sanity 3.94.1 → 3.94.2-next.0.91a5116c07

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 (113) hide show
  1. package/lib/_chunks-cjs/version.js +1 -1
  2. package/lib/_chunks-es/version.mjs +1 -1
  3. package/package.json +25 -25
  4. package/dist/BehaviorSubject-CU-WJrzA.mjs +0 -30
  5. package/dist/BehaviorSubject-CU-WJrzA.mjs.map +0 -1
  6. package/dist/BroadcastDisplayedDocument-BSV9T3BU.mjs +0 -20
  7. package/dist/BroadcastDisplayedDocument-BSV9T3BU.mjs.map +0 -1
  8. package/dist/DisplayedDocumentBroadcaster-DZ65n35Q.mjs +0 -62
  9. package/dist/DisplayedDocumentBroadcaster-DZ65n35Q.mjs.map +0 -1
  10. package/dist/LiveQueries-Crz53eU5.mjs +0 -407
  11. package/dist/LiveQueries-Crz53eU5.mjs.map +0 -1
  12. package/dist/Observable-CCQtH8Gg.mjs +0 -546
  13. package/dist/Observable-CCQtH8Gg.mjs.map +0 -1
  14. package/dist/PostMessageDocuments-BjgsJxz4.mjs +0 -72
  15. package/dist/PostMessageDocuments-BjgsJxz4.mjs.map +0 -1
  16. package/dist/PostMessagePerspective-pucY-E6a.mjs +0 -22
  17. package/dist/PostMessagePerspective-pucY-E6a.mjs.map +0 -1
  18. package/dist/PostMessagePreviewSnapshots-CRQgRg4_.mjs +0 -71
  19. package/dist/PostMessagePreviewSnapshots-CRQgRg4_.mjs.map +0 -1
  20. package/dist/PostMessageRefreshMutations-D944RbO3.mjs +0 -66
  21. package/dist/PostMessageRefreshMutations-D944RbO3.mjs.map +0 -1
  22. package/dist/PostMessageSchema-3eOtr1bs.mjs +0 -516
  23. package/dist/PostMessageSchema-3eOtr1bs.mjs.map +0 -1
  24. package/dist/PostMessageTelemetry-DMTQDJeN.mjs +0 -20
  25. package/dist/PostMessageTelemetry-DMTQDJeN.mjs.map +0 -1
  26. package/dist/PresentationToolGrantsCheck-B0q4AQ3b.mjs +0 -3999
  27. package/dist/PresentationToolGrantsCheck-B0q4AQ3b.mjs.map +0 -1
  28. package/dist/QRCodeSVG-hyTW2xeN.mjs +0 -648
  29. package/dist/QRCodeSVG-hyTW2xeN.mjs.map +0 -1
  30. package/dist/Refractor-Zss2QEe8.mjs +0 -2568
  31. package/dist/Refractor-Zss2QEe8.mjs.map +0 -1
  32. package/dist/SourceContext-QxJD1Wrm.mjs +0 -111
  33. package/dist/SourceContext-QxJD1Wrm.mjs.map +0 -1
  34. package/dist/StructureToolProvider-B-7cwz7l.mjs +0 -2287
  35. package/dist/StructureToolProvider-B-7cwz7l.mjs.map +0 -1
  36. package/dist/ViteDevServerStopped-CgIEqy9p.mjs +0 -57
  37. package/dist/ViteDevServerStopped-CgIEqy9p.mjs.map +0 -1
  38. package/dist/_createContext.mjs +0 -38
  39. package/dist/_createContext.mjs.map +0 -1
  40. package/dist/_singletons.mjs +0 -216
  41. package/dist/_singletons.mjs.map +0 -1
  42. package/dist/browser-B0Q9qZJS.mjs +0 -478
  43. package/dist/browser-B0Q9qZJS.mjs.map +0 -1
  44. package/dist/browser-DmX5VEcE.mjs +0 -324
  45. package/dist/browser-DmX5VEcE.mjs.map +0 -1
  46. package/dist/desk.mjs +0 -53
  47. package/dist/desk.mjs.map +0 -1
  48. package/dist/first-Cz545eV-.mjs +0 -42
  49. package/dist/first-Cz545eV-.mjs.map +0 -1
  50. package/dist/index-B2GCDfau.mjs +0 -96
  51. package/dist/index-B2GCDfau.mjs.map +0 -1
  52. package/dist/index-BRIelBPK.mjs +0 -6946
  53. package/dist/index-BRIelBPK.mjs.map +0 -1
  54. package/dist/index-BUB137yJ.mjs +0 -144
  55. package/dist/index-BUB137yJ.mjs.map +0 -1
  56. package/dist/index-C3PGPrdL.mjs +0 -1192
  57. package/dist/index-C3PGPrdL.mjs.map +0 -1
  58. package/dist/index-C9NvTy6s.mjs +0 -319
  59. package/dist/index-C9NvTy6s.mjs.map +0 -1
  60. package/dist/index-DCkQlgdi.mjs +0 -4001
  61. package/dist/index-DCkQlgdi.mjs.map +0 -1
  62. package/dist/index-DG-3plB0.mjs +0 -71
  63. package/dist/index-DG-3plB0.mjs.map +0 -1
  64. package/dist/index-RoxwhtVB.mjs +0 -5600
  65. package/dist/index-RoxwhtVB.mjs.map +0 -1
  66. package/dist/index-iMZR29eF.mjs +0 -756
  67. package/dist/index-iMZR29eF.mjs.map +0 -1
  68. package/dist/index-wVXq9rWS.mjs +0 -244
  69. package/dist/index-wVXq9rWS.mjs.map +0 -1
  70. package/dist/index.mjs +0 -137385
  71. package/dist/index.mjs.map +0 -1
  72. package/dist/lodash-Vz5dH_Dm.mjs +0 -3679
  73. package/dist/lodash-Vz5dH_Dm.mjs.map +0 -1
  74. package/dist/pane-Bm_57XKB.mjs +0 -5
  75. package/dist/pane-Bm_57XKB.mjs.map +0 -1
  76. package/dist/pane-Dopl4BjD.mjs +0 -5
  77. package/dist/pane-Dopl4BjD.mjs.map +0 -1
  78. package/dist/presentation-DsIky7Cj.mjs +0 -556
  79. package/dist/presentation-DsIky7Cj.mjs.map +0 -1
  80. package/dist/presentation.mjs +0 -10
  81. package/dist/presentation.mjs.map +0 -1
  82. package/dist/publishReplay-PuJoYJpp.mjs +0 -92
  83. package/dist/publishReplay-PuJoYJpp.mjs.map +0 -1
  84. package/dist/refractor-Bg1S3YDK.mjs +0 -26
  85. package/dist/refractor-Bg1S3YDK.mjs.map +0 -1
  86. package/dist/resources-BQsCEzu1.mjs +0 -60
  87. package/dist/resources-BQsCEzu1.mjs.map +0 -1
  88. package/dist/resources-BahMtJuO.mjs +0 -177
  89. package/dist/resources-BahMtJuO.mjs.map +0 -1
  90. package/dist/resources-CjkBN4z6.mjs +0 -126
  91. package/dist/resources-CjkBN4z6.mjs.map +0 -1
  92. package/dist/resources-Dc-6ZcPg.mjs +0 -157
  93. package/dist/resources-Dc-6ZcPg.mjs.map +0 -1
  94. package/dist/resources-DqxSuDsr.mjs +0 -37
  95. package/dist/resources-DqxSuDsr.mjs.map +0 -1
  96. package/dist/resources-_gTjFWLH.mjs +0 -517
  97. package/dist/resources-_gTjFWLH.mjs.map +0 -1
  98. package/dist/resources-kA1bao30.mjs +0 -358
  99. package/dist/resources-kA1bao30.mjs.map +0 -1
  100. package/dist/router.mjs +0 -721
  101. package/dist/router.mjs.map +0 -1
  102. package/dist/stegaEncodeSourceMap-DCG9Ba1H.mjs +0 -358
  103. package/dist/stegaEncodeSourceMap-DCG9Ba1H.mjs.map +0 -1
  104. package/dist/structure.mjs +0 -57
  105. package/dist/structure.mjs.map +0 -1
  106. package/dist/structureTool-Bth1vd8r.mjs +0 -13150
  107. package/dist/structureTool-Bth1vd8r.mjs.map +0 -1
  108. package/dist/switchMap-DHVUskpL.mjs +0 -54
  109. package/dist/switchMap-DHVUskpL.mjs.map +0 -1
  110. package/dist/v4-zH-CAum7.mjs +0 -24798
  111. package/dist/v4-zH-CAum7.mjs.map +0 -1
  112. package/dist/version-DoE_JnhG.mjs +0 -5
  113. package/dist/version-DoE_JnhG.mjs.map +0 -1
@@ -1,3999 +0,0 @@
1
- import { jsx as u, jsxs as G, Fragment as Ue } from "react/jsx-runtime";
2
- import { d as N } from "./index-C9NvTy6s.mjs";
3
- import { a as Or, b as Wr, D as Jt, M as Yt, d as Zt, e as er, f as tr, g as rr, h as nr, s as ir, i as ie, v as Nr, u as re, S as zr, j as or, c as _t, k as sr, l as ge, m as Dr, n as ar } from "./index-DCkQlgdi.mjs";
4
- import { p as _e, a as Ct, P as cr, b as At, c as Tt, d as He, e as Qe, f as kt, g as Mt, s as Ye, h as $t, t as It, A as lt, i as lr, j as Ft, k as jr, l as Fr, D as Br, E as Vr, S as Kr, m as ur, n as Hr, o as Gr } from "./presentation-DsIky7Cj.mjs";
5
- import { B as Ie, u as dr, T as Xe, M as qr, D as Qr, F as Xr, G as Jr, H as pr, I as Yr } from "./index-RoxwhtVB.mjs";
6
- import { a2 as Bt, a3 as Zr, a4 as en, C as he, T as oe, S as De, a5 as tn, B as ye, F as le, a as rn, s as it, a6 as ot, W as nn, b as Ze, a7 as on, a8 as sn, a9 as an, k as st, w as ut, aa as cn, ab as ln, ac as fr, ad as mr, ae as un, af as dn, ag as pn, ah as fn, ai as mn, D as hn, Z as vn, aj as gn, ak as wn, e as at, al as yn, v as hr } from "./v4-zH-CAum7.mjs";
7
- import { useContext as Ut, useMemo as ke, memo as dt, useEffect as K, useRef as ve, useLayoutEffect as Je, useState as z, forwardRef as pt, Suspense as Lt, useId as Pn, useImperativeHandle as vr, lazy as Ne, useCallback as pe, useSyncExternalStore as bn, useReducer as Sn } from "react";
8
- import { useTranslation as xe, useUnique as gr, getPublishedId as ft, useDocumentPreviewStore as _n, usePerspective as Ot, getPreviewStateObservable as xn, useSchema as En, getPreviewValueWithFallback as Rn, SanityDefaultPreview as Cn, PreviewCard as An, Translate as Wt, CommentsIntentProvider as Tn, useActiveWorkspace as wr, useClient as mt, useCurrentUser as yr, useProjectId as kn, useDataset as Mn, useWorkspace as $n, COMMENTS_INSPECTOR_NAME as In, useGrantsStore as Un } from "sanity";
9
- import { StateLink as ht, useRouter as et, decodeJsonParams as Ln } from "sanity/router";
10
- import { styled as Pe, createGlobalStyle as On } from "styled-components";
11
- import { PresentationSharedStateContext as Wn, PresentationPanelsContext as Nt, PresentationNavigateContext as Nn, PresentationParamsContext as zn, PresentationContext as Dn } from "sanity/_singletons";
12
- import { PaneRouterContext as jn, PaneLayout as Pr, DocumentListPane as Fn, StructureToolProvider as Bn, DocumentPane as Vn } from "sanity/structure";
13
- import { A as Kn } from "./StructureToolProvider-B-7cwz7l.mjs";
14
- import { D as Hn, i as Gn } from "./DisplayedDocumentBroadcaster-DZ65n35Q.mjs";
15
- import { flushSync as qn } from "react-dom";
16
- function Qn({ children: t, isValidProp: e, ...r }) {
17
- e && en(e), r = { ...Ut(Bt), ...r }, r.isStatic = Zr(() => r.isStatic);
18
- const n = ke(() => r, [
19
- JSON.stringify(r.transition),
20
- r.transformPagePoint,
21
- r.reducedMotion
22
- ]);
23
- return u(Bt.Provider, { value: n, children: t });
24
- }
25
- const Xn = {
26
- "handshake/syn": nr,
27
- "handshake/syn-ack": rr,
28
- "handshake/ack": tr,
29
- "channel/response": er,
30
- "channel/heartbeat": Zt,
31
- "channel/disconnect": Yt,
32
- "overlay/focus": "visual-editing/focus",
33
- "overlay/navigate": "visual-editing/navigate",
34
- "overlay/toggle": "visual-editing/toggle",
35
- "presentation/toggleOverlay": "presentation/toggle-overlay"
36
- }, Jn = {
37
- [nr]: "handshake/syn",
38
- [rr]: "handshake/syn-ack",
39
- [tr]: "handshake/ack",
40
- [er]: "channel/response",
41
- [Zt]: "channel/heartbeat",
42
- [Yt]: "channel/disconnect",
43
- "visual-editing/focus": "overlay/focus",
44
- "visual-editing/navigate": "overlay/navigate",
45
- "visual-editing/toggle": "overlay/toggle",
46
- "presentation/toggle-overlay": "presentation/toggleOverlay"
47
- }, Yn = (t) => {
48
- const { data: e } = t;
49
- return e && typeof e == "object" && "domain" in e && "type" in e && "from" in e && "to" in e && (e.domain === "sanity/channels" && (e.domain = Jt), e.to === "overlays" && (e.to = "visual-editing"), e.from === "overlays" && (e.from = "visual-editing"), e.channelId = e.connectionId, delete e.connectionId, e.type = Xn[e.type] ?? e.type), t;
50
- }, Zn = (t) => {
51
- const { channelId: e, ...r } = t, n = { ...r, connectionId: e };
52
- return n.domain === Jt && (n.domain = "sanity/channels"), n.to === "visual-editing" && (n.to = "overlays"), n.from === "visual-editing" && (n.from = "overlays"), n.type = Jn[n.type] ?? n.type, n.type === "channel/response" && n.responseTo && !n.data && (n.data = { responseTo: n.responseTo }), (n.type === "handshake/syn" || n.type === "handshake/syn-ack" || n.type === "handshake/ack") && (n.data = { id: n.connectionId }), n;
53
- }, ei = ({ context: t }, e) => {
54
- const { sources: r, targetOrigin: n } = t, o = Zn(e.message);
55
- r.forEach((i) => {
56
- i.postMessage(o, { targetOrigin: n });
57
- });
58
- }, xt = () => ({
59
- listen: Wr(Yn),
60
- requestMachine: Or().provide({
61
- actions: {
62
- "send message": ei
63
- }
64
- })
65
- }), ti = (t) => {
66
- const e = N.c(3), {
67
- comlink: r
68
- } = t;
69
- let n, o;
70
- return e[0] !== r ? (n = () => r.on("visual-editing/features", ni), o = [r], e[0] = r, e[1] = n, e[2] = o) : (n = e[1], o = e[2]), K(n, o), null;
71
- }, ri = dt(ti);
72
- function ni() {
73
- return {
74
- features: {
75
- optimistic: !0
76
- }
77
- };
78
- }
79
- const ii = ir({
80
- actions: {
81
- //
82
- },
83
- actors: {
84
- //
85
- },
86
- guards: {
87
- //
88
- }
89
- }).createMachine({
90
- // eslint-disable-next-line tsdoc/syntax
91
- /** @xstate-layout N4IgpgJg5mDOIC5QAUBOcwDsAuBDbAlgPaYAEAKkUQDYDEBAZqrgLZinrVG4QDaADAF1EoAA5FYBQiREgAHogAsAJgA0IAJ6IAHAEYAdIoCcJowFY9R-vzPLlAX3vq0GHPmJlKNfVx4FMUPRMrOy+EJACwkgg4pLSmLIKCLoAbIr6Zoop2tqKAMxpJnnF6loIZkbK+uZ5umapKXmK-Cm6js7osFh48RRU1D7c4RC02ERQUNTsAG4EsACuuNSkkFL+UKRE02Co1LgasJGysWsy0UnaZinVyrpGAOx1Rim2efeliPe3hma1Zvy6XT8W4OJwgFxdNy9LwDMKQILMNgcMBMOAACyO0RO8USiAK930LWU-3uiiB9yaKXemkQjW01V+txS-GKqUe7XBnW67hIfW8cJGjER7E4Q0xYgkpwS5zxVMJKWJ-FJ5Mp1LKFn4Pz+DSaLTaYIh3Oh-UGPEg+nQqNgaPWCJCpAF4pikpxMoQKWZ+gp+TSZLy1hSH3deXpNSZLNqVP1HVcPQ8fNhQ3Nor8ATtSMdQmOLo8uPdnu9BUUfoDQY1WrqOuarUcYMwRHC8Gihqh8Zh2biubdAFpAzSEL2OS247yYfodqgiKgO1K8yog7ptATFL9dFljMDrHkh1zW6OTWF1jPXaAkmY1YgKnktfxtC9dPd+Io9DvYzzPAekxBj13T3i7vKirKkqqpBsYVQ1HUFjFs0t6KK+kIjh+-JfvoBAQFMP5nH+CDaMo16KjYyjMvUNh5GWOT6MoLL8A8ygrk0dQIUabafmaEAWiinQ2gEWHSjhjJUYuj73Pcd63noQaNEYFb-Dk2S0cxe7IYm7GcYevFYjm2HyJeeQQb8tFkikVjGNoFGajUt73o+z61vYQA */
92
- id: "Presentation Tool",
93
- context: {
94
- url: null,
95
- error: null,
96
- visualEditingOverlaysEnabled: !1
97
- },
98
- on: {
99
- "iframe reload": {
100
- actions: ie({
101
- url: null
102
- }),
103
- target: ".loading"
104
- }
105
- },
106
- states: {
107
- error: {
108
- description: "Failed to load, either because of a misconfiguration, a network error, or an unexpected error",
109
- tags: ["error"]
110
- },
111
- loading: {
112
- on: {
113
- "iframe loaded": {
114
- target: "loaded"
115
- }
116
- },
117
- tags: ["busy"]
118
- },
119
- loaded: {
120
- on: {
121
- "toggle visual editing overlays": {
122
- actions: ie({
123
- visualEditingOverlaysEnabled: ({
124
- event: t
125
- }) => t.enabled
126
- })
127
- },
128
- "iframe refresh": {
129
- target: ".refreshing"
130
- },
131
- "iframe reload": {
132
- target: ".reloading"
133
- }
134
- },
135
- states: {
136
- idle: {},
137
- refreshing: {
138
- on: {
139
- "iframe loaded": {
140
- target: "idle"
141
- }
142
- },
143
- tags: ["busy"]
144
- },
145
- reloading: {
146
- on: {
147
- "iframe loaded": {
148
- target: "idle"
149
- }
150
- },
151
- tags: ["busy"]
152
- }
153
- },
154
- initial: "idle"
155
- }
156
- },
157
- initial: "loading"
158
- }), oi = function(t) {
159
- const e = N.c(14), {
160
- comlink: r,
161
- children: n
162
- } = t;
163
- let o;
164
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {}, e[0] = o) : o = e[0];
165
- const i = ve(o);
166
- let s, c;
167
- e[1] !== r ? (s = () => r == null ? void 0 : r.on("visual-editing/shared-state", () => ({
168
- state: i.current
169
- })), c = [r], e[1] = r, e[2] = s, e[3] = c) : (s = e[2], c = e[3]), K(s, c);
170
- let a;
171
- e[4] !== r ? (a = (h, v) => {
172
- i.current[h] = v, r == null || r.post("presentation/shared-state", {
173
- key: h,
174
- value: v
175
- });
176
- }, e[4] = r, e[5] = a) : a = e[5];
177
- const l = a;
178
- let p;
179
- e[6] !== r ? (p = (h) => {
180
- r == null || r.post("presentation/shared-state", {
181
- key: h
182
- }), delete i.current[h];
183
- }, e[6] = r, e[7] = p) : p = e[7];
184
- const f = p;
185
- let d, m;
186
- e[8] !== f || e[9] !== l ? (m = {
187
- removeValue: f,
188
- setValue: l
189
- }, e[8] = f, e[9] = l, e[10] = m) : m = e[10], d = m;
190
- const g = d;
191
- let P;
192
- return e[11] !== n || e[12] !== g ? (P = /* @__PURE__ */ u(Wn.Provider, { value: g, children: n }), e[11] = n, e[12] = g, e[13] = P) : P = e[13], P;
193
- }, si = Pe.div`
194
- overflow: hidden;
195
- flex-basis: 0;
196
- flex-shrink: 1;
197
- `, zt = function(t) {
198
- const e = N.c(15), {
199
- children: r,
200
- defaultSize: n,
201
- id: o,
202
- minWidth: i,
203
- maxWidth: s,
204
- order: c
205
- } = t, a = n === void 0 ? null : n, l = c === void 0 ? 0 : c, p = Ut(Nt);
206
- if (p === null)
207
- throw Error("Panel components must be rendered within a PanelGroup container");
208
- const {
209
- getPanelStyle: f,
210
- registerElement: d,
211
- unregisterElement: m
212
- } = p;
213
- let g;
214
- e[0] !== f || e[1] !== o ? (g = f(o), e[0] = f, e[1] = o, e[2] = g) : g = e[2];
215
- const P = g;
216
- let h, v;
217
- e[3] !== a || e[4] !== o || e[5] !== s || e[6] !== i || e[7] !== l || e[8] !== d || e[9] !== m ? (h = () => (d(o, {
218
- id: o,
219
- type: "panel",
220
- defaultSize: a,
221
- maxWidth: s ?? null,
222
- minWidth: i ?? 0,
223
- order: l
224
- }), () => {
225
- m(o);
226
- }), v = [o, a, l, s, i, d, m], e[3] = a, e[4] = o, e[5] = s, e[6] = i, e[7] = l, e[8] = d, e[9] = m, e[10] = h, e[11] = v) : (h = e[10], v = e[11]), Je(h, v);
227
- let S;
228
- return e[12] !== r || e[13] !== P ? (S = /* @__PURE__ */ u(si, { style: P, children: r }), e[12] = r, e[13] = P, e[14] = S) : S = e[14], S;
229
- };
230
- function br(t, e) {
231
- let r;
232
- return (...n) => {
233
- clearTimeout(r), r = setTimeout(() => {
234
- t.apply(t, n);
235
- }, e);
236
- };
237
- }
238
- const Sr = "presentation/panels", _r = () => JSON.parse(localStorage.getItem(Sr) || "{}"), ai = (t) => {
239
- localStorage.setItem(Sr, JSON.stringify(t));
240
- }, xr = (t) => t.map((e) => [e.id, e.order].join(":")).join(",");
241
- function ci() {
242
- const t = N.c(1);
243
- let e;
244
- const r = ui, n = li;
245
- let o;
246
- if (t[0] === Symbol.for("react.memo_cache_sentinel")) {
247
- const i = br(n, 100);
248
- o = {
249
- get: r,
250
- set: n,
251
- setDebounced: i
252
- }, t[0] = o;
253
- } else
254
- o = t[0];
255
- return e = o, e;
256
- }
257
- function li(t, e) {
258
- const r = _r(), n = xr(t), o = {
259
- ...r,
260
- [n]: e
261
- };
262
- ai(o);
263
- }
264
- function ui(t) {
265
- const e = _r(), r = xr(t);
266
- return Array.isArray(e[r]) && e[r].some(di) ? void 0 : e[r];
267
- }
268
- function di(t) {
269
- return t === null;
270
- }
271
- function Et(t, e, r) {
272
- const {
273
- maxWidth: n,
274
- minWidth: o
275
- } = t, i = n == null ? 100 : n / r * 100, s = o / r * 100;
276
- return Math.min(i, Math.max(s, e));
277
- }
278
- function pi(t, e, r, n, o, i) {
279
- const {
280
- panels: s,
281
- widths: c
282
- } = o, {
283
- widths: a
284
- } = i, l = a || c, p = [...l];
285
- {
286
- const g = t < 0 ? n : r, P = s.findIndex((S) => S.id === g.id), h = l[P], v = Et(g, h + Math.abs(t), e);
287
- if (h === v)
288
- return l;
289
- t = t < 0 ? h - v : v - h;
290
- }
291
- let f = 0, d = t < 0 ? r : n, m = s.findIndex((g) => g.id === d.id);
292
- for (; ; ) {
293
- const g = s[m], P = l[m], h = Math.abs(t) - Math.abs(f), v = Et(g, P - h, e);
294
- if (P !== v && (f += P - v, p[m] = v, f.toPrecision(10).localeCompare(Math.abs(t).toPrecision(10), void 0, {
295
- numeric: !0
296
- }) >= 0))
297
- break;
298
- if (t < 0) {
299
- if (--m < 0)
300
- break;
301
- } else if (++m >= s.length)
302
- break;
303
- }
304
- return f === 0 ? l : (d = t < 0 ? n : r, m = s.findIndex((g) => g.id === d.id), p[m] = l[m] + f, p);
305
- }
306
- function fi(t, e, r) {
307
- if (t.length === 1) return "100";
308
- const n = t.findIndex((i) => i.id === e), o = r[n];
309
- return o == null ? "0" : o.toPrecision(10);
310
- }
311
- function Vt(t, e, r = 0, n = null) {
312
- const o = t.clientX, s = (n || e.getBoundingClientRect()).left;
313
- return o - s - r;
314
- }
315
- function wt(t) {
316
- return t.type === "panel";
317
- }
318
- function Kt(t) {
319
- return t.type === "resizer";
320
- }
321
- function Ht(t) {
322
- return Array.from(t.values()).sort(({
323
- order: e
324
- }, {
325
- order: r
326
- }) => e == null && r == null ? 0 : e == null ? -1 : r == null ? 1 : e - r);
327
- }
328
- function Gt(t, e, r) {
329
- const n = e.reduce((s, c) => s + c, 0), o = [...e].map((s) => s / n * 100);
330
- let i = 0;
331
- for (let s = 0; s < t.length; s++) {
332
- const c = t[s], a = o[s], l = Et(c, a, r);
333
- a != l && (i += a - l, o[s] = l);
334
- }
335
- if (i.toFixed(3) !== "0.000")
336
- for (let s = 0; s < t.length; s++) {
337
- const c = t[s];
338
- let {
339
- maxWidth: a,
340
- minWidth: l
341
- } = c;
342
- l = l / r * 100, a != null && (a = a / r * 100);
343
- const p = Math.min(
344
- // eslint-disable-next-line no-negated-condition
345
- a ?? 100,
346
- Math.max(l, o[s] + i)
347
- );
348
- if (p !== o[s] && (i -= p - o[s], o[s] = p, Math.abs(i).toFixed(3) === "0.000"))
349
- break;
350
- }
351
- return o;
352
- }
353
- function mi(t) {
354
- let e = t.length, r = 100;
355
- const n = t.map((s) => s.defaultSize ? (r -= s.defaultSize, e -= 1, s.defaultSize) : null), o = r / e;
356
- return n.map((s) => s === null ? o : s);
357
- }
358
- const hi = Pe.div`
359
- display: flex;
360
- flex-direction: row;
361
- height: 100%;
362
- overflow: hidden;
363
- width: 100%;
364
- `, vi = function(t) {
365
- const e = N.c(46), {
366
- children: r
367
- } = t, n = ve(null);
368
- let o;
369
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ new Map(), e[0] = o) : o = e[0];
370
- const [i, s] = z(o);
371
- let c, a;
372
- e[1] !== i ? (a = Ht(i).filter(wt), e[1] = i, e[2] = a) : a = e[2], c = a;
373
- const l = c;
374
- let p;
375
- e[3] === Symbol.for("react.memo_cache_sentinel") ? (p = [], e[3] = p) : p = e[3];
376
- const [f, d] = z(p), [m, g] = z(null);
377
- let P;
378
- e[4] !== i || e[5] !== l || e[6] !== f ? (P = {
379
- elements: i,
380
- panels: l,
381
- widths: f
382
- }, e[4] = i, e[5] = l, e[6] = f, e[7] = P) : P = e[7];
383
- const h = ve(P);
384
- let v;
385
- e[8] !== m || e[9] !== l || e[10] !== f ? (v = (B) => ({
386
- flexGrow: fi(l, B, f),
387
- pointerEvents: m === null ? void 0 : "none"
388
- }), e[8] = m, e[9] = l, e[10] = f, e[11] = v) : v = e[11];
389
- const S = v;
390
- let b;
391
- e[12] === Symbol.for("react.memo_cache_sentinel") ? (b = (B, H) => {
392
- s((q) => {
393
- if (q.has(B))
394
- return q;
395
- const Y = new Map(q);
396
- return Y.set(B, H), Y;
397
- });
398
- }, e[12] = b) : b = e[12];
399
- const w = b;
400
- let y;
401
- e[13] === Symbol.for("react.memo_cache_sentinel") ? (y = (B) => {
402
- s((H) => {
403
- if (!H.has(B))
404
- return H;
405
- const q = new Map(H);
406
- return q.delete(B), q;
407
- });
408
- }, e[13] = y) : y = e[13];
409
- const _ = y;
410
- let C;
411
- e[14] === Symbol.for("react.memo_cache_sentinel") ? (C = {
412
- containerWidth: window.innerWidth,
413
- dragOffset: 0,
414
- panelAfter: null,
415
- panelBefore: null,
416
- resizerIndex: -1,
417
- resizerRect: null,
418
- startX: 0,
419
- widths: []
420
- }, e[14] = C) : C = e[14];
421
- const E = ve(C);
422
- let R;
423
- e[15] !== i ? (R = (B, H) => {
424
- const q = Ht(i), Y = q.findIndex((V) => V.id === B), de = i.get(B);
425
- if (!de || !Kt(de))
426
- return;
427
- const k = de.el.current;
428
- k && (E.current = {
429
- resizerIndex: Y,
430
- panelBefore: q.reduce((V, j, ce) => wt(j) && ce < Y ? j : V, null),
431
- panelAfter: q.reduce((V, j, ce) => V === null && wt(j) && ce > Y ? j : V, null),
432
- containerWidth: window.innerWidth,
433
- startX: H.pageX,
434
- dragOffset: Vt(H, k),
435
- resizerRect: k.getBoundingClientRect(),
436
- widths: h.current.widths
437
- }, g(B));
438
- }, e[15] = i, e[16] = R) : R = e[16];
439
- const A = R;
440
- let x;
441
- e[17] === Symbol.for("react.memo_cache_sentinel") ? (x = () => {
442
- g(null);
443
- }, e[17] = x) : x = e[17];
444
- const U = x;
445
- let I;
446
- e[18] !== i ? (I = (B, H) => {
447
- H.preventDefault(), H.stopPropagation();
448
- const {
449
- containerWidth: q,
450
- dragOffset: Y,
451
- panelBefore: de,
452
- panelAfter: k,
453
- resizerRect: V
454
- } = E.current;
455
- if (de == null || k == null)
456
- return;
457
- const j = i.get(B);
458
- if (!j || !Kt(j))
459
- return;
460
- const ce = j.el.current;
461
- if (!ce)
462
- return;
463
- const fe = Vt(H, ce, Y, V);
464
- if (fe === 0)
465
- return;
466
- const {
467
- widths: Ee
468
- } = h.current, Re = n.current.getBoundingClientRect(), Ce = fe / Re.width * 100, we = pi(Ce, q, de, k, h.current, E.current);
469
- Ee.some((be, Ae) => be !== we[Ae]) && d(we);
470
- }, e[18] = i, e[19] = I) : I = e[19];
471
- const T = I;
472
- let $, W;
473
- e[20] !== i || e[21] !== l || e[22] !== f ? ($ = () => {
474
- h.current.elements = i, h.current.panels = l, h.current.widths = f;
475
- }, W = [i, l, f], e[20] = i, e[21] = l, e[22] = f, e[23] = $, e[24] = W) : ($ = e[23], W = e[24]), Je($, W);
476
- const D = ci();
477
- let F, Z;
478
- e[25] !== l || e[26] !== D ? (F = () => {
479
- const {
480
- widths: B
481
- } = h.current;
482
- if (B.length === l.length)
483
- return;
484
- const H = D.get(l);
485
- if (H) {
486
- const Y = Gt(l, H, window.innerWidth);
487
- d(Y);
488
- return;
489
- }
490
- const q = mi(l);
491
- d(q);
492
- }, Z = [D, l], e[25] = l, e[26] = D, e[27] = F, e[28] = Z) : (F = e[27], Z = e[28]), Je(F, Z);
493
- let Q, X;
494
- e[29] !== l || e[30] !== D || e[31] !== f ? (Q = () => {
495
- f.length && D.setDebounced(l, f);
496
- }, X = [D, l, f], e[29] = l, e[30] = D, e[31] = f, e[32] = Q, e[33] = X) : (Q = e[32], X = e[33]), K(Q, X);
497
- let ne, ee;
498
- e[34] === Symbol.for("react.memo_cache_sentinel") ? (ne = () => {
499
- const B = new ResizeObserver(() => {
500
- const {
501
- panels: H,
502
- widths: q
503
- } = h.current, Y = Gt(H, q, window.innerWidth);
504
- q.some((k, V) => k !== Y[V]) && d(Y);
505
- });
506
- return B.observe(n.current), () => {
507
- B.disconnect();
508
- };
509
- }, ee = [], e[34] = ne, e[35] = ee) : (ne = e[34], ee = e[35]), Je(ne, ee);
510
- let se, J;
511
- e[36] !== m || e[37] !== T || e[38] !== S || e[39] !== A ? (J = {
512
- activeResizer: m,
513
- drag: T,
514
- getPanelStyle: S,
515
- registerElement: w,
516
- startDragging: A,
517
- stopDragging: U,
518
- unregisterElement: _
519
- }, e[36] = m, e[37] = T, e[38] = S, e[39] = A, e[40] = J) : J = e[40], se = J;
520
- const ue = se;
521
- let ae;
522
- e[41] !== r ? (ae = /* @__PURE__ */ u(hi, { ref: n, children: r }), e[41] = r, e[42] = ae) : ae = e[42];
523
- let te;
524
- return e[43] !== ue || e[44] !== ae ? (te = /* @__PURE__ */ u(Nt.Provider, { value: ue, children: ae }), e[43] = ue, e[44] = ae, e[45] = te) : te = e[45], te;
525
- };
526
- function Dt(t) {
527
- const e = N.c(37);
528
- let r, n, o, i, s;
529
- e[0] !== t ? ({
530
- children: r,
531
- message: n,
532
- onRetry: i,
533
- onContinueAnyway: o,
534
- ...s
535
- } = t, e[0] = t, e[1] = r, e[2] = n, e[3] = o, e[4] = i, e[5] = s) : (r = e[1], n = e[2], o = e[3], i = e[4], s = e[5]);
536
- const {
537
- t: c
538
- } = xe(_e);
539
- let a;
540
- e[6] !== c ? (a = c("error-card.retry-button.text"), e[6] = c, e[7] = a) : a = e[7];
541
- let l;
542
- e[8] !== i || e[9] !== a ? (l = /* @__PURE__ */ u(Ie, { mode: "ghost", onClick: i, text: a }), e[8] = i, e[9] = a, e[10] = l) : l = e[10];
543
- const p = l;
544
- let f;
545
- e[11] !== c ? (f = c("error-card.continue-button.text"), e[11] = c, e[12] = f) : f = e[12];
546
- let d;
547
- e[13] !== o || e[14] !== f ? (d = /* @__PURE__ */ u(Ie, { mode: "ghost", tone: "critical", onClick: o, text: f }), e[13] = o, e[14] = f, e[15] = d) : d = e[15];
548
- const m = d;
549
- let g;
550
- e[16] !== c ? (g = c("error-card.title"), e[16] = c, e[17] = g) : g = e[17];
551
- let P;
552
- e[18] !== g ? (P = /* @__PURE__ */ u(oe, { size: 1, weight: "semibold", children: g }), e[18] = g, e[19] = P) : P = e[19];
553
- let h;
554
- e[20] !== n ? (h = /* @__PURE__ */ u(oe, { muted: !0, size: 1, children: n }), e[20] = n, e[21] = h) : h = e[21];
555
- let v;
556
- e[22] !== P || e[23] !== h ? (v = /* @__PURE__ */ G(De, { space: 3, children: [
557
- P,
558
- h
559
- ] }), e[22] = P, e[23] = h, e[24] = v) : v = e[24];
560
- let S;
561
- e[25] !== m || e[26] !== o || e[27] !== i || e[28] !== p ? (S = i && o ? /* @__PURE__ */ G(tn, { space: 2, children: [
562
- p,
563
- m
564
- ] }) : i ? /* @__PURE__ */ u(ye, { children: p }) : o ? /* @__PURE__ */ u(ye, { children: m }) : null, e[25] = m, e[26] = o, e[27] = i, e[28] = p, e[29] = S) : S = e[29];
565
- let b;
566
- e[30] !== r || e[31] !== v || e[32] !== S ? (b = /* @__PURE__ */ u(le, { align: "center", height: "fill", justify: "center", children: /* @__PURE__ */ u(rn, { padding: 4, sizing: "border", width: 0, children: /* @__PURE__ */ G(De, { space: 4, children: [
567
- v,
568
- r,
569
- S
570
- ] }) }) }), e[30] = r, e[31] = v, e[32] = S, e[33] = b) : b = e[33];
571
- let w;
572
- return e[34] !== s || e[35] !== b ? (w = /* @__PURE__ */ u(he, { height: "fill", ...s, children: b }), e[34] = s, e[35] = b, e[36] = w) : w = e[36], w;
573
- }
574
- function gi(t = {}) {
575
- const e = Object.entries(t).map(([r, n]) => `${r}=${n}`).join("&");
576
- return e.length ? `?${e}` : "";
577
- }
578
- function wi(t) {
579
- const e = ["comment", "inspect", "instruction", "pathKey", "rev", "since", "template", "view"], r = Object.entries(t).filter(([n]) => e.includes(n)).reduce((n, [o, i]) => i == null ? n : {
580
- ...n,
581
- [o]: i
582
- }, {});
583
- return gi(r);
584
- }
585
- const yi = pt(function(e, r) {
586
- const n = N.c(11);
587
- let o, i;
588
- n[0] !== e ? ({
589
- searchParams: i,
590
- ...o
591
- } = e, n[0] = e, n[1] = o, n[2] = i) : (o = n[1], i = n[2]);
592
- let s;
593
- n[3] !== i ? (s = Object.entries(i), n[3] = i, n[4] = s) : s = n[4];
594
- let c;
595
- n[5] !== s ? (c = {
596
- type: void 0,
597
- _searchParams: s
598
- }, n[5] = s, n[6] = c) : c = n[6];
599
- let a;
600
- return n[7] !== r || n[8] !== o || n[9] !== c ? (a = /* @__PURE__ */ u(ht, { ...o, ref: r, state: c, title: void 0 }), n[7] = r, n[8] = o, n[9] = c, n[10] = a) : a = n[10], a;
601
- }), Pi = pt(function(e, r) {
602
- const n = N.c(15);
603
- let o, i, s, c;
604
- if (n[0] !== e) {
605
- const {
606
- documentId: f,
607
- documentType: d,
608
- parentRefPath: m,
609
- template: g,
610
- searchParams: P,
611
- ...h
612
- } = e;
613
- o = f, i = d, c = P, s = h, n[0] = e, n[1] = o, n[2] = i, n[3] = s, n[4] = c;
614
- } else
615
- o = n[1], i = n[2], s = n[3], c = n[4];
616
- let a;
617
- n[5] !== c ? (a = Object.entries(c), n[5] = c, n[6] = a) : a = n[6];
618
- let l;
619
- n[7] !== o || n[8] !== i || n[9] !== a ? (l = {
620
- id: o,
621
- type: i,
622
- _searchParams: a
623
- }, n[7] = o, n[8] = i, n[9] = a, n[10] = l) : l = n[10];
624
- let p;
625
- return n[11] !== r || n[12] !== s || n[13] !== l ? (p = /* @__PURE__ */ u(ht, { ...s, ref: r, state: l, title: void 0 }), n[11] = r, n[12] = s, n[13] = l, n[14] = p) : p = n[14], p;
626
- });
627
- function Er(t) {
628
- const e = N.c(26), {
629
- children: r,
630
- onStructureParams: n,
631
- structureParams: o,
632
- searchParams: i,
633
- refs: s
634
- } = t, {
635
- state: c,
636
- resolvePathFromState: a
637
- } = et();
638
- let l;
639
- e[0] !== c._searchParams ? (l = Object.fromEntries(c._searchParams || []), e[0] = c._searchParams, e[1] = l) : l = e[1];
640
- const p = gr(l);
641
- let f;
642
- e[2] !== a || e[3] !== p || e[4] !== c ? (f = (E) => {
643
- const R = a(c), A = wi({
644
- ...p,
645
- ...E
646
- });
647
- return `${R}${A}`;
648
- }, e[2] = a, e[3] = p, e[4] = c, e[5] = f) : f = e[5];
649
- const d = f;
650
- let m, g;
651
- e[6] === Symbol.for("react.memo_cache_sentinel") ? (g = {}, e[6] = g) : g = e[6];
652
- const P = o;
653
- let h;
654
- e[7] === Symbol.for("react.memo_cache_sentinel") ? (h = [], e[7] = h) : h = e[7];
655
- let v;
656
- e[8] !== s || e[9] !== i ? (v = (E) => {
657
- const {
658
- childId: R,
659
- ...A
660
- } = E, x = s == null ? void 0 : s.find((U) => U._id === R || ft(U._id) === R);
661
- return x ? /* @__PURE__ */ u(ht, { ...A, state: {
662
- id: R,
663
- type: x._type,
664
- _searchParams: Object.entries(i)
665
- } }) : /* @__PURE__ */ u("div", { ...A });
666
- }, e[8] = s, e[9] = i, e[10] = v) : v = e[10];
667
- let S, b;
668
- e[11] !== i ? (S = (E) => /* @__PURE__ */ u(yi, { ...E, searchParams: i }), b = (E) => /* @__PURE__ */ u(Pi, { ...E, searchParams: i }), e[11] = i, e[12] = S, e[13] = b) : (S = e[12], b = e[13]);
669
- let w;
670
- e[14] !== n ? (w = (E) => {
671
- n({
672
- ...E,
673
- inspect: E.inspect ?? void 0
674
- });
675
- }, e[14] = n, e[15] = w) : w = e[15];
676
- let y;
677
- e[16] !== d || e[17] !== P || e[18] !== v || e[19] !== S || e[20] !== b || e[21] !== w ? (y = {
678
- index: 0,
679
- groupIndex: 0,
680
- siblingIndex: 0,
681
- payload: g,
682
- params: P,
683
- hasGroupSiblings: !1,
684
- groupLength: 1,
685
- routerPanesState: h,
686
- ChildLink: v,
687
- BackLink: S,
688
- ReferenceChildLink: b,
689
- ParameterizedLink: Ti,
690
- closeCurrentAndAfter: Ai,
691
- handleEditReference: Ci,
692
- replaceCurrent: Ri,
693
- closeCurrent: Ei,
694
- duplicateCurrent: xi,
695
- setView: _i,
696
- setParams: w,
697
- setPayload: Si,
698
- navigateIntent: bi,
699
- createPathWithParams: d
700
- }, e[16] = d, e[17] = P, e[18] = v, e[19] = S, e[20] = b, e[21] = w, e[22] = y) : y = e[22], m = y;
701
- const _ = m;
702
- let C;
703
- return e[23] !== r || e[24] !== _ ? (C = /* @__PURE__ */ u(jn.Provider, { value: _, children: r }), e[23] = r, e[24] = _, e[25] = C) : C = e[25], C;
704
- }
705
- function bi(t, e, r) {
706
- console.warn("navigateIntent", t, e, r);
707
- }
708
- function Si(t) {
709
- console.warn("setPayload", t);
710
- }
711
- function _i(t) {
712
- console.warn("setView", t);
713
- }
714
- function xi(t) {
715
- console.warn("duplicateCurrent", t);
716
- }
717
- function Ei() {
718
- console.warn("closeCurrent");
719
- }
720
- function Ri(t) {
721
- console.warn("replaceCurrent", t);
722
- }
723
- function Ci(t) {
724
- console.warn("handleEditReference", t);
725
- }
726
- function Ai() {
727
- console.warn("closeCurrentAndAfter");
728
- }
729
- function Ti() {
730
- throw new Error("ParameterizedLink not implemented");
731
- }
732
- const ki = Pe(Pr)`
733
- height: 100%;
734
- `, Mi = Pe(le)`
735
- & > div {
736
- min-width: none !important;
737
- max-width: none !important;
738
- }
739
- `, $i = Pe(it)`
740
- white-space: pre-wrap;
741
- `;
742
- function Ii(t) {
743
- var R, A, x, U;
744
- const e = N.c(33), {
745
- mainDocumentState: r,
746
- onStructureParams: n,
747
- searchParams: o,
748
- refs: i
749
- } = t, {
750
- t: s
751
- } = xe(_e), {
752
- devMode: c
753
- } = Ct();
754
- let a, l;
755
- if (e[0] !== ((R = r == null ? void 0 : r.document) == null ? void 0 : R._id) || e[1] !== i) {
756
- let I;
757
- e[3] !== ((A = r == null ? void 0 : r.document) == null ? void 0 : A._id) ? (I = (T) => {
758
- var $;
759
- return ft(T._id) !== (($ = r == null ? void 0 : r.document) == null ? void 0 : $._id);
760
- }, e[3] = (x = r == null ? void 0 : r.document) == null ? void 0 : x._id, e[4] = I) : I = e[4], l = i.filter(I).map(Li), e[0] = (U = r == null ? void 0 : r.document) == null ? void 0 : U._id, e[1] = i, e[2] = l;
761
- } else
762
- l = e[2];
763
- a = l;
764
- const p = a;
765
- let f, d;
766
- e[5] !== p ? (d = {
767
- filter: "_id in $ids",
768
- params: {
769
- ids: p
770
- }
771
- }, e[5] = p, e[6] = d) : d = e[6];
772
- let m;
773
- e[7] !== s ? (m = s("document-list-pane.document-list.title"), e[7] = s, e[8] = m) : m = e[8];
774
- let g;
775
- e[9] !== d || e[10] !== m ? (g = {
776
- id: "$root",
777
- options: d,
778
- schemaTypeName: "",
779
- title: m,
780
- type: "documentList"
781
- }, e[9] = d, e[10] = m, e[11] = g) : g = e[11], f = g;
782
- const P = f, [h, v] = z(null);
783
- let S;
784
- e[12] === Symbol.for("react.memo_cache_sentinel") ? (S = () => v(null), e[12] = S) : S = e[12];
785
- const b = S, [w] = z(Ui);
786
- let y;
787
- e[13] === Symbol.for("react.memo_cache_sentinel") ? (y = () => v(null), e[13] = y) : y = e[13];
788
- let _;
789
- if (e[14] !== i ? (_ = [i], e[14] = i, e[15] = _) : _ = e[15], K(y, _), h) {
790
- let I;
791
- e[16] !== s ? (I = s("document-list-pane.error.text"), e[16] = s, e[17] = I) : I = e[17];
792
- let T;
793
- e[18] !== c || e[19] !== h || e[20] !== s ? (T = c && /* @__PURE__ */ u(he, { overflow: "auto", padding: 3, radius: 2, tone: "critical", children: /* @__PURE__ */ G(De, { space: 3, children: [
794
- /* @__PURE__ */ u(ot, { muted: !0, size: 0, children: s("presentation-error.label") }),
795
- /* @__PURE__ */ u($i, { size: 1, children: h.error.message })
796
- ] }) }), e[18] = c, e[19] = h, e[20] = s, e[21] = T) : T = e[21];
797
- let $;
798
- return e[22] !== T || e[23] !== I ? ($ = /* @__PURE__ */ u(Dt, { flex: 1, message: I, onRetry: b, children: T }), e[22] = T, e[23] = I, e[24] = $) : $ = e[24], $;
799
- }
800
- let C;
801
- e[25] !== P ? (C = /* @__PURE__ */ u(Mi, { direction: "column", flex: 1, children: /* @__PURE__ */ u(Fn, { index: 0, itemId: "$root", pane: P, paneKey: "$root" }) }), e[25] = P, e[26] = C) : C = e[26];
802
- let E;
803
- return e[27] !== n || e[28] !== i || e[29] !== o || e[30] !== w || e[31] !== C ? (E = /* @__PURE__ */ u(dr, { onCatch: v, children: /* @__PURE__ */ u(ki, { children: /* @__PURE__ */ u(Bn, { children: /* @__PURE__ */ u(Er, { onStructureParams: n, structureParams: w, searchParams: o, refs: i, children: C }) }) }) }), e[27] = n, e[28] = i, e[29] = o, e[30] = w, e[31] = C, e[32] = E) : E = e[32], E;
804
- }
805
- function Ui() {
806
- return {};
807
- }
808
- function Li(t) {
809
- return ft(t._id);
810
- }
811
- const Oi = Pe(it)`
812
- white-space: pre-wrap;
813
- `;
814
- function Wi(t) {
815
- const e = N.c(35), {
816
- documentId: r,
817
- documentType: n,
818
- onFocusPath: o,
819
- onStructureParams: i,
820
- searchParams: s,
821
- structureParams: c
822
- } = t, {
823
- template: a,
824
- templateParams: l
825
- } = c, {
826
- t: p
827
- } = xe(_e), {
828
- devMode: f
829
- } = Ct();
830
- let d, m;
831
- e[0] !== l ? (m = Ln(l), e[0] = l, e[1] = m) : m = e[1];
832
- let g;
833
- e[2] !== r || e[3] !== n || e[4] !== m || e[5] !== a ? (g = {
834
- id: r,
835
- type: n,
836
- template: a,
837
- templateParameters: m
838
- }, e[2] = r, e[3] = n, e[4] = m, e[5] = a, e[6] = g) : g = e[6];
839
- let P;
840
- e[7] !== r || e[8] !== g ? (P = {
841
- id: r,
842
- options: g,
843
- title: "",
844
- type: "document"
845
- }, e[7] = r, e[8] = g, e[9] = P) : P = e[9], d = P;
846
- const h = d, [v, S] = z(null);
847
- let b;
848
- e[10] === Symbol.for("react.memo_cache_sentinel") ? (b = () => S(null), e[10] = b) : b = e[10];
849
- const w = b;
850
- let y;
851
- e[11] === Symbol.for("react.memo_cache_sentinel") ? (y = () => {
852
- S(null);
853
- }, e[11] = y) : y = e[11];
854
- let _;
855
- if (e[12] !== r || e[13] !== n || e[14] !== c ? (_ = [r, n, c], e[12] = r, e[13] = n, e[14] = c, e[15] = _) : _ = e[15], K(y, _), v) {
856
- let x;
857
- e[16] !== p ? (x = p("document-pane.error.text"), e[16] = p, e[17] = x) : x = e[17];
858
- let U;
859
- e[18] !== f || e[19] !== v || e[20] !== p ? (U = f && /* @__PURE__ */ u(he, { overflow: "auto", padding: 3, radius: 2, tone: "critical", children: /* @__PURE__ */ G(De, { space: 3, children: [
860
- /* @__PURE__ */ u(ot, { muted: !0, size: 0, children: p("presentation-error.label") }),
861
- /* @__PURE__ */ u(Oi, { size: 1, children: v.error.message })
862
- ] }) }), e[18] = f, e[19] = v, e[20] = p, e[21] = U) : U = e[21];
863
- let I;
864
- return e[22] !== x || e[23] !== U ? (I = /* @__PURE__ */ u(Dt, { flex: 1, message: x, onRetry: w, children: U }), e[22] = x, e[23] = U, e[24] = I) : I = e[24], I;
865
- }
866
- let C;
867
- e[25] === Symbol.for("react.memo_cache_sentinel") ? (C = {
868
- height: "100%"
869
- }, e[25] = C) : C = e[25];
870
- let E;
871
- e[26] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ u(cr, {}), e[26] = E) : E = e[26];
872
- let R;
873
- e[27] !== o || e[28] !== h ? (R = /* @__PURE__ */ u(Lt, { fallback: E, children: /* @__PURE__ */ u(Vn, { paneKey: "document", index: 1, itemId: "document", pane: h, onFocusPath: o }) }), e[27] = o, e[28] = h, e[29] = R) : R = e[29];
874
- let A;
875
- return e[30] !== i || e[31] !== s || e[32] !== c || e[33] !== R ? (A = /* @__PURE__ */ u(dr, { onCatch: S, children: /* @__PURE__ */ u(Pr, { style: C, children: /* @__PURE__ */ u(Er, { searchParams: s, onStructureParams: i, structureParams: c, children: R }) }) }), e[30] = i, e[31] = s, e[32] = c, e[33] = R, e[34] = A) : A = e[34], A;
876
- }
877
- function Ni(t) {
878
- const e = N.c(7), {
879
- documentId: r,
880
- documentType: n,
881
- onFocusPath: o,
882
- onStructureParams: i,
883
- searchParams: s,
884
- structureParams: c
885
- } = t;
886
- let a;
887
- return e[0] !== r || e[1] !== n || e[2] !== o || e[3] !== i || e[4] !== s || e[5] !== c ? (a = /* @__PURE__ */ u(Kn, { children: /* @__PURE__ */ u(Wi, { documentId: r, documentType: n, onFocusPath: o, onStructureParams: i, searchParams: s, structureParams: c }) }), e[0] = r, e[1] = n, e[2] = o, e[3] = i, e[4] = s, e[5] = c, e[6] = a) : a = e[6], a;
888
- }
889
- function zi(t, e) {
890
- const r = N.c(7), n = _n();
891
- let o;
892
- r[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {}, r[0] = o) : o = r[0];
893
- const [i, s] = z(o), {
894
- perspectiveStack: c
895
- } = Ot();
896
- let a, l;
897
- return r[1] !== t || r[2] !== n || r[3] !== c || r[4] !== e ? (a = () => {
898
- if (!e)
899
- return;
900
- const p = xn(n, e, t, c).subscribe((f) => {
901
- s(f);
902
- });
903
- return () => {
904
- p == null || p.unsubscribe();
905
- };
906
- }, l = [n, e, t, c], r[1] = t, r[2] = n, r[3] = c, r[4] = e, r[5] = a, r[6] = l) : (a = r[5], l = r[6]), K(a, l), i;
907
- }
908
- function Di(t) {
909
- var C, E, R, A, x, U, I, T;
910
- const e = N.c(38), {
911
- documentId: r,
912
- documentType: n,
913
- mainDocumentState: o,
914
- onFocusPath: i,
915
- onStructureParams: s,
916
- refs: c,
917
- searchParams: a,
918
- structureParams: l
919
- } = t, {
920
- t: p
921
- } = xe(_e), f = En();
922
- let d;
923
- e[0] !== ((C = o == null ? void 0 : o.document) == null ? void 0 : C._id) || e[1] !== ((E = o == null ? void 0 : o.document) == null ? void 0 : E._type) || e[2] !== a ? (d = ($) => {
924
- var W, D;
925
- return /* @__PURE__ */ u(ht, { ...$, state: {
926
- id: (W = o == null ? void 0 : o.document) == null ? void 0 : W._id,
927
- type: (D = o == null ? void 0 : o.document) == null ? void 0 : D._type,
928
- _searchParams: Object.entries(a)
929
- } });
930
- }, e[0] = (R = o == null ? void 0 : o.document) == null ? void 0 : R._id, e[1] = (A = o == null ? void 0 : o.document) == null ? void 0 : A._type, e[2] = a, e[3] = d) : d = e[3];
931
- const m = d;
932
- let g, P;
933
- e[4] !== ((x = o == null ? void 0 : o.document) == null ? void 0 : x._type) || e[5] !== f ? (P = f.get(((U = o == null ? void 0 : o.document) == null ? void 0 : U._type) || "shoe"), e[4] = (I = o == null ? void 0 : o.document) == null ? void 0 : I._type, e[5] = f, e[6] = P) : P = e[6], g = P;
934
- const h = g, v = zi(((T = o == null ? void 0 : o.document) == null ? void 0 : T._id) || "", h);
935
- let S;
936
- e: {
937
- if (!(o != null && o.document)) {
938
- S = null;
939
- break e;
940
- }
941
- let $;
942
- e[7] !== o.document || e[8] !== v.snapshot ? ($ = Rn({
943
- snapshot: v.snapshot,
944
- fallback: o.document
945
- }), e[7] = o.document, e[8] = v.snapshot, e[9] = $) : $ = e[9];
946
- let W;
947
- e[10] !== p ? (W = p("main-document.label"), e[10] = p, e[11] = W) : W = e[11];
948
- let D;
949
- e[12] !== W ? (D = /* @__PURE__ */ u(he, { padding: 1, radius: 2, shadow: 1, children: /* @__PURE__ */ u(oe, { muted: !0, size: 0, weight: "medium", children: W }) }), e[12] = W, e[13] = D) : D = e[13];
950
- let F;
951
- e[14] !== h || e[15] !== $ || e[16] !== D ? (F = /* @__PURE__ */ u(Cn, { ...$, schemaType: h, status: D }), e[14] = h, e[15] = $, e[16] = D, e[17] = F) : F = e[17], S = F;
952
- }
953
- const b = S;
954
- if (r && n) {
955
- let $;
956
- return e[18] !== r || e[19] !== n || e[20] !== i || e[21] !== s || e[22] !== a || e[23] !== l ? ($ = /* @__PURE__ */ u(Ni, { documentId: r, documentType: n, onFocusPath: i, onStructureParams: s, searchParams: a, structureParams: l }), e[18] = r, e[19] = n, e[20] = i, e[21] = s, e[22] = a, e[23] = l, e[24] = $) : $ = e[24], $;
957
- }
958
- let w;
959
- e[25] !== m || e[26] !== o || e[27] !== b || e[28] !== p ? (w = o && /* @__PURE__ */ u(he, { padding: 3, tone: o.document ? "inherit" : "caution", children: o.document ? /* @__PURE__ */ u(An, { __unstable_focusRing: !0, as: m, "data-as": "a", radius: 2, sizing: "border", tone: "inherit", children: b }) : /* @__PURE__ */ u(he, { padding: 2, radius: 2, tone: "inherit", children: /* @__PURE__ */ G(le, { gap: 3, children: [
960
- /* @__PURE__ */ u(ye, { flex: "none", children: /* @__PURE__ */ u(oe, { size: 1, children: /* @__PURE__ */ u(nn, {}) }) }),
961
- /* @__PURE__ */ u(ye, { flex: 1, children: /* @__PURE__ */ u(oe, { size: 1, children: /* @__PURE__ */ u(Wt, { t: p, i18nKey: "main-document.missing.text", components: {
962
- Code: "code"
963
- }, values: {
964
- path: o.path
965
- } }) }) })
966
- ] }) }) }), e[25] = m, e[26] = o, e[27] = b, e[28] = p, e[29] = w) : w = e[29];
967
- let y;
968
- e[30] !== o || e[31] !== s || e[32] !== c || e[33] !== a ? (y = /* @__PURE__ */ u(Ii, { mainDocumentState: o, onStructureParams: s, searchParams: a, refs: c }), e[30] = o, e[31] = s, e[32] = c, e[33] = a, e[34] = y) : y = e[34];
969
- let _;
970
- return e[35] !== w || e[36] !== y ? (_ = /* @__PURE__ */ G(le, { direction: "column", flex: 1, height: "fill", children: [
971
- w,
972
- y
973
- ] }), e[35] = w, e[36] = y, e[37] = _) : _ = e[37], _;
974
- }
975
- function ji(t) {
976
- const e = N.c(2);
977
- let r;
978
- e[0] !== t ? (r = () => t || Nr(), e[0] = t, e[1] = r) : r = e[1];
979
- const [n] = z(r);
980
- return n;
981
- }
982
- const Fi = Pe.div`
983
- position: relative;
984
- `, Bi = Pe.div`
985
- position: absolute;
986
- top: 0;
987
- bottom: 0;
988
- left: -5px;
989
- width: 9px;
990
- z-index: 10;
991
- cursor: ${({
992
- $disabled: t
993
- }) => t ? "auto" : "ew-resize"};
994
-
995
- /* Border */
996
- & > span:nth-child(1) {
997
- display: block;
998
- border-left: 1px solid var(--card-border-color);
999
- position: absolute;
1000
- top: 0;
1001
- left: 4px;
1002
- bottom: 0;
1003
- transition: opacity 200ms;
1004
- }
1005
-
1006
- ${({
1007
- $disabled: t
1008
- }) => !t && `
1009
- /* Hover effect */
1010
- & > span:nth-child(2) {
1011
- display: block;
1012
- position: absolute;
1013
- top: 0;
1014
- left: 0;
1015
- width: 9px;
1016
- bottom: 0;
1017
- background-color: var(--card-border-color);
1018
- opacity: 0;
1019
- transition: opacity 150ms;
1020
- }
1021
-
1022
- @media (hover: hover) {
1023
- &:hover > span:nth-child(2) {
1024
- opacity: 0.2;
1025
- }
1026
- }
1027
- `}
1028
- `, Rr = function(t) {
1029
- const e = N.c(27), {
1030
- id: r,
1031
- order: n,
1032
- disabled: o
1033
- } = t, i = o === void 0 ? !1 : o, s = ve(null), c = Ut(Nt);
1034
- if (c === null)
1035
- throw Error("Panel components must be rendered within a PanelGroup container");
1036
- const a = ji(r), {
1037
- activeResizer: l,
1038
- drag: p,
1039
- startDragging: f,
1040
- stopDragging: d,
1041
- registerElement: m,
1042
- unregisterElement: g
1043
- } = c, P = l === a;
1044
- if (c === null)
1045
- throw Error("Panel components must be rendered within a PanelGroup container");
1046
- let h;
1047
- e[0] !== a || e[1] !== f ? (h = (T) => {
1048
- f(a, T.nativeEvent);
1049
- }, e[0] = a, e[1] = f, e[2] = h) : h = e[2];
1050
- const v = h;
1051
- let S;
1052
- e[3] !== p || e[4] !== a ? (S = (T) => {
1053
- p(a, T);
1054
- }, e[3] = p, e[4] = a, e[5] = S) : S = e[5];
1055
- const b = S;
1056
- let w;
1057
- e[6] !== d ? (w = () => {
1058
- s.current.blur(), d();
1059
- }, e[6] = d, e[7] = w) : w = e[7];
1060
- const y = w;
1061
- let _, C;
1062
- e[8] !== i || e[9] !== P || e[10] !== b || e[11] !== y ? (_ = () => {
1063
- if (!P || i)
1064
- return;
1065
- const $ = function() {
1066
- const D = document.body.style, F = document.documentElement.style, {
1067
- cursor: Z
1068
- } = F, {
1069
- userSelect: Q
1070
- } = D;
1071
- return F.cursor = "ew-resize", D.userSelect = "none", () => {
1072
- Z ? F.cursor = Z : F.removeProperty("cursor"), Q ? D.userSelect = Q : D.removeProperty("user-select");
1073
- };
1074
- }();
1075
- return window.addEventListener("mousemove", b), window.addEventListener("mouseup", y), window.addEventListener("contextmenu", y), () => {
1076
- $(), window.removeEventListener("mousemove", b), window.removeEventListener("mouseup", y), window.removeEventListener("contextmenu", y);
1077
- };
1078
- }, C = [i, P, b, y], e[8] = i, e[9] = P, e[10] = b, e[11] = y, e[12] = _, e[13] = C) : (_ = e[12], C = e[13]), K(_, C);
1079
- let E, R;
1080
- e[14] !== a || e[15] !== n || e[16] !== m || e[17] !== g ? (E = () => (m(a, {
1081
- id: a,
1082
- order: n,
1083
- type: "resizer",
1084
- el: s
1085
- }), () => {
1086
- g(a);
1087
- }), R = [a, n, m, g], e[14] = a, e[15] = n, e[16] = m, e[17] = g, e[18] = E, e[19] = R) : (E = e[18], R = e[19]), Je(E, R);
1088
- let A, x;
1089
- e[20] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ u("span", {}), A = /* @__PURE__ */ u("span", {}), e[20] = A, e[21] = x) : (A = e[20], x = e[21]);
1090
- let U;
1091
- e[22] !== i ? (U = /* @__PURE__ */ G(Bi, { $disabled: i, children: [
1092
- x,
1093
- A
1094
- ] }), e[22] = i, e[23] = U) : U = e[23];
1095
- let I;
1096
- return e[24] !== v || e[25] !== U ? (I = /* @__PURE__ */ u(Fi, { onMouseDown: v, ref: s, children: U }), e[24] = v, e[25] = U, e[26] = I) : I = e[26], I;
1097
- }, Vi = (t) => {
1098
- const e = N.c(8), {
1099
- documentId: r,
1100
- setDisplayedDocument: n,
1101
- getCommentIntent: o
1102
- } = t;
1103
- let i;
1104
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ u(Rr, { order: 4 }), e[0] = i) : i = e[0];
1105
- let s;
1106
- e[1] !== o || e[2] !== t.children ? (s = /* @__PURE__ */ u(Tn, { getIntent: o, children: t.children }), e[1] = o, e[2] = t.children, e[3] = s) : s = e[3];
1107
- let c;
1108
- return e[4] !== r || e[5] !== n || e[6] !== s ? (c = /* @__PURE__ */ G(Ue, { children: [
1109
- i,
1110
- /* @__PURE__ */ u(zt, { id: "content", minWidth: 325, order: 5, children: /* @__PURE__ */ u(Hn, { documentId: r, setDisplayedDocument: n, children: s }) })
1111
- ] }), e[4] = r, e[5] = n, e[6] = s, e[7] = c) : c = e[7], c;
1112
- }, Ki = (t) => {
1113
- const e = N.c(14), {
1114
- documentId: r,
1115
- documentsOnPage: n,
1116
- documentType: o,
1117
- getCommentIntent: i,
1118
- mainDocumentState: s,
1119
- onFocusPath: c,
1120
- onStructureParams: a,
1121
- searchParams: l,
1122
- setDisplayedDocument: p,
1123
- structureParams: f
1124
- } = t;
1125
- let d;
1126
- e[0] !== r || e[1] !== o || e[2] !== n || e[3] !== s || e[4] !== c || e[5] !== a || e[6] !== l || e[7] !== f ? (d = /* @__PURE__ */ u(Di, { documentId: r, documentType: o, mainDocumentState: s, onFocusPath: c, onStructureParams: a, refs: n, searchParams: l, structureParams: f }), e[0] = r, e[1] = o, e[2] = n, e[3] = s, e[4] = c, e[5] = a, e[6] = l, e[7] = f, e[8] = d) : d = e[8];
1127
- let m;
1128
- return e[9] !== r || e[10] !== i || e[11] !== p || e[12] !== d ? (m = /* @__PURE__ */ u(Vi, { documentId: r, getCommentIntent: i, setDisplayedDocument: p, children: d }), e[9] = r, e[10] = i, e[11] = p, e[12] = d, e[13] = m) : m = e[13], m;
1129
- }, Hi = function(t) {
1130
- const e = N.c(5), {
1131
- children: r,
1132
- navigate: n
1133
- } = t;
1134
- let o;
1135
- e[0] !== n ? (o = (c, a) => {
1136
- n((a === void 0 ? void 0 : a) || {}, c ? {
1137
- preview: c
1138
- } : {});
1139
- }, e[0] = n, e[1] = o) : o = e[1];
1140
- const i = o;
1141
- let s;
1142
- return e[2] !== r || e[3] !== i ? (s = /* @__PURE__ */ u(Nn.Provider, { value: i, children: r }), e[2] = r, e[3] = i, e[4] = s) : s = e[4], s;
1143
- };
1144
- function Gi(t, e) {
1145
- const r = N.c(9);
1146
- let n;
1147
- r[0] !== e || r[1] !== t ? (n = () => JSON.parse(localStorage.getItem(t) ?? JSON.stringify(e)), r[0] = e, r[1] = t, r[2] = n) : n = r[2];
1148
- const [o, i] = z(n);
1149
- let s, c;
1150
- r[3] !== t || r[4] !== o ? (s = () => {
1151
- localStorage.setItem(t, JSON.stringify(o));
1152
- }, c = [t, o], r[3] = t, r[4] = o, r[5] = s, r[6] = c) : (s = r[5], c = r[6]), K(s, c);
1153
- let a;
1154
- return r[7] !== o ? (a = [o, i], r[7] = o, r[8] = a) : a = r[8], a;
1155
- }
1156
- function qi(t) {
1157
- const e = N.c(11), {
1158
- unstable_navigator: r
1159
- } = t, n = !!(r != null && r.component), [o, i] = Gi("presentation/navigator", n), s = n ? o : !1;
1160
- let c;
1161
- e: {
1162
- if (!n) {
1163
- c = void 0;
1164
- break e;
1165
- }
1166
- let m;
1167
- e[0] !== i ? (m = () => i(Qi), e[0] = i, e[1] = m) : m = e[1], c = m;
1168
- }
1169
- const a = c;
1170
- let l;
1171
- e[2] !== s || e[3] !== r ? (l = function() {
1172
- return /* @__PURE__ */ u(Ue, { children: s && /* @__PURE__ */ u(Ji, { ...r }) });
1173
- }, e[2] = s, e[3] = r, e[4] = l) : l = e[4];
1174
- const p = l;
1175
- let f;
1176
- e[5] !== s || e[6] !== a ? (f = {
1177
- navigatorEnabled: s,
1178
- toggleNavigator: a
1179
- }, e[5] = s, e[6] = a, e[7] = f) : f = e[7];
1180
- let d;
1181
- return e[8] !== p || e[9] !== f ? (d = [f, p], e[8] = p, e[9] = f, e[10] = d) : d = e[10], d;
1182
- }
1183
- function Qi(t) {
1184
- return !t;
1185
- }
1186
- function Xi(t) {
1187
- const e = N.c(11), {
1188
- minWidth: r,
1189
- maxWidth: n,
1190
- component: o
1191
- } = t, i = r != null && n != null && r === n;
1192
- let s;
1193
- e[0] !== o ? (s = /* @__PURE__ */ u(o, {}), e[0] = o, e[1] = s) : s = e[1];
1194
- let c;
1195
- e[2] !== n || e[3] !== r || e[4] !== s ? (c = /* @__PURE__ */ u(zt, { id: "navigator", minWidth: r, maxWidth: n, order: 1, children: s }), e[2] = n, e[3] = r, e[4] = s, e[5] = c) : c = e[5];
1196
- let a;
1197
- e[6] !== i ? (a = /* @__PURE__ */ u(Rr, { order: 2, disabled: i }), e[6] = i, e[7] = a) : a = e[7];
1198
- let l;
1199
- return e[8] !== c || e[9] !== a ? (l = /* @__PURE__ */ G(Ue, { children: [
1200
- c,
1201
- a
1202
- ] }), e[8] = c, e[9] = a, e[10] = l) : l = e[10], l;
1203
- }
1204
- const Ji = dt(Xi), Yi = function(t) {
1205
- const e = N.c(3), {
1206
- children: r,
1207
- params: n
1208
- } = t;
1209
- let o;
1210
- o = n;
1211
- const i = o;
1212
- let s;
1213
- return e[0] !== r || e[1] !== i ? (s = /* @__PURE__ */ u(zn.Provider, { value: i, children: r }), e[0] = r, e[1] = i, e[2] = s) : s = e[2], s;
1214
- }, Zi = function(t) {
1215
- const e = N.c(10), {
1216
- children: r,
1217
- devMode: n,
1218
- name: o,
1219
- navigate: i,
1220
- params: s,
1221
- searchParams: c,
1222
- structureParams: a
1223
- } = t;
1224
- let l, p;
1225
- e[0] !== n || e[1] !== o || e[2] !== i || e[3] !== s || e[4] !== c || e[5] !== a ? (p = {
1226
- devMode: n,
1227
- name: o,
1228
- navigate: i,
1229
- params: s,
1230
- searchParams: c,
1231
- structureParams: a
1232
- }, e[0] = n, e[1] = o, e[2] = i, e[3] = s, e[4] = c, e[5] = a, e[6] = p) : p = e[6], l = p;
1233
- const f = l;
1234
- let d;
1235
- return e[7] !== r || e[8] !== f ? (d = /* @__PURE__ */ u(Dn.Provider, { value: f, children: r }), e[7] = r, e[8] = f, e[9] = d) : d = e[9], d;
1236
- };
1237
- function jt(t) {
1238
- const e = re(t, eo);
1239
- if (!Array.isArray(e))
1240
- throw new TypeError("allowPatterns must be an array");
1241
- return e;
1242
- }
1243
- function eo(t) {
1244
- return t.context.allowOrigins;
1245
- }
1246
- function Ge(t) {
1247
- return Array.isArray(t) ? t.join(",") : t;
1248
- }
1249
- function Cr() {
1250
- const t = N.c(2), e = Pn();
1251
- let r;
1252
- return t[0] !== e ? (r = e.startsWith(":") ? e.replace(/^:(.+):$/, "«$1»") : e, t[0] = e, t[1] = r) : r = t[1], r;
1253
- }
1254
- const to = pt(function(e, r) {
1255
- const n = N.c(19), {
1256
- animate: o,
1257
- initial: i,
1258
- onLoad: s,
1259
- preventClick: c,
1260
- src: a,
1261
- variants: l,
1262
- style: p
1263
- } = e, f = ve(null);
1264
- let d;
1265
- n[0] === Symbol.for("react.memo_cache_sentinel") ? (d = () => f.current, n[0] = d) : d = n[0], vr(r, d);
1266
- let m, g;
1267
- n[1] === Symbol.for("react.memo_cache_sentinel") ? (m = () => {
1268
- if (!f.current)
1269
- return;
1270
- const y = f.current, _ = function() {
1271
- y === document.activeElement && y.dispatchEvent(new MouseEvent("mousedown", {
1272
- bubbles: !0,
1273
- cancelable: !0
1274
- }));
1275
- };
1276
- return window.addEventListener("blur", _), () => {
1277
- window.removeEventListener("blur", _);
1278
- };
1279
- }, g = [], n[1] = m, n[2] = g) : (m = n[1], g = n[2]), K(m, g);
1280
- const P = Cr();
1281
- let h;
1282
- n[3] !== p || n[4] !== P ? (h = {
1283
- ...p,
1284
- viewTransitionName: P
1285
- }, n[3] = p, n[4] = P, n[5] = h) : h = n[5];
1286
- let v;
1287
- n[6] !== o || n[7] !== i || n[8] !== s || n[9] !== a || n[10] !== h || n[11] !== l ? (v = /* @__PURE__ */ u(ro, { style: h, animate: o, initial: i, onLoad: s, ref: f, src: a, variants: l }), n[6] = o, n[7] = i, n[8] = s, n[9] = a, n[10] = h, n[11] = l, n[12] = v) : v = n[12];
1288
- let S;
1289
- n[13] !== c ? (S = c && /* @__PURE__ */ u(no, {}), n[13] = c, n[14] = S) : S = n[14];
1290
- let b;
1291
- n[15] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ u(io, {}), n[15] = b) : b = n[15];
1292
- let w;
1293
- return n[16] !== v || n[17] !== S ? (w = /* @__PURE__ */ G(Ue, { children: [
1294
- v,
1295
- S,
1296
- b
1297
- ] }), n[16] = v, n[17] = S, n[18] = w) : w = n[18], w;
1298
- }), ro = Ze.create(Pe.iframe`
1299
- box-shadow: 0 0 0 1px var(--card-border-color);
1300
- border: 0;
1301
- max-height: 100%;
1302
- width: 100%;
1303
- view-transition-class: presentation-tool-iframe;
1304
- `), no = Pe(ye)`
1305
- position: absolute;
1306
- inset: 0;
1307
- background: transparent;
1308
- `, io = On`
1309
- html:active-view-transition-type(sanity-iframe-viewport) {
1310
- view-transition-name: none;
1311
- &::view-transition {
1312
- pointer-events: none;
1313
- }
1314
- /* &::view-transition-old(root) {
1315
- display: none;
1316
- }
1317
- &::view-transition-new(root) {
1318
- animation: none;
1319
- } */
1320
- }
1321
- `;
1322
- function oo(t) {
1323
- const e = new URL(t), { searchParams: r } = e;
1324
- return r.delete(At), r.delete(Tt), r.delete(He), r.delete(Qe), r.delete(kt), e;
1325
- }
1326
- function so(t, e, r, n) {
1327
- const o = new URL(t), { searchParams: i } = o;
1328
- return e && (i.set(Tt, e), i.set(At, r)), i.set(He, n), o;
1329
- }
1330
- function ao(t) {
1331
- const e = N.c(16), {
1332
- openPopup: r,
1333
- previewLocationOrigin: n,
1334
- previewLocationRoute: o,
1335
- perspective: i,
1336
- targetOrigin: s
1337
- } = t;
1338
- let c;
1339
- const a = new URL(o, n || s);
1340
- a.searchParams.set(He, Ge(i));
1341
- const {
1342
- pathname: l,
1343
- search: p
1344
- } = a;
1345
- c = `${n}${l}${p}`;
1346
- const f = c, {
1347
- t: d
1348
- } = xe(_e);
1349
- let m;
1350
- e[0] !== r ? (m = (y) => {
1351
- y.preventDefault(), r(y.currentTarget.href);
1352
- }, e[0] = r, e[1] = m) : m = e[1];
1353
- const g = m;
1354
- let P;
1355
- e[2] !== d ? (P = d("share-url.menu-item.open.text"), e[2] = d, e[3] = P) : P = e[3];
1356
- let h;
1357
- e[4] !== P ? (h = /* @__PURE__ */ u(oe, { size: 1, children: P }), e[4] = P, e[5] = h) : h = e[5];
1358
- let v;
1359
- e[6] === Symbol.for("react.memo_cache_sentinel") ? (v = ["bottom-start"], e[6] = v) : v = e[6];
1360
- let S;
1361
- e[7] !== d ? (S = d("share-url.menu-item.open.text"), e[7] = d, e[8] = S) : S = e[8];
1362
- let b;
1363
- e[9] !== g || e[10] !== f || e[11] !== S ? (b = /* @__PURE__ */ u(Ie, { as: "a", "aria-label": S, icon: on, mode: "bleed", href: f, rel: "opener", target: "_blank", tooltipProps: null, onClick: g }), e[9] = g, e[10] = f, e[11] = S, e[12] = b) : b = e[12];
1364
- let w;
1365
- return e[13] !== h || e[14] !== b ? (w = /* @__PURE__ */ u(Xe, { animate: !0, content: h, fallbackPlacements: v, placement: "bottom", portal: !0, children: b }), e[13] = h, e[14] = b, e[15] = w) : w = e[15], w;
1366
- }
1367
- function Ar(t) {
1368
- const e = re(t, co);
1369
- if (!e)
1370
- throw new TypeError("targetOrigin is required");
1371
- return e;
1372
- }
1373
- function co(t) {
1374
- var e;
1375
- return (e = t.context.previewUrl) == null ? void 0 : e.origin;
1376
- }
1377
- function lo(t) {
1378
- var ne;
1379
- const e = N.c(32), {
1380
- fontSize: r,
1381
- onChange: n,
1382
- padding: o,
1383
- prefix: i,
1384
- suffix: s,
1385
- value: c,
1386
- previewUrlRef: a
1387
- } = t, l = r === void 0 ? 1 : r, p = o === void 0 ? 3 : o, f = jt(a), d = Ar(a), {
1388
- t: m
1389
- } = xe(_e), {
1390
- basePath: g
1391
- } = ((ne = wr()) == null ? void 0 : ne.activeWorkspace) || {}, P = g === void 0 ? "/" : g, h = ve(null), [v, S] = z(void 0), [b, w] = z(void 0);
1392
- let y;
1393
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (y = (ee) => {
1394
- S(ee.currentTarget.value);
1395
- }, e[0] = y) : y = e[0];
1396
- const _ = y;
1397
- let C;
1398
- e[1] !== f || e[2] !== P || e[3] !== n || e[4] !== v || e[5] !== m || e[6] !== d ? (C = (ee) => {
1399
- var se;
1400
- if (ee.key === "Enter") {
1401
- if (v === void 0)
1402
- return;
1403
- let J = v;
1404
- try {
1405
- J = new URL(v, d).toString();
1406
- } catch {
1407
- }
1408
- if (Array.isArray(f)) {
1409
- if (!f.some((ae) => ae.test(J))) {
1410
- w(m("preview-location-input.error", {
1411
- origin: d,
1412
- context: "origin-not-allowed"
1413
- })), ee.currentTarget.reportValidity();
1414
- return;
1415
- }
1416
- } else if (!d && (J.startsWith(`${P}/`) || J === P)) {
1417
- w(m("preview-location-input.error", {
1418
- basePath: P,
1419
- context: "same-base-path"
1420
- }));
1421
- return;
1422
- }
1423
- const ue = J === d ? `${d}/` : J;
1424
- w(void 0), S(void 0), n(ue), (se = h.current) == null || se.blur();
1425
- }
1426
- ee.key === "Escape" && (w(void 0), S(void 0));
1427
- }, e[1] = f, e[2] = P, e[3] = n, e[4] = v, e[5] = m, e[6] = d, e[7] = C) : C = e[7];
1428
- const E = C;
1429
- let R;
1430
- e[8] === Symbol.for("react.memo_cache_sentinel") ? (R = () => {
1431
- w(void 0), S(void 0);
1432
- }, e[8] = R) : R = e[8];
1433
- const A = R;
1434
- let x;
1435
- e[9] !== d || e[10] !== c ? (x = () => {
1436
- w(void 0);
1437
- let ee = c;
1438
- try {
1439
- ee = new URL(c, d).toString();
1440
- } catch {
1441
- }
1442
- S(ee);
1443
- }, e[9] = d, e[10] = c, e[11] = x) : x = e[11];
1444
- const U = x;
1445
- let I;
1446
- e[12] === Symbol.for("react.memo_cache_sentinel") ? (I = () => {
1447
- w(void 0), S(void 0);
1448
- }, e[12] = I) : I = e[12];
1449
- let T;
1450
- e[13] !== d || e[14] !== c ? (T = [d, c], e[13] = d, e[14] = c, e[15] = T) : T = e[15], K(I, T);
1451
- let $, W;
1452
- e[16] === Symbol.for("react.memo_cache_sentinel") ? (W = {
1453
- icon: sn
1454
- }, e[16] = W) : W = e[16], $ = W;
1455
- const F = b ? $ : void 0;
1456
- let Z;
1457
- e[17] === Symbol.for("react.memo_cache_sentinel") ? (Z = {
1458
- zIndex: 1
1459
- }, e[17] = Z) : Z = e[17];
1460
- let Q;
1461
- e[18] !== v || e[19] !== d || e[20] !== c ? (Q = v === void 0 ? new URL(c, d).toString() : v, e[18] = v, e[19] = d, e[20] = c, e[21] = Q) : Q = e[21];
1462
- let X;
1463
- return e[22] !== b || e[23] !== l || e[24] !== U || e[25] !== E || e[26] !== p || e[27] !== i || e[28] !== s || e[29] !== F || e[30] !== Q ? (X = /* @__PURE__ */ u(Ue, { children: /* @__PURE__ */ u(an, { clearButton: F, customValidity: b, fontSize: l, onBlur: A, onClear: U, onChange: _, onKeyDownCapture: E, padding: p, prefix: i, style: Z, radius: 2, ref: h, space: p, suffix: s, value: Q }) }), e[22] = b, e[23] = l, e[24] = U, e[25] = E, e[26] = p, e[27] = i, e[28] = s, e[29] = F, e[30] = Q, e[31] = X) : X = e[31], X;
1464
- }
1465
- function Tr() {
1466
- if (typeof crypto < "u") {
1467
- const t = new Uint8Array(16);
1468
- crypto.getRandomValues(t);
1469
- let e = "";
1470
- for (let r = 0; r < t.length; r++)
1471
- e += t[r].toString(16).padStart(2, "0");
1472
- return e = btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/[=]+$/, ""), e;
1473
- }
1474
- return Math.random().toString(36).slice(2);
1475
- }
1476
- async function uo(t, e, r, n) {
1477
- const o = t.withConfig({ apiVersion: Mt }), i = Tr(), s = o.patch(Ye).set({ secret: i, studioUrl: r, userId: n });
1478
- return await o.transaction().createIfNotExists({ _id: Ye, _type: $t, source: e, studioUrl: r, userId: n }).patch(s).commit({ tag: It }), { secret: i };
1479
- }
1480
- async function po(t, e, r, n) {
1481
- const o = t.withConfig({ apiVersion: Mt }), i = o.patch(Ye).set({ secret: null, studioUrl: r, userId: n });
1482
- await o.transaction().createIfNotExists({ _id: Ye, _type: $t, source: e, studioUrl: r, userId: n }).patch(i).commit({ tag: It });
1483
- }
1484
- const fo = Ne(() => import("./QRCodeSVG-hyTW2xeN.mjs")), Rt = 24, mo = 16, ho = 224, vo = Pe(zr)`
1485
- position: absolute;
1486
- top: 50%;
1487
- left: 50%;
1488
- transform: translate(-50%, -50%);
1489
- height: ${Rt}px;
1490
- width: ${Rt}px;
1491
- `, go = Ze.create(st), wo = Ze.create(oe), yo = Ze.create(vo), kr = dt(function(e) {
1492
- const {
1493
- canToggleSharePreviewAccess: r,
1494
- canUseSharedPreviewAccess: n,
1495
- initialUrl: o,
1496
- previewLocationRoute: i,
1497
- perspective: s
1498
- } = e, {
1499
- t: c
1500
- } = xe(_e), {
1501
- push: a
1502
- } = ut(), l = mt({
1503
- apiVersion: lt
1504
- }), p = yr(), [f, d] = z(!0), [m, g] = z(!1), [P, h] = z(!1), [v, S] = z(null), b = m || P || f, w = ke(() => v ? so(o, v, i, Ge(s)) : null, [o, s, i, v]), [y, _] = z(null);
1505
- if (y)
1506
- throw y;
1507
- const C = pe(() => {
1508
- a({
1509
- closable: !0,
1510
- status: "warning",
1511
- title: c("share-preview-menu.error_toggle-sharing", {
1512
- context: "toggle-sharing"
1513
- })
1514
- });
1515
- }, [a, c]), E = pe(async () => {
1516
- try {
1517
- h(!0), await po(l, "sanity/presentation", typeof window > "u" ? "" : location.href, p == null ? void 0 : p.id), S(null);
1518
- } catch (x) {
1519
- _(x);
1520
- } finally {
1521
- h(!1);
1522
- }
1523
- }, [l, p == null ? void 0 : p.id]), R = pe(async () => {
1524
- try {
1525
- g(!0);
1526
- const x = await uo(l, "sanity/presentation", typeof window > "u" ? "" : location.href, p == null ? void 0 : p.id);
1527
- S(x.secret);
1528
- } catch (x) {
1529
- _(x);
1530
- } finally {
1531
- g(!1);
1532
- }
1533
- }, [l, p == null ? void 0 : p.id]), A = pe(() => {
1534
- try {
1535
- if (!w)
1536
- throw new Error("No URL to copy");
1537
- navigator.clipboard.writeText(w.toString()), a({
1538
- closable: !0,
1539
- status: "success",
1540
- title: c("share-url.clipboard.status", {
1541
- context: "success"
1542
- })
1543
- });
1544
- } catch (x) {
1545
- _(x);
1546
- }
1547
- }, [a, c, w]);
1548
- return K(() => {
1549
- let x = new AbortController(), U = [];
1550
- async function I($, W) {
1551
- const {
1552
- result: D,
1553
- syncTags: F
1554
- } = await l.fetch(lr, {}, {
1555
- filterResponse: !1,
1556
- lastLiveEventId: $,
1557
- tag: "presentation.fetch-shared-access-secret"
1558
- });
1559
- Array.isArray(F) && (U = F), W.aborted || S(D);
1560
- }
1561
- const T = l.live.events().subscribe({
1562
- next: ($) => {
1563
- $.type === "message" && (x.abort(), x = new AbortController(), $.tags.some((W) => U.includes(W)) && I($.id, x.signal));
1564
- },
1565
- error: _
1566
- });
1567
- return I(null, x.signal).finally(() => d(!1)), () => {
1568
- T.unsubscribe(), x.abort();
1569
- };
1570
- }, [l]), /* @__PURE__ */ u(qr, { button: /* @__PURE__ */ u(Ie, { "aria-label": c("preview-frame.share-button.aria-label"), icon: pn, mode: "bleed", tooltipProps: null }), id: "share-menu", menu: /* @__PURE__ */ u(cn, { style: {
1571
- maxWidth: 248
1572
- }, padding: n ? void 0 : 0, children: n ? /* @__PURE__ */ G(Ue, { children: [
1573
- /* @__PURE__ */ u("label", { style: {
1574
- cursor: "pointer"
1575
- }, children: /* @__PURE__ */ G(ln, { columns: 2, rows: 2, gapX: 3, gapY: 1, style: {
1576
- justifyContent: "center",
1577
- alignItems: "center",
1578
- gridTemplateColumns: "min-content 1fr",
1579
- gridTemplateRows: "min-content"
1580
- }, paddingTop: 3, paddingX: 3, children: [
1581
- /* @__PURE__ */ u(Xe, { animate: !0, content: /* @__PURE__ */ u(oe, { size: 1, children: c("share-preview-menu.toggle-button.tooltip", {
1582
- context: w ? "disable" : "enable"
1583
- }) }), fallbackPlacements: ["bottom-start"], placement: "bottom", portal: !0, children: /* @__PURE__ */ u(fr, { checked: m || w !== null && !P, readOnly: m || P, indeterminate: f, onChange: r ? w ? E : R : C }) }),
1584
- /* @__PURE__ */ u(oe, { size: 1, weight: "medium", children: c("share-preview-menu.toggle-button.label", {
1585
- context: "first-line"
1586
- }) }),
1587
- /* @__PURE__ */ u("span", {}),
1588
- /* @__PURE__ */ u(oe, { muted: !0, size: 1, children: c("share-preview-menu.toggle-button.label", {
1589
- context: "second-line"
1590
- }) })
1591
- ] }) }),
1592
- /* @__PURE__ */ u(ye, { padding: 3, paddingTop: 2, children: /* @__PURE__ */ G(De, { space: 3, children: [
1593
- /* @__PURE__ */ u(he, { tone: b || !w ? "transparent" : void 0, style: {
1594
- position: "relative",
1595
- aspectRatio: "1 / 1",
1596
- display: "flex",
1597
- alignItems: "center",
1598
- justifyContent: "center"
1599
- }, children: /* @__PURE__ */ u(mr, { children: b ? /* @__PURE__ */ u(go, { muted: !0, initial: {
1600
- opacity: 0
1601
- }, animate: {
1602
- opacity: 1
1603
- }, exit: {
1604
- opacity: 0
1605
- } }) : w ? /* @__PURE__ */ u(Ue, { children: /* @__PURE__ */ G(Lt, { fallback: /* @__PURE__ */ u(st, {}), children: [
1606
- /* @__PURE__ */ u(fo, { title: c("share-preview-menu.qr-code.title", {
1607
- url: w.toString()
1608
- }), value: w.toString(), size: ho, color: "var(--card-fg-color)", logoSize: Rt + mo }),
1609
- /* @__PURE__ */ u(yo, { initial: {
1610
- opacity: -0.5
1611
- }, animate: {
1612
- opacity: 1.5
1613
- }, exit: {
1614
- opacity: 0
1615
- } })
1616
- ] }) }) : /* @__PURE__ */ u(wo, { muted: !0, size: 1, style: {
1617
- maxWidth: "100px",
1618
- textWrap: "pretty",
1619
- textAlign: "center"
1620
- }, initial: {
1621
- opacity: 0
1622
- }, animate: {
1623
- opacity: 1
1624
- }, exit: {
1625
- opacity: 0
1626
- }, children: c("share-preview-menu.qr-code.placeholder") }) }) }),
1627
- /* @__PURE__ */ u(oe, { muted: !0, size: 1, children: c("share-preview-menu.qr-code.instructions") })
1628
- ] }) }),
1629
- /* @__PURE__ */ u(un, {}),
1630
- /* @__PURE__ */ u(Qr, { disabled: !w || P, icon: dn, onClick: A, text: c("share-preview-menu.copy-url.text") })
1631
- ] }) : /* @__PURE__ */ u(he, { padding: 2, tone: "caution", radius: 3, children: /* @__PURE__ */ u(oe, { style: {
1632
- textWrap: "pretty"
1633
- }, children: c("share-preview-menu.error", {
1634
- context: "missing-grants"
1635
- }) }) }) }), popover: {
1636
- constrainSize: !0,
1637
- placement: "bottom",
1638
- portal: !0
1639
- } });
1640
- });
1641
- kr.displayName = "Memo(SharePreviewMenu)";
1642
- const Po = (t) => {
1643
- const e = N.c(107), {
1644
- canSharePreviewAccess: r,
1645
- canToggleSharePreviewAccess: n,
1646
- canUseSharedPreviewAccess: o,
1647
- iframeRef: i,
1648
- initialUrl: s,
1649
- navigatorEnabled: c,
1650
- onPathChange: a,
1651
- onRefresh: l,
1652
- openPopup: p,
1653
- overlaysConnection: f,
1654
- presentationRef: d,
1655
- perspective: m,
1656
- previewUrl: g,
1657
- setViewport: P,
1658
- targetOrigin: h,
1659
- toggleNavigator: v,
1660
- toggleOverlay: S,
1661
- viewport: b,
1662
- previewUrlRef: w
1663
- } = t, {
1664
- t: y
1665
- } = xe(_e);
1666
- let _;
1667
- e[0] !== P || e[1] !== b ? (_ = () => P(b === "desktop" ? "mobile" : "desktop"), e[0] = P, e[1] = b, e[2] = _) : _ = e[2];
1668
- const C = _;
1669
- let E;
1670
- E = h === location.origin ? "" : h;
1671
- const R = E;
1672
- let A;
1673
- e[3] !== i || e[4] !== l || e[5] !== d || e[6] !== g || e[7] !== h ? (A = () => {
1674
- l(() => {
1675
- i.current && (d.send({
1676
- type: "iframe reload"
1677
- }), Object.assign(i.current, {
1678
- src: `${h}${g || "/"}`
1679
- }));
1680
- });
1681
- }, e[3] = i, e[4] = l, e[5] = d, e[6] = g, e[7] = h, e[8] = A) : A = e[8];
1682
- const x = A, U = re(d, _o), I = re(d, xo), T = re(d, Eo), $ = re(d, Ro), W = re(d, Co);
1683
- let D;
1684
- const F = new URL(g || "/", h), {
1685
- pathname: Z,
1686
- search: Q
1687
- } = oo(F);
1688
- D = `${Z}${Q}`;
1689
- const X = D, ne = Cr(), ee = re(w, Ao);
1690
- let se;
1691
- e[9] === Symbol.for("react.memo_cache_sentinel") ? (se = {
1692
- width: "100%"
1693
- }, e[9] = se) : se = e[9];
1694
- let J;
1695
- e[10] !== c || e[11] !== y || e[12] !== v ? (J = v && /* @__PURE__ */ u(Ie, { "aria-label": y("preview-frame.navigator.toggle-button.aria-label"), icon: fn, mode: "bleed", onClick: v, selected: c, tooltipProps: {
1696
- content: /* @__PURE__ */ u(oe, { size: 1, children: y("preview-frame.navigator.toggle-button.tooltip") }),
1697
- fallbackPlacements: ["bottom-start"],
1698
- placement: "bottom"
1699
- } }), e[10] = c, e[11] = y, e[12] = v, e[13] = J) : J = e[13];
1700
- let ue;
1701
- e[14] === Symbol.for("react.memo_cache_sentinel") ? (ue = {
1702
- whiteSpace: "nowrap"
1703
- }, e[14] = ue) : ue = e[14];
1704
- const ae = W ? "disable" : "enable";
1705
- let te;
1706
- e[15] !== y || e[16] !== ae ? (te = y("preview-frame.overlay.toggle-button.tooltip", {
1707
- context: ae
1708
- }), e[15] = y, e[16] = ae, e[17] = te) : te = e[17];
1709
- let B;
1710
- e[18] !== te ? (B = /* @__PURE__ */ u(ye, { padding: 1, children: /* @__PURE__ */ u(oe, { size: 1, children: te }) }), e[18] = te, e[19] = B) : B = e[19];
1711
- let H;
1712
- e[20] === Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ u(ye, { paddingY: 1, children: /* @__PURE__ */ u(vn, { keys: ["Alt"], style: {
1713
- marginTop: -4,
1714
- marginBottom: -4
1715
- } }) }), e[20] = H) : H = e[20];
1716
- let q;
1717
- e[21] !== B ? (q = /* @__PURE__ */ G(le, { align: "center", style: ue, children: [
1718
- B,
1719
- H
1720
- ] }), e[21] = B, e[22] = q) : q = e[22];
1721
- let Y;
1722
- e[23] === Symbol.for("react.memo_cache_sentinel") ? (Y = ["bottom-start"], e[23] = Y) : Y = e[23];
1723
- let de;
1724
- e[24] === Symbol.for("react.memo_cache_sentinel") ? (de = {
1725
- lineHeight: 0,
1726
- borderRadius: 999,
1727
- userSelect: "none"
1728
- }, e[24] = de) : de = e[24];
1729
- const k = W ? "transparent" : void 0;
1730
- let V;
1731
- e[25] === Symbol.for("react.memo_cache_sentinel") ? (V = {
1732
- margin: -4
1733
- }, e[25] = V) : V = e[25];
1734
- const j = !I, ce = U || f !== "connected";
1735
- let fe;
1736
- e[26] !== W || e[27] !== j || e[28] !== ce || e[29] !== S ? (fe = /* @__PURE__ */ u("div", { style: V, children: /* @__PURE__ */ u(fr, { indeterminate: j, checked: W, onChange: S, disabled: ce }) }), e[26] = W, e[27] = j, e[28] = ce, e[29] = S, e[30] = fe) : fe = e[30];
1737
- const Ee = !W;
1738
- let Re;
1739
- e[31] !== y ? (Re = y("preview-frame.overlay.toggle-button.text"), e[31] = y, e[32] = Re) : Re = e[32];
1740
- let Ce;
1741
- e[33] !== Ee || e[34] !== Re ? (Ce = /* @__PURE__ */ u(ye, { children: /* @__PURE__ */ u(oe, { muted: Ee, size: 1, weight: "medium", children: Re }) }), e[33] = Ee, e[34] = Re, e[35] = Ce) : Ce = e[35];
1742
- let we;
1743
- e[36] !== fe || e[37] !== Ce ? (we = /* @__PURE__ */ G(le, { align: "center", gap: 3, children: [
1744
- fe,
1745
- Ce
1746
- ] }), e[36] = fe, e[37] = Ce, e[38] = we) : we = e[38];
1747
- let Me;
1748
- e[39] !== k || e[40] !== we ? (Me = /* @__PURE__ */ u(he, { as: "label", flex: "none", padding: 3, marginX: 1, style: de, tone: k, children: we }), e[39] = k, e[40] = we, e[41] = Me) : Me = e[41];
1749
- let be;
1750
- e[42] !== q || e[43] !== Me ? (be = /* @__PURE__ */ u(Xe, { animate: !0, content: q, fallbackPlacements: Y, placement: "bottom", portal: !0, children: Me }), e[42] = q, e[43] = Me, e[44] = be) : be = e[44];
1751
- let Ae;
1752
- e[45] !== I || e[46] !== U || e[47] !== T || e[48] !== $ || e[49] !== y ? (Ae = I ? y("preview-frame.refresh-button.tooltip") : y("preview-frame.status", {
1753
- context: U ? "loading" : T ? "refreshing" : $ ? "reloading" : "unknown"
1754
- }), e[45] = I, e[46] = U, e[47] = T, e[48] = $, e[49] = y, e[50] = Ae) : Ae = e[50];
1755
- let Le;
1756
- e[51] !== Ae ? (Le = /* @__PURE__ */ u(oe, { size: 1, children: Ae }), e[51] = Ae, e[52] = Le) : Le = e[52];
1757
- let ze;
1758
- e[53] === Symbol.for("react.memo_cache_sentinel") ? (ze = ["bottom-end"], e[53] = ze) : ze = e[53];
1759
- let $e;
1760
- e[54] !== y ? ($e = y("preview-frame.refresh-button.aria-label"), e[54] = y, e[55] = $e) : $e = e[55];
1761
- const je = $ || T || ee;
1762
- let M;
1763
- e[56] !== x || e[57] !== $e || e[58] !== je ? (M = /* @__PURE__ */ u(Ie, { "aria-label": $e, icon: gn, mode: "bleed", loading: je, onClick: x, tooltipProps: null }), e[56] = x, e[57] = $e, e[58] = je, e[59] = M) : M = e[59];
1764
- let O;
1765
- e[60] !== Le || e[61] !== M ? (O = /* @__PURE__ */ u(ye, { padding: 1, children: /* @__PURE__ */ u(Xe, { animate: !0, content: Le, fallbackPlacements: ze, placement: "bottom", portal: !0, children: M }) }), e[60] = Le, e[61] = M, e[62] = O) : O = e[62];
1766
- let L;
1767
- e[63] !== p || e[64] !== m || e[65] !== R || e[66] !== X || e[67] !== h ? (L = /* @__PURE__ */ u(ye, { padding: 1, children: /* @__PURE__ */ u(ao, { openPopup: p, previewLocationOrigin: R, previewLocationRoute: X, perspective: m, targetOrigin: h }) }), e[63] = p, e[64] = m, e[65] = R, e[66] = X, e[67] = h, e[68] = L) : L = e[68];
1768
- let Te;
1769
- e[69] !== a || e[70] !== X || e[71] !== w || e[72] !== O || e[73] !== L ? (Te = /* @__PURE__ */ u(ye, { flex: 1, children: /* @__PURE__ */ u(lo, { previewUrlRef: w, prefix: O, onChange: a, suffix: L, value: X }) }), e[69] = a, e[70] = X, e[71] = w, e[72] = O, e[73] = L, e[74] = Te) : Te = e[74];
1770
- let me;
1771
- e[75] !== ne ? (me = (gt) => {
1772
- gt == null || gt.style.setProperty("view-transition-name", ne);
1773
- }, e[75] = ne, e[76] = me) : me = e[76];
1774
- const qe = b === "desktop" ? "narrow" : "full";
1775
- let Oe;
1776
- e[77] !== y || e[78] !== qe ? (Oe = y("preview-frame.viewport-button.tooltip", {
1777
- context: qe
1778
- }), e[77] = y, e[78] = qe, e[79] = Oe) : Oe = e[79];
1779
- let Se;
1780
- e[80] !== Oe ? (Se = /* @__PURE__ */ u(oe, { size: 1, children: Oe }), e[80] = Oe, e[81] = Se) : Se = e[81];
1781
- let tt;
1782
- e[82] === Symbol.for("react.memo_cache_sentinel") ? (tt = ["bottom-start"], e[82] = tt) : tt = e[82];
1783
- let Fe;
1784
- e[83] !== y ? (Fe = y("preview-frame.viewport-button.aria-label"), e[83] = y, e[84] = Fe) : Fe = e[84];
1785
- const vt = b === "desktop" ? mn : hn;
1786
- let Be;
1787
- e[85] !== Fe || e[86] !== vt || e[87] !== C || e[88] !== b ? (Be = /* @__PURE__ */ u(Ie, { "data-testid": "preview-viewport-toggle", "data-viewport": b, "aria-label": Fe, icon: vt, mode: "bleed", onClick: C, tooltipProps: null }), e[85] = Fe, e[86] = vt, e[87] = C, e[88] = b, e[89] = Be) : Be = e[89];
1788
- let Ve;
1789
- e[90] !== me || e[91] !== Se || e[92] !== Be ? (Ve = /* @__PURE__ */ u(le, { align: "center", flex: "none", gap: 1, children: /* @__PURE__ */ u(Xe, { animate: !0, ref: me, content: Se, fallbackPlacements: tt, placement: "bottom", portal: !0, children: Be }) }), e[90] = me, e[91] = Se, e[92] = Be, e[93] = Ve) : Ve = e[93];
1790
- let Ke;
1791
- e[94] !== r || e[95] !== n || e[96] !== o || e[97] !== s || e[98] !== m || e[99] !== X ? (Ke = r && /* @__PURE__ */ u(le, { align: "center", flex: "none", gap: 1, children: /* @__PURE__ */ u(kr, { canToggleSharePreviewAccess: n, canUseSharedPreviewAccess: o, previewLocationRoute: X, initialUrl: s, perspective: m }) }), e[94] = r, e[95] = n, e[96] = o, e[97] = s, e[98] = m, e[99] = X, e[100] = Ke) : Ke = e[100];
1792
- let rt;
1793
- return e[101] !== be || e[102] !== Te || e[103] !== Ve || e[104] !== Ke || e[105] !== J ? (rt = /* @__PURE__ */ G(le, { align: "center", gap: 1, paddingX: 1, style: se, children: [
1794
- J,
1795
- be,
1796
- Te,
1797
- Ve,
1798
- Ke
1799
- ] }), e[101] = be, e[102] = Te, e[103] = Ve, e[104] = Ke, e[105] = J, e[106] = rt) : rt = e[106], rt;
1800
- };
1801
- function bo(t) {
1802
- var l;
1803
- const e = N.c(7), r = So, n = (l = t.options) == null ? void 0 : l.component;
1804
- let o;
1805
- e[0] !== n || e[1] !== t ? (o = n ? /* @__PURE__ */ u(n, { ...t, renderDefault: r }) : r(t), e[0] = n, e[1] = t, e[2] = o) : o = e[2];
1806
- const i = o;
1807
- let s;
1808
- e[3] === Symbol.for("react.memo_cache_sentinel") ? (s = {
1809
- position: "relative"
1810
- }, e[3] = s) : s = e[3];
1811
- let c;
1812
- e[4] === Symbol.for("react.memo_cache_sentinel") ? (c = {
1813
- minHeight: 0
1814
- }, e[4] = c) : c = e[4];
1815
- let a;
1816
- return e[5] !== i ? (a = /* @__PURE__ */ u(he, { flex: "none", padding: 2, borderBottom: !0, style: s, children: /* @__PURE__ */ u(le, { align: "center", style: c, children: i }) }), e[5] = i, e[6] = a) : a = e[6], a;
1817
- }
1818
- function So(t) {
1819
- return /* @__PURE__ */ u(Po, { ...t });
1820
- }
1821
- function _o(t) {
1822
- return t.matches("loading");
1823
- }
1824
- function xo(t) {
1825
- return t.matches("loaded");
1826
- }
1827
- function Eo(t) {
1828
- return t.matches({
1829
- loaded: "refreshing"
1830
- });
1831
- }
1832
- function Ro(t) {
1833
- return t.matches({
1834
- loaded: "reloading"
1835
- });
1836
- }
1837
- function Co(t) {
1838
- return t.context.visualEditingOverlaysEnabled;
1839
- }
1840
- function Ao(t) {
1841
- return t.hasTag("busy");
1842
- }
1843
- const yt = Ze.create(le), Mr = dt(pt(function(e, r) {
1844
- const {
1845
- header: n,
1846
- initialUrl: o,
1847
- loadersConnection: i,
1848
- overlaysConnection: s,
1849
- perspective: c,
1850
- viewport: a,
1851
- vercelProtectionBypass: l,
1852
- presentationRef: p,
1853
- previewUrlRef: f
1854
- } = e, [d, m] = z(null), g = Ge(d === null ? c : d), P = ke(() => {
1855
- const k = new URL(o);
1856
- return k.searchParams.get(He) || k.searchParams.set(He, g), (l || k.searchParams.get(Qe)) && k.searchParams.set(kt, "samesitenone"), l && !k.searchParams.get(Qe) && k.searchParams.set(Qe, l), k;
1857
- }, [o, g, l]);
1858
- K(() => {
1859
- i === "connected" && m((k) => k === null ? c : k);
1860
- }, [i, c]);
1861
- const {
1862
- t: h
1863
- } = xe(_e), {
1864
- devMode: v
1865
- } = Ct(), S = wn(), b = ve(null), w = /* @__PURE__ */ u(bo, { ...e, iframeRef: b, options: n });
1866
- vr(r, () => b.current);
1867
- const y = re(p, (k) => k.matches("loading") || k.matches({
1868
- loaded: "reloading"
1869
- })), [_, C] = z(!1), E = re(p, (k) => k.matches({
1870
- loaded: "refreshing"
1871
- })), [R, A] = z(!1), x = y || E || s === "connecting", U = pe(() => {
1872
- b.current && (b.current.src = P.toString(), p.send({
1873
- type: "iframe reload"
1874
- }));
1875
- }, [p, P]), I = pe(() => {
1876
- $(!0);
1877
- }, []), [T, $] = z(!1), [W, D] = z(!1);
1878
- K(() => {
1879
- if (!(y || E) && (s === "connecting" || s === "reconnecting")) {
1880
- const k = setTimeout(() => {
1881
- D(!0);
1882
- }, 5e3);
1883
- return () => clearTimeout(k);
1884
- }
1885
- }, [s, y, E]), K(() => {
1886
- if (!(y || E || !W)) {
1887
- if (s === "connected" && (A(!1), D(!1), C(!1), $(!1)), s === "connecting") {
1888
- const k = setTimeout(() => {
1889
- C(!0), console.error("Unable to connect to visual editing. Make sure you've setup '@sanity/visual-editing' correctly");
1890
- }, Ft);
1891
- return () => clearTimeout(k);
1892
- }
1893
- if (s === "reconnecting") {
1894
- const k = setTimeout(() => {
1895
- C(!0), A(!0);
1896
- }, Ft);
1897
- return () => clearTimeout(k);
1898
- }
1899
- }
1900
- }, [y, s, E, W]);
1901
- const F = pe(() => {
1902
- p.send({
1903
- type: "iframe loaded"
1904
- });
1905
- }, [p]), Z = ke(() => (y || s === "connecting" && !E) && !T, [T, y, E, s]), Q = bn(
1906
- // eslint-disable-next-line no-empty-function
1907
- pe(() => () => {
1908
- }, []),
1909
- () => CSS.supports("(view-transition-name: test)")
1910
- ), X = ke(() => [
1911
- Z ? "background" : "active",
1912
- y ? "reloading" : "idle",
1913
- // If CSS View Transitions are supported, then transition iframe viewport dimensions with that instead of Motion
1914
- Q ? "" : a,
1915
- W && !T ? "timedOut" : ""
1916
- ], [Q, T, y, Z, W, a]), [ne, ee] = z(a), [se, J] = z(Pt[a]);
1917
- K(() => {
1918
- if (Q && a !== ne) {
1919
- const k = () => {
1920
- ee(a), J(Pt[a]);
1921
- };
1922
- !S && "startViewTransition" in document && typeof document.startViewTransition == "function" ? document.startViewTransition({
1923
- // @ts-expect-error - fix typings
1924
- update: () => qn(() => k()),
1925
- types: ["sanity-iframe-viewport"]
1926
- }) : k();
1927
- }
1928
- }, [Q, S, ne, a]);
1929
- const ue = ut(), ae = jt(f), [te, B] = z(!1), [H] = z(/* @__PURE__ */ new Set()), q = at((k) => {
1930
- if (ae.some((V) => V.test(k))) {
1931
- B(k);
1932
- return;
1933
- }
1934
- H.has(k) || (H.add(k), console.warn("Visual Editing is here but misconfigured", {
1935
- reportedOrigin: k
1936
- }), ue.push({
1937
- closable: !0,
1938
- id: `presentation-iframe-origin-mismatch-${k}`,
1939
- status: "error",
1940
- duration: 1 / 0,
1941
- title: h("preview-frame.configuration.error.title"),
1942
- description: /* @__PURE__ */ u(Wt, { t: h, i18nKey: "preview-frame.configuration.error.description", components: {
1943
- Code: "code"
1944
- }, values: {
1945
- targetOrigin: P.origin,
1946
- reportedOrigin: k
1947
- } })
1948
- }));
1949
- }), Y = jr(), de = at((k) => {
1950
- if (!te) return;
1951
- const V = new URL(k, te);
1952
- Y(`${te}${V.pathname}${V.search}${V.hash}`);
1953
- });
1954
- return K(() => {
1955
- var fe;
1956
- if (!te)
1957
- return;
1958
- const k = (fe = b.current) == null ? void 0 : fe.contentWindow;
1959
- if (!k)
1960
- return;
1961
- const V = or({
1962
- targetOrigin: te
1963
- });
1964
- V.addTarget(k);
1965
- const j = V.createChannel({
1966
- name: "presentation",
1967
- heartbeat: !0,
1968
- connectTo: "visual-editing"
1969
- }, _t().provide({
1970
- actors: xt()
1971
- }));
1972
- j.on("visual-editing/navigate", (Ee) => {
1973
- de(Ee.url);
1974
- });
1975
- const ce = j.start();
1976
- return () => {
1977
- ce(), V.destroy();
1978
- };
1979
- }, [te]), K(() => {
1980
- if (s === "connecting" || s === "reconnecting") {
1981
- const k = setInterval(() => {
1982
- var j, ce;
1983
- (ce = (j = b.current) == null ? void 0 : j.contentWindow) == null || ce.postMessage(
1984
- {
1985
- domain: "sanity/channels",
1986
- from: "presentation",
1987
- type: "presentation/status"
1988
- },
1989
- /**
1990
- * The targetOrigin is set to '*' intentionally here, as we need to find out if the iframe is misconfigured and has the wrong origin
1991
- */
1992
- "*"
1993
- );
1994
- }, 1e3), V = new AbortController();
1995
- return window.addEventListener("message", ({
1996
- data: j
1997
- }) => {
1998
- j && typeof j == "object" && "domain" in j && j.domain === "sanity/channels" && "type" in j && j.type === "visual-editing/status" && "data" in j && typeof j.data == "object" && j.data && "origin" in j.data && typeof j.data.origin == "string" && q(j.data.origin);
1999
- }, {
2000
- signal: V.signal
2001
- }), () => {
2002
- V.abort(), clearInterval(k);
2003
- };
2004
- }
2005
- }, [s, _]), /* @__PURE__ */ u(Qn, { transition: S ? {
2006
- duration: 0
2007
- } : void 0, children: /* @__PURE__ */ G(Xr, { children: [
2008
- w,
2009
- /* @__PURE__ */ u(he, { flex: 1, tone: "transparent", children: /* @__PURE__ */ G(le, { align: "center", height: "fill", justify: "center", padding: (Q ? ne : a) === "desktop" ? 0 : 2, sizing: "border", style: {
2010
- position: "relative",
2011
- cursor: x ? "wait" : void 0
2012
- }, children: [
2013
- /* @__PURE__ */ u(mr, { children: !R && !y && !E && // viewport, // using CSS View Transitions instead of framer motion to drive this
2014
- W && !T ? /* @__PURE__ */ u(yt, { initial: "initial", animate: "animate", exit: "exit", variants: qt, justify: "center", align: "center", style: {
2015
- inset: "0",
2016
- position: "absolute",
2017
- backdropFilter: _ ? "blur(16px) saturate(0.5) grayscale(0.5)" : "blur(2px)",
2018
- transition: "backdrop-filter 0.2s ease-in-out",
2019
- // @TODO Because of Safari we have to do this
2020
- WebkitBackdropFilter: _ ? "blur(16px) saturate(0.5) grayscale(0.5)" : "blur(2px)",
2021
- WebkitTransition: "-webkit-backdrop-filter 0.2s ease-in-out",
2022
- zIndex: 1
2023
- }, children: /* @__PURE__ */ G(le, { style: {
2024
- ...ct[a]
2025
- }, justify: "center", align: "center", direction: "column", gap: 4, children: [
2026
- _ && /* @__PURE__ */ u(Ie, { disabled: !0, mode: "ghost", text: h("preview-frame.continue-button.text"), style: {
2027
- opacity: 0
2028
- } }),
2029
- /* @__PURE__ */ u(he, { radius: 2, tone: _ ? "caution" : "inherit", padding: 4, shadow: 1, children: /* @__PURE__ */ G(le, { justify: "center", align: "center", direction: "column", gap: 4, children: [
2030
- /* @__PURE__ */ u(st, { muted: !0 }),
2031
- /* @__PURE__ */ u(oe, { muted: !0, size: 1, children: _ ? h("preview-frame.status", {
2032
- context: "timeout"
2033
- }) : h("preview-frame.status", {
2034
- context: "connecting"
2035
- }) })
2036
- ] }) }),
2037
- _ && /* @__PURE__ */ u(
2038
- Ie,
2039
- {
2040
- tone: "critical",
2041
- onClick: I,
2042
- text: h("preview-frame.continue-button.text")
2043
- }
2044
- )
2045
- ] }) }) : (y || s === "connecting" && !E) && !T ? /* @__PURE__ */ u(yt, { initial: "initial", animate: "animate", exit: "exit", variants: qt, justify: "center", align: "center", style: {
2046
- inset: "0",
2047
- position: "absolute"
2048
- // boxShadow: '0 0 0 1px var(--card-shadow-outline-color)',
2049
- }, children: /* @__PURE__ */ G(le, { style: {
2050
- ...ct[a]
2051
- }, justify: "center", align: "center", direction: "column", gap: 4, children: [
2052
- /* @__PURE__ */ u(st, { muted: !0 }),
2053
- /* @__PURE__ */ u(oe, { muted: !0, size: 1, children: h("preview-frame.status", {
2054
- context: "loading"
2055
- }) })
2056
- ] }) }) : R && !T ? /* @__PURE__ */ u(yt, { initial: "initial", animate: "animate", exit: "exit", variants: To, justify: "center", align: "center", style: {
2057
- background: "var(--card-bg-color)",
2058
- inset: "0",
2059
- position: "absolute"
2060
- }, children: /* @__PURE__ */ u(Dt, { flex: 1, message: h("preview-frame.connection.error.text"), onRetry: U, onContinueAnyway: I, children: v && /* @__PURE__ */ G(Ue, { children: [
2061
- s !== "connected" && /* @__PURE__ */ u(he, { padding: 3, radius: 2, tone: "critical", children: /* @__PURE__ */ G(De, { space: 3, children: [
2062
- /* @__PURE__ */ u(ot, { muted: !0, size: 0, children: h("preview-frame.overlay.connection-status.label") }),
2063
- /* @__PURE__ */ u(it, { size: 1, children: h("channel.status", {
2064
- context: s
2065
- }) })
2066
- ] }) }),
2067
- i !== "connected" && /* @__PURE__ */ u(he, { padding: 3, radius: 2, tone: "critical", children: /* @__PURE__ */ G(De, { space: 3, children: [
2068
- /* @__PURE__ */ u(ot, { muted: !0, size: 0, children: h("preview-frame.loader.connection-status.label") }),
2069
- /* @__PURE__ */ u(it, { size: 1, children: h("channel.status", {
2070
- context: i
2071
- }) })
2072
- ] }) })
2073
- ] }) }) }) : null }),
2074
- /* @__PURE__ */ u(to, { animate: X, initial: ["background"], onLoad: F, preventClick: Z, ref: b, src: P.toString(), style: se, variants: Pt })
2075
- ] }) })
2076
- ] }) });
2077
- }));
2078
- Mr.displayName = "Memo(ForwardRef(Preview))";
2079
- const ct = {
2080
- desktop: {
2081
- width: "100%",
2082
- height: "100%"
2083
- },
2084
- mobile: {
2085
- width: 375,
2086
- height: 650
2087
- }
2088
- }, qt = {
2089
- initial: {
2090
- opacity: 1
2091
- },
2092
- animate: {
2093
- opacity: [0, 0, 1]
2094
- },
2095
- exit: {
2096
- opacity: [1, 0, 0]
2097
- }
2098
- }, To = {
2099
- initial: {
2100
- opacity: 1
2101
- },
2102
- animate: {
2103
- opacity: [0, 0, 1]
2104
- },
2105
- exit: {
2106
- opacity: [1, 0, 0]
2107
- }
2108
- }, Pt = {
2109
- desktop: {
2110
- ...ct.desktop,
2111
- boxShadow: "0 0 0 0px var(--card-border-color)"
2112
- },
2113
- mobile: {
2114
- ...ct.mobile,
2115
- boxShadow: "0 0 0 1px var(--card-border-color)"
2116
- },
2117
- background: {
2118
- opacity: 0,
2119
- scale: 1
2120
- },
2121
- idle: {
2122
- scale: 1
2123
- },
2124
- reloading: {
2125
- scale: [1, 1, 1, 0.98]
2126
- },
2127
- active: {
2128
- opacity: [0, 0, 1],
2129
- scale: 1
2130
- },
2131
- timedOut: {
2132
- opacity: [0, 0, 1]
2133
- }
2134
- };
2135
- function ko() {
2136
- let t = !1;
2137
- return (...e) => {
2138
- t || (console.warn(...e), t = !0);
2139
- };
2140
- }
2141
- const Mo = ko();
2142
- function $o(t, e) {
2143
- const r = N.c(9);
2144
- Jr(t);
2145
- let n;
2146
- r[0] === Symbol.for("react.memo_cache_sentinel") ? (n = {}, r[0] = n) : n = r[0];
2147
- const [o, i] = z(n);
2148
- let s;
2149
- r[1] === Symbol.for("react.memo_cache_sentinel") ? (s = {}, r[1] = s) : s = r[1];
2150
- const [c, a] = z(s), l = ve("");
2151
- let p;
2152
- r[2] !== e ? (p = (v, S, b) => {
2153
- const y = (b === void 0 ? [] : b).filter(Uo);
2154
- (S === "published" ? i : a)((C) => {
2155
- const E = {};
2156
- for (const A of y)
2157
- E[A._id] = A;
2158
- if (l.current !== e.current.url)
2159
- return l.current = e.current.url, {
2160
- [v]: E
2161
- };
2162
- const R = C[v];
2163
- return Gn(R, E) ? C : {
2164
- ...C,
2165
- [v]: E
2166
- };
2167
- });
2168
- }, r[2] = e, r[3] = p) : p = r[3];
2169
- const f = p;
2170
- let d;
2171
- const m = t === "published" ? o : c;
2172
- let g;
2173
- if (r[4] !== m) {
2174
- const v = Object.values(m).reduce(Io, {});
2175
- g = Object.values(v), r[4] = m, r[5] = g;
2176
- } else
2177
- g = r[5];
2178
- d = g;
2179
- const P = d;
2180
- let h;
2181
- return r[6] !== P || r[7] !== f ? (h = [P, f], r[6] = P, r[7] = f, r[8] = h) : h = r[8], h;
2182
- }
2183
- function Io(t, e) {
2184
- return Object.values(e).forEach((r) => {
2185
- t[r._id] = r;
2186
- }), t;
2187
- }
2188
- function Uo(t) {
2189
- return "_projectId" in t && t._projectId ? (Mo("Cross dataset references are not supported yet, ignoring source document", t), !1) : t;
2190
- }
2191
- function Lo(t) {
2192
- for (var e = [], r = 0; r < t.length; ) {
2193
- var n = t[r];
2194
- if (n === "*" || n === "+" || n === "?") {
2195
- e.push({ type: "MODIFIER", index: r, value: t[r++] });
2196
- continue;
2197
- }
2198
- if (n === "\\") {
2199
- e.push({ type: "ESCAPED_CHAR", index: r++, value: t[r++] });
2200
- continue;
2201
- }
2202
- if (n === "{") {
2203
- e.push({ type: "OPEN", index: r, value: t[r++] });
2204
- continue;
2205
- }
2206
- if (n === "}") {
2207
- e.push({ type: "CLOSE", index: r, value: t[r++] });
2208
- continue;
2209
- }
2210
- if (n === ":") {
2211
- for (var o = "", i = r + 1; i < t.length; ) {
2212
- var s = t.charCodeAt(i);
2213
- if (
2214
- // `0-9`
2215
- s >= 48 && s <= 57 || // `A-Z`
2216
- s >= 65 && s <= 90 || // `a-z`
2217
- s >= 97 && s <= 122 || // `_`
2218
- s === 95
2219
- ) {
2220
- o += t[i++];
2221
- continue;
2222
- }
2223
- break;
2224
- }
2225
- if (!o)
2226
- throw new TypeError("Missing parameter name at ".concat(r));
2227
- e.push({ type: "NAME", index: r, value: o }), r = i;
2228
- continue;
2229
- }
2230
- if (n === "(") {
2231
- var c = 1, a = "", i = r + 1;
2232
- if (t[i] === "?")
2233
- throw new TypeError('Pattern cannot start with "?" at '.concat(i));
2234
- for (; i < t.length; ) {
2235
- if (t[i] === "\\") {
2236
- a += t[i++] + t[i++];
2237
- continue;
2238
- }
2239
- if (t[i] === ")") {
2240
- if (c--, c === 0) {
2241
- i++;
2242
- break;
2243
- }
2244
- } else if (t[i] === "(" && (c++, t[i + 1] !== "?"))
2245
- throw new TypeError("Capturing groups are not allowed at ".concat(i));
2246
- a += t[i++];
2247
- }
2248
- if (c)
2249
- throw new TypeError("Unbalanced pattern at ".concat(r));
2250
- if (!a)
2251
- throw new TypeError("Missing pattern at ".concat(r));
2252
- e.push({ type: "PATTERN", index: r, value: a }), r = i;
2253
- continue;
2254
- }
2255
- e.push({ type: "CHAR", index: r, value: t[r++] });
2256
- }
2257
- return e.push({ type: "END", index: r, value: "" }), e;
2258
- }
2259
- function Oo(t, e) {
2260
- e === void 0 && (e = {});
2261
- for (var r = Lo(t), n = e.prefixes, o = n === void 0 ? "./" : n, i = e.delimiter, s = i === void 0 ? "/#?" : i, c = [], a = 0, l = 0, p = "", f = function(R) {
2262
- if (l < r.length && r[l].type === R)
2263
- return r[l++].value;
2264
- }, d = function(R) {
2265
- var A = f(R);
2266
- if (A !== void 0)
2267
- return A;
2268
- var x = r[l], U = x.type, I = x.index;
2269
- throw new TypeError("Unexpected ".concat(U, " at ").concat(I, ", expected ").concat(R));
2270
- }, m = function() {
2271
- for (var R = "", A; A = f("CHAR") || f("ESCAPED_CHAR"); )
2272
- R += A;
2273
- return R;
2274
- }, g = function(R) {
2275
- for (var A = 0, x = s; A < x.length; A++) {
2276
- var U = x[A];
2277
- if (R.indexOf(U) > -1)
2278
- return !0;
2279
- }
2280
- return !1;
2281
- }, P = function(R) {
2282
- var A = c[c.length - 1], x = R || (A && typeof A == "string" ? A : "");
2283
- if (A && !x)
2284
- throw new TypeError('Must have text between two parameters, missing text after "'.concat(A.name, '"'));
2285
- return !x || g(x) ? "[^".concat(We(s), "]+?") : "(?:(?!".concat(We(x), ")[^").concat(We(s), "])+?");
2286
- }; l < r.length; ) {
2287
- var h = f("CHAR"), v = f("NAME"), S = f("PATTERN");
2288
- if (v || S) {
2289
- var b = h || "";
2290
- o.indexOf(b) === -1 && (p += b, b = ""), p && (c.push(p), p = ""), c.push({
2291
- name: v || a++,
2292
- prefix: b,
2293
- suffix: "",
2294
- pattern: S || P(b),
2295
- modifier: f("MODIFIER") || ""
2296
- });
2297
- continue;
2298
- }
2299
- var w = h || f("ESCAPED_CHAR");
2300
- if (w) {
2301
- p += w;
2302
- continue;
2303
- }
2304
- p && (c.push(p), p = "");
2305
- var y = f("OPEN");
2306
- if (y) {
2307
- var b = m(), _ = f("NAME") || "", C = f("PATTERN") || "", E = m();
2308
- d("CLOSE"), c.push({
2309
- name: _ || (C ? a++ : ""),
2310
- pattern: _ && !C ? P(b) : C,
2311
- prefix: b,
2312
- suffix: E,
2313
- modifier: f("MODIFIER") || ""
2314
- });
2315
- continue;
2316
- }
2317
- d("END");
2318
- }
2319
- return c;
2320
- }
2321
- function Wo(t, e) {
2322
- var r = [], n = Ir(t, r, e);
2323
- return No(n, r, e);
2324
- }
2325
- function No(t, e, r) {
2326
- r === void 0 && (r = {});
2327
- var n = r.decode, o = n === void 0 ? function(i) {
2328
- return i;
2329
- } : n;
2330
- return function(i) {
2331
- var s = t.exec(i);
2332
- if (!s)
2333
- return !1;
2334
- for (var c = s[0], a = s.index, l = /* @__PURE__ */ Object.create(null), p = function(d) {
2335
- if (s[d] === void 0)
2336
- return "continue";
2337
- var m = e[d - 1];
2338
- m.modifier === "*" || m.modifier === "+" ? l[m.name] = s[d].split(m.prefix + m.suffix).map(function(g) {
2339
- return o(g, m);
2340
- }) : l[m.name] = o(s[d], m);
2341
- }, f = 1; f < s.length; f++)
2342
- p(f);
2343
- return { path: c, index: a, params: l };
2344
- };
2345
- }
2346
- function We(t) {
2347
- return t.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
2348
- }
2349
- function $r(t) {
2350
- return t && t.sensitive ? "" : "i";
2351
- }
2352
- function zo(t, e) {
2353
- if (!e)
2354
- return t;
2355
- for (var r = /\((?:\?<(.*?)>)?(?!\?)/g, n = 0, o = r.exec(t.source); o; )
2356
- e.push({
2357
- // Use parenthesized substring match if available, index otherwise
2358
- name: o[1] || n++,
2359
- prefix: "",
2360
- suffix: "",
2361
- modifier: "",
2362
- pattern: ""
2363
- }), o = r.exec(t.source);
2364
- return t;
2365
- }
2366
- function Do(t, e, r) {
2367
- var n = t.map(function(o) {
2368
- return Ir(o, e, r).source;
2369
- });
2370
- return new RegExp("(?:".concat(n.join("|"), ")"), $r(r));
2371
- }
2372
- function jo(t, e, r) {
2373
- return Fo(Oo(t, r), e, r);
2374
- }
2375
- function Fo(t, e, r) {
2376
- r === void 0 && (r = {});
2377
- for (var n = r.strict, o = n === void 0 ? !1 : n, i = r.start, s = i === void 0 ? !0 : i, c = r.end, a = c === void 0 ? !0 : c, l = r.encode, p = l === void 0 ? function(A) {
2378
- return A;
2379
- } : l, f = r.delimiter, d = f === void 0 ? "/#?" : f, m = r.endsWith, g = m === void 0 ? "" : m, P = "[".concat(We(g), "]|$"), h = "[".concat(We(d), "]"), v = s ? "^" : "", S = 0, b = t; S < b.length; S++) {
2380
- var w = b[S];
2381
- if (typeof w == "string")
2382
- v += We(p(w));
2383
- else {
2384
- var y = We(p(w.prefix)), _ = We(p(w.suffix));
2385
- if (w.pattern)
2386
- if (e && e.push(w), y || _)
2387
- if (w.modifier === "+" || w.modifier === "*") {
2388
- var C = w.modifier === "*" ? "?" : "";
2389
- v += "(?:".concat(y, "((?:").concat(w.pattern, ")(?:").concat(_).concat(y, "(?:").concat(w.pattern, "))*)").concat(_, ")").concat(C);
2390
- } else
2391
- v += "(?:".concat(y, "(").concat(w.pattern, ")").concat(_, ")").concat(w.modifier);
2392
- else {
2393
- if (w.modifier === "+" || w.modifier === "*")
2394
- throw new TypeError('Can not repeat "'.concat(w.name, '" without a prefix and suffix'));
2395
- v += "(".concat(w.pattern, ")").concat(w.modifier);
2396
- }
2397
- else
2398
- v += "(?:".concat(y).concat(_, ")").concat(w.modifier);
2399
- }
2400
- }
2401
- if (a)
2402
- o || (v += "".concat(h, "?")), v += r.endsWith ? "(?=".concat(P, ")") : "$";
2403
- else {
2404
- var E = t[t.length - 1], R = typeof E == "string" ? h.indexOf(E[E.length - 1]) > -1 : E === void 0;
2405
- o || (v += "(?:".concat(h, "(?=").concat(P, "))?")), R || (v += "(?=".concat(h, "|").concat(P, ")"));
2406
- }
2407
- return new RegExp(v, $r(r));
2408
- }
2409
- function Ir(t, e, r) {
2410
- return t instanceof RegExp ? zo(t, e) : Array.isArray(t) ? Do(t, e, r) : jo(t, e, r);
2411
- }
2412
- function Ur(t, e) {
2413
- return t instanceof Function ? t(e) : t;
2414
- }
2415
- function Bo(t, e) {
2416
- var r;
2417
- if (t.resolve) {
2418
- const n = (r = t.resolve(e)) == null ? void 0 : r.filter;
2419
- return n ? `// groq
2420
- *[${n}][0]{_id, _type}` : void 0;
2421
- }
2422
- return "type" in t ? `// groq
2423
- *[_type == "${t.type}"][0]{_id, _type}` : `// groq
2424
- *[${Ur(t.filter, e)}][0]{_id, _type}`;
2425
- }
2426
- function Vo(t, e) {
2427
- var r;
2428
- return t.resolve ? ((r = t.resolve(e)) == null ? void 0 : r.params) ?? e.params : "type" in t ? {} : Ur(t.params, e) ?? e.params;
2429
- }
2430
- function Ko(t, e) {
2431
- const r = Array.isArray(t) ? t : [t];
2432
- for (t of r) {
2433
- let n, o = t;
2434
- if (typeof t == "string")
2435
- try {
2436
- const i = new URL(t);
2437
- n = i.origin, o = i.pathname;
2438
- } catch {
2439
- }
2440
- if (!(n && e.origin !== n))
2441
- try {
2442
- const s = Wo(o, {
2443
- decode: decodeURIComponent
2444
- })(e.pathname);
2445
- if (s) {
2446
- const {
2447
- params: c,
2448
- path: a
2449
- } = s;
2450
- return {
2451
- origin: n,
2452
- params: c,
2453
- path: a
2454
- };
2455
- }
2456
- } catch {
2457
- throw new Error(`"${t}" is not a valid route pattern`);
2458
- }
2459
- }
2460
- }
2461
- function Ho(t) {
2462
- var _, C;
2463
- const e = N.c(22), {
2464
- navigate: r,
2465
- navigationHistory: n,
2466
- path: o,
2467
- targetOrigin: i,
2468
- resolvers: s
2469
- } = t;
2470
- let c;
2471
- e[0] !== s ? (c = s === void 0 ? [] : s, e[0] = s, e[1] = c) : c = e[1];
2472
- const a = c, {
2473
- state: l
2474
- } = et(), {
2475
- perspectiveStack: p
2476
- } = Ot();
2477
- let f;
2478
- e[2] === Symbol.for("react.memo_cache_sentinel") ? (f = {
2479
- apiVersion: lt
2480
- }, e[2] = f) : f = e[2];
2481
- const d = mt(f);
2482
- let m;
2483
- e[3] !== o || e[4] !== l ? (m = o || ((C = (_ = l._searchParams) == null ? void 0 : _.find(Go)) == null ? void 0 : C[1]) || "", e[3] = o, e[4] = l, e[5] = m) : m = e[5];
2484
- const g = m, [P, h] = z(void 0), v = ve(void 0);
2485
- let S;
2486
- e[6] !== r || e[7] !== n ? (S = (E, R) => {
2487
- var A, x;
2488
- (!E || v.current !== E._id) && (h({
2489
- document: E,
2490
- path: R.pathname
2491
- }), v.current = E == null ? void 0 : E._id, ((A = n.at(-1)) == null ? void 0 : A.id) === ((x = n.at(-2)) == null ? void 0 : x.id) && (r == null || r({
2492
- id: E == null ? void 0 : E._id,
2493
- type: E == null ? void 0 : E._type
2494
- })));
2495
- }, e[6] = r, e[7] = n, e[8] = S) : S = e[8];
2496
- const b = at(S);
2497
- let w;
2498
- e[9] !== d || e[10] !== b || e[11] !== p || e[12] !== g || e[13] !== a || e[14] !== i ? (w = () => {
2499
- const E = new URL(g, i);
2500
- if (a.length) {
2501
- let R;
2502
- for (const A of a) {
2503
- const x = Ko(A.route, E);
2504
- if (x) {
2505
- R = {
2506
- context: x,
2507
- resolver: A
2508
- };
2509
- break;
2510
- }
2511
- }
2512
- if (R) {
2513
- const A = Bo(R.resolver, R.context), x = Vo(R.resolver, R.context);
2514
- if (A) {
2515
- const U = new AbortController(), I = {
2516
- perspective: p,
2517
- signal: U.signal,
2518
- tag: "use-main-document"
2519
- };
2520
- return d.fetch(A, x, I).then((T) => b(T, E)).catch((T) => {
2521
- T instanceof Error && T.name === "AbortError" || (h({
2522
- document: void 0,
2523
- path: E.pathname
2524
- }), v.current = void 0);
2525
- }), () => {
2526
- U.abort();
2527
- };
2528
- }
2529
- }
2530
- }
2531
- h(void 0), v.current = void 0;
2532
- }, e[9] = d, e[10] = b, e[11] = p, e[12] = g, e[13] = a, e[14] = i, e[15] = w) : w = e[15];
2533
- let y;
2534
- return e[16] !== d || e[17] !== p || e[18] !== g || e[19] !== a || e[20] !== i ? (y = [d, p, g, a, i], e[16] = d, e[17] = p, e[18] = g, e[19] = a, e[20] = i, e[21] = y) : y = e[21], K(w, y), P;
2535
- }
2536
- function Go(t) {
2537
- const [e] = t;
2538
- return e === "preview";
2539
- }
2540
- const qo = /^([\w-]+):(0|[1-9][0-9]*)$/, Qo = /^([\w-]+):([0-9]+),([0-9]+)$/, Xo = /^([\w-]+):([\w-]+)$/;
2541
- function Jo(t) {
2542
- const e = [];
2543
- for (const r of t.split(".")) {
2544
- const n = qo.exec(r);
2545
- if (n) {
2546
- e.push(n[1], Number(n[2]));
2547
- continue;
2548
- }
2549
- const o = Qo.exec(r);
2550
- if (o) {
2551
- e.push(o[1], [Number(o[2]), Number(o[3])]);
2552
- continue;
2553
- }
2554
- const i = Xo.exec(r);
2555
- if (i) {
2556
- e.push(i[1], { _key: i[2] });
2557
- continue;
2558
- }
2559
- e.push(r);
2560
- }
2561
- return e;
2562
- }
2563
- function Yo(t) {
2564
- var r;
2565
- if (t === void 0)
2566
- return;
2567
- const e = (r = decodeURIComponent(t)) == null ? void 0 : r.split(".");
2568
- return e[0] === "drafts" && e.shift(), e.join(".");
2569
- }
2570
- function Zo(t) {
2571
- if (t !== void 0)
2572
- return pr.toString(Jo(decodeURIComponent(t)));
2573
- }
2574
- function es(t) {
2575
- return {
2576
- id: Yo(t.id),
2577
- path: Zo(t.path),
2578
- type: t.type
2579
- };
2580
- }
2581
- function nt(t) {
2582
- return Object.fromEntries(Object.entries(t).filter(([, e]) => e !== void 0 && e !== "" && e !== null));
2583
- }
2584
- function ts({
2585
- initialPreviewUrl: t,
2586
- routerNavigate: e,
2587
- routerState: r,
2588
- routerSearchParams: n,
2589
- frameStateRef: o
2590
- }) {
2591
- const i = ke(() => {
2592
- const {
2593
- id: d,
2594
- path: m,
2595
- type: g
2596
- } = es(r);
2597
- return {
2598
- id: d,
2599
- type: g,
2600
- path: m,
2601
- preview: n.preview || t.toString(),
2602
- perspective: n.perspective,
2603
- viewport: n.viewport,
2604
- inspect: n.inspect,
2605
- rev: n.rev,
2606
- since: n.since,
2607
- template: n.template,
2608
- templateParams: n.templateParams,
2609
- view: n.view,
2610
- // assist
2611
- pathKey: n.pathKey,
2612
- instruction: n.instruction,
2613
- // comments
2614
- comment: n.comment,
2615
- changesInspectorTab: n.changesInspectorTab
2616
- };
2617
- }, [r, n, t]), s = ke(() => nt({
2618
- inspect: i.inspect,
2619
- path: i.path,
2620
- rev: i.rev,
2621
- since: i.since,
2622
- template: i.template,
2623
- templateParams: i.templateParams,
2624
- view: i.view,
2625
- // assist
2626
- pathKey: i.pathKey,
2627
- instruction: i.instruction,
2628
- // comments
2629
- comment: i.comment,
2630
- changesInspectorTab: i.changesInspectorTab
2631
- }), [i.changesInspectorTab, i.comment, i.inspect, i.instruction, i.path, i.pathKey, i.rev, i.since, i.template, i.templateParams, i.view]), c = ke(() => nt({
2632
- perspective: i.perspective,
2633
- preview: i.preview,
2634
- viewport: i.viewport
2635
- }), [i.perspective, i.preview, i.viewport]), a = ve(r);
2636
- K(() => {
2637
- a.current = r;
2638
- }, [r]);
2639
- const [l, p] = z([r]);
2640
- return {
2641
- navigate: pe((d, m = {}, g) => {
2642
- d.id && (d.id = ft(d.id));
2643
- const {
2644
- _searchParams: P,
2645
- ...h
2646
- } = a.current, v = (P || []).reduce((y, [_, C]) => (y[_] = C, y), {}), S = nt({
2647
- ...h,
2648
- ...d
2649
- }), b = nt({
2650
- ...v,
2651
- ...m
2652
- });
2653
- h.id !== S.id && (delete b.template, delete b.templateParams), S._searchParams = Object.entries(b).reduce((y, [_, C]) => [...y, [_, C]], []);
2654
- const w = g ?? b.preview === o.current.url;
2655
- p((y) => [...y, S]), e(S, {
2656
- replace: w
2657
- });
2658
- }, [e, o]),
2659
- navigationHistory: l,
2660
- params: i,
2661
- searchParams: c,
2662
- structureParams: s
2663
- };
2664
- }
2665
- const rs = (t) => {
2666
- const e = N.c(10), [r, n] = z(ns);
2667
- let o;
2668
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (o = (f) => {
2669
- const d = window.open(f, "_blank");
2670
- d && n((m) => new Set(m).add(d));
2671
- }, e[0] = o) : o = e[0];
2672
- const i = o;
2673
- let s, c;
2674
- e[1] !== t || e[2] !== r ? (s = () => {
2675
- const f = [];
2676
- if (r.size && t)
2677
- for (const d of r)
2678
- d && "closed" in d && !d.closed && f.push(t.addTarget(d));
2679
- return () => {
2680
- f.forEach(is);
2681
- };
2682
- }, c = [t, r], e[1] = t, e[2] = r, e[3] = s, e[4] = c) : (s = e[3], c = e[4]), K(s, c);
2683
- let a, l;
2684
- e[5] !== r ? (a = () => {
2685
- if (r.size) {
2686
- const f = setInterval(() => {
2687
- const d = /* @__PURE__ */ new Set();
2688
- for (const m of r)
2689
- m && "closed" in m && m.closed && d.add(m);
2690
- d.size && n((m) => {
2691
- const g = new Set(m);
2692
- for (const P of d)
2693
- g.delete(P);
2694
- return g;
2695
- });
2696
- }, Fr);
2697
- return () => {
2698
- clearInterval(f);
2699
- };
2700
- }
2701
- }, l = [r], e[5] = r, e[6] = a, e[7] = l) : (a = e[6], l = e[7]), K(a, l);
2702
- let p;
2703
- return e[8] !== r ? (p = {
2704
- popups: r,
2705
- open: i
2706
- }, e[8] = r, e[9] = p) : p = e[9], p;
2707
- };
2708
- function ns() {
2709
- return /* @__PURE__ */ new Set();
2710
- }
2711
- function is(t) {
2712
- return t();
2713
- }
2714
- function Lr() {
2715
- const {
2716
- perspectiveStack: t,
2717
- selectedPerspectiveName: e,
2718
- selectedReleaseId: r
2719
- } = Ot();
2720
- return r ? t : e === void 0 ? "drafts" : e;
2721
- }
2722
- function bt() {
2723
- const t = N.c(4);
2724
- let e;
2725
- t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ new Map(), t[0] = e) : e = t[0];
2726
- const [r, n] = z(e);
2727
- let o;
2728
- e: {
2729
- const l = Array.from(r.values());
2730
- if (l.find(as)) {
2731
- o = "connected";
2732
- break e;
2733
- }
2734
- const p = l.filter(ss);
2735
- if (p.length) {
2736
- o = p.some(os) ? "connecting" : "reconnecting";
2737
- break e;
2738
- }
2739
- o = "idle";
2740
- }
2741
- const i = o;
2742
- let s;
2743
- t[1] === Symbol.for("react.memo_cache_sentinel") ? (s = (l) => {
2744
- n((p) => {
2745
- var d;
2746
- const f = new Map(p);
2747
- if (l.status === "disconnected")
2748
- f.delete(l.connection);
2749
- else {
2750
- const m = ((d = f.get(l.connection)) == null ? void 0 : d.hasConnected) || l.status === "connected", g = l.status === "handshaking" ? "connecting" : l.status;
2751
- f.set(l.connection, {
2752
- status: g,
2753
- hasConnected: m
2754
- });
2755
- }
2756
- return f;
2757
- });
2758
- }, t[1] = s) : s = t[1];
2759
- const c = s;
2760
- let a;
2761
- return t[2] !== i ? (a = [i, c], t[2] = i, t[3] = a) : a = t[3], a;
2762
- }
2763
- function os(t) {
2764
- const {
2765
- hasConnected: e
2766
- } = t;
2767
- return !e;
2768
- }
2769
- function ss(t) {
2770
- const {
2771
- status: e
2772
- } = t;
2773
- return e === "connecting";
2774
- }
2775
- function as(t) {
2776
- const {
2777
- status: e
2778
- } = t;
2779
- return e === "connected";
2780
- }
2781
- const cs = Ne(() => import("./LiveQueries-Crz53eU5.mjs")), ls = Ne(() => import("./PostMessageDocuments-BjgsJxz4.mjs")), us = Ne(() => import("./PostMessageRefreshMutations-D944RbO3.mjs")), ds = Ne(() => import("./PostMessagePerspective-pucY-E6a.mjs")), ps = Ne(() => import("./PostMessagePreviewSnapshots-CRQgRg4_.mjs")), fs = Ne(() => import("./PostMessageSchema-3eOtr1bs.mjs")), ms = Ne(() => import("./PostMessageTelemetry-DMTQDJeN.mjs")), hs = Pe(le)`
2782
- overflow-x: auto;
2783
- `;
2784
- function vs(t) {
2785
- var ze, $e, je;
2786
- const {
2787
- canToggleSharePreviewAccess: e,
2788
- canUseSharedPreviewAccess: r,
2789
- tool: n,
2790
- vercelProtectionBypass: o,
2791
- initialPreviewUrl: i,
2792
- previewUrlRef: s
2793
- } = t, c = jt(s), a = Ar(s), l = (ze = n.options) == null ? void 0 : ze.components, p = n.name || Br, {
2794
- unstable_navigator: f,
2795
- unstable_header: d
2796
- } = l || {}, {
2797
- navigate: m,
2798
- state: g
2799
- } = et(), P = gr(Object.fromEntries(g._searchParams || [])), h = Lr(), v = re(s, (M) => {
2800
- var O;
2801
- return ((O = M.context.previewMode) == null ? void 0 : O.shareAccess) !== !1;
2802
- }), [S] = z(() => {
2803
- var O;
2804
- const M = (O = n.options) == null ? void 0 : O.devMode;
2805
- return typeof M == "function" ? M() : typeof M == "boolean" ? M : typeof window < "u" && window.location.hostname === "localhost";
2806
- }), b = ve(null), [w, y] = z(), [_, C] = z(null), E = ve({
2807
- title: void 0,
2808
- url: void 0
2809
- }), {
2810
- navigate: R,
2811
- navigationHistory: A,
2812
- params: x,
2813
- searchParams: U,
2814
- structureParams: I
2815
- } = ts({
2816
- initialPreviewUrl: i,
2817
- routerNavigate: m,
2818
- routerState: g,
2819
- routerSearchParams: P,
2820
- frameStateRef: E
2821
- }), T = ke(() => br(R, 50), [R]), $ = sr(ii), W = ke(() => x.viewport ? "mobile" : "desktop", [x.viewport]), [D, F] = $o(h, E), Z = kn(), Q = Mn(), X = Ho({
2822
- // Prevent flash of content by using immediate navigation
2823
- navigate: R,
2824
- navigationHistory: A,
2825
- path: x.preview,
2826
- targetOrigin: a,
2827
- resolvers: (je = ($e = n.options) == null ? void 0 : $e.resolve) == null ? void 0 : je.mainDocuments
2828
- }), [ne, ee] = bt(), [se, J] = bt(), [ue, ae] = bt(), {
2829
- open: te
2830
- } = rs(w), B = re($, (M) => M.matches("loading"));
2831
- K(() => {
2832
- var L;
2833
- const M = (L = b.current) == null ? void 0 : L.contentWindow;
2834
- if (!M || B) return;
2835
- const O = or({
2836
- targetOrigin: a
2837
- });
2838
- return O.addTarget(M), y(O), () => {
2839
- O.destroy(), y(void 0);
2840
- };
2841
- }, [a, B]);
2842
- const H = at((M, O, L) => T(M, O, L));
2843
- K(() => {
2844
- if (!w) return;
2845
- const M = w.createChannel({
2846
- name: "presentation",
2847
- heartbeat: !0,
2848
- connectTo: "visual-editing"
2849
- }, _t().provide({
2850
- actors: xt()
2851
- }));
2852
- M.on("visual-editing/focus", (L) => {
2853
- "id" in L && H({
2854
- type: L.type,
2855
- id: L.id,
2856
- path: L.path
2857
- });
2858
- }), M.on("visual-editing/navigate", (L) => {
2859
- const {
2860
- title: Te
2861
- } = L;
2862
- let me = L.url;
2863
- if (!me.startsWith("http"))
2864
- try {
2865
- me = new URL(me, a).toString();
2866
- } catch {
2867
- }
2868
- if (E.current.url !== me)
2869
- try {
2870
- const [qe, Oe] = me.split("?"), Se = new URLSearchParams(Oe);
2871
- Se.delete(Qe), Se.delete(kt), H({}, {
2872
- preview: `${qe}${Se.size > 0 ? "?" : ""}${Se}`
2873
- });
2874
- } catch {
2875
- H({}, {
2876
- preview: me
2877
- });
2878
- }
2879
- E.current = {
2880
- title: Te,
2881
- url: me
2882
- };
2883
- }), M.on("visual-editing/meta", (L) => {
2884
- E.current.title = L.title;
2885
- }), M.on("visual-editing/toggle", (L) => {
2886
- $.send({
2887
- type: "toggle visual editing overlays",
2888
- enabled: L.enabled
2889
- });
2890
- }), M.on("visual-editing/documents", (L) => {
2891
- F(
2892
- "visual-editing",
2893
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2894
- L.perspective,
2895
- L.documents
2896
- );
2897
- }), M.on("visual-editing/refreshing", (L) => {
2898
- L.source === "manual" ? clearTimeout(we.current) : L.source === "mutation" && $.send({
2899
- type: "iframe refresh"
2900
- });
2901
- }), M.on("visual-editing/refreshed", () => {
2902
- $.send({
2903
- type: "iframe loaded"
2904
- });
2905
- }), M.onStatus(ee);
2906
- const O = M.start();
2907
- return C(M), () => {
2908
- O(), C(null);
2909
- };
2910
- }, [w, $, F, ee, a]), K(() => {
2911
- if (!w) return;
2912
- const M = w.createChannel({
2913
- name: "presentation",
2914
- connectTo: "preview-kit",
2915
- heartbeat: !0
2916
- }, _t().provide({
2917
- actors: xt()
2918
- }));
2919
- return M.onStatus(ae), M.on("preview-kit/documents", (O) => {
2920
- O.projectId === Z && O.dataset === Q && F(
2921
- "preview-kit",
2922
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2923
- O.perspective,
2924
- O.documents
2925
- );
2926
- }), M.start();
2927
- }, [w, Q, Z, F, ae, a]);
2928
- const q = pe((M) => {
2929
- T({
2930
- path: pr.toString(M)
2931
- }, {}, !0);
2932
- }, [T]), Y = pe((M) => {
2933
- const O = new URL(M, a), L = O.toString();
2934
- x.preview !== L && (Array.isArray(c) ? c.some((Te) => Te.test(L)) && T({}, {
2935
- preview: L
2936
- }) : O.origin === a && T({}, {
2937
- preview: L
2938
- }));
2939
- }, [a, x.preview, c, T]), de = pe((M) => {
2940
- T({}, M);
2941
- }, [T]);
2942
- K(() => {
2943
- x.id && x.path ? _ == null || _.post("presentation/focus", {
2944
- id: x.id,
2945
- path: x.path
2946
- }) : _ == null || _.post("presentation/blur");
2947
- }, [x.id, x.path, _]), K(() => {
2948
- if (E.current.url && x.preview && E.current.url !== x.preview) {
2949
- try {
2950
- const M = new URL(E.current.url, a).origin, O = new URL(x.preview, a).origin;
2951
- if (M !== O)
2952
- return;
2953
- } catch {
2954
- }
2955
- if (E.current.url = x.preview, ne === "connected") {
2956
- let M = x.preview;
2957
- if (M.startsWith("http"))
2958
- try {
2959
- const O = new URL(x.preview, a);
2960
- M = O.pathname + O.search + O.hash;
2961
- } catch {
2962
- }
2963
- _ == null || _.post("presentation/navigate", {
2964
- url: M,
2965
- type: "replace"
2966
- });
2967
- }
2968
- }
2969
- }, [ne, a, x.preview, _]);
2970
- const k = pe(() => _ == null ? void 0 : _.post("presentation/toggle-overlay"), [_]), [V, j] = z(null);
2971
- K(() => {
2972
- const M = (L) => {
2973
- Qt(L) && k();
2974
- }, O = (L) => {
2975
- Qt(L) && k(), ws(["mod", "\\"], L) && k();
2976
- };
2977
- return window.addEventListener("keydown", O), window.addEventListener("keyup", M), () => {
2978
- window.removeEventListener("keydown", O), window.removeEventListener("keyup", M);
2979
- };
2980
- }, [k]);
2981
- const [ce, fe] = z(null), [{
2982
- navigatorEnabled: Ee,
2983
- toggleNavigator: Re
2984
- }, Ce] = qi({
2985
- unstable_navigator: f
2986
- }), we = ve(void 0), Me = pe((M) => {
2987
- if ($.send({
2988
- type: "iframe refresh"
2989
- }), _) {
2990
- we.current = window.setTimeout(M, 300), _.post("presentation/refresh", {
2991
- source: "manual",
2992
- livePreviewEnabled: ue === "connected" || se === "connected"
2993
- });
2994
- return;
2995
- }
2996
- M();
2997
- }, [se, $, ue, _]), be = $n(), Ae = pe(({
2998
- id: M,
2999
- type: O,
3000
- path: L
3001
- }) => {
3002
- if (E.current.url)
3003
- return {
3004
- title: E.current.title || E.current.url,
3005
- name: "edit",
3006
- params: {
3007
- id: M,
3008
- path: L,
3009
- type: O,
3010
- inspect: In,
3011
- workspace: be.name,
3012
- mode: Vr,
3013
- preview: x.preview
3014
- }
3015
- };
3016
- }, [x.preview, be.name]), Le = pe((M) => {
3017
- T({}, {
3018
- viewport: M === "desktop" ? void 0 : "mobile"
3019
- }, !0);
3020
- }, [T]);
3021
- return /* @__PURE__ */ G(Ue, { children: [
3022
- /* @__PURE__ */ u(Zi, { devMode: S, name: p, navigate: T, params: x, searchParams: U, structureParams: I, children: /* @__PURE__ */ u(Hi, { navigate: T, children: /* @__PURE__ */ u(Yi, { params: x, children: /* @__PURE__ */ u(oi, { comlink: _, children: /* @__PURE__ */ u(hs, { "data-testid": "presentation-root", height: "fill", children: /* @__PURE__ */ G(vi, { children: [
3023
- /* @__PURE__ */ u(Ce, {}),
3024
- /* @__PURE__ */ u(zt, { id: "preview", minWidth: 325, defaultSize: Ee ? 50 : 75, order: 3, children: /* @__PURE__ */ u(le, { direction: "column", flex: 1, height: "fill", ref: fe, children: /* @__PURE__ */ u(yn, { element: ce, children: /* @__PURE__ */ u(
3025
- Mr,
3026
- {
3027
- canSharePreviewAccess: v,
3028
- canToggleSharePreviewAccess: e,
3029
- canUseSharedPreviewAccess: r,
3030
- header: d,
3031
- initialUrl: i,
3032
- loadersConnection: se,
3033
- navigatorEnabled: Ee,
3034
- onPathChange: Y,
3035
- onRefresh: Me,
3036
- openPopup: te,
3037
- overlaysConnection: ne,
3038
- previewUrl: x.preview,
3039
- perspective: h,
3040
- ref: b,
3041
- setViewport: Le,
3042
- targetOrigin: a,
3043
- toggleNavigator: Re,
3044
- toggleOverlay: k,
3045
- viewport: W,
3046
- vercelProtectionBypass: o,
3047
- presentationRef: $,
3048
- previewUrlRef: s
3049
- },
3050
- a
3051
- ) }) }) }),
3052
- /* @__PURE__ */ u(Ki, { documentId: x.id, documentsOnPage: D, documentType: x.type, getCommentIntent: Ae, mainDocumentState: X, onFocusPath: q, onStructureParams: de, searchParams: U, setDisplayedDocument: j, structureParams: I })
3053
- ] }) }) }) }) }) }),
3054
- /* @__PURE__ */ G(Lt, { children: [
3055
- w && /* @__PURE__ */ u(cs, { controller: w, perspective: h, liveDocument: V, onDocumentsOnPage: F, onLoadersConnection: J }),
3056
- _ && x.id && x.type && /* @__PURE__ */ u(us, { comlink: _, id: x.id, type: x.type, loadersConnection: se, previewKitConnection: ue }),
3057
- _ && /* @__PURE__ */ u(fs, { comlink: _, perspective: h }),
3058
- _ && D.length > 0 && /* @__PURE__ */ u(ps, { comlink: _, perspective: h, refs: D }),
3059
- _ && /* @__PURE__ */ u(ls, { comlink: _, perspective: h }),
3060
- _ && /* @__PURE__ */ u(ri, { comlink: _ }),
3061
- _ && /* @__PURE__ */ u(ds, { comlink: _, perspective: h }),
3062
- _ && /* @__PURE__ */ u(ms, { comlink: _ })
3063
- ] })
3064
- ] });
3065
- }
3066
- function Qt(t) {
3067
- return t.key === "Alt";
3068
- }
3069
- const gs = typeof window < "u" && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform), Xt = {
3070
- alt: "altKey",
3071
- ctrl: "ctrlKey",
3072
- mod: gs ? "metaKey" : "ctrlKey",
3073
- shift: "shiftKey"
3074
- };
3075
- function ws(t, e) {
3076
- return t.every((r) => Xt[r] ? e[Xt[r]] : e.key === r.toUpperCase());
3077
- }
3078
- async function ys(t, e, r, n, o = hr()) {
3079
- const i = t.withConfig({ apiVersion: Mt });
3080
- try {
3081
- const s = new Date(Date.now() + 1e3 * Kr), c = `drafts.${o}`, a = Tr(), l = i.patch(c).set({ secret: a, source: e, studioUrl: r, userId: n });
3082
- return await i.transaction().createOrReplace({ _id: c, _type: ur }).patch(l).commit({ tag: It }), { secret: a, expiresAt: s };
3083
- } finally {
3084
- try {
3085
- await i.delete({ query: Hr });
3086
- } catch (s) {
3087
- console.error("Failed to delete expired secrets", s);
3088
- }
3089
- }
3090
- }
3091
- function Ps({
3092
- client: t,
3093
- currentUserId: e
3094
- }) {
3095
- return ge(async () => await ys(t, "sanity/presentation", location.href, e));
3096
- }
3097
- function bs({
3098
- client: t
3099
- }) {
3100
- return ge(async () => t.fetch(lr, {}, {
3101
- tag: "presentation.fallback-to-shared-access-secret"
3102
- }));
3103
- }
3104
- function Ss({
3105
- client: t,
3106
- allowOption: e
3107
- }) {
3108
- return ge(async ({
3109
- input: r
3110
- }) => {
3111
- const {
3112
- initialUrl: n
3113
- } = r;
3114
- if (typeof URLPattern > "u" && await import("./index-iMZR29eF.mjs"), !e)
3115
- return [new URLPattern(n.origin)];
3116
- const o = typeof e == "function" ? await e({
3117
- client: t,
3118
- origin,
3119
- initialUrl: n
3120
- }) : e, s = (Array.isArray(o) ? o : [o]).map((c) => {
3121
- const a = new URLPattern(c);
3122
- if (a.hostname === "*")
3123
- throw new Error("It's insecure to allow any hostname, it could disclose data to a malicious site");
3124
- return a;
3125
- });
3126
- return s.some((c) => c.test(n.origin)) ? s : [...s, new URLPattern(n.origin)];
3127
- });
3128
- }
3129
- function _s({
3130
- client: t,
3131
- studioBasePath: e,
3132
- previewUrlOption: r,
3133
- perspective: n
3134
- }) {
3135
- return ge(async ({
3136
- input: o
3137
- }) => {
3138
- const {
3139
- origin: i
3140
- } = location;
3141
- if (typeof r == "function") {
3142
- const s = await r({
3143
- client: t,
3144
- studioBasePath: e,
3145
- // @TODO handle checking permissions here, and then generating a secret
3146
- previewUrlSecret: "",
3147
- studioPreviewPerspective: Ge(n),
3148
- previewSearchParam: o.previewSearchParam
3149
- });
3150
- return new URL(s, i);
3151
- }
3152
- if (!r)
3153
- return new URL("/", i);
3154
- if (typeof r == "string")
3155
- return new URL(r, i);
3156
- if (typeof r.initial == "function") {
3157
- const s = await r.initial({
3158
- client: t,
3159
- origin: i
3160
- });
3161
- return new URL(s, i);
3162
- }
3163
- return typeof r.initial == "string" ? new URL(r.initial, i) : new URL(r.preview || "/", r.origin || i);
3164
- });
3165
- }
3166
- function xs({
3167
- client: t,
3168
- previewUrlOption: e
3169
- }) {
3170
- return ge(async ({
3171
- input: r
3172
- }) => {
3173
- const {
3174
- targetOrigin: n
3175
- } = r;
3176
- if (typeof e == "object" && (e != null && e.draftMode))
3177
- return {
3178
- enable: e.draftMode.enable,
3179
- shareAccess: e.draftMode.shareAccess ?? !0
3180
- };
3181
- if (!e || typeof e == "string" || typeof e == "function" || !e.previewMode)
3182
- return !1;
3183
- const o = typeof e.previewMode == "function" ? await e.previewMode({
3184
- client: t,
3185
- origin,
3186
- targetOrigin: n
3187
- }) : e.previewMode;
3188
- return o === !1 ? !1 : {
3189
- enable: o.enable,
3190
- shareAccess: o.shareAccess ?? !0
3191
- };
3192
- });
3193
- }
3194
- function Es({
3195
- client: t,
3196
- studioBasePath: e,
3197
- previewUrlOption: r,
3198
- perspective: n
3199
- }) {
3200
- return ge(async ({
3201
- input: o
3202
- }) => {
3203
- const {
3204
- previewUrlSecret: i,
3205
- resolvedPreviewMode: s,
3206
- initialUrl: c
3207
- } = o;
3208
- if (typeof r == "function") {
3209
- const l = await r({
3210
- client: t,
3211
- studioBasePath: e,
3212
- previewUrlSecret: i,
3213
- studioPreviewPerspective: Ge(n),
3214
- previewSearchParam: c.toString()
3215
- });
3216
- return new URL(l, c);
3217
- }
3218
- if (!s)
3219
- throw new Error("Resolved preview mode is false");
3220
- const a = new URL(s.enable, c);
3221
- return a.searchParams.set(Tt, i), a.searchParams.set(He, Ge(n)), c.pathname !== a.pathname && a.searchParams.set(At, `${c.pathname}${c.search}${c.hash}`), a;
3222
- });
3223
- }
3224
- const Rs = ge(async ({
3225
- input: t
3226
- }) => {
3227
- const {
3228
- previewSearchParam: e,
3229
- initialUrl: r,
3230
- allowOrigins: n
3231
- } = t;
3232
- if (!e)
3233
- return r;
3234
- try {
3235
- const o = new URL(e, r.origin);
3236
- return n.some((i) => i.test(o.origin)) ? o : r;
3237
- } catch {
3238
- return r;
3239
- }
3240
- }), St = {
3241
- _id: Ye,
3242
- _type: $t
3243
- }, Cs = {
3244
- _id: `drafts.${hr()}`,
3245
- _type: ur
3246
- }, As = ir({
3247
- actions: {
3248
- "notify preview will likely fail": Dr("Missing permissions to create preview secret, or read shared preview secret. Preview will likely fail loading."),
3249
- "assign preview search param": ie({
3250
- previewSearchParam: (t, e) => e.previewSearchParam
3251
- }),
3252
- "assign error": ie({
3253
- error: (t, e) => e.error instanceof Error ? e.error : new Error(e.message, {
3254
- cause: e.error
3255
- })
3256
- })
3257
- },
3258
- actors: {
3259
- "check permission": ar(() => Yr(() => new Error("The 'check permission' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'check permission': fromObservable(({input}: {input: CheckPermissionInput}) => ...)}})"))),
3260
- "resolve initial url": ge(() => Promise.reject(new Error("The 'resolve initial url' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'resolve initial url': fromPromise(...)}})"))),
3261
- "resolve allow patterns": ge(() => Promise.reject(new Error("The 'resolve allow patterns' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'resolve allow pattern': fromPromise(...)}})"))),
3262
- "resolve url from preview search param": Rs,
3263
- "resolve preview mode": ge(() => Promise.reject(new Error("The 'resolve preview mode' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'resolve preview mode': fromPromise(...)}})"))),
3264
- "create preview secret": ge(async () => Promise.reject(new Error("The 'create preview secret' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'create preview secret': fromPromise(...)}})"))),
3265
- "read shared preview secret": ge(async () => Promise.reject(new Error("The 'read shared preview secret' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'read shared preview secret': fromPromise(...)}})"))),
3266
- "resolve preview mode url": ge(() => Promise.reject(new Error("The 'resolve preview mode url' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'resolve preview mode url': fromPromise(...)}})")))
3267
- },
3268
- guards: {
3269
- "has checked permissions": ({
3270
- context: t
3271
- }) => !!(t.previewAccessSharingCreatePermission && t.previewAccessSharingReadPermission && t.previewAccessSharingUpdatePermission && t.previewUrlSecretPermission),
3272
- "search param has new origin": ({
3273
- context: t,
3274
- event: e
3275
- }) => {
3276
- if (!t.previewUrl || !e.previewSearchParam)
3277
- return !1;
3278
- try {
3279
- const r = new URL(e.previewSearchParam, t.previewUrl);
3280
- return t.previewUrl.origin !== r.origin;
3281
- } catch {
3282
- return !1;
3283
- }
3284
- },
3285
- "can create preview secret": ({
3286
- context: t
3287
- }) => {
3288
- var e;
3289
- return ((e = t.previewUrlSecretPermission) == null ? void 0 : e.granted) === !0;
3290
- },
3291
- "has preview mode with created secret": ({
3292
- context: t
3293
- }, e) => {
3294
- var r;
3295
- return e === !1 ? !1 : ((r = t.previewUrlSecretPermission) == null ? void 0 : r.granted) === !0;
3296
- },
3297
- "has preview mode with share access": ({
3298
- context: t
3299
- }, e) => {
3300
- var r;
3301
- return e === !1 ? !1 : ((r = t.previewAccessSharingReadPermission) == null ? void 0 : r.granted) === !0;
3302
- },
3303
- "has preview mode without permissions": ({
3304
- context: t
3305
- }, e) => {
3306
- var r, n;
3307
- return e === !1 ? !1 : ((r = t.previewAccessSharingReadPermission) == null ? void 0 : r.granted) === !1 && ((n = t.previewUrlSecretPermission) == null ? void 0 : n.granted) === !1;
3308
- }
3309
- },
3310
- delays: {
3311
- expiredSecret: ({
3312
- context: t
3313
- }) => {
3314
- var n;
3315
- if (!((n = t.previewUrlSecret) != null && n.expiresAt))
3316
- return 0;
3317
- const e = Date.now(), r = t.previewUrlSecret.expiresAt.getTime();
3318
- return Math.max(r - e, 0);
3319
- }
3320
- }
3321
- }).createMachine({
3322
- // eslint-disable-next-line tsdoc/syntax
3323
- /** @xstate-layout N4IgpgJg5mDOIC5QAUBOYBuBLMB3ABAKoBKAMgMRiqoD2qAdAA4A2AhgC4BmdAtvWphwESpBFgB2GGgGMOWGuIDaABgC6K1YlCMasLO3nitIAB6IArAA56AZgCcAdkcBGS8vMAmO+YBszgDQgAJ6Izs4+9M7KACzKztGWHg4OPubmAL7pgQLYeERklNR0TGxcvPzoucJkYpIycgqKzupqxjp6BgrGZggAtM520ZHRdjZjNjFe7oEhCGERUbHxicmpGVkgOUL5FFS0DCwc3Kh8W3kitVKynUoeLZpIIO36ht2IvV62Hl7elmE2lh83xmoXCkRicQSSRS5gSmWylW2IkK+xKR3KZ2qogkVwaShs9zauheXUePV6gPo3jSUyi-xBczBi0hKxh5mc8M2iPOBVgYHY+EY3IIfNYqGkAAtBWLWDwNESOq8yaCbM56A4bB5fGllHYvD4fAz4h56CNfG5LKqHMpLdFOZidvRJWBpABrCRQZBUHhYWB6BSwcjyx7PG5vPrs5TqjWqyyjTXRDwMjwxei68J2ZQ2nyWXN2jYOkT0dCwGjMbDiKAASXEL1YzEIqGY5AgCjA9BxNFd7cLZGLcDLFertYM9cbzEu9RuGmD2mJYeVfRGdipyh86Yc0XiE3MDK3JssIwcrmtPjGSXzCMEPNI-dL5Y9NbrDabKOKhzKJwq16xd8Hj5HLAxybSdrkMGdWhDeclVAclN3odlzBsKwBjSSxjwcZM7DVeJ1w8P4xmidk7HtYVHRLf9KwAQWYZgaFwZAOHYKhxEDVtxHbTtu2-KpyIHB9qNo+jGPYZjUFY0C8Qgh450VUlYPedkHHoHwnDSZDVOiGwfGiBlUhXXwwjsQYtKSYzSJ-Pj7yHGi6IYpiWMDPZ31KY5TjIosKIEqBbOEhzxNgSTpzUWcnmg+TTHePV6Hw3MYgzaItJ0hlYRNTNkLiHxBl1GILN4zz+KHccADFaB4TEAGUwDFSVGNQWUWzbDs6m43tby8oqm1KmhyuFKqaolOrZSC8CQsg2SSSMRdel8ZSNUTdlcw8M07AZQZrDXdaDRtUZnHWK98r7DqPRKsrKuq8VBplHg3wOVyMQ8o7CpOrqzr6i7auukbGjGmSwrkqaFL6MJlLiWFlC1EGty0hknAiXVVPMRx12UJwOQLR72ueytMQAWRoCAwEajjmqkVrMb-by8YJsBvqUX6FUm8Nem2+hbWPUZErGTcjS8NUJg8AE9T1ZwHHwvKkSe6yPWpwnic4lqewp46ceFfHCbpmdmkZhcgZmyxzFsDmTPcXUUiNRKDy3ZQJlVLSkYlm9KaHWWifYhWyaVyyCul1Wf3V2nOzAn71DuHWYMivovGsBxPCy74beWaJDWCUJzBSFTrUcQYdMzIFHd-FXPTVmn5dJrsvcOrHfeL-2ac1kKCXDiLyWcNKJiiHM-BtONwgtnMEM1DVNwhhI7B8AurMo2uqgD260U-dzval6fXYbwkoIB5moijLLkm5tvYRBo1nGQtND11ZaIdzEiMeX6vV5LuW+QFIVLNFS7pXquVxv+pnF1FtYP4OY7AG3QohJMqcEDeGUq4NwYQBhLEnkWWAABXaQ0g4CBhfoKMiH9JRf1lKFUMEceiizVPA0+7gtQQy8LzXU6obaJTFtEJwHhXDIL7G-WepccHcO2PgqUjBrrEPCoDSOFI3C2AGHtQ8sIiJJGTILZS7JRaeGSKw7CnDbz8LwAHJ06AOBgHOtIdA7Ay5cUrpLHRT92ymOqsxExZj16iK3gAqI6oaQ6QtE4YylhkynzmkCBGNgNR7VvgdaxTBbEGIccY969jzHOTuuiL8bVol10JrEoxTj+QuN-iQlu7xwjKX1P8bSTC0hGhcKaBIOZAQGkBKE7RGSeFZMMRACqEoxRgCohgrBFjFY8Sibo3A+iOldJ6X0zBfp8l-UKeIshjgqTGTiPYPaGotS7igd8QWtgsp6iQnFOEd8q6tKEOM6qnTunoGmQM5JC83LDKdqMy5rBrlTP6bMoOUkGab3-kDU+ERVEpnsEjDRVSdljBXKeQY3h5gOBaa8mmzt4k-nHIMz2zzfzIvaYVNFVRxxzObosxAfg1Q2jSOERIh5kIBNGKaNZ2lvjhFhEimJHUCVCAxQ8j8Tz0m4vbJyzERKfnBQ3hNXWkdyWeJsCMVhqNsK6mTO4Q2Q9DysLCEhDw7LMntjQV8wMJhYDsCMfQVgnAxIAAowAmEYFgdAnSXRmIAJTkAFTEg1MzYCuIBZHKYKlUiqWwrCMJkDZgDAYceRMfwUisPYZYTIGxxA03gI8NqJLmZ6msKqENcjErqIZL0cethvDGXLew9hiYWnOjdDLb0vp-SsUzdNcwEMEJ7WTohDMfgU4RpTCpUJnhYrHghuEFpRcnyjhfMwFtet2Q2FNOwsWZarBan8TsuMkRvhIzPJGDwmkWnJLnf6g0aZl0mQTURDdsxYiGwwsRIEgwEwTuxj5IS9lRKORPeSJCOF4XgrUZqbZsxwZszcJtbC4RUg2FfTXU6PVzoDSGjwH9ik-gxRGG4NtxkkZblhgyxIhFQG5lSPEODj89VoYjKqGKURkij0zImXSUCwiozZuDLUCQQY6tOVEr1WDqMsxNCkP4RFPBZj+I4I0qoRMODjIlceBzkK6raWAIT7DDZlNPhUuVkKI0pEXbHBISF1yAiIqpi5KL7E5ISWYoTna2b6Qg+DcFN7EAphLdpdOWVoPJ0RXxl5HKrmTNuYahzaQviaQPVERa8mlGeBUnnQyDStSwcCzi4L1kuV4HHNR4DCFdRaVVFSzcZ4VVIVsDEVhZ5QnWlYZZvRKLj3-KlT0FIKjVRZghkCXwqkjQGzVFxvOMisoWYy46QV9ABN+mo3mFZZ427lp032jzVa2bJGtCUtciak1AA */
3324
- id: "Preview URL",
3325
- context: ({
3326
- input: t
3327
- }) => ({
3328
- initialUrl: null,
3329
- previewUrl: null,
3330
- error: null,
3331
- allowOrigins: null,
3332
- previewSearchParam: t.previewSearchParam,
3333
- previewUrlSecret: null,
3334
- previewAccessSharingCreatePermission: null,
3335
- previewAccessSharingReadPermission: null,
3336
- previewAccessSharingUpdatePermission: null,
3337
- previewUrlSecretPermission: null,
3338
- previewMode: null
3339
- }),
3340
- invoke: [{
3341
- src: "check permission",
3342
- input: () => ({
3343
- checkPermissionName: "read",
3344
- document: St
3345
- }),
3346
- onError: {
3347
- target: ".error",
3348
- actions: {
3349
- type: "assign error",
3350
- params: ({
3351
- event: t
3352
- }) => ({
3353
- message: "Failed to check permission",
3354
- error: t.error
3355
- })
3356
- }
3357
- },
3358
- onSnapshot: {
3359
- actions: ie({
3360
- previewAccessSharingReadPermission: ({
3361
- event: t
3362
- }) => t.snapshot.context ?? null
3363
- })
3364
- }
3365
- }, {
3366
- src: "check permission",
3367
- input: () => ({
3368
- checkPermissionName: "create",
3369
- document: St
3370
- }),
3371
- onError: {
3372
- target: ".error",
3373
- actions: {
3374
- type: "assign error",
3375
- params: ({
3376
- event: t
3377
- }) => ({
3378
- message: "Failed to check permission",
3379
- error: t.error
3380
- })
3381
- }
3382
- },
3383
- onSnapshot: {
3384
- actions: ie({
3385
- previewAccessSharingCreatePermission: ({
3386
- event: t
3387
- }) => t.snapshot.context ?? null
3388
- })
3389
- }
3390
- }, {
3391
- src: "check permission",
3392
- input: () => ({
3393
- checkPermissionName: "update",
3394
- document: St
3395
- }),
3396
- onError: {
3397
- target: ".error",
3398
- actions: {
3399
- type: "assign error",
3400
- params: ({
3401
- event: t
3402
- }) => ({
3403
- message: "Failed to check permission",
3404
- error: t.error
3405
- })
3406
- }
3407
- },
3408
- onSnapshot: {
3409
- actions: ie({
3410
- previewAccessSharingUpdatePermission: ({
3411
- event: t
3412
- }) => t.snapshot.context ?? null
3413
- })
3414
- }
3415
- }, {
3416
- src: "check permission",
3417
- input: () => ({
3418
- checkPermissionName: "create",
3419
- document: Cs
3420
- }),
3421
- onError: {
3422
- target: ".error",
3423
- actions: {
3424
- type: "assign error",
3425
- params: ({
3426
- event: t
3427
- }) => ({
3428
- message: "Failed to check permission",
3429
- error: t.error
3430
- })
3431
- }
3432
- },
3433
- onSnapshot: {
3434
- actions: ie({
3435
- previewUrlSecretPermission: ({
3436
- event: t
3437
- }) => t.snapshot.context ?? null
3438
- })
3439
- }
3440
- }],
3441
- on: {
3442
- "set preview search param": {
3443
- actions: {
3444
- type: "assign preview search param",
3445
- params: ({
3446
- event: t
3447
- }) => ({
3448
- previewSearchParam: t.previewSearchParam
3449
- })
3450
- }
3451
- }
3452
- },
3453
- states: {
3454
- checkingPermissions: {
3455
- always: {
3456
- guard: "has checked permissions",
3457
- target: "resolvingInitialUrl"
3458
- },
3459
- tags: "busy"
3460
- },
3461
- resolvingInitialUrl: {
3462
- invoke: {
3463
- src: "resolve initial url",
3464
- input: ({
3465
- context: t
3466
- }) => ({
3467
- previewSearchParam: t.previewSearchParam
3468
- }),
3469
- onError: {
3470
- target: "error",
3471
- actions: {
3472
- type: "assign error",
3473
- params: ({
3474
- event: t
3475
- }) => ({
3476
- message: "Failed to resolve initial url",
3477
- error: t.error
3478
- })
3479
- }
3480
- },
3481
- onDone: {
3482
- target: "resolvingAllowPatterns",
3483
- actions: ie({
3484
- initialUrl: ({
3485
- event: t
3486
- }) => t.output
3487
- })
3488
- }
3489
- },
3490
- tags: "busy"
3491
- },
3492
- error: {
3493
- type: "final",
3494
- tags: "error"
3495
- },
3496
- resolvingAllowPatterns: {
3497
- invoke: {
3498
- src: "resolve allow patterns",
3499
- input: ({
3500
- context: t
3501
- }) => ({
3502
- initialUrl: t.initialUrl
3503
- }),
3504
- onError: {
3505
- target: "error",
3506
- actions: {
3507
- type: "assign error",
3508
- params: ({
3509
- event: t
3510
- }) => ({
3511
- message: "Failed to resolve preview url allow patterns",
3512
- error: t.error
3513
- })
3514
- }
3515
- },
3516
- onDone: {
3517
- target: "resolvingUrlFromPreviewSearchParam",
3518
- actions: ie({
3519
- allowOrigins: ({
3520
- event: t
3521
- }) => t.output
3522
- })
3523
- }
3524
- },
3525
- tags: ["busy"]
3526
- },
3527
- resolvingUrlFromPreviewSearchParam: {
3528
- id: "loop",
3529
- invoke: {
3530
- src: "resolve url from preview search param",
3531
- input: ({
3532
- context: t
3533
- }) => ({
3534
- initialUrl: t.initialUrl,
3535
- allowOrigins: t.allowOrigins,
3536
- previewSearchParam: t.previewSearchParam
3537
- }),
3538
- onError: {
3539
- target: "error",
3540
- actions: {
3541
- type: "assign error",
3542
- params: ({
3543
- event: t
3544
- }) => ({
3545
- message: "Failed to resolve preview url from search param",
3546
- error: t.error
3547
- })
3548
- }
3549
- },
3550
- onDone: {
3551
- target: "resolvingPreviewMode",
3552
- actions: ie({
3553
- initialUrl: ({
3554
- event: t
3555
- }) => t.output
3556
- })
3557
- }
3558
- },
3559
- tags: ["busy"]
3560
- },
3561
- resolvingPreviewMode: {
3562
- on: {
3563
- "set preview search param": {
3564
- guard: "search param has new origin",
3565
- actions: {
3566
- type: "assign preview search param",
3567
- params: ({
3568
- event: t
3569
- }) => ({
3570
- previewSearchParam: t.previewSearchParam
3571
- })
3572
- },
3573
- target: "#loop",
3574
- reenter: !0
3575
- }
3576
- },
3577
- invoke: {
3578
- src: "resolve preview mode",
3579
- input: ({
3580
- context: t
3581
- }) => ({
3582
- targetOrigin: t.initialUrl.origin
3583
- }),
3584
- onError: {
3585
- target: "error",
3586
- actions: {
3587
- type: "assign error",
3588
- params: ({
3589
- event: t
3590
- }) => ({
3591
- message: "Failed to resolve preview url allow patterns",
3592
- error: t.error
3593
- })
3594
- }
3595
- },
3596
- onDone: [{
3597
- guard: {
3598
- type: "has preview mode with created secret",
3599
- params: ({
3600
- event: t
3601
- }) => t.output
3602
- },
3603
- actions: ie({
3604
- previewMode: ({
3605
- event: t
3606
- }) => t.output
3607
- }),
3608
- target: "previewMode.createPreviewSecret"
3609
- }, {
3610
- guard: {
3611
- type: "has preview mode with share access",
3612
- params: ({
3613
- event: t
3614
- }) => t.output
3615
- },
3616
- actions: ie({
3617
- previewMode: ({
3618
- event: t
3619
- }) => t.output
3620
- }),
3621
- target: "previewMode.readShareAccess"
3622
- }, {
3623
- guard: {
3624
- type: "has preview mode without permissions",
3625
- params: ({
3626
- event: t
3627
- }) => t.output
3628
- },
3629
- actions: [ie({
3630
- previewUrl: ({
3631
- context: t
3632
- }) => t.initialUrl
3633
- }), "notify preview will likely fail"],
3634
- target: "success"
3635
- }, {
3636
- actions: ie({
3637
- previewUrl: ({
3638
- context: t
3639
- }) => t.initialUrl
3640
- }),
3641
- target: "success"
3642
- }]
3643
- },
3644
- tags: ["busy"]
3645
- },
3646
- success: {
3647
- on: {
3648
- "set preview search param": {
3649
- guard: "search param has new origin",
3650
- actions: {
3651
- type: "assign preview search param",
3652
- params: ({
3653
- event: t
3654
- }) => ({
3655
- previewSearchParam: t.previewSearchParam
3656
- })
3657
- },
3658
- target: "#loop",
3659
- reenter: !0
3660
- }
3661
- }
3662
- },
3663
- previewMode: {
3664
- on: {
3665
- "set preview search param": {
3666
- guard: "search param has new origin",
3667
- actions: {
3668
- type: "assign preview search param",
3669
- params: ({
3670
- event: t
3671
- }) => ({
3672
- previewSearchParam: t.previewSearchParam
3673
- })
3674
- },
3675
- target: "#loop",
3676
- reenter: !0
3677
- }
3678
- },
3679
- states: {
3680
- createPreviewSecret: {
3681
- invoke: {
3682
- src: "create preview secret",
3683
- onError: {
3684
- target: "error",
3685
- actions: {
3686
- type: "assign error",
3687
- params: ({
3688
- event: t
3689
- }) => ({
3690
- message: "Failed to create preview secret",
3691
- error: t.error
3692
- })
3693
- }
3694
- },
3695
- onDone: {
3696
- target: "resolvePreviewUrl",
3697
- actions: ie({
3698
- previewUrlSecret: ({
3699
- event: t
3700
- }) => t.output
3701
- })
3702
- }
3703
- },
3704
- tags: ["busy"]
3705
- },
3706
- readShareAccess: {
3707
- invoke: {
3708
- src: "read shared preview secret",
3709
- onError: {
3710
- target: "error",
3711
- actions: {
3712
- type: "assign error",
3713
- params: ({
3714
- event: t
3715
- }) => ({
3716
- message: "Failed to read shared preview secret",
3717
- error: t.error
3718
- })
3719
- }
3720
- },
3721
- onDone: {
3722
- target: "resolvePreviewUrl",
3723
- actions: ie({
3724
- previewUrlSecret: ({
3725
- event: t
3726
- }) => ({
3727
- secret: t.output,
3728
- expiresAt: new Date(Date.now() + 1e3 * 60 * 60 * 60 * 24)
3729
- })
3730
- })
3731
- }
3732
- },
3733
- tags: ["busy"]
3734
- },
3735
- resolvePreviewUrl: {
3736
- invoke: {
3737
- src: "resolve preview mode url",
3738
- input: ({
3739
- context: t
3740
- }) => ({
3741
- initialUrl: t.initialUrl,
3742
- resolvedPreviewMode: t.previewMode,
3743
- previewUrlSecret: t.previewUrlSecret.secret
3744
- }),
3745
- onError: {
3746
- target: "error",
3747
- actions: {
3748
- type: "assign error",
3749
- params: ({
3750
- event: t
3751
- }) => ({
3752
- message: "Failed to resolve preview url",
3753
- error: t.error
3754
- })
3755
- }
3756
- },
3757
- onDone: {
3758
- target: "success",
3759
- actions: ie({
3760
- previewUrl: ({
3761
- event: t
3762
- }) => t.output
3763
- })
3764
- }
3765
- },
3766
- tags: ["busy"]
3767
- },
3768
- error: {
3769
- type: "final",
3770
- tags: ["error"]
3771
- },
3772
- success: {
3773
- after: {
3774
- expiredSecret: {
3775
- guard: "can create preview secret",
3776
- actions: ie({
3777
- previewUrlSecret: null
3778
- }),
3779
- target: "createPreviewSecret",
3780
- reenter: !0
3781
- }
3782
- }
3783
- }
3784
- },
3785
- initial: "readShareAccess"
3786
- }
3787
- },
3788
- initial: "checkingPermissions"
3789
- });
3790
- function Ts(t, e) {
3791
- var _;
3792
- const r = N.c(24), n = Un();
3793
- let o;
3794
- r[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {
3795
- apiVersion: lt
3796
- }, r[0] = o) : o = r[0];
3797
- const i = mt(o), s = yr(), c = s == null ? void 0 : s.id, a = wr(), l = ((_ = a == null ? void 0 : a.activeWorkspace) == null ? void 0 : _.basePath) || "/", p = et();
3798
- let f;
3799
- r[1] !== p.state._searchParams ? (f = new URLSearchParams(p.state._searchParams).get("preview"), r[1] = p.state._searchParams, r[2] = f) : f = r[2];
3800
- const d = f, {
3801
- push: m
3802
- } = ut(), {
3803
- t: g
3804
- } = xe(_e), P = Lr();
3805
- let h;
3806
- if (r[3] !== e || r[4] !== i || r[5] !== c || r[6] !== n || r[7] !== P || r[8] !== t || r[9] !== m || r[10] !== l || r[11] !== g) {
3807
- let C;
3808
- r[13] !== m || r[14] !== g ? (C = () => m({
3809
- id: "preview-url-secret.missing-grants",
3810
- closable: !0,
3811
- status: "error",
3812
- duration: 1 / 0,
3813
- title: g("preview-url-secret.missing-grants")
3814
- }), r[13] = m, r[14] = g, r[15] = C) : C = r[15];
3815
- let E;
3816
- r[16] !== n ? (E = (R) => {
3817
- const {
3818
- input: A
3819
- } = R;
3820
- return n.checkDocumentPermission(A.checkPermissionName, A.document);
3821
- }, r[16] = n, r[17] = E) : E = r[17], h = As.provide({
3822
- actions: {
3823
- "notify preview will likely fail": C
3824
- },
3825
- actors: {
3826
- "create preview secret": Ps({
3827
- client: i,
3828
- currentUserId: c
3829
- }),
3830
- "read shared preview secret": bs({
3831
- client: i
3832
- }),
3833
- "resolve allow patterns": Ss({
3834
- client: i,
3835
- allowOption: e
3836
- }),
3837
- "resolve initial url": _s({
3838
- client: i,
3839
- studioBasePath: l,
3840
- previewUrlOption: t,
3841
- perspective: P
3842
- }),
3843
- "resolve preview mode": xs({
3844
- client: i,
3845
- previewUrlOption: t
3846
- }),
3847
- "resolve preview mode url": Es({
3848
- client: i,
3849
- studioBasePath: l,
3850
- previewUrlOption: t,
3851
- perspective: P
3852
- }),
3853
- "check permission": ar(E)
3854
- }
3855
- }), r[3] = e, r[4] = i, r[5] = c, r[6] = n, r[7] = P, r[8] = t, r[9] = m, r[10] = l, r[11] = g, r[12] = h;
3856
- } else
3857
- h = r[12];
3858
- let v;
3859
- r[18] !== d ? (v = {
3860
- input: {
3861
- previewSearchParam: d
3862
- }
3863
- }, r[18] = d, r[19] = v) : v = r[19];
3864
- const S = sr(h, v);
3865
- let b, w;
3866
- r[20] !== S || r[21] !== d ? (b = () => {
3867
- S.send({
3868
- type: "set preview search param",
3869
- previewSearchParam: d
3870
- });
3871
- }, w = [S, d], r[20] = S, r[21] = d, r[22] = b, r[23] = w) : (b = r[22], w = r[23]), K(b, w);
3872
- const y = re(S, ks);
3873
- if (y)
3874
- throw y;
3875
- return S;
3876
- }
3877
- function ks(t) {
3878
- return t.status === "error" ? t.error : t.hasTag("error") ? t.context.error : null;
3879
- }
3880
- function Ms(t) {
3881
- const e = N.c(9), {
3882
- t: r
3883
- } = xe(_e), {
3884
- push: n
3885
- } = ut(), o = et();
3886
- let i;
3887
- e[0] !== o.state._searchParams ? (i = new URLSearchParams(o.state._searchParams).get("preview"), e[0] = o.state._searchParams, e[1] = i) : i = e[1];
3888
- const s = i, c = re(t, Is), a = re(t, $s);
3889
- let l, p;
3890
- e[2] !== c || e[3] !== a || e[4] !== s || e[5] !== n || e[6] !== r ? (l = () => {
3891
- if (!Array.isArray(c) || !s || !a)
3892
- return;
3893
- const f = new URL(s, a).origin;
3894
- c.some((d) => d.test(f)) || n({
3895
- closable: !0,
3896
- id: `presentation-iframe-origin-mismatch-${f}`,
3897
- status: "error",
3898
- duration: 1 / 0,
3899
- title: r("preview-search-param.configuration.error.title"),
3900
- description: /* @__PURE__ */ u(Wt, { t: r, i18nKey: "preview-search-param.configuration.error.description", components: {
3901
- Code: "code"
3902
- }, values: {
3903
- previewSearchParam: s,
3904
- blockedOrigin: f
3905
- } })
3906
- });
3907
- }, p = [c, a, s, n, r], e[2] = c, e[3] = a, e[4] = s, e[5] = n, e[6] = r, e[7] = l, e[8] = p) : (l = e[7], p = e[8]), K(l, p);
3908
- }
3909
- function $s(t) {
3910
- var e;
3911
- return (e = t.context.previewUrl) == null ? void 0 : e.origin;
3912
- }
3913
- function Is(t) {
3914
- return t.context.allowOrigins;
3915
- }
3916
- function Us(t, e) {
3917
- let r = new AbortController(), n = [];
3918
- async function o(s, c) {
3919
- const { result: a, syncTags: l } = await t.fetch(
3920
- Gr,
3921
- {},
3922
- {
3923
- filterResponse: !1,
3924
- lastLiveEventId: s,
3925
- tag: "preview-url-secret.fetch-vercel-bypass-protection-secret"
3926
- }
3927
- );
3928
- Array.isArray(l) && (n = l), c.aborted || e(a);
3929
- }
3930
- const i = t.live.events().subscribe({
3931
- next: (s) => {
3932
- s.type === "message" && (r.abort(), r = new AbortController(), s.tags.some((c) => n.includes(c)) && o(s.id, r.signal));
3933
- },
3934
- // eslint-disable-next-line no-console
3935
- error: (s) => console.error(s)
3936
- });
3937
- return o(null, r.signal), () => {
3938
- i.unsubscribe(), r.abort();
3939
- };
3940
- }
3941
- function Ls() {
3942
- const t = N.c(7);
3943
- let e;
3944
- t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = {
3945
- apiVersion: lt
3946
- }, t[0] = e) : e = t[0];
3947
- const r = mt(e), [n, o] = Sn(Os, "loading"), [i, s] = z(null);
3948
- let c, a;
3949
- t[1] !== r ? (c = () => {
3950
- const p = Us(r, (f) => {
3951
- s(f), o();
3952
- });
3953
- return () => p();
3954
- }, a = [r], t[1] = r, t[2] = c, t[3] = a) : (c = t[2], a = t[3]), K(c, a);
3955
- let l;
3956
- return t[4] !== n || t[5] !== i ? (l = [i, n], t[4] = n, t[5] = i, t[6] = l) : l = t[6], l;
3957
- }
3958
- function Os() {
3959
- return "ready";
3960
- }
3961
- function Ws(t) {
3962
- var g, P;
3963
- const e = N.c(8), {
3964
- tool: r
3965
- } = t, n = Ts((g = r.options) == null ? void 0 : g.previewUrl, (P = r.options) == null ? void 0 : P.allowOrigins);
3966
- Ms(n);
3967
- const o = re(n, Fs), i = re(n, js), s = re(n, Ds), c = re(n, zs), a = re(n, Ns), [l, p] = Ls();
3968
- if (!a || p === "loading" || !o || typeof o.granted > "u" || !i || typeof i.granted > "u" || !c || !s || typeof s.granted > "u" || typeof c.granted > "u") {
3969
- let h;
3970
- return e[0] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ u(cr, {}), e[0] = h) : h = e[0], h;
3971
- }
3972
- const f = (o == null ? void 0 : o.granted) === !0 && (i == null ? void 0 : i.granted) === !0, d = (s == null ? void 0 : s.granted) === !0;
3973
- let m;
3974
- return e[1] !== n || e[2] !== f || e[3] !== d || e[4] !== r || e[5] !== a || e[6] !== l ? (m = /* @__PURE__ */ u(vs, { tool: r, initialPreviewUrl: a, vercelProtectionBypass: l, canToggleSharePreviewAccess: f, canUseSharedPreviewAccess: d, previewUrlRef: n }), e[1] = n, e[2] = f, e[3] = d, e[4] = r, e[5] = a, e[6] = l, e[7] = m) : m = e[7], m;
3975
- }
3976
- function Ns(t) {
3977
- return t.context.previewUrl;
3978
- }
3979
- function zs(t) {
3980
- return t.context.previewUrlSecretPermission;
3981
- }
3982
- function Ds(t) {
3983
- return t.context.previewAccessSharingReadPermission;
3984
- }
3985
- function js(t) {
3986
- return t.context.previewAccessSharingUpdatePermission;
3987
- }
3988
- function Fs(t) {
3989
- return t.context.previewAccessSharingCreatePermission;
3990
- }
3991
- const ia = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3992
- __proto__: null,
3993
- default: Ws
3994
- }, Symbol.toStringTag, { value: "Module" }));
3995
- export {
3996
- ia as P,
3997
- xt as c
3998
- };
3999
- //# sourceMappingURL=PresentationToolGrantsCheck-B0q4AQ3b.mjs.map