sanity-plugin-mux-input 2.0.1 → 2.0.3
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.
- package/LICENSE +1 -1
- package/lib/_chunks/Input-4ec3c050.js +2666 -0
- package/lib/_chunks/Input-4ec3c050.js.map +1 -0
- package/lib/_chunks/Input-aa6d929b.js +2636 -0
- package/lib/_chunks/Input-aa6d929b.js.map +1 -0
- package/lib/_chunks/Preview-1664b7d5.js +28 -0
- package/lib/_chunks/Preview-1664b7d5.js.map +1 -0
- package/lib/_chunks/Preview-43ce9c72.js +26 -0
- package/lib/_chunks/{Preview-3195237b.js.map → Preview-43ce9c72.js.map} +1 -1
- package/lib/_chunks/VideoSource.styled-24577ec8.js +318 -0
- package/lib/_chunks/VideoSource.styled-24577ec8.js.map +1 -0
- package/lib/_chunks/VideoSource.styled-99ffa712.js +336 -0
- package/lib/_chunks/VideoSource.styled-99ffa712.js.map +1 -0
- package/lib/_chunks/index-9933dea2.js +264 -0
- package/lib/_chunks/index-9933dea2.js.map +1 -0
- package/lib/_chunks/index-c54f5393.js +247 -0
- package/lib/_chunks/index-c54f5393.js.map +1 -0
- package/lib/{src/index.d.ts → index.d.ts} +0 -0
- package/lib/index.esm.js +2 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +9 -1
- package/lib/index.js.map +1 -1
- package/package.json +27 -34
- package/lib/_chunks/Input-2ba004d3.js +0 -2
- package/lib/_chunks/Input-2ba004d3.js.map +0 -1
- package/lib/_chunks/Input-af5a0a66.esm.js +0 -2
- package/lib/_chunks/Input-af5a0a66.esm.js.map +0 -1
- package/lib/_chunks/Preview-3195237b.js +0 -2
- package/lib/_chunks/Preview-bb256342.esm.js +0 -2
- package/lib/_chunks/Preview-bb256342.esm.js.map +0 -1
- package/lib/_chunks/VideoSource.styled-1b994d90.js +0 -2
- package/lib/_chunks/VideoSource.styled-1b994d90.js.map +0 -1
- package/lib/_chunks/VideoSource.styled-f92259cd.esm.js +0 -2
- package/lib/_chunks/VideoSource.styled-f92259cd.esm.js.map +0 -1
- package/lib/_chunks/index-3d8d7583.esm.js +0 -2
- package/lib/_chunks/index-3d8d7583.esm.js.map +0 -1
- package/lib/_chunks/index-efe6ce48.js +0 -2
- package/lib/_chunks/index-efe6ce48.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VideoSource.styled-1b994d90.js","sources":["../../src/hooks/useAssetDocumentValues.ts","../../src/hooks/useClient.ts","../../src/util/readSecrets.ts","../../src/util/generateJwt.ts","../../src/util/getPlaybackId.ts","../../src/util/getPlaybackPolicy.ts","../../src/util/getPosterSrc.ts","../../src/components/VideoSource.styled.tsx","../../src/util/getAnimatedPosterSrc.ts"],"sourcesContent":["import {isReference} from 'sanity'\nimport {useDocumentValues} from 'sanity'\n\nimport type {Reference, VideoAssetDocument} from '../util/types'\n\nconst path = ['assetId', 'data', 'playbackId', 'status', 'thumbTime', 'filename']\nexport const useAssetDocumentValues = (asset: Reference | null | undefined) =>\n useDocumentValues<VideoAssetDocument | null | undefined>(\n isReference(asset) ? asset._ref! : '',\n path\n )\n","// As it's required to specify the API Version this custom hook ensures it's all using the same version\nimport {useClient as useSanityClient} from 'sanity'\n\nexport function useClient() {\n return useSanityClient({apiVersion: '2022-09-14'})\n}\n","// Utils with a readName prefix are suspendable and should only be called in the render body\n// Not inside event callbacks or a useEffect.\n// They may be called dynamically, unlike useEffect\n\n// @TODO rename to readSigningPair\n\nimport type {SanityClient} from '@sanity/client'\nimport {suspend} from 'suspend-react'\n\nimport {cacheNs} from '../util/constants'\nimport {type Secrets} from '../util/types'\n\nexport const _id = 'secrets.mux' as const\n\nexport function readSecrets(client: SanityClient): Secrets {\n const {projectId, dataset} = client.config()\n return suspend(async () => {\n const data = await client.fetch(\n /* groq */ `*[_id == $_id][0]{\n token,\n secretKey,\n enableSignedUrls,\n signingKeyId,\n signingKeyPrivate\n }`,\n {_id}\n )\n return {\n token: data?.token || null,\n secretKey: data?.secretKey || null,\n enableSignedUrls: Boolean(data?.enableSignedUrls) || false,\n signingKeyId: data?.signingKeyId || null,\n signingKeyPrivate: data?.signingKeyPrivate || null,\n }\n }, [cacheNs, _id, projectId, dataset])\n}\n","import type {SanityClient} from '@sanity/client'\nimport {suspend} from 'suspend-react'\n\nimport {readSecrets} from './readSecrets'\nimport type {AnimatedThumbnailOptions, ThumbnailOptions} from './types'\n\nexport type Audience = 'g' | 's' | 't' | 'v'\n\nexport type Payload<T extends Audience> = T extends 'g'\n ? AnimatedThumbnailOptions\n : T extends 's'\n ? never\n : T extends 't'\n ? ThumbnailOptions\n : T extends 'v'\n ? never\n : never\n\nexport function generateJwt<T extends Audience>(\n client: SanityClient,\n playbackId: string,\n aud: T,\n payload?: Payload<T>\n): string {\n const {signingKeyId, signingKeyPrivate} = readSecrets(client)\n if (!signingKeyId) {\n throw new TypeError('Missing signingKeyId')\n }\n if (!signingKeyPrivate) {\n throw new TypeError('Missing signingKeyPrivate')\n }\n\n const {default: sign} = suspend(() => import('jsonwebtoken-esm/sign'), ['jsonwebtoken-esm/sign'])\n\n return sign(\n payload ? JSON.parse(JSON.stringify(payload, (_, v) => v ?? undefined)) : {},\n atob(signingKeyPrivate),\n {\n algorithm: 'RS256',\n keyid: signingKeyId,\n audience: aud,\n subject: playbackId,\n noTimestamp: true,\n expiresIn: '12h',\n }\n )\n}\n","import type {VideoAssetDocument} from './types'\n\nexport function getPlaybackId(asset: VideoAssetDocument): string {\n if (!asset?.playbackId) {\n console.error('Asset is missing a playbackId', {asset})\n throw new TypeError(`Missing playbackId`)\n }\n return asset.playbackId\n}\n","import type {PlaybackPolicy, VideoAssetDocument} from './types'\n\nexport function getPlaybackPolicy(asset: VideoAssetDocument): PlaybackPolicy {\n return asset.data?.playback_ids?.[0]?.policy ?? 'public'\n}\n","import type {SanityClient} from '@sanity/client'\n\nimport {generateJwt} from './generateJwt'\nimport {getPlaybackId} from './getPlaybackId'\nimport {getPlaybackPolicy} from './getPlaybackPolicy'\nimport type {MuxThumbnailUrl, ThumbnailOptions, VideoAssetDocument} from './types'\n\nexport interface PosterSrcOptions extends ThumbnailOptions {\n asset: VideoAssetDocument\n client: SanityClient\n}\n\nexport function getPosterSrc({\n asset,\n client,\n fit_mode,\n height,\n time = asset.thumbTime,\n width,\n}: PosterSrcOptions): MuxThumbnailUrl {\n const params = {fit_mode, height, time, width}\n const playbackId = getPlaybackId(asset)\n\n let searchParams = new URLSearchParams(\n JSON.parse(JSON.stringify(params, (_, v) => v ?? undefined))\n )\n if (getPlaybackPolicy(asset) === 'signed') {\n const token = generateJwt(client, playbackId, 't', params)\n searchParams = new URLSearchParams({token})\n }\n\n return `https://image.mux.com/${playbackId}/thumbnail.png?${searchParams}`\n}\n","import {LockIcon, UnknownIcon} from '@sanity/icons'\nimport {Box, Card, Grid, Inline, Spinner} from '@sanity/ui'\nimport React, {memo, Suspense, useMemo} from 'react'\nimport {MediaPreview} from 'sanity'\nimport styled from 'styled-components'\nimport {suspend} from 'suspend-react'\nimport {useErrorBoundary} from 'use-error-boundary'\n\nimport {useClient} from '../hooks/useClient'\nimport {getAnimatedPosterSrc} from '../util/getAnimatedPosterSrc'\nimport {getPlaybackPolicy} from '../util/getPlaybackPolicy'\nimport {getPosterSrc} from '../util/getPosterSrc'\nimport type {VideoAssetDocument} from '../util/types'\n\nconst mediaDimensions = {aspect: 16 / 9}\n\ninterface ImageLoaderProps {\n alt: string\n src: string\n height?: number\n width: number\n aspectRatio?: string\n}\nconst ImageLoader = memo(function ImageLoader({\n alt,\n src,\n height,\n width,\n aspectRatio,\n}: ImageLoaderProps) {\n suspend(async () => {\n const img = new Image(width, height)\n img.decoding = 'async'\n img.src = src\n await img.decode()\n }, ['sanity-plugin-mux-input', 'image', src])\n\n return <img alt={alt} src={src} height={height} width={width} style={{aspectRatio}} />\n})\n\n// @TODO fix typings errors due to props.renderDefault\nconst VideoMediaPreview = styled<any>(MediaPreview)`\n img {\n object-fit: cover;\n }\n`\n\ninterface VideoMediaPreviewSignedSubtitleProps {\n solo?: boolean\n}\nconst VideoMediaPreviewSignedSubtitle = ({solo}: VideoMediaPreviewSignedSubtitleProps) => {\n return (\n <Inline\n space={1}\n style={{\n marginTop: solo ? '-1.35em' : undefined,\n marginBottom: solo ? undefined : '0.35rem',\n }}\n >\n <LockIcon />\n Signed playback policy\n </Inline>\n )\n}\n\ninterface PosterImageProps extends Omit<ImageLoaderProps, 'src' | 'alt'> {\n asset: VideoAssetDocument\n showTip?: boolean\n}\nconst PosterImage = ({asset, height, width, showTip}: PosterImageProps) => {\n const client = useClient()\n const src = getPosterSrc({\n asset,\n client,\n height,\n width,\n fit_mode: 'smartcrop',\n })\n const subtitle = useMemo(\n () =>\n showTip && getPlaybackPolicy(asset) === 'signed' ? (\n <VideoMediaPreviewSignedSubtitle solo />\n ) : undefined,\n [asset, showTip]\n )\n\n // eslint-disable-next-line no-warning-comments\n // @TODO support setting the alt text in the schema, like how we deal with images\n return (\n <VideoMediaPreview\n mediaDimensions={mediaDimensions}\n subtitle={subtitle}\n title={<>{null}</>}\n media={<ImageLoader alt=\"\" src={src} height={height} width={width} />}\n />\n )\n}\n\nexport interface VideoThumbnailProps extends Omit<PosterImageProps, 'height'> {\n width: number\n}\nexport const VideoThumbnail = memo(function VideoThumbnail({\n asset,\n width,\n showTip,\n}: VideoThumbnailProps) {\n const {ErrorBoundary, didCatch, error} = useErrorBoundary()\n const height = Math.round((width * 9) / 16)\n const subtitle = useMemo(\n () =>\n showTip && getPlaybackPolicy(asset) === 'signed' ? (\n <VideoMediaPreviewSignedSubtitle />\n ) : undefined,\n [showTip, asset]\n )\n\n if (didCatch) {\n return (\n <VideoMediaPreview\n subtitle={error.message}\n mediaDimensions={mediaDimensions}\n title=\"Error when loading thumbnail\"\n media={\n <Card radius={2} height=\"fill\" style={{position: 'relative', width: '100%'}}>\n <Box\n style={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n }}\n >\n <UnknownIcon />\n </Box>\n </Card>\n }\n />\n )\n }\n\n return (\n <ErrorBoundary>\n <Suspense\n fallback={\n <VideoMediaPreview\n isPlaceholder\n title=\"Loading thumbnail...\"\n subtitle={subtitle}\n mediaDimensions={mediaDimensions}\n />\n }\n >\n <PosterImage showTip={showTip} asset={asset} height={height} width={width} />\n </Suspense>\n </ErrorBoundary>\n )\n})\n\n// @TODO fix typings errors due to props.renderDefault\nconst AnimatedVideoMediaPreview = styled<any>(MediaPreview)`\n img {\n object-fit: contain;\n }\n`\n\ninterface AnimatedPosterImageProps extends Omit<ImageLoaderProps, 'src' | 'alt' | 'height'> {\n asset: VideoAssetDocument\n}\nconst AnimatedPosterImage = ({asset, width}: AnimatedPosterImageProps) => {\n const client = useClient()\n const src = getAnimatedPosterSrc({asset, client, width})\n\n // eslint-disable-next-line no-warning-comments\n // @TODO support setting the alt text in the schema, like how we deal with images\n return (\n <AnimatedVideoMediaPreview\n withBorder={false}\n mediaDimensions={mediaDimensions}\n media={<ImageLoader alt=\"\" src={src} width={width} aspectRatio=\"16:9\" />}\n />\n )\n}\n\nexport interface AnimatedVideoThumbnailProps extends Omit<PosterImageProps, 'height'> {\n width: number\n}\nexport const AnimatedVideoThumbnail = memo(function AnimatedVideoThumbnail({\n asset,\n width,\n}: AnimatedVideoThumbnailProps) {\n const {ErrorBoundary, didCatch} = useErrorBoundary()\n\n if (didCatch) {\n return null\n }\n\n return (\n <ErrorBoundary>\n <Suspense\n fallback={\n <FancyBackdrop>\n <VideoMediaPreview\n mediaDimensions={mediaDimensions}\n withBorder={false}\n media={<Spinner muted />}\n />\n </FancyBackdrop>\n }\n >\n <Card height=\"fill\" tone=\"transparent\">\n <AnimatedPosterImage asset={asset} width={width} />\n </Card>\n </Suspense>\n </ErrorBoundary>\n )\n})\nconst FancyBackdrop = styled(Box)`\n backdrop-filter: blur(8px) brightness(0.5) saturate(2);\n mix-blend-mode: color-dodge;\n`\n\nexport const ThumbGrid = styled(Grid)`\n grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));\n`\n\nexport const CardLoadMore = styled(Card)`\n border-top: 1px solid var(--card-border-color);\n position: sticky;\n bottom: 0;\n z-index: 200;\n`\n","import type {SanityClient} from '@sanity/client'\n\nimport {generateJwt} from './generateJwt'\nimport {getPlaybackId} from './getPlaybackId'\nimport {getPlaybackPolicy} from './getPlaybackPolicy'\nimport type {AnimatedThumbnailOptions, MuxAnimatedThumbnailUrl, VideoAssetDocument} from './types'\n\nexport interface AnimatedPosterSrcOptions extends AnimatedThumbnailOptions {\n asset: VideoAssetDocument\n client: SanityClient\n}\n\nexport function getAnimatedPosterSrc({\n asset,\n client,\n height,\n width,\n start = asset.thumbTime ? Math.max(0, asset.thumbTime - 2.5) : 0,\n end = start + 5,\n fps = 15,\n}: AnimatedPosterSrcOptions): MuxAnimatedThumbnailUrl {\n const params = {height, width, start, end, fps}\n const playbackId = getPlaybackId(asset)\n\n let searchParams = new URLSearchParams(\n JSON.parse(JSON.stringify(params, (_, v) => v ?? undefined))\n )\n if (getPlaybackPolicy(asset) === 'signed') {\n const token = generateJwt(client, playbackId, 'g', params)\n searchParams = new URLSearchParams({token})\n }\n\n return `https://image.mux.com/${playbackId}/animated.gif?${searchParams}`\n}\n"],"names":["path","useClient","useSanityClient","apiVersion","_id","generateJwt","client","playbackId","aud","payload","signingKeyId","signingKeyPrivate","projectId","dataset","config","suspend","async","data","fetch","token","secretKey","enableSignedUrls","Boolean","cacheNs","readSecrets","TypeError","default","sign","Promise","resolve","then","_interopNamespace","require","JSON","parse","stringify","_","v","atob","algorithm","keyid","audience","subject","noTimestamp","expiresIn","getPlaybackId","asset","console","error","getPlaybackPolicy","_a","_b","_c","_d","playback_ids","policy","getPosterSrc","_ref2","fit_mode","height","time","thumbTime","width","params","searchParams","URLSearchParams","mediaDimensions","aspect","ImageLoader","memo","_ref3","alt","src","aspectRatio","img","Image","decoding","decode","jsx","style","VideoMediaPreview","styled","MediaPreview","_templateObject","_taggedTemplateLiteral","VideoMediaPreviewSignedSubtitle","_ref4","solo","jsxs","Inline","space","marginTop","marginBottom","children","LockIcon","PosterImage","_ref5","showTip","subtitle","useMemo","title","Fragment","media","VideoThumbnail","_ref6","ErrorBoundary","didCatch","useErrorBoundary","Math","round","message","Card","radius","position","Box","display","justifyContent","alignItems","top","left","right","bottom","UnknownIcon","Suspense","fallback","isPlaceholder","AnimatedVideoMediaPreview","_templateObject2","AnimatedPosterImage","_ref7","_ref","start","max","end","fps","getAnimatedPosterSrc","withBorder","AnimatedVideoThumbnail","_ref8","FancyBackdrop","Spinner","muted","tone","_templateObject3","ThumbGrid","Grid","_templateObject4","CardLoadMore","_templateObject5","useDocumentValues","isReference"],"mappings":"uvBAKA,MAAMA,EAAO,CAAC,UAAW,OAAQ,aAAc,SAAU,YAAa,YCF/D,SAASC,IACd,OAAOC,YAAgB,CAACC,WAAY,cACtC,CCOO,MAAMC,EAAM,cCMZ,SAASC,EACdC,EACAC,EACAC,EACAC,GAEA,MAAMC,aAACA,EAAAC,kBAAcA,GDVhB,SAAqBL,GAC1B,MAAMM,UAACA,EAAAC,QAAWA,GAAWP,EAAOQ,SACpC,OAAOC,WAAQC,UACP,MAAAC,QAAaX,EAAOY,MAQxB,+IAAA,CAACd,QAEI,MAAA,CACLe,aAAOF,WAAME,QAAS,KACtBC,iBAAWH,WAAMG,YAAa,KAC9BC,iBAAkBC,QAAc,MAANL,OAAM,EAAAA,EAAAI,oBAAqB,EACrDX,oBAAcO,WAAMP,eAAgB,KACpCC,yBAAmBM,WAAMN,oBAAqB,KAChD,GACC,CAACY,EAAAA,QAASnB,EAAKQ,EAAWC,GAC/B,CCX4CW,CAAYlB,GACtD,IAAKI,EACG,MAAA,IAAIe,UAAU,wBAEtB,IAAKd,EACG,MAAA,IAAIc,UAAU,6BAGhB,MAACC,QAASC,GAAQZ,EAAAA,SAAQ,IAAMa,QAAAC,UAAAC,MAAA,WAAA,OAAAC,EAAAC,QAAO,yBAAA,KAA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F,KAAQ,GACnClI"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e,t,i,n,s;function r(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}import{useDocumentValues as o,isReference as a,useClient as l,MediaPreview as d}from"sanity";import{jsx as c,jsxs as m,Fragment as u}from"react/jsx-runtime";import{UnknownIcon as h,LockIcon as g}from"@sanity/icons";import{Card as p,Box as f,Spinner as y,Grid as b,Inline as w}from"@sanity/ui";import{memo as v,useMemo as k,Suspense as x}from"react";import I from"styled-components";import{suspend as S}from"suspend-react";import{useErrorBoundary as K}from"use-error-boundary";import{c as T}from"./index-3d8d7583.esm.js";const j=["assetId","data","playbackId","status","thumbTime","filename"],P=e=>o(a(e)?e._ref:"",j);function O(){return l({apiVersion:"2022-09-14"})}const _="secrets.mux";function R(e,t,i,n){const{signingKeyId:s,signingKeyPrivate:r}=function(e){const{projectId:t,dataset:i}=e.config();return S((async()=>{const t=await e.fetch("*[_id == $_id][0]{\n token,\n secretKey,\n enableSignedUrls,\n signingKeyId,\n signingKeyPrivate\n }",{_id:_});return{token:(null==t?void 0:t.token)||null,secretKey:(null==t?void 0:t.secretKey)||null,enableSignedUrls:Boolean(null==t?void 0:t.enableSignedUrls)||!1,signingKeyId:(null==t?void 0:t.signingKeyId)||null,signingKeyPrivate:(null==t?void 0:t.signingKeyPrivate)||null}}),[T,_,t,i])}(e);if(!s)throw new TypeError("Missing signingKeyId");if(!r)throw new TypeError("Missing signingKeyPrivate");const{default:o}=S((()=>import("jsonwebtoken-esm/sign")),["jsonwebtoken-esm/sign"]);return o(n?JSON.parse(JSON.stringify(n,((e,t)=>null!=t?t:void 0))):{},atob(r),{algorithm:"RS256",keyid:s,audience:i,subject:t,noTimestamp:!0,expiresIn:"12h"})}function U(e){if(!(null==e?void 0:e.playbackId))throw console.error("Asset is missing a playbackId",{asset:e}),new TypeError("Missing playbackId");return e.playbackId}function B(e){var t,i,n,s;return null!=(s=null==(n=null==(i=null==(t=e.data)?void 0:t.playback_ids)?void 0:i[0])?void 0:n.policy)?s:"public"}function E(e){let{asset:t,client:i,fit_mode:n,height:s,time:r=t.thumbTime,width:o}=e;const a={fit_mode:n,height:s,time:r,width:o},l=U(t);let d=new URLSearchParams(JSON.parse(JSON.stringify(a,((e,t)=>null!=t?t:void 0))));if("signed"===B(t)){const e=R(i,l,"t",a);d=new URLSearchParams({token:e})}return"https://image.mux.com/".concat(l,"/thumbnail.png?").concat(d)}const J={aspect:16/9},N=v((function(e){let{alt:t,src:i,height:n,width:s,aspectRatio:r}=e;return S((async()=>{const e=new Image(s,n);e.decoding="async",e.src=i,await e.decode()}),["sanity-plugin-mux-input","image",i]),c("img",{alt:t,src:i,height:n,width:s,style:{aspectRatio:r}})})),C=I(d)(e||(e=r(["\n img {\n object-fit: cover;\n }\n"]))),D=e=>{let{solo:t}=e;return m(w,{space:1,style:{marginTop:t?"-1.35em":void 0,marginBottom:t?void 0:"0.35rem"},children:[c(g,{}),"Signed playback policy"]})},L=e=>{let{asset:t,height:i,width:n,showTip:s}=e;const r=O(),o=E({asset:t,client:r,height:i,width:n,fit_mode:"smartcrop"}),a=k((()=>s&&"signed"===B(t)?c(D,{solo:!0}):void 0),[t,s]);return c(C,{mediaDimensions:J,subtitle:a,title:c(u,{children:null}),media:c(N,{alt:"",src:o,height:i,width:n})})},M=v((function(e){let{asset:t,width:i,showTip:n}=e;const{ErrorBoundary:s,didCatch:r,error:o}=K(),a=Math.round(9*i/16),l=k((()=>n&&"signed"===B(t)?c(D,{}):void 0),[n,t]);return r?c(C,{subtitle:o.message,mediaDimensions:J,title:"Error when loading thumbnail",media:c(p,{radius:2,height:"fill",style:{position:"relative",width:"100%"},children:c(f,{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:0,left:0,right:0,bottom:0},children:c(h,{})})})}):c(s,{children:c(x,{fallback:c(C,{isPlaceholder:!0,title:"Loading thumbnail...",subtitle:l,mediaDimensions:J}),children:c(L,{showTip:n,asset:t,height:a,width:i})})})})),z=I(d)(t||(t=r(["\n img {\n object-fit: contain;\n }\n"]))),A=e=>{let{asset:t,width:i}=e;const n=function(e){let{asset:t,client:i,height:n,width:s,start:r=(t.thumbTime?Math.max(0,t.thumbTime-2.5):0),end:o=r+5,fps:a=15}=e;const l={height:n,width:s,start:r,end:o,fps:a},d=U(t);let c=new URLSearchParams(JSON.parse(JSON.stringify(l,((e,t)=>null!=t?t:void 0))));if("signed"===B(t)){const e=R(i,d,"g",l);c=new URLSearchParams({token:e})}return"https://image.mux.com/".concat(d,"/animated.gif?").concat(c)}({asset:t,client:O(),width:i});return c(z,{withBorder:!1,mediaDimensions:J,media:c(N,{alt:"",src:n,width:i,aspectRatio:"16:9"})})},V=v((function(e){let{asset:t,width:i}=e;const{ErrorBoundary:n,didCatch:s}=K();return s?null:c(n,{children:c(x,{fallback:c($,{children:c(C,{mediaDimensions:J,withBorder:!1,media:c(y,{muted:!0})})}),children:c(p,{height:"fill",tone:"transparent",children:c(A,{asset:t,width:i})})})})})),$=I(f)(i||(i=r(["\n backdrop-filter: blur(8px) brightness(0.5) saturate(2);\n mix-blend-mode: color-dodge;\n"]))),q=I(b)(n||(n=r(["\n grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));\n"]))),F=I(p)(s||(s=r(["\n border-top: 1px solid var(--card-border-color);\n position: sticky;\n bottom: 0;\n z-index: 200;\n"])));export{V as A,F as C,q as T,M as V,_,B as a,R as b,E as c,P as d,U as g,O as u};
|
|
2
|
-
//# sourceMappingURL=VideoSource.styled-f92259cd.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VideoSource.styled-f92259cd.esm.js","sources":["../../src/hooks/useAssetDocumentValues.ts","../../src/hooks/useClient.ts","../../src/util/readSecrets.ts","../../src/util/generateJwt.ts","../../src/util/getPlaybackId.ts","../../src/util/getPlaybackPolicy.ts","../../src/util/getPosterSrc.ts","../../src/components/VideoSource.styled.tsx","../../src/util/getAnimatedPosterSrc.ts"],"sourcesContent":["import {isReference} from 'sanity'\nimport {useDocumentValues} from 'sanity'\n\nimport type {Reference, VideoAssetDocument} from '../util/types'\n\nconst path = ['assetId', 'data', 'playbackId', 'status', 'thumbTime', 'filename']\nexport const useAssetDocumentValues = (asset: Reference | null | undefined) =>\n useDocumentValues<VideoAssetDocument | null | undefined>(\n isReference(asset) ? asset._ref! : '',\n path\n )\n","// As it's required to specify the API Version this custom hook ensures it's all using the same version\nimport {useClient as useSanityClient} from 'sanity'\n\nexport function useClient() {\n return useSanityClient({apiVersion: '2022-09-14'})\n}\n","// Utils with a readName prefix are suspendable and should only be called in the render body\n// Not inside event callbacks or a useEffect.\n// They may be called dynamically, unlike useEffect\n\n// @TODO rename to readSigningPair\n\nimport type {SanityClient} from '@sanity/client'\nimport {suspend} from 'suspend-react'\n\nimport {cacheNs} from '../util/constants'\nimport {type Secrets} from '../util/types'\n\nexport const _id = 'secrets.mux' as const\n\nexport function readSecrets(client: SanityClient): Secrets {\n const {projectId, dataset} = client.config()\n return suspend(async () => {\n const data = await client.fetch(\n /* groq */ `*[_id == $_id][0]{\n token,\n secretKey,\n enableSignedUrls,\n signingKeyId,\n signingKeyPrivate\n }`,\n {_id}\n )\n return {\n token: data?.token || null,\n secretKey: data?.secretKey || null,\n enableSignedUrls: Boolean(data?.enableSignedUrls) || false,\n signingKeyId: data?.signingKeyId || null,\n signingKeyPrivate: data?.signingKeyPrivate || null,\n }\n }, [cacheNs, _id, projectId, dataset])\n}\n","import type {SanityClient} from '@sanity/client'\nimport {suspend} from 'suspend-react'\n\nimport {readSecrets} from './readSecrets'\nimport type {AnimatedThumbnailOptions, ThumbnailOptions} from './types'\n\nexport type Audience = 'g' | 's' | 't' | 'v'\n\nexport type Payload<T extends Audience> = T extends 'g'\n ? AnimatedThumbnailOptions\n : T extends 's'\n ? never\n : T extends 't'\n ? ThumbnailOptions\n : T extends 'v'\n ? never\n : never\n\nexport function generateJwt<T extends Audience>(\n client: SanityClient,\n playbackId: string,\n aud: T,\n payload?: Payload<T>\n): string {\n const {signingKeyId, signingKeyPrivate} = readSecrets(client)\n if (!signingKeyId) {\n throw new TypeError('Missing signingKeyId')\n }\n if (!signingKeyPrivate) {\n throw new TypeError('Missing signingKeyPrivate')\n }\n\n const {default: sign} = suspend(() => import('jsonwebtoken-esm/sign'), ['jsonwebtoken-esm/sign'])\n\n return sign(\n payload ? JSON.parse(JSON.stringify(payload, (_, v) => v ?? undefined)) : {},\n atob(signingKeyPrivate),\n {\n algorithm: 'RS256',\n keyid: signingKeyId,\n audience: aud,\n subject: playbackId,\n noTimestamp: true,\n expiresIn: '12h',\n }\n )\n}\n","import type {VideoAssetDocument} from './types'\n\nexport function getPlaybackId(asset: VideoAssetDocument): string {\n if (!asset?.playbackId) {\n console.error('Asset is missing a playbackId', {asset})\n throw new TypeError(`Missing playbackId`)\n }\n return asset.playbackId\n}\n","import type {PlaybackPolicy, VideoAssetDocument} from './types'\n\nexport function getPlaybackPolicy(asset: VideoAssetDocument): PlaybackPolicy {\n return asset.data?.playback_ids?.[0]?.policy ?? 'public'\n}\n","import type {SanityClient} from '@sanity/client'\n\nimport {generateJwt} from './generateJwt'\nimport {getPlaybackId} from './getPlaybackId'\nimport {getPlaybackPolicy} from './getPlaybackPolicy'\nimport type {MuxThumbnailUrl, ThumbnailOptions, VideoAssetDocument} from './types'\n\nexport interface PosterSrcOptions extends ThumbnailOptions {\n asset: VideoAssetDocument\n client: SanityClient\n}\n\nexport function getPosterSrc({\n asset,\n client,\n fit_mode,\n height,\n time = asset.thumbTime,\n width,\n}: PosterSrcOptions): MuxThumbnailUrl {\n const params = {fit_mode, height, time, width}\n const playbackId = getPlaybackId(asset)\n\n let searchParams = new URLSearchParams(\n JSON.parse(JSON.stringify(params, (_, v) => v ?? undefined))\n )\n if (getPlaybackPolicy(asset) === 'signed') {\n const token = generateJwt(client, playbackId, 't', params)\n searchParams = new URLSearchParams({token})\n }\n\n return `https://image.mux.com/${playbackId}/thumbnail.png?${searchParams}`\n}\n","import {LockIcon, UnknownIcon} from '@sanity/icons'\nimport {Box, Card, Grid, Inline, Spinner} from '@sanity/ui'\nimport React, {memo, Suspense, useMemo} from 'react'\nimport {MediaPreview} from 'sanity'\nimport styled from 'styled-components'\nimport {suspend} from 'suspend-react'\nimport {useErrorBoundary} from 'use-error-boundary'\n\nimport {useClient} from '../hooks/useClient'\nimport {getAnimatedPosterSrc} from '../util/getAnimatedPosterSrc'\nimport {getPlaybackPolicy} from '../util/getPlaybackPolicy'\nimport {getPosterSrc} from '../util/getPosterSrc'\nimport type {VideoAssetDocument} from '../util/types'\n\nconst mediaDimensions = {aspect: 16 / 9}\n\ninterface ImageLoaderProps {\n alt: string\n src: string\n height?: number\n width: number\n aspectRatio?: string\n}\nconst ImageLoader = memo(function ImageLoader({\n alt,\n src,\n height,\n width,\n aspectRatio,\n}: ImageLoaderProps) {\n suspend(async () => {\n const img = new Image(width, height)\n img.decoding = 'async'\n img.src = src\n await img.decode()\n }, ['sanity-plugin-mux-input', 'image', src])\n\n return <img alt={alt} src={src} height={height} width={width} style={{aspectRatio}} />\n})\n\n// @TODO fix typings errors due to props.renderDefault\nconst VideoMediaPreview = styled<any>(MediaPreview)`\n img {\n object-fit: cover;\n }\n`\n\ninterface VideoMediaPreviewSignedSubtitleProps {\n solo?: boolean\n}\nconst VideoMediaPreviewSignedSubtitle = ({solo}: VideoMediaPreviewSignedSubtitleProps) => {\n return (\n <Inline\n space={1}\n style={{\n marginTop: solo ? '-1.35em' : undefined,\n marginBottom: solo ? undefined : '0.35rem',\n }}\n >\n <LockIcon />\n Signed playback policy\n </Inline>\n )\n}\n\ninterface PosterImageProps extends Omit<ImageLoaderProps, 'src' | 'alt'> {\n asset: VideoAssetDocument\n showTip?: boolean\n}\nconst PosterImage = ({asset, height, width, showTip}: PosterImageProps) => {\n const client = useClient()\n const src = getPosterSrc({\n asset,\n client,\n height,\n width,\n fit_mode: 'smartcrop',\n })\n const subtitle = useMemo(\n () =>\n showTip && getPlaybackPolicy(asset) === 'signed' ? (\n <VideoMediaPreviewSignedSubtitle solo />\n ) : undefined,\n [asset, showTip]\n )\n\n // eslint-disable-next-line no-warning-comments\n // @TODO support setting the alt text in the schema, like how we deal with images\n return (\n <VideoMediaPreview\n mediaDimensions={mediaDimensions}\n subtitle={subtitle}\n title={<>{null}</>}\n media={<ImageLoader alt=\"\" src={src} height={height} width={width} />}\n />\n )\n}\n\nexport interface VideoThumbnailProps extends Omit<PosterImageProps, 'height'> {\n width: number\n}\nexport const VideoThumbnail = memo(function VideoThumbnail({\n asset,\n width,\n showTip,\n}: VideoThumbnailProps) {\n const {ErrorBoundary, didCatch, error} = useErrorBoundary()\n const height = Math.round((width * 9) / 16)\n const subtitle = useMemo(\n () =>\n showTip && getPlaybackPolicy(asset) === 'signed' ? (\n <VideoMediaPreviewSignedSubtitle />\n ) : undefined,\n [showTip, asset]\n )\n\n if (didCatch) {\n return (\n <VideoMediaPreview\n subtitle={error.message}\n mediaDimensions={mediaDimensions}\n title=\"Error when loading thumbnail\"\n media={\n <Card radius={2} height=\"fill\" style={{position: 'relative', width: '100%'}}>\n <Box\n style={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n }}\n >\n <UnknownIcon />\n </Box>\n </Card>\n }\n />\n )\n }\n\n return (\n <ErrorBoundary>\n <Suspense\n fallback={\n <VideoMediaPreview\n isPlaceholder\n title=\"Loading thumbnail...\"\n subtitle={subtitle}\n mediaDimensions={mediaDimensions}\n />\n }\n >\n <PosterImage showTip={showTip} asset={asset} height={height} width={width} />\n </Suspense>\n </ErrorBoundary>\n )\n})\n\n// @TODO fix typings errors due to props.renderDefault\nconst AnimatedVideoMediaPreview = styled<any>(MediaPreview)`\n img {\n object-fit: contain;\n }\n`\n\ninterface AnimatedPosterImageProps extends Omit<ImageLoaderProps, 'src' | 'alt' | 'height'> {\n asset: VideoAssetDocument\n}\nconst AnimatedPosterImage = ({asset, width}: AnimatedPosterImageProps) => {\n const client = useClient()\n const src = getAnimatedPosterSrc({asset, client, width})\n\n // eslint-disable-next-line no-warning-comments\n // @TODO support setting the alt text in the schema, like how we deal with images\n return (\n <AnimatedVideoMediaPreview\n withBorder={false}\n mediaDimensions={mediaDimensions}\n media={<ImageLoader alt=\"\" src={src} width={width} aspectRatio=\"16:9\" />}\n />\n )\n}\n\nexport interface AnimatedVideoThumbnailProps extends Omit<PosterImageProps, 'height'> {\n width: number\n}\nexport const AnimatedVideoThumbnail = memo(function AnimatedVideoThumbnail({\n asset,\n width,\n}: AnimatedVideoThumbnailProps) {\n const {ErrorBoundary, didCatch} = useErrorBoundary()\n\n if (didCatch) {\n return null\n }\n\n return (\n <ErrorBoundary>\n <Suspense\n fallback={\n <FancyBackdrop>\n <VideoMediaPreview\n mediaDimensions={mediaDimensions}\n withBorder={false}\n media={<Spinner muted />}\n />\n </FancyBackdrop>\n }\n >\n <Card height=\"fill\" tone=\"transparent\">\n <AnimatedPosterImage asset={asset} width={width} />\n </Card>\n </Suspense>\n </ErrorBoundary>\n )\n})\nconst FancyBackdrop = styled(Box)`\n backdrop-filter: blur(8px) brightness(0.5) saturate(2);\n mix-blend-mode: color-dodge;\n`\n\nexport const ThumbGrid = styled(Grid)`\n grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));\n`\n\nexport const CardLoadMore = styled(Card)`\n border-top: 1px solid var(--card-border-color);\n position: sticky;\n bottom: 0;\n z-index: 200;\n`\n","import type {SanityClient} from '@sanity/client'\n\nimport {generateJwt} from './generateJwt'\nimport {getPlaybackId} from './getPlaybackId'\nimport {getPlaybackPolicy} from './getPlaybackPolicy'\nimport type {AnimatedThumbnailOptions, MuxAnimatedThumbnailUrl, VideoAssetDocument} from './types'\n\nexport interface AnimatedPosterSrcOptions extends AnimatedThumbnailOptions {\n asset: VideoAssetDocument\n client: SanityClient\n}\n\nexport function getAnimatedPosterSrc({\n asset,\n client,\n height,\n width,\n start = asset.thumbTime ? Math.max(0, asset.thumbTime - 2.5) : 0,\n end = start + 5,\n fps = 15,\n}: AnimatedPosterSrcOptions): MuxAnimatedThumbnailUrl {\n const params = {height, width, start, end, fps}\n const playbackId = getPlaybackId(asset)\n\n let searchParams = new URLSearchParams(\n JSON.parse(JSON.stringify(params, (_, v) => v ?? undefined))\n )\n if (getPlaybackPolicy(asset) === 'signed') {\n const token = generateJwt(client, playbackId, 'g', params)\n searchParams = new URLSearchParams({token})\n }\n\n return `https://image.mux.com/${playbackId}/animated.gif?${searchParams}`\n}\n"],"names":["path","useAssetDocumentValues","asset","useDocumentValues","isReference","_ref","useClient","useSanityClient","apiVersion","_id","generateJwt","client","playbackId","aud","payload","signingKeyId","signingKeyPrivate","projectId","dataset","config","suspend","async","data","fetch","token","secretKey","enableSignedUrls","Boolean","cacheNs","readSecrets","TypeError","default","sign","import","JSON","parse","stringify","_","v","atob","algorithm","keyid","audience","subject","noTimestamp","expiresIn","getPlaybackId","console","error","getPlaybackPolicy","_a","_b","_c","_d","playback_ids","policy","getPosterSrc","_ref2","fit_mode","height","time","thumbTime","width","params","searchParams","URLSearchParams","mediaDimensions","aspect","ImageLoader","memo","_ref3","alt","src","aspectRatio","img","Image","decoding","decode","jsx","style","VideoMediaPreview","styled","MediaPreview","_templateObject","_taggedTemplateLiteral","VideoMediaPreviewSignedSubtitle","_ref4","solo","jsxs","Inline","space","marginTop","marginBottom","children","LockIcon","PosterImage","_ref5","showTip","subtitle","useMemo","title","Fragment","media","VideoThumbnail","_ref6","ErrorBoundary","didCatch","useErrorBoundary","Math","round","message","Card","radius","position","Box","display","justifyContent","alignItems","top","left","right","bottom","UnknownIcon","Suspense","fallback","isPlaceholder","AnimatedVideoMediaPreview","_templateObject2","AnimatedPosterImage","_ref7","start","max","end","fps","getAnimatedPosterSrc","withBorder","AnimatedVideoThumbnail","_ref8","FancyBackdrop","Spinner","muted","tone","_templateObject3","ThumbGrid","Grid","_templateObject4","CardLoadMore","_templateObject5"],"mappings":"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AE,EAAA,CACCd,kBACAqE,YAAY,EACZjC,MAAQxB,EAAA6D,EAAA,CAAQC,OAAK,QAK3B/C,SAACf,EAAAiC,EAAA,CAAKpD,OAAO,OAAOkF,KAAK,cACvBhD,SAACf,EAAAkD,EAAA,CAAoB9H,QAAc4D,eAK7C,IACM4E,EAAgBzD,EAAOiC,EAAPjC,CAAU6D,IAAAA,EAAA1D,EAAA,CAAA,oGAKnB2D,EAAY9D,EAAO+D,EAAP/D,CAAWgE,IAAAA,EAAA7D,EAAA,CAAA,0EAIvB8D,EAAejE,EAAO8B,EAAP9B,CAAWkE,IAAAA,EAAA/D,EAAA,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e;function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function t(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach((function(r){n(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}import{isObjectInputProps as o,definePlugin as i}from"sanity";import{jsx as c,jsxs as s}from"react/jsx-runtime";import{memo as a,useRef as l,useCallback as d,lazy as p,Suspense as u}from"react";import{useToast as m,Flex as f,Inline as h,Button as g,Card as y,Grid as b,Heading as v,Text as j,Spinner as O,Box as w}from"@sanity/ui";import x from"scroll-into-view-if-needed";import{clear as k}from"suspend-react";import{useErrorBoundary as P}from"use-error-boundary";import T from"styled-components";const C="sanity-plugin-mux-input",D="secrets.mux";var E=a((function(e){const{children:r,schemaType:t}=e,{push:n}=m(),o=l(null),{ErrorBoundary:i,didCatch:a,error:p,reset:u}=P({onDidCatch:(e,r)=>{console.group(e.toString()),console.groupCollapsed("console.error"),console.error(e),console.groupEnd(),e.stack&&(console.groupCollapsed("error.stack"),console.log(e.stack),console.groupEnd()),(null==r?void 0:r.componentStack)&&(console.groupCollapsed("errorInfo.componentStack"),console.log(r.componentStack),console.groupEnd()),console.groupEnd(),n({status:"error",title:"Plugin crashed",description:c(f,{align:"center",children:s(h,{space:1,children:["An error happened while rendering",c(g,{padding:1,fontSize:1,style:{transform:"translateY(1px)"},mode:"ghost",text:t.title,onClick:()=>{o.current&&x(o.current,{behavior:"smooth",scrollMode:"if-needed",block:"center"})}})]})})})}}),O=d((()=>{k(["mux-input"]),u()}),[u]);return a?c(y,{ref:o,paddingX:[2,3,4,4],height:"fill",shadow:1,overflow:"auto",children:c(f,{justify:"flex-start",align:"center",height:"fill",children:s(b,{columns:1,gap:[2,3,4,4],children:[s(v,{as:"h1",children:["The ",c("code",{children:"mux-input"})," plugin crashed"]}),(null==p?void 0:p.message)&&c(y,{padding:3,tone:"critical",shadow:1,radius:2,children:c(j,{children:p.message})}),c(h,{children:c(g,{onClick:O,text:"Retry"})})]})})}):c(i,{children:r})}));const S=T(y)(e||(z=["\n aspect-ratio: 16 / 9;\n position: relative;\n width: 100%;\n"],I||(I=z.slice(0)),e=Object.freeze(Object.defineProperties(z,{raw:{value:Object.freeze(I)}}))));var z,I;const A=()=>c("div",{style:{padding:1},children:c(y,{shadow:1,sizing:"border",style:{aspectRatio:"16/9",width:"100%",borderRadius:"1px"},children:s(f,{align:"center",direction:"column",height:"fill",justify:"center",children:[c(O,{muted:!0}),c(w,{marginTop:3,children:c(j,{align:"center",muted:!0,size:1,children:"Loading…"})})]})})}),R=p((()=>import("./Input-af5a0a66.esm.js")));var V=e=>a((function(r){return function(e){var r;return o(e)&&"mux.video"===(null==(r=e.schemaType.type)?void 0:r.name)}(r)?c(S,{children:c(E,{schemaType:r.schemaType,children:c(u,{fallback:c(A,{}),children:c(R,t({config:e},r))})})}):r.renderDefault(r)}));const B=p((()=>import("./Preview-bb256342.esm.js")));var L=a((function(e){return function(e){var r,t;return"mux.video"===(null==(t=null==(r=e.schemaType)?void 0:r.type)?void 0:t.name)}(e)?c(S,{children:c(B,t({},e))}):e.renderDefault(e)}));const M={mp4_support:"none"},X=i((e=>{const r=t(t({},M),e);return{name:"mux-input",form:{components:{input:V(r),preview:L}},schema:{types:[{name:"mux.video",type:"object",title:"Video asset reference",fields:[{title:"Video",name:"asset",type:"reference",weak:!0,to:[{type:"mux.videoAsset"}]}]},{name:"mux.videoAsset",type:"object",title:"Video asset",fields:[{type:"string",name:"status"},{type:"string",name:"assetId"},{type:"string",name:"playbackId"},{type:"string",name:"filename"},{type:"number",name:"thumbTime"}]}]}}}));export{A as I,X as a,C as c,M as d,D as m};
|
|
2
|
-
//# sourceMappingURL=index-3d8d7583.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-3d8d7583.esm.js","sources":["../../src/util/constants.ts","../../src/components/ErrorBoundaryCard.tsx","../../src/components/Input.styled.tsx","../../src/components/FormInput.tsx","../../src/util/asserters.ts","../../src/components/FormPreview.tsx","../../src/index.ts"],"sourcesContent":["export const name = 'mux-input' as const\n\n// Caching namespace, as suspend-react might be in use by other components on the page we must ensure we don't collide\nexport const cacheNs = 'sanity-plugin-mux-input' as const\n\nexport const muxSecretsDocumentId = 'secrets.mux' as const\n","/* eslint-disable no-console */\nimport {Button, Card, Flex, Grid, Heading, Inline, Text, useToast} from '@sanity/ui'\nimport React, {memo, useCallback, useRef} from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\nimport {clear} from 'suspend-react'\nimport {useErrorBoundary} from 'use-error-boundary'\n\nimport {name} from '../util/constants'\nimport {type MuxInputProps} from '../util/types'\n\nexport interface Props extends Pick<MuxInputProps, 'schemaType'> {\n children: React.ReactNode\n}\nfunction ErrorBoundaryCard(props: Props) {\n const {children, schemaType} = props\n const {push: pushToast} = useToast()\n const errorRef = useRef(null)\n const {ErrorBoundary, didCatch, error, reset} = useErrorBoundary({\n onDidCatch: (err, errorInfo) => {\n console.group(err.toString())\n console.groupCollapsed('console.error')\n console.error(err)\n console.groupEnd()\n if (err.stack) {\n console.groupCollapsed('error.stack')\n console.log(err.stack)\n console.groupEnd()\n }\n if (errorInfo?.componentStack) {\n console.groupCollapsed('errorInfo.componentStack')\n console.log(errorInfo.componentStack)\n console.groupEnd()\n }\n console.groupEnd()\n pushToast({\n status: 'error',\n title: 'Plugin crashed',\n description: (\n <Flex align=\"center\">\n <Inline space={1}>\n An error happened while rendering\n <Button\n padding={1}\n fontSize={1}\n style={{transform: 'translateY(1px)'}}\n mode=\"ghost\"\n text={schemaType.title}\n onClick={() => {\n if (errorRef.current) {\n scrollIntoView(errorRef.current, {\n behavior: 'smooth',\n scrollMode: 'if-needed',\n block: 'center',\n })\n }\n }}\n />\n </Inline>\n </Flex>\n ),\n })\n },\n })\n const handleRetry = useCallback(() => {\n // Purge request cache before retrying, otherwise the cached errors will rethrow\n clear([name])\n\n reset()\n }, [reset])\n\n if (didCatch) {\n return (\n <Card ref={errorRef} paddingX={[2, 3, 4, 4]} height=\"fill\" shadow={1} overflow=\"auto\">\n <Flex justify=\"flex-start\" align=\"center\" height=\"fill\">\n <Grid columns={1} gap={[2, 3, 4, 4]}>\n <Heading as=\"h1\">\n The <code>{name}</code> plugin crashed\n </Heading>\n {error?.message && (\n <Card padding={3} tone=\"critical\" shadow={1} radius={2}>\n <Text>{error.message}</Text>\n </Card>\n )}\n <Inline>\n <Button onClick={handleRetry} text=\"Retry\" />\n </Inline>\n </Grid>\n </Flex>\n </Card>\n )\n }\n\n return <ErrorBoundary>{children}</ErrorBoundary>\n}\n\nexport default memo(ErrorBoundaryCard)\n","import {Box, Card, Flex, Spinner, Text} from '@sanity/ui'\nimport React from 'react'\nimport styled from 'styled-components'\n\n// This container base container ensures everything uses the same aspect ratio, avoids layout shifts and stuff jumping around\nexport const AspectRatioCard = styled(Card)`\n aspect-ratio: 16 / 9;\n position: relative;\n width: 100%;\n`\n\nexport const InputFallback = () => {\n return (\n <div style={{padding: 1}}>\n <Card\n shadow={1}\n sizing=\"border\"\n style={{aspectRatio: '16/9', width: '100%', borderRadius: '1px'}}\n >\n <Flex align=\"center\" direction=\"column\" height=\"fill\" justify=\"center\">\n <Spinner muted />\n <Box marginTop={3}>\n <Text align=\"center\" muted size={1}>\n Loading…\n </Text>\n </Box>\n </Flex>\n </Card>\n </div>\n )\n}\n","import React, {lazy, memo, Suspense} from 'react'\nimport {type InputProps} from 'sanity'\n\nimport {isMuxInputProps} from '../util/asserters'\nimport {type Config} from '../util/types'\nimport ErrorBoundaryCard from './ErrorBoundaryCard'\nimport {AspectRatioCard, InputFallback} from './Input.styled'\n\nconst Input = lazy(() => import('./Input'))\n\n// eslint-disable-next-line import/no-anonymous-default-export\nexport default (config: Config) =>\n memo(function FormInput(props: InputProps) {\n if (isMuxInputProps(props)) {\n return (\n <AspectRatioCard>\n <ErrorBoundaryCard schemaType={props.schemaType}>\n <Suspense fallback={<InputFallback />}>\n <Input config={config} {...props} />\n </Suspense>\n </ErrorBoundaryCard>\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n })\n","import {type InputProps, type PreviewLayoutKey, type PreviewProps, isObjectInputProps} from 'sanity'\n\nimport type {MuxInputPreviewProps, MuxInputProps} from './types'\n\nexport function isMuxInputProps(props: InputProps): props is MuxInputProps {\n return isObjectInputProps(props) && props.schemaType.type?.name === 'mux.video'\n}\n\nexport function isMuxInputPreviewProps(\n props: PreviewProps<PreviewLayoutKey>\n): props is MuxInputPreviewProps {\n return props.schemaType?.type?.name === 'mux.video'\n}\n","import React, {lazy, memo} from 'react'\nimport {PreviewLayoutKey, PreviewProps} from 'sanity'\n\nimport {isMuxInputPreviewProps} from '../util/asserters'\nimport {AspectRatioCard} from './Input.styled'\n\nconst Preview = lazy(() => import('./Preview'))\n\nexport default memo(function FormPreview(props: PreviewProps<PreviewLayoutKey>) {\n if (isMuxInputPreviewProps(props)) {\n return (\n <AspectRatioCard>\n {/* @ts-expect-error */}\n <Preview {...props} />\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n})\n","import {definePlugin} from 'sanity'\n\nimport createFormInput from './components/FormInput'\nimport FormPreview from './components/FormPreview'\nimport {type Config} from './util/types'\n\nexport const defaultConfig: Config = {\n mp4_support: 'none',\n}\n\nexport const muxInput = definePlugin<Partial<Config> | void>((userConfig) => {\n const config: Config = {...defaultConfig, ...userConfig}\n const InputComponent = createFormInput(config)\n return {\n name: 'mux-input',\n form: {\n components: {\n input: InputComponent,\n preview: FormPreview,\n },\n },\n schema: {\n types: [\n {\n name: 'mux.video',\n type: 'object',\n title: 'Video asset reference',\n fields: [\n {\n title: 'Video',\n name: 'asset',\n type: 'reference',\n weak: true,\n to: [{type: 'mux.videoAsset'}],\n },\n ],\n },\n {\n name: 'mux.videoAsset',\n type: 'object',\n title: 'Video asset',\n fields: [\n {\n type: 'string',\n name: 'status',\n },\n {\n type: 'string',\n name: 'assetId',\n },\n {\n type: 'string',\n name: 'playbackId',\n },\n {\n type: 'string',\n name: 'filename',\n },\n {\n type: 'number',\n name: 'thumbTime',\n },\n ],\n },\n ],\n },\n }\n})\n"],"names":["cacheNs","muxSecretsDocumentId","ErrorBoundaryCard$1","memo","props","children","schemaType","push","pushToast","useToast","errorRef","useRef","ErrorBoundary","didCatch","error","reset","useErrorBoundary","onDidCatch","err","errorInfo","console","group","toString","groupCollapsed","groupEnd","stack","log","componentStack","status","title","description","jsx","Flex","align","jsxs","Inline","space","Button","padding","fontSize","style","transform","mode","text","onClick","current","scrollIntoView","behavior","scrollMode","block","handleRetry","useCallback","clear","Card","ref","paddingX","height","shadow","overflow","justify","Grid","columns","gap","Heading","as","message","tone","radius","Text","AspectRatioCard","styled","_templateObject","InputFallback","sizing","aspectRatio","width","borderRadius","direction","Spinner","muted","Box","marginTop","size","Input","lazy","import","createFormInput","config","_a","isObjectInputProps","type","name","isMuxInputProps","ErrorBoundaryCard","Suspense","fallback","_objectSpread","renderDefault","Preview","FormPreview","_b","isMuxInputPreviewProps","defaultConfig","mp4_support","muxInput","definePlugin","userConfig","form","components","input","preview","schema","types","fields","weak","to"],"mappings":"+qCAAO,MAGMA,EAAU,0BAEVC,EAAuB,cC0FpC,IAAeC,EAAAC,GAlFf,SAA2BC,GACnB,MAAAC,SAACA,EAAUC,WAAAA,GAAcF,GACxBG,KAAMC,GAAaC,IACpBC,EAAWC,EAAO,OAClBC,cAACA,EAAeC,SAAAA,EAAAC,MAAUA,EAAOC,MAAAA,GAASC,EAAiB,CAC/DC,WAAY,CAACC,EAAKC,KACRC,QAAAC,MAAMH,EAAII,YAClBF,QAAQG,eAAe,iBACvBH,QAAQN,MAAMI,GACdE,QAAQI,WACJN,EAAIO,QACNL,QAAQG,eAAe,eACfH,QAAAM,IAAIR,EAAIO,OAChBL,QAAQI,mBAENL,WAAWQ,kBACbP,QAAQG,eAAe,4BACfH,QAAAM,IAAIP,EAAUQ,gBACtBP,QAAQI,YAEVJ,QAAQI,WACEhB,EAAA,CACRoB,OAAQ,QACRC,MAAO,iBACPC,YACGC,EAAAC,EAAA,CAAKC,MAAM,SACV5B,SAAC6B,EAAAC,EAAA,CAAOC,MAAO,EAAG/B,SAAA,CAAA,oCAEf0B,EAAAM,EAAA,CACCC,QAAS,EACTC,SAAU,EACVC,MAAO,CAACC,UAAW,mBACnBC,KAAK,QACLC,KAAMrC,EAAWuB,MACjBe,QAAS,KACHlC,EAASmC,SACXC,EAAepC,EAASmC,QAAS,CAC/BE,SAAU,SACVC,WAAY,YACZC,MAAO,UAEX,UAMX,IAGCC,EAAcC,GAAY,KAExBC,EAAA,CDjEU,cCmEVrC,GAAA,GACL,CAACA,IAEJ,OAAIF,EAECkB,EAAAsB,EAAA,CAAKC,IAAK5C,EAAU6C,SAAU,CAAC,EAAG,EAAG,EAAG,GAAIC,OAAO,OAAOC,OAAQ,EAAGC,SAAS,OAC7ErD,SAAC0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){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function t(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var o=require("sanity"),s=require("react/jsx-runtime"),i=require("react"),c=require("@sanity/ui"),l=require("scroll-into-view-if-needed"),a=require("suspend-react"),u=require("use-error-boundary"),d=require("styled-components");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=p(l),f=p(d);var h=i.memo((function(e){const{children:r,schemaType:n}=e,{push:t}=c.useToast(),o=i.useRef(null),{ErrorBoundary:l,didCatch:d,error:p,reset:f}=u.useErrorBoundary({onDidCatch:(e,r)=>{console.group(e.toString()),console.groupCollapsed("console.error"),console.error(e),console.groupEnd(),e.stack&&(console.groupCollapsed("error.stack"),console.log(e.stack),console.groupEnd()),(null==r?void 0:r.componentStack)&&(console.groupCollapsed("errorInfo.componentStack"),console.log(r.componentStack),console.groupEnd()),console.groupEnd(),t({status:"error",title:"Plugin crashed",description:s.jsx(c.Flex,{align:"center",children:s.jsxs(c.Inline,{space:1,children:["An error happened while rendering",s.jsx(c.Button,{padding:1,fontSize:1,style:{transform:"translateY(1px)"},mode:"ghost",text:n.title,onClick:()=>{o.current&&m.default(o.current,{behavior:"smooth",scrollMode:"if-needed",block:"center"})}})]})})})}}),h=i.useCallback((()=>{a.clear(["mux-input"]),f()}),[f]);return d?s.jsx(c.Card,{ref:o,paddingX:[2,3,4,4],height:"fill",shadow:1,overflow:"auto",children:s.jsx(c.Flex,{justify:"flex-start",align:"center",height:"fill",children:s.jsxs(c.Grid,{columns:1,gap:[2,3,4,4],children:[s.jsxs(c.Heading,{as:"h1",children:["The ",s.jsx("code",{children:"mux-input"})," plugin crashed"]}),(null==p?void 0:p.message)&&s.jsx(c.Card,{padding:3,tone:"critical",shadow:1,radius:2,children:s.jsx(c.Text,{children:p.message})}),s.jsx(c.Inline,{children:s.jsx(c.Button,{onClick:h,text:"Retry"})})]})})}):s.jsx(l,{children:r})}));const x=f.default(c.Card)(e||(j=["\n aspect-ratio: 16 / 9;\n position: relative;\n width: 100%;\n"],g||(g=j.slice(0)),e=Object.freeze(Object.defineProperties(j,{raw:{value:Object.freeze(g)}}))));var j,g;const y=()=>s.jsx("div",{style:{padding:1},children:s.jsx(c.Card,{shadow:1,sizing:"border",style:{aspectRatio:"16/9",width:"100%",borderRadius:"1px"},children:s.jsxs(c.Flex,{align:"center",direction:"column",height:"fill",justify:"center",children:[s.jsx(c.Spinner,{muted:!0}),s.jsx(c.Box,{marginTop:3,children:s.jsx(c.Text,{align:"center",muted:!0,size:1,children:"Loading…"})})]})})}),b=i.lazy((()=>Promise.resolve().then((function(){return require("./Input-2ba004d3.js")}))));var v=e=>i.memo((function(r){return function(e){var r;return o.isObjectInputProps(e)&&"mux.video"===(null==(r=e.schemaType.type)?void 0:r.name)}(r)?s.jsx(x,{children:s.jsx(h,{schemaType:r.schemaType,children:s.jsx(i.Suspense,{fallback:s.jsx(y,{}),children:s.jsx(b,n({config:e},r))})})}):r.renderDefault(r)}));const O=i.lazy((()=>Promise.resolve().then((function(){return require("./Preview-3195237b.js")}))));var w=i.memo((function(e){return function(e){var r,n;return"mux.video"===(null==(n=null==(r=e.schemaType)?void 0:r.type)?void 0:n.name)}(e)?s.jsx(x,{children:s.jsx(O,n({},e))}):e.renderDefault(e)}));const P={mp4_support:"none"},k=o.definePlugin((e=>{const r=n(n({},P),e);return{name:"mux-input",form:{components:{input:v(r),preview:w}},schema:{types:[{name:"mux.video",type:"object",title:"Video asset reference",fields:[{title:"Video",name:"asset",type:"reference",weak:!0,to:[{type:"mux.videoAsset"}]}]},{name:"mux.videoAsset",type:"object",title:"Video asset",fields:[{type:"string",name:"status"},{type:"string",name:"assetId"},{type:"string",name:"playbackId"},{type:"string",name:"filename"},{type:"number",name:"thumbTime"}]}]}}}));exports.InputFallback=y,exports.cacheNs="sanity-plugin-mux-input",exports.defaultConfig=P,exports.muxInput=k,exports.muxSecretsDocumentId="secrets.mux";
|
|
2
|
-
//# sourceMappingURL=index-efe6ce48.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-efe6ce48.js","sources":["../../src/components/ErrorBoundaryCard.tsx","../../src/util/constants.ts","../../src/components/Input.styled.tsx","../../src/components/FormInput.tsx","../../src/util/asserters.ts","../../src/components/FormPreview.tsx","../../src/index.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport {Button, Card, Flex, Grid, Heading, Inline, Text, useToast} from '@sanity/ui'\nimport React, {memo, useCallback, useRef} from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\nimport {clear} from 'suspend-react'\nimport {useErrorBoundary} from 'use-error-boundary'\n\nimport {name} from '../util/constants'\nimport {type MuxInputProps} from '../util/types'\n\nexport interface Props extends Pick<MuxInputProps, 'schemaType'> {\n children: React.ReactNode\n}\nfunction ErrorBoundaryCard(props: Props) {\n const {children, schemaType} = props\n const {push: pushToast} = useToast()\n const errorRef = useRef(null)\n const {ErrorBoundary, didCatch, error, reset} = useErrorBoundary({\n onDidCatch: (err, errorInfo) => {\n console.group(err.toString())\n console.groupCollapsed('console.error')\n console.error(err)\n console.groupEnd()\n if (err.stack) {\n console.groupCollapsed('error.stack')\n console.log(err.stack)\n console.groupEnd()\n }\n if (errorInfo?.componentStack) {\n console.groupCollapsed('errorInfo.componentStack')\n console.log(errorInfo.componentStack)\n console.groupEnd()\n }\n console.groupEnd()\n pushToast({\n status: 'error',\n title: 'Plugin crashed',\n description: (\n <Flex align=\"center\">\n <Inline space={1}>\n An error happened while rendering\n <Button\n padding={1}\n fontSize={1}\n style={{transform: 'translateY(1px)'}}\n mode=\"ghost\"\n text={schemaType.title}\n onClick={() => {\n if (errorRef.current) {\n scrollIntoView(errorRef.current, {\n behavior: 'smooth',\n scrollMode: 'if-needed',\n block: 'center',\n })\n }\n }}\n />\n </Inline>\n </Flex>\n ),\n })\n },\n })\n const handleRetry = useCallback(() => {\n // Purge request cache before retrying, otherwise the cached errors will rethrow\n clear([name])\n\n reset()\n }, [reset])\n\n if (didCatch) {\n return (\n <Card ref={errorRef} paddingX={[2, 3, 4, 4]} height=\"fill\" shadow={1} overflow=\"auto\">\n <Flex justify=\"flex-start\" align=\"center\" height=\"fill\">\n <Grid columns={1} gap={[2, 3, 4, 4]}>\n <Heading as=\"h1\">\n The <code>{name}</code> plugin crashed\n </Heading>\n {error?.message && (\n <Card padding={3} tone=\"critical\" shadow={1} radius={2}>\n <Text>{error.message}</Text>\n </Card>\n )}\n <Inline>\n <Button onClick={handleRetry} text=\"Retry\" />\n </Inline>\n </Grid>\n </Flex>\n </Card>\n )\n }\n\n return <ErrorBoundary>{children}</ErrorBoundary>\n}\n\nexport default memo(ErrorBoundaryCard)\n","export const name = 'mux-input' as const\n\n// Caching namespace, as suspend-react might be in use by other components on the page we must ensure we don't collide\nexport const cacheNs = 'sanity-plugin-mux-input' as const\n\nexport const muxSecretsDocumentId = 'secrets.mux' as const\n","import {Box, Card, Flex, Spinner, Text} from '@sanity/ui'\nimport React from 'react'\nimport styled from 'styled-components'\n\n// This container base container ensures everything uses the same aspect ratio, avoids layout shifts and stuff jumping around\nexport const AspectRatioCard = styled(Card)`\n aspect-ratio: 16 / 9;\n position: relative;\n width: 100%;\n`\n\nexport const InputFallback = () => {\n return (\n <div style={{padding: 1}}>\n <Card\n shadow={1}\n sizing=\"border\"\n style={{aspectRatio: '16/9', width: '100%', borderRadius: '1px'}}\n >\n <Flex align=\"center\" direction=\"column\" height=\"fill\" justify=\"center\">\n <Spinner muted />\n <Box marginTop={3}>\n <Text align=\"center\" muted size={1}>\n Loading…\n </Text>\n </Box>\n </Flex>\n </Card>\n </div>\n )\n}\n","import React, {lazy, memo, Suspense} from 'react'\nimport {type InputProps} from 'sanity'\n\nimport {isMuxInputProps} from '../util/asserters'\nimport {type Config} from '../util/types'\nimport ErrorBoundaryCard from './ErrorBoundaryCard'\nimport {AspectRatioCard, InputFallback} from './Input.styled'\n\nconst Input = lazy(() => import('./Input'))\n\n// eslint-disable-next-line import/no-anonymous-default-export\nexport default (config: Config) =>\n memo(function FormInput(props: InputProps) {\n if (isMuxInputProps(props)) {\n return (\n <AspectRatioCard>\n <ErrorBoundaryCard schemaType={props.schemaType}>\n <Suspense fallback={<InputFallback />}>\n <Input config={config} {...props} />\n </Suspense>\n </ErrorBoundaryCard>\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n })\n","import {type InputProps, type PreviewLayoutKey, type PreviewProps, isObjectInputProps} from 'sanity'\n\nimport type {MuxInputPreviewProps, MuxInputProps} from './types'\n\nexport function isMuxInputProps(props: InputProps): props is MuxInputProps {\n return isObjectInputProps(props) && props.schemaType.type?.name === 'mux.video'\n}\n\nexport function isMuxInputPreviewProps(\n props: PreviewProps<PreviewLayoutKey>\n): props is MuxInputPreviewProps {\n return props.schemaType?.type?.name === 'mux.video'\n}\n","import React, {lazy, memo} from 'react'\nimport {PreviewLayoutKey, PreviewProps} from 'sanity'\n\nimport {isMuxInputPreviewProps} from '../util/asserters'\nimport {AspectRatioCard} from './Input.styled'\n\nconst Preview = lazy(() => import('./Preview'))\n\nexport default memo(function FormPreview(props: PreviewProps<PreviewLayoutKey>) {\n if (isMuxInputPreviewProps(props)) {\n return (\n <AspectRatioCard>\n {/* @ts-expect-error */}\n <Preview {...props} />\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n})\n","import {definePlugin} from 'sanity'\n\nimport createFormInput from './components/FormInput'\nimport FormPreview from './components/FormPreview'\nimport {type Config} from './util/types'\n\nexport const defaultConfig: Config = {\n mp4_support: 'none',\n}\n\nexport const muxInput = definePlugin<Partial<Config> | void>((userConfig) => {\n const config: Config = {...defaultConfig, ...userConfig}\n const InputComponent = createFormInput(config)\n return {\n name: 'mux-input',\n form: {\n components: {\n input: InputComponent,\n preview: FormPreview,\n },\n },\n schema: {\n types: [\n {\n name: 'mux.video',\n type: 'object',\n title: 'Video asset reference',\n fields: [\n {\n title: 'Video',\n name: 'asset',\n type: 'reference',\n weak: true,\n to: [{type: 'mux.videoAsset'}],\n },\n ],\n },\n {\n name: 'mux.videoAsset',\n type: 'object',\n title: 'Video asset',\n fields: [\n {\n type: 'string',\n name: 'status',\n },\n {\n type: 'string',\n name: 'assetId',\n },\n {\n type: 'string',\n name: 'playbackId',\n },\n {\n type: 'string',\n name: 'filename',\n },\n {\n type: 'number',\n name: 'thumbTime',\n },\n ],\n },\n ],\n },\n }\n})\n"],"names":["memo","props","children","schemaType","push","pushToast","useToast","errorRef","useRef","ErrorBoundary","didCatch","error","reset","useErrorBoundary","onDidCatch","err","errorInfo","console","group","toString","groupCollapsed","groupEnd","stack","log","componentStack","status","title","description","jsx","Flex","align","jsxs","Inline","space","Button","padding","fontSize","style","transform","mode","text","onClick","current","scrollIntoView","behavior","scrollMode","block","handleRetry","useCallback","clear","Card","ref","paddingX","height","shadow","overflow","justify","Grid","columns","gap","Heading","as","message","tone","radius","Text","AspectRatioCard","styled","_templateObject","InputFallback","sizing","aspectRatio","width","borderRadius","direction","Spinner","muted","Box","marginTop","size","Input","lazy","Promise","resolve","then","require","createFormInput","config","_a","isObjectInputProps","type","name","isMuxInputProps","ErrorBoundaryCard","Suspense","fallback","_objectSpread","renderDefault","Preview","FormPreview","_b","isMuxInputPreviewProps","defaultConfig","mp4_support","muxInput","definePlugin","userConfig","form","components","input","preview","schema","types","fields","weak","to"],"mappings":"wgCA+FA,IAAeA,EAAAA,EAAAA,MAlFf,SAA2BC,GACnB,MAAAC,SAACA,EAAUC,WAAAA,GAAcF,GACxBG,KAAMC,GAAaC,EAASA,W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