1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9906,4792,409],{64535:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/public/[docId]",function(){return i(83727)}])},38095:function(e,t){"use strict";t.Z={src:"/_next/static/media/Sal-Spray.5abcbf19.svg",height:1657,width:2161,blurWidth:0,blurHeight:0}},71537:function(e,t,i){"use strict";i.d(t,{z:function(){return ex}});var n=i(52322);i(98248),i(61219);var r=i(55671),s=i(62202),l=i(18200),o=i(81674),a=i(94523),d=i(97729),c=i.n(d),u=i(5632),x=i(2784),h=i(43997),m=i(14274),p=i(93202),g=i(2013);let j=e=>{let t=["malformed","encoded","illegal"];return e.includes("URIError")&&e.split(" ").some(e=>t.includes(e))};class f extends x.Component{componentDidMount(){window.addEventListener("error",this.handleError),window.addEventListener("unhandledrejection",this.handleUnhandledRejection)}componentWillUnmount(){window.removeEventListener("error",this.handleError),window.removeEventListener("unhandledrejection",this.handleUnhandledRejection)}componentDidCatch(e,t){if("dev"===m.v.APPLICATION_ENVIRONMENT)throw e}static getDerivedStateFromError(e){return{hasError:!0,errMessage:e.message,shouldMountChildren:!1}}handleError(e){if("dev"===m.v.APPLICATION_ENVIRONMENT)throw Error("[ErrorBoundary]: ".concat(e.message))}handleUnhandledRejection(e){let t=this.props.unhandledRejectionFilter(e);if(t){var i;let t=(null===(i=e.reason)||void 0===i?void 0:i.message)||"";this.setState({hasError:!0,errMessage:t})}}render(){let e=!0===j(this.state.errMessage)?{opacity:"0.65",starOverlay:!1}:{};return(0,n.jsxs)(n.Fragment,{children:[this.state.hasError&&(0,n.jsx)(g.q,{pos:"absolute",top:0,...e,errMessage:""===this.state.errMessage?void 0:this.state.errMessage,showDisclosure:!0}),this.state.shouldMountChildren&&this.props.children]})}constructor(e){super(e),this.state={hasError:!1,errMessage:"",shouldMountChildren:!0},this.handleError=this.handleError.bind(this),this.handleUnhandledRejection=this.handleUnhandledRejection.bind(this)}}f.defaultProps={unhandledRejectionFilter:e=>{var t;return!!j((null===(t=e.reason)||void 0===t?void 0:t.message)||"")||e.reason instanceof p.YBv&&!1===document.hidden||e.reason instanceof p.R5s}},i(61036),i(62376),i(6991),i(76298),i(4466),i(43839),i(40917);var v=i(11050),C=i(42005);let b=()=>{let e=(0,x.useRef)(!1),t=(0,x.useRef)(new Map);(0,x.useEffect)(()=>{if("production"!==m.v.APPLICATION_ENVIRONMENT)return;let i=()=>{if(e.current)return;let i=t.current.get("total"),n=t.current.get("notTrusted"),r=n/i>.5;r&&i>5&&(e.current=!0,C.c.track(v.xW.NOT_TRUSTED_EVENTS_DETECTED,{totalEvents:i,notTrustedEvents:n}))},n=e=>{e.isTrusted||t.current.set("notTrusted",(t.current.get("notTrusted")||0)+1),t.current.set("total",(t.current.get("total")||0)+1),i()};return document.addEventListener("paste",n,{capture:!0}),document.addEventListener("mousedown",n,{capture:!0}),document.addEventListener("keydown",n,{capture:!0}),()=>{document.removeEventListener("paste",n,{capture:!0}),document.removeEventListener("mousedown",n,{capture:!0}),document.removeEventListener("keydown",n,{capture:!0})}},[])};var y=i(79254),k=i(27354),w=i(42111),S=i(32019),E=i(99092),I=i(36651);let _=(e,t)=>{E.H.init(m.v.HIGHLIGHT_PROJECT_ID,{environment:m.v.APPLICATION_ENVIRONMENT,sessionShortcut:!!t&&"shift+command+0",enableStrictPrivacy:e,enableSegmentIntegration:!0,networkRecording:{enabled:!0,recordHeadersAndBody:!0}}),v.co.loadSdkPromise.then(e=>{e&&e.addSourceMiddleware(E.LZ)})},A=e=>{let{children:t}=e,{user:i,anonymousUser:r,isGammaOrgUser:s,isUserLoading:l}=(0,I.SE)(),{enabled:o,enableStrictPrivacy:a}=(0,w.ye)("highlight");return(0,x.useEffect)(()=>{o&&!l&&i&&_(a,s)},[a,o,s,l,i]),(0,x.useEffect)(()=>{if(!l){if(i){let{id:e,displayName:t,email:n,profileImageUrl:r}=i;E.H.identify(e,{highlightDisplayName:t,email:n,avatar:r})}else if(null==r?void 0:r.id){let{id:e,displayName:t}=r;E.H.identify("",{anonDisplayName:t||"",anonId:e})}}},[i,r,l]),(0,n.jsx)(n.Fragment,{children:t})};var T=i(34881),O=i(87254),P=i(5879),D=i(44754);let R=e=>{let{children:t}=e;return(0,D.b)(),(0,n.jsx)(P.bd,{i18n:O.ag,children:t})};var G=i(18875),z=i(17292),N=i(55478),M=i(76332),L=i(6912),F=i(27902),U=i(21733),W=i(78462),H=i(72354),V=i(1163),B=i(2953);let K="get-gamma-pro",q=e=>{var t,i;let{children:r}=e,{currentWorkspace:s,isUserLoading:l}=(0,U.SE)(),[o,a]=(0,x.useState)(!1),d=(0,F.z$)(),c=(0,w.ye)("upsellUXEnabled_Pro"),{data:u,refetch:h}=(0,M.FaU)({variables:{workspaceId:null==s?void 0:s.id,includeExpired:!0},skip:!(null==s?void 0:s.id)}),m=null==u?void 0:u.subscription;(0,L.ET)({subscription:m,workspace:s,autoLaunch:!0});let{data:p}=(0,M.kNl)({variables:{workspaceId:null==s?void 0:s.id},skip:!s}),g=null==p?void 0:null===(t=p.products)||void 0===t?void 0:t.find(e=>"pro"===e.key),j=null==g?void 0:null===(i=g.prices)||void 0===i?void 0:i.find(e=>e.frequencyUnit===M.C_B.Year),f=(0,V.K9)(s),{isOpen:v,onOpen:C,onClose:b}=(0,N.q)({id:"upsell-modal"}),y=(0,x.useRef)(null),k=(0,x.useCallback)(e=>{let{onOpenCallback:t,onCloseCallback:i,insufficientCreditsWarning:n,segmentEvent:r}=e;c&&(a(!!n),null==t||t(),C(),null==d||d.track(r),y.current=i||null)},[d,C,c]),S=(0,x.useCallback)(()=>{var e;null==y||null===(e=y.current)||void 0===e||e.call(y),b(),y.current=null,a(!1)},[b]),[E,I]=(0,x.useState)({openUpsellModal:k,product:f,subscription:m,proYearlyProductPrice:j});return(0,x.useEffect)(()=>{let e="true"===(0,W.SJ)()[K];e&&!l&&s&&(C(),(0,T.lO)({query:{...(0,W.SJ)(),[K]:void 0},emitChange:!1}))},[C,s,l]),(0,x.useEffect)(()=>
1{I({openUpsellModal:k,refetchSubscription:h,product:f,subscription:m,proYearlyProductPrice:j})},[k,f,m,j,h]),(0,n.jsxs)(B.P.Provider,{value:E,children:[r,(0,n.jsx)(H.b,{insufficientCreditsWarning:o,isUpsellModalOpen:v,closeUpsellModal:S}),(0,n.jsx)(L.S1,{})]})};var Y=i(99268),Z=i(25944),X=i(19902);let J="no_org_id",Q=e=>{let{children:t}=e;(0,Z.iZ)();let{user:i,anonymousUser:r,currentWorkspace:s,isUserLoading:l}=(0,I.SE)();return(0,x.useEffect)(()=>{let e=(0,X.K)();(0,Y.$n)(e.get()),e.fetch().then(Y.$n).catch(()=>{})},[]),(0,x.useEffect)(()=>{let e;if(!l){if(i){let{id:t,email:n}=i,r=!!n&&n.endsWith("@gamma.app"),l=(null==s?void 0:s.id)||J;e={userId:t,isGammaUser:r,userOrgId:l,anonymousUser:!1,gammaUserFirstName:r?i.firstName:""}}else e={userId:"anonymous_user",isGammaUser:!1,userOrgId:J,anonymousUser:!0,gammaUserFirstName:""};(0,Y.$n)(e)}},[l,i,r,s]),(0,n.jsx)(n.Fragment,{children:t})};var $=i(54839),ee=i(91994),et=i(89311),ei=i(95426),en=i(1198),er=i(90221),es=i(60742),el=i(13265),eo=i(90383);o.vc.autoAddCss=!1;let ea=(0,ee.bh)(),ed=(0,p.RqP)(),ec=(0,p.PGq)(),eu=(0,s.B1)(a.qZ,{styles:{global:{".ProseMirror":{outline:"0 none"}}}});((e,t)=>{let i=(0,$.I)({theme:t});e.globalToast=i})(window,eu),(0,es.Lq)(),z.F7.initialize(),(0,T.lt)(),v.co.init(),(0,G.S1)(),(0,k.u7)(),(0,ei.a)("appMainBundleLoaded"),console.log("\uD83D\uDE80 GammaApp main wrapper imported"),w.VH.get("debugLogging")||(window.console.debug=()=>{});let ex=e=>function(t){return(0,n.jsx)(eh,{children:(0,n.jsx)(e,{...t})})},eh=e=>{let{children:t}=e;console.log("\uD83D\uDE80 GammaApp main wrapper rendered");let i=(0,u.useRouter)();(0,et.l)(),(0,el.k)(),b(),(0,x.useEffect)(()=>{let e=(e,t)=>{let{shallow:i}=t;console.debug("[GammaApp - handleRouteChange] App is changing to ".concat(e," ").concat(i?"with":"without"," shallow routing"))};return i.events.on("routeChangeStart",e),()=>{i.events.off("routeChangeStart",e)}},[i]);let s=(0,en.aY)();return(0,n.jsx)(h.zt,{store:ea,children:(0,n.jsx)(R,{children:(0,n.jsx)(l.x,{theme:eu,resetCSS:!0,children:(0,n.jsx)(f,{children:(0,n.jsx)(r.e,{client:ed,children:(0,n.jsxs)(p.mdV,{client:ec,children:[(0,n.jsx)(ep,{}),(0,n.jsx)(y.H6,{}),(0,n.jsx)(G.GQ,{}),(0,n.jsxs)(I.fS,{children:[(0,n.jsx)(F.qA,{children:(0,n.jsx)(w.dF,{children:(0,n.jsx)(q,{children:(0,n.jsx)(p.Imj,{children:(0,n.jsx)(Q,{children:(0,n.jsx)(A,{children:(0,n.jsx)(en.dv,{value:s,children:(0,n.jsx)(S.u,{children:t})})})})})})})}),(0,n.jsx)(w.MG,{})]})]})})})})})})},em="A new medium for presenting ideas, powered by AI. Beautiful, engaging content with none of the formatting and design work.",ep=()=>{let e=m.v.APPLICATION_ENVIRONMENT;return(0,n.jsxs)(c(),{children:[(0,n.jsx)("title",{children:"Gamma"}),(0,n.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0, viewport-fit=cover"}),(0,n.jsx)("link",{rel:"manifest",href:"/manifest.json"}),(0,n.jsx)("link",{rel:"shortcut icon",href:"production"===e?"/favicons/favicon-transparent-96x96.png":"staging"===e?"/favicons/favicon_staging.jpg":"/favicons/favicon_local.jpg"}),(0,n.jsx)("meta",{content:em,name:"description"},"description"),(0,n.jsx)("meta",{content:"Gamma",property:"og:title"},"og:title"),(0,n.jsx)("meta",{content:em,property:"og:description"},"og:description"),(0,n.jsx)("meta",{content:m.v.OG_IMAGE_URL,property:"og:image"},"og:image"),(0,n.jsx)("meta",{content:"Gamma",property:"twitter:title"},"twitter:title"),(0,n.jsx)("meta",{content:em,property:"twitter:description"},"twitter:description"),(0,n.jsx)("meta",{content:m.v.OG_IMAGE_URL,property:"twitter:image"},"twitter:image"),(0,n.jsx)("meta",{property:"og:type",content:"website"},"og:type"),(0,n.jsx)("meta",{content:"summary_large_image",name:"twitter:card"},"twitter:card"),(0,n.jsx)("link",{href:"https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900",rel:"stylesheet"}),(0,n.jsx)("link",{rel:"stylesheet",href:"https://use.typekit.net/tiw2cwq.css"}),!(0,er.l6)()&&!(0,eo.wg)()&&(0,n.jsx)("script",{async:!0,src:"https://cdn.optimizely.com/js/20579410255.js"}),(0,n.jsx)("script",{src:"//cdn.iframe.ly/embed.js",async:!0,charSet:"utf-8"})]})}},16983:function(e,t,i){"use strict";i.d(t,{X:function(){return b}});var n=i(52322),r=i(11881),s=i(28535),l=i(62614),o=i(43297),a=i(38035),d=i(75009),c=i(29117),u=i(82554),x=i(74409),h=i(77533),m=i(82655),p=i(49929),g=i(5879),j=i(39097),f=i.n(j),v=i(90221);let C=e=>{let{children:t,href:i,onClick:o,as:a=f()}=e;return i?(0,n.jsx)(r.f,{as:s.xu,role:"group",onClick:o,children:(0,n.jsx)(r.A,{href:i,as:a,_focusVisible:{boxShadow:"none",outline:"0 none !important"},_hover:{textDecoration:"none !important"},children:t})}):(0,n.jsx)(s.xu,{as:l.z,w:"100%",variant:"unstyled",display:"inline-flex",h:"fit-content",role:"group",onClick:o,maxW:{base
1:"none",md:"18em"},tabIndex:0,_focusVisible:{boxShadow:"none",outline:"0 none !important"},children:t})},b=e=>{let{label:t,description:i,isPopular:r,colorScheme:l,imageUrl:j,href:b,transform:y,onClick:k,ctaIcon:w,ctaLabel:S,as:E}=e;return(0,n.jsx)(C,{href:b,onClick:e=>{null==k||k(e)},as:E||f(),children:(0,n.jsxs)(o.K,{cursor:"pointer",direction:{base:"row",md:"column"},px:"0",flex:"1",whiteSpace:"normal",textAlign:"left",spacing:"0",border:"none",bg:"white",borderRadius:"lg",boxShadow:{base:"sm",md:"md"},transition:"all 300ms ease",bottom:"0",outline:"none",_groupHover:(0,v.s2)()?{}:{bottom:3,boxShadow:"xl",transform:"scale(1.03)"},position:"relative",transform:{base:"auto",md:y&&!(0,v.s2)()?y:"auto"},_groupFocusWithin:{shadow:"outline"},overflow:"hidden",children:[(0,n.jsxs)(a.k,{flex:"1",justifyContent:"center",textAlign:"center",color:"".concat(l,".500"),bg:"".concat(l,".100"),position:"relative",minH:{base:"none",md:"190px"},children:[(0,n.jsx)(d.E,{src:j,objectFit:"cover",transitionProperty:"filter",transitionDuration:"normal",_groupHover:{filter:"brightness(1.02)"}}),r&&(0,n.jsx)(c.U,{position:"absolute",bottom:"2",left:"2",children:(0,n.jsxs)(u.C,{colorScheme:"teal",fontSize:"md",p:"0.5",px:"2",textTransform:"none",fontWeight:"600",borderRadius:["sm","md"],children:[(0,n.jsx)(p.G,{icon:m.BDt})," ",(0,n.jsx)(g.cC,{id:"gL/sdV"})]})})]}),(0,n.jsxs)(o.K,{spacing:"1.5",p:4,maxW:"100%",minH:{base:"100px",md:"none"},justifyContent:"space-between",alignItems:"stretch",flex:"1.5",direction:{base:"row",md:"column"},position:"relative",h:"100%",children:[(0,n.jsxs)(o.K,{children:[(0,n.jsx)(x.X,{fontSize:{base:"xl",md:"2xl"},fontWeight:"600",children:t}),(0,n.jsx)(c.U,{children:(0,n.jsx)(s.xu,{fontSize:{base:"sm",md:"md"},fontWeight:"500",lineHeight:"1.4",color:"gray.600",children:i})})]}),(0,n.jsxs)(c.U,{maxW:"100%",justifyContent:"flex-end",alignItems:"flex-start",fontSize:{base:"sm",sm:"md"},p:{base:.5,md:0},children:[(0,n.jsx)(h.x,{display:{base:"none",md:"block"},transition:"all 300ms ease",opacity:0,color:"".concat(l,".700"),_groupFocusWithin:{opacity:1},_groupHover:{opacity:1},children:S}),(0,n.jsx)(s.xu,{fontSize:{base:"md",sm:"lg"},_groupFocusWithin:{color:"".concat(l,".700")},_groupHover:{color:"".concat(l,".700")},children:w})]})]})]})})}},60510:function(e,t,i){"use strict";i.d(t,{r:function(){return G},h:function(){return z}});var n=i(52322),r=i(38035),s=i(17993),l=i(77533),o=i(62614),a=i(81672),d=i(42946),c=i(49929),u=i(2784),x=i(90221),h=i(90439),m=i(93441),p=i(89458),g=i(90383),j=i(18733),f=i(5879),v=i(42111),C=i(78462),b=i(94199),y=i(11082),k=i(64173),w=i(31807),S=i(6912),E=i(48832),I=i(11050),_=i(36651),A=i(81640),T=i(12265),O=i(11942),P=i(88640);let D=[{Component:()=>{let e=(0,v.ye)("outageButterbar");if(!e.enabled)return null;let{header:t,text:i,buttonLink:r,buttonText:s,key:l,pathnameRegexp:o}=e;return(0,n.jsx)(z,{definition:{key:l,header:t,text:i,buttonText:s,buttonLink:r,conditions:()=>!o||null!==window.location.pathname.match(new RegExp(o))}})},key:"outage-butterbar"},{Component:()=>{let e=(0,v.ye)("openAiStatus");return"NORMAL"===e?null:(0,n.jsx)(z,{definition:{key:"ai-service-status",header:(0,n.jsx)(f.cC,{id:"1Agl06"}),text:(0,n.jsx)(f.cC,{id:"cCl6WD"}),ttl:86400,conditions:()=>(0,C._r)(window.location.pathname)}})},key:"ai-service-status-butterbar"},{Component:()=>{var e,t,i;let{user:r,currentWorkspace:s}=(0,_.SE)(),{subscription:l,product:o}=(0,A.z)(),{launchFailedPaymentFlow:a,failedPaymentFlowEnabled:d}=(0,S.ET)({subscription:l,workspace:s,autoLaunch:!1});if(!l||!o)return null;let c=(0,T.K)(),{name:u,dontChurnMessage:x}=c[o],{status:h,expirationTime:m,id:p}=l,g=(0,E.p6)(m,"MMMM do, yyyy"),j=(null==l?void 0:null===(e=l.createdByUser)||void 0===e?void 0:e.id)===(null==r?void 0:r.id),v=(0,O._8)(),C=m>Date.now();if(!("unpaid"===h||"past_due"===h)&&!C)return null;let k=v&&(j||!(null==l?void 0:l.createdByUser))?(0,n.jsx)(f.cC,{id:"velw1T",values:{expirationFormatted:g,GAMMA_PROPER_NOUN:b.N6,productName:u},components:{0:(0,n.jsx)(y.r,{href:v,isExternal:!0,textDecoration:"underline"})}}):(0,n.jsx)(f.cC,{id:"9aBOfk",values:{expirationFormatted:g,GAMMA_PROPER_NOUN:b.N6,productName:u,0:null===(t=l.createdByUser)||void 0===t?void 0:t.displayName,1:null===(i=l.createdByUser)||void 0===i?void 0:i.email},components:{0:(0,n.jsx)("b",{}),1:(0,n.jsx)("b",{})}});return(0,n.jsx)(z,{definition:{key:"payment-overdue-".concat(p),header:(0,n.jsx)(f.cC,{id:"gosJne",values:{productName:u}}),text:(0,n.jsxs)(n.Fragment,{children:[x," ",k]}),buttonText:(0,n.jsx)(f.cC,{id:"WLvqZR"}),buttonLink:d?void 0:v,buttonOnClick:d?a:void 0}})},key:"payment-overdue-butterbar"},{Component:()=>{let{subscription:e,openUpsellModal:t}=(0,A.z)();if(!e)return null;let{status:i,expirationTime:r,id:s}=e,l=new Date>(0,w.Z)(r)&&new Date<(0,k.Z)((0,w.Z)(r),{days:10});if(!l)return null;let o=()=>t({segmentEvent:I.AA.GAMMA_PRO_UPSELL_SUBSCRIPTION_EXPIRED_BUTTERBAR}),a=(0,n.jsx)(y.r,{onClick:o,isExternal:!0,textDecoration:"underline",children:(0,n.jsx)(f.cC,{id:"mj68q/"})});return(0,n.jsx)(z,{definition:{key:"subscription-expired-".concat(s),header:(0,n.jsx)(f.cC,{id:"5nhH6A"}),text:(0,n.jsxs)(n.Fragment,{children:["unpaid"===i||"past_due"===i?(0,n.jsx)(f.cC,{id:"Qdg
1XJv"}):""," ",a]}),buttonText:(0,n.jsx)(f.cC,{id:"kwkhPe"}),buttonOnClick:o}})},key:"subscription-expired-butterbar"},{Component:()=>{var e,t,i;let{user:r}=(0,_.SE)(),{subscription:s,product:l}=(0,A.z)();if(!s||!l)return null;let{status:o,expirationTime:a,id:d,cancellationRequestedTime:c}=s,u="canceled"!=o&&c&&new Date<(0,w.Z)(a)&&new Date>(0,k.Z)((0,w.Z)(a),{days:-7});if(!u)return null;let x=(null==s?void 0:null===(e=s.createdByUser)||void 0===e?void 0:e.id)===(null==r?void 0:r.id),h=(0,O._8)(),m=(0,E.p6)(a,"MMMM do, yyyy"),p=(0,T.K)(),{name:g,dontChurnMessage:j}=p[l],v=!x&&(null==s?void 0:s.createdByUser)?(0,n.jsx)(f.cC,{id:"z4DeyC",values:{expirationFormatted:m,GAMMA_PROPER_NOUN:b.N6,productName:g,0:null===(t=s.createdByUser)||void 0===t?void 0:t.displayName,1:null===(i=s.createdByUser)||void 0===i?void 0:i.email},components:{0:(0,n.jsx)("b",{}),1:(0,n.jsx)("b",{})}}):(0,n.jsx)(f.cC,{id:"qP91+f",values:{expirationFormatted:m,GAMMA_PROPER_NOUN:b.N6,productName:g},components:{0:(0,n.jsx)(y.r,{href:h,isExternal:!0,textDecoration:"underline"})}});return(0,n.jsx)(z,{definition:{key:"subscription-ending-soon-".concat(d),header:(0,n.jsx)(f.cC,{id:"THJAvC",values:{productName:g}}),text:(0,n.jsxs)(n.Fragment,{children:[j," ",v]}),buttonText:(0,n.jsx)(f.cC,{id:"3jHA5d"}),buttonLink:h}})},key:"upcoming-cancellation-butterbar"},{key:"tablet-browser-warning",header:(0,n.jsx)(f.cC,{id:"JAtlMu",values:{GAMMA_PROPER_NOUN:b.N6}}),text:(0,n.jsx)(f.cC,{id:"9JlCFS",values:{GAMMA_PROPER_NOUN:b.N6}}),conditions:()=>(0,x.dA)(),dismissKey:P.H.lastDismissedPreferredBrowserMessage},{key:"desktop-browser-warning",header:(0,n.jsx)(f.cC,{id:"3S0+Wy",values:{GAMMA_PROPER_NOUN:b.N6}}),text:(0,n.jsx)(f.cC,{id:"Tf7VpJ"}),conditions:()=>R()&&(0,x.ds)(),dismissKey:P.H.lastDismissedPreferredBrowserMessage}],R=()=>(0,x.jP)()||!(0,x.i7)()&&!(0,x.G6)()&&!(0,x.NA)(),G=e=>{let{isViewOnly:t}=e,i=(0,m.gF)();if(t||!i||(0,x.l6)()||h.cx||(0,g.wg)())return null;let s=D.map(e=>"Component"in e?(0,n.jsx)(e.Component,{},e.key):(0,n.jsx)(z,{definition:e},e.key));return(0,n.jsx)(r.k,{"data-testid":"butterbar",direction:"column",top:0,pos:"relative",zIndex:"banner",sx:{"> *:not(:first-child)":{display:"none"}},children:s})},z=e=>{let{definition:t}=e,{key:i,dismissKey:x="butterbar-dismiss-".concat(i),header:h,text:m,buttonText:g,buttonLink:f,buttonOnClick:v=f?()=>window.open(f,"_blank"):void 0,conditions:C,ttl:b}=t,[y,k]=(0,p.I)(x,!1);return((0,u.useEffect)(()=>{if(!(b&&y))return;let e=new Date().getTime(),t=new Date(y).getTime(),i=e-t>1e3*b;i&&j.W.removeItem(x)},[x,y,b]),C&&!C()||y)?null:(0,n.jsxs)(r.k,{direction:"row",bg:"indigo.500",color:"white",py:3,px:4,align:"center",fontSize:"sm",children:[(0,n.jsxs)(s.g,{flex:"1",align:"start",spacing:0,children:[(0,n.jsx)(l.x,{fontWeight:"bold",children:h}),(0,n.jsx)(l.x,{opacity:"0.7",fontSize:"xs",children:m})]}),g&&v&&(0,n.jsx)(o.z,{variant:"plain",size:"sm",mr:4,rightIcon:f?(0,n.jsx)(c.G,{icon:d.wlW}):void 0,onClick:v,children:g}),(0,n.jsx)(a.P,{onClick:()=>{k(String(new Date))}})]})}},2013:function(e,t,i){"use strict";i.d(t,{q:function(){return y}});var n=i(52322),r=i(38035),s=i(77533),l=i(49259),o=i(87436),a=i(95897),d=i(28535),c=i(89511),u=i(11121),x=i(44438),h=i(42822),m=i(62614),p=i(75009),g=i(94523),j=i(5879),f=i(3543),v=i(92981);let C=(0,n.jsx)(j.cC,{id:"HiX9QN"}),b={bgImage:"radial-gradient(1px 1px at 20px 30px, #eee, rgba(0,0,0,0)),\n radial-gradient(1px 1px at 40px 70px, #fff, rgba(0,0,0,0)),\n radial-gradient(1px 1px at 50px 160px, #ddd, rgba(0,0,0,0)),\n radial-gradient(1px 1px at 90px 40px, #fff, rgba(0,0,0,0)),\n radial-gradient(1px 1px at 130px 80px, #fff, rgba(0,0,0,0)),\n radial-gradient(1px 1px at 160px 120px, #ddd, rgba(0,0,0,0))",bgRepeat:"repeat",bgSize:"200px 200px",transform:"translate(-50%,-50%)",borderRadius:{base:0,lg:"100px"},pos:"relative",maxW:"8xl",maxH:"5xl",minH:{base:0,lg:"5xl"}},y=e=>{let{errMessage:t=C,showDisclosure:i=!1,opacity:y=1,starOverlay:k=!0,backgroundColor:w=g.qZ.colors.trueblue[900],...S}=e,E=k?b:{};return(0,n.jsx)(r.k,{"data-error-component":!0,w:"100vw",h:"100vh",overflow:"hidden",zIndex:99999,backgroundColor:(0,f.tT)(w,y),...S,children:(0,n.jsx)(r.k,{...E,justifyContent:"center",alignItems:"center",flex:1,p:[4,16],left
1:"50%",top:"50%",children:(0,n.jsxs)(v.qX,{lede:"",title:(0,n.jsx)(j.cC,{id:"HbR60U"}),stackProps:{shadow:"lg-dark",position:"relative"},children:[(0,n.jsx)(s.x,{children:(0,n.jsx)(j.cC,{id:"1gm+lP"})}),i&&(0,n.jsx)(l.U,{allowToggle:!0,pt:4,children:(0,n.jsxs)(o.Q,{children:[(0,n.jsxs)(a.K,{px:0,_hover:{bgColor:"none"},borderStyle:"none",children:[(0,n.jsx)(d.xu,{flex:"1",textAlign:"left",children:(0,n.jsx)(j.cC,{id:"qug3k/"})}),(0,n.jsx)(c.X,{})]}),(0,n.jsx)(u.H,{pb:4,children:(0,n.jsx)(x.E,{colorScheme:"red",children:t})})]})}),(0,n.jsx)(h.M,{children:(0,n.jsx)(m.z,{variant:"solid",size:"lg",m:6,onClick:()=>{window.location.reload()},children:(0,n.jsx)(j.cC,{id:"C6f2hU"})})}),(0,n.jsx)(p.E,{pos:"absolute",w:36,bottom:"calc(-100% + 120px)",right:-12,src:"/_next/static/media/Sal-Asteroid-Parachute.ad317576.png",pointerEvents:"none",opacity:{base:0,md:1}})]})})})}},4661:function(e,t,i){"use strict";i.d(t,{o:function(){return o}});var n=i(52322),r=i(38035),s=i(60510);let l=e=>{let{children:t,withFooter:i,isViewOnly:l}=e;return(0,n.jsxs)(r.k,{direction:"column",width:"100%",height:"100%",minHeight:"var(--100vh)",bgColor:"gray.100",color:"gray.800",children:[(0,n.jsx)(s.r,{isViewOnly:l}),(0,n.jsx)(r.k,{zIndex:"1",id:"main",flex:"1",justifyContent:"center",alignItems:"center",direction:"column",position:"relative",children:t}),i&&(0,n.jsxs)(r.k,{fontSize:"12px",color:"gray.400",pb:8,id:"footer",justifyContent:"center",children:["\xa9 ",new Date().getFullYear()," Gamma Tech, Inc."]})]})};function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{withFooter:!1,isViewOnly:!1},{withFooter:i,isViewOnly:r}=t,s=t=>(0,n.jsx)(l,{withFooter:i,isViewOnly:r,children:(0,n.jsx)(e,{...t})});return"getInitialProps"in e&&(s.getInitialProps=e.getInitialProps),s}},409:function(e,t,i){"use strict";i.d(t,{oO:function(){return n.o},wI:function(){return d},GE:function(){return S}});var n=i(4661),r=i(52322),s=i(38035),l=i(28165),o=i(60510);let a=e=>{let{children:t}=e;return(0,r.jsxs)(s.k,{width:"100%",height:"100%",direction:"column",minHeight:"var(--100vh)",bgColor:"gray.100",color:"gray.800",p:0,children:[(0,r.jsx)(l.xB,{styles:{body:{overflowY:"scroll"}}}),(0,r.jsx)(o.r,{}),t]})};function d(e){let t=t=>(0,r.jsx)(a,{children:(0,r.jsx)(e,{...t})});return"getInitialProps"in e&&(t.getInitialProps=e.getInitialProps),t}var c=i(15706),u=i(5632),x=i(45847),h=i.n(x),m=i(2784),p=i(14274),g=i(55001),j=i(18606),f=i(7454),v=i(17283),C=i(17821),b=i(90221);let y=p.v.IS_CLIENT_SIDE&&document.cookie.includes("gammaGADebug=true"),k=()=>"production"===p.v.APPLICATION_ENVIRONMENT&&!(0,b.l6)()||y,w=e=>{let{children:t,headerMode:i}=e,n=(0,u.useRouter)();return(0,m.useEffect)(()=>{if(!k())return;let e=e=>{(0,v.o8)(e)};return n.events.on("routeChangeComplete",e),n.events.on("hashChangeComplete",e),()=>{n.events.off("routeChangeComplete",e),n.events.off("hashChangeComplete",e)}},[n.events]),(0,r.jsxs)(s.k,{direction:"column",width:"100%",height:"100%",minHeight:"var(--100vh)",bg:"#EDE9E8",color:"gray.800",overflowX:"hidden",children:[k()&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h(),{strategy:"afterInteractive",src:"https://www.googletagmanager.com/gtag/js?id=".concat(v.vt)}),(0,r.jsx)(h(),{id:"gtag-init",strategy:"afterInteractive",dangerouslySetInnerHTML:{__html:"\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '".concat(v.vt,"', {\n page_path: window.location.pathname,\n });\n ")}})]}),(0,r.jsx)(j.P,{headerMode:i}),(0,r.jsx)(s.k,{zIndex:"1",id:"main",flex:"1",justifyContent:"flex-start",alignItems:"center",direction:"column",position:"relative",children:t}),(0,r.jsx)(g.Y,{})]})};function S(e,t){let i=i=>{let{headerMode:n}=t||{};return(0,r.jsxs)(c.f6,{theme:f.i,children:[(0,r.jsx)(C.ZP,{}),(0,r.jsx)(w,{headerMode:n,children:(0,r.jsx)(e,{...i})})]})};return"getInitialProps"in e&&(i.getInitialProps=e.getInitialProps),i}},79254:function(e,t,i){"use strict";i.d(t,{$C:function(){return x},H6:function(){return u},Uj:function(){return h}});var n=i(52322),r=i(5632),s=i(45847),l=i.n(s),o=i(14274),a=i(93441),d=i(34385);
1let c=["/signin","/signup","/invitations/workspaces/[workspaceId]"],u=()=>{let e=(0,r.useRouter)().pathname;return!(0,a.gF)()||c.includes(e)?null:(0,n.jsx)("style",{children:".grecaptcha-badge { visibility: hidden; }"})},x=()=>(0,n.jsx)(l(),{src:"https://www.google.com/recaptcha/enterprise.js?render=".concat(o.v.RECAPTCHA_SCORING_KEY),async:!0,defer:!0}),h=async e=>(await (0,d.X)(50,100)(()=>!!window.grecaptcha).catch(()=>{throw Error("Timed out waiting for grecaptcha")}),new Promise((t,i)=>{grecaptcha.enterprise.ready(async()=>{try{let i=await grecaptcha.enterprise.execute(o.v.RECAPTCHA_SCORING_KEY,{action:e});t(i)}catch(e){console.log(e),i(e)}})}))},45820:function(e,t,i){"use strict";i.d(t,{N:function(){return ep}});var n=i(52322),r=i(69251),s=i(30523),l=i(28535),o=i(42946),a=i(5879),d=i(97729),c=i.n(d),u=i(2784),x=i(704),h=i(13734),m=i(75816),p=i(45760),g=i(18153),j=i(91994),f=i(76282),v=i(17993),C=i(5740),b=i(43297),y=i(29117),k=i(77533),w=i(54933),S=i(49929),E=i(74153),I=i(75258);let _=(0,u.memo)(()=>{let[e]=(0,E.Ns)("editorMode");return(0,n.jsxs)(v.g,{spacing:3,align:"stretch",children:[(0,n.jsx)(l.xu,{fontSize:"sm",children:(0,n.jsx)(a.cC,{id:"x4f8pZ"})}),"freeform"===e?(0,n.jsx)(A,{title:I.D.freeform.label(),icon:I.D.freeform.icon,children:(0,n.jsx)(a.cC,{id:"ELg7Zs",values:{0:I.D.freeform.label()}})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A,{title:I.D.structured.label(),icon:I.D.structured.icon,children:(0,n.jsx)(a.cC,{id:"iKG7iK",values:{0:I.D.structured.label()}})}),(0,n.jsx)(A,{title:(0,n.jsx)(a.cC,{id:"+mgW41"}),icon:o.Yai,children:(0,n.jsx)(a.cC,{id:"oGNrqw",components:{0:(0,n.jsx)(C.T,{})}})}),(0,n.jsx)(A,{title:(0,n.jsx)(a.cC,{id:"1Nr9Bi"}),icon:w.BDt,children:(0,n.jsx)(a.cC,{id:"5cPTto",components:{0:(0,n.jsx)(C.T,{})}})})]})]})});_.displayName="AIGeneratorTips";let A=e=>{let{icon:t,title:i,children:r}=e;return(0,n.jsx)(l.xu,{p:4,borderRadius:"md",bg:"whiteAlpha.700",children:(0,n.jsxs)(b.K,{color:"gray.700",spacing:"1",children:[(0,n.jsxs)(y.U,{spacing:"1",fontSize:"sm",children:[null!==t&&(0,n.jsx)(S.G,{icon:t}),(0,n.jsx)(k.x,{fontWeight:"600",color:"gray.800",children:i})]}),(0,n.jsx)(k.x,{fontSize:"sm",children:r})]})})};var T=i(51874),O=i(93546),P=i(8484),D=i(87651),R=i(62614);let G=(0,u.memo)(()=>{let e=(0,j.TL)(),t=(0,j.qr)(),i=(0,j.CG)(f.Zm),r=(0,j.CG)(f.d_),s=(0,j.CG)(f.Vn),d=(0,E.o7)(),c=(0,u.useCallback)(()=>{let i=(0,f.jj)(t.getState()),n=i.find(e=>e.isDraft);n&&e((0,f.J7)({num:n.num}))},[e,t]);return(0,n.jsx)(l.xu,{children:i&&(0,n.jsx)(D.U,{in:s,children:(0,n.jsxs)(b.K,{direction:{base:"column",md:"row"},alignItems:{base:"stretch",md:"center"},spacing:4,bg:"white",p:"4",borderRadius:"lg",boxShadow:"sm",children:[(0,n.jsxs)(y.U,{flex:"1",children:[(0,n.jsx)(S.G,{icon:o.On6}),(0,n.jsxs)(b.K,{spacing:0,children:[(0,n.jsx)(k.x,{fontWeight:"600",fontSize:"lg",children:(0,n.jsx)(a.cC,{id:"YU/AK+",values:{0:null==r?void 0:r.num}})}),(0,n.jsx)(k.x,{children:(0,n.jsx)(a.cC,{id:"J4c0Rh"})})]})]}),(0,n.jsx)(R.z,{variant:"solid",colorScheme:"primary",onClick:d,children:(0,n.jsx)(a.cC,{id:"u52q7m"})}),(0,n.jsx)(R.z,{onClick:c,variant:"plain",children:(0,n.jsx)(a.cC,{id:"dEgA5A"})})]})})})});G.displayName="OverrideDraftWarning";var z=i(75768),N=i(32899),M=i(10625),L=i(67046),F=i(332),U=i(99058),W=i(44035),H=i(39237),V=i(27599),B=i(94523),K=i(18149),q=i.n(K);let Y={size:"sm",variant:"ghost",colorScheme:"gray",color:"gray.800"},Z=(0,u.memo)(()=>{let e=(0,j.qr)(),t=(0,j.TL)(),i=(0,E.vS)(),r=(0,j.CG)(f.jj,(e,t)=>q()(e,t)),{hideTooltips:s,GammaTooltipHiderContext:d}=(0,B.o5)(),c=(0,j.CG)(f.Zm),x=(0,u.useCallback)(()=>{t((0,f.ly)());let n=(0,f.au)(e.getState());i(n,!1)},[t,i,e]),h=(0,u.useCallback)(()=>{t((0,f.np)());let n=(0,f.au)(e.getState());i(n,!1)},[t,i,e]),m=(0,u.useCallback)(n=>{t((0,f.J7)({num:n}));let r=(0,f.au)(e.getState());i(r,!1)},[t,i,e]);if(0===r.length)return null;let p=r.findIndex(e=>e.isCurrent),g=r[p],v=p<r.length-1;return c?(0,n.jsxs)(z.h,{isAttached:!0,bg:"whiteAlpha.500",borderRadius:"md",children:[(0,n.jsx)(N.h,{display:{base:"none",md:"inline-flex"},isDisabled:!(p>0),"aria-label":"previous version",onClick:h,...Y,icon:(0,n.jsx)(S.G,{icon:o.A35,fixedWidth:!0})}),(0,n.jsxs)(M.v,{closeOnSelect:!0,children:[(0,n.jsx)(d,{children:(0,n.jsx)(B.kH,{label:"Version ".concat(g.num," ").concat(g.isDraft?"(current draft)":""),closeOnClick:!1,children:(0,n.jsx)(L.j,{colorScheme:"gray",minW:"10",size:"sm",as:R.z,variant:"ghost",onClick:()=>{s()},children:g.num})})}),(0,n.jsx)(F.h,{children:(0,n.jsxs)(U.q,{maxW:"260px",children:[(0,n.jsx)(W._,{title:"Version history",type:"radio",value:String(g.num),children:[...r].reverse().map((e,t)=>(0,n.jsx)(H.i,{value:String(e.num),onClick:()=>{m(e.num),setTimeout(()=>{s()},0)},children:(0,n.jsxs)(k.x,{children:["Version ",e.num," ",e.isDraft&&"(current draft)"]})},t))}),(0,n.jsx)(V.R,{}),(0,n.jsx)(l.xu,{py:1,px:2,children:(0,n.jsx)(k.x,{fontSize:"xs",children:(0,n.jsx)(a.cC,{id:"gdzgeC"})})})]})})]}),(0,n.jsx)(N.h,{display:{base:"none",md:"inline-flex"},isDisabled:!v,onClick:x,"aria-label":"next version",...Y,icon:(0,n.jsx)(S.G,{icon:o._tD,fixedWidth:!0})})]}):null});Z.displayName="VersionSwitcher";var X=i(67109),J=i(49259),Q=i(74008),$=i(90980),ee=i(1071),et=i(35183),ei=i(97166),en=i(29494),er=i(87254),es=i(22902),el=i(39092);let eo=(0,u.memo)(()=>{let[e,t]=(0,E.ip)();return(0,n.jsx)(el.j,{label:(0,n.jsx)(a.cC,{id:"kI1qVD"}),colorScheme:"orchid",icon:w.Y$l,values:[es._J[e].label()],children:(0,n.jsxs)(v.g,{spacing:4,align:"start",children:[(0,n.jsxs)(et.NI,{children:[(0,n.jsx)(es.FQ,{selectedFormat:e,setSelectedFormat:t}),(0,n.jsx)(el.i,{children:(0,n.jsx)(a.cC,{id:"qJHyoI"})})]}),(0,n.jsxs)(et.NI,{children:[(0,n.jsx)(ei.l,{fontSize:"sm",fontWeight:"semibold",children:(0,n.jsx)(a.cC,{id:"G57+qO"})}),(0,n.jsx)(ea,{})]})]})})});eo.displayName="FormatSettingsGroup";let ea=(0,u.memo)(()=>{let[e,t]=(0,E.Q_)(),i=(0,u.useCallback)(e=>t(e.target.value),[t]);return(0,n.jsx)(en.g,{value:e||"",onChange:i,bg:"white",placeholder:er.ag._({i
1d:"LLAa/9"})})});ea.displayName="PromptInput";var ed=i(33872),ec=i(62141);let eu=(0,u.memo)(e=>{let{isLoading:t}=e,i=(0,j.CG)(f.Vn);return(0,n.jsxs)(v.g,{flex:"1",overflow:"hidden auto",spacing:3,align:"start",alignItems:"stretch",transition:"all 300ms ease",opacity:i?.75:1,pointerEvents:i?"none":"inherit",cursor:i?"not-allowed":"default",children:[(0,n.jsxs)(l.xu,{fontSize:"sm",children:[(0,n.jsx)(a.cC,{id:"Tz0i8g"})," ",(0,n.jsx)(B.Yq,{label:(0,n.jsx)(a.cC,{id:"FDel/s"})})]}),t?(0,n.jsxs)(b.K,{children:[(0,n.jsx)(X.O,{height:16}),(0,n.jsx)(X.O,{height:16}),(0,n.jsx)(X.O,{height:16})]}):(0,n.jsxs)(J.U,{allowMultiple:!0,defaultIndex:[0],allowToggle:!0,as:b.K,w:"100%",bg:"white",borderRadius:"lg",overflow:"hidden",spacing:0,divider:(0,n.jsx)(Q.i,{}),boxShadow:"sm",children:[(0,n.jsx)(ec.o,{}),(0,n.jsx)(ed.Td,{}),(0,n.jsx)(eo,{})]}),(0,n.jsx)(l.xu,{display:{base:"none",lg:"block"},children:(0,n.jsx)(ex,{})})]})});eu.displayName="AIGeneratorSettings";let ex=(0,u.memo)(()=>{let e=(0,j.CG)(f.mO),{maxTokens:t}=(0,ee.ml)();return(0,n.jsx)($.H,{charCount:e,max:t,shouldShow:!0})});ex.displayName="AIGeneratorCharacterCount";var eh=i(43305),em=i(4123);let ep=(0,u.memo)(()=>{let[e,t]=(0,u.useState)("outline"),{skipThemeStep:i}=(0,x.R)(),d=(0,j.TL)();(0,g.j)({queryKey:"ref"}),(0,u.useEffect)(()=>()=>{d((0,f.fB)())},[d]);let v=(0,u.useCallback)(()=>{t("outline")},[]),C="theme"===e?void 0:(0,n.jsx)(a.cC,{id:"opD9db"});return(0,n.jsx)(p.jX,{children:(0,n.jsxs)(T.v4,{children:[(0,n.jsx)(c(),{children:(0,n.jsx)("title",{children:"Generate | Gamma"})}),(0,n.jsx)(P.D,{navLabel:(0,n.jsx)(a.cC,{id:"iH8pgl"}),navIcon:o.acZ,onClick:"theme"===e?v:void 0,styleProps:"theme"===e?{position:"absolute"}:void 0,pageTitle:C,rightItem:"outline"===e?(0,n.jsx)(Z,{}):void 0}),"outline"===e?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(r.r,{templateAreas:{base:'"overrideWarning" \n "settings" \n "editor"\n "tips"',md:'"overrideWarning overrideWarning"\n "settings editor"\n "tips editor"',xl:'". overrideWarning ." \n "settings editor tips" \n "settings editor tips"'},gridTemplateColumns:{base:"1fr",md:"2fr 3fr",xl:"3fr 6fr 3fr"},gridTemplateRows:{base:"auto",md:"auto auto 1fr",xl:"auto"},gap:4,mx:"auto",alignItems:"flex-start",p:{base:4,lg:6},pt:{base:4,lg:4},maxW:"1800px",children:[(0,n.jsx)(s.P,{area:"overrideWarning",children:(0,n.jsx)(G,{})}),(0,n.jsx)(s.P,{area:"settings",alignSelf:"start",children:(0,n.jsx)(eu,{isLoading:!1})}),(0,n.jsx)(s.P,{area:"editor",h:"100%",children:(0,n.jsx)(O.e,{showTopbar:!0,showAddBreaks:!0,enableModes:!0,containerProps:{minH:{base:"40vh",lg:"60vh"}},showContentTip:!0})}),(0,n.jsx)(s.P,{area:"tips",children:(0,n.jsx)(_,{})})]}),(0,n.jsx)(l.xu,{height:"20vh"})," ",(0,n.jsx)(em.U,{cta:i?(0,n.jsx)(m.j,{children:(0,n.jsx)(a.cC,{id:"ziAjHi"})}):(0,n.jsx)(eh.O,{onClick:()=>t("theme")})})]}):"theme"===e?(0,n.jsx)(h.O,{}):null]})})});ep.displayName="AIGeneratorPage"},24551:function(e,t,i){"use strict";i.d(t,{C:function(){return w},O:function(){return S}});var n=i(52322),r=i(38035),s=i(17993),l=i(62614),o=i(67109),a=i(42946),d=i(49929),c=i(5879),u=i(55388),x=i(2689),h=i.n(x),m=i(2784),p=i(91994),g=i(62040),j=i(90507),f=i(28858),v=i(46741),C=i(76282),b=i(74720),y=i(14874);let k={...f.I,...b.R,...v.dE},w="ai-card-editor",S=(0,m.memo)(e=>{let{...t}=e,i=(0,p.CG)(C.$X),o=(0,u.jE)({...t,extensions:y.XL});o&&(o.editorId=w);let x=(0,p.CG)(C.g8),f=(0,p.CG)(C.CC);(0,m.useEffect)(()=>{o&&o.setEditable(!i)},[i,o]);let v=(0,m.useCallback)(()=>{null==o||o.chain().insertContentAt(null==o?void 0:o.state.doc.content.size,{type:"card",content:[{type:"paragraph"}]}).selectInsertedNode().run()},[o]);return(0,g.n)(o),(0,n.jsxs)(r.k,{flex:"1",direction:"column",sx:k,p:{base:2,md:3},children:[(0,n.jsx)(j.kg,{editor:o,style:{wordBreak:"break-word",display:"flex",flexDirection:"column"}}),i&&(0,n.jsx)(s.g,{children:h()(x-f).map(e=>(0,n.jsx)(E,{},e))}
1),!i&&(0,n.jsx)(l.z,{boxShadow:"none",leftIcon:(0,n.jsx)(d.G,{icon:a.r8p,fixedWidth:!0}),onClick:v,children:(0,n.jsx)(c.cC,{id:"sFY+gw"})})]})});S.displayName="AICardEditor";let E=()=>(0,n.jsx)(o.O,{height:14,width:"100%",borderRadius:"md"})},93546:function(e,t,i){"use strict";i.d(t,{e:function(){return L}});var n=i(52322),r=i(17993),s=i(28535),l=i(38035),o=i(29117),a=i(75768),d=i(37417),c=i(62614),u=i(77533),x=i(5740),h=i(36474),m=i(43297),p=i(97143),g=i(42946),j=i(49929),f=i(94523),v=i(5879),C=i(2784),b=i(90980),y=i(45760),k=i(91994),w=i(86581),S=i(7208),E=i(74153),I=i(1071),_=i(76282),A=i(75258),T=i(24551),O=i(55388),P=i(62040),D=i(90507),R=i(46741),G=i(74720),z=i(14874);let N={...G.R,...R.dE},M=(0,C.memo)(e=>{let{...t}=e,i=(0,O.jE)({...t,extensions:z.uJ});return(0,P.n)(i),(0,n.jsx)(l.k,{flex:"1",direction:"column",sx:N,children:(0,n.jsx)(D.kg,{editor:i,style:{wordBreak:"break-word",flex:1,display:"flex",flexDirection:"column"}})})});M.displayName="AIFreeformEditor";let L=(0,C.memo)(e=>{let{showAddBreaks:t,showTopbar:i=!1,hideFooter:m=!1,containerProps:p,onEditorUpdate:O,showContentTip:P,onAddClick:D,isAdding:R}=e,G=(0,k.CG)(_.Vn),N=(0,k.CG)(_.$X),{setEditorInstance:L}=(0,y.vZ)(),U=(0,E.ex)({debounce:500}),W=(0,k.qr)(),[H]=(0,E.Ns)("editorMode"),V=(0,C.useRef)(!1),B=(0,C.useCallback)(e=>{let t,{editor:i,transaction:n}=e;if(V.current&&n.docChanged){if(null==O||O({editor:i}),"structured"===H){let e=[];i.state.doc.forEach(t=>{let i=(0,w.MF)(t);e.push(i)}),t=e.join("\n\n---\n\n")}else t=(0,w.MF)(i.state.doc);U({content:t})}},[O,U,H]),K=(0,k.CG)(_.mO),q=(0,C.useCallback)(e=>{let{editor:t}=e;L(t);let i=(0,_.au)(W.getState()),n=(0,w.c8)(i),r=(0,z.dW)(n,H).content.toJSON();t.commands.setContent(r),V.current=!0},[L,W,H]),{isAddingBreaks:Y,canAddBreaks:Z,canRemoveBreaks:X,removeSectionBreaks:J,addSectionBreaks:Q}=(0,S.N)(),$="structured"===H,ee=(0,k.CG)(_.au),et=0===ee.length,ei=(0,k.CG)(_.CC),{maxTokens:en}=(0,I.ml)();return(0,n.jsxs)(r.g,{borderRadius:"md",spacing:3,align:"start",opacity:G?.75:1,pointerEvents:G?"none":"inherit",cursor:G?"not-allowed":void 0,h:"100%",children:[P&&(0,n.jsxs)(s.xu,{fontSize:"sm",pos:"relative",w:"100%",children:[(0,n.jsx)(v.cC,{id:"4b3oEV"})," ",(0,n.jsx)(f.Yq,{label:(0,n.jsx)(v.cC,{id:"tztPjl"})})]}),(0,n.jsxs)(l.k,{flex:"1",w:"100%",bg:"white",borderRadius:"lg",boxShadow:"sm",direction:"column",children:[i&&(0,n.jsxs)(o.U,{position:"relative",py:2,px:4,borderBottom:"1px",borderColor:"var(--chakra-colors-chakra-border-color)",justifyContent:"center",children:[(0,n.jsx)(A.x,{}),t&&(0,n.jsx)(a.h,{position:"absolute",top:"2",right:"2",size:"sm",children:Z&&(0,n.jsx)(d.M,{in:!0,initialScale:.6,children:(0,n.jsx)(f.kH,{label:(0,n.jsx)(v.cC,{id:"SuUA6H"}),placement:"top",children:(0,n.jsx)(c.z,{boxShadow:"none",isLoading:Y,leftIcon:(0,n.jsx)(j.G,{icon:g.EQg,fixedWidth:!0}),onClick:()=>Q(ee),children:(0,n.jsx)(u.x,{display:{base:"none",sm:"block"},children:(0,n.jsx)(v.cC,{id:"I6SWEy"})})})})})})]}),(0,n.jsxs)(l.k,{fontSize:"sm",direction:"column",flex:"1",pos:"relative",sx:{".ProseMirror":{padding:"freeform"===H?6:0,fontSize:"16px"}},...p,children:["freeform"===H?(0,n.jsx)(M,{onUpdate:B,onCreate:q}):(0,n.jsx)(T.O,{onUpdate:B,onCreate:q}),et&&!N&&"freeform"===H&&(0,n.jsx)(s.xu,{pos:"absolute",top:6,left:6,pointerEvents:"none",color:"gray.500",fontSize:"md",children:(0,n.jsx)(v.cC,{id:"xafDnF"})})]}),!m&&(0,n.jsxs)(o.U,{fontSize:"sm",px:4,py:3,alignItems:"center",color:"gray.500",children:[$?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.k,{flex:"1",children:(0,n.jsx)(u.x,{children:(0,n.jsx)(v.cC,{id:"Psk6LY",values:{cardCount:ei}})})}),(0,n.jsx)(l.k,{flex:"2",justifyContent:"center",display:{base:"none",md:"flex"},children:(0,n.jsx)(u.x,{children:(0,n.jsx)(v.cC,{id:"c3ugvF",components:{0:(0,n.jsx)(x.T,{})}})})}),(0,n.jsx)(l.k,{flex:"1",justifyContent:"flex-end",children:(0,n.jsx)(b.H,{charCount:K,max:en,shouldShow:!0,bg:"white",borderColor:"white",fontFamily:"mono"})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.L,{flex:"1"}),(0,n.jsx)(l.k,{flex:"2",justifyContent:"center",children:(0,n.jsx)(F,{})}),(0,n.jsx)(l.k,{flex:"1",justifyContent:"flex-end",children:(0,n.jsx)(b.H,{charCount:K,max:en,shouldShow:!0,bg:"white",borderColor:"white",fontFamily:"mono"})})]}),D&&(0,n.jsx)(c.z,{variant:"solid",size:"sm",onClick:D,isLoading:R,leftIcon:(0,n.jsx)(j.G,{icon:g.JyM}),children:(0,n.jsx)(v.cC,{id:"sFY+gw"})})]})]})]})});L.displayName="AIGeneratorContent";let F=(0,C.memo)(()=>(0,n.jsx)(f.kH,{placement:"top",bg:"gray.900",label:(0,n.jsxs)(m.K,{spacing:1,fontFamily:"mono",children:[(0,n.jsx)(u.x,{children:"# Heading 1"}),(0,n.jsx)(u.x,{children:"## Heading 1"}),(0,n.jsx)(u.x,{children:"### Heading 3"}),(0,n.jsx)(u.x,{children:"- Item 1"}),(0,n.jsx)(u.x,{children:"- Item 2"}),(0,n.jsx)(u.x,{children:"- Item 3"}
1),(0,n.jsx)(u.x,{children:"--- Divider"})]}),children:(0,n.jsxs)(u.x,{cursor:"help",children:[(0,n.jsx)(u.x,{as:"span",color:"gray.400",mr:1,children:(0,n.jsx)(j.G,{icon:p.cCZ})}),(0,n.jsx)(v.cC,{id:"u6Hp4N"})]})}));F.displayName="MarkdownTip"},74720:function(e,t,i){"use strict";i.d(t,{R:function(){return r}});var n=i(40212);let r={".ProseMirror":{flex:1,...n.U},".block":{my:"0.75rem",":first-child":{mt:"0px !important"},":last-child":{mb:"0px !important"}},".block-heading":{fontWeight:"bold",lineHeight:"1.25",_first:{mt:0}},h1:{fontSize:"1.5em"},h2:{fontSize:"1.25em"},h3:{fontSize:"1.125em"},"a[href]":{color:"var(--chakra-colors-trueblue-600)",textDecoration:"underline"}}},14874:function(e,t,i){"use strict";i.d(t,{XL:function(){return ef},uJ:function(){return ej},dW:function(){return ev}});var n=i(72338),r=i(86900),s=i(42626),l=i(74902),o=i(36518),a=i(71391),d=i(86509),c=i(9432),u=i(70675),x=i(38438),h=i(39615),m=i(39475),p=i(77381),g=i(6085),j=i(3402),f=i(17487),v=i(72762),C=i(73528),b=i(99173),y=i(41889),k=i(13653),w=i(59799),S=i(90507),E=i(47577),I=i(52322),_=i(28535);let A=e=>{let{selected:t}=e;return(0,I.jsx)(S.T5,{children:(0,I.jsx)(_.xu,{pos:"relative",draggable:"true","data-drag-handle":!0,cursor:"grab",contentEditable:"false",position:"relative",display:"flex",flexDirection:"column",justifyContent:"center",height:"1.25rem",color:t?"trueblue.400":"gray.400",lineHeight:"1rem",fontWeight:"800",children:"---"})})},T=/^(---|___|â-)/,O=n.NB.create({name:"sectionBreak",group:"block",atom:!0,selectable:!0,draggable:!0,parseHTML:()=>[{tag:"hr"}],renderHTML(e){let{HTMLAttributes:t}=e;return["hr",(0,n.P1)(t)]},addNodeView:()=>(0,S.fW)(A),addInputRules(){return[(0,E.ok)({find:T,type:this.type})]}});var P=i(60491),D=i(90062),R=i(91073),G=i(27191),z=i(52780);let N=new G.Sy({props:{decorations:e=>{let{doc:t}=e,i=[],n=1;return t.descendants((e,t)=>{"card"===e.type.name&&(i.push(z.p.node(t,t+e.nodeSize,{},{number:n,isSectionCardPluginDecoration:!0})),n++)}),0==i.length?z.EH.empty:z.EH.create(t,i)}}}),M=e=>{let t=e.find(e=>e.spec.isSectionCardPluginDecoration);return t?t.spec:{number:0,isSectionCardPluginDecoration:!0}};var L=i(29117),F=i(77533),U=i(38035),W=i(32899),H=i(10625),V=i(67046),B=i(332),K=i(99058),q=i(25481),Y=i(27599),Z=i(42946),X=i(49929),J=i(94523),Q=i(5879),$=i(87254),ee=i(2784),et=i(5026),ei=i(76282),en=i(91994),er=i(90221),es=i(3543);let el={r:235,g:248,b:255},eo={r:255,g:245,b:255},ea={r:107,g:70,b:193},ed={r:43,g:108,b:176},ec=(e,t,i,n)=>n?{bg:"gray.100",text:"gray.600"}:{bg:(0,es.Py)(el,eo,e/Math.min(i,t)),text:(0,es.Py)(ed,ea,e/Math.min(i,t))},eu=e=>{let{decorations:t,editor:i,getPos:n}=e,{number:r}=M(t),s=(0,en.CG)(ei.CC),{maxCards:l,canUpgrade:o}=(0,et.hw)(),a=r>l,d=r===s,c=ec(r,s,l,a),u=(0,ee.useCallback)(()=>{let e=n(),t=i.view.state.doc.nodeAt(e);if(!t){console.error("[SectionCardView] Cannot append card. Node unknown");return}let r=e+t.nodeSize;i.chain().insertContentAt(r,{type:"card",content:[{type:"paragraph"}]}).focus().selectInsertedNode().run()},[i,n]),x=(0,ee.useCallback)(()=>{i.commands.selectNodeAtPos(n())},[i,n]),h=(0,ee.useCallback)(()=>{let e=n(),t=i.view.state.doc.nodeAt(e);if(!t){console.error("[SectionCardView] Cannot delete card. Node unknown");return}i.chain().deleteRange({from:e,to:e+t.nodeSize}).selectInsideNodeAtPos(e).focus().run()},[i,n]),m=(0,ee.useCallback)(()=>{let e=n(),t=i.view.state.doc.nodeAt(e);if(!t){console.error("[SectionCardView] Cannot focus card. Node unknown");return}i.chain().selectInsideNodeAtPos(e).focus().run()},[i,n]),p=(0,k.Od)(t);return(0,I.jsxs)(S.T5,{role:"group",children:[(0,I.jsxs)(L.U,{className:"card",border:"1px solid",borderColor:p?"var(--chakra-ring-color)":"blackAlpha.100",shadow:"sm",_hover:{shadow:"md"},transitionProperty:"box-shadow",transitionDuration:"normal",bg:"white",borderRadius:"md",spacing:0,align:"stretch","data-selection-ring":!0,pos:"relative",my:3,mt:1===r?0:void 0,role:"group",children:[!(0,er.s2)()&&(0,I.jsx)(_.xu,{position:"absolute",color:c.text,zIndex:"1",top:"3.5",left:"0",pointerEvents:"none",opacity:"0",_groupHover:{opacity:.75},children:(0,I.jsx)(X.G,{icon:Z.Okg,fixedWidth:!0})}),a&&(0,I.jsx)(_.Cd,{size:"6px",position:"absolute",zIndex:"2",top:"1.5",left:"1.5",bg:"sunglow.400"}),(0,I.jsx)(J.kH,{label:a&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(F.x,{children:[(0,I.jsx)(Q.cC,{id:"rayOuP"})," "]}),(0,I.jsx)(F.x,{color:"gray.400",children:o?(0,I.jsx)(Q.cC,{id:"W8sobv",values:{MAX_CARDS_PRO:et.Fv}}):(0,I.jsx)(Q.cC,{id:"yLG7qf"})})]}),placement:"top",children:(0,I.jsx)(U.k,{dir:"column",align:"start",justify:"center",pr:1,pl:2,py:{base:3.5,md:4},w:12,cursor:a?"help":"grab","data-drag-handle":!0,contentEditable:!1,onClick:x,fontSize:r>=100?"xs":"sm",fontFamily:"mono",fontWeight:"600",borderLeftRadius:"inherit",userSelect:"none",transitionProperty:"filter",transitionDuration:"normal",_hover:{filter:"brightness(0.95)"},bg:c.bg,color:c.text,children:r})}),(0,I.jsx)(_.xu,{p:{base:3,md:4},flex:1,color:a?"gray.600":void 0,position:"relative",children:(0,I.jsx)(S.ms,{})}),(0,I.jsx)(eh,{addCard:u,focusCard:m,deleteCard:h})]}),!(0,er.s2)()&&!d&&(0,I.jsx)(ex,{addCard:u})]})},ex=(0,ee.memo)(e=>{let{addCard:t}=e;return(0,I.jsxs)(U.k,{w:"100%",h:1,borderRadius:"md",bg:"trueblue.200",transitionProperty:"opacity",transitionDuration:"slow",opacity:0,_hover:{opacity:1},_focusWithin:{opacity:1},contentEditable:!1,my:1,dir:"column",align:"center",justify:"center",pos:"absolute",transform:"translateY(-0.75rem)",zIndex:1,children:[(0,I.jsx)(_.xu,{pos:"absolute",top:-2,bottom:-2,left:0,right:0}
1),(0,I.jsx)(J.kH,{placement:"top",label:$.ag._({id:"sFY+gw"}),shortcut:"---",children:(0,I.jsx)(W.h,{pos:"absolute",variant:"solid",icon:(0,I.jsx)(X.G,{icon:Z.r8p}),"aria-label":"Add card",isRound:!0,size:"xs",onClick:t,tabIndex:-1})})]})});ex.displayName="CardDivider";let eh=(0,ee.memo)(e=>{let{addCard:t,deleteCard:i,focusCard:n}=e;return(0,I.jsx)(L.U,{pr:{base:2,md:2.5},pt:{base:2,md:3},alignSelf:"start",children:(0,er.s2)()?(0,I.jsx)(H.v,{children:e=>{let{onClose:r}=e;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(V.j,{onClick:n,as:W.h,colorScheme:"gray",variant:"ghost",size:"sm",icon:(0,I.jsx)(X.G,{icon:Z.S6C,fixedWidth:!0})}),(0,I.jsx)(B.h,{children:(0,I.jsxs)(K.q,{zIndex:"tooltip",children:[(0,I.jsx)(q.s,{onClick:()=>{r(),t()},icon:(0,I.jsx)(X.G,{icon:Z.L26,fixedWidth:!0}),children:(0,I.jsx)(Q.cC,{id:"90n2YU"})}),(0,I.jsx)(Y.R,{}),(0,I.jsx)(q.s,{onClick:()=>{i(),r()},color:"red",icon:(0,I.jsx)(X.G,{icon:Z.Vui,fixedWidth:!0}),children:(0,I.jsx)(Q.cC,{id:"nabda1"})})]})})]})}}):(0,I.jsx)(J.kH,{label:(0,I.jsx)(Q.cC,{id:"nabda1"}),placement:"top",children:(0,I.jsx)(W.h,{colorScheme:"gray",variant:"ghost",opacity:"0",_groupHover:{opacity:1},_focus:{opacity:1},transitionProperty:"opacity",transitionDuration:"slow",size:"sm",onClick:i,"aria-label":$.ag._({id:"nabda1"}),icon:(0,I.jsx)(X.G,{icon:Z.Vui,fixedWidth:!0})})})})});eh.displayName="CardActions";let em=/^(---|___|â-)$/,ep=n.NB.create({name:"card",content:"block+",selectable:!0,draggable:!0,isolating:!0,parseHTML:()=>[{tag:"section"}],renderHTML(e){let{HTMLAttributes:t}=e;return["section",(0,n.P1)(t),0]},addNodeView:()=>(0,S.fW)(eu),addProseMirrorPlugins:()=>[N],addInputRules:()=>[new n.VK({find:em,handler:e=>{let{state:t,range:i}=e,{tr:n}=t;(0,P.X)({tr:n.deleteRange(i.from,i.to),dispatch:!0})}})],addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.mergeCardsOnDelete(!1),Delete:()=>this.editor.commands.mergeCardsOnDelete(!0),Tab:()=>this.editor.commands.selectNextCard(!0),"Shift-Tab":()=>this.editor.commands.selectNextCard(!1)}},addCommands:()=>({selectNextCard:e=>t=>{let{state:i,dispatch:r,commands:s}=t;if(!r)return!0;let{selection:l}=i,o=(0,n.Kk)(R.KH)(l);if(!o||!l.empty)return!1;let a=i.doc.resolve(o.pos),d=a.index();if(e){if(d===a.parent.childCount-1)return!1;s.selectInsideNodeAtPos(o.pos+o.node.nodeSize)}else{if(0===d)return!1;let e=a.posAtIndex(d-1);s.selectInsideNodeAtPos(e)}return!0},mergeCardsOnDelete:e=>t=>{let{tr:i,state:r,dispatch:s}=t;if(!s)return!0;let{selection:l}=r,o=(0,n.Kk)(R.KH)(l);if(!o||!l.empty)return!1;try{let t=(0,D.pt)(l,e);if(!t)return!1;return e?(0,D.Yh)(o.pos,i,r):(0,D.Gq)(o.pos,i)}catch(e){return console.debug("[CardCommands] mergeCardsOnDelete failed",e),!1}}})}),eg=[d.A,p.l,y.d,x.n,h.x,f.Hy,a.X,r.d8,m.v,c.Tx,u.Z.configure({openOnClick:!1}),C.aV,v.g,b.k,w.U,g.m,o.f,l.m.configure({color:"var(--chakra-colors-trueblue-200)",width:3,class:"ProseMirror-dropcursor"}),k.Jn],ej=[...eg,O,s.B.extend({content:"block+"})],ef=[...eg,ep,s.B.extend({content:"card+"})],ev=(e,t)=>{let i=(0,n.J1)("freeform"===t?ej:ef);return"structured"===t&&(e=e.split("<hr>").map(e=>"<section>".concat(e,"</section>")).join("\n")),(0,j.T)(e,i)}},23082:function(e,t,i){"use strict";i.d(t,{m:function(){return ef}});var n=i(52322),r=i(42946),s=i(5879),l=i(97729),o=i.n(l),a=i(5632),d=i(2784),c=i(51874),u=i(704),x=i(45760),h=i(76282),m=i(18153),p=i(91994),g=i(44754),j=i(74153),f=i(87651),v=i(43297),C=i(74409),b=i(17190),y=i(43305),k=i(75816),w=i(4123),S=i(28535),E=i(17993),I=i(93546),_=i(42822),A=i(62614),T=i(49929),O=i(33872),P=i(62141),D=i(47821);let R=(0,d.memo)(()=>{let e=(0,p.CG)(h.RB),t=(0,D.Ao)(),{goToScreen:i}=(0,u.R)(),l=(0,d.useCallback)(()=>{i("promptEditor",{generateId:e})},[e,i]);return(0,n.jsxs)(v.K,{w:"100%",position:"relative",spacing:2,children:[(0,n.jsx)(C.X,{size:"sm",fontWeight:"regular",color:"gray.800",children:(0,n.jsx)(s.cC,{id:"Tz0i8g"})}),(0,n.jsx)(S.xu,{p:"4",pb:6,border:"none",bg:"white",borderRadius:"md",boxShadow:"sm",children:(0,n.jsxs)(v.K,{spacing:4,children:[(0,n.jsx)(P.B,{}),t&&(0,n.jsx)(O.$3,{}),(0,n.jsx)(O.p3,{})]})}),e&&(0,n.jsx)(_.M,{children:(0,n.jsx)(A.z,{mt:2,size:"sm",colorScheme:"gray",variant:"link",onClick:l,rightIcon:(0,n.jsx)(T.G,{icon:r.gr5}),children:(0,n.jsx)(s.cC,{id:"02C6JB"})})})]})});R.displayName="SimpleAIGeneratorSettings";let G=(0,d.memo)(()=>{let e=(0,p.CG)(h.RB);return(0,n.jsx)(S.xu,{w:"100%",children:(0,n.jsx)(f.U,{in:"existing"==(e?"existing":"new"),children:(0,n.jsxs)(E.g,{w:"100%",spacing:4,children:[(0,n.jsxs)(v.K,{w:"100%",position:"relative",spacing:2,children:[(0,n.jsx)(C.X,{size:"sm",fontWeight:"regular",color:"gray.800",children:(0,n.jsx)(s.cC,{id:"dD7NPy"})}),(0,n.jsx)(I.e,{containerProps:{minH:{base:"30vh",lg:"30vh"},overflow:"auto",w:"100%"},showContentTip:!1})]}),(0,n.jsx)(R,{})]})})})});G.displayName="OutlineEditor";var z=i(70065),N=i(29117),M=i(74105),L=i(85573),F=i(92768),U=i(32899),W=i(75768),H=i(38035),V=i(74008),B=i(77533),K=i(20437),q=i(54933),Y=i(94523),Z=i(87254),X=i(46152),J=i.n(X);let Q=()=>({deck:[{prompt:Z.ag._({id:"qlwKtq"}),icon:q._C7,type:"fun"},{prompt:Z.ag._({id:"P4NNIM"}),icon:q.xEp,type:"fun"},{prompt:Z.ag._({id:"lxdJmZ"}),icon:q.SvR,type:"fun"},{prompt:Z.ag._({id:"M7U1p2"}),icon:q.nkk,type:"fun"},{prompt:Z.ag._({id:"J6sCsQ"}),icon:q.Poi,type:"fun"},{prompt:Z.ag._({id:"I2RSm2"}),icon:q.dyi,type:"work"},{prompt:Z.ag._({id:"eIHwsO"}),type:"fun",icon:q.dER},{prompt:Z.ag._({id:"2GuYO+"}),icon:q.FcG,type:"work"},{prompt:Z.ag._({id:"XZUS53"}),type:"fun",icon:q.QmK},{prompt:Z.ag._({id:"nn97aN"}),type:"fun",icon:q.Fli},{prompt:Z.ag._({id:"NOzvim"}),type:"work",icon:q.wWp},{prompt:Z.ag._({id:"QASHwu"}),type:"work",icon:q.SoD},{prompt:Z.ag._({id:"t/ny5a"}),type:"fun",icon:q.FVb},{prompt:Z.ag._({id:"4pkbqe"}),type:"fun",icon:q.ytF},{prompt:Z.ag._({id:"raFuzm"}),type:"fun",icon:q.xTf},{prompt:Z.ag._({id:"HPvhIn"}),type:"work",icon:q.Stf},{prompt:Z.ag._({id:"sXxsO8"}),type:"fun",icon:q.Elv},{prompt:Z.ag._({id:"oRQ3AS"}),type:"fun",icon:q.io7},{prompt:Z.ag._({id:"5mHzsl"}),type:"work",icon:q.IOb}],webpage:[{prompt:Z.ag._({id:"o8jXBg"}),icon:q.V3X,type:"work"},{prompt:Z.ag._({id:"0hgAA3"}),icon:q.J9Y,type:"work"},{prompt:Z.ag._({id:"h+l7+s"}),icon:q.wKO,type:"work"},{prompt:Z.ag._({id:"AItsa8"}),icon:q.d19,type:"fun"},{prompt:Z.ag._({id:"XrkZJq"}),type:"work",icon:q._jT},{prompt:Z.ag._({id:"gElU4S"}),type:"work",icon:q.fGT},{prompt:Z.ag._({id:"MfwlJs"}),type:"fun",icon:q.RcT},{prompt:Z.ag._({id:"dQYE0e"}),type:"work",icon:q.Zr4}],document:[{prompt:Z.ag._({id:"CoQWsB"}),icon:q.uqx,type:"work"},{prompt:Z.ag._({id:"P3ZE6a"}),type:"work",icon:q.GTN},{prompt:Z.ag._({id:"9HiZDb"}),type:"work",icon:q.cYw},{prompt:Z.ag._({id:"Jqvt0L"}),type:"work",icon:q.mNe},{prompt:Z.ag._({id:"pdW8CP"}),type:"work",icon:q.Wx7},{prompt:Z.ag._({id:"3cKebJ"}),type:"fun",icon:q.thV},{prompt:Z.ag._({id:"meKpPw"}),type:"work",icon:q.tq6},{prompt:Z.ag._({id:"ZQpymk"}),icon:q.N6K,type:"work"},{prompt:Z.ag._({id:"etsxle"}),type:"work",icon:q.lhK},{prompt:Z.ag._({id:"you5yT"}),icon:q.RRR,type:"fun"},{prompt:Z.ag._({id:"4yv77g"}),icon:q.S$C,type:"fun"},{prompt:Z.ag._({id:"bT0M+P"}),type:"fun",icon:q.LBu},{prompt:Z.ag._({id:"ww+l5h"}),type:"fun",icon:q.vWT}]});var $=i(22902),ee=i(63304),et=i(93202),ei=i(42111),en=i(21733);let er=()=>{let[e]=(0,et.JBp)(),t=(0,d.useCallback)(async t=>{var i;let{prompt:n,format:r,locale:s,editorMode:l}=t,o=await e({variables:{input:{workspaceId:(0,en.n_)(),generationType:et.FJd.Generate,input:{format:r,prompt:n,settings:{...ee.zJ,imageProvider:ei.VH.get("aiGeneratorDefaultImageProvider"),locale:s,editorMode:l}}}}});return null===(i=o.data)||void 0===i?void 0:i.createDocGeneration},[e]);return t};var es=i(5026),el=i(50634),eo=i(48525),ea=i(45302),ed=i(36651),ec=i(50896);let eu=e=>e.replace(/^- /gm,"").split("\n").join("\n\n---\n\n"),ex=(0,d.memo)(()=>{let e=(0,z.p)(),t=(0,p.TL)(),{onDocGenerationLoaded:i,webpageOnly:l}=(0,u.R)(),o=er(),a=(0,d.useRef)(null),[c,m]=(0,d.useState)(!1),g=(0,p.CG)(h.RB),y=g?"existing":"new",{canU
1pgrade:k}=(0,es.hw)(),[w,E]=(0,j.Q_)(),I=(0,d.useRef)(w),[_,O]=(0,j.Ns)("locale"),P=(0,p.CG)(h.g8),D=(0,p.CG)(h.$X),R=(0,ea.jw)(_),G=(0,j.vS)(),{getEditorInstance:Z}=(0,x.vZ)(),[X,et]=(0,d.useState)(l?"webpage":"deck"),{generate:ei}=(0,el.j)("GenerateOutlineSimple",{onStart(){t((0,h.tX)(!0)),G("",!1)},onContent(e){let t=eu(e);G(t,!1)},onComplete(e){var i;G(eu(e),!0),null===(i=Z())||void 0===i||i.commands.focus("start"),t((0,h.tX)(!1))},timeout:3e4}),en=(0,d.useCallback)(async()=>{let t=(0,ed.n_)();if(t)try{let{promise:e}=ei({variables:{topic:w,numBullets:P||ee.Qk,format:X,language:R.englishName||"English"},workspaceId:t});await e}catch(t){console.error("[PromptAndOutlineSettings] error generating outline: ".concat(t.message)),e({status:"error",title:(0,n.jsx)(s.cC,{id:"RVmL+P"}),description:(0,n.jsx)(s.cC,{id:"fuwKpE"}),duration:5e3,isClosable:!0,position:"top"})}finally{(0,h.tX)(!1)}},[ei,R.englishName,P,w,X,e]),ex=(0,d.useCallback)(async()=>{D||(en(),m(!1))},[D,en]),ep=(0,d.useCallback)(async()=>{if(!D){try{let r=await o({prompt:w,format:X,locale:_,editorMode:"structured"});if(!r){e({title:(0,n.jsx)(s.cC,{id:"SlfejT"}),description:(0,n.jsx)(s.cC,{id:"J/Ajhz"}),status:"error",duration:5e3,isClosable:!0}),console.error("[PromptAndOutlingSettings]: No docGeneration found. This is unexpected.");return}t((0,h.Gn)(r)),null==i||i(r.id),en()}catch(e){console.error("[PromptAndOutlineSettings]: Error creating doc generation: ".concat(e.message))}m(!1)}},[o,t,D,_,en,i,w,X,e]),eg=(0,d.useMemo)(()=>Q(),[]),ej=(0,d.useCallback)(e=>{var t,i;if("Enter"===e.key){if(e.preventDefault(),D)return;g?ex():ep(),m(!1),null==a||null===(t=a.current)||void 0===t||t.blur()}"Escape"===e.key&&c&&(m(!1),null===(i=a.current)||void 0===i||i.blur())},[g,D,ep,ex,c]),ef=(0,d.useCallback)(()=>{eC(J()(eg[X]))},[eg,X]),[ev,eC]=(0,d.useState)(J()(eg[X]));return(0,n.jsxs)(S.xu,{w:"100%",mt:{base:"2",md:"4"},children:[!1===l&&(0,n.jsx)(f.U,{in:"new"===y,children:(0,n.jsx)(b.W,{maxW:"sm",px:0,children:(0,n.jsx)($.FQ,{hideCheckbox:!0,setSelectedFormat:e=>{et(e),eC(J()(eg[e]))},selectedFormat:X})})}),(0,n.jsx)(v.K,{spacing:{base:2,md:4},w:"100%",children:(0,n.jsxs)(S.xu,{w:"100%",textAlign:"center",children:[(0,n.jsxs)(v.K,{direction:{base:"column",sm:"row"},alignItems:{base:"flex-start",sm:"center"},justifyContent:"space-between",mb:"2",children:["existing"===y&&(0,n.jsx)(C.X,{size:"sm",fontWeight:"regular",color:"gray.800",textAlign:"left",children:(0,n.jsx)(s.cC,{id:"W9uQXX"})}),(0,n.jsxs)(N.U,{maxW:"100%",overflowX:"hidden",children:[k?(0,n.jsx)(ec.J,{cardCount:P,onChange:e=>{t((0,h.Go)(Number(e)))},maxCards:es.ix}):(0,n.jsx)(ec.Y,{onIncrement:()=>{P!==es.Fv&&t((0,h.O_)())},onDecrement:()=>{t((0,h.Jr)())},maxCards:es.Fv,cardCount:P,size:"sm"}),(0,n.jsx)(eo.k,{locale:R,setLocale:O,buttonProps:{variant:"plain",size:"sm",textAlign:"left"}})]})]}),(0,n.jsxs)(M.B,{mb:"5",bg:"white",boxShadow:w?"sm":"lg",border:"none",borderRadius:"md",display:"flex",alignItems:"center",gap:"0",children:[(0,n.jsx)(L.I,{color:"gray.800",fontWeight:"500",borderColor:"transparent",fontSize:{base:"md",md:"lg"},height:{base:"14",md:"16"},placeholder:em(),value:w,ref:a,onKeyDown:ej,onChange:e=>{E(e.target.value)},maxLength:140,_focus:{boxShadow:"var(--chakra-shadows-lg), var(--chakra-shadows-outline)"},onFocus:()=>{I.current=w,m(!0)},onBlur:()=>{m(!1)}}),"existing"===y&&!c&&(0,n.jsx)(F.xW,{h:"100%",border:"none",bg:"none",p:{base:2,md:3},children:(0,n.jsx)(Y.kH,{label:(0,n.jsx)(s.cC,{id:"2b2I/9"}),placement:"top",children:(0,n.jsx)(U.h,{variant:"ghost",bg:"gray.50",color:"trueblue.400","aria-label":"Regenerate outline",isLoading:D,icon:(0,n.jsx)(T.G,{fixedWidth:!0,icon:q.SbL}),onClick:ex})})})]}),(0,n.jsx)(f.U,{in:!D&&"existing"===y&&c,children:(0,n.jsx)(v.K,{onFocusCapture:()=>{m(!0)},children:(0,n.jsxs)(W.h,{mx:"auto",size:"md",mb:"4",children:[(0,n.jsx)(A.z,{variant:"plain",onClick:()=>{m(!1),E(I.current)},children:(0,n.jsx)(s.cC,{id:"dEgA5A"})}),(0,n.jsx)(A.z,{variant:"solid",onClick:ex,children:(0,n.jsx)(s.cC,{id:"4tE6l+"})})]})})}),(0,n.jsx)(f.U,{in:!!("new"===y&&w),children:(0,n.jsx)(H.k,{w:"100%",justifyContent:"center",children:(0,n.jsx)(A.z,{isDisabled:!w||D,size:"lg",minW:{base:"100%",md:"16em"},onClick:ep,variant:"solid",rightIcon:(0,n.jsx)(T.G,{icon:q.eFW}),children:(0,n.jsx)(s.cC,{id:"4tE6l+"})})})})]})}),(0,n.jsx)(f.U,{in:"new"===y&&!w,children:(0,n.jsxs)(v.K,{width:"100%",spacing:4,children:[(0,n.jsxs)(N.U,{w:"100%",spacing:"3",alignItems:"center",h:"10",children:[(0,n.jsx)(V.i,{borderColor:"blackAlpha.400"}),(0,n.jsx)(B.x,{flexShrink:"0",color:"gray.600",children:(0,n.jsx)(s.cC,{id:"Mx
1B2DA"})}),(0,n.jsx)(V.i,{borderColor:"blackAlpha.400"})]}),(0,n.jsx)(K.M,{columns:{base:1,md:3},spacing:{base:2,md:3},children:ev.slice(0,3).map((e,t)=>(0,n.jsx)(eh,{starterPrompt:e,setPrompt:E},t))}),(0,n.jsx)(H.k,{justify:"center",w:"100%",children:(0,n.jsx)(A.z,{variant:"plain",size:{base:"sm",md:"md"},leftIcon:(0,n.jsx)(T.G,{icon:r.a_u}),onClick:ef,children:(0,n.jsx)(s.cC,{id:"gH5Gbn"})})})]})})]})});ex.displayName="PromptAndOutlineSettings";let eh=e=>{let{setPrompt:t,starterPrompt:i}=e,s=(0,d.useCallback)(()=>{t("".concat(i.prompt))},[i,t]);return(0,n.jsxs)(v.K,{as:A.z,direction:"row",alignItems:"flex-start",whiteSpace:"normal",textAlign:"left",display:"inline-flex",boxShadow:"sm",variant:"unstyled",h:"auto",p:3,spacing:3,bg:"whiteAlpha.700",border:"2px solid",borderColor:"transparent",borderRadius:"md",cursor:"pointer",_hover:{borderColor:"purple.400"},onClick:s,role:"group",minH:{base:"44px",md:"16"},children:[(0,n.jsx)(B.x,{color:"purple.300",_groupHover:{color:"purple.500"},children:(0,n.jsx)(T.G,{icon:i.icon,fixedWidth:!0})}),(0,n.jsx)(B.x,{title:i.prompt,fontSize:"sm",color:"gray.800",fontWeight:"medium",noOfLines:{base:2,md:3},flex:"1",children:i.prompt}),(0,n.jsx)(B.x,{fontSize:"sm",color:"blackAlpha.400",_groupHover:{color:"purple.500"},children:(0,n.jsx)(T.G,{icon:r.r8p,fixedWidth:!0})})]})},em=()=>Z.ag._({id:"BiLwIi"}),ep=(0,d.memo)(e=>{let{goToThemeStep:t}=e,{skipThemeStep:i}=(0,u.R)(),r=(0,p.CG)(h.RB);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(f.U,{in:"new"==(r?"existing":"new"),children:(0,n.jsx)(v.K,{alignContent:"center",pt:{base:"9",md:"8vh"},w:"100%",children:(0,n.jsxs)(v.K,{spacing:{base:2,md:4},mb:{base:5,md:8},w:"100%",children:[(0,n.jsx)(C.X,{textAlign:"center",color:"gray.800",fontWeight:"600",fontFamily:"p22-mackinac-pro",w:"100%",size:{base:"xl",md:"2xl"},children:(0,n.jsx)(s.cC,{id:"ziAjHi"})}),(0,n.jsx)(C.X,{size:{base:"sm",md:"md"},textAlign:"center",fontWeight:"500",color:"blackAlpha.700",children:(0,n.jsx)(s.cC,{id:"yMWCRe"})})]})})}),(0,n.jsxs)(b.W,{maxW:"3xl",width:"100%",pb:"150px",children:[(0,n.jsx)(ex,{}),(0,n.jsx)(G,{})]}),r&&(0,n.jsx)(w.U,{cta:i?(0,n.jsx)(k.j,{children:(0,n.jsx)(s.cC,{id:"ziAjHi"})}):(0,n.jsx)(y.O,{onClick:t})})]})});ep.displayName="OutlineStep";var eg=i(13734),ej=i(8484);let ef=(0,d.memo)(e=>{let{autosetLocale:t}=e,[i,l]=(0,d.useState)("outline"),{webpageOnly:f,skipThemeStep:v,onGenerateSuccess:C}=(0,u.R)(),{query:b}=(0,a.useRouter)(),y=b.ref,k=(0,p.CG)(h.RB);(0,m.j)({queryKey:"ref"});let w=(0,p.TL)(),S=(0,p.qr)(),[E,I]=(0,j.Ns)("locale");(0,d.useEffect)(()=>{t&&I((0,g.K)())},[w,I,S]),(0,d.useEffect)(()=>()=>{w((0,h.mc)())},[]);let _=(0,d.useCallback)(()=>{l("outline")},[]),A=(0,d.useCallback)(()=>{v||l("theme")},[v]),T="new"==(k?"existing":"new")||"theme"===i?void 0:(0,n.jsx)(s.cC,{id:"ziAjHi"}),O=(0,d.useMemo)(()=>{let e;let t=("dashboard"===y||"sites-dashboard"==y)&&"outline"===i,l=t?(0,n.jsx)(s.cC,{id:"i0qMbr"}):(0,n.jsx)(s.cC,{id:"iH8pgl"}),o=t?r.J9Y:r.acZ,a={};return"theme"===i&&(a={position:"absolute"},e=_),{navLabel:l,navIcon:o,onClick:e,options:{ref:y},styleProps:a}},[_,y,i]);return(0,n.jsx)(x.jX,{children:(0,n.jsxs)(c.v4,{children:[(0,n.jsx)(o(),{children:(0,n.jsx)("title",{children:(0,n.jsx)(s.cC,{id:"EixifW"})})}),(0,n.jsx)(ej.D,{...O,pageTitle:T}),"outline"===i?(0,n.jsx)(ep,{goToThemeStep:A}):(0,n.jsx)(eg.O,{})]})})});ef.displayName="CreateGeneratePage"},49516:function(e,t,i){"use strict";i.d(t,{j:function(){return ee}});var n=i(52322),r=i(43297),s=i(28535),l=i(77533),o=i(11082),a=i(17993),d=i(74409),c=i(62614),u=i(54933),x=i(49929),h=i(5879),m=i(87254),p=i(2784),g=i(5632),j=i(76332),f=i(42111),v=i(91994),C=i(50260),b=i(21733),y=i(63304),k=i(39486),w=i(9449),S=i(31490),E=i(39122);let I=()=>{let{push:e}=(0,g.useRouter)(),t=(0,v.qr)(),[i]=(0,j.Kb4)(),[n,r]=(0,p.useState)(!1),[s]=(0,j.JBp)(),[l]=(0,j.VS0)(),[o]=(0,j.Mhm)(),a=(0,p.useCallback)(async()=>{var e,t,n;let r=(0,S.nZ)(),l=(0,b.n_)(),o=await s({variables:{input:{workspaceId:(0,b.n_)(),generationType:j.FJd.UploadPpt,input:{interactionId:(0,S.nZ)(),settings:{...y.zJ},format:"deck"}}}}),a=null===(t=o.data)||void 0===t?void 0:null===(e=t.createDocGeneration.draftInput)||void 0===e?void 0:e.id;if(!a)throw Error("No docGenerateInputId");let d=await i({variables:{docGenerateInputId:a,options:{themeId:C.C4}}}),c=null===(n=d.data)||void 0===n?void 0:n.generateDoc;if(!c)throw Error("Could not create doc");return null==c||c.docGenerateInput.id,{docGenerateInputId:a,interactionId:r,workspaceId:l,docId:c.id}},[s,i]),[d]=(0,j.UoQ)(),c=(0,p.useCallback)(async e=>{var t;let{docId:i,themeId:n}=e,r=await d({variables:{id:i,themeId:n}});return null===(t=r.data)||void 0===t?void 0:t.updateDoc},[d]),u=(0,p.useCallback)(async e=>{var i,n;let r;let{file:s,docId:l,interactionId:a}=e;if(!s.thumbnails)throw Error("No thumbnails");let d=await o({variables:{input:{htmlUrl:s.htmlUrl,workspaceId:(0,b.n_)(),interactionId:a}}});if(!(null===(n=d.data)||void 0===n?void 0:null===(i=n.parsePptHtml)||void 0===i?void 0:i.slideHtml))throw Error("Could not parse ppt html");console.log("Got slides HTML",r=d.data.parsePptHtml.slideHtml);let{stream:c,cancel:u}=(0,w.ZE)({promptKey:"ImportPPT",interactionId:a,variables:{slidesHtml:r,thumbnails:s.thumbnails},workspaceId:(0,b.n_)()},{streamId:l,streamResumingEnabled:!0,retries:3});await (0,k.m3)({stream:c,onCancel:u,interactionId:a,options:{docFormatKey:"deck",imageOptions:{},lazyImages:!1},bufferCards:1,store:t,docId:l}).promise},[o,t]),x=(0,p.useCallback)(async e=>{var t;let{interactionId:i,file:n,docId:r,docGenerateInputId:s}=e,o=await l({variables:{input:{interactionId:i,workspaceId:(0,b.n_)(),docId:r,docGenerateInputId:s,htmlUrl:n.htmlUrl,thumbnails:n.thumbnails}}}),a=null===(t=o.data)||void 0===t?void 0:t.generateImportPptThemes;if(!a)throw Error("Error generating theme");return a.themes},[l]),h=(0,p.useCallback)(async t=>{let{file:i}=t;console.log("[GENERATE] file",i),r(!0);try{let{docGenerateInputId:t,docId:n,interactionId:r,workspaceId:s}=await a();console.log("[GENERATE] createDoc",{docGenerateInputId:t,docId:n,interactionId:r,workspaceId:s});let l=u({file:i,docId:n,interactionId:r});if(f.VH.get("pptImportThemes")){let e=x({interactionId:r,file:i,docId:n,docGenerateInputId:t}),s=e.then(e=>(console.log("[GENERATE] themes",e),c({docId:n,themeId:e[0].id})));await Promise.all([s,l])}else await l;e("/docs/".concat(n,"?source=").concat(E.VY))}finally{r(!1)}},[a,u,x,e,c]);return{generate:h,isGenerating:n}};var _=i(93202),A=i(18153),T=i(26787),O=i(11050),P=i(86581),D=i(18455),R=i(17190),G=i(42946),z=i(82863),N=i(14274),M=i(51874),L=i(83633),F=i(8484);let U=e=>{let{children:t}=e,{query:i}=(0,g.useRouter)(),r="dashboard"===i.key?(0,n.jsx)(h.cC,{id:"i0qMbr"}):(0,n.jsx)(h.cC,{id:"iH8pgl"}),s="dashboard"===i.key?G.J9Y:G.acZ;return(0,n.jsx)(z.rg,{clientId:N.v.GOOGLE_DRIVE_IMPORT_CLIENT_ID,children:(0,n.jsxs)(M.v4,{children:[(0,n.jsx)(F.D,{navL
1abel:r,navIcon:s,options:{ref:i.ref}}),(0,n.jsx)(L.U,{title:(0,n.jsx)(h.cC,{id:"eumYBf"}),subtitle:(0,n.jsx)(h.cC,{id:"7aFH7x"}),icon:(0,n.jsx)(x.G,{icon:u.Vmj}),iconBoxProps:{color:"purple.300"},children:(0,n.jsx)(R.W,{maxW:"3xl",children:t})})]})})};var W=i(29117),H=i(36474),V=i(32899),B=i(94523);let K=e=>{let{importedFile:t,handleDelete:i,children:r}=e;return(0,n.jsxs)(a.g,{spacing:{base:8,md:10},maxW:"100%",w:"700px",alignSelf:"center",children:[(0,n.jsx)(a.g,{spacing:4,align:"stretch",w:"100%",children:(0,n.jsxs)(W.U,{justifyContent:"center",bg:"white",py:3,px:4,spacing:4,borderRadius:"md",shadow:"sm",children:[(0,n.jsx)(s.xu,{color:"green.500",fontSize:"lg",children:(0,n.jsx)(x.G,{icon:u.f8k})}),(0,n.jsx)(l.x,{noOfLines:1,children:null==t?void 0:t.filename}),(0,n.jsx)(H.L,{}),(0,n.jsx)(B.kH,{placement:"top",label:(0,n.jsx)(h.cC,{id:"cILfnJ"}),children:(0,n.jsx)(V.h,{onClick:i,variant:"ghost",colorScheme:"red","aria-label":m.ag._({id:"cILfnJ"}),icon:(0,n.jsx)(x.G,{icon:G.Vui})})})]})}),(0,n.jsx)(a.g,{spacing:4,w:"100%",children:r})]})};var q=i(82655),Y=i(22902);let Z=(0,p.memo)(e=>{let{value:t,onSelect:i}=e;return(0,n.jsxs)(r.K,{direction:"row",mb:4,w:"100%",justifyContent:"center",children:[(0,n.jsx)(B.kH,{placement:"top",label:(0,n.jsx)(h.cC,{id:"MZZYy8"}),children:(0,n.jsx)(s.xu,{flex:"1",children:(0,n.jsx)(Y.qe,{label:(0,n.jsx)(h.cC,{id:"3b7s4O"}),icon:q.qHV,selectedIcon:u.qHV,onClick:()=>{i("vision")},description:(0,n.jsx)(h.cC,{id:"m7XeHS",components:{0:(0,n.jsx)("strong",{})}}),isSelected:"vision"===t})})}),(0,n.jsx)(B.kH,{placement:"top",label:(0,n.jsx)(h.cC,{id:"7IsDMu"}),children:(0,n.jsx)(s.xu,{flex:"1",children:(0,n.jsx)(Y.qe,{label:(0,n.jsx)(h.cC,{id:"jZBpoi"}),icon:q.JyM,selectedIcon:u.JyM,onClick:()=>{i("text")},isSelected:"text"===t,description:(0,n.jsx)(h.cC,{id:"piZd2g",components:{0:(0,n.jsx)("strong",{})}})})})})]})});Z.displayName="PptImportTypeSelector";var X=i(704),J=i(96796),Q=i(76282);let $={GoogleDocs:_.FJd.ImportGoogleDoc,GoogleSlides:_.FJd.ImportGoogleSlides,PptxUpload:_.FJd.UploadPpt,DocxUpload:_.FJd.UploadWordFile},ee=(0,p.memo)(()=>{(0,A.j)({queryKey:"ref"});let e=(0,v.TL)(),t=(0,O.z$)(),{guessSettings:i,isLoading:g}=(0,J.d)(),{goToScreen:j}=(0,X.R)(),C=(0,f.ye)("pptImportV2"),[b,y]=(0,p.useState)("freeform"),k=(0,v.CG)(Q.$Q),w=(null==k?void 0:k.source)==="PptxUpload",[S,E]=(0,p.useState)("deck"),[_,R]=(0,p.useState)(C?"vision":"text"),G=(0,p.useCallback)(i=>{let{source:n,src:r}=i;e((0,Q.c_)(i)),"GoogleSlides"===n||"PptxUpload"===n?y("structured"):y("freeform"),null==t||t.track(O.AA.DOC_IMPORTED,{source:n,src:r,with_ai:!0})},[e,t]),{generate:z,isGenerating:N}=I(),M=(0,p.useCallback)(async()=>{if(!k)return;if(w&&C&&"vision"===_){await z({file:k});return}let e=$[k.source],t=(0,D.B)(k.html,!1),n=(0,P.c$)(t),r="GoogleDocs"===k.source||"DocxUpload"===k.source;await i(e,{format:S,content:n,settings:{textMode:r&&"deck"==S?"condense":r||"document"!==S?"preserve":"generate",editorMode:b}})},[k,w,C,_,S,b,i,z]),L=(0,p.useCallback)(()=>{e((0,Q.c_)(void 0))},[e]);return(0,n.jsxs)(U,{children:[!k&&(0,n.jsxs)(r.K,{direction:"column",spacing:{base:6,md:8},align:"center",w:"100%",children:[(0,n.jsx)(T.v,{onImportComplete:G}),(0,n.jsx)(s.xu,{w:"100%",children:(0,n.jsx)(l.x,{textAlign:"center",color:"blackAlpha.800",children:(0,n.jsx)(h.cC,{id:"HmmZUO",components:{0:(0,n.jsx)(o.r,{textDecoration:"underline",fontWeight:"600",href:"/create/paste?ref=import",onClick:e=>{e.preventDefault(),j("createPaste",{ref:"import"})}})}})})})]}),k&&(0,n.jsxs)(K,{importedFile:k,handleDelete:L,children:[!w&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.g,{spacing:4,w:"100%",py:2,children:[(0,n.jsx)(d.X,{size:{base:"sm",md:"md"},textAlign:"center",fontWeight:"500",color:"blackAlpha.700",px:4,children:(0,n.jsx)(h.cC,{id:"SjATqV"})}),(0,n.jsx)(Y.FQ,{setSelectedFormat:E,selectedFormat:S})]}),(0,n.jsx)(s.xu,{width:"100%",children:(0,n.jsx)(c.z,{size:"lg",variant:"solid",rightIcon:(0,n.jsx)(x.G,{icon:u.eFW}),onClick:M,isLoading:g,loadingText:m.ag._({id:"qgUvjm"}),w:"100%",children:(0,n.jsx)(h.cC,{id:"xGVfLh"})})})]}
1),w&&(0,n.jsxs)(n.Fragment,{children:[C&&(0,n.jsxs)(a.g,{spacing:4,w:"100%",py:2,children:[(0,n.jsx)(d.X,{size:{base:"sm",md:"md"},textAlign:"center",fontWeight:"500",color:"blackAlpha.700",px:4,children:(0,n.jsx)(h.cC,{id:"ETAPks"})}),(0,n.jsx)(Z,{value:_,onSelect:R})]}),"text"===_&&(0,n.jsxs)(a.g,{spacing:4,w:"100%",py:2,children:[(0,n.jsx)(d.X,{size:{base:"sm",md:"md"},textAlign:"center",fontWeight:"500",color:"blackAlpha.700",px:4,children:(0,n.jsx)(h.cC,{id:"SjATqV"})}),(0,n.jsx)(Y.FQ,{setSelectedFormat:E,selectedFormat:S})]}),(0,n.jsx)(s.xu,{width:"100%",children:(0,n.jsx)(c.z,{size:"lg",variant:"solid",rightIcon:(0,n.jsx)(x.G,{icon:u.eFW}),onClick:M,isLoading:g||N,loadingText:m.ag._({id:"qgUvjm"}),w:"100%",children:(0,n.jsx)(h.cC,{id:"xGVfLh"})})})]})]})]})});ee.displayName="CreateImportPage"},49580:function(e,t,i){"use strict";i.d(t,{B:function(){return B}});var n=i(52322),r=i(17190),s=i(43297),l=i(69251),o=i(30523),a=i(11082),d=i(17993),c=i(74409),u=i(42822),x=i(67109),h=i(62614),m=i(42946),p=i(54933),g=i(49929),j=i(5879),f=i(2784),v=i(16983),C=i(51874),b=i(93202),y=i(42111),k=i(91994),w=i(36651),S=i(76282),E=i(83633),I=i(704),_=i(28535),A=i(77533),T=i(82554),O=i(36474),P=i(29117),D=i(87254),R=i(48832),G=i(90221),z=i(78462);let N="trueblue",M={[b.FJd.Generate]:(0,n.jsx)(j.cC,{id:"ziAjHi"}),[b.FJd.PasteText]:(0,n.jsx)(j.cC,{id:"HzVv6g"}),[b.FJd.ImportGoogleDoc]:(0,n.jsx)(j.cC,{id:"HzVv6g"}),[b.FJd.ImportGoogleSlides]:(0,n.jsx)(j.cC,{id:"l3s5ri"}),[b.FJd.UploadWordFile]:(0,n.jsx)(j.cC,{id:"l3s5ri"}),[b.FJd.UploadPpt]:(0,n.jsx)(j.cC,{id:"l3s5ri"})},L=e=>{let{count:t}=e;return(0,n.jsx)(n.Fragment,{children:[...Array(t)].map((e,t)=>(0,n.jsx)(W,{children:(0,n.jsxs)(s.K,{spacing:1,w:"100%",children:[(0,n.jsx)(x.O,{height:"1rem",borderRadius:"sm",w:"100%"}),(0,n.jsx)(_.xu,{w:"12rem",children:(0,n.jsx)(x.O,{height:"0.875rem",borderRadius:"sm",w:"100%"})})]})},t))})},F=e=>{for(let t of e)if(0!==t.trim().length&&"---"!==t.trim())return t.trim().replace(/^[#]{1,3}/,"");return D.ag._({id:"wja8aL"})},U=e=>{var t,i,r,s,l,o;let{docGeneration:a}=e,{goToScreen:d}=(0,I.R)(),c={whitespace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},u=(null===(t=a.draftInput)||void 0===t?void 0:t.prompt)||(null===(r=a.docGenerateInputs)||void 0===r?void 0:null===(i=r[0])||void 0===i?void 0:i.prompt),x=(null===(s=a.draftInput)||void 0===s?void 0:s.content)||(null===(o=a.docGenerateInputs)||void 0===o?void 0:null===(l=o[0])||void 0===l?void 0:l.content)||"",h=F(x.split("\n")),p=a.generationType===b.FJd.Generate&&u?u:h.slice(0,100),v=(0,R.BK)(a.updatedTime),C=0===a.docGenerateInputs.length,y=(0,z.Xn)(a),k=(0,f.useCallback)(()=>{a.generationType===b.FJd.Generate?d("createGenerate",{generateId:a.id}):d("promptEditor",{generateId:a.id})},[a.generationType,a.id,d]);return(0,n.jsxs)(W,{href:y,onClick:k,children:[(0,n.jsxs)(_.xu,{overflow:"hidden",maxW:"100%",children:[(0,n.jsx)(A.x,{...c,textAlign:"left",fontSize:{base:"sm",md:"md"},mb:[1,1.5],children:p}),(0,n.jsxs)(A.x,{...c,textAlign:"left",maxW:"100%",fontWeight:"400",fontSize:{base:"xs",md:"sm"},color:"gray.700",children:[M[a.generationType]," \xb7 ",v,C&&(0,n.jsxs)(n.Fragment,{children:[" \xb7 ",(0,n.jsx)(T.C,{colorScheme:"teal",children:(0,n.jsx)(j.cC,{id:"eneWvv"})})]})]})]}),(0,n.jsx)(O.L,{}),(0,n.jsx)(_.xu,{fontSize:{base:"sm",md:"md"},color:"blackAlpha.400",_groupHover:{color:"".concat(N,".500")},children:(0,n.jsx)(g.G,{icon:m._tD})})]})},W=e=>{let{children:t,href:i,onClick:r,...s}=e;return(0,n.jsx)(h.z,{as:a.r,href:i||void 0,onClick:e=>{e.preventDefault(),null==r||r()},bg:"white",borderRadius:"lg",display:"flex",border:"1px solid",boxShadow:"sm",borderColor:"white",variant:"plain",fontSize:"lg",py:4,spacing:"3",role:"group",minH:{base:16,md:20},_hover:(0,G.s2)()?{}:{color:"".concat(N,".600"),textDecoration:"none",boxShadow:"md"},...s,children:(0,n.jsx)(P.U,{spacing:"3",w:"100%",children:t})})};var H=i(8484);let V=e=>{let{createGenerateV2Enabled:t}=e;return{paste:{label:(0,n.jsx)(j.cC,{id:"Q4xH1Z"}),description:(0,n.jsx)(j.cC,{id:"MxbdK6"}),icon:p.nfZ,colorScheme:"pink",imageUrl:"/_next/static/media/Thumbnail-paste.fdba31f6.svg",transform:"rotate(-1.5deg) scale(0.84)",screen:"createPaste"},generate:{label:(0,n.jsx)(j.cC,{id:"ziAjHi"}),description:(0,n.jsx)(j.cC,{id:"anOFr5"}),icon:p.JyM,colorScheme:"trueblue",imageUrl:"/_next/static/media/Thumbnail-generate.8e2e4605.svg",isPopular:!0,screen:t?"createGenerate":"legacyGuidedMode"},import:{label:(0,n.jsx)(j.cC,{id:"2xoyqj"}),description:(0,n.jsx)(j.cC,{id:"5c5WYH"}),icon:p.Vmj,colorScheme:"purple",imageUrl:"/_next/static/media/Thumbnail-transform.76b5e76e.svg",transform:"rotate(1.5deg) scale(0.84)",screen:"createImport"}}},B=(0,f.memo)(()=>{var e;let t=(0,k.TL)(),{goToScreen:i,navEnabled:p}
1=(0,I.R)(),_=(0,w.n_)(),[A,T]=(0,f.useState)(!1),O=(0,y.ye)("createGenerateV2"),{data:P,fetchMore:D,loading:R}=(0,b.M1N)({variables:{workspaceId:_,first:5}}),G=null==P?void 0:P.docGenerations.pageInfo,z=(0,f.useCallback)(()=>{(null==G?void 0:G.hasNextPage)&&(null==G?void 0:G.endCursor)&&(T(!0),D({variables:{after:null==G?void 0:G.endCursor}}).finally(()=>{T(!1)}))},[D,G]),N=(0,f.useMemo)(()=>{var e;return(null==P?void 0:null===(e=P.docGenerations)||void 0===e?void 0:e.edges.map(e=>e.node))||[]},[null==P?void 0:null===(e=P.docGenerations)||void 0===e?void 0:e.edges]);return(0,n.jsxs)(C.v4,{children:[p&&(0,n.jsx)(H.D,{navLabel:(0,n.jsx)(j.cC,{id:"i0qMbr"}),navIcon:m.J9Y,options:{ref:"home"}}),(0,n.jsx)(E.U,{title:(0,n.jsx)(j.cC,{id:"1zuBj5"}),subtitle:(0,n.jsx)(j.cC,{id:"h0sjMM"}),children:(0,n.jsx)(r.W,{maxW:"4xl",children:(0,n.jsx)(s.K,{spacing:12,align:"center",children:(0,n.jsx)(l.r,{gap:[4,4,2],gridTemplateAreas:{base:'"generate" "paste" "import"',md:'"paste generate import"'},gridTemplateColumns:{base:"1fr",md:"1fr 1fr 1fr"},width:"100%",children:Object.entries(V({createGenerateV2Enabled:O})).map(e=>{let[r,{label:s,description:l,isPopular:d,colorScheme:c,imageUrl:u,transform:x,screen:h}]=e;return(0,n.jsx)(o.P,{area:r,children:(0,n.jsx)(v.X,{as:a.r,label:s,description:l,isPopular:d,colorScheme:c,imageUrl:u,transform:x,onClick:e=>{t((0,S._8)()),e.preventDefault(),e.stopPropagation(),i(h)},ctaIcon:(0,n.jsx)(g.G,{icon:m.eFW}),ctaLabel:(0,n.jsx)(j.cC,{id:"xGVfLh"})})},r)})})})})}),(0,n.jsx)(r.W,{maxW:"2xl",pb:"10vw",children:(0,n.jsxs)(d.g,{align:"stretch",spacing:[2,3],children:[(0,n.jsx)(c.X,{fontSize:["lg","2xl"],mb:[2,3],textAlign:"center",fontWeight:"600",color:"gray.800",fontFamily:"p22-mackinac-pro",children:R?(0,n.jsx)(u.M,{children:(0,n.jsx)(x.O,{w:"50%",h:6})}):0===N.length?(0,n.jsx)(n.Fragment,{}):(0,n.jsx)(j.cC,{id:"yvKMb+"})}),(0,n.jsx)(d.g,{spacing:3,align:"stretch",children:R?(0,n.jsx)(L,{count:5}):(null==N?void 0:N.length)===0?(0,n.jsx)(n.Fragment,{}):N.map(e=>(0,n.jsx)(U,{docGeneration:e},e.id))}),A&&(0,n.jsx)(L,{count:5}),(null==G?void 0:G.hasNextPage)&&(0,n.jsx)(h.z,{leftIcon:(0,n.jsx)(g.G,{icon:m.r8p}),variant:"plain",boxShadow:"none",_hover:{bg:"white"},onClick:()=>z(),isLoading:A,children:(0,n.jsx)(j.cC,{id:"yQ2kGp"})})]})})]})});B.displayName="CreatePage"},49197:function(e,t,i){"use strict";i.d(t,{L:function(){return D}});var n=i(52322),r=i(17190),s=i(17993),l=i(28535),o=i(87651),a=i(74409),d=i(62614),c=i(77533),u=i(11082),x=i(42946),h=i(54933),m=i(49929),p=i(94523),g=i(5879),j=i(87254),f=i(2784),v=i(51874),C=i(45760),b=i(28918),y=i(93202),k=i(18153),w=i(91994),S=i(93546),E=i(96796),I=i(76282),_=i(54012),A=i(22902),T=i(83633),O=i(704),P=i(8484);let D=(0,f.memo)(()=>{let{guessSettings:e,isLoading:t}=(0,E.d)(),i=(0,w.CG)(I.au),[D,R]=(0,f.useState)(!1),[G,z]=(0,f.useState)("deck"),{goToScreen:N}=(0,O.R)(),M=(0,f.useCallback)(async()=>{let t=(0,_.Yl)(i),n=(0,_.vE)(i),r=(0,b.J1)(i);await e(y.FJd.PasteText,{format:G,content:i,settings:{textMode:r>=1e3?"document"===G?"preserve":"condense":"generate",editorMode:n>2&&t>5?"structured":"freeform"}})},[e,G,i]);return(0,k.j)({queryKey:"ref"}),(0,n.jsx)(C.jX,{children:(0,n.jsxs)(v.v4,{children:[(0,n.jsx)(P.D,{navLabel:(0,n.jsx)(g.cC,{id:"iH8pgl"}),navIcon:x.acZ}),(0,n.jsx)(T.U,{title:(0,n.jsx)(g.cC,{id:"RG+JLG"}),subtitle:(0,n.jsx)(g.cC,{id:"v2ydVh"}),icon:(0,n.jsx)(m.G,{icon:h.OEL}),iconBoxProps:{color:"salmon.300"},children:(0,n.jsx)(r.W,{maxW:"2xl",children:(0,n.jsxs)(s.g,{spacing:4,w:"100%",children:[(0,n.jsx)(s.g,{spacing:3,align:"stretch",w:"100%",children:(0,n.jsx)(S.e,{containerProps:{minH:{base:"270px",sm:"300px",md:"50vh"},maxH:"50vh",overflow:"auto"},hideFooter:!0,onEditorUpdate:e=>{let{editor:t}=e;R(!t.isEmpty)}})}),(0,n.jsx)(l.xu,{w:"100%",children:(0,n.jsx)(o.U,{in:D,children:(0,n.jsxs)(s.g,{spacing:4,py:2,w:"100%",children:[(0,n.jsx)(a.X,{size:{base:"sm",md:"md"},textAlign:"center",fontWeight:"500",color:"blackAlpha.700",px:4,children:(0,n.jsx)(g.cC,{id:"SjATqV"})}),(0,n.jsx)(A.FQ,{setSelectedFormat:z,selectedFormat:G})]})})}),(0,n.jsx)(p.kH,{label:i?"":(0,n.jsx)(g.cC,{id:"9IxKHJ"}),isDisabled:!!i,placement:"top",children:(0,n.jsx)(l.xu,{width:"100%",children:(0,n.jsx)(d.z,{size:"lg",minW:"16em",width:"100%",onClick:M,variant:"solid",rightIcon:(0,n.jsx)(m.G,{icon:x.eFW}),isLoading:t,isDisabled:!i,loadingText:j.ag._({id:"qgUvjm"}),children:(0,n.jsx)(g.cC,{id:"xGVfLh"})})})}),(0,n.jsx)(l.xu,{w:"100%",children:(0,n.jsx)(o.U,{in:!D,children:(0,n.jsx)(c.x,{textAlign:"center",color:"blackAlpha.800",children:(0,n.jsx)(g.cC,{id:"LVQnRo",components:{0:(0,n.jsx)(u.r,{onClick:e=>{e.preventDefault(),N("createImport",{ref:"paste"})},textDecoration:"underline",fontWeight:"600"})}})})})})]})})})]})})});D.displayName="CreatePastePage"},22902:function(e,t,i){"use strict";i.d(t,{FQ:function(){return f},_J:function(){return g},qe:function(){return j}});var n=i(52322),r=i(43297),s=i(62614),l=i(28535),o=i(77533),a=i(82655),d=i(42946),c=i(54933),u=i(49929),x=i(94523),h=i(87254),m=i(2784),p=i(90221);let g={deck:{label:()=>h.ag._({id:"FOoDGS"}
1),selectedIcon:c.s2,icon:a.s2,description:()=>h.ag._({id:"EPYCou"})},document:{label:()=>h.ag._({id:"7Zdnlq"}),selectedIcon:c.OEL,icon:a.OEL,description:()=>h.ag._({id:"nM2WM0"})},webpage:{label:()=>h.ag._({id:"YVokw8"}),selectedIcon:c.tc$,icon:a.tc$,description:()=>h.ag._({id:"C90Qtf"})}},j=e=>{let{label:t,icon:i,description:a,selectedIcon:x,isSelected:h,onClick:m,hideCheckbox:g}=e,j="purple.500";return(0,n.jsxs)(r.K,{as:s.z,h:"auto",textShadow:"none",variant:"plain",p:{base:2.5,sm:3},minW:24,spacing:1,w:"100%",cursor:"pointer",textAlign:"center",transition:"all 300ms ease",border:"2px solid",bg:h?"white":"whiteAlpha.800",borderRadius:"md",boxShadow:"sm",borderColor:h?j:"whiteAlpha.400",color:h?"trueblue.700":"gray.800",onClick:m,_hover:(0,p.s2)()?{color:"gray.800"}:{bg:"trueblue.50",borderColor:"trueblue.400"},position:"relative",children:[!g&&(0,n.jsx)(l.xu,{fontSize:"md",position:"absolute",left:1.5,top:1.5,color:h?j:"gray.200",children:(0,n.jsx)(u.G,{icon:h?c.f8k:d.diR})}),(0,n.jsx)(l.xu,{fontSize:{base:"lg",sm:"xl"},color:h?"trueblue.600":"trueblue.300",children:(0,n.jsx)(u.G,{icon:h?x:i})}),(0,n.jsx)(o.x,{fontSize:"sm",fontWeight:"500",noOfLines:1,children:t}),a&&(0,n.jsx)(o.x,{mt:2,fontSize:"xs",fontWeight:"500",whiteSpace:"normal",children:a})]})},f=(0,m.memo)(e=>{let{setSelectedFormat:t,selectedFormat:i,hideCheckbox:s}=e;return(0,n.jsx)(r.K,{direction:"row",mb:4,w:"100%",justifyContent:"center",children:Object.entries(g).map(e=>{let[r,{label:o,icon:a,selectedIcon:d,description:c}]=e;return(0,n.jsx)(x.kH,{placement:"top",label:c(),children:(0,n.jsx)(l.xu,{flex:"1",children:(0,n.jsx)(j,{label:o(),icon:a,selectedIcon:d,hideCheckbox:s,onClick:()=>{t(r)},isSelected:r===i})})},r)})})});f.displayName="FormatPickerComponent"},83633:function(e,t,i){"use strict";i.d(t,{U:function(){return a}});var n=i(52322),r=i(43297),s=i(74409),l=i(28535),o=i(38035);let a=e=>{let{title:t,subtitle:i,icon:a,iconBoxProps:d,children:c}=e;return(0,n.jsxs)(r.K,{alignContent:"center",position:"relative",zIndex:"0",spacing:0,py:{base:"9",md:"8vh"},w:"100%",children:[(0,n.jsxs)(r.K,{spacing:{base:2,md:4},mb:{base:5,md:8},w:"100%",children:[null!==t&&(0,n.jsxs)(s.X,{textAlign:"center",color:"gray.800",fontWeight:"600",fontFamily:"p22-mackinac-pro",w:"100%",size:{base:"xl",md:"2xl"},px:4,children:[a&&(0,n.jsx)(l.xu,{display:"inline",mr:2,...d,children:a}),t]}),i&&(0,n.jsx)(s.X,{size:{base:"sm",md:"md"},textAlign:"center",fontWeight:"500",color:"blackAlpha.700",px:4,children:i})]}),(0,n.jsx)(o.k,{w:"100%",justifyContent:"center",children:c})]})}},21723:function(e,t,i){"use strict";i.d(t,{B:function(){return d}});var n=i(52322),r=i(38035),s=i(2784),l=i(71113),o=i(67496),a=i(51874);let d=(0,s.memo)(e=>{let{id:t,children:i}=e,{isLoading:s}=(0,o.HL)({id:t});return s?(0,n.jsx)(r.k,{...a.ZQ,w:"100%",h:"100%",flex:1,alignSelf:"center",children:(0,n.jsx)(l.AA,{})}):(0,n.jsx)(n.Fragment,{children:i})});d.displayName="LoadDocGenerationPage"},704:function(e,t,i){"use strict";i.d(t,{R:function(){return s},u:function(){return r}});var n=i(2784);let r=(0,n.createContext)({goToScreen:()=>{throw Error("goToScreen not available. Did you forget to wrap your component in RouterNavigationContext?")},goBack:()=>{throw Error("goBack not available. Did you forget to wrap your component in RouterNavigationContext?")},onDocGenerationLoaded:()=>{},navEnabled:!0,webpageOnly:!1,skipThemeStep:!1}),s=()=>(0,n.useContext)(r)},13734:function(e,t,i){"use strict";i.d(t,{O:function(){return Q}});var n=i(52322),r=i(38035),s=i(2784),l=i(91994),o=i(14324),a=i(67613),d=i(46409),c=i(90221),u=i(93441),x=i(28535),h=i(17993),m=i(62614),p=i(28165),g=i(54933),j=i(49929),f=i(5879),v=i(41004),C=i(4742),b=i.n(C),y=i(9850),k=i.n(y),w=i(86113),S=i(27333),E=i(52394),I=i(83947),_=i(31709),A=i(32186),T=i(96933),O=i(87205),P=i(74153),D=i(75816),R=i(50260),G=i(22569);let z=e=>{let{theme:t}=e,i=t||R.mU,{isLoadingThemes:r}=(0,o.a)(),s=(0,G.R5)(i),l=(0,R.wj)(i),a=(0,G.wh)(s,l),d=r?{}:a;return(0,n.jsx)(x.xu,{...d,w:"100vw",h:"100%",position:"fixed",zIndex:-1,opacity:1,"data-theme-picker-background":!0,transitionProperty:"background-color, background-image",transitionDuration:"1s",inset:"0px"})},N=(0,v.E)(x.xu),M=e=>{let{card:t,theme:i,...r}=e,l=(0,s.useMemo)(()=>
1{if(t)return(0,_.vL)({docFlags:{cardLayoutsEnabled:!0}},[t])},[t]);return(0,n.jsx)(N,{pointerEvents:"none",sx:{"*":{backdropFilter:"none !important",transitionProperty:"background-color, color, border-color, padding, margin, width, maxWidth, fontSize",transitionDuration:".15s",[".button .".concat(S.A8)]:{transitionProperty:"none"}},".doc-content-wrapper *[data-doc-background-element], .motion-present-mode-bg":{display:"none"},".card-wrapper,.card-body,.doc-content-wrapper":{padding:0,margin:0,minHeight:"auto"},"[data-card-body]":{"--card-color-transparent":"var(--card-color)","--card-width":"60rem"}},...r,children:l&&i&&(0,n.jsx)(A.m,{content:l,initialContent:l,theme:i})})},L=(e,t,i)=>{let n=0,r=e=>{var s;return null===(s=e.content)||void 0===s?void 0:s.map(e=>{var s,l,o,a,d,c,u;let x={...e,attrs:{...e.attrs}};if("image"===e.type){let e=t.shift();e&&(x.attrs.src=e.imageUrl,x.attrs.tempUrl=e.imageUrl)}if("cardAccentLayoutItem"===e.type&&(null===(o=e.attrs)||void 0===o?void 0:null===(l=o.background)||void 0===l?void 0:null===(s=l.image)||void 0===s?void 0:s.src)){let e=null==i?void 0:null===(u=i.config)||void 0===u?void 0:null===(c=u.accentBackgrounds)||void 0===c?void 0:c[n];e&&(n++,x.attrs.background=e)}if("smartLayoutCell"===e.type&&(null===(d=e.attrs)||void 0===d?void 0:null===(a=d.image)||void 0===a?void 0:a.src)==="custom"){let e=t.shift();e&&(x.attrs.image.src=e.imageUrl,x.attrs.image.tempUrl=e.imageUrl)}return e.content&&(x.content=r(x)),x})};return Object.assign({},e,{content:r(e)})},F=e=>{e&&requestAnimationFrame(()=>{var t;return null===(t=document.querySelector('[data-theme-id="'.concat(e,'"]')))||void 0===t?void 0:t.scrollIntoView({behavior:"smooth"})})},U=e=>{let{images:t}=e,i=(0,l.TL)(),o=(0,l.CG)(a.ez),d=(0,l.CG)(a.$b),[c,u]=(0,P.Ns)("themeId"),x=o.find(e=>c===e.id);(0,s.useEffect)(()=>{if(c||!(null==o?void 0:o.length))return;i((0,a.uG)({activeView:"standard"}));let e=b()(d);e&&(u(e.id),F(e.id))},[i,c,d,o,u]);let v=(0,s.useMemo)(()=>{let e=k()((0,w.s)()),i=L(e,k()(t),x);return i.content[0].content||[]},[x,t]),C=(0,s.useCallback)(()=>{if(!o)return;let e=b()(o);e&&(u(e.id),(null==e?void 0:e.workspaceId)?i((0,a.uG)({activeView:"custom"})):i((0,a.uG)({activeView:"standard"})),F(null==e?void 0:e.id))},[i,u,o]),y=(0,T.i)({base:0,"4xl":300})||0,S=(0,T.i)({base:600,xl:250,"4xl":0})||0,_=(0,T.i)({base:0,xl:1})||0,R=(0,T.i)({base:.5,lg:.6,xl:.7,"2xl":.85,"3xl":1,"4xl":1.125});return(0,s.useEffect)(function(){o&&0!==o.length&&Promise.all(o.map(e=>{var t,i,n,r,s,l,o,a,d,c;(null===(n=e.config.accentBackgrounds)||void 0===n?void 0:null===(i=n[0])||void 0===i?void 0:null===(t=i.image)||void 0===t?void 0:t.src)&&(0,O.GN)(null===(a=e.config.accentBackgrounds)||void 0===a?void 0:null===(o=a[0].image)||void 0===o?void 0:o.src),(null===(l=e.config.accentBackgrounds)||void 0===l?void 0:null===(s=l[1])||void 0===s?void 0:null===(r=s.image)||void 0===r?void 0:r.src)&&(0,O.GN)(null===(c=e.config.accentBackgrounds)||void 0===c?void 0:null===(d=c[1].image)||void 0===d?void 0:d.src)}))},[o]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z,{theme:x}),(0,n.jsxs)(r.k,{zIndex:1,py:0,px:6,sx:A.n,"data-theme-desktop-root":!0,position:"relative",children:[(0,n.jsx)(p.xB,{styles:{html:{overflowX:"hidden",overflowY:"auto"}}}),(0,n.jsxs)(r.k,{direction:"column",pos:"relative",flex:1,h:"100%",transform:"scale(".concat(R,")"),justifyContent:"center",alignItems:"center",ml:[40,35,30,20,0],"data-id":"theme-picker-desktop-cards",children:[(0,n.jsx)(M,{pos:"absolute",theme:x,card:v[2],initial:{opacity:0}
1,animate:{opacity:1,translateX:0,transition:{opacity:{duration:.5,delay:0,ease:"easeOut"},default:{duration:2,ease:"easeOut"}}},zIndex:1}),(0,n.jsx)(M,{pos:"absolute",theme:x,card:v[0],initial:{translateX:0,opacity:0},animate:{translateX:y,translateY:S,rotate:-_,opacity:1,transition:{default:{duration:2,delay:.5,ease:"easeOut"}}}}),(0,n.jsx)(M,{pos:"absolute",theme:x,card:v[1],initial:{translateX:0,opacity:0},transformOrigin:"center",animate:{translateX:-y,translateY:-S,rotate:_,opacity:1,transition:{default:{duration:2,delay:.5,ease:"easeOut"}}}})]}),(0,n.jsxs)(r.k,{w:"420px",p:6,direction:"column",justifyContent:"center",bg:"whiteAlpha.900",borderRadius:"lg",h:"calc(100vh - var(--chakra-sizes-20))",minH:"700px",mb:4,shadow:"md",pos:"relative",position:"sticky",mt:6,children:[(0,n.jsx)(I.v,{title:(0,n.jsx)(f.cC,{id:"cQGp8b"}),description:(0,n.jsxs)(h.g,{w:"100%",align:"center",justify:"center",children:[(0,n.jsx)(D.j,{w:"100%",children:(0,n.jsx)(f.cC,{id:"ziAjHi"})}),(0,n.jsx)(m.z,{w:"100%",leftIcon:(0,n.jsx)(j.G,{icon:g.a_u,color:"var(--chakra-colors-trueblue-800)"}),size:"md",onClick:C,children:(0,n.jsx)(f.cC,{id:"B8w15Q"})})]}),stackProps:{pb:4},currentTheme:x}),(0,n.jsx)(E.t,{shouldScrollToCurrent:!0,currentTheme:x,setTheme:e=>{u(null==e?void 0:e.id)},flexProps:{overflowY:"auto",mx:-6,px:3}})]})]})]})};var W=i(43297),H=i(74409),V=i(77533),B=i(75768),K=i(29117),q=i(42946),Y=i(43997),Z=i(8393),X=i(18438);let J=()=>{let e=(0,s.useRef)(!1),t=(0,l.CG)(a.Y3),i=(0,l.CG)(a.$b),[o,d]=(0,P.Ns)("themeId",{debounce:500}),[c,u]=(0,s.useState)(()=>t.find(e=>e.id===o)),h=(0,Y.I0)(),g=(0,l.CG)(a.C0),v=(0,l.CG)(a.FM),C=c?(0,R.wj)(c):void 0;(0,s.useEffect)(()=>{if(o||!(null==i?void 0:i.length)||e.current)return;let t=b()(i);if(t){var n;h((0,a.uG)({activeView:"standard"})),u(t),null===(n=document.querySelector('[data-theme-mobile-preview="'.concat(t.id,'"]')))||void 0===n||n.scrollIntoView(),e.current=!0}},[h,i,o]),(0,s.useEffect)(()=>{var t;!e.current&&o&&c&&(c.workspaceId?h((0,a.uG)({activeView:"custom"})):h((0,a.uG)({activeView:"standard"})),null===(t=document.querySelector('[data-theme-mobile-preview="'.concat(c.id,'"]')))||void 0===t||t.scrollIntoView(),e.current=!0)},[h,c,o]);let y=(0,s.useCallback)(e=>{let{scrollLeft:i,scrollWidth:n,clientWidth:r}=e.target,s=Math.round(i/(n-r)*(t.length-1)),l=t[s];l.id!==(null==c?void 0:c.id)&&u(l)},[t,null==c?void 0:c.id,u]),k=(0,s.useCallback)(()=>{(null==c?void 0:c.id)&&d(c.id)},[null==c?void 0:c.id,d]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z,{theme:c}),(0,n.jsxs)(W.K,{spacing:0,h:"100%",w:"100vw",children:[(0,n.jsx)(p.xB,{styles:{html:{height:"100%"},body:{height:"100%"}}}),(0,n.jsxs)(W.K,{spacing:0,mx:"auto",zIndex:1,px:6,pt:20,sx:A.n,w:"100%",children:[(0,n.jsxs)(W.K,{align:"center",spacing:1,children:[(0,n.jsx)(H.X,{letterSpacing:"-0.04em",fontWeight:"700",fontFamily:"p22-mackinac-pro",color:C?"#FFFFFF":"#0a1629",w:"100%",size:"2xl",transitionProperty:"common",transitionDuration:"normal",children:(0,n.jsx)(f.cC,{id:"cQGp8b"})}),(0,n.jsx)(V.x,{fontSize:"lg",color:C?"#FFFFFF":"#0a1629",letterSpacing:"-0.04em",transitionProperty:"common",transitionDuration:"normal",children:(0,n.jsx)(f.cC,{id:"950yV9"})})]}),g&&(0,n.jsxs)(B.h,{variant:"ghost",size:"sm",borderRadius:"full",w:"100%",pt:2,justifyContent:"center",children:[(0,n.jsx)(m.z,{borderRadius:"full",leftIcon:(0,n.jsx)(j.G,{icon:q.D0h,fixedWidth:!0}),"data-theme-picker-active-view-button":"custom",colorScheme:"custom"===v?"trueblue":"gray",bg:"custom"===v?"trueblue.100":"gray.100",onClick:()=>h((0,a.uG)({activeView:"custom"})),children:(0,n.jsx)(f.cC,{id:"8Tg/JR"})}),(0,n.jsx)(m.z,{borderRadius:"full",leftIcon:(0,n.jsx)(x.xu,{w:3.5,children:(0,n.jsx)(Z.Y,{})}),"data-theme-picker-active-view-button":"standard",colorScheme:"standard"===v?"trueblue":"gray",bg:"standard"===v?"trueblue.100":"gray.100",onClick:()=>h((0,a.uG)({activeView:"standard"})),children:(0,n.jsx)(f.cC,{id:"TJBHlP"})})]})]}),(0,n.jsx)(r.k,{zIndex:1,pos:"relative",overflow:"auto",py:8,sx:{"scroll-snap-type":"x mandatory"},onScroll:y,children:(0,n.jsx)(K.U,{flex:1,spacing:6,px:12,pt:1,children:t.map(e=>(0,n.jsx)(X.L,{isSelected:e.id===(null==c?void 0:c.id),theme:e},e.id))})}),(0,n.jsx)(r.k,{px:6,py:4,mb:2,justify:"center",zIndex:9,w:"100%",children:(0,n.jsx)(D.j,{size:"lg",w:"100%",onClick:k,children:(0,n.jsx)(f.cC,{id:"ziAjHi"})})})]})]})},Q=(0,s.memo)(e=>{let{images:t=[]}=e;(0,o.a)();let i=(0,l.CG)(a.ez);return(0,u.gF)()&&(null==i?void 0:i.length)?(0,n.jsxs)(r.k,{direction:"column",justifyContent:"flex-start",flex:1,w:"100vw",h:"100%",children:[(0,n.jsx)(d.Y,{}),(0,c.s2)()?(0,n.jsx)(J,{}):(0,n.jsx)(U,{images:t})]}):null});Q.displayName="ThemeStep"},8484:function(e,t,i){"use strict";i.d(t,{D:function(){return x}});var n=i(52322),r=i(29117),s=i(38035),l=i(62614),o=i(74409),a=i(42946),d=i(49929),c=i(5879),u=i(704);let x=e=>{let{navLabel:t=(0,n.jsx)(c.cC,{id:"iH8pgl"}),navIcon:i=a.acZ,onClick:x,options:h,pageTitle:m,pageIcon:p,rightItem:g,centerItem:j,styleProps:f}=e,{goBack:v,navEnabled:C}=(0,u.R)();return(0,n.jsxs)(r.U,{px:4,position:"relative",zIndex:"10",width:"100%",spacing:3,alignItems:"flex",...f,children:[(0,n.jsx)(s.k,{flex:"1",children:C&&(0,n.jsx)(l.z,{size:"sm",leftIcon:(0,n.jsx)(d.G,{icon:i,fixedWidth:!0}),variant:"plain",bg:"white",borderRadius:"md",boxShadow:"sm",border:"none",onClick:()=>{x?x():v(h)},children:t})}),(0,n.jsx)(s.k,{flex:"3",align:"center",justify:"center",children:j||(0,n.jsxs)(r.U,{justifyContent:"center",w:"100%",children:[p&&p,m&&(0,n.jsx)(o.X,{fontWeight:"600",fontSize:{base:"md",sm:"lg",md:"xl"},fontFamily:"p22-mackinac-pro",children:m})]})}),(0,n.jsx)(s.k,{flex:"1",justifyContent:"flex-end",alignItems:"center",children:g})]})}},75258:function(e,t,i){"use strict";i.d(t,{D:function(){return g},x:function(){return j}});var n=i(52322),r=i(75768),s=i(62614),l=i(42946),o=i(49929),a=i(94523),d=i(87254),c=i(2784),u=i(76282),x=i(91994),h=i(7208),m=i(74153),p=i(96933);let g={freeform:{label:()=>d.ag._({id:"Jn5DbR"}),icon:l.elf,description:()=>d.ag._({id:"f15rRF"}),tip:()=>d.ag._({id:"y8DgoV"})},structured:{label:()=>d.ag._({id:"2PPaNm"}),icon:l.s2,description:()=>d.ag._({id:"on9ayD"}),tip:()=>d.ag._({id:"G7ngQL"})}},j=(0,c.memo)(()=>{let[e,t]=(0,m.Ns)("editorMode"),i=(0,x.CG)(u.Vn),{onChangeMode:l}=(0,h.N)(),d=(0,p.i)({base:!1,sm:!0});return(0,n.jsx)(r.h,{isAttached:!0,isDisabled:i,children:Object.entries(g).map(i=>{let[r,{label:c,description:u,icon:x}]=i,h=r===e;return(0,n.jsx)(a.kH,{label:u(),placement:"top",children:(0,n.jsx)(s.z,{size:"sm",leftIcon:d?(0,n.jsx)(o.G,{icon:x,fixedWidth:!0}):void 0,variant:h?"plainSelected":"plain",onClick:()=>
1{t(r),l()},boxShadow:"none",children:c()})},r)})})});j.displayName="ModeSwitcher"},33872:function(e,t,i){"use strict";i.d(t,{$3:function(){return G},Td:function(){return D},p3:function(){return z}});var n=i(52322),r=i(17993),s=i(10625),l=i(67046),o=i(62614),a=i(75009),d=i(332),c=i(99058),u=i(25481),x=i(28535),h=i(82554),m=i(77533),p=i(35183),g=i(97166),j=i(29494),f=i(42946),v=i(54933),C=i(49929),b=i(5879),y=i(87254),k=i(2784),w=i(42111),S=i(99787),E=i(47821),I=i(9883),_=i(68728),A=i(61185),T=i(67964),O=i(74153),P=i(39092);let D=(0,k.memo)(()=>{let[e]=(0,O.Ns)("imageProvider"),t=A.s[e]||S.QT,[i]=(0,O.Ns)("imageLicense"),s=(0,_.E)(i),[l]=(0,O.Ns)("imageStyle",{debounce:500});return(0,n.jsx)(P.j,{label:(0,n.jsx)(b.cC,{id:"an5hVd"}),colorScheme:"trueblue",icon:v.VmB,values:[null==t?void 0:t.label(),"web"===e&&s,"aiGenerated"===e&&l],children:(0,n.jsxs)(r.g,{spacing:4,children:[(0,n.jsx)(G,{}),(0,n.jsx)(z,{})]})})});D.displayName="ImageSettingsGroup";let R=(0,k.memo)(e=>{let{provider:t,setProvider:i}=e,r=(0,E.Ao)();return(0,n.jsxs)(s.v,{children:[(0,n.jsx)(l.j,{as:o.z,variant:"plain",boxShadow:"sm",w:"100%",textAlign:"left",rightIcon:(0,n.jsx)(C.G,{icon:f.ptq}),leftIcon:t.image?(0,n.jsx)(a.E,{h:"1em",w:"1em",objectFit:"cover",src:t.image.src}):t.icon?(0,n.jsx)(C.G,{icon:t.icon,color:"var(--chakra-colors-trueblue-600)",fixedWidth:!0}):void 0,size:"sm",children:t.label()||(0,n.jsx)(b.cC,{id:"wdxz7K"})}),(0,n.jsx)(d.h,{children:(0,n.jsx)(c.q,{zIndex:"tooltip",maxH:"60vh",overflowY:"auto",children:Object.entries(A.s).map(e=>{let[t,{label:s,icon:l,image:o,badge:d,description:c}]=e;return"aiGenerated"!==t||r?(0,n.jsxs)(u.s,{icon:o?(0,n.jsx)(a.E,{display:"inline",mr:2,h:"1em",w:"1em",objectFit:"contain",src:o.src}):l?(0,n.jsx)(x.xu,{display:"inline",mr:2,color:"trueblue.600",children:(0,n.jsx)(C.G,{icon:l})}):void 0,onClick:()=>i(t),children:[s(),d&&(0,n.jsx)(h.C,{ml:2,colorScheme:"green",children:d()}),c&&(0,n.jsx)(m.x,{fontSize:"xs",color:"gray.500",children:c()})]},t):null})})})]})});R.displayName="ImageProviderPicker";let G=()=>{let[e,t]=(0,O.Ns)("imageProvider"),i=A.s[e]||S.QT;return(0,n.jsxs)(p.NI,{children:[(0,n.jsx)(g.l,{fontSize:"sm",fontWeight:"semibold",children:(0,n.jsx)(b.cC,{id:"qA0pmh"})}),(0,n.jsx)(R,{provider:i,setProvider:t})]})},z=()=>{let[e]=(0,O.Ns)("imageProvider"),[t,i]=(0,O.Ns)("imageLicense"),[r,s]=(0,O.Ns)("imageStyle",{debounce:500}),l=(0,T.Y)("ai_premium_models"),o=(0,w.ye)("aiGeneratedImagesDefaultModel"),[a,d]=(0,O.Ns)("imageModel");return(0,n.jsxs)(n.Fragment,{children:["web"===e&&(0,n.jsxs)(p.NI,{children:[(0,n.jsx)(g.l,{fontSize:"sm",fontWeight:"semibold",children:(0,n.jsx)(b.cC,{id:"6TSHCF"})}),(0,n.jsx)(_.A,{value:t,onChange:i})]}),"aiGenerated"===e&&(0,n.jsxs)(p.NI,{children:[(0,n.jsx)(g.l,{fontSize:"sm",fontWeight:"semibold",children:(0,n.jsx)(b.cC,{id:"X2yiuT"})}),(0,n.jsx)(j.g,{value:r,onChange:e=>s(e.target.value),placeholder:y.ag._({id:"5x/foo"}),rows:2})]}),"aiGenerated"===e&&l&&(0,n.jsxs)(p.NI,{children:[(0,n.jsx)(g.l,{fontSize:"sm",fontWeight:"semibold",children:(0,n.jsx)(b.cC,{id:"emv9SK"})}),(0,n.jsx)(I.q,{value:a||o,setValue:d})]})]})}},39092:function(e,t,i){"use strict";i.d(t,{i:function(){return C},j:function(){return v}});var n=i(52322),r=i(87436),s=i(95897),l=i(29117),o=i(28535),a=i(43297),d=i(77533),c=i(36474),u=i(89511),x=i(11121),h=i(67109),m=i(49929),p=i(2784),g=i(76282),j=i(91994);let f={_groupHover:{color:"purple.600"}},v=(0,p.memo)(e=>{let{icon:t,colorScheme:i="gray",label:p,values:v=[],children:C}=e,b=(0,j.CG)(g.RB);return(0,n.jsx)(r.Q,{border:"none",children:e=>{let{isExpanded:r}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.K,{_focus:{boxShadow:"none",outline:"none"},py:2,p:3,outline:"none",transitionProperty:"common",transitionDuration:"normal",bg:"transparent",_hover:{bg:"".concat(i,".50")},children:(0,n.jsxs)(l.U,{width:"100%",spacing:"3",align:"start",children:[(0,n.jsx)(o.xu,{...f,display:"inline",fontSize:"sm",color:"".concat(i,".300"),children:(0,n.jsx)(m.G,{icon:t,fixedWidth:!0})}),(0,n.jsxs)(a.K,{spacing:0,align:"start",textAlign:"left",children:[(0,n.jsx)(d.x,{...f,fontWeight:"700",children:p}),!r&&(0,n.jsx)(d.x,{fontSize:"sm",fontWeight:"500",noOfLines:2,...f,children:v.filter(Boolean).join(" \xb7 ")})]}),(0,n.jsx)(c.L,{}),(0,n.jsx)(u.X,{...f})]})}),(0,n.jsxs)(x.H,{p:4,pt:3,pb:6,children:[b&&C,!b&&(0,n.jsxs)(a.K,{spacing:4,pt:2,align:"start",children:[(0,n.jsx)(h.O,{w:"100%",height:"30px"}),(0,n.jsx)(h.O,{w:"100%",height:"30px"}),(0,n.jsx)(h.O,{w:"100%",height:"30px"})]})]})]})}})});v.displayName="SettingsGroup";let C=e=>{let{children:t}=e;return(0,n.jsx)(d.x,{fontSize:"sm",color:"gray.500",children:t})}},62141:function(e,t,i){"use strict";i.d(t,{B:function(){return O},o:function(){return I}});var n=i(52322),r=i(17993),s=i(35183),l=i(97166),o=i(75768),a=i(62614),d=i(43297),c=i(29494),u=i(87651),x=i(54933),h=i(49929),m=i(94523),p=i(5879),g=i(87254),j=i(2784),f=i(48525),v=i(45302),C=i(63304),b=i(74153),y=i(54012),k=i(39092),w=i(89099),S=i(16556);let E=(0,j.memo)(e=>{let{tagsList:t,onClick:i}=e;return(0,n.jsx)(w.E,{pb:"2",align:"flex-start",w:"100%",children:t.map(e=>(0,n.jsx)(w.U,{children:(0,n.jsx)(S.Vp,{cursor:"pointer",colorScheme:"purple",boxShadow:"sm",_hover:{color:"white",bg:"purple.600"},onClick:()=>{i(e.value)},children:e.label})},e.label))})});E.displayName="SettingsTags";let I=(0,j.memo)(()=>{var e;
1let[t]=(0,b.Ns)("locale"),i=(0,v.jw)(t),[s]=(0,b.Ns)("textAmount"),[l]=(0,b.Ns)("textMode"),o=null===(e=A.find(e=>e.key===l))||void 0===e?void 0:e.label();return(0,n.jsx)(k.j,{label:(0,n.jsx)(p.cC,{id:"OuNFIM"}),colorScheme:"blue",icon:x.elf,values:[o,"preserve"!==l&&(0,y.XL)(s).label,"generate"===l&&i.displayName],children:(0,n.jsxs)(r.g,{spacing:4,children:[(0,n.jsx)(_,{}),"preserve"!==l&&(0,n.jsx)(O,{}),"generate"===l&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P,{}),(0,n.jsx)(R,{})]}),(0,n.jsx)(T,{})]})})});I.displayName="TextSettingsGroup";let _=()=>{let[e,t]=(0,b.Ns)("textMode");return(0,n.jsxs)(s.NI,{children:[(0,n.jsx)(l.l,{fontSize:"sm",fontWeight:"semibold",children:(0,n.jsx)(p.cC,{id:"OuNFIM"})}),(0,n.jsx)(o.h,{size:"sm",isAttached:!0,width:"100%",children:A.map(i=>(0,n.jsx)(m.kH,{placement:"top",label:i.tip(),children:(0,n.jsx)(a.z,{variant:i.key===e?"plainSelected":"plain",boxShadow:"none",leftIcon:(0,n.jsx)(h.G,{icon:i.icon}),onClick:()=>t(i.key),width:"100%",children:i.label()})},i.label()))})]})},A=[{label:()=>g.ag._({id:"ziAjHi"}),key:"generate",icon:x.ddb,tip:()=>g.ag._({id:"8mt5hR"})},{label:()=>g.ag._({id:"NIvI2q"}),key:"condense",icon:x.G_A,tip:()=>g.ag._({id:"owZbal"})},{label:()=>g.ag._({id:"c0sF7y"}),key:"preserve",icon:x.byT,tip:()=>g.ag._({id:"RPSHJC"})}],T=()=>{let[e,t]=(0,b.Ns)("locale"),i=(0,v.jw)(e);return(0,n.jsxs)(s.NI,{children:[(0,n.jsx)(l.l,{fontSize:"sm",fontWeight:"semibold",children:(0,n.jsx)(p.cC,{id:"f6Pzgf"})}),(0,n.jsx)(f.k,{locale:i,setLocale:t,buttonProps:{variant:"plain",size:"sm",width:"100%",textAlign:"left"}})]})},O=()=>{let[e,t]=(0,b.Ns)("textAmount"),[i]=(0,b.Ns)("textMode"),r=(0,j.useMemo)(()=>(0,C.kq)(),[]);return(0,n.jsxs)(s.NI,{children:[(0,n.jsx)(l.l,{fontSize:"sm",fontWeight:"semibold",children:"condense"===i?(0,n.jsx)(p.cC,{id:"z7tEVo"}):(0,n.jsx)(p.cC,{id:"UmJg9q"})}),(0,n.jsx)(o.h,{size:"sm",isAttached:!0,width:"100%",children:Object.entries(r).map(i=>{let[r,{label:s,description:l,icon:o}]=i;return(0,n.jsx)(m.kH,{placement:"top",label:l,children:(0,n.jsx)(a.z,{variant:e===r?"plainSelected":"plain",boxShadow:"none",onClick:()=>t(r),leftIcon:(0,n.jsx)(h.G,{icon:o}),width:"100%",textAlign:"left",children:s})},r)})})]})},P=()=>{let[e,t]=(0,b.Ns)("audience",{debounce:500}),i=(0,j.useMemo)(()=>D(),[]);return(0,n.jsxs)(s.NI,{children:[(0,n.jsx)(l.l,{fontSize:"sm",fontWeight:"semibold",children:(0,n.jsx)(p.cC,{id:"CfNFS9"})}),(0,n.jsxs)(d.K,{spacing:3,children:[(0,n.jsx)(c.g,{size:"sm",minH:16,value:e,onChange:e=>t(e.target.value)}),(0,n.jsx)(u.U,{in:""===e||null===e,children:(0,n.jsx)(E,{tagsList:i,onClick:e=>{t(e)}})})]})]})},D=()=>[{label:g.ag._({id:"9N+p+g"}),value:g.ag._({id:"pCuan7"})},{label:g.ag._({id:"Y9OrUQ"}),value:g.ag._({id:"no1XFa"})},{label:g.ag._({id:"vINKFZ"}),value:g.ag._({id:"H13RWO"})},{label:g.ag._({id:"5AIqvu"}),value:g.ag._({id:"hqe36h"})},{label:g.ag._({id:"bNrMlq"}),value:g.ag._({id:"kImdWQ"})}],R=()=>{let[e,t]=(0,b.Ns)("tone",{debounce:500}),i=(0,j.useMemo)(()=>G(),[]);return(0,n.jsxs)(s.NI,{children:[(0,n.jsx)(l.l,{fontSize:"sm",fontWeight:"semibold",children:(0,n.jsx)(p.cC,{id:"uAQyzk"})}),(0,n.jsxs)(d.K,{spacing:"3",children:[(0,n.jsx)(c.g,{size:"sm",minH:16,value:e,onChange:e=>t(e.target.value)}),(0,n.jsx)(u.U,{in:""===e||null===e,children:(0,n.jsx)(E,{tagsList:i,onClick:e=>{t(e)}})})]})]})},G=()=>[{label:g.ag._({id:"Oojfbh"}),value:g.ag._({id:"L7fEtA"})},{label:g.ag._({id:"hzExWo"}),value:g.ag._({id:"F64cR2"})},{label:g.ag._({id:"wanXT9"}),value:"Precise and detailed writing suitable for technical documents, manuals, and guides. Emphasize accuracy and clarity"},{label:g.ag._({id:"ChasOQ"}),value:g.ag._({id:"lVYl+I"})},{label:g.ag._({id:"wTl0UK"}),value:g.ag._({id:"sFGQvg"})},{label:g.ag._({id:"4Nl9R0"}),value:g.ag._({id:"cspP/G"})}]},50896:function(e,t,i){"use strict";i.d(t,{J:function(){return E},Y:function(){return S}});var n=i(52322),r=i(75768),s=i(32899),l=i(62614),o=i(29117),a=i(77533),d=i(28535),c=i(10625),u=i(67046),x=i(332),h=i(99058),m=i(44035),p=i(39237),g=i(42946),j=i(49929),f=i(94523),v=i(5879),C=i(87254),b=i(2784),y=i(62131),k=i(81640),w=i(11050);let S=(0,b.memo)(e=>{let{onIncrement:t,onDecrement:i,maxCards:c,cardCount:u,...x}=e,h={boxShadow:"sm",bg:"white"};return(0,n.jsxs)(r.h,{isAttached:!0,flex:"1",...x,children:[null!=u&&(0,n.jsx)(s.h,{display:"flex",onClick:i,icon:(0,n.jsx)(j.G,{icon:g.Kl4}),"aria-label":C.ag._({id:"MrRUp2"}),width:2,...h}),(0,n.jsx)(l.z,{flex:"1",...h,_hover:{color:"inherit"},cursor:"default",children:(0,n.jsx)(f.kH,{label:(0,n.jsx)(v.cC,{id:"ukrE78"}),placement:"top",children:(0,n.jsx)(o.U,{spacing:1,cursor:"help",children:(0,n.jsxs)(a.x,{children:[(0,n.jsx)(d.xu,{as:"span",css:{fontVariantNumeric:"tabular-nums"},children:u})," ",(0,n.jsx)(v.cC,{id:"MU+gFM",values:{0:null!=u?u:0}})]})})})}),null!=u&&(0,n.jsx)(s.h,{display:"flex",onClick:t,icon:(0,n.jsx)(j.G,{icon:g.r8p}),"aria-label":C.ag._({id:"sFY+gw"}),width:2,isDisabled:u>=c,...h})]})});
1S.displayName="CardCountStepper";let E=(0,b.memo)(e=>{let{cardCount:t,maxCards:i,onChange:r}=e,{openUpsellModal:s}=(0,k.z)(),d=(0,b.useMemo)(()=>[...Array(i)],[i]),f=(0,b.useMemo)(()=>["15","20","25"],[]),C=()=>{s({segmentEvent:w.AA.GAMMA_UPSELL_CALLOUT_AI_GENERATE_LONGER})};return(0,n.jsxs)(c.v,{children:[(0,n.jsx)(u.j,{size:"sm",boxShadow:"none",minW:"32",textAlign:"left",as:l.z,rightIcon:(0,n.jsx)(j.G,{size:"xs",icon:g.ptq}),children:(0,n.jsx)(v.cC,{id:"fFAIng",values:{0:null!=t?t:0}})}),(0,n.jsx)(x.h,{children:(0,n.jsx)(h.q,{zIndex:"tooltip",children:(0,n.jsxs)(m._,{onChange:e=>{let t=Number(e);if(t>10){C();return}r(t)},value:"".concat(t),children:[d.map((e,t)=>{let i=t+1;return(0,n.jsx)(p.i,{value:"".concat(i),children:(0,n.jsx)(v.cC,{id:"bM4Wv5",values:{count:i}})},i)}),f.map(e=>{let t=Number(e);return(0,n.jsx)(p.i,{bg:"trueblue.50",border:"1px solid white",_hover:{bg:"trueblue.50",borderColor:"trueblue.200"},value:"".concat(t),children:(0,n.jsxs)(o.U,{spacing:"3",children:[(0,n.jsx)(a.x,{w:"100%",children:(0,n.jsx)(v.cC,{id:"bM4Wv5",values:{count:t}})}),(0,n.jsx)(y.ER,{product:"pro"})]})},t)})]})})})]})});E.displayName="CardCountDropdown"},43305:function(e,t,i){"use strict";i.d(t,{O:function(){return g}});var n=i(52322),r=i(62614),s=i(29117),l=i(54933),o=i(49929),a=i(94523),d=i(5879),c=i(2784),u=i(85420),x=i(97763),h=i(25566),m=i(74153);let p=()=>{let[e]=(0,m.Ns)("imageProvider");return"aiGenerated"===e?"generateV2WithImages":"generateV2"},g=(0,c.memo)(e=>{let{onClick:t}=e,i=p(),{hasEnoughCreditsToGenerateDeck:c}=(0,x.qO)(),m=(0,x.YO)(t,"generateV2",h.AA.GAMMA_UPSELL_CALLOUT_AI_CREDITS_GENERATE_V2);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(a.kH,{label:(0,n.jsx)(d.cC,{id:"mTJ1YV"}),isDisabled:c,shouldWrapChildren:!0,children:(0,n.jsx)(r.z,{variant:"solid",w:"100%",rightIcon:(0,n.jsxs)(s.U,{children:[(0,n.jsx)(u.J,{type:i}),(0,n.jsx)(o.G,{icon:l.eFW})]}),onClick:m,size:{base:"md",lg:"lg"},children:(0,n.jsx)(d.cC,{id:"xGVfLh"})})})})});g.displayName="ContinueToThemePickerButton"},75816:function(e,t,i){"use strict";i.d(t,{j:function(){return H}});var n=i(52322),r=i(62614),s=i(54933),l=i(49929),o=i(94523),a=i(87254),d=i(2784),c=i(704),u=i(97763),x=i(11050),h=i(5632),m=i(39486),p=i(9449),g=i(22537),j=i(39122),f=i(93202),v=i(42111),C=i(67964),b=i(91994),y=i(84405),k=i(31181),w=i(15041),S=i(50260),E=i(14027),I=i(36651),_=i(45302),A=i(76282);let T=e=>{let t=(0,C.Y)("ai_premium_models"),i=(0,v.ye)("generatorGPT4"),n=(0,v.ye)("anthropicGenerate"),r=(0,v.ye)("mistralGenerate"),s=r?"mistralai/Mistral-7B-Instruct-v0.2":n?"claude-instant-1.2":"gpt-3.5-turbo-1106",l=r?"mistralai/Mixtral-8x7B-Instruct-v0.1":n?"claude-2.1":"gpt-4-1106-preview",o=(0,d.useCallback)(n=>{if(!t&&!i)return s;let r="generate"!==n.textMode&&!n.parallel,o=e>=800&&!n.parallel,a=n.numCards&&n.numCards>=12&&!n.parallel;return r||a||o?l:s},[t,i,e,s,l]);return o};var O=i(43019),P=i(50634),D=i(57124),R=i(78462),G=i(96796);let z=()=>{let{push:e}=(0,h.useRouter)(),[t]=(0,f.V$$)(),i=(0,v.ye)("createSiteAi"),n=(0,D._O)(),{generate:r}=(0,P.j)("DetermineSiteMetadata",{}),[s]=(0,f.gVY)(),[l]=(0,f.Iyu)(),[o]=(0,f.D1_)(),c=(0,d.useCallback)(async i=>{let{workspaceId:n,docId:d,themeId:c,generateVars:u,firstCards:x}=i,h=x[0]?(0,O.getCardTitle)(x[0].content):void 0,{data:m}=await t({variables:{input:{workspaceId:n,name:h||a.ag._({id:"h3eRam"}),routes:[{docId:d,path:"/"}],themeId:c}}}),p=null==m?void 0:m.createSite;if(!p){console.error("[CreateSiteModal] Failed to create site, no site returned"),e("/docs/".concat(d,"?source=").concat(j.VY));return}try{let e=x.map(e=>e.raw).join("\n"),{language:t,instructions:i,input:a}=u,{promise:c}=r({workspaceId:n,variables:{topic:i||"",input:a,language:t,pageHtml:e}}),h=await c,{title:m,subdomain:g}=(0,G.R)(h),j="string"==typeof g&&g.length<=60&&/^[a-z0-9-]+$/.test(g.toLowerCase()),f=[];j&&f.push(s({variables:{input:{siteId:p.id,name:g.toLowerCase()}}})),m&&f.push(...[l({variables:{input:{siteId:p.id,name:m}}}),o({variables:{id:d,title:m}})]),await Promise.all(f)}catch(e){console.error("(caught) useGenerateSite error: ".concat(e))}let g=(0,R.yQ)({docId:d,params:{source:j.VY}});e(g)},[t,e,r,s,l,o]);return{canCreateSite:i&&n,createSiteWithAIAndRedirect:c}};var N=i(5026),M=i(1071),L=i(56920),F=i(37164);let U=()=>{let{push:e}=(0,h.useRouter)(),[t]=(0,f.qbt)(),{generate:i}=(0,P.j)("DeterminePageMetadata",{}),[n]=(0,f.D1_)(),r=(0,d.useCallback)(async r=>{let{site:s,docId:l,workspaceId:o,generateVars:a,firstCards:d}=r;try{let{language:e,instructions:r,input:c}=a,u=s.routes.map(e=>{var t;
1return{title:null===(t=e.doc)||void 0===t?void 0:t.title,path:e.path}}),x=d.map(e=>e.raw).join("\n"),h=d[0]?(0,O.getCardTitle)(d[0].content):void 0,m=!0,{promise:p}=i({workspaceId:o,variables:{topic:r||"",input:c,language:e,otherPages:u,pageHtml:x}}),g=await p,{path:j,title:f}=(0,G.R)(g);f||(f=h||"Untitled page",m=!1),j||(j=(0,L.IR)(f)),s.routes.some(e=>e.path===j)&&(j="".concat(j,"-").concat((0,F.x0)(6))),await Promise.all([t({variables:{input:{siteId:s.id,docId:l,path:(0,w.fJ)(j),offline:!1}},refetchQueries:["GetSite"]}),n({variables:{id:l,title:f,titleEdited:m}})])}catch(e){console.error("(caught) useSetPageMetadataWithAI error: ".concat(e))}let c=(0,R.yQ)({docId:l,params:{source:j.VY}});e(c)},[i,e,t,n]);return{setPageMetadataWithAIAndRedirect:r}},W=e=>{let{onSuccess:t}=e,{push:i}=(0,h.useRouter)(),n=(0,b.qr)(),r=(0,b.CG)(k.lH),{canCreateSite:s,createSiteWithAIAndRedirect:l}=z(),{setPageMetadataWithAIAndRedirect:o}=U(),[c]=(0,f.Kb4)(),u=(0,v.ye)("generatorLazyImages"),[x,O]=(0,d.useState)(!1),P=(0,v.ye)("streamResumingEnabled"),D=(0,b.CG)(A.mO),R=!0,G="",{maxTokens:L}=(0,M.ml)(),{maxCards:F}=(0,N.hw)();D>L&&(R=!1,G=a.ag._({id:"ZcJO3k",values:{maxTokens:L}}));let W=T(D),H=(0,f.jLg)(f.vGj),V=(0,d.useCallback)(async()=>{var e;
1let a=n.getState(),d=(0,A.RB)(a),x=(0,A.U6)(a);if(!x)throw Error("Cannot generate with no docGenerateInputId");O(!0);let h=(0,I.n_)(),b=(0,A.au)(a),k=(0,A.lb)(a),T=(0,_.jw)((0,A.Mn)("locale")(a)),R=(0,A.Mn)("textAmount")(a),G=(0,A.Mn)("audience")(a),z=(0,A.Mn)("tone")(a),N=(0,A.Lh)(a),M=(0,A.CC)(a),L=(0,A.Mn)("imageLicense")(a),U=(0,A.Mn)("imageProvider")(a),V=(0,A.Mn)("imageModel")(a)||v.VH.get("aiGeneratedImagesDefaultModel"),B=(0,A.Mn)("imageStyle")(a),K=(0,A.Mn)("textMode")(a),q=(0,A.Mn)("editorMode")(a),Y=(0,A.PB)(a),Z={instructions:k,input:b,language:T.englishName,numCards:Math.min(M,F),format:N,textAmount:R,audience:G,tone:z,textMode:K,editorMode:q,imageProvider:"aiGenerated"===U?"aiGenerated":"web"},X=(0,A.Mn)("themeId")(a),J=X?(await H({id:X})).data.theme:void 0;"aiGenerated"===U&&!B&&J&&(B=(0,S.A)(J));let Q=s&&"webpage"===N,$=(0,w.Vr)(r)||Q,ee=await c({variables:{docGenerateInputId:x,options:{themeId:$?void 0:X||E.g.id,orgAccess:$?f.y3$.Manage:void 0}}}),et=null===(e=ee.data)||void 0===e?void 0:e.generateDoc,ei=null==et?void 0:et.docGenerateInput.id;if(!ei)throw Error("No docGenerateInput.id to use as interactionId");if(!et)throw Error("Could not create doc");let en=v.VH.get("generateParallel"),er=en&&"structured"===q&&(Z.numCards>=10||D>=2e3)&&(v.VH.get("generateParallelFree")||(0,C.uL)("ai_premium_models")),es=W({numCards:M,editorMode:q,textMode:K,parallel:er,textAmount:R}),el={docFormatKey:N,imageOptions:{license:L,provider:U,generateStyle:B,model:V},lazyImages:"aiGenerated"===U||u,theme:J},{input:eo,instructions:ea,...ed}=Z;g.a.trackRequestSent(n,{interface:"wizard",streaming:!0,interactionId:ei,inputContent:Z.input,inputMessage:Z.instructions,inputData:{options:el,isGenerateV2:!0,isAdvancedMode:"generate"!==Y,isParallel:er,generationType:Y,...ed,textAmount:R,format:N,language:Z.language,model:es},docId:et.id,docGenerationId:d,docGenerateInputId:ei});let{stream:ec,cancel:eu}=(0,p.ZE)({promptKey:er?"GenerateDeckParallel":"GenerateDeck",interactionId:ei,variables:{...Z,model:es},workspaceId:h},{streamId:et.id,streamResumingEnabled:P,retries:3}),ex=await (0,m.m3)({stream:ec,onCancel:eu,interactionId:ei,options:el,bufferCards:1,store:n,docId:et.id}).promise;(0,y.Q)({doc_id:et.id,source:f.L17.AiGenerated,extra:"v2"}),!r&&Q?await l({workspaceId:h,docId:et.id,generateVars:Z,themeId:X,firstCards:ex.cards}):r?(await o({docId:et.id,site:r,workspaceId:h,generateVars:Z,firstCards:ex.cards}),null==t||t()):i("/docs/".concat(et.id,"?source=").concat(j.VY))},[s,W,l,o,c,H,u,F,t,i,r,n,P,D]);return{generate:V,isGenerating:x,canGenerate:R,cantGenerateReason:G}},H=(0,d.memo)(e=>{let{children:t,onClick:i,...h}=e,{onGenerateSuccess:m}=(0,c.R)(),{isGenerating:p,generate:g,canGenerate:j,cantGenerateReason:f}=W({onSuccess:m}),v=(0,d.useCallback)(async()=>{null==i||i(),await g()},[i,g]),C=(0,u.YO)(v,"generateV2",x.AA.GAMMA_UPSELL_CALLOUT_AI_CREDITS_GENERATE_V2);return(0,n.jsx)(o.kH,{label:f,shouldWrapChildren:!0,children:(0,n.jsx)(r.z,{leftIcon:(0,n.jsx)(l.G,{icon:s.JyM}),variant:"solid",isLoading:p,loadingText:a.ag._({id:"NOdFZR"}),isDisabled:p,onClick:C,size:{base:"md",lg:"lg"},...h,children:t})})});H.displayName="GenerateButton"},4123:function(e,t,i){"use strict";i.d(t,{U:function(){return G}});var n=i(52322),r=i(43297),s=i(38035),l=i(29117),o=i(76282),a=i(14764),d=i(91994),c=i(25566),u=i(77533),x=i(94523),h=i(5879),m=i(2784),p=i(50896),g=i(74153),j=i(5026);let f=(0,m.memo)(e=>{let{...t}=e,i=(0,d.CG)(o.CC),[s,l]=(0,g.Ns)("numCards"),{maxCards:a}=(0,j.hw)(),c=(0,m.useCallback)(()=>{i&&l(Math.min(i+1,a))},[i,l,a]),f=(0,m.useCallback)(()=>{i&&1!==i&&l(i-1)},[i,l]),[v]=(0,g.Ns)("editorMode"),C=i>a,b=Math.min(i,a);return"structured"===v?(0,n.jsx)(x.kH,{label:(0,n.jsx)(h.cC,{id:"Zne1Sw"}),placement:"top",children:(0,n.jsxs)(r.K,{spacing:{base:.5,sm:2},flex:"1",justifyContent:"center",alignItems:"center",direction:{base:"column-reverse",sm:"row"},children:[(0,n.jsx)(u.x,{cursor:"help",fontSize:C?"xs":"lg",fontWeight:C?void 0:"600",textDecoration:C?"line-through":void 0,color:C?"gray.500":void 0,css:{textWrap:"nowrap"},textAlign:"center",children:(0,n.jsx)(h.cC,{id:"AZLIlg",values:{cardCount:i}})}),C&&(0,n.jsx)(u.x,{fontSize:{base:"md",sm:"lg"},fontWeight:"600",lineHeight:"1",children:(0,n.jsx)(h.cC,{id:"gcpsjO",values:{adjustedCardCount:b}})})]})}):(0,n.jsx)(p.Y,{maxCards:a,cardCount:i,onIncrement:c,onDecrement:f,...t})});
1f.displayName="CardCountSettings";var v=i(62614),C=i(28535),b=i(54933),y=i(49929),k=i(97763),w=i(62131),S=i(2953),E=i(11050),I=i(1071);let _=e=>{let{product:t,title:i,subtitle:r,isWarning:s=!1,onClick:o,cta:a}=e;return(0,n.jsxs)(l.U,{borderRadius:"md",bg:s?"sunglow.100":"trueblue.100",px:{base:2,md:3},pl:4,py:2,children:[t&&(0,n.jsx)(w.ER,{product:t}),(0,n.jsxs)(u.x,{py:1,fontSize:{base:"xs",sm:"sm"},noOfLines:2,lineHeight:"1.3",flex:"1",children:[(0,n.jsx)("strong",{children:i})," ",r]}),a&&o&&(0,n.jsx)(v.z,{onClick:o,variant:"ghost",color:"trueblue.500",bg:"trueblue.50",size:"sm",leftIcon:(0,n.jsx)(C.xu,{display:{base:"none",sm:"block"},children:(0,n.jsx)(y.G,{icon:b.JyM,fixedWidth:!0})}),children:a})]})},A=(0,m.memo)(()=>{let{hasEnoughCreditsToGenerateDeck:e}=(0,k.qO)(),{openUpsellModal:t}=(0,S.z)();return e?null:(0,n.jsx)(_,{product:"pro",isWarning:!0,onClick:()=>t({segmentEvent:E.AA.GAMMA_UPSELL_CALLOUT_AI_CREDITS_GENERATE_V2}),title:(0,n.jsx)(h.cC,{id:"Lhlq0w"}),subtitle:(0,n.jsx)(h.cC,{id:"cl2O0R"}),cta:(0,n.jsx)(h.cC,{id:"kwkhPe"})})});A.displayName="NotEnoughCreditsUpsellWarning";let T=(0,m.memo)(()=>{let e=(0,d.CG)(o.mO),{maxTokens:t,canUpgrade:i}=(0,I.ml)(),{openUpsellModal:r}=(0,S.z)();return!e||e<t?null:e>=t&&i?(0,n.jsx)(_,{product:"pro",isWarning:!0,onClick:()=>r({segmentEvent:E.AA.GAMMA_UPSELL_CALLOUT_AI_GENERATE_LONGER}),title:(0,n.jsx)(h.cC,{id:"265FwR"}),subtitle:(0,n.jsx)(h.cC,{id:"kaOsNu",values:{0:I.Jv.toLocaleString()}}),cta:(0,n.jsx)(h.cC,{id:"kwkhPe"})}):(0,n.jsx)(_,{isWarning:!0,title:(0,n.jsx)(h.cC,{id:"mWVxkj"}),subtitle:(0,n.jsx)(h.cC,{id:"qTSTz6",values:{0:I.Jv.toLocaleString()}})})});T.displayName="MaxTokensUpsellWarning";let O=(0,m.memo)(()=>{let e=(0,d.CG)(o.CC),[t]=(0,g.Ns)("editorMode"),{maxCards:i,canUpgrade:r}=(0,j.hw)(),{openUpsellModal:s}=(0,S.z)();return!e||e<i||e===i&&"structured"===t?null:"freeform"===t&&e>=i&&r?(0,n.jsx)(_,{product:"pro",onClick:()=>s({segmentEvent:E.AA.GAMMA_UPSELL_CALLOUT_AI_GENERATE_LONGER}),title:(0,n.jsx)(h.cC,{id:"6/00Zu",values:{MAX_CARDS_PRO:j.Fv}}),cta:(0,n.jsx)(h.cC,{id:"kwkhPe"})}):"freeform"===t?null:r?(0,n.jsx)(_,{product:"pro",isWarning:!0,onClick:()=>s({segmentEvent:E.AA.GAMMA_UPSELL_CALLOUT_AI_GENERATE_LONGER}),title:(0,n.jsx)(h.cC,{id:"dHdJAv",values:{maxCards:i}}),subtitle:(0,n.jsx)(h.cC,{id:"c4NYWT",values:{MAX_CARDS_PRO:j.Fv}}),cta:(0,n.jsx)(h.cC,{id:"kwkhPe"})}):(0,n.jsx)(_,{isWarning:!0,title:(0,n.jsx)(h.cC,{id:"dHdJAv",values:{maxCards:i}}),subtitle:(0,n.jsx)(h.cC,{id:"yLG7qf"})})});O.displayName="CardCountUpsellWarning";var P=i(41004);let D=(0,P.E)(s.k),R=(0,m.memo)(e=>{let{children:t}=e;return(0,n.jsx)(D,{bg:"white",py:3,position:"fixed",zIndex:"10",initial:{opacity:0,bottom:-10},animate:{opacity:1,bottom:0},exit:{opacity:0,bottom:0},borderTop:"1px solid",borderColor:"blackAlpha.200",px:{base:3,md:4},direction:"column",align:"center",w:"100%",children:t})});R.displayName="StickyBottomBar";let G=e=>{let{cta:t}=e,i=(0,d.CG)(o.Vn),u=(0,d.CG)(o.$X);if(u)return null;let x=(0,n.jsx)(a.r,{modalId:"ai-credits-modal-generate-v2",variant:"ghost",justify:"flex-end",segmentEvent:c.AA.GAMMA_UPSELL_CALLOUT_AI_CREDITS_GENERATE_V2,alignSelf:"center"});return(0,n.jsx)(R,{children:(0,n.jsxs)(r.K,{w:"100%",direction:{base:"column-reverse",md:"row"},spacing:{base:2,md:4},alignItems:{base:"center",md:"flex-end"},children:[(0,n.jsx)(s.k,{flex:"1",children:x}),(0,n.jsxs)(r.K,{w:"2xl",maxW:"100%",overflow:"hidden",children:[(0,n.jsx)(A,{}),(0,n.jsx)(O,{}),(0,n.jsx)(T,{}),(0,n.jsxs)(l.U,{spacing:{base:2,md:3},opacity:i?.75:1,pointerEvents:i?"none":"inherit",cursor:i?"not-allowed":"default",children:[(0,n.jsx)(f,{size:{base:"md",lg:"lg"}}),(0,n.jsx)(s.k,{flex:"1",alignItems:"stretch",flexDirection:"column",children:t})]})]}),(0,n.jsx)(s.k,{flex:"1",display:{base:"none",md:"flex"}})]})})}},45760:function(e,t,i){"use strict";i.d(t,{jX:function(){return o},vZ:function(){return l}});var n=i(52322),r=i(2784);let s=r.createContext({});function l(){let e=(0,r.useContext)(s);return e}let o=e=>{let{children:t}=e,i=r.useRef();return(0,n.jsx)(s.Provider,{value:{setEditorInstance:e=>{i.current=e},getEditorInstance:()=>i.current},children:t})}},7208:function(e,t,i){"use strict";i.d(t,{N:function(){return E}});var n=i(52322),r=i(70065),s=i(43297),l=i(28535),o=i(77533),a=i(75768),d=i(62614),c=i(54933),u=i(49929),x=i(87254),h=i(2784),m=i(36528),p=i(54691),g=i(31490),j=i(91994),f=i(6997);let v="\n{{input}}\n\n###\n\nThe text above contains the outline for my presentation. Find the lines that should be slide breaks.\n\nIf the text I give you contains clear slide numbering, always use that to split it up.\nOtherwise, if there are clear section headings, use those.\nIf there is no obvious break, use your best judgement to split the content into slides by subject matter.\n\nRespond with a list of line numbers that represent the start of a new slide. Each line number should be on its own line without the ".concat(">>>"," symbol. For example,\n1\n4\n18\n").trim(),C=new f.u({params:{temperature:.5,model:"gpt-3.5-turbo"},variables:["input"],systemPrompt:"\nI am a slide designer who will be turning a presentation outline into a slide deck. I need your help identifying where the slide boundaries are in the presentation. Respond only with line numbers, each number on its own line.\n".trim(),userPrompt:v});var b=i(76282),y=i(74153);let k=e=>{let t=e.split("\n"),i=1;return t.map(e=>""===e.trim()?e:"".concat(i++).concat(">>>").concat(e)).join("\n")},w=(e,t)=>(t.forEach(t=>{e=e.replace("".concat(t).concat(">>>"),"---\n\n".concat(t).concat(">>>"))}),e),S=e=>{let t=e.split("\n");return t.map(e=>{let t=e.split(">>>");return t.length>1?t[1]:e}).join("\n")},E=()=>{let[e,t]=(0,h.useState)(!1),[i,f]=(0,y.Ns)("editorMode"),v=(0,y.vS)(),E=(0,j.CG)(b.Kd),I=(0,j.CG)(b.MH),_=(0,r.p)(),A=(0,h.useRef)(null),T=(0,j.CG)(b.Vn);(0,h.useEffect)(()=>{T&&A.current&&(_.close(A.current),A.current=null)},[_,T]);let O=(0,h.useCallback)(()=>{let e=(0,j.bh)().getState(),t=(0,b.au)(e),i=t.replace(/\n\n---\n\n/g,"\n\n");v(i);let r=x.ag._({id:"a7V4Kp"}),h=x.ag._({id:"jpA4hO"}),m=x.ag._({id:"9uI/rE"}),p=x.ag._({id:"DPfwMq"}),g=_({render:()=>(0,n.jsxs)(s.K,{p:4,shadow:"lg",borderRadius:"lg",bg:"green.100",spacing:4,direction:{base:"column",md:"row"},children:[(0,n.jsx)(l.xu,{color:"green.600",fontSize:"xl",children:(0,n.jsx)(u.G,{icon:c.fV7})}),(0,n.jsxs)(l.xu,{children:[(0,n.jsx)(o.x,{noOfLines:1,fontWeight:"600",children:r}),(0,n.jsx)(o.x,{fontSize:"xs",noOfLines:1,color:"blackAlpha.800",children:h})]}),(0,n.jsxs)(a.h,{children:[(0,n.jsx)(d.z,{size:"md",variant:"solid",onClick:()=>_.close(g),rightIcon:(0,n.jsx)(u.G,{icon:c.LEp}),children:p}),(0,n.jsx)(d.z,{size:"md",colorScheme:"gray",variant:"ghost",onClick:()=>{v(t),_.close(g)}
1,children:m})]})]}),status:"success",duration:5e3,position:"top",containerStyle:{maxW:"none"}})},[v,_]),P=(0,h.useCallback)(async e=>{let r=(0,g.nZ)(),h=k(e),j=C.prepare({variables:{input:h},interactionId:r}),b=x.ag._({id:"P0CwEw"}),y=_({title:b,status:"loading",duration:1e4,position:"top"}),E=await (0,m.oO)(j),I=await (0,p.I)(E,r,{retries:0});if(!I)throw Error("Response is undefined");let A=I.split("\n").map(e=>parseInt(e)),T=S(w(h,A));console.debug("Splitting cards",{numberedContent:h,resp:I,lineBreaks:A,newContent:T}),_.close(y),v(T),f("structured"),t(!1);let O=x.ag._({id:"0+Fg4H"}),P=x.ag._({id:"YbORTh"}),D=x.ag._({id:"9uI/rE"}),R=x.ag._({id:"DPfwMq"}),G=_({render:()=>(0,n.jsxs)(s.K,{p:4,shadow:"lg",borderRadius:"lg",bg:"green.100",spacing:4,direction:{base:"column",md:"row"},children:[(0,n.jsx)(l.xu,{color:"green.600",fontSize:"xl",children:(0,n.jsx)(u.G,{icon:c.fV7})}),(0,n.jsxs)(l.xu,{children:[(0,n.jsx)(o.x,{noOfLines:1,fontWeight:"600",children:O}),(0,n.jsx)(o.x,{fontSize:"xs",noOfLines:1,color:"blackAlpha.800",children:P})]}),(0,n.jsxs)(a.h,{children:[(0,n.jsx)(d.z,{size:"md",variant:"solid",onClick:()=>_.close(G),rightIcon:(0,n.jsx)(u.G,{icon:c.LEp}),children:R}),(0,n.jsx)(d.z,{size:"md",colorScheme:"gray",variant:"ghost",onClick:()=>{v(e),f(i),_.close(G)},children:D})]})]}),status:"success",duration:5e3,position:"top",containerStyle:{maxW:"none"}})},[i,v,f,_]),D=(0,h.useCallback)(()=>{let e=(0,j.bh)().getState();A.current&&(_.close(A.current),A.current=null);let i=(0,b.Kd)(e);if(!i)return;let r=(0,b.au)(e),c=x.ag._({id:"CObmXw"}),u=x.ag._({id:"+JxrYy"}),h=x.ag._({id:"goXuxS"}),m=x.ag._({id:"6Uau97"});A.current=_({render:()=>(0,n.jsxs)(s.K,{p:4,shadow:"lg",borderRadius:"lg",bg:"trueblue.100",spacing:4,direction:{base:"column",md:"row"},children:[(0,n.jsxs)(l.xu,{children:[(0,n.jsx)(o.x,{noOfLines:1,fontWeight:"600",children:c}),(0,n.jsx)(o.x,{fontSize:"xs",noOfLines:1,color:"blackAlpha.800",children:u})]}),(0,n.jsxs)(a.h,{children:[(0,n.jsx)(d.z,{variant:"solid",size:"md",onClick:()=>{P(r),t(!0),_.close(A.current)},children:h}),(0,n.jsx)(d.z,{variant:"plain",size:"md",onClick:()=>{_.close(A.current)},children:m})]})]}),status:"info",duration:8e3,position:"top"})},[P,_]);return(0,h.useEffect)(()=>()=>{A.current&&(_.close(A.current),A.current=null)},[_]),{addSectionBreaks:P,isAddingBreaks:e,canAddBreaks:E,canRemoveBreaks:I,removeSectionBreaks:O,onChangeMode:D}}},74153:function(e,t,i){"use strict";i.d(t,{Ns:function(){return g},Q_:function(){return p},ex:function(){return h},ip:function(){return m},o7:function(){return x},vS:function(){return j}});var n=i(2784),r=i(45760),s=i(93202),l=i(91994),o=i(86581),a=i(33522),d=i(24551),c=i(14874),u=i(76282);let x=()=>{let e=(0,l.qr)(),t=(0,l.TL)(),[i]=(0,s.NCT)(),r=(0,n.useCallback)(async()=>{var n;let r=(0,u.d_)(e.getState()),s=r.id,l=await i({variables:{docGenerateInputId:s,input:{}}}),o=null===(n=l.data)||void 0===n?void 0:n.updateDocGenerationDraftInput;o&&o.draftInput&&s!==o.draftInput.id&&t((0,u.Gn)(o))},[t,e,i]);return r},h=e=>{var t;let i=(0,l.qr)(),r=(0,l.TL)(),[o]=(0,s.NCT)(),d=(0,n.useCallback)(async e=>{var t;let n=(0,u.RB)(i.getState()),s=(0,u.U6)(i.getState());if(!n||!s)return;let{format:l,...a}=e,d={format:l,...a},c=(0,u.br)(i.getState());d.settings&&(d.settings={...c,...d.settings});let x=(0,u.U6)(i.getState()),h=await o({variables:{docGenerateInputId:s,input:d}}),m=null===(t=h.data)||void 0===t?void 0:t.updateDocGenerationDraftInput;m&&m.draftInput&&x!==m.draftInput.id&&r((0,u.Gn)(m))},[r,i,o]),c=(0,a.Kt)(d,null!==(t=null==e?void 0:e.debounce)&&void 0!==t?t:0),x=(0,n.useCallback)(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];r((0,u.Zx)(e)),t&&c(e)},[c,r]);return x},m=()=>{let e=h(),t=(0,n.useCallback)(function(t){let i=!(arguments.length>1)||void 0===arguments[1]||arguments[1];e({format:t},i)},[e]),i=(0,l.CG)(u.Lh);return[i,t]},p=()=>{let e=h({debounce:500}),t=(0,n.useCallback)(function(t){let i=!(arguments.length>1)||void 0===arguments[1]||arguments[1];e({prompt:t},i)},[e]),i=(0,l.CG)(u.lb);return[i,t]},g=(e,t)=>{let i=h(t),r=(0,n.useCallback)(function(t){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];i({settings:{[e]:t}},n)},[e,i]),s=(0,l.CG)((0,u.Mn)(e));return[s,r]},j=e=>{let t=h(e),{getEditorInstance:i}=(0,r.vZ)(),s=(0,n.useCallback)(function(e){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=i();if(r){let t=r.editorId===d.C,i=(0,o.c8)(e),n=(0,c.dW)(i,t?"structured":"freeform").content.toJSON();r.commands.setContent(n)}t({content:e},n)},[t,i]);return s}},96796:function(e,t,i){"use strict";i.d(t,{R:function(){return v},d:function(){return f}});var n=i(5632),r=i(2784),s=i(63304),l=i(67496),o=i(28918),a=i(31490),d=i(39122),c=i(93202),u=i(42111),x=i(21733),h=i(50634),m=i(45302);let p=e=>{if(!e)throw Error("Response is undefined");let t=v(e),i=(0,m.jw)(t.locale);
1return{settings:{tone:t.tone,audience:t.audience,locale:i.key,textAmount:g(t.text_amount,["sm","md","lg"],"md")}}},g=(e,t,i)=>e?t&&!t.includes(e)?i:e:void 0,j=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=new URLSearchParams("");return t.generateOutline&&i.append(l.nx,"1"),t.generateSettings&&i.append(l.Cb,"1"),"/generate/".concat(e,"?").concat(i.toString())},f=()=>{let{push:e}=(0,n.useRouter)(),[t,i]=(0,r.useState)(!1),[l]=(0,c.JBp)(),{generate:m}=(0,h.j)("DetermineGenerateSettings",{}),g=(0,r.useCallback)(async(t,n)=>{var r;let c=(0,a.nZ)();i(!0);let h=(0,o.d)(n.content,d.VN),g=await m({variables:{input:h},workspaceId:(0,x.n_)(),interactionId:c}).promise,f=p(g),{settings:v,format:C,...b}=n,y=await l({variables:{input:{workspaceId:(0,x.n_)(),generationType:t,input:{interactionId:c,settings:{...s.zJ,imageProvider:u.VH.get("aiGeneratorDefaultImageProvider"),...f.settings,...v},...b,format:C}}}});i(!1),e(j(null===(r=y.data)||void 0===r?void 0:r.createDocGeneration.id))},[l,e]);return{guessSettings:g,isLoading:t}},v=e=>{let t=e.split("\n"),i={};return t.forEach(e=>{let[t,n]=e.split(": ");t&&n&&(i[t.trim().toLowerCase()]=n.trim())}),i}},67496:function(e,t,i){"use strict";i.d(t,{Cb:function(){return x},HL:function(){return h},nx:function(){return u}});var n=i(9850),r=i.n(n),s=i(5632),l=i(2784),o=i(76282),a=i(93202),d=i(91994),c=i(704);let u="generateOutline",x="generateSettings",h=e=>{let{id:t}=e,i=(0,s.useRouter)(),n=(0,d.TL)(),r=(0,d.qr)(),{goToScreen:u}=(0,c.R)(),[x,h]=(0,l.useState)(!0),[p]=(0,a.UCC)({variables:{id:t}});return(0,l.useEffect)(()=>{i&&r&&p&&p().then(e=>{let{data:t}=e;if(null==t?void 0:t.docGeneration)return t.docGeneration;throw Error("Could not load docGeneration")}).then(e=>{n((0,o.Gn)(m(e))),h(!1)}).catch(()=>{u("createWithAI")})},[n,p,u,i,r]),{isLoading:x}},m=e=>({...e,docGenerateInputs:e.docGenerateInputs.map(p),draftInput:e.draftInput?p(e.draftInput):void 0}),p=e=>{let t=r()(e);return t.settings.textMode||(t.settings.preserveText?t.settings.textMode="preserve":t.settings.textMode="generate",delete t.settings.preserveText),t}},1071:function(e,t,i){"use strict";i.d(t,{Jv:function(){return r},ml:function(){return s}});var n=i(57124);let r=1e4,s=()=>{let e=(0,n.Y)("ai_premium_models");return{maxTokens:e?r:5e3,canUpgrade:!e}}},49165:function(e,t,i){"use strict";i.d(t,{R:function(){return p},c:function(){return g}});var n=i(52322),r=i(70065),s=i(5879),l=i(5632),o=i(2784),a=i(93202),d=i(42111),c=i(84405),u=i(87978),x=i(41425),h=i(23147),m=i(36651);let p={example_deck_clone_toast:a.L17.DuplicateInspiration,import_google_doc:a.L17.ImportGoogleDoc,import_google_slides:a.L17.ImportGoogleSlides,import_docx:a.L17.ImportDocx,import_pptx:a.L17.ImportPptx,blank:a.L17.Blank,template_browser:a.L17.DuplicateTemplate,get_started_modal:a.L17.Blank,template_modal_griditem:a.L17.DuplicateTemplate,template_dashboard_griditem:a.L17.DuplicateTemplate,template_modal_preview:a.L17.DuplicateTemplate,template_modal_preview_create_theme:a.L17.DuplicateTemplate,"slash-new":a.L17.SlashNew,editor_toolbar_doc_menu_duplicate:a.L17.DuplicateDoc,dashboard_docs_view_duplicate:a.L17.DuplicateDoc,ai_generated:a.L17.AiGenerated,ai_generated_advanced:a.L17.AiGenerated,sites_add_page:a.L17.SitesAddPage,sites_copy_to_site:a.L17.SitesCopyToSite},g=()=>{let{user:e,currentWorkspace:t}=(0,m.SE)(),i=(0,d.ye)("cardLayoutsEnabled"),[g,{data:j,loading:f}]=(0,a.CsQ)(),{push:v,replace:C}=(0,l.useRouter)(),b=(0,r.p)(),y=(0,o.useCallback)(r=>{var l;let o=null==e?void 0:null===(l=e.settings)||void 0===l?void 0:l.needsEditorOnboarding,a=r.source,d=null==r?void 0:r.channelId,m=(null==r?void 0:r.historyFn)==="replace"?C:v,j=o?"quickstart":"empty";if(!(null==t?void 0:t.id)){console.error("[createDocAndNavigate] No currentWorkspace found");return}let f={cardLayoutsEnabled:i},y=(null==r?void 0:r.document)?r.document:"empty"===j?(0,u.bx)(e,{docFlags:f}):(0,u.VK)(e,{docFlags:f}),k=(0,h.qI)(y);return console.debug("[createDocAndNavigate] Creating doc",{document:y,encodedDocument:k}),g({variables:{workspaceId:null==t?void 0:t.id,title:(null==r?void 0:r.title)||"",source:p[r.source],initialContent:{ydoc:k,schemaVersion:x.bI,editors:[null==e?void 0:e.id]},...d?{channels:[{channelId:d}]}:{}}}).then(async e=>{let{data:t}=e;(0,c.Q)({doc_id:null==t?void 0:t.createDoc.id,source:a,channel:d||null}),console.debug("[createDocAndNavigate] Doc created. Navigating to Editor",null==t?void 0:t.createDoc.id),m("/docs/".concat(null==t?void 0:t.createDoc.id).concat(o?"?tour=true":""))}).catch(e=>{console.error("[createDocAndNavigate]",e),b({title:(0,n.jsx)(s.cC,{id:"0jT1fA"}),description:e.message,position:"top",status:"error",isClosable:!0,duration:null})})},[i,g,null==t?void 0:t.id,v,C,b,e]);return[y,{data:j,loading:f}]}},6912:function(e,t,i){"use strict";i.d(t,{S1:function(){return C},B_:function(){return k},ET:function(){return b}});var n=i(2784),r=i(14274),s=i(88232),l=i(42111),o=i(49152),a=i(44663),d=i(1163),c=i(11050),u=i(90221),x=i(23284),h=i(90383),m=i(87254),p=i(82108),g=i.n(p),j=i(94199);let f=(e,t)=>{let i=g()(t);
1return{[e]:{next:m.ag._({id:"hXzOVo"}),back:m.ag._({id:"iH8pgl"}),nevermind:m.ag._({id:"CKyk7Q"}),goToAccount:m.ag._({id:"C9yTHG",values:{GAMMA_PROPER_NOUN:j.N6}}),getHelp:m.ag._({id:"pWsyuL"}),declineOffer:m.ag._({id:"aIFikE"}),confirmAndCancel:m.ag._({id:"G9nPRC"}),pauseSubscription:m.ag._({id:"2RgEmU"}),cancelSubscription:m.ag._({id:"dEgA5A"}),discountSubscription:m.ag._({id:"qG4Wa/"}),claimOffer:m.ag._({id:"/Gl/RK"}),discountOff:m.ag._({id:"Bdtwnw"}),discountFor:m.ag._({id:"sQv06Y"}),discountForever:m.ag._({id:"FsOOWf"}),discountOneTime:m.ag._({id:"HpXCa4"}),day:m.ag._({id:"5YWExy"}),month:m.ag._({id:"obrMay"}),year:m.ag._({id:"/Tw548"}),error:m.ag._({id:"wTrpxV"}),genericErrorDescription:m.ag._({id:"PUjJ3A"}),cancelNow:m.ag._({id:"EiakwV"}),applyingDiscount:m.ag._({id:"8kSYjw"}),applyingCancel:m.ag._({id:"VpuvNv"}),applyingResume:m.ag._({id:"eIoGiX"}),applyingPause:m.ag._({id:"UD7gOq"}),discountApplied:m.ag._({id:"jdYyiz"}),discountAppliedMessage:m.ag._({id:"DhHX6G"}),pauseApplied:m.ag._({id:"eeITvj"}),pauseAppliedMessage:m.ag._({id:"nm0VaE"}),pauseAppliedResumeMessage:m.ag._({id:"qOe0SS"}),pauseScheduledMessage:m.ag._({id:"mqRc6d"}),until:m.ag._({id:"C51N+0"}),cancelApplied:m.ag._({id:"Wcg6zu"}),cancelAppliedMessage:m.ag._({id:"8vN97Y"}),cancelAppliedDateMessage:m.ag._({id:"BS/SGu"}),howLongToPausePrompt:m.ag._({id:"HLyJ9n"}),whatCouldWeHaveDone:m.ag._({id:"fcbm8H"}),weReadEveryAnswer:m.ag._({id:"nkuKRd"}),applyingCustomerAction:m.ag._({id:"PXwF+s"}),loading:m.ag._({id:"Z3FXyt"}),pauseWallCardPunch:m.ag._({id:"iL2TQ6"}),pauseWallCta:m.ag._({id:"TvXj47"}),pauseWallCardHeading:m.ag._({id:"kHm8Fg"}),scheduledToReactivate:m.ag._({id:"aH7vi8"}),resumeApplied:m.ag._({id:"diOgYK"}),resumeAppliedMessage:m.ag._({id:"YqFvUY"}),resumeNextChargeMessage:m.ag._({id:"VDqPUf"}),resumeNextChargeMessageWithoutAmount:m.ag._({id:"RrvVAn"}),resumeAccountDataInfo:m.ag._({id:"dJCJXA"}),subscriptionPauseNotice:m.ag._({id:"fpxliT"}),failedPaymentNotice:m.ag._({id:"Vxg5vO"}),chargedMultipleTimeNotice:m.ag._({id:"lAlv46"}),failedPaymentCardPunch:m.ag._({id:"KEZrHg",values:{GAMMA_PROPER_NOUN:j.N6,productName:i}}),resumeHey:m.ag._({id:"hdOctW"}),invoicePaidTitle:m.ag._({id:"aJGfDL"}),logout:m.ag._({id:"W+3RJN"}),note:m.ag._({id:"ycCSuD"}),discount:m.ag._({id:"HmpVeZ"}),discountNoticeHeadline:m.ag._({id:"5P1dmt"}),discountNoticePrepend:m.ag._({id:"yjadEY"}),discountOverride:m.ag._({id:"JfBDWL"}),discountValidUntil:m.ag._({id:"uXxNua"}),updateBilling:m.ag._({id:"tQilrI"}),extendTrialCTA:m.ag._({id:"m3l7VI"}),extendTrialPunch:m.ag._({id:"s5pINo"}),extendTrialOfferTitle:m.ag._({id:"SyzXYh"}),trialExtended:m.ag._({id:"fezME2"}),trialExtendedMessage:m.ag._({id:"QE4mUs"}),applyingTrialExtension:m.ag._({id:"vI2q9R"}),switchPlanCTA:m.ag._({id:"P2mx2L"}),changePlanHighlights:m.ag._({id:"qbgW+C"}),changePlanOfferPunch:m.ag._({id:"MRkiFP"}),planChanged:m.ag._({id:"ByFtyh"}),planChangedMessage:m.ag._({id:"Pf5z1G"}),applyingPlanChange:m.ag._({id:"9vKKLI"}),surveyStepTag:m.ag._({id:"cSUBI1"}),freeFormStepTag:m.ag._({id:"cSUBI1"}),finalConfirmation:m.ag._({id:"1/oP/N"}),offerDiscountTag:m.ag._({id:"LTgtxG"}),offerChangePlanTag:m.ag._({id:"ENMJv2"}),offerExtendTrialTag:m.ag._({id:"MWKntz"}),offerRedirectTag:m.ag._({id:"cvpAvL"}),offerContactTag:m.ag._({id:"cvpAvL"}),offerPauseTag:m.ag._({id:"+T6DGl"}),completeTag:m.ag._({id:"K5c1e7"}),errorTag:m.ag._({id:"EuvbIW"}),offerAccepted:m.ag._({id:"ZU0opP"})}}},v="\n!function(){ \n if (!window.churnkey || !window.churnkey.created) {\n window.churnkey = { created: true };\n const a = document.createElement('script');\n a.src = 'https://assets.churnkey.co/js/app.js?appId=".concat(r.v.CHURNKEY_APP_ID,"';\n a.async = true;\n const b = document.getElementsByTagName('script')[0];\n b.parentNode.insertBefore(a, b);\n }\n }();\n"),C=()=>{let e=!(0,u.l6)()&&!(0,h.wg)();return(0,x.G)(e,v),null},b=e=>{let{subscription:t,workspace:i,autoLaunch:c=!0}=e,u=(0,l.ye)("churnkeyFailedPaymentWallEnabled"),x=(0,o.l)(),h=(0,d.K9)(i),m=(0,a.G)(),p=(0,n.useCallback)(async()=>{if(t&&h&&u)return(0,s.d6)("churnkey").then(e=>{var i,n;if(!e||!t.billingSubscriptionId||!(null===(i=t.createdByUser)||void 0===i?void 0:i.billingCustomerId)){console.error("[Churnkey] launchFailedPayment Missing hmac or subscription data",{hmac:e,subscription:t});return}console.debug("[Churnkey] launchFailedPayment - launching churnkey with:",{hmac:e,appId:r.v.CHURNKEY_APP_ID,subscriptionId:t.billingSubscriptionId,customerId:null===(n=t.createdByUser)||void 0===n?void 0:n.billingCustomerId}),y({authHash:e,subscription:t,localeKey:x,productKey:h,launchIntercomUI:m})})},[t,h,u,x,m]);return(0,n.useEffect)(()=>{c&&p()},[p,c]),{launchFailedPaymentFlow:p,failedPaymentFlowEnabled:u}},y=async e=>{var t,i;let{authHash:n,subscription:s,localeKey:l,productKey:o,launchIntercomUI:a}=e;null===(i=window.churnkey)||void 0===i||i.check("failed-payment",{subscriptionId:s.billingSubscriptionId,customerId:null===(t=s.createdByUser)||void 0===t?void 0:t.billingCustomerId,authHash:n,customerAttributes:{language:l},i18n:{lang:l,messages:f(l,o)},appId:r.v.CHURNKEY_APP_ID,mode:r.v.CHURNKEY_MODE,provider:"stripe",softWall:!0,forceCheck:!1,gracePeriodDays:3,ignoreInvoicesWithoutAttempt:!1,handleSupportRequest
1(){var e;a(),c.co.track(c.AA.CHURNKEY_HANDLE_SUPPORT_CLICK,{source:"failed-payment-wall",subscriptionId:s.billingSubscriptionId,customerId:null===(e=s.createdByUser)||void 0===e?void 0:e.billingCustomerId})},async handleCancel(e){var t,i;return c.co.track(c.AA.CANCEL_SUBSCRIPTION_CLICK,{source:"failed-payment-wall",subscriptionId:s.billingSubscriptionId,customerId:null===(t=s.createdByUser)||void 0===t?void 0:t.billingCustomerId}),console.debug("[launchChurnkeyFailedPayment.handleCancel]",{subscriptionId:s.billingSubscriptionId,customerId:null===(i=s.createdByUser)||void 0===i?void 0:i.billingCustomerId,customer:e}),w({authHash:n,subscription:s,localeKey:l,productKey:o,launchIntercomUI:a,customerAttributes:{viaFailedPayment:!0}}).catch(e=>y({authHash:n,subscription:s,localeKey:l,productKey:o,launchIntercomUI:a}))},onFailedPaymentWallActivated(){var e;c.co.track(c.AA.CHURNKEY_FAILED_PAYMENT_WALL_SHOWN,{subscriptionId:s.billingSubscriptionId,customerId:null===(e=s.createdByUser)||void 0===e?void 0:e.billingCustomerId})},onUpdatePaymentInformation(){var e;c.co.track(c.AA.CHURNKEY_PAYMENT_METHOD_UPDATED,{source:"failed-payment-wall",subscriptionId:s.billingSubscriptionId,customerId:null===(e=s.createdByUser)||void 0===e?void 0:e.billingCustomerId})},onFailedPaymentWallClose(){var e;c.co.track(c.AA.CHURNKEY_FAILED_PAYMENT_WALL_CLOSED,{subscriptionId:s.billingSubscriptionId,customerId:null===(e=s.createdByUser)||void 0===e?void 0:e.billingCustomerId})},onCancel(){var e;c.co.track(c.AA.CHURNKEY_CANCEL_SUBSCRIPTION_COMPLETE,{source:"failed-payment-wall",subscriptionId:s.billingSubscriptionId,customerId:null===(e=s.createdByUser)||void 0===e?void 0:e.billingCustomerId})},onError(e,t){console.warn('Churnkey check("failed-payment", ...) error',e,t)}})},k=(e,t)=>{let i=(0,l.ye)("churnkeyCancelFlowEnabled"),r=(0,o.l)(),c=(0,d.K9)(t),u=(0,a.G)(),x=(0,n.useCallback)(()=>{if(e&&c&&i)return(0,s.d6)("churnkey").then(t=>{var i;if(!t||!e.billingSubscriptionId||!(null===(i=e.createdByUser)||void 0===i?void 0:i.billingCustomerId)){console.debug("[Churnkey] handleCancel - Missing hmac or subscription data",{hmac:t,subscription:e});return}return w({authHash:t,subscription:e,localeKey:r,productKey:c,launchIntercomUI:u})})},[i,r,c,e,u]);return{launchCancelFlow:x,cancelFlowEnabled:i}},w=async e=>{let{authHash:t,subscription:i,localeKey:n,productKey:s,customerAttributes:l={},launchIntercomUI:o}=e;return new Promise((e,a)=>{var u,x,h;null===(h=window.churnkey)||void 0===h||h.init("show",{subscriptionId:i.billingSubscriptionId,customerId:null===(u=i.createdByUser)||void 0===u?void 0:u.billingCustomerId,authHash:t,customerAttributes:{language:n,frequency:null===(x=(0,d.OJ)(i))||void 0===x?void 0:x.frequencyUnit,productKey:s,...l},i18n:{lang:n,messages:f(n,s)},appId:r.v.CHURNKEY_APP_ID,mode:r.v.CHURNKEY_MODE,provider:"stripe",record:!0,handleSupportRequest(){var e;o(),c.co.track(c.AA.CHURNKEY_HANDLE_SUPPORT_CLICK,{source:"cancel-flow",subscriptionId:i.billingSubscriptionId,customerId:null===(e=i.createdByUser)||void 0===e?void 0:e.billingCustomerId})},onCancel(e,t,n){var r;c.co.track(c.AA.CHURNKEY_CANCEL_SUBSCRIPTION_COMPLETE,{source:"cancel-flow",subscriptionId:i.billingSubscriptionId,customerId:null===(r=i.createdByUser)||void 0===r?void 0:r.billingCustomerId,surveyResponse:t,freeformFeedback:n}),console.debug("[launchChurnkeyCancelFlow.onCancel]",{surveyResponse:t,freeformFeedback:n})},onGoToAccount(t){console.debug("[launchChurnkeyCancelFlow.onGoToAccount]",{sessionResults:t}),e({sessionResults:t})},onClose(t){if(console.debug("[launchChurnkeyCancelFlow.onClose]",{sessionResults:t}),!t||t.aborted){a("Churnkey cancel flow aborted");return}e({sessionResults:t})},onError(e){console.warn("[launchChurnkeyCancelFlow.onError]",{message:e}),a({message:e})}})})}},12985:function(e,t,i){"use strict";i.d(t,{B:function(){return r}});var n=i(2784);let r=n.lazy(()=>Promise.all([i.e(8917),i.e(7120),i.e(4100),i.e(3421)]).then(i.bind(i,23421)).then(e=>({default:e.default})))},85747:function(e,t,i){"use strict";i.d(t,{E:function(){return o}});var n=i(52322),r=i(2784),s=i(99787);let l={width:"0.1px",height:"0.1px",opacity:0,overflow:"hidden",position:"absolute",zIndex:-1},o=e=>{let{handleFilesCallback:t,multiple:i=!1,accept:o=s.pK.join(",")}=e,a=(0,r.useRef)(null),d=(0,r.useMemo)(()=>(0,n.jsx)("input",{ref:a,className:"gamma-FileInput-input",style:l,type:"file",name:"gamma-file-input",multiple:i,accept:o,onChange:e=>{let i=e.target;if(!i||!i.files)return;let n=Array.from(i.files);t(n),i.value=null}}),[o,t,i]),c=(0,r.useCallback)(()=>{var e;null===(e=a.current)||void 0===e||e.click()},[]);return{inputElement:d,onClick:c}}},62700:function(e,t,i){"use strict";i.d(t,{d:function(){return s}});var n=i(52322),r=i(5879);let s=()=>({100:(0,n.jsx)(r.cC,{id:"RGjFMI"}),200:(0,n.jsx)(r.cC,{id:"GMGHcE"}),300:(0,n.jsx)(r.cC,{id:"1njn7W"}),400:(0,n.jsx)(r.cC,{id:"xfqlmg"}),500:(0,n.jsx)(r.cC,{id:"agPptk"}),600:(0,n.jsx)(r.cC,{id:"KVGfPY"}),700:(0,n.jsx)(r.cC,{id:"KmydK6"}),800:(0,n.jsx)(r.cC,{id:"NV46Ki"}),900:(0,n.jsx)(r.cC,{id:"THokF3"})})},30423:function(e,t,i){"use strict";i.d(t,{Av:function(){return g},B_:function(){return f},CZ:function(){return x},QP:function(){return v},Sd:function(){return C},UK:function(){return h},ZN:function(){return j},cC:function(){return p},x_:function(){return m},zn:function(){return c}});var n=i(18149),r=i.n(n),s=i(53553),l=i(93202);let o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=["italic","oblique"];for(let i of e)for(let e of t)if(-1!==i.toLowerCase().indexOf(e))return!0;return!1},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];for(let t of e){if(d(t,["thin"]))return 100;if(d(t,["light","lite"],["extra","ultra","x"]))return 200;if(d(t,["light"]))return 300;if(d(t,["medium"]))return 500;if(d(t,["bold"],["demi","semi"]))return 600;if(d(t,["bold"],["extra","x"]))return 800;if(d(t,["bold"]))return 700;if(d(t,["black","heavy","ultra"]))return 900}return 400},d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(let n of t)if(0===i.length){if(-1!==e.toLowerCase().indexOf(n.toLowerCase()))return!0}else for(let t of i)if(-1!==e.toLowerCase().indexOf(n.toLowerCase())&&-1!==e.toLowerCase().indexOf(t.toLowerCase()))return!0;return!1},c=async e=>new Promise((t,i)=>{let n=new FileReader;n.onload=e=>{var n,r,l,d,c,u,x,h,m,p,g,j,f,v,C,b,y,k,w;let S=null===(n=e.target)||void 0===n?void 0:n.result;try{let e=s.ZP.parse(S),i=null!==(b=null===(r=Object.values(null!==(C=null===(d=e.tables)||void 0===d?void 0:null===(l=d.name)||void 0===l?void 0:l.preferredSubfamily)&&void 0!==C?C:null===(u=e.tables)||void 0===u?void 0:null===(c=u.name)||void 0===c?void 0:c.fontSubfam
1ily))||void 0===r?void 0:r[0])&&void 0!==b?b:"",n=null!==(y=null===(x=Object.values(null===(m=e.tables)||void 0===m?void 0:null===(h=m.name)||void 0===h?void 0:h.fullName))||void 0===x?void 0:x[0])&&void 0!==y?y:"",E=null!==(w=null===(p=Object.values(null!==(k=null===(j=e.tables)||void 0===j?void 0:null===(g=j.name)||void 0===g?void 0:g.preferredFamily)&&void 0!==k?k:null===(v=e.tables)||void 0===v?void 0:null===(f=v.name)||void 0===f?void 0:f.fontFamily))||void 0===p?void 0:p[0])&&void 0!==w?w:"";t({familyName:E,isItalic:o([i,n]),weight:a([i,n])})}catch(e){i(e)}},n.onerror=e=>{console.error("[parseFontFile] unable to read the font file, providing defaults",e),t({familyName:"",isItalic:!1,weight:400})},n.readAsArrayBuffer(e)}),u=e=>{let t=e.lastIndexOf(".");return -1===t||t===e.length-1?{name:e,extension:void 0}:{name:e.slice(0,t),extension:e.slice(t+1)}},x=e=>{let{extension:t}=u(e);return t===l.sA6.Otf||t===l.sA6.Ttf?t:l.sA6.Ttf},h=e=>{let{existingFont:t}=e;if(!t)return!0;let i={fontName:t.name,fontId:t.id,fontFiles:t.fontFiles.map(e=>({id:e.id,name:e.name,weight:e.weight,isItalic:e.isItalic,fileType:e.fileType,sourceUrl:e.sourceUrl}))},n={fontName:e.fontName,fontId:e.fontId,fontFiles:e.uploadFontFiles.map(e=>({id:e.fontFile.id,name:e.fontFile.name,weight:e.fontFile.weight,isItalic:e.fontFile.isItalic,fileType:e.fontFile.fileType,sourceUrl:e.fontFile.sourceUrl}))};return!r()(i,n)},m=e=>{let t=e.reduce((e,t)=>{let i=[t.weight,t.isItalic].join("__");return{...e,[i]:!0}},{});return Object.keys(t).length},p=e=>{let t=Object.values(e.reduce((e,t)=>{let i=t.fontFile,n=[i.weight,i.isItalic,i.fileType].join("__");return e[n]=e[n]||[],e[n].push(t),e},{})).reduce((e,t)=>{if(t.length>1)for(let i of t)e[i.uploadId]=!0;return e},{});return t},g=e=>e.reduce((e,t)=>{let i=t.fontFile.weight;return{...e,[i]:[...e[i]||[],t]}},{}),j=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return e.sort((e,i)=>t?Number(e)-Number(i):Number(i)-Number(e))},f=e=>j(Array.from(new Set(e.map(e=>e.weight)))),v=(e,t)=>
1{if(void 0===t)return;if(t>e[e.length-1])return e[e.length-1];let i=1/0,n=-1;for(let r=0;r<e.length;r++){let s=Math.abs(t-e[r]);if(s<i)i=s,n=r;else break}return e[n]},C=e=>!!e&&0!==e.length&&-1===e.findIndex(e=>!e.isItalic)},33022:function(e,t,i){"use strict";i.d(t,{C:function(){return f}});var n=i(52322),r=i(29117),s=i(5740),l=i(77533),o=i(28535),a=i(43297),d=i(74409),c=i(20437),u=i(74008),x=i(62614),h=i(42946),m=i(54933),p=i(49929),g=i(5879);i(2784);let j=e=>{let{label:t,shortcuts:i}=e;return(0,n.jsxs)(r.U,{children:[i.map((e,t)=>(0,n.jsx)(s.T,{padding:1,children:e},t)),(0,n.jsx)(l.x,{fontSize:"sm",fontWeight:"medium",whiteSpace:"nowrap",children:t})]})},f=e=>{let{onClose:t,showExitPresentMode:i=!0}=e;return(0,n.jsx)(o.xu,{children:(0,n.jsxs)(a.K,{spacing:6,children:[(0,n.jsxs)(a.K,{spacing:1,children:[(0,n.jsxs)(r.U,{color:"gray.500",children:[(0,n.jsx)(p.G,{icon:h.UFh})," ",(0,n.jsx)(d.X,{size:"xs",fontWeight:"normal",children:(0,n.jsx)(g.cC,{id:"h7MgpO"})})]}),(0,n.jsx)(d.X,{size:"md",children:(0,n.jsx)(g.cC,{id:"UodEcE"})})]}),(0,n.jsxs)(c.M,{spacing:3,columns:1,children:[(0,n.jsx)(j,{label:(0,n.jsx)(g.cC,{id:"9xCxY6"}),shortcuts:[(0,n.jsx)(p.G,{icon:m.acZ},"left"),(0,n.jsx)(p.G,{icon:m.eFW},"right")]}),i&&(0,n.jsx)(j,{label:(0,n.jsx)(g.cC,{id:"IkakN2"}),shortcuts:["Esc"]}),(0,n.jsx)(j,{label:(0,n.jsx)(g.cC,{id:"K0Oq/D"}),shortcuts:["R"]}),(0,n.jsx)(u.i,{borderColor:"gray.300"}),(0,n.jsx)(j,{label:(0,n.jsx)(g.cC,{id:"CgmvBu"}),shortcuts:["S"]}),(0,n.jsx)(j,{label:(0,n.jsx)(g.cC,{id:"/5i2oX"}),shortcuts:[(0,n.jsx)(p.G,{icon:m.FPD},"up"),(0,n.jsx)(p.G,{icon:m.r5q},"down")]}),(0,n.jsx)(j,{label:(0,n.jsx)(g.cC,{id:"rEj/lx"}),shortcuts:["Enter"]})]}),(0,n.jsx)(x.z,{size:"sm",variant:"solid",onClick:t,children:(0,n.jsx)(g.cC,{id:"76gPWk"})})]})},"coach-bar")}},26787:function(e,t,i){"use strict";i.d(t,{v:function(){return A}});var n=i(52322),r=i(43297),s=i(28535),l=i(77533),o=i(87651),a=i(29117),d=i(81540),c=i(42946),u=i(54933),x=i(49929),h=i(5879),m=i(16983),p=i(70065),g=i(82863),j=i(2784),f=i(14274),v=i(42111),C=i(36651),b=i(93441),y=i(23405),k=i(2090),w=i(85747);let S=e=>{let t=(0,p.p)(),{currentWorkspace:i}=(0,C.SE)(),[r,s]=(0,j.useState)(!1),[l,o]=(0,j.useState)(!1),a=(0,y.y)("pptImportV2"),d=(0,j.useCallback)(async(r,l)=>{let{isPPT:a,toastId:d}=l;(0,k.cT)(r,null==i?void 0:i.id,{onUploadComplete:async i=>{let{src:r,name:l}=i,c=await fetch(r).then(e=>e.text()),u=l.replace(/[.]html$/,"");e.onUploadComplete({html:c,filename:u,source:a?"PptxUpload":"DocxUpload",src:r}),t.update(d,{status:"success",title:(0,n.jsx)(h.cC,{id:"oMgC5V"}),duration:5e3,isClosable:!0}),o(!0),s(!1)},onUploadFailed(i){var r;t.update(d,{status:"error",title:(0,n.jsx)(h.cC,{id:"SlfejT"}),description:(0,n.jsx)(h.cC,{id:"lIW942"}),duration:5e3,isClosable:!0}),null===(r=e.onUploadFailed)||void 0===r||r.call(e,i),s(!1),o(!1)}},void 0,"importDoc",f.v.TRANSLOADIT_DOC_IMPORT_TEMPLATE_ID)},[null==i?void 0:i.id,e,t]),c=(0,j.useCallback)((r,l)=>{let{toastId:a}=l;(0,k.cT)(r,null==i?void 0:i.id,{onUploadComplete:async i=>{let{name:r,fullResults:l,src:d}=i,{convert_to_html:c,convert_to_pdf:u,pdf_to_images:x}=l,m=x.map(e=>({index:e.meta.thumb_index,width:e.meta.width,height:e.meta.height,url:e.ssl_url})),p=u[0].ssl_url,g=u[0].original_name||r.replace(/[.]x?html$/,""),j=c[0].ssl_url,f=await fetch(j).then(e=>e.text());e.onUploadComplete({html:f,filename:g,htmlUrl:j,src:d,source:"PptxUpload",thumbnails:m,pdfUrl:p,fileUrl:d}),t.update(a,{status:"success",title:(0,n.jsx)(h.cC,{id:"oMgC5V"}),duration:5e3,isClosable:!0}),o(!0),s(!1)},onUploadFailed(i){var r;t.update(a,{status:"error",title:(0,n.jsx)(h.cC,{id:"SlfejT"}),description:(0,n.jsx)(h.cC,{id:"lIW942"}),duration:5e3,isClosable:!0}),null===(r=e.onUploadFailed)||void 0===r||r.call(e,i),s(!1),o(!1)}},void 0,"importPpt",f.v.TRANSLOADIT_PPT_IMPORT_TEMPLATE_ID)},[null==i?void 0:i.id,e,t]),u=(0,j.useCallback)(async i=>{var r;null===(r=e.onUploadStarted)||void 0===r||r.call(e),s(!0);let l=i[0],o=k.eb.includes(l.type),u=t({id:"load-doc-toast-".concat(l.name),position:"top",duration:null,status:"loading",variant:"subtle",title:(0,n.jsx)(h.cC,{id:"hdsaJo"}),description:(0,n.jsx)(h.cC,{id:"HOoZAi"}),isClosable:!1});o&&a?c(l,{toastId:u}):d(l,{isPPT:o,toastId:u})},[e,a,t,d,c]),{onClick:x,inputElement:m}=(0,w.E)({handleFilesCallback:u,multiple:!1,accept:[...k.u0,...k.eb].join(",")});return{initiateDocUpload:x,hiddenInputElement:m,isUploading:r,handleDocUpload:u,isSuccess:l}},E="https://www.googleapis.com/auth/drive.file",I=e=>
1{let[t,i]=(0,j.useState)(!1),[r,s]=(0,j.useState)(),l=(0,p.p)(),{user:o}=(0,C.SE)(),[a,d]=(0,j.useState)(!1),[c,u]=(0,j.useState)(!1),{handleDocUpload:x}=S({onUploadComplete:e.onImportComplete}),m=(0,j.useCallback)((e,t,i,r)=>{let s="https://www.googleapis.com/drive/v3/files/".concat(t,"?fields=exportLinks");d(!0);let o=l({id:"load-doc-toast-".concat(t),position:"top",duration:null,status:"loading",variant:"subtle",title:(0,n.jsx)(h.cC,{id:"hdsaJo"}),description:(0,n.jsx)(h.cC,{id:"5VLwXq"}),isClosable:!1});fetch(s,{headers:{Authorization:"Bearer ".concat(e)}}).then(async e=>{if(200!==e.status){var t;let i=await e.json(),n=null==i?void 0:null===(t=i.error)||void 0===t?void 0:t.message;return Promise.reject(n?"Google Drive error ".concat(e.status,": ").concat(n):"Google Drive error ".concat(e.status))}return e.json()}).then(async t=>{let n=t.exportLinks[i],r=await fetch(n,{headers:{Authorization:"Bearer ".concat(e)}});return r.blob()}).then(e=>{let t=new File([e],"".concat(r,".pptx"),{type:i});x([t]),d(!1),l.close(o)}).catch(e=>{console.error("Error importing doc ".concat(t," from google"),e),d(!1),l.update(o,{status:"error",title:(0,n.jsx)(h.cC,{id:"SlfejT"}),description:e.message||e||(0,n.jsx)(h.cC,{id:"lIW942"}),duration:5e3,isClosable:!0})})},[l,x]),y=(0,j.useCallback)((t,i,r,s)=>{let o="https://www.googleapis.com/drive/v3/files/".concat(i,"/export?mimeType=").concat(r);d(!0);let a=l({id:"load-doc-toast-".concat(i),position:"top",duration:null,status:"loading",variant:"subtle",title:(0,n.jsx)(h.cC,{id:"hdsaJo"}),description:(0,n.jsx)(h.cC,{id:"gmwDJx"}),isClosable:!1});fetch(o,{headers:{Authorization:"Bearer ".concat(t)}}).then(e=>e.text()).then(t=>{e.onImportComplete({html:t,filename:s,source:"GoogleDocs",src:o}),l.update(a,{status:"success",title:(0,n.jsx)(h.cC,{id:"oMgC5V"}),duration:5e3,isClosable:!0}),u(!0),d(!1)}).catch(e=>{console.error("Error importing doc ".concat(i," from google"),e),u(!1),d(!1)})},[e,l]),k=(0,j.useCallback)((e,t)=>{if("picked"!==t.action)return;let[i]=t.docs;"application/vnd.google-apps.document"===i.mimeType?y(e,i.id,"text/html",i.name):"application/vnd.google-apps.presentation"===i.mimeType&&m(e,i.id,"application/vnd.openxmlformats-officedocument.presentationml.presentation",i.name)},[y,m]),w=(0,j.useCallback)(e=>{s(e);let t=window.google,i=v.VH.get("pptImport"),n=["application/vnd.google-apps.document",i&&"application/vnd.google-apps.presentation"].filter(e=>!!e),r=new t.picker.DocsView(t.picker.ViewId.DOCS).setMimeTypes(n.join(",")),l=new t.picker.PickerBuilder().addView(r).addView(t.picker.ViewId.FOLDERS).setOAuthToken(e).setAppId(f.v.GOOGLE_PROJECT_ID).setDeveloperKey(f.v.GOOGLE_API_KEY).setCallback(t=>{k(e,t)});i&&l.addView(t.picker.ViewId.DOCUMENTS).addView(t.picker.ViewId.PRESENTATIONS),l.build().setVisible(!0),Array.from(document.getElementsByClassName("picker-dialog")).forEach(e=>{e.style.zIndex="2000"})},[k]),I=(0,j.useCallback)(e=>{console.error("Google auth failed:",e),l({title:(0,n.jsx)(h.cC,{id:"FL/pCd",values:{error:e}}),status:"error",duration:3e3,position:"top",isClosable:!1})},[l]),_=(0,g.Nq)({scope:E,hint:null==o?void 0:o.email,prompt:"",onSuccess:e=>{(0,g.FX)(e,E)?w(e.access_token):I("Could not get requested scopes")},onError:I}),A=(0,j.useCallback)(()=>{window.gapi.load("picker",()=>{i(!0)})},[]);(0,b.Gq)("https://apis.google.com/js/api.js",{onload:A});let T=(0,j.useCallback)(()=>{t&&(r?w(r):_())},[r,_,t,w]);return{initiateGoogleImport:T,isImporting:a,isSuccess:c}},_=e=>{let{text:t}=e;return(0,n.jsxs)(r.K,{direction:"row",spacing:1.5,w:"100%",children:[(0,n.jsx)(s.xu,{color:"green.400",children:(0,n.jsx)(x.G,{icon:u.LEp})}),(0,n.jsx)(l.x,{children:t})]})},A=e=>{let{onImportComplete:t}=e,{initiateDocUpload:i,hiddenInputElement:u,isUploading:p,isSuccess:g}=S({onUploadComplete:t}),{initiateGoogleImport:j,isImporting:f,isSuccess:v}=I({onImportComplete:t}),C=p||f,b=v||g;return(0,n.jsxs)(s.xu,{w:"100%",children:[(0,n.jsx)(o.U,{in:b,children:(0,n.jsx)(a.U,{w:"100%",p:12,justifyContent:"center",spacing:4,border:"none",boxShadow:"none",bg:"whiteAlpha.700",backdropFilter:"blur(10px)",borderRadius:"md",children:(0,n.jsx)(l.x,{fontSize:"xl",children:(0,n.jsx)(h.cC,{id:"oMgC5V"})})})}),(0,n.jsx)(o.U,{in:C,children:(0,n.jsxs)(a.U,{w:"100%",p:12,justifyContent:"center",spacing:4,border:"none",boxShadow:"none",bg:"whiteAlpha.700",backdropFilter:"blur(10px)",borderRadius:"md",children:[(0,n.jsx)(d.$,{}),(0,n.jsx)(l.x,{fontSize:"xl",children:(0,n.jsx)(h.cC,{id:"fxZ/WE"})})]})}),(0,n.jsx)(o.U,{in:!C&&!b,children:(0,n.jsxs)(r.K,{w:"100%",direction:{base:"column",md:"row"},justifyContent:"center",spacing:{base:3,md:4},children:[(0,n.jsx)(m.X,{label:(0,n.jsx)(h.cC,{id:"RMmFZu"}),description:(0,n.jsxs)(r.K,{spacing:1,children:[(0,n.jsx)(_,{text:(0,n.jsx)(h.cC,{id:"W/x3L4"})}),(0,n.jsx)(_,{text:(0,n.jsx)(h.cC,{id:"cuyHFX"})})]}),isPopular:!1,colorScheme:"blue",imageUrl:"/_next/static/media/Thumbnail-drive.beda1526.svg",onClick:j,ctaIcon:(0,n.jsx)(x.G,{icon:c.A$k}),ctaLabel:(0,n.jsx)(h.cC,{id:"iSLIjg"})}),(0,n.jsx)(m.X,{label:(0,n.jsx)(h.cC,{id:"RNxrCU"}),description:(0,n.jsxs)(r.K,{spacing:1,children:[(0,n.jsx)(_,{text:(0,n.jsx)(h.cC,{id:"GwfEs/"})}),(0,n.jsx)(_,{text:(0,n.jsx)(h.cC,{id:"g8oIJP"})})]}),isPopular:!1,colorScheme:"purple",imageUrl:"/_next/static/media/Thumbnail-upload.175964bf.svg",onClick:i,ctaIcon:(0,n.jsx)(x.G,{icon:c.A$k}),ctaLabel:(0,n.jsx)(h.cC,{id:"JYj5R2"})}),u]})})]})}},23312:function(e,t,i){"use strict";i.d(t,{C:function(){return p}});var n=i(52322),r=i(92850),s=i(26468),l=i(22226),o=i(54326),a=i(2338),d=i(97217),c=i(77533),u=i(50250),x=i(43297),h=i(62614),m=i(5879);let p=e=>{let{invitationCount:t,isOpen:i,onClose:p,onSendInvitationsClick:g,onDiscardClick:j}=e;
1return i?(0,n.jsxs)(r.u_,{returnFocusOnClose:!1,onClose:p,closeOnOverlayClick:!0,isOpen:!0,isCentered:!0,children:[(0,n.jsx)(s.Z,{}),(0,n.jsxs)(l.h,{children:[(0,n.jsx)(o.x,{children:(0,n.jsx)(m.cC,{id:"tW/kB6",values:{invitationCount:t}})}),(0,n.jsx)(a.o,{}),(0,n.jsx)(d.f,{children:(0,n.jsx)(c.x,{children:(0,n.jsx)(m.cC,{id:"qxNK2k",values:{invitationCount:t}})})}),(0,n.jsx)(u.m,{children:(0,n.jsxs)(x.K,{spacing:2,direction:"row",align:"center",children:[(0,n.jsx)(h.z,{onClick:j,children:(0,n.jsx)(m.cC,{id:"bzSI52"})}),(0,n.jsx)(h.z,{variant:"solid",onClick:g,children:(0,n.jsx)(m.cC,{id:"6dWGPZ",values:{invitationCount:t}})})]})})]})]}):null}},55001:function(e,t,i){"use strict";i.d(t,{Y:function(){return j}});var n=i(52322),r=i(38035),s=i(17190),l=i(43297),o=i(20437),a=i(28535),d=i(11082),c=i(75009),u=i(74409),x=i(97010),h=i(42822),m=i(44663),p=i(82979);let g=e=>[{category:"Product",items:[{text:"Help",url:p.mc.help},{text:"Change log",url:p.mc.changeLog},{text:"Pricing",url:p.mc.pricing},{text:"Templates",url:p.mc.templates},{text:"Inspiration",url:p.mc.inspiration},{text:"Contact us",onClick:e}]},{category:"Company",items:[{text:"Team",url:p.mc.team},{text:"Terms of Service",url:p.mc.terms},{text:"Privacy Policy",url:p.mc.privacy}]},{category:"Follow us",items:[{text:"Twitter",url:"https://twitter.com/meetgamma"},{text:"Instagram",url:"https://www.instagram.com/meetgamma/"},{text:"LinkedIn",url:"https://www.linkedin.com/company/gamma-app/"},{text:"TikTok",url:"https://www.tiktok.com/@meetgamma"}]}],j=()=>{let e=(0,m.G)(),t=g(e);return(0,n.jsx)(r.k,{fontSize:"12px",bgColor:"#1d0042",color:"gray.400",py:20,id:"footer",justifyContent:"center",children:(0,n.jsx)(s.W,{maxW:"940px",children:(0,n.jsxs)(l.K,{children:[(0,n.jsxs)(o.M,{columns:4,spacing:6,mb:10,minChildWidth:"200px",children:[(0,n.jsx)(a.xu,{w:"100%",children:(0,n.jsx)(d.r,{href:"/",children:(0,n.jsx)(c.E,{src:"https://assets.website-files.com/60de2701a7b28f308f619d3d/60de2701a7b28ff7e9619d49_White%20Logo%20g%20spot.svg",loading:"lazy",width:"120px",alt:"Gamma logo"})})}),t.map((e,t)=>{let{category:i,items:r}=e;return(0,n.jsxs)(a.xu,{w:"100%",children:[(0,n.jsx)(u.X,{marginBottom:"25px",color:"rgba(239, 208, 255, 0.7)",fontWeight:"bold",fontSize:"14px",fontFamily:"var(--body-font)",letterSpacing:"normal",children:i}),(0,n.jsx)(x.QI,{listStyleType:"none",margin:0,children:r.map((e,t)=>{let{text:i,url:r,onClick:s}=e;return(0,n.jsx)(x.HC,{fontSize:"14px",pb:4,children:(0,n.jsx)(d.r,{color:"hsla(0, 0%, 100%, 0.86)",href:r||void 0,onClick:s||void 0,children:i})},t)})})]},t)})]}),(0,n.jsxs)(h.M,{color:"rgba(239, 208, 255, 0.7)",fontSize:"13px",children:["\xa9 ",new Date().getFullYear()," Gamma Tech, Inc."]})]})})})}},18606:function(e,t,i){"use strict";i.d(t,{P:function(){return m}});var n=i(52322),r=i(28535),s=i(43297),l=i(11082),o=i(75009),a=i(36474),d=i(62614),c=i(36651),u={src:"/_next/static/media/gamma-logo-white.9613e68b.svg"},x=i(82979);let h=[{text:"Pricing",url:x.mc.pricing,hideWhenSmall:!0},{text:"Templates",url:x.mc.templates,hideWhenSmall:!0},{text:"Login",url:x.mc.login}],m=e=>{let{headerMode:t="light"}=e,{user:i,isUserLoading:m}=(0,c.SE)(),p="light"===t;return(0,n.jsx)(r.xu,{py:4,px:[6,6,12],h:x.AP,pr:[4,6,12],zIndex:"999",top:["auto","auto","0"],children:(0,n.jsxs)(s.K,{direction:"row",children:[(0,n.jsx)(l.r,{href:"/","aria-current":"page",children:(0,n.jsx)(o.E,{w:"100px",src:p?"https://assets.website-files.com/62e823626cd4fdd0e5dc1527/62e823626cd4fdc26bdc1576_Gamma.svg":u.src,loading:"lazy",alt:"Gamma logo"})}),(0,n.jsx)(a.L,{}),!m&&!i&&(0,n.jsxs)(s.K,{direction:"row",spacing:[4,4,8],fontWeight:"500",fontSize:"14px",color:p?"#3b3a40":"#fff",alignItems:"center",transition:"color 300ms ease",children:[h.map(e=>{let{text:t,url:i,hideWhenSmall:r}=e;return(0,n.jsx)(l.r,{display:r?["none","none","block"]:"block",href:i,color:p?void 0:"whiteAlpha.800",_hover:{color:p?"#000":"whiteAlpha.900",textDecoration:"none"},children:t},t)}),(0,n.jsx)(d.z,{as:l.r,href:x.mc.signup,maxHeight:"32px",borderStyle:"solid",borderWidth:"0.5px",fontSize:"14px",borderColor:"rgba(0, 0, 0, 0.24)",backgroundColor:"#fff",boxShadow:"0 4px 4px 0 rgb(0 0 0 / 5%)",fontWeight:"700",borderRadius:"100px",color:"#3b3a40",_hover:{color:"black",textDecoration:"none"},children:"Try for free"})]})]})})}},82979:function(e,t,i){"use strict";i.d(t,{AP:function(){return r},mc:function(){return n}});let n={pricing:"/pricing",help:"https://help.gamma.app",changeLog:"https://gamma.app/public/Change-Log-awopg3inl2eo3b3",team:"https://gamma.app/public/Meet-the-Team-at-Gamma-nbqgqy05eyfcsbi",terms:"https://gamma.app/terms",privacy:"https://gamma.app/privacy",login:"/signin",signup:"/signup",templates:"/templates",inspiration:"/inspiration"},r=16},7454:function(e,t,i){"use strict";i.d(t,{i:function(){return o}});var n=i(62202),r=i(15193),s=i(94523);let l={colors:s.qZ.colors,zIndices:{tooltip:5600,modal:1800,dropdown:1600},fonts:{body:"'Eudoxus Sans', sans-serif",heading:"'p22-mackinac-pro', sans-serif"},fontSizes:{xxs:"11px"},components:{Link:{baseStyle:{textDecoration:"none"}},Button:{variants:{fancy:{color:"white",borderRadius:"full",background:"linear-gradient(180deg, #6850FF 0%, rgba(38, 59, 227, 0) 100%), linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%), linear-gradient(272.9deg, #003DD9 0.18%, #6850FF 109.19%, #DF7A6C 188.8%)",border:"1px solid rgba(255, 255, 255, 0.12)",_hover:{background:"linear-gradient(180deg, #3A24C2 0%, rgba(38, 59, 227, 0) 100%), linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%), linear-gradient(272.9deg, #002C9D 0.18%, #6850FF 109.19%, #DF7A6C 188.8%, #A56057 224.56%)"},_active:{boxShadow:"inset 1px 1px 5px rgb(0 0 0 / 50%)",background:"linear-gradient(180deg, #3A24C2 0%, rgba(38, 59, 227, 0) 100%), linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%), linear-gradient(272.9deg, #002C9D 0.18%, #6850FF 109.19%, #DF7A6C 188.8%, #A56057 224.56%)"},textDecoration:"none !important"}}},Heading:{baseStyle:{letterSpacing:"-0.04em"},variants:{fancy:{backgroundImage:s.qZ.colors.gradient["blue-to-purple"],backgroundClip:"text",color:"transparent"}}}}},o=(0,n.B1)(l,(0,r.A)({colorScheme:"trueblue"}))},17283:function(e,t,i){"use strict";i.d(t,{o8:function(){return s},vt:function(){return r}});var n=i(14274);let r=n.v.NEXT_PUBLIC_GA_ID,s=e=>{var t,i;null===(t=(i=window).gtag)||void 0===t||t.call(i,"config",r,{page_path:e})}},25944:function(e,t,i){"use strict";i.d(t,{bf:function(){return p},iZ:function(){return h},lh:function(){return x},wK:function(){return m}});var n=i(2784),r=i(42111),s=i(91994),l=i(47968),o=i(90604),a=i(56400),d=i(99268);let c=e=>Math.random()<=1/e;class u{setupProvider(){this.t1SetupProvider||(this.t1SetupProvider=performance.now())}downloadDoc(){this.t2DownloadDoc||(this.t2DownloadDoc=performance.now())}onCreate(){this.t3OnCreate||(this.t3OnCreate=performance.now())}report(){return null===this.t1SetupProvider||null===this.t2DownloadDoc||null===this.t3OnCreate?null:{downloadDoc:this.t2DownloadDoc-this.t1SetupProvider,onCreate:this.t3OnCreate-this.t2DownloadDoc}}constructor(){this.t1SetupProvider=null,this.t2DownloadDoc=null,this.t3OnCreate=null}}let x=(e,t)=>{let i=(0,s.CG)(l.Pw),r=(0,n.useRef)(i);(0,n.useEffect)(()=>{r.current=i},[i]),(0,n.useEffect)(()=>
1{if(e)return window.addEventListener("keydown",i,!0),()=>{window.removeEventListener("keydown",i,!0)};function i(e){let i=e.target.closest(".ProseMirror");if(!i||!r.current||!c(t))return;let n=performance.now();requestAnimationFrame(()=>{let t=e.key;" "===t&&(t="Space");let i=performance.now()-n;(0,d.EF)({...(0,a.H)(),key:t,duration:i})})}},[e,r,t])},h=()=>{let e=(0,r.ye)("rumSampleRate");(0,n.useEffect)(()=>{(0,d._k)(e)},[e])},m=e=>{let t=(0,n.useCallback)(t=>{let{isFullscreen:i=!1}=t;if(!e)return;let n=performance.now();requestAnimationFrame(()=>{requestAnimationFrame(()=>{let e=performance.now()-n;(0,d.gG)({...(0,a.H)(),toMode:o.q.SLIDE_VIEW,duration:e,isFullscreen:i})})})},[e]),i=(0,n.useCallback)(t=>{let{isFullscreen:i=!1}=t;if(!e)return;let n=performance.now();requestAnimationFrame(()=>{requestAnimationFrame(()=>{let e=performance.now()-n;(0,d.gG)({...(0,a.H)(),toMode:o.q.DOC_VIEW,duration:e,isFullscreen:i})})})},[e]);return{recordExitSlideModePerformance:i,recordEnterSlideModePerformance:t}},p=()=>{let[e]=(0,n.use
1State)(()=>new u),t=(0,n.useCallback)(()=>{e.setupProvider()},[e]),i=(0,n.useCallback)(()=>{e.downloadDoc()},[e]),r=(0,n.useCallback)(()=>{e.onCreate();let t=e.report();if(null===t){console.warn("[HoneycombDocLoadTimer] failed to generate doc timings");return}(0,d.Py)({...(0,a.H)(),duration:t.onCreate}),(0,d.aZ)({...(0,a.H)(),duration:t.downloadDoc})},[e]);return{timeOnCreate:r,timeOnSetupProvider:t,timeOnDownloadDoc:i}}},89311:function(e,t,i){"use strict";i.d(t,{l:function(){return o}});var n=i(5632),r=i(2784),s=i(7e4),l=i(88640);let o=()=>{let{pathname:e,isReady:t}=(0,n.useRouter)(),i=(0,r.useRef)(!1),[o,a]=(0,s.X)(l.H.lastHomeUrl,"/");(0,r.useEffect)(()=>{if(i.current||!t)return;let n="/inspiration"===e||"/templates"===e?e:"/";a(n),i.current=!0},[a,t,e])}},60536:function(e,t,i){"use strict";i.d(t,{V:function(){return p}});var n=i(52322),r=i(43297),s=i(29117),l=i(77533),o=i(82554),a=i(36474),d=i(41098),c=i(5879),u=i(23405),x=i(94199),h=i(67964),m=i(81640);let p=e=>{let{onClose:t,onOpen:i,segmentEvent:p,doc:g,label:j}=e,f=(0,u.y)("upsellUXEnabled_Pro"),v=(0,h.dU)(null==g?void 0:g.organization),{openUpsellModal:C}=(0,m.z)();return!1===v&&f?(0,n.jsxs)(r.K,{my:4,borderTop:"1px solid var(--chakra-colors-gray-100)",w:"100%",children:[(0,n.jsxs)(s.U,{mt:4,children:[(0,n.jsxs)(s.U,{children:[(0,n.jsx)(l.x,{children:j||(0,n.jsx)(c.cC,{id:"alnKae",values:{GAMMA_PROPER_NOUN:x.N6}})}),(0,n.jsx)(o.C,{colorScheme:"trueblue",variant:"solid",children:x.k3})]}),(0,n.jsx)(a.L,{}),(0,n.jsx)(d.r,{onClickCapture:e=>{e.preventDefault(),C({onOpenCallback:t,onCloseCallback:i,segmentEvent:p})},checked:!1})]}),(0,n.jsx)(l.x,{fontSize:"xs",color:"gray.600",children:(0,n.jsx)(c.cC,{id:"/BIHRF",values:{GAMMA_PROPER_NOUN:x.N6}})})]}):null}},4758:function(e,t,i){"use strict";i.d(t,{L:function(){return p}});var n=i(52322),r=i(38035),s=i(16556),l=i(29117),o=i(109),a=i(77533),d=i(28535),c=i(42946),u=i(49929),x=i(94523),h=i(5879),m=i(7985);i(30579);let p=e=>{let{selectedCollaborator:t,idx:i,handleRemoveClick:p}=e,g=t&&(0,m.G)((null==t?void 0:t.email)||""),j=0===i?170:300;return(0,n.jsx)(r.k,{width:0===i?"calc(100% - 100px)":"",className:"searchbartag","data-testid":"searchbartag-collaborator-".concat(t.email),children:(0,n.jsxs)(s.Vp,{size:"md",minW:110,...g?{}:{colorScheme:"red",bg:"red",color:"white"},children:["id"in t?(0,n.jsx)(x.kH,{label:t.email,"aria-label":t.email,children:(0,n.jsxs)(l.U,{children:[(0,n.jsx)(o.q,{size:"2xs",m:0,name:t.displayName,src:t.profileImageUrl}),(0,n.jsx)(a.x,{textTransform:"capitalize",wordBreak:"break-word",noOfLines:1,maxW:j,lineHeight:"1.5",children:t.displayName})]})}):(0,n.jsx)(x.kH,{label:g?t.email:(0,n.jsx)(h.cC,{id:"XILg0L"}),"aria-label":t.email,children:(0,n.jsxs)(l.U,{flex:1,children:[(0,n.jsx)(d.Cd,{bg:g?"trueblue.100":"none",size:6,children:(0,n.jsx)(u.G,{icon:g?c.FU$:c.WV2})}),(0,n.jsx)(a.x,{wordBreak:"break-all",display:"block",height:"100%",width:"100%",noOfLines:1,maxW:j,lineHeight:"1.5",children:t.email})]})}),(0,n.jsx)(s.SD,{onClick:p})]})},"id"in t?t.id:t.email)}},60740:function(e,t,i){"use strict";i.d(t,{y:function(){return s}});var n=i(55478),r=i(2784);let s=()=>{let{isOpen:e,onOpen:t,onClose:i}=(0,n.q)({id:"sharePanelDisclosure"}),[s,l]=(0,r.useState)("invite");return{isSharePanelOpen:e,onSharePanelOpen:t,onSharePanelClose:i,view:s,setView:l}}},86513:function(e,t,i){"use strict";i.d(t,{XG:function(){return n},Nj:function(){return eZ},t9:function(){return eX},o$:function(){return e2},aA:function(){return to},WQ:function(){return tp}});var n,r=i(52322),s=i(92850),l=i(26468),o=i(22226),a=i(54326),d=i(28535),c=i(2338),u=i(74008),x=i(97217),h=i(43297),m=i(67109),p=i(89099),g=i(62614),j=i(82554),f=i(36474),v=i(50250),C=i(38035),b=i(42946),y=i(49929),k=i(94523),w=i(5879),S=i(2784),E=i(93202),I=i(11550),_=i(67964),A=i(30579),T=i(16710),O=i(46759),P=i(15041),D=i(36651),R=i(55274),G=i(17993),z=i(77533),N=i(47443),M=i(52929),L=i(29117),F=i(94199),U=i(25566),W=i(70065),H=i(11082),V=i(75652),B=i.n(V),K=i(14274),q=i(91994),Y=i(11050),Z=i(47968);let X=(e,t)=>"".concat(K.v.API_HOST||"","/export/docs/").concat(e,"/").concat(t),J=async(e,t,i)=>{let n=X(e,i);return fetch(n,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","share-token":K.v.SHARE_TOKEN||""},body:JSON.stringify({docContent:t})})},Q=function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"pdf",s=(0,W.p)(),l=(0,S.useRef)(null),o=(0,Y.z$)(),[a,d]=(0,S.useState)(!1),c=(0,S.useCallback)(()=>{l.current=s({id:"export-toast-".concat(e.id,"-").concat(n),isClosable:!1,position:"top",duration:null,status:"loading",variant:"light",title:(0,r.jsx)(w.cC,{id:"N/fNtX",values:{format:n}})})},[null==e?void 0:e.id,s,n]),u=(0,S.useCallback)(()=>{l.current&&s.update(l.current,{status:"loading",variant:"light",title:(0,r.jsx)(w.cC,{id:"eJOEBy"}),description:(0,r.jsx)(w.cC,{id:"vMANwD"}),isClosable:!0})},[s,n]),x=(0,S.useCallback)(()=>{l.current&&s.update(l.current,{title:(0,r.jsx)(w.cC,{id:"walT1X"}),status:"error",duration:null,isClosable:!0})},[s]),h=(0,S.useCallback)(e=>{l.current&&s.update(l.current,{status:"success",title:(0,r.jsx)(w.cC,{id:"pK8dQg"}),description:(0,r.jsx)(z.x,{children:(0,r.jsx)(w.cC,{id:"MTtTC2",components:{0:(0,r.jsx)(H.r,{textDecoration:"underline",target:"_blank",href:e||void 0,onClick:()=>l.current&&s.close(l.current)})}})}),isClosable:!0})},[s,n]),m=(0,S.useCallback)(()=>{let r=null==i?void 0:i.getJSON();d(!0),c();let s=setTimeout(u,3e4);J(e.id,r,n).then(async i=>{var r;let s=await i.blob();if(!i.ok)throw Error("Export failed.");let l="pdf"===n?Y.AA.PDF_EXPORTED:Y.AA.PPTX_EXPORTED;null==o||o.track(l,{doc_id:e.id,source:t}),h(decodeURIComponent(i.headers.get("x-gamma-download-url")||"")||void 0);let a=window.URL.createObjectURL(s),d=document.createElement("a"),c=decodeURIComponent((null===(r=(i.headers.get("Content-Disposition")||"").split(";").find(e=>e.includes("filename=")))||void 0===r?void 0:r.replace("filename=","").trim())||"".concat(e.id,".").concat(n));d.download=c,d.href=a,d.style.display="none",document.body.appendChild(d),d.click(),d.remove()}).catch(()=>{x()}).finally(()=>{d(!1),clearTimeout(s)})},[o,null==e?void 0:e.id,i,t,n,x,c,u,h]);return{handleExport:m,exportInProgress:a}},$=e=>{let t=(0,q.CG)(Z.Pu),i=e.theme||t,n=(0,S.useMemo)(()=>{let e=i.fonts?[...i.fonts]:[];return e.length<2&&e.push({id:"Inter",name:"Inter",url:"https://fonts.googleapis.com/css2?family=Inter"}),B()(e).map(e=>{var t;return(null===(t=e.url)||void 0===t?void 0:t.includes("fonts.googleapis.com"))?{name:e.name,url:"https://fonts.google.com/specimen/".concat(e.name)}
1:{name:e.name}}).filter(e=>!!e)},[i]);return n};var ee=i(69747),et=i(68727),ei=i(60536);let en=e=>{let{doc:t,editor:i,onSharePanelOpen:n,onSharePanelClose:s,isMultipage:l=!1}=e,o=(0,q.CG)(Z.Pu),a=o.config.headingGradient,d=(0,D.py)("edit",t);return(0,r.jsxs)(G.g,{spacing:4,align:"start",pt:2,children:[(0,r.jsx)(z.x,{fontSize:"sm",color:"gray.600",children:l?(0,r.jsx)(w.cC,{id:"QI+Cf0",values:{0:t.title},components:{0:(0,r.jsx)("strong",{})}}):(0,r.jsx)(w.cC,{id:"qwhOQ/",values:{GAMMA_ARTIFACT_PROPER_NOUN:F.Yc}})}),(0,r.jsxs)(h.K,{spacing:2,width:"100%",children:[(0,r.jsx)(el,{format:"pdf",label:"PDF",icon:b.gSj,accentColor:"red",doc:t,editor:i}),(0,r.jsx)(el,{format:"pptx",label:"PowerPoint",icon:b.WOY,accentColor:"orange",doc:t,editor:i})]}),(0,r.jsxs)(h.K,{spacing:"2",w:"100%",children:[a&&(0,r.jsx)(er,{}),(0,r.jsx)(es,{doc:t})]}),i&&d&&(0,r.jsx)(z.x,{fontSize:"sm",color:"gray.600",children:(0,r.jsx)(w.cC,{id:"8LhjM/",components:{0:(0,r.jsx)(g.z,{variant:"link",as:"span",size:"sm",cursor:"pointer",onClick:()=>{s(),ee.pw.emit(ee.TI.OPEN_PAGE_SETUP,"cards")}})}})}),(0,r.jsx)(ei.V,{onClose:s,onOpen:n,segmentEvent:U.AA.GAMMA_PRO_UPSELL_EXPORT_SETTINGS_REMOVE_WATERMARK,doc:t})]})},er=()=>(0,r.jsxs)(N.b,{status:"info",bg:"gray.100",children:[(0,r.jsx)(M.z,{color:"gray.400",boxSize:"4",mt:"1",mr:"2.5"}),(0,r.jsx)(w.cC,{id:"lgULOV",values:{GAMMA_ARTIFACT_PROPER_NOUN:F.Yc}})]}),es=e=>{let{doc:t}=e,i=$(t);return i.length?(0,r.jsxs)(N.b,{status:"info",bg:"gray.100",children:[(0,r.jsx)(M.z,{color:"gray.400",boxSize:"4",mt:"1",mr:"2.5"}),(0,r.jsxs)(h.K,{children:[(0,r.jsx)(z.x,{fontSize:"sm",children:(0,r.jsx)(w.cC,{id:"5qYpE7"})}),(0,r.jsx)(L.U,{children:i.map(e=>{let{name:t,url:i}=e;return(0,r.jsx)(d.xu,{border:"1px",borderColor:"gray.200",borderRadius:"md",bg:"white",h:"auto",_hover:i?{boxShadow:"var(--chakra-shadows-md)",borderColor:"var(--chakra-colors-trueblue-300)",color:"var(--chakra-colors-trueblue-400)"}:{},onClick:i?()=>window.open(i,"_blank"):void 0,cursor:i?"pointer":void 0,children:(0,r.jsxs)(L.U,{p:3,paddingRight:4,spacing:4,children:[(0,r.jsx)(z.x,{fontWeight:"medium",children:t}),i&&(0,r.jsx)(y.G,{icon:b.wlW,size:"1x"})]})},"name")})})]})]}):null},el=e=>{let{format:t,doc:i,editor:n,icon:s,accentColor:l,label:o,badge:a}=e,{handleExport:d,exportInProgress:c}=Q(i,"share_panel",n,t);return(0,r.jsx)(et.j,{onClick:d,icon:s,formatLabel:o,accentColor:l,exportInProgress:c,exportInProgressNote:(0,r.jsx)(w.cC,{id:"57bp6s"}),badge:a})};var eo=i(87651),ea=(i(81672),i(74409)),ed=i(109),ec=(i(82655),i(54933)),eu=i(87254),ex=i(1842),eh=i.n(ex),em=i(21979),ep=i(16893),eg=i(20336),ej=i(84405),ef=i(93441),ev=i(89458),eC=i(78462),eb=i(88640),ey=i(8174);let ek=e=>{let{icon:t,showDisabled:i=!1}=e;return(0,r.jsx)(d.Cd,{color:"gray.800",textAlign:"center",bg:"gray.200",size:8,opacity:i?.5:1,children:i?(0,r.jsxs)("span",{className:"fa-stack",children:[(0,r.jsx)(y.G,{icon:b.u6k,className:"fa-stack-1x"}),(0,r.jsx)(y.G,{icon:t,className:"fa-stack-1x"})]}):(0,r.jsx)(y.G,{size:"1x",icon:t})})},ew=e=>{let{channel:t,doc:i,isDisabled:n,showDisabledIcon:s=!1}=e,{removeDocChannel:l}=(0,ey.Z)(),o=(0,S.useCallback)(()=>{i&&l(i,t.id)},[t.id,i,l]),a=(0,eC.j)({slug:t.slug,id:t.id});return(0,r.jsxs)(L.U,{py:2,w:"100%",justify:"space-between","data-testid":"workspace-row-".concat(t.id),children:[(0,r.jsx)(d.xu,{children:(0,r.jsxs)(C.k,{alignItems:"center",children:[(0,r.jsx)(ek,{icon:A.Ty,showDisabled:s}),(0,r.jsx)(d.xu,{ml:3,opacity:s?.5:1,children:(0,r.jsx)(H.r,{href:a,target:"_blank",children:t.name})})]})}),(0,r.jsx)(g.z,{size:"sm",variant:"ghost",colorScheme:"red",onClick:o,isDisabled:n,children:(0,r.jsx)(w.cC,{id:"t/YqKh"})})]},t.id)};var eS=i(46949),eE=i(75768),eI=i(74105),e_=i(81540),eA=i(20816),eT=i(46028),eO=i(38421),eP=i.n(eO);let eD=e=>{let{workspaceId:t,docId:i,existingChannels:n,isDisabled:s}=e,l=(0,S.useRef)(null),[o,a]=(0,S.useState)(""),[c,u]=(0,S.useState)([]),[x,m]=(0,S.useState)(!1),{addDocChannel:p}=(0,ey.Z)(),{data:g,loading:j}=(0,E.Kce)({variables:{query:o,workspaceId:t},skip:!o});(0,S.useEffect)(()=>{if(j||!g)return;
1let e=g.search.filter(Boolean);u(e),m(0===e.length)},[g,j]);let f=(0,S.useMemo)(()=>o?c.filter(e=>!n.find(t=>t.id===e.id)):[],[n,o,c]),v=(0,S.useCallback)(e=>{let t=f.find(t=>t.id===e);if(!t){console.error("[ChannelSearchBar.addSelectedChannel] No matching channel found");return}p({docId:i,channel:t,existingChannels:n})},[p,i,n,f]);return(0,r.jsx)(eE.h,{w:"100%",mb:2,alignItems:"flex-start","data-testid":"sharepanel-channel-search-bar",children:(0,r.jsx)(d.xu,{flex:1,children:(0,r.jsxs)(eI.B,{w:"100%",justifyContent:"center",zIndex:1,children:[(0,r.jsx)(C.k,{display:"none",position:"absolute",h:"100%",w:"100%",alignItems:"center",justifyContent:"center",bg:"gray.300",zIndex:"overlay",opacity:.4,children:(0,r.jsx)(e_.$,{})}),(0,r.jsxs)(eT.Qc,{rollNavigation:!0,multiple:!0,emptyState:()=>!!x&&(0,r.jsxs)(C.k,{direction:"column",justify:"center",align:"center",w:"100%",my:6,children:[(0,r.jsx)(d.xu,{w:"80%",maxW:"200px",mb:6,alignContent:"center",children:(0,r.jsx)(eP(),{src:"/images/Sal-Fishing-2x.png",width:"640",height:"361",alt:"Sal, the Gamma mascot, fishing extraterrestrially"})}),(0,r.jsx)(ea.X,{size:"xs",mb:2,textAlign:"center",children:(0,r.jsx)(w.cC,{id:"NmfOr+"})}),(0,r.jsx)(z.x,{fontSize:"sm",color:"gray.400",textAlign:"center",children:(0,r.jsx)(w.cC,{id:"kXnLEt"})})]}),suggestWhenEmpty:!1,openOnFocus:!0,filter:()=>!0,onSelectOption:e=>{let{item:t}=e;v(t.value),a("")},children:[(0,r.jsxs)(eA.Z,{pointerEvents:"none",color:"gray.300",h:"100%",flexDirection:"column",children:[(0,r.jsx)(C.k,{flex:1}),(0,r.jsx)(C.k,{h:10,py:4,alignItems:"center",children:(0,r.jsx)(eS.W,{w:10})})]}),(0,r.jsx)(eT.Vp,{ref:l,"data-testid":"autocomplete-channels-input",cursor:s?"not-allowed":void 0,disabled:s,w:"100%",pl:5,wrapStyles:{px:2},fontSize:"md",placeholder:eu.ag._({id:"KmCmUJ"}),transition:"width 1s ease-in-out",value:o,onChange:e=>{let{target:t}=e,{value:i}=t;a(i),i||u([])}}),(0,r.jsx)(eT.Jm,{w:"100%",mt:0,display:o.length>0?"flex":"none",children:f.length>0&&f.map(e=>{let{id:t,name:i,memberCount:n,isMember:s,members:l}=e;return(0,r.jsx)(eT.Gb,{"data-testid":"autocomplete-item-channel-".concat(t),value:{id:e.id},getValue:e=>e.id,align:"center",_focus:{bg:"trueblue.50"},children:(0,r.jsxs)(L.U,{spacing:4,p:0,flex:1,children:[(0,r.jsx)(d.xu,{color:"gray.700",children:(0,r.jsx)(y.G,{icon:A.Ty})}),(0,r.jsxs)(h.K,{spacing:0,flex:"1",children:[(0,r.jsx)(z.x,{children:i}),(0,r.jsx)(z.x,{fontSize:"sm",color:"gray.400",children:s?(0,r.jsx)(w.cC,{id:"tWPlLK",values:{0:n||0}}):(0,r.jsx)(w.cC,{id:"pkIIls",values:{0:n||0}})})]}),(0,r.jsx)(k.NL,{size:"xs",overflowTooltipLabel:eu.ag._({id:"25VyZX"}),avatars:l||[],max:3,onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})},t)})})]})]})})})};var eR=i(55478),eG=i(78071),ez=i(7985),eN=i(41004),eM=i(99016),eL=i(23312),eF=i(80498),eU=i(62549),eW=i(10625),eH=i(67046),eV=i(99058),eB=i(44035),eK=i(39237),eq=i(27599),eY=i(25481);(n||(n={})).NoAccess="no_access";let eZ={[E.y3$.Manage]:{title:()=>eu.ag._({id:"DZfDCl"}),description:()=>eu.ag._({id:"r59J7Q"})},[E.y3$.Edit]:{title:()=>eu.ag._({id:"ePK91l"}),description:()=>eu.ag._({id:"kuZsYI"})},[E.y3$.Comment]:{title:()=>eu.ag._({id:"NBdIgR"}),description:()=>eu.ag._({id:"IwFh5+"})},[E.y3$.View]:{title:()=>eu.ag._({id:"jpctdh"}),description:()=>eu.ag._({id:"yzFEXd"})},[n.NoAccess]:{title:()=>eu.ag._({id:"oPoLg+"}),description:()=>eu.ag._({id:"Vcif8/"})}},eX=e=>{let{isDisabled:t,options:i,disabledOptions:s=[],selected:l,variant:o="ghost",onClick:a=()=>{},onRemove:c}=e;return(0,r.jsxs)(eW.v,{closeOnSelect:!0,children:[(0,r.jsx)(eH.j,{"data-testid":"permission-menu-value-".concat(l),as:g.z,display:"flex",size:"sm",isDisabled:t,variant:o,rightIcon:(0,r.jsx)(y.G,{icon:b.ptq}),children:eZ[l||n.NoAccess].title()}),(0,r.jsx)(eV.q,{textAlign:"left",zIndex:"overlay",children:(0,r.jsxs)(eB._,{defaultValue:l,value:l,title:eu.ag._({id:"9cDpsw"}),type:"radio",onChange:e=>{a(e)},children:[i.map(e=>{let t=s.find(t=>t.permission===e),i=t&&t.reason;return(0,r.jsx)(eK.i,{isDisabled:!!t,value:e,alignItems:"start",pt:3,children:(0,r.jsx)(k.kH,{label:i,"aria-label":i,isDisabled:!t,placement:"top",children:(0,r.jsxs)(d.xu,{children:[(0,r.jsx)(z.x,{mt:-1,children:eZ[e].title()}),(0,r.jsx)(z.x,{fontSize:"sm",color:"gray.500",mt:1,children:eZ[e].description()})]})},e)},e)}),c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eq.R,{}),(0,r.jsx)(eY.s,{color:"red.500",onClick:c,icon:(0,r.jsx)(y.G,{icon:b.XAH,fixedWidth:!0}),children:(0,r.jsx)(w.cC,{id:"t/YqKh"})})]})]})})]})};var eJ=i(4758);let eQ=(0,eN.E)(d.xu),e$=(e,t,i)=>{if(!i)return e;let n=[...e],r=e.findIndex(e=>"email"in e&&e.email===i),s=t.find(e=>e.email===i);return -1!==r&&n.splice(r,1),[...n,s||{email:i}]},e0=(e,t)=>{let i=(0,eU.Hs)(t.map(e=>"displayName"in e?e.displayName:e.email),3);
1return e===E.y3$.Manage?eu.ag._({id:"4bKxWq",values:{userNames:i,GAMMA_ARTIFACT_PROPER_NOUN:F.Yc,0:t.length}}):e===E.y3$.Edit?eu.ag._({id:"3rbi6Y",values:{userNames:i,GAMMA_ARTIFACT_PROPER_NOUN:F.Yc,0:t.length}}):e===E.y3$.Comment?eu.ag._({id:"uGWY40",values:{userNames:i,GAMMA_ARTIFACT_PROPER_NOUN:F.Yc,0:t.length}}):e===E.y3$.View?eu.ag._({id:"p5IG6F",values:{userNames:i,GAMMA_ARTIFACT_PROPER_NOUN:F.Yc,0:t.length}}):eu.ag._({id:"Ai1TAT",values:{userNames:i,GAMMA_ARTIFACT_PROPER_NOUN:F.Yc,0:t.length}})},e1=e=>{let{workspaceId:t,docId:i,user:n,existingDocCollaborators:s,existingInvitations:l,registerDoneFn:o,isDisabled:a}=e,c=(0,W.p)(),[u,x]=(0,S.useState)(!1),h=(0,S.useRef)(),m=(0,S.useRef)(null),[p,j]=(0,S.useState)(""),[f,v]=(0,S.useState)([]),[I,_]=(0,S.useState)(E.y3$.Manage),[A,T]=(0,S.useState)(new eF.B),[O,P]=(0,S.useState)([]),D=O.filter(e=>"email"in e),R=s.map(e=>e.user),{isOpen:G,onOpen:N,onClose:M}=(0,eR.q)({id:"unsentInvitationsModalDisclosure"}),[F,{loading:U,error:H}]=(0,E.qVw)();(0,ef.GJ)("Error inviting collaborators.",H);let V=(0,eM.j)(E.aAR),{data:B,loading:K}=(0,E.PGi)({variables:{query:p,workspaceId:t},skip:!p});(0,S.useEffect)(()=>{if(K||!B)return;let e=B.search.filter(Boolean);v(e)},[B,K]);let q=(0,S.useMemo)(()=>p?f.filter(e=>"User"===e.__typename&&e.id!==n.id&&!D.concat(R).find(t=>t.email===e.email)):[],[f,R,p,D,n.id]),Y=!!p&&!q.find(e=>e.email===p),Z=I===E.y3$.Manage&&D.some(e=>!("__typename"in e&&"User"===e.__typename)),X=O.concat({email:p}).filter(e=>!("email"in e)||(0,ez.G)(e.email||"")),J=!!O.length,Q=!!X.length;(0,S.useEffect)(()=>{o(()=>()=>(Q?N():A.resolve(),A.promise))},[o,A,Q,N]);let $=(0,S.useCallback)(async e=>{x(!0),P(t=>e.reduce((e,t)=>e$(e,q,t.trim()),t));let i=(await Promise.all(e.map(e=>V({workspaceId:t,query:e}).then(t=>{var i;return null===(i=t.data)||void 0===i?void 0:i.search.find(t=>"User"===t.__typename&&t.email===e)})))).filter(Boolean);P(t=>e.reduce((e,t)=>e$(e,i,t.trim()),t)),x(!1)},[q,V,t]),ee=(0,S.useCallback)(async()=>{if(0===D.length)return;let e=e$(D,q,p.trim()).filter(e=>"email"in e&&(0,ez.G)(e.email||"")),t=[...s,...e.map(e=>{if("id"in e)return{docId:i,user:e,guest:!1,permission:I,__typename:"DocCollaborator"}})].filter(e=>!!e),r=[...l,...e.map(e=>{if("id"in e)return;let t={id:"temp",docTitle:"temp-title",invitedBy:n,docId:i,email:e.email,permission:I,__typename:"DocInvitation"};return t})].filter(e=>!!e);return F({variables:{docId:i,collaborators:e.map(e=>{let t="id"in e?{userId:e.id}:{email:e.email};return{...t,permission:I}})},update:(e,t)=>{let{data:n}=t;e.writeFragment({id:"Doc:".concat(i),fragment:E.yAO,data:null==n?void 0:n.addCollaborators})},optimisticResponse:{addCollaborators:{id:i,collaborators:t,invitations:r}}}).then(()=>{let t=eu.ag._({id:"Ka86rB",values:{0:e.length}}),i=e0(I,e);c({title:t,description:i,status:"success",duration:5e3,isClosable:!0,position:"top"})})},[F,i,p,I,q,D,s,l,c,n]),et=(0,S.useCallback)(async()=>Promise.all([ee()]).then(()=>{var e;P([]),j(""),null===(e=h.current)||void 0===e||e.resetItems(!0),A.resolve(),T(new eF.B)}).catch(e=>{console.warn(e)}),[ee,A]),ei=a||U||u;return(0,r.jsxs)(eE.h,{w:"100%",mb:2,alignItems:"flex-start","data-testid":"sharepanel-search-bar",children:[(0,r.jsx)(d.xu,{flex:1,children:(0,r.jsxs)(eI.B,{w:"100%",justifyContent:"center",zIndex:2,children:[(0,r.jsx)(C.k,{display:u?"flex":"none",position:"absolute",h:"100%",w:"100%",alignItems:"center",justifyContent:"center",bg:"gray.300",zIndex:"overlay",opacity:.4,children:(0,r.jsx)(e_.$,{})}),(0,r.jsxs)(eT.Qc,{ref:h,values:O,maxSelections:100,maxSuggestions:20,creatable:!0,multiple:!0,freeSolo:!0,suggestWhenEmpty:!1,openOnFocus:!0,filter:(e,t)=>!D.find(e=>e.email===t),onSelectOption:e=>{let{item:t}=e,{type:i}=t.originalValue;"collaborator"===i&&P(e=>e$(e,q,t.value)),j("")},onTagRemoved:e=>{P(t=>[...t].filter(t=>"email"in t?t.email!==e:!("id"in t)||t.id!==e))},children:[(0,r.jsxs)(eA.Z,{pointerEvents:"none",color:"gray.300",h:"100%",flexDirection:"column",children:[(0,r.jsx)(C.k,{flex:1}),(0,r.jsx)(C.k,{h:10,py:4,alignItems:"center",children:(0,r.jsx)(eS.W,{w:10})})]}),(0,r.jsx)(eT.Vp,{ref:m,"data-testid":"autocomplete-collaborators-input",cursor:ei?"not-allowed":void 0,disabled:ei,w:"100%",pl:5,wrapStyles:{px:2}
1,fontSize:"md",placeholder:eu.ag._({id:"P8H57Z"}),transition:"width 1s ease-in-out",value:p,onKeyDown:e=>{let{key:t}=e;if("Backspace"===t&&0===p.length&&O.length>0){let e=O.slice(-1).pop();if(e){var i;null===(i=h.current)||void 0===i||i.removeItem("email"in e?e.email:e.id)}}},onPaste:e=>{e.preventDefault(),e.stopPropagation();let t=e.clipboardData.getData("Text"),i=t.trim().split(/[,|;\s]+/);$(i),j(""),v([])},onChange:e=>{let{target:t}=e,{value:i}=t;j(i),i||v([])},children:O.map((e,t)=>(0,r.jsx)(eJ.L,{idx:t,selectedCollaborator:e,handleRemoveClick:()=>{var t;null===(t=h.current)||void 0===t||t.removeItem(e.email)}},"id"in e?e.id:e.email))}),(0,r.jsx)(eT.Jm,{w:"100%",mt:0,display:p.length>0?"flex":"none",children:q.map(e=>{let{id:t,email:i,displayName:n,profileImageUrl:s}=e;return(0,r.jsx)(eT.Gb,{fixed:!0,"data-testid":"autocomplete-item-user-".concat(t),value:{email:i,type:"collaborator"},getValue:e=>e.email,align:"center",_focus:{bg:"trueblue.50"},children:(0,r.jsxs)(L.U,{children:[(0,r.jsx)(ed.q,{size:"sm",name:n,src:s}),(0,r.jsxs)(d.xu,{children:[(0,r.jsx)(z.x,{textTransform:"capitalize",children:n}),(0,r.jsx)(z.x,{fontSize:"xs",color:"gray.500",children:null==i?void 0:i.toLowerCase()})]})]})},t)}).concat((0,r.jsx)(eT.Gb,{value:{email:p,type:"collaborator"},align:"center",display:Y?"flex":"none",_focus:{bg:"trueblue.50"},children:(0,r.jsxs)(L.U,{children:[(0,r.jsx)(d.Cd,{bg:"trueblue.100",size:8,children:(0,r.jsx)(y.G,{icon:b.FU$})}),(0,r.jsx)(z.x,{size:"md",children:p})]})},p))})]}),(0,r.jsx)(eG.p,{in:J,unmountOnExit:!0,children:(0,r.jsx)(eA.x,{w:"auto",justifyContent:"flex-end",pr:1,children:(0,r.jsx)(eX,{isDisabled:U,options:[E.y3$.Manage,E.y3$.Edit,E.y3$.Comment,E.y3$.View],variant:"ghost",selected:I,onClick:e=>_(e)})})})]})}),(0,r.jsx)(eQ,{overflowX:"hidden",mr:-2,transition:"slow",animate:{maxWidth:J?"200px":"0px"},children:(0,r.jsx)(k.kH,{label:(0,r.jsx)(w.cC,{id:"Rxin92"}),"aria-label":eu.ag._({id:"Rxin92"}),isDisabled:!Z,placement:"top",children:(0,r.jsx)(d.xu,{children:(0,r.jsx)(g.z,{variant:"solid",onClick:et,isDisabled:!Q||Z,isLoading:U,"data-testid":"add-selected-items",children:(0,r.jsx)(w.cC,{id:"m16xKo"})})})})}),(0,r.jsx)(eL.C,{invitationCount:X.length,onDiscardClick:()=>{M(),A.resolve(),T(new eF.B)},onSendInvitationsClick:()=>{M(),et()},onClose:()=>{M(),A.reject(),T(new eF.B)},isOpen:G})]})},e2=e=>{let{title:t,subtitle:i,img:n,isDisabled:s=!1,disabledText:l,tooltipText:o,testId:a,infoIcon:c,permissionsControl:u,workspaceGuestInvite:x}=e,h="string"==typeof i?(0,r.jsx)(z.x,{fontSize:"xs",color:"gray.500",children:i}):i,m=(0,r.jsx)(k.kH,{isDisabled:!o,label:o,placement:"top",children:(0,r.jsx)(d.xu,{children:u})});return(0,r.jsxs)(L.U,{w:"100%",justify:"space-between",py:2,"data-testid":"permission-settings-row".concat(a?"-"+a:""),children:[(0,r.jsx)(d.xu,{children:(0,r.jsxs)(C.k,{alignItems:"center",children:[n,(0,r.jsxs)(d.xu,{ml:3,children:[(0,r.jsx)(z.x,{children:t}),(0,r.jsxs)(C.k,{align:"center",children:[x&&x,h&&h]})]})]})}),(0,r.jsx)(d.xu,{children:(0,r.jsx)(k.kH,{isDisabled:!o,label:(0,r.jsx)(z.x,{children:o}),placement:"top",children:s?(0,r.jsx)(z.x,{size:"sm",color:"gray.500","data-testid":"permission-controls-disabled-".concat(a),children:l}):c?(0,r.jsxs)(L.U,{children:[c,m]}):m})})]})},e5=e=>{let{children:t,showDivider:i=!0,...n}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(G.g,{spacing:1,align:"stretch",py:4,...n,children:t}),i&&(0,r.jsx)(u.i,{})]})},e4=e=>{let{subtitle:t,tooltipLabel:i,ariaLabel:n,icon:s}=e;return(0,r.jsxs)(L.U,{spacing:1,align:"center",children:[(0,r.jsx)(z.x,{fontSize:"xs",color:"gray.500",children:t}),(0,r.jsx)(k.kH,{label:i,placement:"top","aria-label":n,children:(0,r.jsx)(d.xu,{color:"gray.500",lineHeight:"1",children:(0,r.jsx)(y.G,{size:"xs",icon:s})})})]})};var e3=i(43679),e9=i(34071),e6=i(39429),e7=i(46164),e8=i(47154),te=i(48394);let tt=e=>{let{email:t,name:i,workspaceName:n,workspaceId:s}=e,[l]=(0,E.f4M)(),[o,a]=(0,S.useState)(!1),d=(0,W.p)();return(0,r.jsx)(e3.J,{closeOnBlur:!0,children:e=>{let{onClose:c}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e9.x,{children:(0,r.jsx)(g.z,{leftIcon:(0,r.jsx)(y.G,{icon:b.Gg}),size:"xs",colorScheme:"gray",mr:1,px:2,h:"auto",py:1,children:(0,r.jsx)(w.cC,{id:"O1wAlQ"})})}),(0,r.jsxs)(e6.y,{bg:"white",children:[(0,r.jsx)(e7.Q,{}),(0,r.jsx)(e8.Y,{fontWeight:"bold",children:(0,r.jsx)(w.cC,{id:"XYV7FR"})}),(0,r.jsxs)(te.b,{children:[(0,r.jsx)(z.x,{fontSize:"sm",children:(0,r.jsx)(w.cC,{id:"hJZ5XP",values:{name:i,workspaceName:n,GAMMA_ARTIFACT_PROPER_NOUN_PLURAL:F.aq}})}),(0,r.jsx)(g.z,{isDisabled:o,w:"100%",mt:2,onClick:()=>{s&&t&&(a(!0),l({variables:{workspaceId:s,invitees:[{email:t}]}}).then(()=>
1{d({title:eu.ag._({id:"oNCcm2"}),status:"success",duration:5e3,isClosable:!0,position:"top"})}).catch(e=>{console.error(e),d({title:eu.ag._({id:"h37zlR",values:{0:e.message}}),status:"error",isClosable:!0,position:"top"})}).finally(()=>{a(!1),c()}))},children:(0,r.jsx)(w.cC,{id:"qVqqmP"})})]})]})]})}})},ti=()=>({view:{subtitle:eu.ag._({id:"ihPQra"}),tooltip:(0,A.tN)()},comment:{subtitle:eu.ag._({id:"qPZYdC"}),tooltip:eu.ag._({id:"oKPro/",values:{0:(0,A.tN)()}})},edit:{subtitle:eu.ag._({id:"TVFcVE"}),tooltip:eu.ag._({id:"2gPY9r",values:{0:(0,A.tN)()}})}}),tn=(e,t)=>{var i,n;let r="DocCollaborator"===e.__typename?null===(i=e.user.displayName)||void 0===i?void 0:i.toUpperCase():"DocInvitation"===e.__typename?e.email.toUpperCase():"",s="DocCollaborator"===t.__typename?null===(n=t.user.displayName)||void 0===n?void 0:n.toUpperCase():"DocInvitation"===t.__typename?t.email.toUpperCase():"";return!s||r&&r<s?-1:!r||s&&r>s?1:0},tr=(e,t)=>{if(e.permission!==t.permission){if("manage"===e.permission)return -1;if("manage"===t.permission)return 1}return tn(e,t)},ts=e=>{var t,i,s;let{workspaceId:l,isFromOtherOrg:o,doc:a,user:c,setVerifySearchDone:u,canManage:x}=e,h=(0,ep.A)(ti),m=(0,W.p)(),[p,g]=(0,ev.I)(eb.H.hasDismissedDocWorkspaceNotice,!1),[j,f]=(0,S.useState)(!1),{isConnected:v}=(0,E.$gs)(),[I,{error:_}]=(0,E.qVw)(),[A,{error:O}]=(0,E.mrc)();(0,ef.GJ)("Error updating collaborator.",_),(0,ef.GJ)("Error removing collaborator.",O);let[P]=(0,E.rIg)(),[D]=(0,E.kTH)(),R=null==a?void 0:null===(t=a.accessLinks)||void 0===t?void 0:t[0],U=(0,S.useMemo)(()=>(0,eC.Gn)({docTitle:null==a?void 0:a.title,docId:null==a?void 0:a.id,token:null==R?void 0:R.token,absolute:!0}),[a,null==R?void 0:R.token]),H=x&&v,V=!o,B=(V&&(p||!a||a.orgAccess),!!(!(null==a?void 0:a.orgAccess)&&(null==a?void 0:a.channels)&&(null==a?void 0:a.channels.length)>0&&(null==a?void 0:a.channels.every(e=>eh()(e.permission))))),K=(null==a?void 0:a.orgAccess)==null&&(null==a?void 0:a.publicAccess)==E.y3$.View,q=(0,T.qw)(a),Y=(null==a?void 0:a.collaborators)||[],Z=(null==a?void 0:a.invitations)||[],X=Y.filter(e=>e.permission===E.y3$.Manage).length,J=[...Y,...Z].sort(tr),Q=e=>()=>{let t="updated"===e?eu.ag._({id:"Xpw8aE"}):eu.ag._({id:"jwO7L7"});m({title:t,status:"success",duration:5e3,isClosable:!0,position:"top"})},$=(null==R?void 0:R.permission)?null==R?void 0:R.permission:n.NoAccess,ee=$===n.NoAccess,et=(null==R?void 0:R.token)==="",ei=R&&R.permission!==E.y3$.View,en=a.orgAccess?a.orgAccess:n.NoAccess,er=en!==n.NoAccess;return(0,r.jsxs)(r.Fragment,{children:[H&&(0,r.jsx)(e1,{workspaceId:l,docId:a.id,user:c,existingDocCollaborators:Y,existingInvitations:Z,registerDoneFn:u,isDisabled:!x}),(0,r.jsx)(eg.V,{label:(0,r.jsx)(w.cC,{id:"i5bpoc"}),isConnected:v,mb:4}),(0,r.jsx)(z.x,{fontSize:"sm",color:"gray.600",pt:2,children:q}),(0,r.jsxs)(e5,{children:[!1,(0,r.jsx)(e2,{testId:"workspace",title:(0,r.jsx)(w.cC,{id:"wtxjAY"}),subtitle:er?eu.ag._({id:"aC87LX",values:{0:null==a?void 0:null===(i=a.organization)||void 0===i?void 0:i.name}}):"",img:(0,r.jsx)(ek,{icon:b.P88,showDisabled:!er}),isDisabled:!H,disabledText:eZ[en].title(),infoIcon:K?(0,r.jsx)(k.kH,{label:(0,r.jsx)(w.cC,{id:"paaewf",values:{GAMMA_ARTIFACT_PROPER_NOUN:F.Yc}}),placement:"top",children:(0,r.jsx)(d.xu,{color:"yellow.500",children:(0,r.jsx)(y.G,{icon:b.DBf})})}):void 0,permissionsControl:(0,r.jsx)(eX,{isDisabled:!H,selected:en,options:[E.y3$.Manage,E.y3$.Edit,E.y3$.Comment,E.y3$.View,n.NoAccess],onClick:e=>{let t={id:a.id,orgAccess:e===n.NoAccess?null:e};P({variables:t,optimisticResponse:{updateDoc:{...t,__typename:"Doc"}},refetchQueries:["GetDocs"]}).then(Q(e===n.NoAccess?"removed":"updated"))}})}),V&&(null===(s=a.channels)||void 0===s?void 0:s.map(e=>(0,r.jsx)(ew,{channel:e,doc:a,isDisabled:!v,showDisabledIcon:B},e.id))),!!a.orgAccess&&V&&!a.site&&!B&&(0,r.jsx)(d.xu,{w:"100%",mt:2,children:(0,r.jsx)(eD,{existingChannels:a.channels,workspaceId:l,docId:a.id,isDisabled:!v})}),(0,r.jsx)(eo.U,{in:V&&B,children:(0,r.jsxs)(N.b,{status:"warning",children:[(0,r.jsx)(M.z,{}),(0,r.jsx)(w.cC,{id:"RZRM4l",values:{GAMMA_ARTIFACT_PROPER_NOUN:F.Yc}})]})})]}),J&&(0,r.jsx)(e5,{showDivider:x,children:J.map(e=>
1{let t=e.permission===E.y3$.Manage&&X<2,i=!H||t,n=t?eu.ag._({id:"0q0LJR"}):void 0,s=eZ[e.permission].title();if("DocCollaborator"===e.__typename){var o;let t=e.user;return(0,r.jsx)(e2,{testId:t.email,title:"".concat(t.displayName," ").concat(t.id===c.id?eu.ag._({id:"dDUgzP"}):""),img:(0,r.jsx)(ed.q,{name:t.displayName,src:t.profileImageUrl,size:"sm"}),subtitle:i?void 0:t.email,isDisabled:i,disabledText:s,tooltipText:n,workspaceGuestInvite:!i&&e.guest?(0,r.jsx)(tt,{name:t.displayName,workspaceName:null===(o=a.organization)||void 0===o?void 0:o.name,workspaceId:l,email:e.user.email}):void 0,permissionsControl:(0,r.jsx)(eX,{isDisabled:i,selected:e.permission,options:[E.y3$.Manage,E.y3$.Edit,E.y3$.Comment,E.y3$.View],disabledOptions:e.guest?[{permission:E.y3$.Manage,reason:eu.ag._({id:"Rxin92"})}]:[],onClick:e=>{let i={docId:a.id,collaborators:[{userId:t.id,permission:e}]};I({variables:i,optimisticResponse:{addCollaborators:{id:i.docId,collaborators:Y.map(i=>({...i,permission:i.user.id===t.id?e:i.permission})),invitations:Z,__typename:"Doc"}}}).then(Q("updated")).catch(()=>{})},onRemove:()=>{let e={docId:a.id,collaborators:[{userId:t.id}]};A({variables:e,optimisticResponse:{removeCollaborators:{id:e.docId,collaborators:Y.filter(e=>e.user.id!==t.id),invitations:Z,__typename:"Doc"}}}).then(Q("removed"))}})},t.id)}return"DocInvitation"===e.__typename?(0,r.jsx)(e2,{testId:e.email,title:e.email,subtitle:eu.ag._({id:"MActeE"}),img:(0,r.jsx)(d.Cd,{bg:"trueblue.50",size:8,children:(0,r.jsx)(y.G,{icon:b.FU$,size:"sm"})}),isDisabled:i,disabledText:s,permissionsControl:(0,r.jsx)(eX,{selected:e.permission,options:[E.y3$.Manage,E.y3$.Edit,E.y3$.Comment,E.y3$.View],disabledOptions:[{permission:E.y3$.Manage,reason:eu.ag._({id:"Rxin92"})}],onClick:t=>{let i={docId:a.id,collaborators:[{email:e.email,permission:t}]};I({variables:i,optimisticResponse:{addCollaborators:{id:i.docId,invitations:Z.map(i=>({...i,permission:i.email===e.email?t:i.permission})),collaborators:Y,__typename:"Doc"}}}).then(Q("updated")).catch(()=>{console.warn("Error updating permission")})},onRemove:()=>{let t={docId:a.id,collaborators:[{email:e.email}]};A({variables:t,optimisticResponse:{removeCollaborators:{id:t.docId,invitations:Z.filter(t=>t.email!==e.email),collaborators:Y,__typename:"Doc"}}}).then(Q("removed"))}})},e.email):null})}),x&&(0,r.jsxs)(e5,{showDivider:!1,children:[(0,r.jsx)(e2,{title:(0,r.jsx)(w.cC,{id:"qZu20V"}
1),subtitle:ee?eu.ag._({id:"vMZPZT"}):(0,r.jsx)(e4,{subtitle:h[$].subtitle,tooltipLabel:h[$].tooltip,ariaLabel:h[$].subtitle,icon:b.DBf}),img:(0,r.jsx)(ek,{icon:b.nNP,showDisabled:ee}),isDisabled:!H,disabledText:eZ[$].title(),permissionsControl:(0,r.jsx)(eX,{selected:$,options:[E.y3$.Edit,E.y3$.Comment,E.y3$.View,n.NoAccess],onClick:e=>{let t=null==R?void 0:R.id,i={id:a.id,accessLinks:e===n.NoAccess?[{permission:null}]:[{permission:e}]};D({variables:i,optimisticResponse:{updateDoc:{...i,accessLinks:[{__typename:"AccessLink",id:t||"temp-id",permission:e===n.NoAccess?null:e}],__typename:"Doc"}}}).then(Q(e===n.NoAccess?"removed":"updated"))}})}),(0,r.jsxs)(eo.U,{animateOpacity:!0,in:!!(null==R?void 0:R.permission),children:[(0,r.jsx)(em.I,{url:U,customLabel:eu.ag._({id:"y1eoq1"}),onClick:()=>{(0,ej.J)({docId:a.id,source:"sharePanel",type:"tokenUrl"})}}),!et&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eo.U,{in:j,unmountOnExit:!0,children:(0,r.jsxs)(G.g,{mt:3,align:"stretch",spacing:4,bg:"gray.50",p:6,borderRadius:"md",children:[(0,r.jsxs)(L.U,{spacing:4,align:"center",children:[(0,r.jsx)(d.xu,{color:"purple.600",children:(0,r.jsx)(y.G,{fixedWidth:!0,icon:ec._1N})}),(0,r.jsx)(z.x,{fontSize:"sm",children:(0,r.jsx)(w.cC,{id:"asiJbp"})})]}),(0,r.jsxs)(L.U,{spacing:4,align:"center",children:[(0,r.jsx)(d.xu,{color:"purple.600",children:(0,r.jsx)(y.G,{fixedWidth:!0,icon:ec.Mdf})}),(0,r.jsx)(z.x,{fontSize:"sm",display:"inline-block",children:(0,r.jsx)(w.cC,{id:"+g8rkW",values:{GAMMA_ARTIFACT_PROPER_NOUN:F.Yc,GAMMA_PROPER_NOUN:F.N6}})})]}),ei&&(0,r.jsxs)(L.U,{spacing:4,align:"center",children:[(0,r.jsx)(d.xu,{color:"purple.600",children:(0,r.jsx)(y.G,{fixedWidth:!0,icon:ec.FKd})}),(0,r.jsx)(z.x,{fontSize:"sm",children:(0,r.jsx)(w.cC,{id:"NSCwrX",values:{GAMMA_PROPER_NOUN:F.N6,selectedAccessLinkPermission:$},components:{0:(0,r.jsx)(z.x,{as:"span",fontWeight:"bold"})}})})]})]})}),(0,r.jsx)(C.k,{justify:"center",alignItems:"center",my:3,children:(0,r.jsxs)(L.U,{spacing:1,as:"button",onClick:()=>f(!j),children:[j?(0,r.jsx)(y.G,{fixedWidth:!0,size:"xs",icon:b.onQ}):(0,r.jsx)(y.G,{fixedWidth:!0,size:"xs",icon:b.r8p}),(0,r.jsx)(z.x,{lineHeight:"normal",marginLeft:"auto",marginRight:"auto",fontSize:"xs",fontWeight:"medium",children:j?(0,r.jsx)(w.cC,{id:"BRvU04"}):(0,r.jsx)(w.cC,{id:"l0Ck42"})})]})})]})]})]})]})};var tl=i(50019);let to=e=>{let{visibility:t,isFromOtherOrg:i}=e,n=(0,tl.ff)("white","var(--chakra-colors-gray-900)");return(0,r.jsxs)(r.Fragment,{children:[i&&(0,r.jsx)(y.G,{icon:b.Gg}),(0,r.jsxs)(d.xu,{as:"span",className:"fa-layers fa-fw",children:[(0,r.jsx)(y.G,{icon:t.primaryIcon}),t.secondaryIcon&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.G,{icon:ec.diR,color:n,transform:"down-6 right-6"}),(0,r.jsx)(y.G,{icon:t.secondaryIcon,transform:"shrink-7 right-6 down-6"})]})]})]})};var ta=i(35183),td=i(41098),tc=i(26284),tu=i(29494);let tx="embed-copied-toast",th=e=>{let{embedCode:t,isDisabled:i,docId:n}=e,s=(0,W.p)(),[l,o]=(0,S.useState)(!1),{hasCopied:a,onCopy:d}=(0,tc.V)(t),c=(0,S.useRef)(null);(0,S.useEffect)(()=>{c.current&&l&&(c.current.focus(),c.current.select())},[l]);let u=(0,S.useCallback)(()=>o(!0),[]),x=(0,S.useCallback)(()=>o(!1),[]),h=(0,S.useCallback)(()=>{d(),s.isActive(tx)||s({id:tx,title:(0,r.jsx)(w.cC,{id:"ETv+Uw"}),status:"success",duration:5e3}),(0,ej.J)({docId:n,source:"sharePanel",type:"embed"})},[n,d,s]);return(0,r.jsxs)(G.g,{spacing:4,align:"stretch",children:[(0,r.jsx)(tu.g,{ref:c,rows:5,variant:"filled",fontFamily:"mono",colorScheme:"gray",disabled:i,onClick:u,onBlur:x,isReadOnly:!0,resize:"none",pointerEvents:i?"none":void 0,children:t}),(0,r.jsx)(g.z,{alignSelf:"flex-end",onClick:h,isDisabled:i,size:"sm",...i?{opacity:"1 !important",color:"gray.400",_hover:{opacity:"1"},_active:{boxShadow:"0 none"}}:{},children:a?(0,r.jsx)(w.cC,{id:"6V3Ea3"}):(0,r.jsx)(w.cC,{id:"Sx4kHi"})})]})},tm=e=>{let{doc:t,isSharePublic:i,isConnected:s,onSharePanelOpen:l,onSharePanelClose:o,editor:a}=e,c=(0,W.p)(),[u,x]=(0,S.useState)(!!t.publicAccess),[h]=(0,E.o6I)(),m=(0,S.useMemo)(()=>{let e=(0,eC.Gn)({docId:t.id,docTitle:t.title,path:"public",absolute:!0});return i?e:(0,eC.lT)({docId:t.id,docTitle:t.title})},[t.id,t.title,i]),p=(0,S.useCallback)(e=>{x(e.target.checked);let i={id:t.id,publicAccess:e.target.checked?E.y3$.View:null};h({variables:i,optimisticResponse:{updateDoc:{...i,__typename:"Doc"}}}).then(()=>
1{let t=e.target.checked?eu.ag._({id:"OnQp1B"}):eu.ag._({id:"e5veeL"});c({title:t,status:"success",duration:5e3,isClosable:!0,position:"top"})})},[t.id,c,h]),j=t.publicAccess?eZ[E.y3$.View].title():eZ[n.NoAccess].title(),f=i?(0,r.jsx)(w.cC,{id:"kGj/zu",values:{GAMMA_ARTIFACT_PROPER_NOUN:F.Yc},components:{0:(0,r.jsx)(z.x,{as:"span",borderBottom:"0.125em dashed",borderColor:"gray.400",cursor:"help"}),1:(0,r.jsx)(k.kH,{placement:"top",label:eu.ag._({id:"kni5pb",values:{GAMMA_ARTIFACT_PROPER_NOUN:F.Yc}}),"aria-label":"public access is read only"})}}):(0,r.jsx)(w.cC,{id:"RmtWc6",values:{GAMMA_ARTIFACT_PROPER_NOUN:F.Yc}});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.x,{fontSize:"sm",color:"gray.600",pt:2,children:f}),(0,r.jsx)(e5,{showDivider:!1,children:(0,r.jsx)(e2,{title:(0,r.jsx)(w.cC,{id:"YsO5Wf"}),testId:"public-access",subtitle:(0,r.jsx)(e4,{subtitle:(0,r.jsx)(w.cC,{id:"oEQSnD"}),tooltipLabel:(0,A.tN)(),ariaLabel:eu.ag._({id:"oEQSnD"}),icon:b.DBf}),img:(0,r.jsx)(ek,{icon:b.Xj}),isDisabled:!s,disabledText:j,permissionsControl:(0,r.jsx)(ta.NI,{children:(0,r.jsx)(td.r,{id:"public-access",isChecked:u,onChange:p})})})}),(0,r.jsx)(k.kH,{label:i?(0,r.jsx)(w.cC,{id:"RFk/SS"}):(0,r.jsx)(w.cC,{id:"4wpR4l"}),placement:"top",isDisabled:u,children:(0,r.jsx)(d.xu,{children:i?(0,r.jsx)(em.I,{isDisabled:!t.publicAccess,url:m,customLabel:eu.ag._({id:"FO91Ip"}),onClick:()=>{(0,ej.J)({docId:t.id,source:"sharePanel",type:"public"})}}):(0,r.jsx)(th,{embedCode:m,isDisabled:!u,docId:t.id})})}),i&&a&&(0,r.jsx)(z.x,{fontSize:"sm",color:"gray.500",mt:4,children:(0,r.jsx)(w.cC,{id:"a9n+CI",components:{0:(0,r.jsx)(g.z,{variant:"link",as:"span",size:"sm",cursor:"pointer",onClick:()=>{o(),ee.pw.emit(ee.TI.OPEN_PAGE_SETUP,"preview")}})}})}),(0,r.jsx)(ei.V,{onClose:o,onOpen:l,segmentEvent:Y.AA.GAMMA_PRO_UPSELL_SHARE_SETTINGS_REMOVE_WATERMARK,doc:t})]})},tp=e=>{var t;let{doc:i,editor:n,isSharePanelOpen:G,onSharePanelClose:z,onSharePanelOpen:N,onAnalyticsPanelOpen:M,view:L,setView:F,showAnalytics:U=!0,showSharePublic:W=!0,showEmbed:H=!0}=e,V=(0,_._O)(),{openSiteSettings:B}=(0,R.AA)(),K=(0,S.useRef)(!1),{user:q,currentWorkspace:Y}=(0,D.SE)(),{isConnected:Z}=(0,E.$gs)(),X=(0,D.py)("manage",i),J=(0,D.py)("comment",i),{isOpen:Q,onClose:$}=(0,I.M)({id:"create-site-modal"}),ee=i&&i.site&&i.site.routes.length>1,et=i&&(0,P.Vr)(i.site),ei=(0,A.ei)({showSharePublic:W&&X&&!et,showEmbed:H&&X&&!et}),er=X&&M&&i&&!et,[es,el]=(0,S.useState)(()=>()=>Promise.resolve()),eo=(0,S.useCallback)(()=>{z(),$()},[z,$]),ea=i?ee?i.site.name:i.title:null,ed=(0,S.useCallback)(()=>{es().then(()=>{F("invite"),z()},()=>{console.debug("[handleSharePanelClose] CollaboratorSearchBar rejected \uD83D\uDC4E\uD83C\uDFFC")})},[F,z,es]),ec=(0,S.useCallback)(()=>{M&&(z(),M())},[M,z]),eu=(0,S.useCallback)(()=>{B("domains"),z()},[z,B]);if(!q)return null;let ex=(0,T.h_)(i,q),eh=ex?(0,T.Xp)()[ex]:null,em=(0,T.Gi)(i,Y);if(i&&null===eh)return console.error("[SharePanel] Unknown VisibilityValue for doc",i),null;let ep=null==i?void 0:null===(t=i.organization)||void 0===t?void 0:t.id;return!i||ep||K.current||(console.error("[SharePanelModal] Doc unexpectedly doesnt have a workspaceId",{docId:i.id,organization:i.organization}),K.current=!0),(0,r.jsxs)(k.Wk,{isDark:!1,children:[(0,r.jsxs)(s.u_,{onEsc:ed,isOpen:G,onClose:z,trapFocus:!1,size:"3xl",returnFocusOnClose:!1,children:[(0,r.jsx)(l.Z,{}),(0,r.jsxs)(o.h,{"data-share-panel-modal-content":!0,mx:2,children:[(0,r.jsxs)(a.x,{children:[eh&&(0,r.jsx)(d.xu,{as:"span",mr:3,children:(0,r.jsx)(to,{visibility:eh,isFromOtherOrg:em})}),ea?(0,r.jsx)(w.cC,{id:"sit2to",values:{displayName:ea}}):(0,r.jsx)(w.cC,{id:"Z8lGw6"})]}),(0,r.jsx)(c.o,{"data-share-panel-close-button":!0,onClick:e=>{e.preventDefault(),ed()}}),(0,r.jsx)(u.i,{}),i?(0,r.jsx)(x.f,{pb:6,"data-testid":"share-panel-modal-body",children:i&&ep&&(0,r.jsxs)(r.Fragment,{children:[X&&(0,r.jsxs)(h.K,{direction:"row",children:[(0,r.jsx)(p.E,{my:4,children:ei.map(e=>{let{viewKey:t,icon:i,ariaLabel:n,label:s,isBeta:l}=e,o=L===t;return(0,r.jsx)(p.U,{children:(0,r.jsx)(g.z,{leftIcon:(0,r.jsx)(y.G,{icon:i,"aria-label":n}),variant:"ghost",size:"sm",fontWeight:"600",bg:o?"trueblue.50":"transparent",color:o?"trueblue.500":"gray.600",onClick:()=>F(t),rightIcon:l?(0,r.jsx)(j.C,{colorScheme:"green",children:(0,r.jsx)(w.cC,{id:"YBt9YP"})}):void 0,children:s})},t)})}),!(null==i?void 0:i.site)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.L,{}),(0,r.jsx)(g.z,{onClick:eu,variant:"plain",size:"sm",my:4,children:(0,r.jsx)(w.cC,{id:"wzvDe1"})})]})]}),(!J||"invite"==L)&&(0,r.jsx)(ts,{workspaceId:ep,doc:i,user:q,setVerifySearchDone:el,canManage:X,isFromOtherOrg:em,isMultipage:ee}),X&&("public"===L||"embed"===L)&&(0,r.jsx)(tm,{doc:i,isSharePublic:"public"==L,isConnected:Z,onSharePanelOpen:N,onSharePanelClose:z,editor:n}),J&&"export"===L&&(0,r.jsx)(en,{doc:i,editor:n,onSharePanelOpen:N,onSharePanelClose:z,isMultipage:ee})]})}):(0,r.jsx)(x.f,{pb:6,"data-testid":"share-panel-modal-body",children:(0,r.jsxs)(h.K,{children:[(0,r.jsx)(m.O,{height:"55px"}),(0,r.jsx)(m.O,{height:"55px"}),(0,r.jsx)(m.O,{height:"55px"}),(0,r.jsx)(m.O,{height:"55px"})]})}),(0,r.jsx)(u.i,{}),(0,r.jsx)(v.m,{children:(0,r.jsxs)(C.k,{justifyContent:"space-between",flex:1,children:[U&&er&&(0,r.jsx)(g.z,{isDisabled:!Z,leftIcon:(0,r.jsx)(y.G,{icon:b.Ma4}),variant:"ghost",onClick:ec,children:(0,r.jsx)(w.cC,{id:"YaUqUV"})}),(0,r.jsx)(f.L,{}),(0,r.jsx)(g.z,{onClick:e=>{e.preventDefault(),ed()},variant:"solid",children:(0,r.jsx)(w.cC,{id:"DPfwMq"})})]})})]})]}),(null==i?void 0:i.id)&&V&&X&&(0,r.jsx)(O.M,{isOpen:Q,onClose:eo,existingDoc:i})]})}},8174:function(e,t,i){"use strict";i.d(t,{Z:function(){return d}});var n=i(52322),r=i(70065),s=i(5879),l=i(2784),o=i(93202),a=i(94199);let d=()=>{let e=(0,r.p)(),[t]=(0,o.yx3)({refetchQueries:["GetChannelDocActivity","GetChannels"]}),i=(0,l.useCallback)(i=>{let{docId:r,doc:l,channel:d,existingChannels:c=[]}=i,u=r||(null==l?void 0:l.id);if(!u){console.error("Invalid docid");return}let x={input:{docId:u,sharing:[{op:o.Bdm.Add,path:"/channels",value:[{channelId:d.id}]}]}},h=(null==l?void 0:l.title)||a.Yc,m=[...c,{id:d.id,slug:d.slug,name:d.name,permission:o.y3$.Comment}].sort((e,t)=>
1e.slug.localeCompare(t.slug,"en"));t({variables:x,update:(e,t)=>{let{data:i}=t;e.writeFragment({id:"Doc:".concat(u),fragment:o.IiT,data:null==i?void 0:i.updatePublicChannels})},optimisticResponse:{updatePublicChannels:{id:x.input.docId,channels:m}}}).then(()=>{e({title:(0,n.jsx)(s.cC,{id:"7hDHpt",values:{title:h}}),description:(0,n.jsx)(s.cC,{id:"A2xcFn",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc,0:d.name}}),status:"success",duration:5e3,isClosable:!0,position:"top"})},t=>{e({title:(0,n.jsx)(s.cC,{id:"bLdU0Q",values:{title:h,0:d.name}}),description:t.message,duration:null,status:"error",isClosable:!0,position:"top"})})},[t,e]),d=(0,l.useCallback)((i,r)=>{var l;if(!r)return;let d={input:{docId:i.id,sharing:[{op:o.Bdm.Remove,path:"/channels",value:[{channelId:r}]}]}};t({variables:d,update:(e,t)=>{let{data:n}=t;e.writeFragment({id:"Doc:".concat(i.id),fragment:o.P6u,data:null==n?void 0:n.updatePublicChannels})},optimisticResponse:{updatePublicChannels:{id:d.input.docId,channels:null===(l=i.channels)||void 0===l?void 0:l.filter(e=>e.id!==r)}}}).then(()=>{e({title:(0,n.jsx)(s.cC,{id:"qsnpV6",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}),status:"success",duration:1e4,position:"top"})}).catch(t=>{e({title:(0,n.jsx)(s.cC,{id:"+yMzgs"}),description:t.message,status:"error",duration:3e3,isClosable:!0,position:"top"}),console.error("[addRemoveDocChannel] Error removing channel:",t.message)})},[t,e]);return{addDocChannel:i,removeDocChannel:d}}},16710:function(e,t,i){"use strict";i.d(t,{Gi:function(){return c},Xp:function(){return h},h_:function(){return m},nZ:function(){return j},qw:function(){return p},uG:function(){return f}});var n=i(52322),r=i(42946),s=i(5879),l=i(87254),o=i(94199),a=i(30579),d=i(78462);let c=(e,t)=>{var i;return(null==e?void 0:null===(i=e.organization)||void 0===i?void 0:i.id)!==(null==t?void 0:t.id)},u={PRIVATE:"private",LINK_VIEW:"link-view",LINK_COMMENT:"link-comment",LINK_EDIT:"link-edit",INDIVIDUAL:"individual",ORG_VIEW:"org-view",ORG_COMMENT:"org-comment",ORG_EDIT:"org-edit",ORG_MANAGE:"org-manage",CHANNEL_PRIVATE:"channel-private",PUBLIC:"public"},x=[u.ORG_VIEW,u.ORG_COMMENT,u.ORG_EDIT,u.ORG_MANAGE],h=()=>({[u.PRIVATE]:{title:()=>l.ag._({id:"IZiYjM",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}),subtitle:()=>l.ag._({id:"nHujJB",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}),primaryIcon:r.byT},[u.LINK_VIEW]:{title:()=>l.ag._({id:"Pb5t/X",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}),primaryIcon:r.nNP},[u.LINK_COMMENT]:{title:()=>l.ag._({id:"FUtIA5",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}),primaryIcon:r.nNP},[u.LINK_EDIT]:{title:()=>l.ag._({id:"tNOSZi",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}),primaryIcon:r.nNP},[u.INDIVIDUAL]:{title:()=>l.ag._({id:"IB6oAl",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}),subtitle:e=>"".concat(e," can access this ").concat(o.Yc,"."),primaryIcon:r.ILF},[u.ORG_VIEW]:{title:e=>l.ag._({id:"S+losC",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc,org:e}}),primaryIcon:r.P88,secondaryIcon:r.Mdf},[u.ORG_COMMENT]:{title:e=>l.ag._({id:"acq2w5",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc,org:e}}),primaryIcon:r.P88,secondaryIcon:r.Mzg},[u.ORG_EDIT]:{title:e=>l.ag._({id:"FFdz7p",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc,org:e}}),primaryIcon:r.P88,secondaryIcon:r.TzT},[u.ORG_MANAGE]:{title:e=>l.ag._({id:"3yNlmN",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc,org:e}}),primaryIcon:r.P88},[u.CHANNEL_PRIVATE]:{title:()=>l.ag._({id:"Tw6Jzi"}),primaryIcon:a.Ty},[u.PUBLIC]:{title:()=>l.ag._({id:"NMHF69",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}),primaryIcon:r.Xj}}),m=(e,t)=>{var i;if(!e)return null;let n=(null==e?void 0:e.publicAccess)?u.PUBLIC:(null==e?void 0:e.orgAccess)==="manage"?u.ORG_MANAGE:(null==e?void 0:e.orgAccess)==="edit"?u.ORG_EDIT:(null==e?void 0:e.orgAccess)==="comment"?u.ORG_COMMENT:(null==e?void 0:e.orgAccess)==="view"?u.ORG_VIEW:(null==e?void 0:e.channels)&&e.channels.some(e=>null!==e.permission)?u.CHANNEL_PRIVATE:(null==e?void 0:e.collaborators)&&(null==e?void 0:null===(i=e.collaborators)||void 0===i?void 0:i.length)>1?u.INDIVIDUAL:(null==e?void 0:e.accessLinks)&&e.accessLinks.some(e=>
1"view"===e.permission&&""===e.token)?u.LINK_VIEW:(null==e?void 0:e.accessLinks)&&e.accessLinks.some(e=>"comment"===e.permission&&""===e.token)?u.LINK_COMMENT:(null==e?void 0:e.accessLinks)&&e.accessLinks.some(e=>"edit"===e.permission&&""===e.token)?u.LINK_EDIT:f(e,t)?u.PRIVATE:u.INDIVIDUAL;return n},p=e=>(null==e?void 0:e.publicAccess)?l.ag._({id:"gJUdlS",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}):(null==e?void 0:e.orgAccess)?l.ag._({id:"5Ma3Lv",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}):l.ag._({id:"QbKKqw",values:{GAMMA_ARTIFACT_PROPER_NOUN:o.Yc}}),g=(e,t,i)=>{var l,o;if(!t)return[];let h=(null==e?void 0:null===(l=e.channels)||void 0===l?void 0:l.map(e=>{let{id:t,name:i,slug:n}=e;return{id:t,label:i,href:(0,d.j)({id:t,slug:n}),icon:a.Ty}}))||[],p=m(e,t),g=c(e,i),j=g?[{id:"shared-from-external-org",label:(null==e?void 0:null===(o=e.organization)||void 0===o?void 0:o.name)?(0,n.jsx)(s.cC,{id:"lFZJ+N",values:{0:e.organization.name}}):(0,n.jsx)(s.cC,{id:"qn35Ez"}),icon:r.Gg,color:"gray.500"}]:[];if(p===u.PUBLIC)return[{id:"public",label:(0,n.jsx)(s.cC,{id:"7d1a0d"}),icon:r.Xj,color:"gray.500"},...j,...h];if(p===u.PRIVATE)return[{id:"private",label:(0,n.jsx)(s.cC,{id:"zwBp5t"}),icon:r.byT,color:"gray.500"},...j];if(p===u.INDIVIDUAL){let i=(e.collaborators||[]).filter(e=>e.user.id!==t.id).length;return[{id:"collaborators",label:(0,n.jsx)(s.cC,{id:"o2NxSP",values:{numCollaborators:i}}),icon:r.ILF,color:"gray.500"},...j]}return g?j:p&&x.includes(p)?[{id:"workspace",label:(0,n.jsx)(s.cC,{id:"0Gd0NU"}),icon:r.P88,color:"gray.500"},...j,...h]:h},j=e=>{let{doc:t,user:i,currentWorkspace:n,channelToExclude:r}=e;return g(t,i,n).filter(e=>e.id!==r)},f=(e,t)=>{var i;return e&&t&&!e.orgAccess&&!e.publicAccess&&(null===(i=e.createdBy)||void 0===i?void 0:i.id)===t.id}},46759:function(e,t,i){"use strict";i.d(t,{M:function(){return _}});var n=i(52322),r=i(70065),s=i(92850),l=i(26468),o=i(22226),a=i(54326),d=i(2338),c=i(97217),u=i(43297),x=i(35183),h=i(97166),m=i(85573),p=i(50250),g=i(75768),j=i(62614),f=i(94523),v=i(5879),C=i(87254),b=i(5632),y=i(2784),k=i(93202),w=i(83669),S=i(1504
11),E=i(36651),I=i(78462);let _=e=>{var t;let{isOpen:i,onClose:_,existingDoc:A}=e,T=(0,r.p)(),O=(0,y.useRef)(null),[P,D]=(0,y.useState)(!1),{currentWorkspace:R}=(0,E.SE)(),[G,z]=(0,y.useState)(""),[N]=(0,k.V$$)(),[M]=(0,k.So6)(),L=(0,w.b)(),{push:F}=(0,b.useRouter)(),U=(0,y.useCallback)(async()=>{if(null==A?void 0:A.id){await (0,S.iL)(A.id),D(!0);try{var e,t;let{data:i}=await M({variables:{duplicateDocInput:{sourceDocId:A.id,source:k.L17.SitesCopyToSite,title:(null==A?void 0:A.title)||C.ag._({id:"wja8aL"}),orgId:null==R?void 0:R.id,orgAccess:k.y3$.Manage,themeId:null}}}),n=null==i?void 0:null===(e=i.duplicateDoc)||void 0===e?void 0:e.id;if(!n){console.error("[CreateSiteModal] Failed to duplicate doc with id",A.id);return}let{data:r}=await N({variables:{input:{workspaceId:null==R?void 0:R.id,name:G,routes:[{docId:n,path:"/"}],themeId:null==A?void 0:null===(t=A.theme)||void 0===t?void 0:t.id}}}),s=null==r?void 0:r.createSite;if(!s){console.error("[CreateSiteModal] Failed to create site, no site returned");return}let l=(0,I.yQ)({docId:n});F(l),_()}catch(e){T({status:"error",title:(0,n.jsx)(v.cC,{id:"Pdboh4"}),description:(0,n.jsx)(v.cC,{id:"c6YG3V"})}),console.error(e)}D(!1)}},[N,null==R?void 0:R.id,M,null==A?void 0:A.id,null==A?void 0:null===(t=A.theme)||void 0===t?void 0:t.id,null==A?void 0:A.title,G,F,T]),W=(0,y.useCallback)(async()=>{D(!0);let{data:e}=await N({variables:{input:{workspaceId:null==R?void 0:R.id,name:G,routes:[]}}}),t=null==e?void 0:e.createSite;if(!t){console.error("[CreateSiteModal] Failed to create site, no site returned");return}L({siteId:null==t?void 0:t.id,routes:null==t?void 0:t.routes,title:"Home",path:"/"})},[L,N,null==R?void 0:R.id,G]),H=(0,y.useCallback)(async()=>(null==A?void 0:A.id)?U():W(),[null==A?void 0:A.id,U,W]),V=G.length>0;return(0,n.jsx)(f.Wk,{isDark:!1,children:(0,n.jsxs)(s.u_,{isOpen:i,onClose:_,initialFocusRef:O,size:"2xl",children:[(0,n.jsx)(l.Z,{}),(0,n.jsxs)(o.h,{children:[(0,n.jsx)(a.x,{children:(0,n.jsx)(v.cC,{id:"JHMOcq"})}),(0,n.jsx)(d.o,{}),(0,n.jsx)(c.f,{children:(0,n.jsx)(u.K,{spacing:4,children:(0,n.jsxs)(x.NI,{children:[(0,n.jsx)(h.l,{children:(0,n.jsx)(v.cC,{id:"Lve3H6"})}),(0,n.jsx)(m.I,{ref:O,placeholder:C.ag._({id:"tlD7N3"}),onChange:e=>{z(e.target.value)},onKeyDown:e=>{V&&"Enter"===e.key&&H()}})]})})}),(0,n.jsx)(p.m,{children:(0,n.jsxs)(g.h,{children:[(0,n.jsx)(j.z,{variant:"ghost",onClick:_,children:(0,n.jsx)(v.cC,{id:"dEgA5A"})}),(0,n.jsx)(j.z,{variant:"solid",onClick:H,isDisabled:!V,isLoading:P,children:(0,n.jsx)(v.cC,{id:"JHMOcq"})})]})})]})]})})}},83669:function(e,t,i){"use strict";i.d(t,{b:function(){return x}});var n=i(5632),r=i(2784),s=i(93202),l=i(84405),o=i(87978),a=i(41425),d=i(23147),c=i(21733),u=i(78462);let x=()=>{let{user:e,currentWorkspace:t}=(0,c.SE)(),[i]=(0,s.CsQ)(),[x]=(0,s.qbt)(),{push:h}=(0,n.useRouter)(),m=(0,r.useCallback)(async n=>{let{title:r,path:c,siteId:m,routes:p}=n;if(!c.startsWith("/")){console.error("[AddNewPageToSite] Path must start with /. Aborting.",c);return}if(!(null==t?void 0:t.id)||!m||!p)return;let g=(0,o.R$)({settings:{defaultFullBleed:"full"},docFlags:{cardLayoutsEnabled:!0}}),j=(0,d.qI)(g),{data:f}=await i({variables:{workspaceId:null==t?void 0:t.id,title:r,source:s.L17.SitesAddPage,initialContent:{ydoc:j,schemaVersion:a.bI,editors:[null==e?void 0:e.id]},orgAccess:s.y3$.Manage,mainPage:"/"===c}}),v=null==f?void 0:f.createDoc.id;if((0,l.Q)({doc_id:v,source:s.L17.SitesAddPage,channel:null}),!m||!v){console.error("[AddPageModal] Site or doc id is undefined. Cannot add route.");return}await x({variables:{input:{siteId:m,docId:v,path:c,offline:!1}},refetchQueries:["GetSite"]});let C=(0,u.yQ)({docId:v});return console.debug("[AddPageModal] Doc created. Adding route then navigating to editor",v),await h(C),v},[null==t?void 0:t.id,e,i,x,h]);return m}},56745:function(e,t,i){"use strict";i.d(t,{z:function(){return t_}});var n=i(52322),r=i(70065),s=i(32981),l=i(26468),o=i(73751),a=i(54326),d=i(38035),c=i(77533),u=i(28535),x=i(75768),h=i(62614),m=i(97217),p=i(2338),g=i(42822),j=i(81540),f=i(94523),v=i(5879),C=i(87254),b=i(18149),y=i.n(b),k=i(2784),w=i(43997),S=i(93202),E=i(11050),I=i(47968),_=i(36651),A=i(93441),T=i(47749),O=i(36371),P=i(73582),D=i(2969),R=i(29117),G=i(3181),z=i(13272),N=i(84010),M=i(42946),L=i(54933),F=i(49929),U=i(66625),W=i(94199),H=i(91994),V=i(87978),B=i(46409),K=i(49354),q=i(96933),Y=i(20678),Z=i(29318),X=i(887),J=i(66479),Q=i(20437),$=i(30233),ee=i(26838);let et=(0,k.memo)(e=>{let{theme:t,onThemeClick:i,onSelectClick:r}=e,{data:s,loading:l}=(0,S.BCl)({variables:{workspaceId:null,archived:!1},fetchPolicy:"cache-first",nextFetchPolicy:"cache-only"}),o=(null==s?void 0:s.themes)||[];return(0,n.jsxs)(n.Fragment,{children:[l?(0,n.jsx)($.S,{size:4}):(0,n.jsx)(u.xu,{flex:1,p:6,children:(0,n.jsx)(Q.M,{columns:{base:1,lg:2},spacing:1,children:[...o].sort(J.qb).map(e=>(0,n.jsx)(ee.o,{type:"standard",theme:e,isChecked:e.id===t.id,onThemeClicked:i,variant:"ghost"},e.id))})}),(0,n.jsx)(d.k,{pos:"sticky",bottom:0,px:6,py:4,alignItems:"center",bg:"white",children:(0,n.jsx)(h.z,{"data-testid":"select-this-theme",flex:1,variant:"solid",leftIcon:(0,n.jsx)(F.G,{icon:M.JyM}),onClick:r,children:(0,n.jsx)(v.cC,{id:"UJfhAS"})})})]})});var ei=i(5200),en=i(41004),er=i(25925),es=i(50521);let el=(0,en.E)(u.xu),eo={enter:e=>({position:"absolute",width:"100%",x:"push"===e?"100%":"-100%",opacity:0}
1),center:{width:"100%",position:"static",x:0,opacity:1},exit:e=>({width:"100%",position:"absolute",x:"push"===e?"-100%":"100%",opacity:0})},ea=e=>{let{containerProps:t,motionProps:i,InitialComponent:r}=e,[s,l]=(0,k.useState)(r?[r]:[]),o=(0,k.useRef)("push"),a=(0,k.useCallback)(()=>{o.current="pop",l([...s.slice(0,-1)])},[s]),d=(0,k.useCallback)(e=>{o.current="push",l([...s,e])},[s]),c=s[s.length-1];return((0,k.useEffect)(()=>{0===s.length&&r&&d(r)},[r,d,s]),c)?(0,n.jsx)(es.m.Provider,{value:{push:d,pop:a},children:(0,n.jsx)(u.xu,{...t||{},position:"relative",children:(0,n.jsx)(er.M,{initial:!1,custom:o.current,children:(0,n.jsx)(el,{variants:eo,custom:o.current,initial:"enter",animate:"center",exit:"exit",transition:{default:{duration:.2}},...i||{},children:(0,n.jsx)(c,{})},s.length)})})}):null};var ed=i(25585),ec=i(97010),eu=i(82655),ex=i(42111),eh=i(43297),em=i(35183),ep=i(97166),eg=i(82713),ej=i(24213),ef=i(71272);let ev=e=>e.replace(/^\d+\.\s*/,"").replaceAll(/\s/g,"-").toLowerCase(),eC={width:"100%",variant:"unstyled",borderRadius:"revert",height:"revert",justifyContent:"flex-start"},eb=(0,k.memo)(e=>{let{icon:t,label:i,onClick:r,...s}=e;return(0,n.jsxs)(d.k,{"data-testid":"theme-config-menu-button-".concat(ev(i)),as:h.z,...eC,onClick:r,p:4,borderBottomWidth:"1px",_hover:{bg:"trueblue.50"},...s,children:[(0,n.jsx)(u.xu,{color:"trueblue.500",children:(0,n.jsx)(F.G,{icon:t,fixedWidth:!0})}),(0,n.jsx)(u.xu,{fontWeight:"600",ml:2,mr:"auto",children:i}),(0,n.jsx)(u.xu,{color:"gray.600",children:(0,n.jsx)(F.G,{icon:M._tD})})]})});eb.displayName="ThemeConfigNavigationMenuButton";let ey=e=>{let{label:t,onBackClick:i,children:r}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(d.k,{"data-testid":"theme-config-back-button",as:h.z,...eC,p:4,borderBottomWidth:"1px",bg:"gray.50",_hover:{bg:"gray.200"},onClick:i,children:[(0,n.jsx)(u.xu,{color:"gray.600",mr:2,children:(0,n.jsx)(F.G,{icon:M.A35})}),(0,n.jsx)(u.xu,{fontWeight:"600",children:t})]}),(0,n.jsx)(u.xu,{children:r})]})};var ek=i(47443),ew=i(52929),eS=i(37164),eE=i(99787),eI=i(16494),e_=i(29596),eA=i(40520),eT=i(64743);let eO=e=>(0,eT.bH)(e)&&(0,eT.Rr)(e),eP=e=>{let{setBackground:t,background:i,defaultMessage:r,isDark:s,isValidSource:l}=e,[o,a]=(0,k.useState)(eE.hq.key),d=e_.ah[o],c=(0,k.useCallback)(e=>l?l(e)&&eO(e):eO(e),[l]),u=(0,k.useCallback)(e=>{t({...i,...e})},[i,t]);return(0,n.jsx)(eA.O,{isDark:s,isValidSource:c,defaultMessage:r,currentBackground:i,currentSource:d,updateCurrentBackground:u,setCurrentSourceKey:a,currentSourceKey:o,editType:"themeBackgroun
1d"})};var eD=i(13793);i(38095);var eR=i(17993),eG=i(75009),ez=i(32899),eN=i(91710),eM=i(97253),eL=i(87205);i(65331),i(41779);let eF=e=>{let{uploadedImages:t,setUploadedImages:i,setIsLoading:s}=e,l=(0,H.CG)(I.KV),{currentWorkspace:o}=(0,_.SE)(),{orgId:a,templateId:d}=(0,Z.Ds)(l||(null==o?void 0:o.id),"themeBackground"),u=(0,r.p)(),[x,h]=(0,k.useState)(0),[m,p]=(0,k.useState)(!1),g=(0,k.useCallback)(e=>{let{file:t,tempUrl:n}=e;s(!0);let r=n;if(t.type&&(0,eL.Ns)(t.type)){let e="HEIC_tempId_".concat((0,eS.x0)());r=e}i(e=>[...e,{tempUrl:r,name:t.name,src:null,showPlaceholder:!0,uploadStatus:eI.D.Uploading}])},[s,i]),j=(0,k.useCallback)(e=>{i(t=>{let i=t.map(t=>t.name===e.name?{...t,...(0,eM.gM)({result:e,isError:!1})}:t);return i}),h(e=>e+1)},[i]);(0,k.useEffect)(()=>{s(!t.every(e=>"optimized"===e.uploadResultStep))},[s,t]);let b=(0,k.useCallback)(()=>{u({title:"Error uploading images, please try again",status:"error",duration:3e3,isClosable:!0}),h(e=>e+1)},[u]),y=(0,k.useMemo)(()=>{if(!a)throw Error("Tried uploading an image with no orgId");return eE.ND.createUppyInstance(a,{onUploadStart:g,onUploadComplete:j,onUploadFailed:b}
1,"themeBackground",50,"image",d)},[x,a,g,j,b,d]),w=()=>(0,n.jsx)(n.Fragment,{children:a&&(0,n.jsx)(eN.v0,{width:"100%",height:"100%",note:C.ag._({id:"x4Ts51"}),uppy:y,locale:{strings:{browse:C.ag._({id:"wZ9s+A"})}}})});return t.length>0?(0,n.jsxs)(eR.g,{align:"flex-start",spacing:4,onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),p(!0)},children:[m&&(0,n.jsx)(w,{}),(0,n.jsx)(Q.M,{gap:2,columns:{base:2,"2xl":3},children:t.map(e=>{let{src:t,meta:r,name:s,tempUrl:l}=e||{},o=t?(0,eL.aN)(t,{width:500}):void 0;return(0,n.jsxs)(eh.K,{spacing:1,position:"relative",role:"group",children:[(0,n.jsx)(eG.E,{src:o||l||"",alt:"",ignoreFallback:!0,borderRadius:"md"}),(0,n.jsx)(f.kH,{label:(0,n.jsx)(v.cC,{id:"ZTnXof"}),placement:"top",children:(0,n.jsx)(ez.h,{"aria-label":C.ag._({id:"Rz0Yis"}),icon:(0,n.jsx)(F.G,{icon:M.XAH}),onClick:()=>{i(t=>{let i=t.filter(t=>t.name!==e.name);return i})},isRound:!0,position:"absolute",top:1,right:1,size:"sm",color:"red.600",opacity:0,_hover:{color:"red.600"},_groupHover:{opacity:1}})}),r&&r.width&&r.height&&(0,n.jsxs)(c.x,{fontSize:"xs",children:[r.width,"\xd7",r.height,"px"]}),s&&(0,n.jsx)(c.x,{fontSize:"xs",lineHeight:4,children:s})]},e.tempUrl)})})]}):(0,n.jsx)(w,{})};var eU=i(53701);let eW=e=>e.backgroundType!==eD.E.NONE,eH={...K.Gx,accentId:void 0},eV=e=>{let{theme:t,updateTheme:i}=e,[r,s]=(0,k.useState)(!1),[l,o]=(0,k.useState)(null),[a,d]=(0,k.useState)(null),u=l&&!!l.accentId,m=t.config.accentBackgrounds,p=(0,ex.ye)("bulkUploadAccentImages"),g=(0,k.useCallback)(()=>{d(eH),o(eH)},[]),j=(0,k.useCallback)(()=>{o(null),d(null)},[]),f=(0,k.useCallback)(e=>{let t=e||l;if(!t)return;let n={...t,source:T.cx,originalSource:t.source,accentId:(0,eS.x0)()},r=m||[];if(u){let e=r.findIndex(e=>e.accentId===l.accentId);if(-1===e){console.warn("[AccentImagePicker] Could not find accent image to edit");return}i({accentBackgrounds:[...r.slice(0,e),n,...r.slice(e+1)]})}else i({accentBackgrounds:[...r,n]});j()},[m,l,u,j,i]),b=(0,k.useCallback)(e=>{let t=(m||[]).filter(t=>t.accentId!==e.accentId);i({accentBackgrounds:t})},[m,i]),w=(0,k.useCallback)(e=>{let t={...e,source:e.originalSource};d(t),o({...e,source:e.originalSource})},[]),S=(0,k.useCallback)(e=>{if(e.source===eE.hq.key||e.source===eE.$5.key){f(e);return}if(e.source===eE.in.key){var t,i,n,r;(null===(t=e.image)||void 0===t?void 0:t.uploadStatus)===eI.D.Uploading?s(!0):(null===(i=e.image)||void 0===i?void 0:i.uploadStatus)===eI.D.Done&&(null===(n=e.image)||void 0===n?void 0:n.uploadResultStep)==="optimized"?s(!1):(null===(r=e.image)||void 0===r?void 0:r.uploadStatus)===eI.D.Error&&s(!1)}o(e)},[f]),E=(0,k.useMemo)(()=>!y()(l,a),[l,a]),I=(0,J.wj)(t),[_,A]=(0,k.useState)([]),[O,P]=(0,k.useState)(!1),D=(0,k.useCallback)(()=>{A([]),P(!1)},[]),R=(0,k.useCallback)(()=>{let e=_.map(e=>({type:eD.E.IMAGE,source:T.cx,originalSource:"image.custom",image:e,accentId:(0,eS.x0)()})),t=m||[];i({accentBackgrounds:[...e,...t]}),D()},[_,m,i,D]);return l?(0,n.jsxs)(eh.K,{p:6,children:[(0,n.jsx)(eP,{setBackground:S,background:l,isValidSource:eW,defaultMessage:(0,n.jsxs)(ek.b,{children:[(0,n.jsx)(ew.z,{}),(0,n.jsx)(v.cC,{id:"VPwqDS"})]}),isDark:I}),(0,n.jsxs)(x.h,{pt:6,display:"flex",children:[(0,n.jsx)(h.z,{variant:"ghost",onClick:j,children:(0,n.jsx)(v.cC,{id:"dEgA5A"})}),(0,n.jsx)(h.z,{variant:"solid",onClick:()=>f(),isLoading:r,isDisabled:!E,flex:1,children:u?(0,n.jsx)(v.cC,{id:"tfDRzk"}):(0,n.jsx)(v.cC,{id:"B6vyEa"})})]})]}):(0,n.jsxs)(eh.K,{spacing:6,children:[(0,n.jsxs)(eh.K,{spacing:3,p:6,children:[(0,n.jsx)(h.z,{leftIcon:(0,n.jsx)(F.G,{icon:M.r8p}),alignSelf:"flex-start",onClick:g,children:(0,n.jsx)(v.cC,{id:"5phU36"})}),(0,n.jsxs)(ek.b,{fontSize:"xs",children:[(0,n.jsx)(ew.z,{}),(0,n.jsx)(c.x,{children:(0,n.jsx)(v.cC,{id:"M6esHH"})})]}),p&&(0,n.jsx)(eF,{uploadedImages:_,setUploadedImages:A,setIsLoading:P}),m&&0!=m.length&&(0,n.jsx)(eU.U,{accentImages:m,isDark:I,handleDelete:b,handleItemClick:w})]}),_.length>0&&(0,n.jsxs)(x.h,{display:"flex",w:"100%",position:"sticky",bottom:0,left:0,bg:"white",py:3,px:6,borderTop:"1px",borderColor:"gray.300",children:[(0,n.jsx)(h.z,{variant:"ghost",onClick:D,children:(0,n.jsx)(v.cC,{id:"dEgA5A"})}),(0,n.jsx)(h.z,{variant:"solid",onClick:R,isLoading:O,flex:1,children:(0,n.jsx)(v.cC,{id:"1rLekk",values:{0:_.length,1:C.ag._({id:"BZPFHo",values:{0:_.length}})}})})]})]})};var eB=i(85573),eK=i(29494),eq=i(63176),eY=i(99793),eZ=i(12985);let eX=async(e,t,n)=>{try{let n=(await Promise.all([i.e(5489),i.e(4751)]).then(i.bind(i,89089))).default,r=(await Promise.all([i.e(5489),i.e(9224)]).then(i.bind(i,30058))).default,s=n.parse(e),l=r.objectify(s);t(l)}catch(e){n(e.message)}},eJ=async(e,t,n)=>{try{let n=(await Promise.all([i.e(5489),i.e(4751)]).then(i.bind(i,89089))).default,r=(await Promise.all([i.e(5489),i.e(9224)]).then(i.bind(i,30058))).default;n().process(e,{parser:r}).then(e=>{let{css:i}=e;t(i)})}catch(e){n(e.message)}},eQ=e=>{let{label:t,initialValue:r,updateValue:s,helperText:l}=e,[o,a]=(0,k.useState)(""),[d,c]=(0,k.useState)(null),[x,h]=(0,k.useState)(),m=(0,A.Kt)(eX,100);return((0,k.useEffect)(()=>{Promise.all([i.e(8917),i.e(7120),i.e(6214)]).then(i.bind(i,96214)).then(e=>{h(e.css())})},[]),(0,A.vm)(()=>{c(null),r&&eJ(r,a,c)},[r],[]),(0,A.vm)(()=>{c(null),m(o,s,c)},[o,s,m],[o]),x)?(0,n.jsxs)(em.NI,{isInvalid:!!d,children:[(0,n.jsx)(ep.l,{children:t}),d&&(0,n.jsx)(eY.J1,{children:d}),l&&(0,n.jsx)(em.Q6,{children:l}),(0,n.jsx)(u.xu,{border:"1px solid",borderColor:"gray.200",fontSize:"md",children:(0,n.jsx)(k.Suspense,{fallback:(0,n.jsx)("span",{}),children:(0,n.jsx)(eZ.B,{value:o,height:"300px",extensions:[x],onChange:a})})})]}):null};var e$=i(8624),e0=i(10625),e1=i(67046),e2=i(99058),e5=i(39237),e4=i(89098);let e3=e=>{let{theme:t,dispatch:i}=e,r=(0,e4.c)(t);
1return(0,n.jsxs)(em.NI,{children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(v.cC,{id:"x5htAS"})}),(0,n.jsxs)(e0.v,{matchWidth:!0,children:[(0,n.jsx)(e1.j,{size:"lg",as:h.z,borderRadius:"md",rightIcon:(0,n.jsx)(F.G,{icon:M.ptq,transform:"shrink-6"}),variant:"toolbar",px:4,h:10,w:"100%",border:"1px solid",borderColor:"gray.200",children:(0,n.jsx)(c.x,{textAlign:"left",fontWeight:"400",children:r.name()})}),(0,n.jsx)(e2.q,{maxH:"320px",maxW:"100%",overflow:"auto",children:e4.N.map(e=>(0,n.jsx)(e5.i,{isChecked:r.key===e.key,value:e.key,onClick:()=>i({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{themeBase:e.key}}}),children:(0,n.jsxs)(R.U,{maxW:"100%",children:[(0,n.jsx)(e9,{base:e}),(0,n.jsxs)(u.xu,{flex:"1",minW:"0",children:[e.name(),e.description&&(0,n.jsx)(c.x,{color:"gray.400",fontSize:"sm",children:e.description()})]})]})},e.key))})]})]})},e9=e=>{let{base:t}=e,i={"--card-color":"#FFF",...t.getCSSVars({cardColor:"#FFF",accentColor:"#F00",accentPalette:["#F00"]})};return(0,n.jsx)(u.xu,{backgroundColor:"gray.200",p:4,css:i,children:(0,n.jsx)(u.xu,{sx:t.cardSx,h:"3em",w:"5em"})})},e6=(0,k.memo)(()=>{var e;let{state:t,pop:i,dispatch:r,label:s}=(0,ed.n)(),{theme:l}=t,o=(null===(e=l.config.cardBackground)||void 0===e?void 0:e.type)===eD.E.COLOR?l.config.cardBackground.color:null;return(0,n.jsx)(ey,{onBackClick:i,label:s,children:(0,n.jsxs)(eh.K,{p:6,children:[(0,n.jsxs)(em.NI,{"data-testid":"custom-theme-card-color-picker",children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(v.cC,{id:"9d2iLQ"})}),(0,n.jsx)(em.Q6,{mb:4,children:(0,n.jsx)(v.cC,{id:"7wiFpy"})}),(0,n.jsx)(e$.T,{value:(null==o?void 0:o.hex)||null,updateValue:e=>r({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{cardBackground:e?{type:eD.E.COLOR,color:{hex:e}}:void 0}}}),defaultValue:"#FFFFFF"})]}),(0,n.jsx)(e3,{theme:l,dispatch:r})]})})});e6.displayName="ThemeConfigCardStylesPanel";var e7=i(30423),e8=i(52099),te=i(78462),tt=i(44035),ti=i(27599);let tn=e=>{let{label:t,description:i,labelColor:r="black",fontFamily:s,fontStyle:l="normal",fontWeight:o=400}=e,a=(0,n.jsxs)(R.U,{alignItems:"baseline",children:[(0,n.jsx)(u.xu,{color:"yellow.400",children:(0,n.jsx)(F.G,{icon:L.e7M})}),(0,n.jsx)(c.x,{textAlign:"left",color:r,fontWeight:o,fontSize:"lg",fontFamily:s,fontStyle:l,children:t})]});return i?(0,n.jsxs)(u.xu,{children:[a,(0,n.jsx)(c.x,{fontSize:"xs",color:"gray.500",children:i})]}):a},tr=e=>{let{value:t,updateValue:i,onFontUploadClick:r,weight:s="regular",defaultFont:l,fonts:o,customFontsEnabled:a,...d}=e,{workspaceFonts:u,globalFonts:x}=o,[m,p,g]=(0,k.useMemo)(()=>{let e=[...u,...x],i=e.find(e=>e.id===t),n=(0,e8.Yw)(e,t),r=(0,e8.Yw)(e,t,!1);return[i,n,r]},[x,u,t]),j=a&&u.filter(e=>!e.archived||e.id===(null==m?void 0:m.id)).length>0,C=!1,b="normal",y="bold"===s?700:400;if(m&&null!==m.workspaceId){C=!0===m.archived;let e=[...m.fontFiles||[]];b=(0,e7.Sd)(e)?"italic":"normal";let t=(0,e7.B_)(e);y=(0,e7.QP)(t,"bold"===s?700:400)||400}return(0,n.jsxs)(e0.v,{matchWidth:!0,isLazy:!0,children:[(0,n.jsx)(e1.j,{size:"lg",as:h.z,borderRadius:"md",rightIcon:(0,n.jsx)(F.G,{icon:M.ptq,transform:"shrink-6"}),variant:"toolbar",px:4,h:10,w:"100%",border:"1px solid",borderColor:"gray.200",...d,children:a&&C?(0,n.jsx)(tn,{label:g||"",fontFamily:'"'.concat(p,'"'),labelColor:t?"gray.800":"gray.400",fontStyle:b,fontWeight:y}):(0,n.jsx)(c.x,{textAlign:"left",fontFamily:'"'.concat(p||l,'"'),fontWeight:y,color:t?"gray.800":"gray.400",fontStyle:b,children:g||(0,n.jsx)(v.cC,{id:"Ff/YaY",values:{defaultFont:l,GAMMA_PROPER_NOUN:W.N6}})})}),(0,n.jsxs)(e2.q,{maxH:"320px",overflow:"auto",zIndex:"dropdown",children:[(0,n.jsxs)(tt._,{type:"radio",value:t||"",onChange:e=>i(e||void 0),children:[j&&(0,n.jsx)(f.NZ,{m:2,children:(0,n.jsx)(v.cC,{id:"syCKVA"})}),j&&u.map(e=>{var i;let r=e.id!==t,l=e.archived&&r,o=(null===(i=e.fontFiles)||void 0===i?void 0:i.length)===0&&r;if(!e.fontFiles||o||l)return null;let a=(0,e7.Sd)(e.fontFiles)?"italic":"normal";return C&&e.id===t?(0,n.jsx)(e5.i,{value:e.id,disabled:!0,children:(0,n.jsx)(tn,{fontFamily:e.name,label:e.name,fontStyle:a,description:(0,n.jsx)(v.cC,{id:"FZBl16"})})},e.id):(0,n.jsx)(e5.i,{value:e.id,children:(0,n.jsx)(c.x,{fontFamily:'"'.concat(e.name,'"'),fontSize:"lg",fontWeight:s,fontStyle:a,children:e.name})},e.id)}),j&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ti.R,{}),(0,n.jsx)(f.NZ,{m:2,children:(0,n.jsx)(v.cC,{id:"Z/0bkt"})})]}),(0,n.jsx)(e5.i,{value:"",children:(0,n.jsx)(c.x,{fontFamily:l,fontSize:"lg",fontWeight:s,color:"gray.400",children:(0,n.jsx)(v.cC,{id:"fuNYg+"})})}),x&&x.map(e=>(0,n.jsx)(e5.i,{value:e.id,children:(0,n.jsx)(c.x,{fontFamily:(0,e8.eu)(e.id)?'"'.concat(e.id,'"'):'"'.concat(e.name,'"'),fontSize:"lg",fontWeight:s,children:e.name})},e.id))]}),a&&(0,n.jsx)(h.z,{width:"calc(100% + var(--chakra-space-4))",variant:"plain",position:"sticky",bottom:-2,m:-2,mt:2,p:2,borderX:"none",borderBottom:"none",fontSize:"sm",borderRadius:"none",onClick:r,leftIcon:(0,n.jsx)(F.G,{icon:M.A$k}),children:(0,n.jsx)(v.cC,{id:"vNYIdl"})})]})]})};var ts=i(29705),tl=i(11082),to=i(62700);let ta=e=>{var t,i,r;
1let{font:s,value:l,defaultWeight:o,updateValue:a,...d}=e,u=(0,k.useCallback)(e=>{let t=Number(e);Number.isNaN(t)||a(t)},[a]),x=(null==l?void 0:l.toString())||"",m=(0,to.d)()[o],{weightOptions:p,isDeletedFontWeight:g}=(0,k.useMemo)(()=>{let e=(0,e8.W9)(s),t=void 0!==l&&!e.includes(l);if(!t||!l)return{isDeletedFontWeight:t,weightOptions:e};let i=[...e,l].sort((e,t)=>e-t);return{isDeletedFontWeight:t,weightOptions:i}},[s,l]),j=s&&(null==s?void 0:s.workspaceId)!==null,f=j&&(null===(t=s.fontFiles)||void 0===t?void 0:t.length)===0,C=g&&j,b=(0,te.p6)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(e0.v,{matchWidth:!0,isLazy:!0,children:[(0,n.jsx)(e1.j,{size:"lg",as:h.z,borderRadius:"md",rightIcon:(0,n.jsx)(F.G,{icon:M.ptq,transform:"shrink-6"}),variant:"toolbar",px:4,h:10,w:"100%",border:"1px solid",borderColor:"gray.200",isDisabled:p.length<=1,...d,children:g?(0,n.jsx)(tn,{label:f?(0,n.jsx)(v.cC,{id:"EqUVJs"}):null!==(i=(0,to.d)()[x])&&void 0!==i?i:m,labelColor:l?"gray.800":"gray.400"}):(0,n.jsx)(c.x,{textAlign:"left",color:l?"gray.800":"gray.400",fontWeight:400,children:null!==(r=(0,to.d)()[x])&&void 0!==r?r:m})}),(0,n.jsx)(e2.q,{maxH:"320px",overflow:"auto",zIndex:"dropdown",children:(0,n.jsx)(tt._,{type:"radio",value:x,onChange:u,children:p.map(e=>{var t,i;return g&&l===e?(0,n.jsx)(e5.i,{value:e.toString(),disabled:!0,children:(0,n.jsx)(tn,{label:null!==(t=(0,to.d)()[e])&&void 0!==t?t:m,description:C?(0,n.jsx)(v.cC,{id:"KFmni+"}):(0,n.jsx)(v.cC,{id:"mGTUJj"})})},e):(0,n.jsx)(e5.i,{value:e.toString(),children:(0,n.jsx)(c.x,{fontSize:"lg",children:null!==(i=(0,to.d)()[e])&&void 0!==i?i:m})},e)})})})]}),C&&(0,n.jsx)(c.x,{fontSize:"xs",mt:1.5,children:(0,n.jsxs)(tl.r,{href:b,textDecoration:"underline",isExternal:!0,children:[(0,n.jsx)(v.cC,{id:"RUO69p"}),(0,n.jsx)(ts.h,{ml:1})]})})]})},td=e=>{let{label:t,helperText:i,value:r,defaultValue:s,updateValue:l,...o}=e;return(0,n.jsxs)(em.NI,{...o,children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(c.x,{children:t})}),(0,n.jsx)(e$.T,{value:r,updateValue:l,defaultValue:s}),i&&(0,n.jsx)(em.Q6,{children:i})]})};var tc=i(84286),tu=i(66028);let tx=e=>{let{value:t,updateValue:i,onLogoUploadStart:r,onLogoUploadFail:s}=e,[l,o]=(0,k.useState)(null),[a,d]=(0,k.useState)(null),c=(0,H.CG)(I.KV),{currentWorkspace:x}=(0,_.SE)(),m=c||(null==x?void 0:x.id);return m?t||a?(0,n.jsxs)(eR.g,{align:"flex-start",spacing:4,children:[(0,n.jsxs)(u.xu,{position:"relative",w:"100%",background:"gray.50",children:["placeholder"==a?(0,n.jsx)(tc.k3,{w:"100%"}):(0,n.jsx)(eG.E,{w:"100%",src:t||a||void 0,alt:"",onMouseDown:tu.br}),l==eI.D.Uploading&&(0,n.jsx)(tc.HI,{}),l==eI.D.Error&&(0,n.jsx)(tc.s7,{})]}),(0,n.jsx)(h.z,{onClick:()=>{i(null),o(null)},mt:2,w:"100%",children:(0,n.jsx)(v.cC,{id:"VlT9ID"})})]}):(0,n.jsx)(eE.un,{orgId:m,uploadType:"image",editType:"icon",dropHereText:C.ag._({id:"cmRkd1",values:{0:"%{browse}"}}),customHeight:"250px",customFontSize:"sm",showTip:!1,onUploadStart:e=>{let{file:t,tempUrl:i}=e;o(eI.D.Uploading),r&&r(),t.type&&(0,eL.Ns)(t.type)?d("placeholder"):d(i)},onUploadSuccess:e=>{let{src:t}=e;o(eI.D.Done),i(t),d(null)},onUploadFailed:e=>{o(eI.D.Error),s&&s()}}):null},th=[{label:()=>C.ag._({id:"uIeorD"}),icon:eu.AVo,Component:()=>{let{dispatch:e,state:t,pop:i,label:r}=(0,ed.n)(),s=(0,J.E7)(t.theme),l=(0,J.wj)(t.theme),o=(0,k.useCallback)(t=>{var i,n;(null==t?void 0:t.type)===eD.E.IMAGE&&(null===(i=t.image)||void 0===i?void 0:i.uploadStatus)===eI.D.Uploading?e({type:"THEME_BACKGROUND_IMAGE_UPLOAD_STARTED",data:{background:t}}):(null==t?void 0:t.type)===eD.E.IMAGE&&(null===(n=t.image)||void 0===n?void 0:n.uploadStatus)===eI.D.Error?e({type:"THEME_BACKGROUND_IMAGE_UPLOAD_FAIL"}):e({type:"THEME_BACKGROUND_UPDATE_SUCCESS",data:{background:t}})},[e]);return(0,n.jsx)(ey,{onBackClick:i,label:r,children:(0,n.jsx)(eh.K,{p:6,children:(0,n.jsx)(eP,{setBackground:o,background:s,defaultMessage:(0,n.jsxs)(ek.b,{fontSize:"xs",children:[(0,n.jsx)(ew.z,{}),(0,n.jsx)(c.x,{children:(0,n.jsx)(v.cC,{id:"j+PsQe"})})]}),isDark:l})})})}},{label:()=>C.ag._({id:"Roi1AL"}),icon:eu.lCX,Component:e6},{label:()=>C.ag._({id:"TzJ8ZI"}),icon:eu.Zkk,Component:()=>{var e,t;let{label:i,state:r,dispatch:s,pop:l}=(0,ed.n)(),{theme:o}=r,a=(0,k.useCallback)(e=>s({type:"THEME_UPDATE_THEME_PROPS",data:{themeProps:{accentColor:null!=e?e:void 0}}}),[s]);return(0,n.jsx)(ey,{onBackClick:l,label:i,children:(0,n.jsxs)(eh.K,{spacing:2,p:6,children:[(0,n.jsxs)(em.NI,{"data-testid":"custom-theme-accent-color-picker",children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(v.cC,{id:"Udsgl4"})}),(0,n.jsx)(em.Q6,{mb:4,children:(0,n.jsx)(v.cC,{id:"7ldaTf"})}),(0,n.jsx)(ej.U,{color:o.accentColor,defaultColor:T.uP,updateColor:a,gradient:o.config.accentGradient,updateGradient:e=>s({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{accentGradient:e}}})})]}
1),(0,n.jsxs)(em.NI,{children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(v.cC,{id:"NEXUdn"})}),(0,n.jsx)(em.Q6,{mb:2,children:(0,n.jsx)(v.cC,{id:"+50OB4"})}),(0,n.jsx)(ef.Y,{value:(null===(e=o.config)||void 0===e?void 0:e.secondaryAccentColors)||[],updateValue:e=>s({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{secondaryAccentColors:e}}}),maxColors:4})]}),(0,n.jsxs)(em.NI,{children:[(0,n.jsx)(ep.l,{mt:4,children:(0,n.jsx)(v.cC,{id:"g/cMXH"})}),(0,n.jsx)(eg.X,{isChecked:!(null===(t=o.config)||void 0===t?void 0:t.disableReadabilityAdjustment),onChange:()=>{var e;return s({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{disableReadabilityAdjustment:!(null===(e=o.config)||void 0===e?void 0:e.disableReadabilityAdjustment)}}})},children:(0,n.jsx)(v.cC,{id:"fflXAI"})}),(0,n.jsx)(em.Q6,{mb:2,children:(0,n.jsx)(v.cC,{id:"QjwqJE"})})]})]})})}},{label:()=>C.ag._({id:"COXEr5"}),icon:eu.l9f,Component:()=>{let{pop:e,state:t,dispatch:i,label:r}=(0,ed.n)(),{theme:s}=t;return(0,n.jsx)(ey,{onBackClick:e,label:r,children:(0,n.jsx)(eV,{theme:s,updateTheme:e=>i({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{...e}}})})})}},{label:()=>C.ag._({id:"I0oBSl"}),icon:eu.yGG,Component:()=>{var e;let t=(0,ex.ye)("customFonts"),{label:i,dispatch:r,state:s,pop:l}=(0,ed.n)(),{theme:o,fontState:a}=s,{fonts:d,fontsMap:u}=a,x=(0,k.useCallback)(e=>{let t=u[e],i=(0,e8.W9)(t),n=(0,e7.QP)(i,o.headingFontWeight||T.ZT.heading)||T.ZT.heading,s=(0,e8.s8)({fontsMap:u,headingFontId:e,bodyFontId:o.bodyFont});r({type:"THEME_UPDATE_THEME_PROPS",data:{themeProps:{headingFont:e,headingFontWeight:n,fonts:s}}})},[r,u,o.bodyFont,o.headingFontWeight]),h=(0,k.useCallback)(e=>{let t=u[e],i=(0,e8.W9)(t),n=(0,e7.QP)(i,o.bodyFontWeight||T.ZT.body)||T.ZT.body,s=(0,e8.s8)({fontsMap:u,bodyFontId:e,headingFontId:o.headingFont});r({type:"THEME_UPDATE_THEME_PROPS",data:{themeProps:{bodyFont:e,bodyFontWeight:n,fonts:s}}})},[r,u,o.headingFont,o.bodyFontWeight]),m=(0,k.useCallback)(e=>r({type:"THEME_UPDATE_THEME_PROPS",data:{themeProps:{headingFontWeight:e}}}),[r]),p=(0,k.useCallback)(e=>r({type:"THEME_UPDATE_THEME_PROPS",data:{themeProps:{bodyFontWeight:e}}}),[r]),g=(0,k.useCallback)(e=>r({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{headingColor:null!=e?e:void 0}}}),[r]),j=(0,k.useCallback)(e=>r({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{headingGradient:null!=e?e:void 0}}}),[r]),f=(0,k.useCallback)(e=>r({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{bodyColor:null!=e?e:void 0}}}),[r]),b=(0,k.useCallback)(()=>{let e=(0,te.p6)();window.open(e,"_blank")},[]),y=u[o.headingFont||T.ke.headingFont]||u[T.ke.headingFont],w=u[o.bodyFont||T.ke.bodyFont]||u[T.ke.bodyFont],S=o.headingFontWeight||T.ZT.heading,E=o.bodyFontWeight||T.ZT.body,I=(0,J.wj)(o);return(0,n.jsx)(ey,{onBackClick:l,label:i,children:(0,n.jsxs)(eh.K,{p:6,children:[(0,n.jsxs)(em.NI,{mb:"2",children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(c.x,{children:(0,n.jsx)(v.cC,{id:"7OvVwW"})})}),(0,n.jsx)(tr,{fonts:d,value:o.headingFont,customFontsEnabled:t,updateValue:x,onFontUploadClick:b,weight:"bold",defaultFont:T.ke.headingFont,"data-testid":"custom-theme-heading-font-picker"}),t&&(0,n.jsx)(ta,{font:y,value:S,defaultWeight:700,updateValue:m})]}),(0,n.jsxs)(em.NI,{mb:"2","data-testid":"custom-theme-heading-color-picker",children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(c.x,{children:(0,n.jsx)(v.cC,{id:"v9mrgh"})})}),(0,n.jsx)(ej.U,{color:o.config.headingColor,updateColor:g,defaultColor:I?T.Qw:T.l0,gradient:o.config.headingGradient,updateGradient:j})]}),(0,n.jsxs)(em.NI,{children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(c.x,{children:(0,n.jsx)(v.cC,{id:"B4QCf7"})})}),(0,n.jsx)(tr,{fonts:d,value:o.bodyFont,customFontsEnabled:t,updateValue:h,onFontUploadClick:b,weight:"normal",defaultFont:T.ke.bodyFont,"data-testid":"custom-theme-body-font-picker"}),t&&(0,n.jsx)(ta,{font:w,value:E,defaultWeight:400,updateValue:p})]}),(0,n.jsx)(td,{label:C.ag._({id:"jx8uni"}),value:(null===(e=o.config)||void 0===e?void 0:e.bodyColor)||null,defaultValue:I?T.Z_:T.zL,updateValue:f}),(0,n.jsxs)(ek.b,{fontSize:"xs",mt:"6",children:[(0,n.jsx)(ew.z,{}),(0,n.jsx)(c.x,{children:(0,n.jsx)(v.cC,{id:"3L+fCN"})})]})]})})}},{label:()=>C.ag._({id:"iG7KNr"}),icon:e=>e.logoUrl?eu.Hh4:eu.thV,Component:()=>{let{pop:e,state:t,dispatch:i,label:r}=(0,ed.n)(),{theme:s}=t;return(0,n.jsx)(ey,{onBackClick:e,label:r,children:(0,n.jsx)(eh.K,{p:6,children:(0,n.jsx)(em.NI,{
1children:(0,n.jsx)(tx,{value:s.logoUrl||null,onLogoUploadStart:()=>{i({type:"THEME_LOGO_UPLOAD_STARTED"})},updateValue:e=>i({type:"THEME_LOGO_UPLOAD_SUCCESS",data:{logoUrl:null!=e?e:void 0}}),onLogoUploadFail:()=>{i({type:"THEME_LOGO_UPLOAD_FAIL"})}})})})})}},{label:()=>C.ag._({id:"sxkWRg"}),icon:eu.gr5,Component:()=>{var e,t,i,r,s,l,o;let{pop:a,state:d,dispatch:c,label:u}=(0,ed.n)(),{theme:x}=d;return(0,n.jsx)(ey,{onBackClick:a,label:u,children:(0,n.jsxs)(eh.K,{spacing:4,p:6,children:[(0,n.jsxs)(em.NI,{children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(v.cC,{id:"S0kLOH"})}),(0,n.jsx)(eB.I,{defaultValue:x.id,readOnly:!0})]}),(0,n.jsxs)(em.NI,{children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(v.cC,{id:"PPYsiY"})}),(0,n.jsx)(eK.g,{defaultValue:null===(t=x.config.keywords)||void 0===t?void 0:null===(e=t.color)||void 0===e?void 0:e.join(", "),onChange:e=>{c({type:"THEME_UPDATE_THEME_KEYWORDS",data:{keywords:{color:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}}})}}),(0,n.jsx)(em.Q6,{children:"Should be separated with commas"})]}),(0,n.jsxs)(em.NI,{children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(v.cC,{id:"valYIJ"})}),(0,n.jsx)(eK.g,{defaultValue:null===(r=x.config.keywords)||void 0===r?void 0:null===(i=r.tone)||void 0===i?void 0:i.join(", "),onChange:e=>{c({type:"THEME_UPDATE_THEME_KEYWORDS",data:{keywords:{tone:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}}})}}),(0,n.jsx)(em.Q6,{children:"Should be separated with commas"})]}),(0,n.jsxs)(em.NI,{children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(v.cC,{id:"1hKEom"})}),(0,n.jsx)(eq.Y2,{defaultValue:x.priority,onChange:(e,t)=>
1{c({type:"THEME_UPDATE_THEME_PROPS",data:{themeProps:{priority:Number.isNaN(t)?void 0:t}}})},children:(0,n.jsx)(eq.zu,{})}),(0,n.jsx)(em.Q6,{children:"Higher priority themes show up first in the themes list"})]}),(0,n.jsxs)(em.NI,{children:[(0,n.jsx)(ep.l,{children:(0,n.jsx)(v.cC,{id:"q3il6U"})}),(0,n.jsx)(eq.Y2,{defaultValue:null===(s=x.config)||void 0===s?void 0:s.fontSize,onChange:(e,t)=>{c({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{fontSize:Number.isNaN(t)?void 0:t}}})},children:(0,n.jsx)(eq.zu,{})})]}),(0,n.jsx)(eQ,{label:(0,n.jsx)(v.cC,{id:"3loch2"}),initialValue:null===(l=x.config)||void 0===l?void 0:l.contentStyles,updateValue:e=>c({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{contentStyles:e}}})}),(0,n.jsx)(eQ,{label:(0,n.jsx)(v.cC,{id:"r0cjYF"}),initialValue:null===(o=x.config)||void 0===o?void 0:o.containerStyles,updateValue:e=>c({type:"THEME_UPDATE_THEME_CONFIG",data:{themeConfig:{containerStyles:e}}}),helperText:C.ag._({id:"W5hi5t"})})]})})},isForGammaOnly:!0}],tm=(e,t)=>!!e.featureFlag&&!ex.VH.get(e.featureFlag)||!!e.isForGammaOnly&&!t,tp={outline:"3px dashed var(--chakra-colors-sunglow-500)",outlineOffset:"0"},tg=()=>{let{push:e,state:t,setLabel:i}=(0,ed.n)(),{theme:r}=t,{isGammaOrgUser:s}=(0,_.SE)(),l=(0,k.useMemo)(()=>th.filter(e=>!tm(e,s)),[s]);return(0,n.jsx)(ec.GS,{listStyleType:"none",marginStart:0,children:l.map((t,l)=>{let{label:o,icon:a,Component:d}=t,c="".concat(l+1,". ").concat(o());return(0,n.jsx)(ec.HC,{children:(0,n.jsx)(eb,{icon:"function"==typeof a?a(r):a,label:c,onClick:()=>{i(c),e(d)},...t.isForGammaOnly&&s&&tp})},o())})})},tj=e=>{let{theme:t,dispatch:i,fonts:r,fontsMap:s}=e,[l,o]=(0,k.useState)("");return(0,n.jsx)(ed.O.Provider,{value:{state:{theme:t,fontState:{fonts:r,fontsMap:s}},dispatch:i,label:l,setLabel:o},children:(0,n.jsx)(ea,{InitialComponent:tg})})};var tf=i(58905),tv=i(75230),tC=i(64951),tb=i(29264);let ty=e=>{let{value:t,onSave:i,themeValidationError:r}=e;return(0,n.jsxs)(em.NI,{isInvalid:!!r,children:[(0,n.jsx)(tf.C,{defaultValue:t,placeholder:(0,T.F)(),onSubmit:i,submitOnBlur:!0,isPreviewFocusable:!0,fontSize:"3xl",children:(0,n.jsxs)(R.U,{minHeight:14,children:[(0,n.jsx)(tv.w,{"data-testid":"custom-theme-name-preview",noOfLines:1}),(0,n.jsx)(eB.I,{as:tC.V,w:{sm:"50%",lg:"40%",xl:"30%","2xl":"20%"},"data-testid":"custom-theme-name-input"}),(0,n.jsx)(tk,{})]})}),r&&(0,n.jsx)(eY.J1,{fontWeight:"500",pb:2,children:r})]})},tk=()=>{let{isEditing:e,getSubmitButtonProps:t,getCancelButtonProps:i,getEditButtonProps:r}=(0,tb.Z)();return e?(0,n.jsxs)(x.h,{justifyContent:"center",size:"sm",spacing:0,children:[(0,n.jsx)(f.kH,{label:(0,n.jsx)(v.cC,{id:"dEgA5A"}),children:(0,n.jsx)(ez.h,{variant:"ghost","aria-label":C.ag._({id:"dEgA5A"}),icon:(0,n.jsx)(F.G,{icon:M.YIN}),...i()})}),(0,n.jsx)(f.kH,{label:(0,n.jsx)(v.cC,{id:"fNzdjk"}),children:(0,n.jsx)(ez.h,{variant:"ghost","aria-label":C.ag._({id:"fNzdjk"}),icon:(0,n.jsx)(F.G,{icon:M.LEp}),...t(),"data-testid":"save-theme-name-button"})})]}):(0,n.jsx)(d.k,{justifyContent:"center",children:(0,n.jsx)(f.kH,{label:(0,n.jsx)(v.cC,{id:"+MxT3Q"}),children:(0,n.jsx)(u.xu,{children:(0,n.jsx)(ez.h,{variant:"ghost","aria-label":C.ag._({id:"+MxT3Q"}),size:"sm",icon:(0,n.jsx)(F.G,{icon:M.Yai}),...r(),ref:null})})})})},tw="theme-editor-root",tS=e=>{var t;let{state:i,dispatch:r,docContent:s,doc:l,workspaceId:o}=e,{theme:a,customizationStep:u}=i,[x,h]=(0,k.useState)(),[m,p]=(0,k.useState)(null),j=(0,A.Kt)(h,300);(0,k.useEffect)(()=>{j(a)},[a,j]);let{globalFonts:f,workspaceFonts:C,fontsMap:b,allThemeFonts:y}=(0,Z.TY)(o);(null==s?void 0:s.content)&&(null===(t=s.content[0].attrs)||void 0===t?void 0:t.background)&&(s.content[0].attrs.background=K.jg);let w=(0,H.CG)(U.mT),S=(0,q.i)({base:"var(--chakra-sizes-xs)",lg:"var(--chakra-sizes-md)","2xl":"var(--chakra-sizes-xl)"})||"var(--chakra-sizes-md)",E=(0,k.useMemo)(()=>(0,X.y)(),[]);(0,k.useEffect)(()=>{let e=null==x?void 0:x.config.accentBackgrounds;if(e){if(m&&0===e.length){m.commands.setContent(E);return}null==m||m.commands.updateThemeAccentImages(e,!0)}}
1,[m,null==x?void 0:x.config.accentBackgrounds,E]);let I=(0,k.useCallback)(e=>{r({type:"SET_NEW_THEME_FOR_SELECTING",data:{theme:(0,J.mg)(e)}})},[r]),_=(0,k.useCallback)(()=>{r({type:"SET_NEW_THEME_FOR_CUSTOMIZING",data:{theme:(0,J.mg)(a,!0)}})},[r,a]);return(0,n.jsxs)(d.k,{direction:"row-reverse",h:"100%",children:[(0,n.jsx)(d.k,{direction:"column",overflowY:"auto",w:S,borderLeft:"1px solid",borderColor:"gray.200",children:(0,n.jsx)(d.k,{flex:"1",direction:"column",position:"relative",children:"selection"===u?(0,n.jsx)(et,{theme:a,onThemeClick:I,onSelectClick:_}):(0,n.jsx)(tj,{theme:a,dispatch:r,fonts:{globalFonts:f,workspaceFonts:C},fontsMap:b})})}),(0,n.jsx)(d.k,{flex:1,bg:"gray.100",position:"relative",maxW:"calc(100vw - ".concat(S,")"),children:(0,n.jsxs)(d.k,{className:tw,overflowY:"scroll",width:"100%",height:"100%",direction:"column",position:"relative",css:{"--editor-width":"100%"},children:[(0,n.jsx)(B.Y,{}),(0,n.jsx)(ei.J,{fonts:y}),(0,n.jsxs)(O.m,{variant:"soft-rounded",size:"sm","data-testid":"custom-theme-tabs",children:[s&&(0,n.jsx)(g.M,{position:"sticky",top:0,zIndex:2,background:"white",children:(0,n.jsxs)(P.t,{p:2,position:"absolute",top:"1rem",background:"white",borderRadius:"full",shadow:"md",children:[(0,n.jsx)(D.O,{"data-testid":"custom-theme-tester-deck-tab",children:(0,n.jsxs)(R.U,{children:[(0,n.jsx)(F.G,{icon:L.Mdf}),(0,n.jsx)(c.x,{children:(0,n.jsx)(v.cC,{id:"vat9WD"})})]})}),(0,n.jsx)(D.O,{"data-testid":"custom-theme-current-deck-tab",children:(0,n.jsxs)(R.U,{children:[(0,n.jsx)(F.G,{icon:M.s2}),(0,n.jsx)(c.x,{children:(0,n.jsx)(v.cC,{id:"VJUm9p"})})]})})]})}),(0,n.jsxs)(G.n,{"data-testid":"custom-theme-tab-panels",children:[(0,n.jsx)(z.x,{p:0,"data-testid":"custom-theme-preview-editor",children:(0,n.jsx)(V.fb,{onCreate:e=>{let{editor:t}=e;return p(t)},initialContent:E,theme:x,scrollingParentSelector:".".concat(tw),isInsideDrawer:!0})}),s&&(0,n.jsx)(z.x,{p:0,"data-testid":"custom-theme-preview-editor",children:(0,n.jsx)(V.fb,{reduxData:{cards:w},initialContent:s,theme:x,scrollingParentSelector:".".concat(tw),doc:l,isInsideDrawer:!0})})]})]})]})})]})},tE=e=>{var t;let{name:i,doc:r,theme:s,themeValidationError:l,dispatch:o}=e,[a,d]=(0,k.useState)(),{data:u,loading:x}=(0,S.gec)({variables:{id:null==s?void 0:s.id},skip:!s||"new"===s.id}),h=(0,Y.$)(null==r?void 0:r.title);(0,k.useEffect)(()=>{!x&&u&&u.theme&&d(u.theme)},[x,u,d]);let m=(0,k.useCallback)(e=>{let t=e||(0,T.F)();o({type:"THEME_UPDATE_THEME_NAME",data:{name:t}})},[o]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ty,{value:i||(0,T.F)(),onSave:m,themeValidationError:l}),x?(0,n.jsx)(N.N,{noOfLines:1,fontSize:"sm",maxW:"300px"}):(0,n.jsxs)(c.x,{color:"gray.700",fontSize:"sm",fontWeight:"normal",letterSpacing:"normal",children:[(null==a?void 0:a.createdBy)&&(0,n.jsx)(v.cC,{id:"qeNU2j",values:{0:a.createdBy.displayName}})," ",(null==a?void 0:a.docCount)&&(null==a?void 0:a.docCount)===1&&(null==a?void 0:a.id)===(null==r?void 0:null===(t=r.theme)||void 0===t?void 0:t.id)?(0,n.jsx)(v.cC,{id:"On+kRG",values:{docTitle:h,GAMMA_ARTIFACT_PROPER_NOUN:W.Yc},components:{0:(0,n.jsx)("strong",{})}}):(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(v.cC,{id:"eVRfvp",values:{GAMMA_ARTIFACT_PROPER_NOUN:W.Yc,GAMMA_ARTIFACT_PROPER_NOUN_PLURAL:W.aq,0:(null==a?void 0:a.docCount)||0},components:{0:(0,n.jsx)("strong",{}),1:(0,n.jsx)("strong",{})}})})]})]})},tI=["headingFont","bodyFont","accentColor","logoUrl"],t_=(0,k.memo)(e=>{var t;let{isOpen:i,onClose:g,state:j,dispatch:b,docContent:O,onThemeCreated:P,disableDrawerTransition:D=!1}=e,R=(0,E.z$)(),G=(0,r.p)(),z=(0,w.v9)(I.yx),N=(0,A.NE)(i,500),{user:M,currentWorkspace:L}=(0,_.SE)(),F=(0,k.useRef)(null),U=D?i:N,[W,{loading:H}]=(0,S.Wu6)(),[V,{loading:B}
1]=(0,S.suk)(),K="loading"===j.themeBackgroundImgStatus||"loading"===j.themeLogoImgStatus,q=(0,k.useCallback)(()=>{b({type:"THEME_RESET"}),g()},[b,g]),Y=(0,k.useCallback)(()=>{if(M&&L&&j.theme){if(!j.theme.name){b({type:"THEME_VALIDATION_ERROR",data:{errorMessage:"Theme name is required."}});return}if("new"===j.theme.id){let e={...j.theme,workspaceId:L.id},{id:t,archived:i,fonts:n,...r}=e;W({variables:{input:r},update:(t,i)=>{let{data:n}=i;(null==n?void 0:n.createTheme)&&t.writeQuery({query:S.$LR,variables:{workspaceId:e.workspaceId,archived:!1},data:{themes:[n.createTheme]}})},optimisticResponse:{createTheme:{__typename:"Theme",...e,createdTime:new Date().toISOString(),updatedTime:new Date().toISOString()}}}).then(t=>{let{data:i}=t;if(null==i?void 0:i.createTheme){var n;null==R||R.track(E.AA.THEME_CREATED,{theme_id:null==i?void 0:null===(n=i.createTheme)||void 0===n?void 0:n.id,type:"new"}),null==P||P(i.createTheme)}G({title:C.ag._({id:"NE6T/k",values:{0:e.name}}),status:"success",duration:3e3,position:"top",isClosable:!0}),q()}).catch(t=>{t.graphQLErrors&&t.graphQLErrors.length>0&&"duplicate_theme_name"===t.graphQLErrors[0].code?b({type:"THEME_VALIDATION_ERROR",data:{errorMessage:t.message}}):(console.error("Couldn't create theme ".concat(e.name," error: ").concat(t)),G({title:C.ag._({id:"FcSGqc",values:{e:t}}),status:"error",duration:3e3,position:"top",isClosable:!1}))})}else{let{__typename:e,archived:t,createdTime:i,updatedTime:n,createdBy:r,fonts:s,...l}=j.theme;for(let e of tI)e in l&&void 0===l[e]&&(l[e]=null);V({variables:{input:l},update:(e,t)=>{let{data:i}=t;(null==i?void 0:i.updateTheme)&&e.writeQuery({query:S.$LR,variables:{workspaceId:j.theme.workspaceId,archived:!1},data:{themes:[i.updateTheme]}})},optimisticResponse:{updateTheme:{__typename:"Theme",...j.theme,createdTime:new Date().toISOString(),updatedTime:new Date().toISOString()}}}).then(()=>{null==R||R.track(E.AA.THEME_UPDATED,{theme_id:j.theme.id}),G({title:C.ag._({id:"WODDpW",values:{0:j.theme.name}}),status:"success",duration:3e3,position:"top",isClosable:!0}),q()}).catch(e=>{e.graphQLErrors&&"duplicate_theme_name"===e.graphQLErrors[0].code?b({type:"THEME_VALIDATION_ERROR",data:{errorMessage:e.message}}):(console.error("Couldn't update theme ".concat(j.theme.name," error: ").concat(e)),G({title:C.ag._({id:"hSYiXl",values:{e:e}}),status:"error",duration:3e3,position:"top",isClosable:!1}))})}}},[M,L,b,null==j?void 0:j.theme,W,G,q,R,P,V]),Z="new"===j.theme.id||!y()(j.theme,j.originalTheme);return(0,n.jsx)(f.Wk,{isDark:!1,children:(0,n.jsxs)(s.d,{placement:"bottom",onClose:q,isOpen:i,isFullHeight:!0,initialFocusRef:F,children:[(0,n.jsx)(l.Z,{}),(0,n.jsxs)(o.s,{borderTopRadius:"xl",h:"calc(var(--100vh) - 24px)",transform:D?"none !important":void 0,children:[(0,n.jsx)(a.x,{borderBottom:"1px solid #000",borderColor:"gray.200",children:"selection"===j.customizationStep?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.k,{"align-items":"center",letterSpacing:"normal",fontSize:"3xl",minH:14,py:1,children:(0,n.jsx)(c.x,{children:(0,n.jsx)(v.cC,{id:"ytpdnC"})})}),(0,n.jsx)(c.x,{color:"gray.700",fontSize:"sm",fontWeight:"normal",letterSpacing:"normal",children:(0,n.jsx)(v.cC,{id:"d9p6AC"})})]}):(0,n.jsxs)(d.k,{"justify-content":"space-between",alignItems:"flex-end",children:[(0,n.jsx)(u.xu,{flex:1,children:(0,n.jsx)(tE,{name:(null===(t=j.theme)||void 0===t?void 0:t.name)||(0,T.F)(),doc:z,theme:j.theme,dispatch:b,themeValidationError:j.themeValidationError})}),(0,n.jsxs)(x.h,{children:[(0,n.jsx)(h.z,{variant:"ghost",onClick:q,children:(0,n.jsx)(v.cC,{id:"dEgA5A"})}),(0,n.jsx)(f.kH,{isDisabled:!K,label:(0,n.jsx)(v.cC,{id:"yz1qqg"}),children:(0,n.jsx)(u.xu,{display:"inline-flex",children:(0,n.jsx)(h.z,{variant:"solid",isLoading:H||B||K,isDisabled:!Z,onClick:Y,"data-testid":"custom-theme-save",children:(0,n.jsx)(v.cC,{id:"EsJdRp"})})})})]})]})}),(0,n.jsx)(m.f,{p:0,h:"100%",children:U?(0,n.jsx)(tS,{state:j,workspaceId:null==L?void 0:L.id,dispatch:b,docContent:O,doc:z}):(0,n.jsx)(tA,{})}),(0,n.jsx)(p.o,{ref:F})]})]})})});t_.displayName="ThemeEditorDrawer";let tA=()=>(0,n.jsx)(u.xu,{flexDirection:"column",flex:"1",w:"100%",h:"100%",bg:"gray.100",inset:0,children:(0,n.jsx)(g.M,{h:"100%",children:(0,n.jsx)(j.$,{})})})},30233:function(e,t,i){"use strict";i.d(t,{S:function(){return l}});var n=i(52322),r=i(69251),s=i(67109);let l=e=>{let{size:t}=e;return(0,n.jsx)(r.r,{gap:4,flex:1,my:2,templateColumns:{base:"repeat(2, minmax(0, 1fr))"},children:Array(t).fill(!0).map((e,t)=>(0,n.jsx)(s.O,{h:"9em",borderRadius:"base"},t))})}},26838:function(e,t,i){"use strict";i.d(t,{o:function(){return eo}});var n=i(52322),r=i(56581),s=i(29117),l=i(77533),o=i(70065),a=i(55478),d=i(28535),c=i(38035),u=i(36474),x=i(5879),h=i(87254),m=i(2784),p=i(90763),g=i(93202),j=i(48832),f=i(11050),v=i(50260),C=i(10625),b=i(67046),y=i(32899),k=i(332),w=i(99058),S=i(27599),E=i(25481),I=i(42946),_=i(54933),A=i(49929),T=i(94523),O=i(82282),P=i(31807),D=i(47749),R=i(29318);let G=(0,m.memo)(e=>{let{theme:t}=e,i=(0,R.eo)({theme:t}),r=t.name.replace(D.Qk,"");return(0,n.jsxs)(C.v,{isLazy:!0,children:[(0,n.jsx)(b.j,{as:y.h,isRound:!0,size:"xs",variant:"ghost",colorScheme:"blackAlpha",icon:(0,n.jsx)(A.G,{icon:I.S6C}),onClick:e=>e.stopPropagation(),children:(0,n.jsx)(x.cC,{id:"7L01XJ"})}),(0,n.jsx)(k.h,{children:(0,n.jsxs)(w.q,{zIndex:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)(d.xu,{px:4,py:0,maxWidth:"300px",children:[(0,n.jsx)(l.x,{noOfLines:3,children:r}),t.createdTime&&(0,n.jsx)(l.x,{fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,n.jsx)(x.cC,{id:"MXSt4t",values:{0:(0,O.Z)((0,P.Z)(t.createdTime),"PPP")}})}),t.createdBy&&(0,n.jsx)(T.kH,{label:t.createdBy.email,children:(0,n.jsx)(l.x,{display:"inline-block",fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,n.jsx)(x.cC,{id:"t490IT",values:{0:t.createdBy.displayName}})})})]}),(0,n.jsx)(S.R,{}),(0,n.jsx)(E.s,{icon:(0,n.jsx)(A.G,{icon:_.XnX,fixedWidth:!0}),onClick:i,children:(0,n.jsx)(x.cC,{id:"yKu/3Y"})})]})})]})});var z=i(53596),N=i(36651),M=i(14274),L=i(8393),F=i(21733);let U=(0,m.memo)(e=>{let{onCustomizeThemeClick:t,onEditThemeClick:i}=e,{isGammaOrgUser:r}=(0,F.SE)(),s=r&&"production"!==M.v.APPLICATION_ENVIRONMENT;return(0,n.jsxs)(C.v,{isLazy:!0,children:[(0,n.jsx)(b.j,{as:y.h,isRound:!0,size:"xs",variant:"ghost",colorScheme:"blackAlpha",icon:(0,n.jsx)(A.G,{icon:I.S6C}),onClick:e=>e.stopPropagation(),children:(0,n.jsx)(x.cC,{id:"7L01XJ"})}),(0,n.jsx)(k.h,{children:(0,n.jsxs)(w.q,{zIndex:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(E.s,{icon:(0,n.jsx)(A.G,{icon:I.Mw$,fixedWidth:!0}),onClick:t,children:(0,n.jsx)(x.cC,{id:"XZd6AM"})}),s&&(0,n.jsx)(E.s,{color:"orange.500",icon:(0,n.jsx)(d.xu,{boxSize:"4",children:(0,n.jsx)(L.Y,{})}),onClick:i,children:"Edit theme"}),(0,n.jsx)(S.R,{}),(0,n.jsx)(d.xu,{px:4,py:0,maxW:56,children:(0,n.jsx)(l.x,{fontSize:"sm",color:"gray.600",children:(0,n.jsx)(x.cC,{id:"FV8ABd"})})})]})})]})});var W=i(29705),H=i(92850),V=i(26468),B=i(22226),K=i(54326),q=i(97217),Y=i(11082),Z=i(67109),X=i(50250),J=i(75768),Q=i(62614),$=i(2338),ee=i(5632),et=i(94199),ei=i(91994),en=i(47968);let er=e=>{let{theme:t,isOpen:i,onClose:r}=e,{asPath:s}=(0,ee.useRouter)(),[o,a]=(0,m.useState)(),[d,c]=(0,m.useState)(),u=(0,ei.CG)(en.yx),h=(0,R.EW)({theme:t,showLinkToDashboard:!!u}),{data:p,loading:j}=(0,g.gec)({variables:{id:null==t?void 0:t.id},skip:!t||"new"===t.id});(0,m.useEffect)(()=>{var e,t;!j&&p&&((null===(e=p.theme)||void 0===e?void 0:e.docCount)&&a(p.theme.docCount),(null===(t=p.theme)||void 0===t?void 0:t.siteCount)&&c(p.theme.siteCount))},[j,p,a,c]);let f=(0,m.useMemo)(()=>{let e=0;return o&&o>0&&(e+=o),d&&d>0&&(e+=d),e},[o,d]);return(0,n.jsxs)(H.u_,{closeOnOverlayClick:!1,isOpen:i,onClose:r,size:"lg",children:[(0,n.jsx)(V.Z,{}),(0,n.jsxs)(B.h,{children:[(0,n.jsx)(K.x,{children:(0,n.jsx)(x.cC,{id:"oh7Knm",values:{0:t.name}})}),(0,n.jsx)(q.f,{children:f>0?(0,n.jsxs)(l.x,{mb:2,children:[(0,n.jsx)(x.cC,{id:"uSopl9",values:{totalCount:f,GAMMA_ARTIFACT_PROPER_NOUN:et.Yc,GAMMA_ARTIFACT_PROPER_NOUN_PLURAL:et.aq}})," ",(0,n.jsx)(x.cC,{id:"c+lbSJ",values:{GAMMA_ARTIFACT_PROPER_NOUN_PLURAL:et.aq}})," ","/#themes"!==s&&(0,n.jsx)(x.cC,{id:"kLomb7",components:{0:(0,n.jsx)(Y.r,{color:"trueblue.500",colorScheme:"trueblue",href:v.oH,textDecoration:"underline",isExternal:!0}),1:(0,n.jsx)(W.h,{mx:"2px"})}})]}):j?(0,n.jsx)(Z.O,{h:"1em",mb:2}):(0,n.jsx)(l.x,{mb:2,children:(0,n.jsx)(x.cC,{id:"KNTN0L",values:{GAMMA_ARTIFACT_PROPER_NOUN_PLURAL:et.aq}})})}),(0,n.jsx)(X.m,{children:(0,n.jsxs)(J.h,{children:[(0,n.jsx)(Q.z,{variant:"ghost",onClick:r,children:(0,n.jsx)(x.cC,{id:"dEgA5A"})}),(0,n.jsx)(Q.z,{variant:"ghost",colorScheme:"red",onClick:()=>{h(),r()},children:(0,n.jsx)(x.cC,{id:"zck3yw"})})]})}),(0,n.jsx)($.o,{})]})]})},es=(0,m.memo)(e=>{let{theme:t,openThemeEditorWithThisTheme:i,onDuplicate:r,onArchiveThemeModalOpen:s,isArchiveThemeModalOpen:o,onArchiveThemeModalClose:a}=e,{canMakeStandard:c,convertToStandard:u}=(0,R.Xm)(t);return(0,n.jsxs)(C.v,{isLazy:!0,children:[(0,n.jsx)(b.j,{as:y.h,isRound:!0,size:"xs",variant:"ghost",colorScheme:"blackAlpha",icon:(0,n.jsx)(A.G,{icon:I.S6C}),onClick:e=>e.stopPropagation(),children:(0,n.jsx)(x.cC,{id:"7L01XJ"})}),(0,n.jsx)(k.h,{children:(0,n.jsxs)(w.q,{zIndex:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)(d.xu,{px:4,py:0,maxWidth:"300px",children:[(0,n.jsx)(l.x,{noOfLines:3,children:t.name}),t.createdTime&&(0,n.jsx)(l.x,{fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,n.jsx)(x.cC,{id:"MXSt4t",values:{0:(0,O.Z)((0,P.Z)(t.createdTime),"PPP")}})}),t.createdBy&&(0,n.jsx)(T.kH,{label:t.createdBy.email,children:(0,n.jsx)(l.x,{display:"inline-block",fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,n.jsx)(x.cC,{id:"t490IT",values:{0:t.createdBy.displayName}})})})]}),(0,n.jsx)(S.R,{}),(0,n.jsx)(E.s,{icon:(0,n.jsx)(A.G,{icon:I.q2v,fixedWidth:!0}),onClick:i,children:(0,n.jsx)(x.cC,{id:"ePK91l"})}),(0,n.jsx)(E.s,{icon:(0,n.jsx)(A.G,{icon:I.WM4,fixedWidth:!0}),onClick:r,children:(0,n.jsx)(x.cC,{id:"euc6Ns"})}),(0,n.jsx)(S.R,{}),c&&(0,n.jsx)(E.s,{color:"orange.500",icon:(0,n.jsx)(d.xu,{boxSize:"4",children:(0,n.jsx)(L.Y,{})}),onClick:u,children:(0,n.jsx)(x.cC,{id:"thLYdn"})}),(0,n.jsx)(E.s,{color:"red.500",icon:(0,n.jsx)(A.G,{icon:I.N2j,fixedWidth:!0}),onClick:s,children:(0,n.jsx)(x.cC,{id:"B495Gs"})})]})}),o&&(0,n.jsx)(k.h,{children:(0,n.jsx)(er,{theme:t,isOpen:!0,onClose:a})})]})}),el=e=>{let{isChecked:t,name:i}=e;return(0,n.jsxs)(s.U,{spacing:1,alignItems:"flex-start",children:[t&&(0,n.jsx)(r.n,{w:3,h:"auto",mr:1,mt:1,color:"trueblue.700"}),(0,n.jsx)(l.x,{fontSize:"sm",noOfLines:1,"data-testid":"theme-name",color:t?"trueblue.700":void 0,children:i})]})},eo=(0,m.memo)(e=>{var t,i,r,l;let{theme:C,onThemeClicked:b,isChecked:y=!1,onEditClick:k,variant:w="outline"}=e,S=(0,f.z$)(),E=(0,o.p)(),I="ghost"===w,_=(0,m.useRef)(null),A=(0,m.useCallback)(e=>()=>{k&&(e?k((0,v.mg)(C,!0)):k(C))},[k,C]),{isOpen:T,onOpen:O,onClose:P}=(0,a.q)({id:"ArchiveThemeModalDisclosure"}),{user:D,currentWorkspace:R}=(0,N.SE)(),[M]=(0,g.gFs)(),L=C.name.replace(v.Qk,""),F=(0,m.useCallback)(()=>
1{if(!D||!R)return;let{id:e,...t}=C;M({variables:{id:e},update:(e,t)=>{let{data:i}=t;(null==i?void 0:i.duplicateTheme)&&e.writeQuery({query:g.$LR,variables:{workspaceId:C.workspaceId,archived:!1},data:{themes:[i.duplicateTheme]}})},optimisticResponse:{duplicateTheme:{id:"temp",__typename:"Theme",...t,name:"".concat(L," (copy)"),archived:!1,createdTime:new Date().toISOString(),updatedTime:new Date().toISOString()}}}).then(t=>{let{data:i}=t;i&&(null==S||S.track(f.AA.THEME_DUPLICATED,{theme_id:i.duplicateTheme.id,source_theme_id:e,name:L}),null==S||S.track(f.AA.THEME_CREATED,{theme_id:i.duplicateTheme.id,name:i.duplicateTheme.name,type:"duplicate"}),E({title:h.ag._({id:"DvRoa4",values:{0:i.duplicateTheme.name}}),status:"success",duration:3e3,position:"top",isClosable:!0}))}).catch(e=>{console.error("Couldn't duplicate theme ".concat(C.name," error: ").concat(e)),E({title:h.ag._({id:"aOi88n",values:{err:e}}),status:"error",duration:3e3,position:"top",isClosable:!1})})},[D,R,C,M,L,S,E]),W=C.workspaceId&&!!(null===(t=C.createdBy)||void 0===t?void 0:t.displayName),H=!!b,V=!k;return(0,n.jsxs)(d.xu,{ref:_,bgColor:y?"trueblue.100":I?void 0:"linen.50",textAlign:"left",tabIndex:H?0:void 0,borderRadius:"md",transitionProperty:I?"common":"none",transitionDuration:"normal",outline:"none",onClick:()=>null==b?void 0:b(C),onKeyPress:e=>{H&&"Enter"===e.key&&(null==b||b(C))},_hover:H?{shadow:I||y?void 0:"lg",bgColor:y?"trueblue.100":I?"trueblue.50":"gray.100"}:void 0,_focus:{boxShadow:y||!H?void 0:"outline"},shadow:I?void 0:"md",p:I?2:0,"data-theme-id":C.id,"data-testid":y?"current-theme-preview":void 0,cursor:H?"pointer":void 0,children:[(0,n.jsx)(z.n,{theme:C,minH:"9em",maxH:"9em"}),(0,n.jsxs)(c.k,{align:"baseline",mt:1,direction:"column",p:I?0:2,children:[W&&(0,n.jsx)(c.k,{my:2,children:(0,n.jsx)(el,{name:L,isChecked:y})}),(0,n.jsxs)(s.U,{alignItems:"flex-start",w:"100%",children:[W?(0,n.jsx)(p.l,{createdByYou:(null===(i=C.createdBy)||void 0===i?void 0:i.id)===(null==D?void 0:D.id),createdByName:null===(r=C.createdBy)||void 0===r?void 0:r.displayName,createdByProfileImageUrl:null===(l=C.createdBy)||void 0===l?void 0:l.profileImageUrl,timestampDescription:C.updatedTime&&(0,n.jsx)(x.cC,{id:"E1dtM3",values:{0:(0,j.Dw)(C.updatedTime)}})}):(0,n.jsx)(el,{name:L,isChecked:y}),(0,n.jsx)(u.L,{}),V?null:C.workspaceId&&!C.archived?(0,n.jsx)(es,{theme:C,openThemeEditorWithThisTheme:A(!1),onDuplicate:F,onArchiveThemeModalOpen:O,isArchiveThemeModalOpen:T,onArchiveThemeModalClose:P}):C.workspaceId&&!0===C.archived?(0,n.jsx)(G,{theme:C}):(0,n.jsx)(U,{onCustomizeThemeClick:A(!0),onEditThemeClick:A(!1)})]})]})]})});eo.displayName="ThemePreview"},52394:function(e,t,i){"use strict";i.d(t,{t:function(){return D}});var n=i(52322),r=i(38035),s=i(36474),l=i(43297),o=i(42822),a=i(77533),d=i(62614),c=i(42946),u=i(49929),x=i(5879),h=i(2784),m=i(91994),p=i(30233),g=i(29705),j=i(47443),f=i(52929),v=i(28535),C=i(80877),b=i(74444),y=i(11082),k=i(94199),w=i(50260);let S=e=>{let{openThemeEditor:t}=e;return(0,n.jsxs)(l.K,{bg:"gray.100",p:4,textAlign:"left",spacing:4,borderRadius:"md",my:2,children:[(0,n.jsx)(a.x,{textAlign:"center",fontWeight:"700",children:(0,n.jsx)(x.cC,{id:"yNvg2Q"})}),(0,n.jsx)(a.x,{fontSize:"sm",color:"gray.700",children:(0,n.jsx)(x.cC,{id:"qYwzxB"})}),(0,n.jsx)(d.z,{onClick:t,variant:"solid",leftIcon:(0,n.jsx)(u.G,{icon:c.JyM}),"data-testid":"new-theme-button",children:(0,n.jsx)(x.cC,{id:"srRMnJ"})})]})};var E=i(67613),I=i(69251),_=i(26838);let A=e=>{let{themes:t,currentThemeId:i,setTheme:r,openThemeEditor:s}=e;return(0,n.jsx)(I.r,{gap:1,flex:1,my:2,templateColumns:{base:"repeat(2, minmax(0, 1fr))"},children:[...t].map(e=>(0,n.jsx)(_.o,{theme:e,isChecked:!!(i&&e.id===i),onEditClick:s,onThemeClicked:r,variant:"ghost"},e.id))})},T=(0,h.memo)(e=>{let{currentTheme:t,setTheme:i,openThemeEditor:r,openThemeEditorWithDefaultTheme:s}=e,o=(0,m.CG)(E.Y3),a=(0,m.CG)(E.C0);return!a&&r?(0,n.jsxs)(l.K,{spacing:8,children:[s&&(0,n.jsx)(S,{openThemeEditor:s}),(0,n.jsx)(A,{themes:o,currentThemeId:null==t?void 0:t.id,setTheme:i,openThemeEditor:r})]}):(0,n.jsxs)(n.Fragment,{children:[(null==t?void 0:t.archived)?(0,n.jsxs)(j.b,{status:"warning",mb:4,children:[(0,n.jsx)(f.z,{}),(0,n.jsxs)(v.xu,{children:[(0,n.jsx)(C.C,{children:(0,n.jsx)(x.cC,{id:"i7yZxh",values:{GAMMA_ARTIFACT_PROPER_NOUN:k.Yc}})}),(0,n.jsx)(b.X,{children:(0,n.jsx)(x.cC,{id:"jH2g5C",components:{0:(0,n.jsx)(y.r,{textDecoration:"underline",isExternal:!0,href:w.oH}),1:(0,n.jsx)(g.h,{mx:"2px"})}})})]})]}):null,(0,n.jsx)(l.K,{spacing:2,children:(0,n.jsx)(v.xu,{width:"100%",mx:0,children:(0,n.jsx)(A,{themes:o,currentThemeId:null==t?void 0:t.id,setTheme:i,openThemeEditor:r})})})]})});T.displayName="ThemePickerBodyInner";var O=i(93441),P=i(14324);let D=e=>{let{setTheme:t,openThemeEditor:i,openThemeEditorWithDefaultTheme:g,currentTheme:j,openBackgroun
1dPanel:f,shouldScrollToCurrent:v=!0,flexProps:C}=e,{isLoadingThemes:b}=(0,P.a)(),y=(0,m.CG)(E.FM);return(0,O.vm)(()=>{v&&!b&&"search"!==y&&(b||requestAnimationFrame(()=>{var e;return null===(e=document.querySelector('[data-theme-id="'.concat(null==j?void 0:j.id,'"]')))||void 0===e?void 0:e.scrollIntoView()}))},[b,null==j?void 0:j.id,y,v],[b,y]),(0,h.useEffect)(()=>{var e;null===(e=document.querySelector("[data-theme-picker-scroll-container]"))||void 0===e||e.scrollTo(0,0)},[y]),(0,n.jsxs)(r.k,{direction:"column",flex:1,h:"fit-content",...C,children:[b?(0,n.jsx)(p.S,{size:4}):(0,n.jsx)(T,{currentTheme:j,setTheme:t,openThemeEditor:i,openThemeEditorWithDefaultTheme:g}),f&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.L,{}),(0,n.jsxs)(l.K,{mt:12,mb:4,p:8,border:"1px solid",borderColor:"gray.200",spacing:4,bgColor:"gray.50",borderRadius:"md",align:"center",justifyContent:"center",children:[(0,n.jsx)(o.M,{children:(0,n.jsx)(a.x,{fontSize:"sm",children:(0,n.jsx)(x.cC,{id:"UNfHm4"})})}),(0,n.jsx)(d.z,{size:"sm",w:"fit-content",leftIcon:(0,n.jsx)(u.G,{icon:c.UHQ}),onClick:f,children:(0,n.jsx)(x.cC,{id:"+EZioz"})})]})]})]})}},83947:function(e,t,i){"use strict";i.d(t,{v:function(){return _}});var n=i(52322),r=i(24624),s=i(43297),l=i(74409),o=i(36474),a=i(62614),d=i(2338),c=i(28535),u=i(75768),x=i(32899),h=i(87651),m=i(85573),p=i(89099),g=i(16556),j=i(42946),f=i(49929),v=i(5879),C=i(87254),b=i(2784),y=i(8393),k=i(91994),w=i(67613),S=i(36651),E=i(93441);let I={dark:{label:(0,n.jsx)(v.cC,{id:"pvnfJD"})},light:{label:(0,n.jsx)(v.cC,{id:"1njn7W"})},professional:{label:(0,n.jsx)(v.cC,{id:"Oojfbh"})},colorful:{label:(0,n.jsx)(v.cC,{id:"Op7PhG"})}},_=(0,b.memo)(e=>{let{title:t,description:i,showDrawerCloseButton:_,openThemeEditorWithDefaultTheme:A,stackProps:T,currentTheme:O}=e,P=(0,k.TL)(),D=(0,k.CG)(w.FM),R=(0,k.CG)(w.s1),G=(0,b.useRef)(null),{currentWorkspace:z}=(0,S.SE)(),[N,M]=(0,b.useState)(""),L=(0,k.CG)(w.C0),F=(0,b.useCallback)(()=>{P((0,w.uG)({activeView:"search"})),setTimeout(()=>{var e;null===(e=G.current)||void 0===e||e.focus()},200)},[P]),U=(0,b.useCallback)(e=>{P((0,w.ql)({searchQuery:e}))},[P]),W=(0,E.Kt)(U,500),H=(0,b.useCallback)(e=>{M(e),W(e)},[W]),V=(0,b.useCallback)(e=>{let t=[...R];R.includes(e)?t=t.filter(t=>t!==e):t.push(e),P((0,w.LT)({filterKeywords:t}))},[R,P]);return(0,E.vm)(()=>{"search"!==D&&(O&&O.workspaceId?P((0,w.uG)({activeView:"custom"})):P((0,w.uG)({activeView:"standard"})))},[P,O,D],[O]),(0,b.useEffect)(()=>()=>{P((0,w.mc)())},[]),(0,n.jsxs)(s.K,{spacing:4,...T,children:[(0,n.jsxs)(s.K,{spacing:8,children:[(0,n.jsxs)(s.K,{spacing:4,children:[(0,n.jsxs)(s.K,{direction:"row",width:"100%",pr:_?10:void 0,children:[(0,n.jsx)(l.X,{fontSize:"3xl",children:t}),(0,n.jsx)(o.L,{}),!!A&&z&&L&&(0,n.jsx)(a.z,{size:"sm",variant:"solid",leftIcon:(0,n.jsx)(f.G,{icon:j.r8p}),onClick:A,"data-testid":"new-theme-button",children:(0,n.jsx)(v.cC,{id:"FiwgR9"})}),_&&(0,n.jsx)(d.o,{})]}),i?(0,n.jsx)(c.xu,{children:i}):(0,n.jsx)(n.Fragment,{})]}),L&&(0,n.jsxs)(u.h,{variant:"ghost",size:"sm",borderRadius:"full",w:"100%",children:[(0,n.jsx)(a.z,{borderRadius:"full",w:"50%",leftIcon:(0,n.jsx)(f.G,{icon:j.D0h,fixedWidth:!0}),"data-theme-picker-active-view-button":"custom",colorScheme:"custom"===D?"trueblue":"gray",bg:"custom"===D?"trueblue.100":"gray.100",onClick:()=>P((0,w.uG)({activeView:"custom"})),children:(0,n.jsx)(v.cC,{id:"8Tg/JR"})}),(0,n.jsx)(a.z,{borderRadius:"full",w:"50%",leftIcon:(0,n.jsx)(c.xu,{w:3.5,children:(0,n.jsx)(y.Y,{})}),"data-theme-picker-active-view-button":"standard",colorScheme:"standard"===D?"trueblue":"gray",bg:"standard"===D?"trueblue.100":"gray.100",onClick:()=>P((0,w.uG)({activeView:"standard"})),children:(0,n.jsx)(v.cC,{id:"TJBHlP"})}),(0,n.jsx)(x.h,{icon:(0,n.jsx)(r.G,{}),isRound:!0,"data-theme-picker-active-view-button":"search","aria-label":C.ag._({id:"A1taO8"}),variant:"ghost",colorScheme:"search"===D?"trueblue":"gray",bg:"search"===D?"trueblue.100":"gray.100",onClick:F})]})]}),(0,n.jsx)(h.U,{in:"search"===D,children:(0,n.jsx)(m.I,{ref:G,w:"100%",placeholder:C.ag._({id:"L0fOnm"}),value:N,onChange:e=>{H(e.target.value)}})}),(0,n.jsx)(h.U,{in:"standard"===D,children:(0,n.jsx)(p.E,{children:Object.entries(I).map(e=>{let[t,{label:i}]=e,r=R.includes(t);return(0,n.jsx)(g.Vp,{size:"md",letterSpacing:"normal",cursor:"pointer",onClick:()=>{V(t)},_hover:{bgColor:r?"trueblue.200":"blackAlpha.200"},colorScheme:r?"trueblue":"blackAlpha",children:i},t)})})})]})});_.displayName="ThemePickerHeader"},86963:function(e,t,i){"use strict";i.d(t,{g:function(){return d}});var n=i(9850),r=i.n(n),s=i(2784),l=i(47749);let o={theme:l.mU,themeValidationError:null,status:"new",themeBackgroun
1dImgStatus:"idle",themeLogoImgStatus:"idle",customizationStep:null,originalTheme:null};function a(e,t){switch(t.type){case"NEW_BLANK_THEME":return{...r()(o),customizationStep:"customization"};case"THEME_RESET":return r()(o);case"SET_THEME_EDITING":{let{theme:i}=t.data,n=r()(i);return{...e,status:"editing",theme:i,originalTheme:n,customizationStep:"customization"}}case"SET_NEW_THEME_FOR_SELECTING":{let{theme:i}=t.data;return{...e,status:"new",theme:i,customizationStep:"selection"}}case"SET_NEW_THEME_FOR_CUSTOMIZING":{let{theme:i}=t.data,n=r()(i);return{...e,theme:i,originalTheme:n,customizationStep:"customization"}}case"THEME_UPDATE_THEME_PROPS":{let{theme:i}=e,{themeProps:n}=t.data;return{...e,theme:{...i,...n}}}case"THEME_UPDATE_THEME_CONFIG":{let{theme:i}=e,{themeConfig:n}=t.data;return{...e,theme:{...i,config:{...i.config,...n}}}}case"THEME_UPDATE_THEME_KEYWORDS":{let{theme:i}=e,{keywords:n}=t.data;return{...e,theme:{...i,config:{...i.config,keywords:{color:[],tone:[],...i.config.keywords,...n}}}}}case"THEME_BACKGROUND_IMAGE_UPLOAD_STARTED":{let{theme:i}=e,{background:n}=t.data;
1return{...e,themeBackgroundImgStatus:"loading",theme:{...i,config:{...i.config,background:n}}}}case"THEME_BACKGROUND_UPDATE_SUCCESS":{let{theme:i}=e,{background:n}=t.data;return{...e,themeBackgroundImgStatus:"idle",theme:{...i,config:{...i.config,background:n}}}}case"THEME_BACKGROUND_IMAGE_UPLOAD_FAIL":return{...e,themeBackgroundImgStatus:"idle"};case"THEME_LOGO_UPLOAD_STARTED":return{...e,themeLogoImgStatus:"loading"};case"THEME_LOGO_UPLOAD_SUCCESS":{let{theme:i}=e,{logoUrl:n}=t.data;return{...e,themeLogoImgStatus:"idle",theme:{...i,logoUrl:n}}}case"THEME_LOGO_UPLOAD_FAIL":return{...e,themeLogoImgStatus:"idle"};case"THEME_UPDATE_THEME_NAME":{let{theme:i}=e,{name:n}=t.data;return{...e,theme:{...i,name:n},themeValidationError:null}}case"THEME_VALIDATION_ERROR":{let{errorMessage:i}=t.data;return{...e,themeValidationError:i}}case"THEME_VALIDATION_ERROR_RESET":return{...e,themeValidationError:null}}}function d(){return s.useReducer(a,o)}},86783:function(e,t,i){"use strict";i.d(t,{z:function(){return g}});var n=i(52322),r=i(38035),s=i(87254),l=i(2784),o=i(64467),a=i(91994),d=i(91579),c=i(58879),u=i(46741),x=i(97676);let h={fontFamily:'"Inter", sans-serif !important',fontWeight:"500",lineHeight:"1.5 !important",textTransform:"none",letterSpacing:"normal !important",textAlign:"left !important",margin:"0 !important",color:"gray.800 !important",background:"none !important",border:"0 none !important",padding:"0 !important",content:'""'},m={".block-paragraph,.block-heading,.block-title,.block-todo,.block-numbered,.block-bullet":{...h,margin:0,my:"0.75em",":first-child":{mt:"0px !important"},":last-child":{mb:"0px !important"}},".block-paragraph":{fontSize:"1em"},".block-heading,.block-title":{fontWeight:"bold",lineHeight:{fontSize:"1.25"},'.heading[level="1"]':{fontSize:"1.5em"},'.heading[level="2"]':{fontSize:"1.25em"},'.heading[level="3"]':{fontSize:"1.125em"},'.heading[level="4"]':{fontSize:"1em"}},".block-title":{".title":{fontSize:"1.75em"}},a:{...h,color:"var(--chakra-colors-blue-500) !important","&:hover":{textDecoration:"underline"},cursor:"pointer"},".mention":{bgColor:"trueblue.50",whiteSpace:"break-spaces"},code:{backgroundColor:"var(--chakra-colors-trueblue-50)",color:"var(--body-color)",...x.FC}},p={".ProseMirror":{height:"100%"},...m,...u.dE,"--box-border-radius":"var(--chakra-radii-sm)","--link-color":"var(--chakra-colors-trueblue-500)",".block-todo label.chakra-checkbox .chakra-checkbox__control:not([data-checked])":{borderColor:"var(--chakra-colors-chakra-border-color)"},"--body-color-inverted":"white",".is-selecting-node":{"[data-selection-ring]":{_before:{content:'""',position:"absolute",inset:0,borderRadius:"inherit",outline:"2px solid",outlineColor:"trueblue.300",pointerEvents:"none",zIndex:1}},'[data-selection-ring="padded"]':{_before:{outlineOffset:"0.25em"}}}},g=(0,l.memo)(e=>{let{isEditable:t,notesSx:i,canShowEditHint:u=!1}=e,[x,h]=(0,l.useState)(null),{destroyEditor:m,mountEditor:g}=(0,a.CG)(o.Vy);(0,l.useEffect)(()=>(g&&h(g()),()=>{null==m||m(),h(null)}),[m,g]),(0,l.useEffect)(()=>{x&&t&&x.commands.focus("end")},[t,x]),(0,l.useEffect)(()=>{if(x){if(t&&!x.isEditable){x.setEditable(!0);return}if(!t&&x.isEditable){x.setEditable(!1);return}}},[t,x]);let j=t?s.ag._({id:"fnNtuR"}):"Double click to edit",f=u&&x&&x.isEmpty;return(0,n.jsx)(r.k,{overflowY:"auto",border:"1px solid",borderColor:"gray.200",borderRadius:"md",flex:1,p:4,wordBreak:"break-word",sx:{".block.block-paragraph.first-block.last-block.is-empty::before":{...c.BI,content:'"'.concat(j,'"')},...p,...i,_before:f?{...c.BI,top:2,left:2,height:"auto",width:"auto",content:'"'.concat(s.ag._({id:"CvH5f/"}),'"')}:{}},pos:"relative",children:(0,n.jsx)(r.k,{flex:1,flexDirection:"column",children:x&&(0,n.jsx)(d.k,{editor:x,className:"highlight-mask",style:{height:"100%"}})})})});g.displayName="CardNotesEditor"},12136:function(e,t,i){"use strict";i.d(t,{e:function(){return p}});var n=i(52322),r=i(70065),s=i(5879),l=i(5632),o=i(2784),a=i(93202),d=i(49165),c=i(11050),u=i(84405),x=i(36651),h=i(41425),m=i(23147);let p=()=>{let[e]=(0,a.So6)({refetchQueries:["GetDocs"]}),{push:t}=(0,l.useRouter)(),i=(0,r.p)(),{user:p,currentWorkspace:g}=(0,x.SE)(),j=(0,c.z$)(),f=(0,o.useCallback)(r=>{var l;let{docId:o,docTitle:a,initialContent:x,channelId:f,source:v,openThemeEditor:C,onSuccess:b,newWindow:y}=r,k=null==p?void 0:null===(l=p.settings)||void 0===l?void 0:l.needsEditorOnboarding;if(!o)return Promise.reject(Error("Cannot duplicate without a docId"));let w=i({id:"duplicate-toast-".concat(o),isClosable:!1,position:"top",status:"loading",variant:"light",duration:null,title:(0,n.jsx)(s.cC,{id:"OvEjsP"})});return p&&(null==g?void 0:g.id)?e({variables:{duplicateDocInput:{orgId:null==g?void 0:g.id,sourceDocId:o,source:d.R[v],initialContent:x?{ydoc:(0,m.qI)(x),schemaVersion:h.bI,editors:[null==p?void 0:p.id]}:void 0,...f?{channels:[{channelId:f}]}:{}}}}).then(e=>{var r,l;if(!(null==e?void 0:null===(r=e.data)||void 0===r?void 0:r.duplicateDoc))throw Error("No data received");null==j||j.track(c.AA.EXAMPLE_DUPLICATED,{doc_id:o,title:a,source:v});let{id:d}=null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.duplicateDoc;(0,u.Q)({doc_id:d,source:v,source_doc_id:o}),console.debug("[Duplicate.".concat(v,"] Doc duplicated New doc id (").concat(d,"). Navigating to Editor")),i.update(w,{status:"success",description:(0,n.jsx)(s.cC,{id:"zzDlyQ"}),duration:5e3,isClosable:!0});let x=C?"/docs/".concat(d).concat(C?"?openThemeEditor=true":""):k?"/docs/".concat(d,"?tour=true"):"/docs/".concat(d);y?window.open(x,"_blank"):t(x),b&&d&&b(d)},e=>{console.error("[Duplicate.".concat(v,"] Error duplicating doc:"),e.message),i.update(w,{title:(0,n.jsx)(s.cC,{id:"ADJtFi"}),description:e.message,status:"error",duration:null,isClosable:!0})}).catch(e=>{console.error("[Duplicate.".concat(v,"] Error duplicating doc:"),e.message),i.update(w,{title:(0,n.jsx)(s.cC,{id:"ADJtFi"}),description:e.message,status:"error",duration:null,isClosable:!0})}):(console.error("[Duplicate.".concat(v,"] Cannot duplicate without a user or workspace"),{user:p}),Promise.reject(Error("Cannot duplicate without a user or workspace")))},[null==g?void 0:g.id,p,i,e,j,t]);return f}},82245:function(e,t,i){"use strict";i.d(t,{A:function(){return n},i:function(){return r}});let n=e=>e.endsWith("gmail.com")||e.endsWith("hotmail.com")||e.endsWith(".edu"),r="gamma_logged_in"},83727:function(e,t,i){"use strict";i.r(t),i.d(t,{PublicPage:function(){return u}});var n=i(52322),r=i(71537),s=i(409),l=i(66347),o=i(44631),a=i(77627),d=i(86793),c=i(90221);let u=()=>((0,d.o)(o.Z.PUBLIC_STATIC),(0,n.jsx)(a.m,{children:(0,c.s2)()?(0,n.jsx)(l.nz,{docEditorType:o.Z.PUBLIC_STATIC}):(0,n.jsx)(l.Ur,{docEditorType:o.Z.PUBLIC_STATIC})}
1));t.default=(0,r.z)((0,s.oO)(u,{isViewOnly:!0}))},75692:function(e,t,i){"use strict";i.d(t,{nP:function(){return _},tE:function(){return w},vP:function(){return k}});var n=i(52322),r=i(77533),s=i(332),l=i(28535),o=i(74409),a=i(69251),d=i(30523),c=i(19783),u=i(32899),x=i(54933),h=i(49929),m=i(5879),p=i(87254),g=i(87202),j=i(2784),f=i(17292),v=i(87827),C=i(91994),b=i(58184);let y=(0,g.ZP)("mod+Escape"),k=new Set(["h","j","k","l","s","PageUp","PageDown","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Enter","Escape"]),w=e=>{let{enabled:t,setActiveKey:i}=e,n=(0,C.CG)(v.C),{handlePresentNavigationEvent:r,spotlightingByBlock:s}=(0,b._)();return(0,j.useEffect)(function(){if(t)return f.F7.on("keydown","NAVIGATION_CONTROLS",e=>{var t,s;let l=e.target;if((null==l?void 0:null===(t=l.closest)||void 0===t?void 0:t.call(l,"[data-gamma-child-tiptap-editor]"))||(null==l?void 0:null===(s=l.closest)||void 0===s?void 0:s.call(l,"input"))||e.metaKey||n)return!1;let o=e.key;switch(k.has(o)&&("s"!==o&&(i(e.key),setTimeout(()=>{i(null)},100)),e.preventDefault()),o){case"s":return r({eventType:"toggleSpotlight",eventKey:o});case"l":case"ArrowRight":return r({eventType:"arrowRight",eventKey:o});case"h":case"ArrowLeft":return r({eventType:"arrowLeft",eventKey:o});case"j":case"ArrowDown":case"PageDown":return r({eventType:"arrowDown",eventKey:o});case"k":case"ArrowUp":case"PageUp":return r({eventType:"arrowUp",eventKey:o});case"r":return r({eventType:"restart",eventKey:o});case"Escape":if(y(e))return!1;return r({eventType:"cancelCurrentAction",eventKey:o});case"Enter":return r({eventType:"toggleExpanded",eventKey:o});default:return!1}})},[t,r,n,i]),s},S=e=>{let t=new KeyboardEvent("keydown",{key:e});i.g.dispatchEvent(t)},E={ArrowUp:{icon:x.FPD,label:(0,n.jsx)(m.cC,{id:"VbggDE"}),ariaLabel:()=>p.ag._({id:"VbggDE"}),shortcuts:["â","K"],key:"ArrowUp",onClick:()=>{S("ArrowUp")},gridPos:[1,2]},ArrowLeft:{icon:x.acZ,label:(0,n.jsx)(m.cC,{id:"4jciC3"}),ariaLabel:()=>p.ag._({id:"4jciC3"}),shortcuts:["â","H"],key:"ArrowLeft",onClick:()=>{S("ArrowLeft")},gridPos:[2,1]},ArrowDown:{icon:x.r5q,label:(0,n.jsx)(m.cC,{id:"e3GOIZ"}),ariaLabel:()=>p.ag._({id:"e3GOIZ"}),shortcuts:["â","J"],key:"ArrowDown",onClick:()=>{S("ArrowDown")},gridPos:[2,2]},ArrowRight:{icon:x.eFW,label:(0,n.jsx)(m.cC,{id:"ZjQRVw"}),ariaLabel:()=>p.ag._({id:"ZjQRVw"}),shortcuts:["â","L"],key:"ArrowRight",onClick:()=>{S("ArrowRight")},gridPos:[2,3]},Spotlight:{icon:x.GTX,label:(0,n.jsx)(m.cC,{id:"Xon9jp"}),ariaLabel:()=>p.ag._({id:"Xon9jp"}),shortcuts:["S"],key:"S",onClick:()=>{S("s")},gridPos:[1,3]}},I=e=>{let{shortcuts:t}=e;return(0,n.jsx)(r.x,{as:"span",color:"gray.400",ml:2,children:t.map((e,i)=>(0,n.jsxs)(j.Fragment,{children:[e,i===t.length-1?null:(0,n.jsx)(r.x,{fontSize:"11px",as:"span",color:"gray.500",mx:1,children:"or"})]},e))})},_=e=>{let{activeKey:t,spotlightingByBlock:i}=e;return(0,n.jsx)(s.h,{children:(0,n.jsxs)(l.xu,{position:"absolute",bottom:4,right:6,zIndex:"sticky",children:[(0,n.jsx)(o.X,{children:(0,n.jsx)(m.cC,{id:"wja8aL"})}),(0,n.jsx)(a.r,{gridTemplateColumns:"repeat(3, 1fr)",gridTemplateRows:"repeat(2, 1fr)",children:Object.values(E).map(e=>{let{gridPos:s,icon:l,label:o,ariaLabel:a,shortcuts:x,key:m,onClick:p}=e,g=t===m;return(0,n.jsx)(d.P,{gridColumn:s[1],gridRow:s[0],children:(0,n.jsx)(c.u,{hasArrow:!0,placement:"top",label:(0,n.jsxs)(r.x,{whiteSpace:"nowrap",children:[o,(0,n.jsx)(I,{shortcuts:x})]}),children:(0,n.jsx)(u.h,{m:1,shadow:"base",size:"md",variant:"S"==m&&i?"solid":"plain",isActive:g||"S"===m&&i,onClick:p,onMouseDown:e=>e.preventDefault(),"aria-label":a(),icon:(0,n.jsx)(h.G,{icon:l})})})},m)})})]})})}},58184:function(e,t,i){"use strict";i.d(t,{_:function(){return p}});var n=i(2784),r=i(34922),s=i(91994),l=i(24781),o=i(11050),a=i(97857),d=i(61750),c=i(82400),u=i(54999),x=i(47968),h=i(12825);let m=function(e,t){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=(0,l.cC)("editor"),r=n.scroller;if(!r)return;e.commands.turnOffSpotlight();let s=r.scrollHeight-r.offsetHeight;if("down"===t){let t=n.isAtBottom(90),l=t&&i&&e.commands.spotlightNextCard(!1,"top");if(!l){let e=r.scrollTop+.5*r.offsetHeight;e>s-150&&(e=s),n.scrollTo({top:e})}}else{let t=n.isAtTop(90),s=t&&i&&e.commands.spotlightNextCard(!0,"bottom");if(!s){let e=r.scrollTop-.5*r.offsetHeight;e<150&&(e=0),n.scrollTo({top:e})}}},p=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.R0.MAIN_PRESENT_VIEW,{editor:t}=(0,h._)(),i=(0,o.z$)(),{enabled:l}=(0,d.gZ)(t),p=(0,s.qr)(),g=(0,n.useCallback)(n=>{let{eventType:s,eventKey:l,method:d="keyboard",payload:h={}}=n;if(!t)return!1;let g=p.getState(),j=(0,x.k8)(g),f=null==j?void 0:j.pos,v=!!(t&&j&&(0,c.Jg)(t,j)),
1C=Object.keys((0,x.X9)(g).tree);switch(s){case"toggleSpotlight":return v?null==t||t.commands.turnOffSpotlight():null==t||t.commands.spotlightNextBlock(),!0;case"goToCard":{let{cardId:e}=h;if(!e)return!1;return t.commands.spotlightCardById(e,v),p.dispatch((0,x.Qx)({attached:!1})),!0}case"arrowRight":return(0,r.p7)(),p.dispatch((0,x.Qx)({attached:!1})),null==i||i.trackDocEvent(o.AA.PRESENT_MODE_NAVIGATED,{direction:o.xQ.CARD_NEXT,method:"keyboard"===d?o.SY.KEYBOARD:o.SY.BUTTON_CLICK,source:e,...void 0!==l&&{key:l}}),t.commands.spotlightNextCard();case"arrowLeft":return(0,r.p7)(),p.dispatch((0,x.Qx)({attached:!1})),null==i||i.trackDocEvent(o.AA.PRESENT_MODE_NAVIGATED,{direction:o.xQ.CARD_PREV,method:"keyboard"===d?o.SY.KEYBOARD:o.SY.BUTTON_CLICK,source:e,...void 0!==l&&{key:l}}),t.commands.spotlightNextCard(!0);case"arrowDown":if((0,r.p7)(),p.dispatch((0,x.Qx)({attached:!1})),!v){let e=(0,a.ei)(t.state.selection);return t.commands.goToNextExpandableNode()||m(t,"down",!e),!0}return null==i||i.trackDocEvent(o.AA.PRESENT_MODE_NAVIGATED,{direction:o.xQ.TELEPROMPTER_DOWN,method:"keyboard"===d?o.SY.KEYBOARD:o.SY.BUTTON_CLICK,source:e,...void 0!==l&&{key:l}}),t.commands.spotlightNextBlock();case"arrowUp":if((0,r.p7)(),p.dispatch((0,x.Qx)({attached:!1})),!v){let e=(0,a.ei)(t.state.selection);return t.commands.goToNextExpandableNode(!0)||m(t,"up",!e),!0}return null==i||i.trackDocEvent(o.AA.PRESENT_MODE_NAVIGATED,{direction:o.xQ.TELEPROMPTER_UP,method:"keyboard"===d?o.SY.KEYBOARD:o.SY.BUTTON_CLICK,source:e,...void 0!==l&&{key:l}}),t.commands.spotlightNextBlock(!0);case"restart":if(C[0])return(0,r.p7)(),t.commands.spotlightCardById(C[0]),p.dispatch((0,x.Qx)({attached:!1})),!0;return!1;case"cancelCurrentAction":{let e=v&&f;if(t.commands.spotlightCollapseNearestExpandableNode(e?f:null))return t.commands.reHighlightExpandableNode(),!0;if(v)return t.commands.turnOffSpotlight(),!0;return p.dispatch((0,x.Qx)({attached:!1})),null==i||i.track(o.AA.CARD_COLLAPSED,{is_present_mode:!0,method:"escape_key"}),t.commands.ascendUpToParentCard(!1)}case"toggleExpanded":{let e=v&&f,i=t.commands.expandOrCollapseExpandableNode(e?f:null);if(i)return!0;if(e){let e=t.state.doc.resolve(f),i=e.parent;if(i&&(0,u.AH)(i))return(0,u.xB)(i.attrs.id,!1),t.commands.spotlightNextBlock(!0),!0;return t.commands.spotlightCollapseNearestExpandableNode(f)}return!1}default:return!1}},[i,t,e,p]);return{handlePresentNavigationEvent:g,spotlightingByBlock:l}}},48105:function(e,t,i){"use strict";i.d(t,{VN:function(){return x},rJ:function(){return c},us:function(){return u}});var n=i(2784),r=i(42111),s=i(91994),l=i(35873),o=i(47968),a=i(90439);let d="disable-card-size-animations",c=()=>{let e=(0,r.ye)("autoZoomToFit"),t=(0,s.CG)(o.Kk);return null!=t?t:e},u=()=>{let e=(0,s.CG)(o.i2),t=(0,n.useRef)(),i=c(),r=!a.Pv&&i;(0,n.useEffect)(()=>{let i=!t.current;t.current=e;let n=i?l.nY:l.id/4;e&&r&&setTimeout(()=>{document.body.classList.add(d),x(),setTimeout(()=>{document.body.classList.remove(d)},l.id/2)},n)},[e,r])},x=()=>{let e=(0,s.bh)(),t=document.documentElement.clientHeight,i=document.querySelector('[data-animate-value="presentCurrent"][data-card-scroll-element]');i&&(e.dispatch((0,o.Ic)({zoomLevel:1})),setTimeout(()=>{let n=i.scrollHeight,r=t/n;if(a.QX)r=Math.max(t/n,.7);else{if(r<.7)return;r=Math.floor(10*r)/10}e.dispatch((0,o.Ic)({zoomLevel:r}
1)),console.debug("[zoomPresentModeToFit] zooming",JSON.stringify({viewportHeight:t,cardHeight:n,targetZoom:r}))}))}},86793:function(e,t,i){"use strict";i.d(t,{o:function(){return h}});var n=i(21805),r=i(2784),s=i(14274),l=i(76332),o=i(42111),a=i(91994),d=i(21733),c=i(82245),u=i(44631),x=i(97590);let h=e=>{let t=(0,a.CG)(x.yx),i=(0,r.useMemo)(()=>!!n.Z.get(c.i),[]),h=(0,d.we)(),m=(0,a.TL)(),p=(0,a.CG)(x.fh),g=(0,o.ye)("docEditorForcePublicStatic"),j=(0,r.useMemo)(()=>{var e,n;let r=new URLSearchParams(window.location.search),o=r.get("following_id")&&r.get("follow_on_start");if(o)return!0;if(!t)return i;let a=null===(n=t.accessLinks)||void 0===n?void 0:null===(e=n.find(e=>e.token===s.v.SHARE_TOKEN))||void 0===e?void 0:e.permission,d=a&&[l.y3$.Edit,l.y3$.Comment].includes(a);return d||h.can(l.y3$.Comment,t)||h.can(l.y3$.Edit,t)||h.can(l.y3$.Manage,t)},[h,t,i]);(0,r.useEffect)(()=>{let t=g?u.Z.PUBLIC_STATIC:e||(j?u.Z.COLLABORATIVE:u.Z.PUBLIC_STATIC);m((0,x.R8)({docEditorType:t}))},[m,e,g,j]);let f=e||(j?u.Z.COLLABORATIVE:u.Z.PUBLIC_STATIC);return console.debug("useSetDocEditorType",{canUseCollaborativeEditor:j,docEditorType:p,fallbackEditor:f,override:e}),p||f}},66347:function(e,t,i){"use strict";i.d(t,{dM:function(){return u5},Ur:function(){return uU},nz:function(){return xs},_i:function(){return n4._i}});var n,r,s,l=i(52322),o=i(38035),a=i(77533),d=i(28535),c=i(73200),u=i(42946),x=i(49929),h=i(5879),m=i(87254),p=i(97729),g=i.n(p),j=i(2784),f=i(43997),v=i(93202),C=i(75279),b=i(30384),y=i(37869),k=i(16690),w=i(55478),S=i(43679),E=i(34071),I=i(32899),_=i(39429),A=i(48394),T=i(30733),O=i.n(T),P=i(12436),D=i.n(P),R=i(76919);class G extends R.v{cleanup(){document.removeEventListener("mousemove",this.throttled)}constructor(){super(),this.throttled=D()(e=>{this.emit("move",e)},200,{leading:!0}),document.addEventListener("mousemove",this.throttled)}}let z=O()(()=>new G),N=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=z(),[n,r]=(0,j.useState)(!1),s=(0,j.useRef)(t);return(0,j.useEffect)(()=>{s.current=t},[t]),(0,j.useEffect)(()=>i.on("move",t=>{s.current||r(e(t))}),[i,e]),n};var M=i(91994),L=i(47968),F=i(89458),U=i(88640),W=i(27537),H=i(60617),V=i(33022);let B=(0,j.memo)(()=>{let{isOpen:e,onToggle:t,onClose:i}=(0,w.q)(),[n,r]=(0,F.I)(U.H.hasSeenCoachBar,!1),s=(0,M.CG)(L.Tf),o=(0,j.useCallback)(()=>{n||r(!0),i()},[n,i,r]),a=!n||e,d=N((0,j.useCallback)(e=>e.clientX>window.innerWidth-150&&e.clientY>window.innerHeight-150,[]));return(0,l.jsx)(H.H,{mr:s&&n&&!a&&!d?"-100%":"0px",transitionProperty:"margin-right",transitionDuration:"ultra-slow",transitionTimingFunction:"ease-in-out",children:(0,l.jsxs)(S.J,{returnFocusOnClose:!1,isOpen:a,onClose:o,closeOnBlur:!0,children:[(0,l.jsx)(E.x,{children:(0,l.jsx)(I.h,{onClick:()=>{e&&r(!0),t()},"aria-label":"Help",isRound:!0,size:"md",icon:(0,l.jsx)(x.G,{icon:u.UFh})})}),(0,l.jsx)(_.y,{...W.Ro,children:(0,l.jsx)(A.b,{children:(0,l.jsx)(V.C,{onClose:o})})})]})})});B.displayName="PresentModeHelpWidget";var K=i(94199),q=i(67964),Y=i(58632),Z=i(10653),X=i(16770);let J=()=>(0,M.CG)((0,X.CO)("left")),Q=()=>(0,M.CG)((0,X.CO)("right")),$=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=e.panelPosition,n=(0,f.I0)(),r=(0,M.CG)((0,X.OC)(e)),s=(0,j.useCallback)(()=>{n((0,X.uJ)({component:e}))},[e,n]);(0,Y.v)(()=>{!t&&r&&n((0,X.sR)({position:i}))},[r,n,t,i],[t]);let l=(0,j.useCallback)(s=>{if(!t)return;let l=!r;(null==s?void 0:s.override)==="open"?l=!0:(null==s?void 0:s.override)==="closed"&&(l=!1),l?n((0,X.Yp)({component:e,disableTransition:!!(null==s?void 0:s.disableTransition)})):n((0,X.sR)({position:i}))},[e,i,r,n,t]);return{togglePanel:l,initPanel:s,isPanelOpen:r}},ee=()=>{let e=(0,j.useMemo)(()=>new Z.st,[]),t=(0,j.useMemo)(()=>new Z.st,[]),i=(0,j.useMemo)(()=>new Z.st,[]);return(0,j.useEffect)(()=>{if(!i||!e||!t)return;let n=e.pipe(i),r=t.pipe(i);return()=>{n(),r()}},[e,t,i]),{leftPanelLifecycle:e,rightPanelLifecycle:t,globalPanelLifecycle:i}};var et=i(48929),ei=i(90419),en=i(96933),er=i(4425);let es=(e,t,i)=>Math.min(Math.max(e,t),i),el=e=>
1{let{setWidth:t,width:i,position:n,onClose:r,panelRef:s,initialWidth:a,isDragging:c,setIsDragging:u}=e,x=(0,j.useMemo)(()=>(0,er.n)(),[]),h=x>0&&"right"===n,[m,p]=(0,j.useState)(i),[g,f]=(0,j.useState)(null),v=D()(e=>{let t;let i=es(t="left"===n?e.clientX:-((e.clientX-g)*1)+m,ei.pn,ei.ZQ);t<=ei.Nh?(s.current.style.transitionProperty="width",s.current.style.transitionDuration="var(--chakra-transition-duration-normal)",i=0):i>ei.pn&&(s.current.style.transitionProperty="",s.current.style.transitionDuration=""),s.current.style.width="".concat(i,"px")},30),C=()=>{u(!1),f(null);let e=s.current.style.width;"0px"===e?(r(),t(a)):t(parseInt(e.replace("px",""),10)),s.current.style.transitionProperty="",s.current.style.transitionDuration="",window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",C)};(0,j.useEffect)(()=>(g&&(window.addEventListener("mousemove",v),window.addEventListener("mouseup",C)),()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",C)}),[g]);let b={};return b="left"===n?{right:-4,position:"absolute"}:h?{position:"relative"}:{left:-4,position:"absolute"},(0,l.jsx)(o.k,{h:"100%",bg:h?"gray.200":c?"blackAlpha.200":"rgba(0,0,0,0)",w:h?2:4,justifyContent:"center",alignItems:"center",cursor:"col-resize",_hover:{bg:h?"gray.400":"blackAlpha.200"},transitionProperty:"common",transitionDuration:"normal",role:"group",onMouseDown:e=>{e.preventDefault(),u(!0),f(e.clientX),p(i)},position:"absolute",display:["none","none","none","flex"],...b,children:!h&&(0,l.jsx)(d.xu,{bg:"white",borderRadius:"full",w:1,h:10,opacity:c?1:".5",transitionProperty:"common",transitionDuration:"normal",_groupHover:{opacity:1}})})},eo={ifPanelHasRoomToOpen:function(e,t){return{base:t,xl:e}}},ea=e=>{var t;let{position:i,panelLifecycle:n}=e,r=(0,j.useRef)(),[s,a]=(0,j.useState)(!1),d=(0,f.I0)(),c=(0,M.CG)((0,X.SL)(i)),u=(0,M.CG)((0,X.Fw)(i)),x=(0,M.CG)((0,X.CO)(i)),h=(0,M.CG)((0,X.eh)(i)),m=null!==(t=null==h?void 0:h.canCollapse)&&void 0!==t&&t,p=(0,j.useCallback)(()=>{d((0,X.sR)({position:i}))},[d,i]),g=(0,j.useCallback)(()=>{d((0,X.Yp)({component:h}))},[h,d]),v=(0,j.useCallback)(e=>{d((0,X.UG)({width:e,position:i})),n.emit("resize",{})},[d,n,i]),C={zIndex:Number((0,et.dQ)("zIndices","overlay"))+1,position:eo.ifPanelHasRoomToOpen("relative","fixed"),top:eo.ifPanelHasRoomToOpen(0,"var(--editor-padding-top)"),bottom:0,[i]:0};u||s||(C.transitionProperty="width",C.transitionDuration="normal"),(0,j.useEffect)(()=>{let e=e=>{"width"===e.propertyName&&n.emit("resize",{})};return r.current.addEventListener("transitionend",e),()=>{r.current&&r.current.removeEventListener("transitionend",e)}},[n,r]);let b=(0,en.i)(eo.ifPanelHasRoomToOpen(!0,!1))||!1;return(0,j.useEffect)(()=>{c&&!b&&m&&p()},[b,c,p,m]),(0,l.jsxs)(o.k,{ref:r,...C,style:{width:c||m?x:0},maxW:"100%","data-print-hidden":!0,children:[c&&"right"===i&&(0,l.jsx)(el,{isDragging:s,setIsDragging:a,position:i,width:x,setWidth:v,panelRef:r,onClose:p,initialWidth:ei.Ld}),(0,l.jsx)(Z.Mn.Provider,{value:n,children:h&&(c||m)&&(0,l.jsx)(h,{isDragging:s,isOpen:c,closePanel:p,openPanel:g,panelRef:r,lifecycle:n,hasRoomToOpen:b})}),c&&"left"===i&&(0,l.jsx)(el,{isDragging:s,setIsDragging:a,position:i,width:x,setWidth:v,panelRef:r,onClose:p,initialWidth:ei.X9})]})},ed=(0,j.memo)(e=>(0,l.jsx)(ea,{position:"right",...e}));ed.displayName="RightPanelContainer";let ec=(0,j.memo)(e=>(0,l.jsx)(ea,{position:"left",...e}));ec.displayName="LeftPanelContainer";var eu=i(50019),ex=i(29117),eh=i(62614),em=i(75768),ep=i(94523),eg=i(5632),ej=i(17292),ef=i(90221),ev=i(78462),eC=i(84698);let eb=e=>{let{docId:t}=e,i=(0,M.TL)(),n=(0,eu.ff)("gray.300","gray.800"),r=(0,eu.ff)("white","gray.900"),s=(0,eu.ff)("transparent","transparent"),a=(0,eu.ff)("gray.500","gray.400"),c=(0,eu.ff)("trueblue.50","trueblue.400"),p=(0,eu.ff)("trueblue.500","white"),g=(0,eu.ff)("gray.600","gray.100"),f=(0,eu.ff)("gray.100","gray.700"),v=(0,eu.ff)("trueblue.50","trueblue.400"),C=(0,eu.ff)("trueblue.500","white"),{replace:b}=(0,eg.useRouter)(),y=(0,M.CG)(eC.tv),k=(0,j.useCallback)(()=>{if(!t)return;let e=(0,ev.yQ)({docId:t});b(e,void 0,{shallow:!0})},[t,b]),w=(0,j.useCallback)(e=>{i((0,eC.Tj)({previewSize:e}))},[i]);return(0,j.useEffect)(()=>ej.F7.on("keydown","SITE_PREVIEW_PANE",e=>("Escape"===e.key&&k(),!0)),[k]),(0,l.jsx)(o.k,{bg:"white",align:"flex-start",direction:"column",width:"100%","data-sites-preview-pane":!0,children:(0,l.jsxs)(ex.U,{w:"100%",spacing:0,p:2,py:2,bg:r,borderColor:n,justify:"flex-start",borderBottomWidth:"1px",children:[(0,l.jsx)(ex.U,{spacing:2,flexBasis:"30%",children:!(0,ef.s2)()&&(0,l.jsx)(eh.z,{size:"sm",variant:"plain",onClick:k,children:(0,l.jsx)(ex.U,{children:(0,l.jsx)(d.xu,{children:(0,l.jsx)(x.G,{icon:u.acZ})})})})}),(0,l.jsxs)(em.h,{size:"sm",ml:24,flexBasis:"40%",justifyContent:"center",children:[(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"58m6Qy"}
1),children:(0,l.jsx)(I.h,{"aria-label":m.ag._({id:"58m6Qy"}),variant:"ghost",size:"sm",icon:(0,l.jsx)(x.G,{icon:u.Z__}),bg:"mobile"===y?c:s,_hover:{color:"mobile"===y?C:g,bg:"mobile"===y?v:f},color:"mobile"===y?p:a,onClick:()=>{w("mobile")}})}),!(0,ef.s2)()&&(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"fpcKeD"}),children:(0,l.jsx)(I.h,{"aria-label":m.ag._({id:"fpcKeD"}),variant:"ghost",size:"sm",icon:(0,l.jsx)(x.G,{icon:u.ep5}),bg:"tablet"===y?c:s,_hover:{color:"tablet"===y?C:g,bg:"tablet"===y?v:f},color:"tablet"===y?p:a,onClick:()=>{w("tablet")}})}),!(0,ef.s2)()&&(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"K3p0ar"}),children:(0,l.jsx)(I.h,{"aria-label":m.ag._({id:"K3p0ar"}),variant:"ghost",size:"sm",icon:(0,l.jsx)(x.G,{icon:u.tc$}),bg:"desktop"===y?c:s,_hover:{color:"desktop"===y?C:g,bg:"desktop"===y?v:f},color:"desktop"===y?p:a,onClick:()=>{w("desktop")}})})]}),(0,l.jsx)(ex.U,{flexBasis:"30%",justifyContent:"flex-end"})]})})};var ey=i(31341),ek=i(85326),ew=i(54073),eS=i.n(ew),eE=i(31181),eI=i(23147);let e_=(e,t)=>{let i=(0,M.TL)(),n=(0,M.qr)(),r=!!(0,M.CG)(eE.$U),s=(0,M.CG)(L.wc),l=(0,M.CG)(eE.B$),o=t&&r&&s;(0,j.useEffect)(()=>{var t,r;if(!o||!e||e.gammaDocId!==l)return;let s=(0,L.yx)(n.getState()),a=null==s?void 0:null===(r=s.publishedSnapshot)||void 0===r?void 0:null===(t=r.content)||void 0===t?void 0:t.default;if(!a)return;let d=!(0,eI.G0)(e,a);console.debug("[useDirtyStateTracking] INITIALIZING DIRTY STATE ".concat(l," via compareDocJSON"),{isDirty:d}),d&&i((0,eE.xc)({pageId:e.gammaDocId,lastUpdatedAt:new Date().toISOString()}))},[i,n,e,o,l]),(0,j.useEffect)(()=>{if(!o||!e)return;let t=eS()(()=>{i((0,eE.xc)({pageId:e.gammaDocId,lastUpdatedAt:new Date().toISOString()}))},500,{leading:!0,trailing:!0,maxWait:1e3});return e.on("update",t),()=>{e.off("update",t)}},[o,i,e])};var eA=i(15041),eT=i(29318),eO=i(87978),eP=i(74389),eD=i(56904),eR=i(78160),eG=i(17132),ez=i(11050),eN=i(97563),eM=i(72338),eL=i(84636),eF=i.n(eL),eU=i(24781),eW=i(96255),eH=i(60742),eV=i(90604);let eB=(e,t,i,n,r)=>{let s=n-i,l=Math.max(s-Math.max(e-i,0)-Math.max(n-t,0),0),o=l/s,a=o>0&&l==t-e;return{overlap:o,viewing:r&&(a||o>.5||l>400),only:a}},eK=(e,t)=>{let i=(0,eU.As)("editor"),[n,r]=(0,j.useState)(null),s=(0,j.useRef)({presentingCardId:null,scrollTop:0,containerHeight:0,expandedCards:{}}),l=(0,M.CG)(L.gh),o=(0,M.CG)(L.i2);(0,j.useEffect)(()=>{s.current.presentingCardId=null!=o?o:null},[o]);let a=(0,M.CG)(L.Q5);(0,j.useEffect)(()=>{s.current.expandedCards=a},[a]),(0,j.useEffect)(()=>{let e=document.querySelector(i.scrollSelector);if(!e)return;r(e);let t=e.getBoundingClientRect(),{height:n}=t;s.current.scrollTop=e.scrollTop,s.current.containerHeight=n},[i.scrollSelector,s]),(0,j.useEffect)(()=>{let e=eS()(()=>{n&&(s.current.scrollTop=n.scrollTop)},250,{trailing:!0,maxWait:500});return window.addEventListener("scroll",e,!0),()=>window.removeEventListener("scroll",e,!0)},[n]),(0,j.useEffect)(()=>{let e=eS()(()=>{n&&(s.current.containerHeight=n.getBoundingClientRect().height)},250,{trailing:!0,maxWait:500});return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[n]),(0,j.useEffect)(()=>{if(!e)return;if(l===eV.q.SLIDE_VIEW){let e=setInterval(()=>{t.emit("cardViewed",{cardId:s.current.presentingCardId,interval:1e3})},1e3);return()=>clearInterval(e)}let n=setInterval(()=>{if(document.hidden)return;let{scrollTop:n,containerHeight:r,expandedCards:l}=s.current,o=n+r;eF()((0,eM.N2)(e.state.doc,eW.KH),e=>e.node.attrs.id).map(t=>{let r;let s=t.node.attrs.id,a=l[s];if(!a)return null;try{r=e.view.nodeDOM(t.pos)}catch(e){return null}if(r instanceof HTMLElement){let e=(0,eH.LY)(r,i.scrollSelector),{offsetHeight:t}=r,l=t+e;return{id:s,...eB(n,o,e,l,a)}}return null}).filter(e=>!!(null==e?void 0:e.viewing)).forEach(e=>{t.emit("cardViewed",{cardId:e.id,interval:1e3})})},1e3);return()=>clearInterval(n)},[l,e,s,t,i.scrollSelector])},eq=e=>{let{editor:t,backoffFactor:i=1}=e,n=(0,ez.z$)(),[r,s]=(0,j.useState)(15e3);eK(t,eN.f);let l=(0,j.useCallback)(()=>{eN.f.flush(),s(Math.min(r*i,12e4))},[i,r]);return(0,j.useEffect)(()=>{if(!n)return;eN.f.initialize(),eN.f.on("flush",e=>{let{viewed:t}=e;for(let[e,i]of Object.entries(t))n.trackDocEvent(ez.AA.CARD_VIEWED,{card_id:e,duration:i})});let e=setInterval(()=>l(),r);return()=>{clearInterval(e),eN.f.destroy()}},[n,r,l]),null};var eY=i(36651),eZ=i(81672),eX=i(74409),eJ=i(17993),eQ=i(8713),e$=i(69420),e0=i(86783),e1=i(18149),e2=i.n(e1),e5=i(64467),e4=i(48776),e3=i(98462);let e9=e=>{let t=(0,M.CG)(e5.AD),{title:i}=(0,e4.T)({cardId:t||void 0}),n=(0,M.CG)(L.pN,function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return e2()(...t)}),r=n.indexOf(t||""),s=(0,j.useCallback)(t=>()=>{var i,s;if(!e)return;let l=null!==(s=n[r+(t?1:-1)])&&void 0!==s?s:n[r],o=null===(i=(0,eW.Bw)(e,l))||void 0===i?void 0:i.pos;if(!o)return;(0,e3.vS)(e,o)||e.commands.selectInsideNodeAtPos(o);let a=e.view.nodeDOM(o);a instanceof HTMLElement&&(0,eU.cC)("editor").scrollElementIntoView({element:a,delay:0})},[r,e,n]);return{cardId:t,title:i||"Untitled",canGoForward:r<n.length-1,canGoBack:r>0,goToNextCard:s(!0),goToPreviousCard:s(!1)}};var e6=i(89996),e7=i(42111),e8=i(35873);let te=e=>{let{editor:t,isReadonly:i}=e,{selection:n}=(0,e6.t)(t),r=(0,M.TL)(),s=(0,e7.ye)("cardNotes");(0,j.useEffect)(()=>
1{if(!t||!s)return;let e=(0,e8.AQ)(t.state.doc,t.state.selection.from);if(e&&e.node&&!(0,e3.Qp)(e.node)){if(i){r((0,e5.NK)());return}(0,e3.Fi)(t,e.pos)}},[s,r,t,i,n])},tt=e=>{let{closePanel:t}=e,{editor:i}=(0,n4._i)(),n=(0,M.CG)(L.hN),{canGoBack:r,canGoForward:s,title:c,goToNextCard:p,goToPreviousCard:g}=e9(i),f=(0,M.TL)();return te({editor:i,isReadonly:!n}),(0,j.useEffect)(()=>eQ.F7.on("keydown","CARD_NOTES_PANEL",e=>{let i=document.activeElement;return!!(i instanceof HTMLElement&&i.closest('[data-panelid="card-notes-panel"]'))&&"Escape"===e.key&&(t(),!0)}),[t,f]),(0,l.jsx)(e$.s,{bgColor:"white","data-panelid":"card-notes-panel",children:(0,l.jsxs)(o.k,{direction:"column",h:"100%",flex:1,children:[(0,l.jsx)(eZ.P,{"data-card-notes-close-button":!0,position:"absolute",top:2,right:3,onClick:t}),(0,l.jsxs)(ex.U,{px:6,py:4,spacing:4,children:[(0,l.jsx)(eX.X,{fontSize:"3xl",fontWeight:800,letterSpacing:-1,children:"Notes"}),n&&(0,l.jsx)(ep.Yq,{label:(0,l.jsx)(h.cC,{id:"qcPeK2"})})]}),(0,l.jsxs)(eJ.g,{px:6,pb:4,alignItems:"stretch",flex:1,overflowY:"hidden",spacing:4,children:[(0,l.jsx)(d.xu,{children:(0,l.jsx)(a.x,{fontWeight:"600",color:"gray.700",wordBreak:"break-word",noOfLines:2,children:c})}),(0,l.jsx)(e0.z,{isEditable:n}),n&&(0,l.jsxs)(ex.U,{children:[(0,l.jsx)(ep.kH,{label:r?(0,l.jsx)(h.cC,{id:"cbqngJ"}):(0,l.jsx)(h.cC,{id:"4OtlnH"}),children:(0,l.jsx)(o.k,{flex:1,children:(0,l.jsx)(I.h,{"aria-label":r?m.ag._({id:"cbqngJ"}):m.ag._({id:"4OtlnH"}),icon:(0,l.jsx)(x.G,{icon:u.acZ}),onClick:g,isDisabled:!r,flex:1})})}),(0,l.jsx)(ep.kH,{label:s?(0,l.jsx)(h.cC,{id:"EyUKqu"}):(0,l.jsx)(h.cC,{id:"ggpGEd"}),children:(0,l.jsx)(o.k,{flex:1,children:(0,l.jsx)(I.h,{"aria-label":s?m.ag._({id:"EyUKqu"}):m.ag._({id:"ggpGEd"}),icon:(0,l.jsx)(x.G,{icon:u.eFW}),onClick:p,isDisabled:!s,flex:1})})})]})]})]})})};tt.panelPosition="right";var ti=i(15830);let tn=e=>{let{toggleCardNotesPanel:t,isCardNotesPanelOpen:i,editor:n}=e,r=(0,M.TL)(),s=(0,e7.ye)("cardNotes"),l=(0,M.CG)(L.gh),o=l===eV.q.SLIDE_VIEW;(0,j.useEffect)(()=>{i&&(!s||o)&&t()},[s,i,t,o]),(0,j.useEffect)(()=>{!i&&n&&(r((0,e5.mK)({isOpen:!1})),n.view.dispatch(n.state.tr))},[r,n,i,t]),(0,j.useEffect)(()=>{if(s&&n)return ti.T.on("toggle",e=>{let{config:s,clickedCardId:l,activeNotesCardId:o}=e;i&&l!==o||(t(s),r((0,e5.mK)({isOpen:!i})),n.view.dispatch(n.state.tr))})},[r,n,s,i,t])};var tr=i(93441);let ts="drag-in-progress",tl=()=>{(0,j.useEffect)(()=>{let e=()=>{document.body.classList.add(ts)},t=()=>{document.body.classList.remove(ts)};return document.body.addEventListener("dragstart",e,!0),document.body.addEventListener("dragend",t,!0),document.body.addEventListener("drop",t,!0),document.body.addEventListener("mouseup",t,!0),()=>{document.body.removeEventListener("dragstart",e,!0),document.body.removeEventListener("dragend",t,!0),document.body.removeEventListener("drop",t,!0),document.body.removeEventListener("mouseup",t,!0)}},[])};var to=i(32981),ta=i(26468),td=i(73751),tc=i(2338),tu=i(97217),tx=i(50250),th=i(58125),tm=i(30764),tp=i(71113),tg=i(29957),tj=i(50260),tf=i(66479),tv=i(79671),tC=i(70830),tb=i(32186),ty=i(46409),tk=i(22569);
1let tw=j.createContext({enabled:!1,registerEditor:(e,t)=>{},getAllCards:()=>[],userMessage:"",setUserMessage:e=>{}});function tS(){let e=(0,j.useContext)(tw);return e}let tE=e=>{let{children:t}=e,i=(0,j.useRef)(new Map),n=(0,j.useRef)(""),r=(0,j.useRef)((e,t)=>{i.current.set(e,t)}),s=(0,j.useRef)(()=>Array.from(i.current.values()).map(e=>{var t,i;return null===(i=e.state.doc.firstChild)||void 0===i?void 0:null===(t=i.content.toJSON())||void 0===t?void 0:t[0]}).filter(Boolean)),o=(0,j.useCallback)(e=>{n.current=e},[]);return(0,l.jsx)(tw.Provider,{value:{enabled:!0,registerEditor:r.current,getAllCards:s.current,userMessage:n.current,setUserMessage:o},children:t})};var tI=i(8776),t_=i(40335),tA=i(56581),tT=i(43297),tO=i(42822),tP=i(81540),tD=i(31709);let tR=e=>{let{cardId:t,onClick:i}=e,n=(0,M.CG)((0,tI.NB)(t)),r=(0,M.CG)(L.Pu);return n?(0,l.jsxs)(tT.K,{zIndex:1,mt:"4.5em",width:"180px",bg:"whiteAlpha.500",border:"1px solid",borderColor:"blackAlpha.300",borderRadius:"lg",p:4,sx:{"*":{"backdrop-filter":"none !important","-webkit-backdrop-filter":"none !important"}},children:[n.variants.map(e=>{if(!e)return null;let{label:s,card:o,id:a}=e;return(0,l.jsx)(tG,{theme:r,isSelected:n.selected===a,label:s,card:o,onClick:()=>{i({cardId:t,variationId:a})}},a)}),n.variants.length<2&&(0,l.jsx)(tO.M,{children:(0,l.jsx)(tP.$,{})})]}):null},tG=e=>{let{label:t,card:i,theme:n,isSelected:r=!1,onClick:s=()=>{}}=e,d=(0,j.useMemo)(()=>(0,tD.vL)({docFlags:{cardLayoutsEnabled:!0}},[i]),[i]);return(0,l.jsxs)(tT.K,{align:"start",children:[(0,l.jsx)(o.k,{borderRadius:"md",bg:"white",shadow:r?"outline":"md",overflow:"hidden",cursor:"pointer",_hover:{bg:"trueblue.50"},transitionProperty:"common",transitionDuration:"fast",onClick:s,children:(0,l.jsx)(o.k,{sx:tb.n,css:{"--editor-font-size":"0.15rem","--editor-width":"150px"},justifyContent:"center",alignItems:"top",pointerEvents:"none",children:(0,l.jsx)(tb.m,{content:d,theme:n,isThumbnail:!0})})}),(0,l.jsxs)(a.x,{fontSize:"sm",children:[r&&(0,l.jsx)(tA.n,{boxSize:3,mr:2}),t]})]})},tz="ai-wizard-editor-root",tN=e=>{let{doc:t,cards:i,theme:n=tj.mU}=e,r=(0,tk.R5)(n),s=(0,tf.wj)(n),a=(0,tk.wh)(r,s),d=(0,M.TL)(),{registerE
1ditor:c}=tS();return((0,j.useEffect)(()=>()=>{d((0,tI.mc)())},[d]),t)?(0,l.jsxs)(o.k,{bg:"gray.100",overflowY:"auto",overflowX:"hidden",justifyContent:"flex-start",alignContent:"center",alignItems:"center",alignSelf:"stretch",direction:"column",width:"100%",height:"100%",position:"relative",className:tz,...a,children:[(0,l.jsx)(ty.Y,{}),i.map((e,i)=>{var n;let r=null===(n=e.attrs)||void 0===n?void 0:n.id;return r?(0,l.jsx)(tM,{doc:t,cardId:r,cardIndex:i,cardJSON:e,onCreate:e=>{c(r,e)}},r):null})]}):null},tM=e=>{let{cardId:t,cardIndex:i,cardJSON:n,doc:r,onCreate:s}=e,a=(0,M.TL)(),[d,c]=(0,j.useState)(null),{userMessage:u}=tS(),x=(0,t_.b)({editor:d});(0,j.useEffect)(()=>{d&&x({doc:d.state.doc,cardId:t,message:u})},[x,d,t,i,u]);let h=(0,j.useMemo)(()=>(0,tv.vL)({docFlags:{cardLayoutsEnabled:!0}},[n]),[n]),m=(0,M.CG)((0,tI.a4)(t));(0,tr.vm)(()=>{if(!d||!m)return;let e=(0,eW.Bw)(d,t);e&&d.commands.command(t=>{let{tr:i}=t,n=tm.NB.fromJSON(d.schema,m.card);return i.replaceWith(e.pos,e.pos+e.node.nodeSize,n),!0})},[d,m,t],[m]);let p=(0,j.useCallback)(e=>{let{cardId:i,variationId:n}=e;d&&i===t&&a((0,tI.dx)({cardId:t,variantId:n}))},[a,d,t]);return(null==r?void 0:r.id)?(0,l.jsxs)(o.k,{className:"ai-variation-editor-".concat(t),alignItems:"flex-start",sx:tb.n,my:-8,children:[(0,l.jsx)(tR,{cardId:t,onClick:p}),(0,l.jsx)(tC.y,{initialContent:h,onCreate:e=>{let{editor:t}=e;c(t),s(t)},doc:r,docId:r.id,scrollingParentSelector:".".concat(tz),readOnly:!0,isStatic:!0,animationsEnabled:!1,extensions:[],shouldSupportMenus:!1})]}):null};var tL=i(11550);let tF=e=>{let{isOpen:t,onClose:i,onOpen:n}=(0,tL.M)({id:"cardSuggestionDrawer"}),r=(0,M.CG)(L.Pu),[s]=(0,j.useState)(()=>(0,th.xC)({reducer:M.Ct}));return(0,l.jsx)(f.zt,{store:s,children:(0,l.jsx)(tU,{...e,isOpen:t,onClose:i,onOpen:n,theme:r})})},tU=(n=e=>{let{doc:t,editor:i,theme:n,isOpen:r,onClose:s,onOpen:o}
1=e,[a,d]=(0,j.useState)([]),[c,u]=(0,j.useState)(null),{getAllCards:x,setUserMessage:m}=tS(),p=(0,j.useCallback)(()=>{s(),d([]),u(null)},[s]),g=(0,j.useCallback)(()=>{if(p(),!i)return;let e={type:"document",content:x()};console.log("[handleConfirm] contentToUse",e);let t=1,n=i.state.doc.nodeSize-2,r=(0,eW.Bw)(i,c);if(r){n=(t=r.pos)+r.node.nodeSize;let i=e.content.find(e=>{var t;return(null===(t=e.attrs)||void 0===t?void 0:t.id)===c});if(!i){console.warn("[handleConfirm] Count not find card to use");return}e=i}i.commands.command(r=>{let{tr:s}=r;return s.replaceRangeWith(t,n,tm.NB.fromJSON(i.schema,e)),!0})},[p,i,c,x]),f=(0,j.useCallback)(async(e,t,i)=>{o(),u(t);let n=e.toJSON().content[0].content;d(n.filter(e=>{var i;return null===t||(null===(i=e.attrs)||void 0===i?void 0:i.id)===t})),m(i)},[o,m]);return(0,j.useEffect)(()=>{if(i)return tg.T.on("openSuggestionEditor",e=>{let{cardId:t,userMessage:n}=e;f(i.view.state.doc,t,n)})},[i,f]),(0,l.jsxs)(to.d,{placement:"bottom",onClose:s,isOpen:r,trapFocus:!0,isFullHeight:!0,children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(td.s,{borderTopRadius:"xl",h:"calc(var(--100vh) - 24px)",transform:"none !important",children:[(0,l.jsx)(tc.o,{zIndex:"10",backgroundColor:"white",mr:2,shadow:"md"}),(0,l.jsx)(tu.f,{p:0,h:"100%",children:a.length>0&&t?(0,l.jsx)(tN,{doc:t,cards:a,theme:n}):(0,l.jsx)(tp.AA,{})}),(0,l.jsx)(tx.m,{borderTop:"1px solid #000",borderColor:"gray.200",children:(0,l.jsxs)(em.h,{spacing:4,children:[(0,l.jsx)(eh.z,{variant:"ghost",onClick:s,children:(0,l.jsx)(h.cC,{id:"dEgA5A"})}),(0,l.jsx)(eh.z,{variant:"solid",onClick:g,children:(0,l.jsx)(h.cC,{id:"7VpPHA"})})]})})]})]})},(0,j.memo)(e=>(0,l.jsx)(tE,{children:(0,l.jsx)(n,{...e})})));var tW=i(69747),tH=i(12825),tV=i(75009),tB=i(20336),tK=i(4030),tq=i(3561),tY={src:"/_next/static/media/Sal-Fishing-2x.1a2d0290.png"},tZ=i(46640),tX=i(83906),tJ=i(10625),tQ=i(67046),t$=i(99058),t0=i(44035),t1=i(39237),t2=i(82108),t5=i.n(t2);let t4=e=>{let{count:t,onClose:i,commentStatusFilter:n,setCommentStatusFilter:r}=e,s=n===v.Ux9.Open?m.ag._({id:"Kz1TxG"}):m.ag._({id:"kywJax"});return(0,l.jsxs)(o.k,{width:"100%",px:6,py:4,justifyContent:"space-between",alignItems:"center",h:16,tabIndex:0,outline:"none",children:[(0,l.jsx)(eX.X,{size:"md",flex:1,noOfLines:1,children:(0,l.jsx)(h.cC,{id:"eiUA4k",values:{count:t}})}),(0,l.jsxs)(tJ.v,{closeOnSelect:!0,children:[(0,l.jsx)(tQ.j,{as:eh.z,size:"sm",rightIcon:(0,l.jsx)(tX.v,{}),mr:8,children:t5()(s)}),(0,l.jsx)(t$.q,{zIndex:3,children:(0,l.jsxs)(t0._,{defaultValue:n,title:m.ag._({id:"0cVgUw"}),type:"radio",children:[(0,l.jsx)(t1.i,{onClick:()=>r(v.Ux9.Open),value:"open",children:(0,l.jsx)(h.cC,{id:"1TNIig"})}),(0,l.jsx)(t1.i,{onClick:()=>r(v.Ux9.Closed),value:"closed",children:(0,l.jsx)(h.cC,{id:"D87pha"})})]})})]}),(0,l.jsx)(eZ.P,{position:"absolute",top:2,right:2,onClick:i,"data-comment-feed-close-button":!0})]})};var t3=i(57480);let t9=e=>{let{user:t,editor:i}=e,[n,r]=(0,j.useState)(()=>{let e=(0,tK.W1)(i,t3.Et),t=e&&e.length?e[0]:(0,tK.xN)(()=>t3.Et,i,"");return t});(0,j.useEffect)(()=>{if(n&&i)return()=>{var e,t;null===(e=(t=i.commands).createDraftComment)||void 0===e||e.call(t,n)}},[n,i]);let s=(0,tK.iZ)({draftComment:n,clearDraftComment(){var e,t,s,l;n&&(null===(s=(l=i.commands).removeDraftComments)||void 0===s||s.call(l,[n]));let o=(0,tK.xN)(()=>t3.Et,i,"");null===(e=(t=i.commands).createDraftComment)||void 0===e||e.call(t,o),r(o)},editor:i}),o=(0,j.useCallback)(e=>{let{editor:t}=e;r(e=>e?{...e,json:t.view.state.doc.toJSON(),text:t.view.state.doc.textContent}:e)},[]);return(0,l.jsx)(tK.Ag,{draftComment:n,user:t,onCommentDraftUpdate:o,onCommentSave:s,commentIdToHighlight:null})},t6=()=>({today:m.ag._({id:"ecUA8p"}),thisWeek:m.ag._({id:"yByRxz"}),earlier:m.ag._({id:"HPqZkW"})}),t7=e=>{var t;let{onClose:i,editor:n}=e,r=(0,M.CG)(L.yx),{isConnected:s}
1=(0,v.$gs)(),[c,u]=(0,j.useState)(v.Ux9.Open),x=null==r?void 0:r.comments,m=null==r?void 0:null===(t=r.comments)||void 0===t?void 0:t.filter(e=>e.status===c),p=(0,M.CG)(L.gh),g=(0,eY.py)("comment",r),f=g&&s,{user:b}=(0,eY.SE)(),y=(0,C.$m)(r,b),k=(0,j.useMemo)(()=>{let e=(0,tZ.yd)({items:m||[],sortBy:tZ.Yz,latestTimeGetterFn:tZ.z3});return e},[m]);return x&&r&&n?(0,l.jsxs)(o.k,{direction:"column",h:"100%",overflowX:"hidden",className:tq.G,w:"100%",children:[(0,l.jsx)(t4,{commentStatusFilter:c,setCommentStatusFilter:u,count:(null==m?void 0:m.length)||0,onClose:i}),(0,l.jsxs)(o.k,{direction:"column",className:"comments-list",flex:1,overflowY:"auto",tabIndex:0,outline:"none",children:[(0,l.jsx)(tB.V,{label:(0,l.jsx)(h.cC,{id:"pQvCbR"}),isConnected:s,mx:6}),y&&!b&&r&&(0,l.jsx)(tK.IZ,{doc:r,accessLink:y}),f&&(0,l.jsx)(d.xu,{px:6,py:2,children:(0,l.jsx)(t9,{user:b,editor:n})}),!(null==m?void 0:m.length)&&(0,l.jsxs)(eJ.g,{align:"center",p:6,textAlign:"center",spacing:8,children:[(0,l.jsx)(d.xu,{w:"80%",maxW:"300px",mb:6,alignContent:"center",children:(0,l.jsx)(tV.E,{src:tY.src,width:"640px",alt:"Sal, the Gamma mascot, fishing extraterrestrially"})}),(0,l.jsxs)(d.xu,{children:[(0,l.jsx)(eX.X,{size:"xs",mb:2,children:"open"===c?(0,l.jsx)(h.cC,{id:"W7i5f5"}):(0,l.jsx)(h.cC,{id:"mpDN1V"})}),(0,l.jsx)(a.x,{fontSize:"sm",children:(0,l.jsx)(h.cC,{id:"iB9OEi"})})]})]}),Object.entries(k).filter(e=>{let[,t]=e;return t.length}).map(e=>{let[t,s]=e;return(0,l.jsxs)(o.k,{direction:"column",children:[(0,l.jsx)(ep.NZ,{px:6,pt:4,pb:2,position:"sticky",top:-2,bg:"white",zIndex:2,children:t6()[t]}),(0,l.jsx)(o.k,{direction:"column",children:s.map(e=>(0,l.jsx)(tK.q5,{instanceType:"feed",userCanComment:f,editor:n,comment:e,selfUser:b,docId:null==r?void 0:r.id,editorMode:p,onClose:i,isRootComment:!0,pt:6,px:6,pb:4},e.id))})]},t)})]})]}):null},t8=e=>{let{closePanel:t,...i}=e,{editor:n}=(0,tH._)();return(0,j.useEffect)(()=>{let e=e=>{let{open:i}=e;i&&t()};return tW.pw.on(tW.TI.POPUP_COMMENT_TOGGLED,e),()=>{tW.pw.on(tW.TI.POPUP_COMMENT_TOGGLED,e)}},[t]),(0,j.useEffect)(()=>ej.F7.on("keydown","COMMENT_FEED_PANEL",e=>!!document.activeElement.closest('[data-panelid="comment-feed-panel"]')&&("Escape"===e.key&&t(),!0)),[t]),(0,l.jsx)(e$.s,{...i,bgColor:"white","data-panelid":"comment-feed-panel",children:(0,l.jsx)(t7,{onClose:t,editor:n})})};t8.panelPosition="right";var ie=i(87202),it=i(39097),ii=i.n(it),ir=i(14764),is=i(97763),il=i(74684),io=i(21733);let ia=()=>{var e,t;let i=(0,M.CG)(L.yx),{user:n}=(0,io.SE)(),r=(0,io.py)("manage",i)&&!!n,s=null==i?void 0:null===(e=i.docGenerateInput)||void 0===e?void 0:e.docGeneration;if(i&&s&&(null===(t=i.createdBy)||void 0===t?void 0:t.id)===(null==n?void 0:n.id)&&r)return(0,ev.Xn)(s)};var id=i(47443),ic=i(80877),iu=i(74444),ix=i(67422);let ih=e=>{let{onClose:t}=e;return(0,l.jsxs)(tT.K,{flex:1,align:"center",justify:"center",p:6,spacing:6,children:[(0,l.jsx)(tV.E,{src:"https://cdn.gamma.app/zc87vhr30n8uf3n/b4b04402416f4ec8b5c1dc24f4c2a3d6/optimized/Sal-Spaceship-Riding.png",px:12}),(0,l.jsx)(ix.K,{children:(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"jVQv+Q"})})}),(0,l.jsx)(eh.z,{variant:"ghost",colorScheme:"blackAlpha",leftIcon:(0,l.jsx)(x.G,{icon:u.g82}),onClick:t,children:(0,l.jsx)(h.cC,{id:"pqZJT2"})})]})},im=()=>(0,l.jsxs)(id.b,{status:"warning",mt:12,minH:20,flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",borderRadius:"lg",borderWidth:"1px",children:[(0,l.jsx)(ic.C,{children:(0,l.jsx)(h.cC,{id:"rvbk/4"})}),(0,l.jsx)(iu.X,{children:(0,l.jsx)(h.cC,{id:"XNkIFY"})})]});var ip=i(74105),ig=i(29494),ij=i(54933),iv=i(27191),iC=i(85420),ib=i(57124),iy=i(4878);let ik="40px",iw=e=>{let{value:t,onChange:i,onSubmit:n,isLoading:r,editor:s,resetMessages:o}=e;(0,iy.F1)(s);let{selection:d,doc:c}=s.state,u=c.textBetween(d.from,d.to,"\n"),h=(0,ib.fg)(),p=(0,j.useRef)(null),[g,f]=(0,j.useState)(!1),v=d instanceof iv.qv,C=d instanceof iv.Bs,b=v&&"card"===d.node.type.name,y=d.empty||b?m.ag._({id:"XrfE9D"}):v?m.ag._({id:"CsUli9"}):C&&u?m.ag._({id:"+NPPZN",values:{0:u.length>50?u.slice(0,50)+"...":u}}
1):m.ag._({id:"/fY1js"}),k=(0,j.useCallback)(()=>{p.current&&(p.current.style.height=ik,p.current.style.height="".concat(p.current.scrollHeight,"px"))},[]);return(0,j.useEffect)(()=>(s.on("selectionUpdate",k),()=>{s.off("selectionUpdate",k)}),[s,k]),(0,j.useEffect)(()=>{g?k():setTimeout(()=>{f(!0),k()},400)},[g,y,k,t]),(0,l.jsxs)(ex.U,{align:"end",children:[(0,l.jsx)(ip.B,{size:"md",children:(0,l.jsx)(ig.g,{"data-gamma-child-tiptap-editor":!0,id:"ai-chat-input",h:ik,minH:ik,ref:p,resize:"none",maxH:g?32:ik,bg:"white",shadow:"md",autoFocus:!0,placeholder:y,value:t,onKeyPress:e=>{"Enter"===e.key&&t.length>0&&!r&&(e.preventDefault(),n())},onChange:e=>i(e.target.value),pr:12})}),(0,l.jsx)(ep.kH,{placement:"top",label:(0,l.jsxs)(eJ.g,{spacing:0,children:[(0,l.jsx)(a.x,{children:"Send request"}),!h&&(0,l.jsxs)(a.x,{color:"gray.400",children:[(0,l.jsx)(iC.J,{type:"chatSuggestion",ml:0})," if successful"]}),(0,l.jsx)(ep.f2,{shortcut:"Enter"})]}),children:(0,l.jsx)(I.h,{"aria-label":"Send message",isDisabled:!t||r,size:"sm",h:ik,w:ik,variant:"solid",icon:(0,l.jsx)(x.G,{icon:ij.FzC,fixedWidth:!0}),onClick:n})})]})};var iS=i(28086),iE=i(26031),iI=i(25314);let i_=e=>{let{editor:t,scrollSelector:i,onClose:n}=e,[r,s]=(0,j.useState)(""),a=(0,e7.ye)("openAiStatus"),d=(0,M.TL)(),c=(0,eU.As)("editor"),m=(0,M.qr)(),p=(0,M.CG)(iE.AZ),g=(0,M.CG)(iE.Q_),[f,v]=(0,j.useState)(null),C=(0,j.useCallback)(()=>{let e=(0,iE.AZ)(m.getState());return e},[m]),b=(0,j.useCallback)(e=>{let t={timestamp:Date.now(),...e};d((0,iE.Hz)({message:t}))},[d]),y=(0,j.useCallback)(()=>{d((0,iE.mc)())},[d]),{status:k,sendMessage:w}=(0,iI.n)({addMessage:b,getMessageHistory:C,editor:t});(0,j.useEffect)(()=>{let e=i&&document.querySelector(i);e&&requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})},[i,p]);let S="idle"!==k;(0,j.useEffect)(()=>{if(!g.length||S)return;let{task:e,id:t}=g[0];!1===e.submit?s(e.message):w({message:e.message}),d((0,iE.VB)({id:t}))},[S,w,d,g]);let E=(0,j.useCallback)(()=>{if(!f||!t)return;let e=document.querySelector('[data-card-id="'.concat(f,'"]')),i=(0,eU.v4)(e,100);null!=i&&i.yAxisInView||c.scrollElementIntoView({element:e})},[t,c,f]),_=(0,j.useCallback)(e=>{E(),w({message:e})},[E,w]),A=(0,j.useCallback)(()=>{_(r),s("")},[_,r]),T=(0,is.YO)(A,"chatSuggestion",ez.AA.GAMMA_UPSELL_CALLOUT_AI_CREDITS_CHAT);(0,j.useEffect)(()=>{if(!t)return;let e=()=>{let e=(0,il.AQ)(t.state.doc,t.state.selection.from);e&&v(e.node.attrs.id)};return e(),t.on("selectionUpdate",e),()=>{t.off("selectionUpdate",e)}},[t]);let O=ia();return t?"DOWN"===a?(0,l.jsx)(ih,{onClose:n}):(0,l.jsxs)(o.k,{direction:"column",h:"100%",w:"100%",px:6,pb:2,children:["DEGRADED"===a&&(0,l.jsx)(im,{}),(0,l.jsx)(iS.rN,{scrollSelector:i,messages:p,editor:t,sendMessage:_,isLoading:S,onClose:n}),(0,l.jsxs)(tT.K,{pos:"sticky",bottom:0,py:2,pt:4,bg:"gray.50",children:[(0,l.jsx)(iw,{editor:t,value:r,onChange:s,onSubmit:T,isLoading:S,resetMessages:y}),(0,l.jsx)(ir.r,{modalId:"ai-credits-modal-message-list",variant:"ghost",justify:"flex-end",segmentEvent:ez.AA.GAMMA_UPSELL_CALLOUT_AI_CREDITS_CHAT})]}),(0,l.jsxs)(em.h,{position:"absolute",left:4,top:1,variant:"ghost",colorScheme:"blackAlpha",children:[(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"5eg0kp"}),placement:"top",children:(0,l.jsx)(I.h,{color:"currentColor","aria-label":"reset-chat",icon:(0,l.jsx)(x.G,{icon:u.YcH}),onClick:y,isRound:!0})}),O&&(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"JrXBQr",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}}),placement:"top",children:(0,l.jsx)(I.h,{color:"currentColor","aria-label":"source-prompt",icon:(0,l.jsx)(x.G,{icon:u.Fzb}),as:ii(),href:O,target:(0,ef.Q5)()?"_self":"_blank",isRound:!0})})]})]}):null};var iA=i(48892);let iT=e=>{let{onClose:t}=e;return(0,l.jsx)(o.k,{width:"100%",px:6,py:4,justifyContent:"space-between",alignItems:"center",h:8,tabIndex:0,outline:"none",position:"absolute",top:0,children:(0,l.jsx)(eZ.P,{"data-design-partner-close-button":!0,position:"absolute",top:2,right:6,zIndex:1,onClick:t})})},iO="design-partner-panel-wrapper",iP=e=>{let{toggleDesignPartnerPanel:t,isDesignPartnerPanelOpen:i,editor:n}=e,r=(0,e7.ye)("aiChat"),s=(0,M.TL)();(0,j.useEffect)(()=>()=>{s((0,iE.mc)())},[]);let l=(0,M.CG)(L.hN);(0,j.useEffect)(()=>{!l&&i&&t()},[l,i,t]),(0,j.useEffect)(()=>{var e,t;n&&(null===(e=(t=n.commands).setSalOpen)||void 0===e||e.call(t,i))},[n,i]),(0,j.useEffect)(()=>
1{if(r)return iA.T.on("toggle",e=>{let{config:i}=e;t(i)})},[t,r]),(0,j.useEffect)(()=>{if(r)return tW.pw.on("queueDesignPartnerTask",e=>{s((0,iE.Lj)({task:e})),t({disableTransition:!1,override:"open"}),console.log("queueDesignPartnerTask",e)})},[s,r,t]),(0,j.useEffect)(()=>{if(!r||!l)return;let e=(0,ie.ZP)("mod+shift+S");return ej.F7.on("keydown","DESIGN_PARTNER_PANEL",i=>!!e(i)&&(t(),!0))},[t,r,l])},iD=e=>{let{closePanel:t,...i}=e,{editor:n}=(0,tH._)();return(0,j.useEffect)(()=>ej.F7.on("keydown","DESIGN_PARTNER_PANEL",e=>!!document.activeElement.closest('[data-panelid="design-partner-panel"]')&&"Escape"===e.key&&(t(),!0)),[t]),(0,l.jsx)(e$.s,{...i,bgColor:"gray.50","data-panelid":"design-partner-panel",borderLeftWidth:"1px",children:(0,l.jsxs)(o.k,{direction:"column",h:"100%",overflowY:"auto",overflowX:"hidden",className:iO,w:"100%",children:[(0,l.jsx)(iT,{onClose:t}),(0,l.jsx)(i_,{editor:n,scrollSelector:".".concat(iO),onClose:t})]})})};iD.panelPosition="right";var iR=i(70065),iG=i(26284),iz=i(87651),iN=i(17190),iM=i(41774),iL=i(84405),iF=i(7207),iU=i(97590),iW=i(76332);let iH=e=>{var t,i;let{doc:n,site:r,path:s}=e,o=(0,iR.p)(),c=(0,M.TL)(),m=(0,M.CG)(eE.v),[p]=(0,iW.zU5)(),[g]=(0,iW.sIg)(),[f]=(0,iW.odt)(),[v,{loading:C}]=(0,iW.kui)(),[b,{loading:y}]=(0,iW.V$$)(),k=(0,M.CG)(eE.B$),w=null==n?void 0:n.id,S=null==n?void 0:null===(t=n.organization)||void 0===t?void 0:t.id,E=(0,eA.mn)({domain:null==r?void 0:null===(i=r.domains)||void 0===i?void 0:i[0],path:s}),I=null==r?void 0:r.id,_=(0,j.useCallback)(async()=>{w&&((0,eE.yB)(c)(!0),await (0,eA.iL)(w),await g({variables:{id:w},refetchQueries:["GetDoc","GetSite"]}).then(()=>{o({render:function(){return(0,l.jsx)(d.xu,{color:"white",p:3,bg:"green.500",shadow:"md",borderRadius:"md",children:(0,l.jsxs)(ex.U,{spacing:4,children:[(0,l.jsx)(d.xu,{children:(0,l.jsx)(x.G,{icon:u.fV7})}),(0,l.jsx)(a.x,{fontWeight:"semibold",children:(0,l.jsx)(h.cC,{id:"V6Byuz"})}),E&&(0,l.jsx)(eh.z,{variant:"plain",as:"a",target:"_blank",_hover:{textDecoration:"none",color:"trueblue.500"},href:E,rightIcon:(0,l.jsx)(x.G,{icon:u.wlW}),children:(0,l.jsx)(h.cC,{id:"Zel0o2"})}),(0,l.jsx)(eZ.P,{onClick:()=>o.closeAll()})]})})},status:"success",position:"top",duration:5e3,isClosable:!0})}).catch(e=>{o({title:(0,l.jsx)(h.cC,{id:"DD5mqk"}),status:"error",position:"top",isClosable:!0}),console.error("Error publishing site:",e.message)}).finally(()=>{(0,eE.yB)(c)(!1)}))},[c,w,g,o,E]),A=(0,j.useCallback)(async()=>{I&&((0,eE.yB)(c)(!0),k&&await (0,eA.iL)(k),await p({variables:{id:I},update:(e,t)=>{let{data:i}=t,n=null==i?void 0:i.publishSite;n&&n.routes.forEach(t=>{e.updateQuery({query:iW.yE1,variables:{id:t.docId}},e=>{var i,n,r;if(e||console.log("%c Publish doc _data is undefined or null","color: red; font-size: 16px"),!(null==e?void 0:e.doc))return e;let s=e.doc;return{doc:{...s,publishedTime:null===(i=t.doc)||void 0===i?void 0:i.publishedTime,publishedSnapshotId:null===(n=t.doc)||void 0===n?void 0:n.publishedSnapshotId,currentSnapshotId:null===(r=t.doc)||void 0===r?void 0:r.currentSnapshotId}}})})}}).then(()=>{o({render:function(){return(0,l.jsx)(d.xu,{color:"white",p:3,bg:"green.500",shadow:"md",borderRadius:"md",children:(0,l.jsxs)(ex.U,{spacing:4,children:[(0,l.jsx)(d.xu,{children:(0,l.jsx)(x.G,{icon:u.fV7})}),(0,l.jsx)(a.x,{fontWeight:"semibold",children:(0,l.jsx)(h.cC,{id:"V6Byuz"})}),E&&(0,l.jsx)(eh.z,{variant:"plain",as:"a",target:"_blank",_hover:{textDecoration:"none",color:"trueblue.500"},href:E,rightIcon:(0,l.jsx)(x.G,{icon:u.wlW}),children:(0,l.jsx)(h.cC,{id:"Zel0o2"})}),(0,l.jsx)(eZ.P,{onClick:()=>o.closeAll()})]})})},status:"success",position:"top",duration:5e3,isClosable:!0})}).catch(e=>{o({title:(0,l.jsx)(h.cC,{id:"DD5mqk"}),description:(0,l.jsx)(h.cC,{id:"R4PZ4k"}),status:"error",position:"top",isClosable:!0}),console.error("Error publishing site:",e.message)}).finally(()=>{(0,eE.yB)(c)(!1)}))},[I,c,k,p,o,E]),T=(0,j.useCallback)(async e=>{if(I&&w)try{await v({variables:{input:{siteId:I,name:e}},refetchQueries:["GetSites","GetDoc"]})}catch(e){console.error("Error adding domain:",e),o({status:"error",title:(0,l.jsx)(h.cC,{id:"HugOMA"}),isClosable:!0,position:"top"})}},[v,w,I,o]),O=(0,j.useCallback)(async e=>{w&&b({variables:{input:{workspaceId:S,name:e,routes:[]}},refetchQueries:["GetSites","GetDoc"]}).catch(e=>{console.error("Error creating site:",e.message)})},[w,S,b]),P=(0,j.useCallback)(async()=>
1{if(!w||!I)return;let e=(0,eA.kj)({routes:(null==r?void 0:r.routes)||[],docId:w,path:s});await f({variables:{input:{siteId:I,routes:e}}})},[f,w,null==r?void 0:r.routes,I,s]);return{publishSite:A,publishDoc:_,addDomain:T,isAddingDomain:C,createSite:O,isCreatingSite:y,updateRoutes:P,isPublishing:m}};var iV=i(45820),iB=i(23082),iK=i(49516),iq=i(49580),iY=i(49197),iZ=i(21723),iX=i(704);let iJ=e=>{let{onGenerateSuccess:t}=e,[i,n]=(0,j.useState)("createGenerate"),[r,s]=(0,j.useState)([]),[o,a]=(0,j.useState)(void 0),d=(0,j.useMemo)(()=>({goToScreen:(e,t)=>{a(null==t?void 0:t.generateId),s(e=>[...e,i]),n(e)},goBack:()=>{s(e=>{let t=[...e],i=t.pop();return i&&n(i),t})},navEnabled:"createGenerate"!==i,webpageOnly:!0,skipThemeStep:!0,onGenerateSuccess:t}),[i,t]),c=(0,j.useMemo)(()=>{switch(i){case"createWithAI":return iq.B;case"createImport":return iK.j;case"createPaste":return iY.L;case"promptEditor":return function(){return(0,l.jsx)(iZ.B,{id:o,children:(0,l.jsx)(iV.N,{})})};case"createGenerate":return function(){return o?(0,l.jsx)(iZ.B,{id:o,children:(0,l.jsx)(iB.m,{autosetLocale:!1})}):(0,l.jsx)(iB.m,{autosetLocale:!0})};default:throw Error("invalid page")}},[o,i]);return(0,l.jsx)(iX.u.Provider,{value:d,children:(0,l.jsx)(c,{})})},iQ=e=>{let{isOpen:t,onClose:i}=e;return(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(to.d,{isOpen:t,placement:"bottom",onClose:i,isFullHeight:!0,children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(td.s,{h:"calc(var(--100vh) - 24px)",p:0,children:[(0,l.jsx)(tc.o,{zIndex:"sticky"}),(0,l.jsx)(tu.f,{p:0,children:(0,l.jsx)(iJ,{onGenerateSuccess:i})})]})]})})},i$=()=>{var e;let t=(0,M.CG)(iU.yx),i=(0,eT.Yy)(),n=(0,iR.p)(),r=null==t?void 0:null===(e=t.accessLinks)||void 0===e?void 0:e[0],s=(0,j.useMemo)(()=>(0,ev.Gn)({docTitle:null==t?void 0:t.title,docId:null==t?void 0:t.id,token:null==r?void 0:r.token,absolute:!0}),[t,null==r?void 0:r.token]),{onCopy:o}=(0,iG.V)(s),a=(0,j.useCallback)(()=>{(0,iL.J)({docId:null==t?void 0:t.id,source:"docWizardFooter",type:"tokenUrl"}),o(),n({title:(0,l.jsx)(h.cC,{id:"pQjjYo"}),status:"success",position:"top",duration:1e3,isClosable:!1})},[null==t?void 0:t.id,o,n]),d=ia();return(0,l.jsxs)(tT.K,{spacing:4,textAlign:"center",children:[(0,l.jsx)(eX.X,{size:"md",children:(0,l.jsx)(h.cC,{id:"bB+DHs"})})," ",(0,l.jsx)(eh.z,{as:ii(),target:(0,ef.Q5)()?"_self":"_blank",variant:"solid",colorScheme:i?"blackAlpha":"whiteAlpha",leftIcon:(0,l.jsx)(x.G,{icon:u.r8p}),href:"/create",children:(0,l.jsx)(h.cC,{id:"xFxi2V"})}),d?(0,l.jsx)(eh.z,{leftIcon:(0,l.jsx)(x.G,{icon:u.Fzb}),variant:"plain",as:ii(),target:(0,ef.Q5)()?"_self":"_blank",href:d,children:(0,l.jsx)(h.cC,{id:"550oRP"})}):(0,l.jsx)(eh.z,{leftIcon:(0,l.jsx)(x.G,{icon:u.nNP}),variant:"plain",onClick:a,children:(0,l.jsx)(h.cC,{id:"RGCCrg"})})]})},i0=()=>{let{isOpen:e,onClose:t,onOpen:i}=(0,tL.M)({id:"add-page-ai-modal"}),n=(0,M.CG)(eE.lH),r=(0,eA.Vr)(n),{publishSite:s,isPublishing:o}=iH({site:n}),a=(0,eT.Yy)();return(0,l.jsxs)(tT.K,{spacing:4,textAlign:"center",children:[(0,l.jsx)(eX.X,{size:"md",children:(0,l.jsx)(h.cC,{id:"bB+DHs"})}),(0,l.jsx)(eh.z,{variant:"solid",colorScheme:a?"blackAlpha":"whiteAlpha",leftIcon:(0,l.jsx)(x.G,{icon:u.r8p}),onClick:i,children:(0,l.jsx)(h.cC,{id:"K3193W"})}),r&&(0,l.jsx)(eh.z,{leftIcon:(0,l.jsx)(x.G,{icon:u.A$k}),variant:"plain",onClick:s,isLoading:o,children:(0,l.jsx)(h.cC,{id:"2uGo/E"})}),(0,l.jsx)(iQ,{isOpen:e,onClose:t})]})};var i1=i(35183),i2=i(97166),i5=i(89099),i4=i(14304),i3=i.n(i4),i9=i(35676),i6=i.n(i9),i7=i(3440),i8=i.n(i7),ne=i(46152),nt=i.n(ne),ni=i(31490);let nn=[{key:"num_cards",category:"length",label:(0,l.jsx)(h.cC,{id:"UnRHxh"})},{key:"content_quality",category:"content",label:(0,l.jsx)(h.cC,{id:"5w/BaJ"})},{key:"missing_content",category:"content",label:(0,l.jsx)(h.cC,{id:"XoKzka"})},{key:"wrong_language",category:"content",label:(0,l.jsx)(h.cC,{id:"R2Ly6h"})},{key:"amount_of_text",category:"content",label:(0,l.jsx)(h.cC,{id:"pi+Tez"})},{key:"inappropriate_content",category:"content",label:(0,l.jsx)(h.cC,{id:"i/9pR4"})},{key:"citations",category:"content",label:(0,l.jsx)(h.cC,{id:"EpFwDO"})},{key:"inaccurate_content",category:"content",label:(0,l.jsx)(h.cC,{id:"Qk+SyG"})},{key:"image_quality",category:"image",label:(0,l.jsx)(h.cC,{id:"ESjmDR"})},{key:"number_of_images",category:"image",label:(0,l.jsx)(h.cC,{id:"x6yr/9"})},{key:"layouts_and_templates",category:"layout",label:(0,l.jsx)(h.cC,{id:"5yz5Kl"})},{key:"theme_styling",category:"layout",label:(0,l.jsx)(h.cC,{id:"d3n/st"})}],nr={key:"other",category:"other",label:(0,l.jsx)(h.cC,{id:"/IX/7x"})},ns=[{key:"bad",label:(0,l.jsx)(h.cC,{id:"XSfVsn"}),ariaLabel:()=>
1m.ag._({id:"XSfVsn"}),icon:u.KfU,color:"red"},{key:"meh",label:(0,l.jsx)(h.cC,{id:"0ASQJH"}),ariaLabel:()=>m.ag._({id:"0ASQJH"}),icon:u.C4q,color:"yellow"},{key:"good",label:(0,l.jsx)(h.cC,{id:"9ZYnL5"}),ariaLabel:()=>m.ag._({id:"9ZYnL5"}),icon:u.ctA,color:"green"}],nl=e=>{let{docId:t,isDark:i,interactionId:n}=e,[r,s]=(0,j.useState)(null),[o,c]=(0,j.useState)(!1),[m,p]=(0,j.useState)(""),g=(0,j.useMemo)(()=>i6()(nt()(i8()(nt()(nn),"category"))).concat([nr]),[]),[f,v]=(0,j.useState)(new Set),C=(0,j.useRef)(null),b=(0,iR.p)(),y=(0,j.useCallback)(e=>{s(e),(0,ni.fM)({rating:e,doc_id:t,interactionId:n}),b({title:(0,l.jsx)(h.cC,{id:"2gZOCV"}),status:"success",position:"top",duration:1e3}),setTimeout(()=>{var e;null==C||null===(e=C.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},200)},[t,n,b]),k=(0,j.useCallback)(e=>{e||((0,ni.XH)({feedback:i3().sanitize(m),tags:Array.from(f),rating:r,doc_id:t,interactionId:n}),b({title:(0,l.jsx)(h.cC,{id:"+Rq0s/"}),status:"success",position:"top",duration:2e3,isClosable:!0})),c(!0)},[t,m,n,b,f,r]);return(0,l.jsx)(d.xu,{p:4,borderRadius:"lg",border:"1px solid",borderColor:i?"whiteAlpha.100":"gray.200",position:"relative",children:o?(0,l.jsxs)(a.x,{color:i?"green.400":"green.600",textAlign:"center",children:[(0,l.jsx)(x.G,{icon:u.fV7})," ",(0,l.jsx)(h.cC,{id:"SOk0EB"})]}):(0,l.jsxs)(tT.K,{spacing:4,children:[(0,l.jsxs)(tT.K,{alignItems:"center",spacing:"1",children:[(0,l.jsx)(a.x,{fontSize:"sm",color:i?"whiteAlpha.800":"gray.500",children:(0,l.jsx)(h.cC,{id:"E47gBS"})}),r?(0,l.jsxs)(a.x,{textAlign:"center",color:i?"green.400":"green.600",children:[(0,l.jsx)(x.G,{icon:u.fV7})," ",(0,l.jsx)(h.cC,{id:"SOk0EB"})]}):(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"cguR5Y"})})]}),(0,l.jsx)(ex.U,{fontSize:"xl",width:"100%",children:ns.map(e=>{let{key:t,ariaLabel:n,label:s,icon:o,color:a}=e,d=r===t;return(0,l.jsx)(na,{ariaLabel:n,label:s,icon:o,color:a,onClick:()=>y(t),isSelected:d,isDisabled:!1,isDark:i},t)})}),r&&"good"!==r&&(0,l.jsxs)(i1.NI,{children:[(0,l.jsx)(i2.l,{fontSize:"sm",color:i?"whiteAlpha.800":"gray.500",children:(0,l.jsx)(h.cC,{id:"467HY8"})}),(0,l.jsx)(i5.E,{children:g.map(e=>{let{key:t,label:n}=e;return(0,l.jsx)(i5.U,{onClick:()=>{v(e=>{let i=new Set(e);return i.has(t)?i.delete(t):i.add(t),i})},children:(0,l.jsx)(no,{label:n,isDark:i,isSelected:f.has(t)})},t)})})]}),r&&(0,l.jsxs)(i1.NI,{textAlign:"center",children:[(0,l.jsx)(i2.l,{fontSize:"sm",color:i?"whiteAlpha.800":"gray.500",children:"good"===r?(0,l.jsx)(h.cC,{id:"AmM8eQ"}):(0,l.jsx)(h.cC,{id:"PhJTrf"})}),(0,l.jsx)(ig.g,{value:m,onChange:e=>{p(e.target.value)},placeholder:"",size:"sm",mb:"4"}),(0,l.jsxs)(em.h,{spacing:"4",ref:C,children:[(0,l.jsx)(eh.z,{variant:"text",onClick:()=>{k(!0)},children:(0,l.jsx)(h.cC,{id:"6Uau97"})}),(0,l.jsx)(eh.z,{variant:"solid",isDisabled:""===m&&0===f.size,onClick:()=>k(!1),minW:32,children:(0,l.jsx)(h.cC,{id:"hQRttt"})})]})]})]})})},no=e=>{let{label:t,isDark:i,isSelected:n}=e;return(0,l.jsx)(eh.z,{variant:"plain",size:"sm",height:"6",boxShadow:"none",bgGradient:"none",bg:n?i?"purple.500":"purple.100":i?"gray.800":"gray.50",color:n?i?"white":"purple.700":i?"white":"gray.800",borderColor:i?"whiteAlpha.200":"blackAlpha.200",_hover:{color:void 0},cursor:"pointer",children:t})},na=e=>{let{label:t,ariaLabel:i,icon:n,color:r,isSelected:s,onClick:o,isDisabled:d,isDark:c}=e;return(0,l.jsx)(ep.kH,{label:t,placement:"top",children:(0,l.jsx)(I.h,{"aria-label":i(),boxShadow:"none",bg:s?c?"".concat(r,".200"):"".concat(r,".100"):c?"whiteAlpha.300":"gray.50",_disabled:{opacity:"".concat(s?1:.5),cursor:"not-allowed"},color:s?c?"".concat(r,".600"):"".concat(r,".500"):c?"whiteAlpha.800":"gray.500",_hover:{backgroundColor:"".concat(r,".100"),color:"".concat(r,".500")},flex:1,icon:(0,l.jsx)(a.x,{fontSize:"2xl",children:(0,l.jsx)(x.G,{icon:n})}),isDisabled:d,variant:"plain",onClick:o})})};var nd=i(39122),nc=i(34881);let nu=["90%","360px"],nx=e=>{let{onClose:t,eyebrowText:i,mainText:n,callsToAction:r}=e;return(0,l.jsxs)(d.xu,{bg:"white",border:"0.5px solid var(--chakra-colors-gray-100)",borderRadius:"md",shadow:"md",p:4,w:nu,maxW:nu,position:"relative",children:[(0,l.jsx)(eZ.P,{size:"sm",onClick:t,position:"absolute",insetEnd:1,top:1}),(0,l.jsxs)(tT.K,{spacing:4,children:[(0,l.jsxs)(tT.K,{spacing:1,paddingEnd:3,children:[!(0,ef.s2)()&&(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.600",children:i}),(0,l.jsx)(a.x,{fontSize:"md",children:n})]}),(0,l.jsx)(d.xu,{w:"100%",children:r})]})]})},nh=e=>{let{onClose:t,startTour:i}=e;return(0,l.jsx)(nx,{eyebrowText:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{"aria-label":"Wave",role:"img",children:"\uD83D\uDC4B"})," ",(0,l.jsx)(h.cC,{id:"IiwaCT",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})]}),mainText:(0,l.jsx)(h.cC,{id:"ntWFEH"}),onClose:t,callsToAction:(0,l.jsx)(eh.z,{size:"md",w:"100%",variant:"solid",onClick:()=>{i(0),t()},children:(0,l.jsx)(h.cC,{id:"VzFYDl"})})})};var nm=i(38914);let np=["90%","360px"],ng=e=>{let{onClose:t}
1=e,[i,n]=(0,j.useState)(!0);return(0,j.useEffect)(()=>{setTimeout(()=>{n(!1)},3e3)},[]),(0,l.jsxs)(d.xu,{bg:"white",border:"0.5px solid var(--chakra-colors-gray-100)",borderRadius:"md",shadow:"md",p:4,w:np,maxW:np,position:"relative",children:[(0,l.jsx)(eZ.P,{size:"md",onClick:t,position:"absolute",insetEnd:1,top:1}),(0,l.jsxs)(tT.K,{direction:"row",spacing:3,justify:"center",w:"100%",alignItems:"center",children:[(0,l.jsx)(d.xu,{color:"trueblue.300",children:(0,l.jsx)(x.G,{icon:nm.tc$,size:"2x",className:i?"fa-bounce":void 0})}),(0,l.jsxs)(tT.K,{spacing:0,direction:"column",flex:1,textAlign:"left",children:[(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.600",children:(0,l.jsx)(h.cC,{id:"eoDgVo"})}),(0,l.jsx)(a.x,{fontSize:"md",children:(0,l.jsx)(h.cC,{id:"p7dFyi"})})]})]})]})},nj="source",nf="desktop-tour-toast",nv="switch-from-mobile-to-desktop-toast",nC=e=>{var t;let{editor:i}=e,n=(0,iR.p)(),r=(0,M.CG)(iU.yx),{startTour:s}=(0,b.c8)(),{user:l,setSettings:o}=(0,eY.SE)(),[a,d]=(0,j.useState)(!1),c=(0,j.useRef)(!1),u=!!(null==l?void 0:null===(t=l.settings)||void 0===t?void 0:t.needsEditorOnboarding),x=(0,M.CG)((0,iM.oH)(null==i?void 0:i.gammaDocId)),h=!!x&&"running"===x.status,m=!!x&&("complete"===x.status||"error"===x.status),p=(0,eU.As)("editor"),[g,f]=(0,j.useState)(null),[v]=(0,j.useState)(()=>(0,ev.SJ)()[nj]===nd.VY),[C]=(0,j.useState)(()=>v&&(0,ef.s2)()),y=v&&m;return(0,j.useEffect)(()=>{i&&d(!h&&!(0,ef.s2)()&&v&&u)},[i,v,h,u]),(0,j.useEffect)(()=>{setTimeout(()=>{(0,nc.lO)({query:{...(0,ev.SJ)(),[nj]:void 0},emitChange:!1})})},[]),(0,j.useEffect)(function(){return a&&!n.isActive(nf)&&setTimeout(()=>{n({id:nf,position:"bottom-left",render:e=>{let{onClose:t}=e;return nh({onClose:()=>{null==o||o({remove:["needsEditorOnboarding"]}),t()},startTour:s})},isClosable:!0,duration:null})},2e3),()=>{n.isActive(nf)&&n.close(nf)}},[o,a,s,n]),(0,j.useEffect)(function(){if(!(0,ef.s2)())return;let e=document.querySelector(p.scrollSelector);if(!e)return;f(e);let t=()=>{if(!g||!(0,ef.s2)())return;let e=(null==g?void 0:g.scrollTop)>=(null==g?void 0:g.scrollHeight)/4;e&&C&&!n.isActive(nv)&&!c.current&&(c.current=!0,n({id:nv,position:"top",render:e=>{let{onClose:t}=e;return ng({onClose:t})},isClosable:!0,duration:null,containerStyle:{minWidth:"100%",display:"flex",justifyContent:"center"}}))};return window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("scroll",t,!0),n.isActive(nv)&&n.close(nv)}},[r,g,p.scrollSelector,C,n]),{showDocWizardFooter:y}},nb=(0,j.memo)(e=>{var t;let{interactionId:i}=e,n=(0,M.CG)(iU.yx),r=(0,eT.Yy)(),[s,a]=(0,j.useState)(!1),d=(0,iR.p)(),c=null==n?void 0:null===(t=n.accessLinks)||void 0===t?void 0:t[0],u=(0,j.useMemo)(()=>(0,ev.Gn)({docTitle:null==n?void 0:n.title,docId:null==n?void 0:n.id,token:null==c?void 0:c.token,absolute:!0}),[n,null==c?void 0:c.token]),{onCopy:x}=(0,iG.V)(u);(0,j.useCallback)(()=>{(0,iL.J)({docId:null==n?void 0:n.id,source:"docWizardFooter",type:"tokenUrl"}),x(),d({title:(0,l.jsx)(h.cC,{id:"pQjjYo"}),status:"success",position:"top",duration:1e3,isClosable:!1})},[null==n?void 0:n.id,x,d]);let m=(0,j.useCallback)(()=>{a(!0)},[]);return(ia(),n)?(0,l.jsx)(ep.Wk,{isDark:r,children:(0,l.jsx)(o.k,{className:"chakra-dont-set-collapse","data-doc-wizard-footer":!0,w:"100%",mt:(0,ef.s2)()?void 0:"-".concat(iF.m),children:(0,l.jsx)(iz.U,{in:!s,style:{width:"100%"},unmountOnExit:!0,children:(0,l.jsx)(o.k,{pt:[10,10,20],pb:[4,4,8],w:"100%",position:"relative",...r?{background:"gray.900",color:"white",borderTop:"2px solid var(--chakra-colors-whiteAlpha-200)"}:{background:"white",color:void 0,borderTop:"2px solid var(--chakra-colors-blackAlpha-200)"},children:(0,l.jsx)(iN.W,{maxW:"450px",children:(0,l.jsxs)(tT.K,{spacing:8,children:[!n.site&&(0,l.jsx)(i$,{}),n.site&&!(0,ef.s2)()&&(0,l.jsx)(i0,{}),(0,l.jsx)(nl,{docId:n.id,isDark:r,interactionId:i}),(0,l.jsx)(tO.M,{pt:[0,0,4],w:"100%",children:(0,l.jsx)(eh.z,{size:"sm",onClick:m,variant:"text",colorScheme:"blackAlpha",children:(0,l.jsx)(h.cC,{id:"vLyv1R"})})})]})})})})})}):null});nb.displayName="DocWizardFooterInner";let ny=e=>{let{editor:t}=e,{showDocWizardFooter:i}=nC({editor:t}),n=(0,M.CG)((0,iM.oH)(null==t?void 0:t.gammaDocId)),r=null==n?void 0:n.id;return i&&r?(0,l.jsx)(nb,{interactionId:r}):(0,l.jsx)(l.Fragment,{})};var nk=i(98537),nw=i.n(nk),nS=i(11082),nE=i(12136);let nI=e=>{let{onCloneClick:t,onSignupClick:i,isLoggedIn:n}=e;return(0,l.jsx)(d.xu,{bg:"white",border:"0.5px solid var(--chakra-colors-gray-100)",borderRadius:"md",shadow:"md",display:"column",p:4,position:"relative",children:n?(0,l.jsxs)(ex.U,{children:[(0,l.jsxs)(a.x,{mr:1,children:[(0,l.jsx)(h.cC,{id:"HMsJrS",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc},components:{0:(0,l.jsx)("strong",{})}})," ","\uD83D\uDE0D"]}),(0,l.jsx)(eh.z,{variant:"solid",onClick:t,children:(0,l.jsx)(h.cC,{id:"he3ygx"})})]}):(0,l.jsxs)(ex.U,{children:[(0,l.jsxs)(a.x,{mr:1,children:[(0,l.jsx)(h.cC,{id:"FEyEJk",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc,GAMMA_PROPER_NOUN:K.N6},components:{0:(0,l.jsx)("strong",{})}})," ","\uD83D\uDE0D"]}),(0,l.jsx)(ii(),{href:"/signup",passHref:!0,legacyBehavior:!0,children:(0,l.jsx)(eh.z,{as:nS.r,onClick:i,variant:"solid",textDecoration:"none !important",children:(0,l.jsx)(h.cC,{id:"e+RpCP"})})})]})})},n_=e=>{let t=!(0,ef.s2)(),{user:i}=(0,eY.SE)(),n=(0,iR.p)(),r=(0,j.useRef)(),s=(0,nE.e)(),l=(0,j.useCallback)(()=>{e&&(null===ez.co||void 0===ez.co||ez.co.track(ez.AA.EXAMPLE_SIGNUP_CLICKED,{doc_id:e.id,title:e.title}))},[e]),o=(0,j.useCallback)(()=>{s({docId:null==e?void 0:e.id,docTitle:null==e?void 0:e.title,source:"example_deck_clone_toast"})},[e,s]);(0,j.useEffect)(()=>()=>{r.current&&n.close(r.current)},[n]);let a=t&&e,d=!!i;(0,tr.vm)(()=>{r.current&&n.close(r.current),a&&(r.current=n({position:"bottom",render:()=>nI({onCloneClick:o,isLoggedIn:d,onSignupClick:l}),isClosable:!0,duration:null}))},[e,t,o,l,a,i,n,d],[a,d])};var nA=i(27058),nT=i(97857),nO=i(61750),nP=i(58247);let nD="sessionId1",nR=eM.hj.create({addStorage:()=>({user:{}}),addCommands(){return{user:e=>()=>{let t=(0,M.bh)();return this.storage.user=nw()({},this.storage.user,e),t.dispatch((0,L.MU)({sessionId:nD}
1)),t.dispatch((0,L.Tx)({collaborators:[this.storage.user]})),!0}}}}),nG=e=>{var t;let{docId:i,snapshotId:n,scrollingParentSelector:r,onCreate:s}=e,a=(0,M.CG)(iU.yx);n_(a);let[c]=(0,j.useState)(()=>[nA.F,nO.$1.configure({scrollerSelector:r}),nR,nT._g]),{user:u,anonymousUser:x,isUserLoading:h,color:m}=(0,eY.SE)(),[p,g]=(0,j.useState)(),{data:f,loading:C,error:b}=(0,v.EDv)({variables:{docId:i,snapshotId:n},skip:!n});(0,j.useEffect)(()=>{!h&&p&&p.commands.user({id:(null==u?void 0:u.id)||x.id,color:m.value,sessionId:nD,idleSince:null,name:(null==u?void 0:u.displayName)||x.displayName||"",profileImageUrl:(null==u?void 0:u.profileImageUrl)||"",isReady:!h})},[p,u,m,h,x]);let y=f&&void 0!==f.snapshot&&!C&&a;return(0,l.jsxs)(d.xu,{"data-testid":"example-static-editor-wrapper",flex:"1",height:"100%",children:[!y||b?(0,l.jsxs)(o.k,{direction:"column",height:"100%",flex:"1",bg:"gray.100",alignItems:"center",justifyContent:"center",children:[!y&&(0,l.jsx)(tP.$,{}),b&&(0,l.jsxs)(tO.M,{h:"100%",children:["There was an error loading this ",K.Yc,":"," ",b.message]})]}):(0,l.jsx)(d.xu,{"data-testid":"example-static-editor-wrapper-inner",transitionProperty:"common",transitionDuration:"750ms",transitionTimingFunction:"ease-out",opacity:y?1:0,children:(0,l.jsx)(eO.yE,{doc:a,editorId:"main",docId:i,extensions:c,onCreate:e=>{let{editor:t}=e;g(t),setTimeout(()=>{s&&s(t)},10)},readOnly:!0,initialContent:null===(t=f.snapshot)||void 0===t?void 0:t.content.default,scrollingParentSelector:r})}),(0,l.jsx)(nP.m,{forceShow:!0,abuseReportingEnabled:!1})]})};var nz=i(332),nN=i(36474),nM=i(48832);let nL=e=>{var t;let{site:i}=e,n=null==i?void 0:null===(t=i.currentDeployment)||void 0===t?void 0:t.deploymentTime,r=(0,j.useMemo)(()=>({fromNow:(0,nM.Km)(n),calendar:(0,nM.p6)(n,"PPpp")}),[n]);return(0,l.jsx)(h.cC,{id:"XHgRJj",values:{0:r.fromNow},components:{0:(0,l.jsx)(ep.kH,{label:r.calendar,placement:"top",shouldWrapChildren:!0}),1:(0,l.jsx)(a.x,{as:"span",cursor:"pointer",style:{textDecoration:"underline"}})}})},nF=e=>{let t=(0,M.CG)(eE.lH),i=(0,eA.k2)(t),n=!(0,eA.Vr)(t),r=(0,M.CG)(eE.RM),s=(0,M.CG)(eE.rc),o=e?(0,l.jsx)(h.cC,{id:"mkk40+"}):n?(0,l.jsx)(h.cC,{id:"r5OY1d"}):i?r>0?(0,l.jsx)(h.cC,{id:"pxio6v",values:{changedPagesCount:r}}):s?(0,l.jsx)(h.cC,{id:"G971z4"}):(0,l.jsx)(h.cC,{id:"o+bOqE"}):(0,l.jsx)(h.cC,{id:"tpB6bH"}),a=e?null:n?(0,l.jsx)(h.cC,{id:"u8Rqhk"}):!1===i?(0,l.jsx)(h.cC,{id:"Ys0XoA"}):r>0||s?(0,l.jsx)(h.cC,{id:"Ys0XoA"}):null,d=t?(0,l.jsx)(nL,{site:t}):null;return{statusText:o,detailText:a,needsPublish:!i||s||r>0,lastPublishedTime:d,publishEnabled:!1===n&&!e}},nU=e=>{let{context:t,openSiteSettings:i}=e,n=(0,M.CG)(eE.lH),r=(0,ek.O1)(),{publishSite:s,isPublishing:o}=iH({site:n}),{statusText:d,detailText:c,needsPublish:m,publishEnabled:p}=nF(o),g=(0,eu.ff)(!1,!0);return("pages"!==t||m||o)&&r&&n&&(0,eA.Vr)(n)?(0,l.jsx)(iN.W,{px:0,children:(0,l.jsxs)(tT.K,{w:"100%",bg:g?"gray.800":"gray.50",borderRadius:"md",p:4,align:"pages"===t?"stretch":"center",direction:"pages"===t?"column":"row",spacing:3,children:[(0,l.jsxs)(eJ.g,{spacing:0,color:g?"gray.200":void 0,textAlign:"pages"===t?"center":"left",align:"pages"===t?"center":"start",children:[(0,l.jsx)(a.x,{fontWeight:"500",fontSize:"sm",children:d}),c&&(0,l.jsx)(a.x,{fontSize:"xs",textColor:"gray.500",css:{textWrap:"balance"},children:c})]}),"pages"!==t&&(0,l.jsx)(nN.L,{}),(0,l.jsx)(eh.z,{size:"sm",variant:"solid",leftIcon:(0,l.jsx)(x.G,{icon:u.A$k}),isDisabled:!p,onClick:s,isLoading:o,children:(0,l.jsx)(h.cC,{id:"1EeNDU"})}),"pages"===t&&(0,l.jsx)(eh.z,{textAlign:"left",color:g?"trueblue.200":"trueblue.600",variant:"link",size:"sm",onClick:i,flex:1,children:(0,l.jsx)(h.cC,{id:"WtsmDd"})})]})}):null};var nW=i(27599),nH=i(25481),nV=i(69024),nB=i(29705),nK=i(92850),nq=i(22226),nY=i(54326);let nZ=e=>{var t;let{onClose:i,isOpen:n,site:r}=e,{replace:s}=(0,eg.useRouter)(),d=(0,iR.p)(),[c,{data:u,loading:x}]=(0,v.jUI)(),m=null==u?void 0:null===(t=u.archiveSite)||void 0===t?void 0:t.archived,p=(0,j.useCallback)(async()=>{if(null==r?void 0:r.id)try{await c({variables:{id:null==r?void 0:r.id}}),i()}catch(e){console.error("[DeleteGammaModal] Failed to archive site",e.message),d({title:(0,l.jsx)(h.cC,{id:"aBvGpM"}),description:(0,l.jsx)(h.cC,{id:"DVB9Jq"}),status:"error",duration:5e3,isClosable:!0,position:"top"})}},[c,null==r?void 0:r.id,d]);return((0,j.useEffect)(()=>{m&&(i(),s("/#sites"),d({title:(0,l.jsx)(h.cC,{id:"oGP1Fe"}),description:(0,l.jsx)(h.cC,{id:"sqh0jP"}),status:"success",duration:5e3,isClosable:!0,position:"top"}))},[m,i,s,d,r]),x||m)?(0,l.jsx)(nz.h,{children:(0,l.jsx)(o.k,{w:"100%",h:"100%",zIndex:"overlay",position:"absolute",top:"0",left:"0",background:"whiteAlpha.800",flex:1,children:(0,l.jsx)(tp.AA,{})})}):(0,l.jsxs)(nK.u_,{onClose:i,isOpen:n,size:"lg",children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{children:[(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"cw2uO1",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})}),(0,l.jsx)(tc.o,{isDisabled:x}),(0,l.jsx)(tu.f,{children:(0,l.jsxs)(tT.K,{spacing:4,children:[(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"87gjhX",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})}),(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"tOGRxi",values:{0:(null==r?void 0:r.name)?'"'.concat(null==r?void 0:r.name,'"'):""}})}),(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"MluQ97",values:{GAMMA_ARTIFACT_PROPER_NOUN_PLURAL:K.aq},components:{0:(0,l.jsx)(nS.r,{color:"trueblue.500",colorScheme:"trueblue",href:"/#trash",textDecoration:"underline",isExternal:!0}),1:(0,l.jsx)(nB.h,{mx:"2px"})}})})]})}),(0,l.jsx)(tx.m,{children:(0,l.jsxs)(em.h,{children:[(0,l.jsx)(eh.z,{variant:"ghost",onClick:i,children:(0,l.jsx)(h.cC,{id:"dEgA5A"})}),(0,l.jsx)(eh.z,{variant:"ghost",color:"red.600",onClick:p,isLoading:x,children:(0,l.jsx)(h.cC,{id:"cnGeoo"})})]})})]})]})},nX=e=>{let{site:t}=e,{isOpen:i,onOpen:n,onClose:r}=(0,w.q)({id:"trash-site-modal"}),[s]=(0,v.sJX)(),o=(0,ek.O1)(),a=null==t?void 0:t.archived,d=(0,j.useCallback)(()=>{(null==t?void 0:t.id)&&s({variables:{id:t.id}
1,optimisticResponse:{unarchiveSite:{id:t.id,__typename:"Site"}}})},[null==t?void 0:t.id,s]);return o&&t?a?(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{fixedWidth:!0,icon:ij.XnX}),onClick:d,children:(0,l.jsx)(h.cC,{id:"yKu/3Y"})}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nH.s,{color:"red.500",icon:(0,l.jsx)(x.G,{fixedWidth:!0,icon:u.XAH}),onClick:()=>{n()},children:(0,l.jsx)(h.cC,{id:"NOLglc",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})}),i&&(0,l.jsx)(nZ,{isOpen:i,onClose:r,site:t})]}):(0,l.jsx)(l.Fragment,{})},nJ=()=>({[eV.q.DOC_VIEW]:{buttonLabel:(0,l.jsx)(h.cC,{id:"eZb+lw"}),shortcutIcon:ij.zc,shortcutKeys:(0,ep.cE)("Mod+Enter"),shortcutLabel:(0,l.jsx)(h.cC,{id:"tbDuNX"})},[eV.q.SLIDE_VIEW]:{buttonLabel:(0,l.jsx)(h.cC,{id:"ydzS9x"}),shortcutIcon:ij.Bg$,shortcutKeys:"Esc",shortcutLabel:(0,l.jsx)(h.cC,{id:"5Rfo7J"})}});var nQ=i(65610),n$=i(87827),n0=i(25944),n1=i(52332),n2=i(54999),n5=i(67748),n4=i(52926);let n3=(0,ie.ZP)("mod+Enter"),n9=(0,ie.ZP)("Esc"),n6=(0,ie.ZP)("mod+Esc"),n7=(0,ie.ZP)("shift+mod+Enter"),n8=e=>function(t){t((0,L.Qx)({attached:!1})),t((0,L.PM)({mode:e}))},re=(e,t)=>{let i=document.querySelector(t);if(!i)return;let n=i.getBoundingClientRect();e.commands.scrollToNodeWithPin(document.elementFromPoint(n.width/2,100),100)},rt=e=>{let{editorWrapperEl:t,scrollingParentSelector:i}=e,n=(0,M.TL)(),[r,s]=(0,j.useState)(!1),[l,o]=(0,j.useState)(!1),{editor:a}=(0,n4._i)(),d=(0,M.CG)(L.gh),c=(0,j.useRef)(d);(0,j.useEffect)(()=>{c.current=d},[d]);let u=(0,M.CG)(L.yq),x=(0,M.CG)(L.JA),h=(0,M.CG)(n$.C),m=(0,ez.z$)(),p=(0,j.useCallback)(e=>{a&&!a.isDestroyed&&(e===eV.q.SLIDE_VIEW?((0,n1.E0)(a.state.doc,n),(0,n2.U6)(a,!1),a.commands.spotlightCurrentCard()):(a.commands.turnOffSpotlight(!0),re(a,i)),n(n8(e)))},[n,a,i]),g=(0,j.useCallback)(()=>{try{var e,t,i,n;if(null===(e=document.body)||void 0===e?void 0:e.requestFullscreen){null===(i=document.body)||void 0===i||i.requestFullscreen();return}(null===(t=document.body)||void 0===t?void 0:t.webkitRequestFullscreen)&&(null===(n=document.body)||void 0===n||n.webkitRequestFullscreen())}catch(e){console.debug("[PresentBlock] Error entering fullscreen:",e)}},[]),f=(0,j.useCallback)(()=>{try{if(document.fullscreenElement){document.exitFullscreen();return}document.webkitCurrentFullScreenElement&&document.webkitExitFullscreen&&document.webkitExitFullscreen()}catch(e){console.debug("[PresentBlock] Error exiting fullscreen:",e)}},[]),v=(0,e7.ye)("realUserMetrics"),{recordExitSlideModePerformance:C,recordEnterSlideModePerformance:b}=(0,n0.wK)(v),y=(0,j.useCallback)(e=>{let{fullscreen:t=!1}=e;c.current!==eV.q.SLIDE_VIEW&&(p(eV.q.SLIDE_VIEW),t&&g(),null==m||m.trackDocEvent(ez.AA.PRESENT_MODE_ENTERED),b({isFullscreen:t}),setTimeout(()=>{document.activeElement&&document.activeElement instanceof HTMLElement&&document.activeElement.blur()}))},[p,b,g,c,m]),k=(0,j.useCallback)(()=>{c.current!==eV.q.DOC_VIEW&&(p(eV.q.DOC_VIEW),r&&f(),null==m||m.trackDocEvent(ez.AA.PRESENT_MODE_EXITED),C({isFullscreen:r}))},[p,r,f,C,c,m]);return(0,j.useEffect)(()=>{let e=()=>{null!==document.fullscreenElement||l||k(),null!==document.webkitCurrentFullScreenElement||l||k(),s(e=>!e),o(!1)};return document.addEventListener("fullscreenchange",e),document.addEventListener("webkitfullscreenchange",e),document.addEventListener("mozfullscreenchange",e),()=>{document.removeEventListener("fullscreenchange",e),document.removeEventListener("webkitfullscreenchange",e),document.removeEventListener("mozfullscreenchange",e)}},[l,k,f]),(0,nQ.r)(()=>{a&&!a.isDestroyed&&d===eV.q.DOC_VIEW&&requestAnimationFrame(()=>{let e=a.state.selection;e instanceof n5.c&&a.commands.command(t=>{let{tr:i}=t;return i.setSelection(e.createSelectionNear()),!0})})},[a,d]),(0,j.useEffect)(()=>ej.F7.on("keydown","PRESENT_BLOCK",e=>{var t,i,n;let r=c.current===eV.q.SLIDE_VIEW;if(!h){if(n3(e)){if(null==e?void 0:null===(t=e.target)||void 0===t?void 0:t.closest("[data-gamma-child-tiptap-editor]"))return;return e.preventDefault(),y({fullscreen:!1}),!0}if(n7(e)){if(null==e?void 0:null===(i=e.target)||void 0===i?void 0:i.closest("[data-gamma-child-tiptap-editor]"))return;return e.preventDefault(),y({fullscreen:!0}),!0}if(n6(e)&&r)return k(),!0;if(n9(e)&&r&&!u&&!x){if(null==e?void 0:null===(n=e.target)||void 0===n?void 0:n.closest("[data-gamma-child-tiptap-editor]"))return;return k(),!0}}}),[y,k,g,u,x,t,h]),{enterSlideView:y,exitSlideView:k,enterFullscreen:g,exitFullscreen:f,exitedFullscreenByClick:l,isFullscreen:r,setIsFullscreen:s,setExitedFullscreenByClick:o}},ri=e=>{let{editorWrapperEl:t,scrollingParentSelector:i}=e,n=(0,M.CG)(L.gh),r=(0,e7.ye)("presentFullScreen"),{shortcutIcon:s,shortcutKeys:o,buttonLabel:a}=nJ()[n],{enterSlideView:d,exitSlideView:c}=rt({editorWrapperEl:t,scrollingParentSelector:i});return(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:s,fixedWidth:!0}),command:o,onClick:()=>{n===eV.q.SLIDE_VIEW?c():d({fullscreen:r})},children:a})};var rn=i(74008),rr=i(67109),rs=i(87342),rl=i(81640);let ro="gray.700";var ra=i(52929);let rd=e=>{let{error:t,refetch:i,...n}=e;return(0,l.jsx)(d.xu,{px:6,py:4,...n,children:(0,l.jsxs)(id.b,{p:6,status:"error",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",children:[(0,l.jsx)(ra.z,{mr:0,boxSize:"30px",alignSelf:"center"}),(0,l.jsx)(ic.C,{mt:4,mb:2,fontSize:"md",children:(0,l.jsx)(h.cC,{id:"uNQm3r"})}),(0,l.jsx)(iu.X,{maxWidth:"md",children:t.message}),(0,l.jsx)(eh.z,{mt:4,onClick:()=>i(),children:(0,l.jsx)(h.cC,{id:"6gRgw8"})})]})})},rc=()=>
1m.ag._({id:"QbrUIo"}),ru=()=>m.ag._({id:"FbBkvL"}),rx=e=>{let{isAnalyticsLoading:t,hasError:i,view:n,setView:r,description:s}=e;return i?(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"ZlwDi6"})}):(0,l.jsxs)(o.k,{direction:"column",flex:1,children:[(0,l.jsx)(nY.x,{children:t?(0,l.jsx)(rh,{}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(h.cC,{id:"ZlwDi6"}),(0,l.jsxs)(eJ.g,{align:"stretch",spacing:4,children:[(0,l.jsx)(a.x,{color:"gray.500",fontSize:"sm",fontWeight:"normal",letterSpacing:"normal",children:s}),(0,l.jsxs)(i5.E,{children:[(0,l.jsx)(i5.U,{children:(0,l.jsx)(eh.z,{leftIcon:(0,l.jsx)(x.G,{icon:ij.Ma4,"aria-label":rc()}),variant:"ghost",fontWeight:"600",bg:"deckView"===n?"trueblue.50":"transparent",color:"deckView"===n?"trueblue.500":ro,onClick:()=>r("deckView"),children:rc()})}),(0,l.jsx)(i5.U,{children:(0,l.jsx)(eh.z,{leftIcon:(0,l.jsx)(x.G,{icon:ij.AGo,"aria-label":ru()}),variant:"ghost",fontWeight:"600",bg:"cardEngagement"===n?"trueblue.50":"transparent",color:"cardEngagement"===n?"trueblue.500":ro,onClick:()=>r("cardEngagement"),children:ru()})})]})]})]})}),(0,l.jsx)(tc.o,{})]})},rh=()=>(0,l.jsxs)(eJ.g,{align:"stretch",spacing:4,children:[(0,l.jsx)(rr.O,{h:12,width:"30%"}),(0,l.jsx)(rr.O,{h:4,width:"80%"})]});var rm=i(98621),rp=i.n(rm),rg=i(17831);let rj=e=>{let{degree:t,alpha:i=1,startColor:n="#ECC94B",endColor:r="#38A169"}=e;if(Number.isNaN(t))return rp()("#e5e0df").toHex8String();let s=rp()(n).toHsl(),l=rp()(r).toHsl();return rp()({h:(0,rg.t7)(s.h,l.h,t),s:(0,rg.t7)(s.s,l.s,t),l:(0,rg.t7)(s.l,l.l,t),a:i}).toHex8String()},rf=(e,t)=>e.reduce((e,i)=>(e[i.cardId]=i[t],e),{}),rv=(e,t)=>{let i=0;for(let r in e){var n;i+=(null!==(n=t[r])&&void 0!==n?n:0)+rv(e[r],t)}return i},rC=(e,t)=>{let i=0;for(let r in e){var n;let s=null!==(n=t[r])&&void 0!==n?n:0;i=Math.max(s+rv(e[r],t),i)}return i};var rb=i(16426),ry=i(7628),rk=i(25195),rw=i(62349),rS=i.n(rw);let rE=e=>{let{cardsViewed:t,totalCards:i}=e,n=rj({degree:t/i}),r=i>0;return(0,l.jsxs)(ex.U,{spacing:3,children:[(0,l.jsxs)(o.k,{flex:1,position:"relative",children:[(0,l.jsx)(rk.E,{h:4,flex:1,borderRadius:"sm",value:t,max:r?i:void 0,bg:"gray.200",sx:{"> div":{bg:n}}}),r&&t===i&&(0,l.jsx)(r_,{top:0,right:0,transform:"translate(50%,-50%)",position:"absolute"})]}),(0,l.jsx)(a.x,{w:{base:10,lg:12},fontSize:"sm",whiteSpace:"nowrap",textAlign:"left",children:r?"".concat(t,"/").concat(i):(0,l.jsx)(h.cC,{id:"8Va3Pt"})})]})},rI=e=>{let{cardCount:t}=e,i=(0,j.useMemo)(()=>rS()(1,t),[t]);return(0,l.jsxs)(ex.U,{spacing:3,filter:"blur(3px)",children:[(0,l.jsx)(o.k,{flex:1,position:"relative",children:(0,l.jsx)(rk.E,{h:4,flex:1,borderRadius:"sm",value:i,max:t,bg:"gray.300",sx:{"> div":{bg:"gray.300"}}})}),(0,l.jsxs)(a.x,{w:{base:10,lg:12},fontSize:"sm",whiteSpace:"nowrap",textAlign:"left",color:"gray.600",children:[i,"/",t]})]})},r_=e=>{let{...t}=e;return(0,l.jsx)(d.Cd,{bg:"green.500",size:"18px",border:"2px solid white",color:"white",...t,children:(0,l.jsx)(x.G,{icon:ij.LEp,"aria-label":m.ag._({id:"y886Ns"}),size:"xs"})})},rA=e=>t=>(0,rg.t7)(0,100,t/e),rT=e=>{var t;let{cards:i,isColorized:n=!1,scaleToMax:r=!1,includeChildren:s,showViewersPercent:o=!1,left
1Label:a,rightLabel:c,tooltipLabel:u,cardLookupTable:x,onAnalyticsPanelClose:h}=e,m=s?rC(i,x):Math.max(...Object.values(x)),p=rA(m),g=(0,j.useCallback)(e=>p(e),[p]);return(0,l.jsxs)(d.xu,{mt:6,mb:4,children:[(0,l.jsxs)(ex.U,{mb:3,children:[(0,l.jsx)(ex.U,{children:(0,l.jsx)(ep.NZ,{children:a})}),(0,l.jsx)(nN.L,{}),(0,l.jsx)(ex.U,{children:(0,l.jsx)(ep.kH,{placement:"top",label:u,children:(0,l.jsx)(ex.U,{children:(0,l.jsx)(ep.NZ,{borderBottom:"0.125em dashed",borderBottomColor:"gray.400",children:c})})})})]}),(0,l.jsx)(d.xu,{width:"100%",children:Object.entries(i).map(e=>{let[i,a]=e;return(0,l.jsx)(rO,{id:i,childCards:a,percentage:null!==(t=x[i])&&void 0!==t?t:0,calculatePercentageScale:g,isColorized:n,cardLookupTable:x,scaleToMax:r,includeChildren:s,showViewersPercent:o,onAnalyticsPanelClose:h},i)})})]})},rO=e=>{var t;let{id:i,cardLookupTable:n,childCards:r,percentage:s,calculatePercentageScale:c,isColorized:m,scaleToMax:p,includeChildren:g,showViewersPercent:f,onAnalyticsPanelClose:v}=e,C=(0,e7.ye)("screenshotsEnabled"),[b,y]=(0,j.useState)(!1),{referenceRef:k,popperRef:w,isHovering:S,getPopperProps:E,onMouseOver:_,onMouseOut:A}=(0,tr.Ux)({placement:"top",gutter:12,enterDelay:200}),T=(0,j.useCallback)(()=>{y(!b)},[b]),O=(0,j.useCallback)(()=>{(0,ry.D)({cardId:i}),v()},[i,v]),P=(0,e4.c)(i),{title:D}=(0,e4.T)({cardId:i}),R=Object.values(r).length>0,G=0===s,z=g?s+rv(r,n):s,N=b?z:0,M=p?c(z):Math.min(100,N),L=b?s:z,F=p?c(L):Math.min(100,L),U={startColor:"#F6AD55",endColor:"#68D391"},W=m?rj({degree:M/100,...U}):"trueblue.50",H=m?rj({degree:F/100,...U}):"trueblue.100";return(0,l.jsxs)(tT.K,{children:[(0,l.jsxs)(o.k,{direction:"column",onMouseOver:_,onMouseOut:A,children:[(0,l.jsxs)(o.k,{ref:k,h:8,px:2,bg:"gray.100",borderRadius:"md",position:"relative",overflow:"hidden",alignItems:"center",_focusWithin:{shadow:"outline"},children:[(0,l.jsxs)(ex.U,{pos:"absolute",zIndex:1,children:[R&&(0,l.jsx)(I.h,{"aria-label":"exp
1and-card",size:"xs",variant:"ghost",isRound:!0,colorScheme:"blackAlpha",icon:(0,l.jsx)(x.G,{icon:u._tD}),transform:b?"rotate(90deg)":"",onClick:T,_focus:{shadow:"none"}}),!R&&(0,l.jsx)(o.k,{w:6,justifyContent:"center",alignItems:"center",children:G?(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"s+PDNe"}),children:(0,l.jsx)(d.xu,{color:"blackAlpha.500",children:(0,l.jsx)(x.G,{icon:ij.Aq,size:"sm"})})}):(0,l.jsx)(d.xu,{color:"blackAlpha.300",fontSize:"xx-small",children:(0,l.jsx)(x.G,{icon:ij.nZ9,size:"sm"})})}),(0,l.jsx)(a.x,{color:G?"blackAlpha.500":void 0,noOfLines:1,children:D||(0,l.jsx)(h.cC,{id:"wja8aL"})})]}),(0,l.jsxs)(d.xu,{position:"absolute",w:"100%",height:"100%",top:0,left:0,pointerEvents:"none",children:[(0,l.jsx)(d.xu,{position:"absolute",h:"100%",bg:G?"blackAlpha.200":W,w:"".concat(M,"%")}),(0,l.jsx)(d.xu,{transitionProperty:"all",transitionDuration:"normal",position:"absolute",h:"100%",bg:G?"blackAlpha.300":H,w:"".concat(F,"%")})]}),m&&100===s&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nN.L,{}),(0,l.jsx)(r_,{alignSelf:"center",zIndex:1})]})]}),S&&(0,l.jsx)(ep.qh,{ref:w,src:C?null==P?void 0:P.previewUrl:rb.Z.src,fallbackSrc:rb.Z.src,shouldShow:S,onClick:O,tooltip:(0,l.jsx)(h.cC,{id:"3YmIR6"}),label:f?(0,l.jsx)(h.cC,{id:"wmqtMZ",values:{percentage:s}}):void 0,...E()})]}),(0,l.jsx)(d.xu,{pl:8,children:R&&Object.entries(r).map(e=>{let[i,r]=e;return(0,l.jsx)(iz.U,{in:b,children:(0,l.jsx)(rO,{id:i,childCards:r,percentage:null!==(t=n[i])&&void 0!==t?t:0,cardLookupTable:n,calculatePercentageScale:c,scaleToMax:p,isColorized:m,includeChildren:g,showViewersPercent:f,onAnalyticsPanelClose:v})},i)})})]})},rP=()=>(0,l.jsx)(tT.K,{spacing:2,children:(0,l.jsx)(h.cC,{id:"QXJTby",components:{0:(0,l.jsx)(a.x,{}),1:(0,l.jsx)(a.x,{}),2:(0,l.jsx)(a.x,{})}})}),rD=e=>{let{timeInMS:t}=e;return void 0===t?(0,l.jsx)(l.Fragment,{}):(0,l.jsx)(h.cC,{id:"yXHI9B",values:{timeInSeconds:t/1e3}})},rR=(e,t)=>"viewTimePercent"===e?{chartDescription:(0,l.jsx)(h.cC,{id:"dpTE1c",values:{viewerCount:t}}),leftLabel:(0,l.jsx)(h.cC,{id:"ml51m3"}),rightLabel:(0,l.jsx)(h.cC,{id:"8R7bfR"})}:{chartDescription:(0,l.jsx)(h.cC,{id:"b2VMTo",values:{viewerCount:t}}),leftLabel:(0,l.jsx)(h.cC,{id:"kTgCTO"}),rightLabel:(0,l.jsx)(h.cC,{id:"AKDcmS"})},rG=e=>{let{docId:t,viewerFilter:i,currentViewerFilterCount:n,onAnalyticsPanelClose:r}=e,s=(0,M.qr)(),o=s.getState(),a=(0,L.X9)(o),{data:c,error:m,loading:p,refetch:g}=(0,v.IrH)({variables:{docId:t}}),[f,C]=(0,j.useState)("viewTimePercent"),{chartDescription:b,rightLabel:y,leftLabel:k}=rR(f,n),w="viewersOnly"===i?"viewers":"everyone",S=(0,e7.ye)("cardViewedThreshold"),E=(0,j.useMemo)(()=>{var e;return(null==c?void 0:null===(e=c.docCardsStats)||void 0===e?void 0:e[w])||[]},[null==c?void 0:c.docCardsStats,w]),I=(0,j.useMemo)(()=>rf(E,f),[E,f]),_=(0,j.useCallback)(()=>C("viewTimePercent"),[]),A=(0,j.useCallback)(()=>C("viewersPercent"),[]);return(0,l.jsxs)(d.xu,{children:[(0,l.jsxs)(ex.U,{my:4,children:[(0,l.jsx)(eh.z,{leftIcon:(0,l.jsx)(x.G,{icon:u.SZw,"aria-label":"Time spend"}),variant:"ghost",fontWeight:"600",bg:"viewTimePercent"===f?"trueblue.50":"transparent",color:"viewTimePercent"===f?"trueblue.500":ro,onClick:_,children:(0,l.jsx)(h.cC,{id:"XyvAeS"})}),(0,l.jsx)(eh.z,{leftIcon:(0,l.jsx)(x.G,{icon:ij.jGC,"aria-label":"Percent viewed"}),variant:"ghost",fontWeight:"600",bg:"viewersPercent"===f?"trueblue.50":"transparent",color:"viewersPercent"===f?"trueblue.500":ro,onClick:A,children:(0,l.jsx)(h.cC,{id:"vXtpAZ"})})]}),(0,l.jsx)(rN,{description:b}),m&&(0,l.jsx)(rd,{error:m,refetch:g}),p&&!m&&(0,l.jsx)(rz,{}),!p&&!m&&(0,l.jsx)(rT,{cards:a.tree,cardLookupTable:I,scaleToMax:"viewTimePercent"===f,isColorized:"viewersPercent"===f,includeChildren:"viewTimePercent"===f,showViewersPercent:"viewersPercent"===f,rightLabel:y,leftLabel:k,tooltipLabel:"viewTimePercent"===f?(0,l.jsx)(rP,{}):(0,l.jsx)(rD,{timeInMS:S}),onAnalyticsPanelClose:r})]})},rz=e=>{let{includeDescription:t=!1}=e;return(0,l.jsx)(o.k,{direction:"column",mt:6,mb:4,children:(0,l.jsxs)(eJ.g,{align:"stretch",children:[t&&(0,l.jsx)(rr.O,{h:5,mb:3,w:"70%"}),[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,l.jsx)(rr.O,{h:8},t))]})})},rN=e=>{let{description:t}=e;return(0,l.jsx)(a.x,{color:ro,children:t})};var rM=i(89364),rL=i(78534),rF=i(80774),rU=i(5832),rW=i(14093),rH=i(70189),rV=i(66983),rB=i(79443),rK=i(109),rq=i(16556),rY=i(829),rZ=i.n(rY);let rX=e=>{let{uniqueViewers:t,docCreatedDate:i}=e,n=(0,e7.ye)("cardViewedThreshold");return(0,l.jsx)(rL.h,{children:(0,l.jsxs)(rF.Tr,{children:[(0,l.jsx)(rJ,{label:(0,l.jsx)(h.cC,{id:"LZHJAq",values:{uniqueViewers:t}}
1),tooltip:(0,l.jsx)(h.cC,{id:"aaiIlJ",values:{docCreatedDate:i}}),width:"40%"}),(0,l.jsx)(rJ,{label:(0,l.jsx)(h.cC,{id:"pRGfP3"}),width:"35%"}),(0,l.jsx)(rJ,{label:(0,l.jsx)(h.cC,{id:"QfqHuz"}),tooltip:(0,l.jsx)(rD,{timeInMS:n}),width:"25%"})]})})},rJ=e=>{let{label:t,width:i,tooltip:n}=e,r=(0,l.jsx)(rU.Th,{w:i,children:(0,l.jsx)(a.x,{display:"inline",borderBottom:n?"0.125em dashed":void 0,borderBottomColor:n?"gray.400":void 0,children:t})});return n?(0,l.jsx)(ep.kH,{placement:"top",label:n,children:r}):r},rQ=["Yesterday at 11:02 am","Today at 12:55 pm","Dec 12, 2020, 10:19 pm","Apr 14, 2023, 4:30 pm","Jan 1, 2021, 12:03 am","Dec 7, 1984, 12:03 am","May 14, 2002, 3:56 pm"],r$=e=>{let{viewers:t,currentViewerFilterCount:i,docCreatedDate:n,creatorId:r,contributors:s,cardCount:o,handleTableRowClick:d,hasIndividualAnalytics:c}=e,{user:u}=(0,eY.SE)(),x=c?t:rZ()(t,e=>{var t;return[(null===(t=e.user)||void 0===t?void 0:t.id)===(null==u?void 0:u.id)?0:1,-e.lastOpened]}).slice(0,3);return(0,l.jsx)(rW.x,{children:(0,l.jsxs)(rH.i,{colorScheme:"blackAlpha",children:[(0,l.jsx)(rX,{uniqueViewers:i,docCreatedDate:n}),(0,l.jsx)(rV.p,{children:x.map((e,i)=>{let{user:n,lastOpened:x,visitorId:h}=e,p=(null==n?void 0:n.id)===r,g=s.some(e=>e.user.id===(null==n?void 0:n.id)),j=n?n.displayName+(n.id===(null==u?void 0:u.id)?" "+m.ag._({id:"dDUgzP"}):"")||"":m.ag._({id:"VmjbJY"}),f=x?t5()((0,tZ.P9)(x)):m.ag._({id:"/JO3xr"}),v={name:j,id:(null==n?void 0:n.id)||h||"",email:null==n?void 0:n.email,isCreator:p,isContributor:g,profileImg:null==n?void 0:n.profileImageUrl,lastOpened:f},C=i===t.length-1,b=(null==n?void 0:n.id)===(null==u?void 0:u.id),y=!c&&!b;return(0,l.jsxs)(rF.Tr,{cursor:"pointer",onClick:()=>d(v),_hover:{bg:"blackAlpha.50"},borderBottom:"none",children:[(0,l.jsx)(rB.Td,{borderBottom:C?"0 none":void 0,children:(0,l.jsx)(r0,{name:j,email:null==n?void 0:n.email,profileImg:null==n?void 0:n.profileImageUrl,isContributor:g,isCreator:p,isAnonymous:!n})}),(0,l.jsx)(rB.Td,{borderBottom:C?"0 none":void 0,children:y?(0,l.jsx)(a.x,{fontSize:"sm",filter:"blur(3px)",color:"gray.600",children:rQ[i%rQ.length]}):(0,l.jsx)(a.x,{fontSize:"sm",children:f})}),(0,l.jsx)(rB.Td,{borderBottom:C?"0 none":void 0,children:y?(0,l.jsx)(rI,{cardCount:o}):(0,l.jsx)(rE,{cardsViewed:e.cardsViewed||0,totalCards:o||0})})]},(null==n?void 0:n.id)||h)})})]})})},r0=e=>{let{name:t,profileImg:i,email:n="",isCreator:r=!1,isContributor:s=!1,isAnonymous:o=!1,...d}=e;return(0,l.jsxs)(ex.U,{...d,children:[(0,l.jsx)(rK.q,{size:"sm",name:t,src:i}),(0,l.jsxs)(tT.K,{spacing:.5,children:[(0,l.jsxs)(a.x,{children:[t,o&&(0,l.jsx)(ep.Yq,{label:(0,l.jsx)(h.cC,{id:"VHgG8W",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}}),ml:2})]}),(0,l.jsxs)(ex.U,{mt:1,children:[(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",children:n}),(r||s)&&(0,l.jsx)(rq.Vp,{size:"sm",transform:"translate(0, 1.5px)",children:r?(0,l.jsx)(h.cC,{id:"UE2beD"}):(0,l.jsx)(h.cC,{id:"3L51iw"})})]})]})]})},r1=e=>{var t,i,n,r;let{user:s,onBackClick:o,docId:a,onAnalyticsPanelClose:c}=e,u=(0,M.qr)(),x=u.getState(),m=(0,L.X9)(x),{data:p,error:g,loading:f,refetch:C}=(0,v.IrH)({variables:{docId:a,userId:s.id},skip:!a||!s.id,pollInterval:9e5,notifyOnNetworkStatusChange:!0}),b=null!==(r=null==p?void 0:null===(i=p.docCardsStats)||void 0===i?void 0:null===(t=i.everyone)||void 0===t?void 0:t.length)&&void 0!==r?r:0,y=null==p?void 0:null===(n=p.docCardsStats)||void 0===n?void 0:n.cardCount,k=(0,j.useMemo)(()=>{var e;return(null==p?void 0:null===(e=p.docCardsStats)||void 0===e?void 0:e.everyone)||[]},[null==p?void 0:p.docCardsStats]),w=(0,j.useMemo)(()=>rf(k,"viewTimePercent"),[k]);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nY.x,{children:(0,l.jsx)(eh.z,{"aria-label":"Back",leftIcon:(0,l.jsx)(rM.R,{}),variant:"ghost",onClick:o,children:(0,l.jsx)(h.cC,{id:"iH8pgl"})})}),(0,l.jsx)(tc.o,{}),(0,l.jsx)(rn.i,{}),(0,l.jsx)(tu.f,{children:(0,l.jsxs)(d.xu,{children:[(0,l.jsx)(r2,{user:s,showLastOpened:!0}),y&&(0,l.jsx)(rN,{description:(0,l.jsx)(h.cC,{id:"YJOrjl",values:{cardsViewed:b,totalCards:y}})}),f&&!g&&(0,l.jsx)(rz,{includeDescription:!0}),g&&(0,l.jsx)(rd,{error:g,refetch:C}),!g&&!f&&(0,l.jsx)(rT,{cards:m.tree,scaleToMax:!0,includeChildren:!0,left
1Label:(0,l.jsx)(h.cC,{id:"ml51m3"}),rightLabel:(0,l.jsx)(h.cC,{id:"8R7bfR"}),cardLookupTable:w,tooltipLabel:(0,l.jsx)(rP,{}),onAnalyticsPanelClose:c})]})})]})},r2=e=>{let{user:t,showLastOpened:i}=e;return(0,l.jsxs)(ex.U,{align:"center",my:6,children:[(0,l.jsx)(r0,{name:t.name,profileImg:t.profileImg,email:t.email,isCreator:t.isCreator,isContributor:t.isContributor,width:i?"50%":void 0}),i&&(0,l.jsxs)(eJ.g,{align:"flex-start",spacing:0,children:[(0,l.jsx)(ep.NZ,{children:(0,l.jsx)(h.cC,{id:"pRGfP3"})}),(0,l.jsx)(a.x,{children:t.lastOpened})]})]})},r5=(e,t,i)=>"everyone"===e?m.ag._({id:"1IE7uf",values:{everyone:t}}):"viewersOnly"===e?m.ag._({id:"r/tA4Y",values:{viewersOnly:i}}):m.ag._({id:"V9JX7d"}),r4={everyone:ij.NdV,viewersOnly:ij.Mdf,accessLinkOnly:ij.uWk},r3=e=>{let{selected:t,handleMenuItemChange:i,everyoneCount:n,viewersOnlyCount:r}=e;return(0,l.jsxs)(tJ.v,{children:[(0,l.jsx)(tQ.j,{leftIcon:(0,l.jsx)(x.G,{size:"xs",icon:r4[t]}),as:eh.z,size:"md",rightIcon:(0,l.jsx)(x.G,{size:"xs",icon:u.ptq}),children:r5(t,n,r)}),(0,l.jsx)(t$.q,{zIndex:2,maxW:"380px",children:(0,l.jsxs)(t0._,{defaultValue:t,value:t,onChange:e=>{Array.isArray(e)||i(e)},children:[(0,l.jsx)(t1.i,{value:"everyone",isDisabled:0===n,children:(0,l.jsxs)(o.k,{align:"center",children:[(0,l.jsx)(x.G,{icon:r4.everyone,size:"xs"}),(0,l.jsxs)(d.xu,{ml:3,children:[(0,l.jsx)(a.x,{children:r5("everyone",n,r)}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"c5ESvc",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})})]})]})}),(0,l.jsx)(t1.i,{value:"viewersOnly",isDisabled:0===r,children:(0,l.jsxs)(o.k,{align:"center",children:[(0,l.jsx)(x.G,{icon:r4.viewersOnly,size:"xs"}),(0,l.jsxs)(d.xu,{ml:3,children:[(0,l.jsx)(a.x,{children:r5("viewersOnly",n,r)}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"5hKO48",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})})]})]})}),!1]})})]})};var r9=i(46423),r6=i(6802),r7=i(70258),r8=i(80237),se=i(59309),st=i(2574),si=i(92638),sn=i(33951),sr=i(10897),ss=i(14582),sl=i(75715),so=i(96492),sa=i(14141),sd=i(40837);let sc={top:55,right:20,bottom:40,left:24},su=e=>Math.round(e).toString(),sx=e=>Math.max(...e.map(e=>(0,sl.Z)(e.toString(),{fontFamily:"Inter, sans-serif",fontSize:"var(--chakra-fontSizes-sm)",fontWeight:"600"})||0)),sh={backgroundColor:"var(--chakra-colors-blackAlpha-800)",color:"var(--chakra-colors-gray-100)",fontFamily:"Inter, sans-serif",boxShadow:"var(--chakra-shadows-4)",fontSize:"var(--chakra-fontSizes-xs)",borderRadius:"var(--chakra-radii-sm)",fontWeight:"var(--chakra-fontWeights-semibold)",borderWidth:"1px",borderColor:"black",paddingRight:"var(--chakra-space-1.5)",paddingLeft:"var(--chakra-space-1.5)",paddingTop:"var(--chakra-space-0.5)",paddingBottom:"var(--chakra-space-0.5)",zIndex:"var(--chakra-zIndex-tooltip)",minWidth:"60px",lineHeight:"var(--chakra-lineHeights-base)"},sm="var(--chakra-colors-gray-500)",sp="var(--chakra-colors-gray-200)",sg=e=>e.map(e=>e.x),sj=e=>e.map(e=>e.y),sf=e=>{let{width:t,height:i,margin:n=sc,chartData:r,TooltipInner:s,showZero:o,shouldRoundYValues:a,showMaxAndMiddle:c,barColor:u,customTooltipStyles:x,onClick:h=()=>{}}=e,{showTooltip:m,tooltipOpen:p,tooltipLeft:g,tooltipTop:f,tooltipData:v,hideTooltip:C}=(0,so.Z)(),b=(0,j.useRef)(),y=(0,j.useRef)();(0,j.useEffect)(()=>()=>{b.current&&clearTimeout(b.current),y.current&&clearTimeout(y.current)},[]);let k=sj(r),w=Math.max(...k),S=[w,Math.round(w/2)],E=sx(c?S:k),I=n.left+E,_=t-I-n.right,A=i-n.top-n.bottom,T={...sa.j,...sh,...x},O=(0,j.useMemo)(()=>(0,si.Z)({range:[0,_],domain:sg(r),padding:.3}),[_,r]),P=(0,j.useMemo)(()=>(0,sn.Z)({range:[A,0],round:!0,domain:[0,w]}),[A,w]),D=o?P(Math.min(...k.filter(e=>0!==e))):A,R=o&&A-D>6;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.xu,{children:(0,l.jsxs)("svg",{width:t,height:i,children:[(0,l.jsx)("rect",{x:0,y:0,rx:4,width:t,height:i,fill:"var(--chakra-colors-gray-100)"}),(0,l.jsx)(se.Z,{top:n.top,left:I,children:r.map(e=>{var t,i;let n=e.y,r=e.x,s="bar-".concat(r,"-").concat(n),a=O.bandwidth(),d=A-(null!==(t=P(n))&&void 0!==t?t:0),c=R&&0===d?6:d,x=null!==(i=O(r))&&void 0!==i?i:0,p=A-c;return(0,l.jsxs)(se.Z,{children:[(0,l.jsx)(sr.Z,{x:x,y:p,width:a,height:c,radius:5,topLeft:!0,topRight:!0,fill:o&&0===n?sp:u,onMouseLeave:()=>{b.current=window.setTimeout(()=>{C()},300)},onMouseMove:t=>{b.current&&clearTimeout(b.current);let i=(0,r8.Z)(t);m({tooltipData:e,tooltipTop:null==i?void 0:i.y,tooltipLeft:null==i?void 0:i.x})},onClick:t=>h(t,e)}),(0,l.jsx)(ss.Z,{x:x,y:0,width:a,height:Math.max(0,A-c),opacity:0,onMouseLeave:()=>{y.current=window.setTimeout(()=>{C()},300)},onMouseMove:t=>{y.current&&clearTimeout(y.current);let i=(0,r8.Z)(t);m({tooltipData:e,tooltipTop:null==i?void 0:i.y,tooltipLeft:null==i?void 0:i.x})}})]},s)})}
1),(0,l.jsx)(r6.Z,{top:n.top,left:I,scale:P,stroke:sp,strokeWidth:2,tickValues:c?S:void 0,numTicks:c?void 0:2,hideZero:!0,tickFormat:a?su:void 0,tickLength:6,tickStroke:sp,tickLabelProps:()=>({fill:sm,textAnchor:"end",fontFamily:"Inter, sans-serif",fontSize:"var(--chakra-fontSizes-sm)",fontWeight:"600",dy:"0.33em",dx:-4})}),(0,l.jsx)(r7.Z,{top:A+n.top,left:I,scale:O,stroke:sp,numTicks:4,tickStroke:sp,tickLabelProps:()=>({fill:sm,textAnchor:"middle",fontFamily:"Inter, sans-serif",fontSize:"var(--chakra-fontSizes-sm)",fontWeight:"600",dy:4}),strokeWidth:2,tickLength:6})]})}),p&&v&&(0,l.jsx)(sd.Z,{top:f,left:g,style:T,children:(0,l.jsx)(s,{x:v.x,y:v.y})})]})},sv=e=>{let{chartTitle:t,TooltipInner:i,showZero:n=!0,shouldRoundYValues:r=!0,showMaxAndMiddle:s=!0,data:o,barColor:c="var(--chakra-colors-trueblue-200)",customTooltipStyles:u,onClick:x=()=>{},...h}=e;return(0,l.jsxs)(d.xu,{position:"relative",height:"300px",...h,children:[(0,l.jsx)(a.x,{size:"xs",color:"gray.500",fontWeight:"600",position:"absolute",top:3,left:"50%",transform:"translateX(-50%)",children:t}),(0,l.jsx)(st.Z,{children:e=>{let{width:t,height:a}=e;return t<10?null:(0,l.jsx)(sf,{width:t,height:a,showZero:n,chartData:o,barColor:c,customTooltipStyles:u,onClick:x,TooltipInner:i,shouldRoundYValues:r,showMaxAndMiddle:s})}})]})},sC=(e,t)=>{let i="LLL d",n=new Date;n.setDate(n.getDate()-t+1);let r=[];for(let s=0;s<t;s++){let t=new Date(n);t.setDate(t.getDate()+s);let l=(0,r9.Z)(t,{representation:"date"}),o=e.find(e=>e.date===l);o?r.push({x:(0,nM.p6)(o.date,i),y:o.uniqueVisitors?o.uniqueVisitors:0}):r.push({x:(0,nM.p6)(l,i),y:0})}return r},sb=e=>{let{viewData:t,dayCount:i}=e,n=sC(t,i);return(0,l.jsx)(sv,{data:n,my:3,chartTitle:(0,l.jsx)(h.cC,{id:"mSEibf"}),TooltipInner:sy})},sy=e=>{let{x:t,y:i}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.x,{children:t}),(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"6MKtHx",values:{y:i}})})]})},sk=e=>e.every(e=>0===e.uniqueVisitors),sw=(e,t)=>t&&t.dailyViews?"everyone"===e?t.dailyViews.everyone?t.dailyViews.everyone:[]:"viewersOnly"===e&&t.dailyViews.viewers?t.dailyViews.viewers:[]:[],sS=(e,t,i)=>{var n,r,s;if(!i)return 0;let l=null!==(r=i.uniqueViewers)&&void 0!==r?r:0,o=null!==(s=null===(n=e.editors)||void 0===n?void 0:n.length)&&void 0!==s?s:0;return"everyone"===t?l:"viewersOnly"===t?Math.max(0,l-o):0},sE=e=>{var t,i;let{doc:n,handleSharePanelOpen:r,onAnalyticsPanelClose:s,canShare:a}=e,{loading:d,data:c,error:u,refetch:x}=(0,v.xls)({variables:{memoId:n.id},skip:!n.id,pollInterval:9e5,notifyOnNetworkStatusChange:!0}),{user:p}=(0,eY.SE)(),[g,f]=(0,j.useState)("deckView"),[C,b]=(0,j.useState)(null),[y,k]=(0,j.useState)("everyone"),w=(0,nM.p6)(n.createdTime,"PPP"),S=n.title||(0,l.jsx)(h.cC,{id:"wja8aL"}),E=(null==c?void 0:c.memoStats.viewers)||[],I=(null==c?void 0:null===(t=c.memoStats.dailyViews)||void 0===t?void 0:t.dayCount)||0,_=sw(y,null==c?void 0:c.memoStats),A=(0,q.Y)("individual_analytics",n.organization),{openUpsellModal:T}=(0,rl.z)(),O=sk(_),P=E.filter(e=>{var t;return"everyone"===y||!(null===(t=n.editors)||void 0===t?void 0:t.some(t=>{var i,n;return(null===(i=e.user)||void 0===i?void 0:i.id)===(null===(n=t.user)||void 0===n?void 0:n.id)}))}),D=sS(n,y,null==c?void 0:c.memoStats),R=(0,j.useCallback)(e=>{k(e)},[]),G=(0,j.useCallback)(e=>{f(e)},[]),z=(0,j.useCallback)(e=>{if(!A&&e.id!==(null==p?void 0:p.id)){T({segmentEvent:ez.AA.GAMMA_PRO_UPSELL_SUBSCRIPTION_INDIVIDUAL_ANALYTICS});return}b(e)},[T,A,p]),N=(0,j.useCallback)(()=>{b(null)},[]),M=void 0!==u;return(0,l.jsxs)(l.Fragment,{children:[C&&(0,l.jsx)(r1,{user:C,onBackClick:N,docId:n.id,onAnalyticsPanelClose:s}),!C&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(rx,{hasError:M,isAnalyticsLoading:d,setView:G,view:g,description:(0,l.jsx)(h.cC,{id:"uEtUah",values:{docTitle:S,docCreatedDate:w}})}),M&&(0,l.jsx)(rd,{error:u,refetch:x}),!M&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(rn.i,{}),(0,l.jsxs)(tu.f,{children:[d&&(0,l.jsx)(sI,{}),!d&&E.length<=1&&a&&(0,l.jsx)(s_,{handleSharePanelOpen:r}),!d&&(0,l.jsxs)(tT.K,{direction:"column",mt:4,spacing:4,children:[(0,l.jsxs)(o.k,{direction:"row",justify:"space-between",align:"center",children:[(0,l.jsx)(eX.X,{as:"h2",size:"md",children:"cardEngagement"===g?ru():rc()}),(0,l.jsx)(r3,{selected:y,handleMenuItemChange:R,everyoneCount:sS(n,"everyone",null==c?void 0:c.memoStats),viewersOnlyCount:sS(n,"viewersOnly",null==c?void 0:c.memoStats)})]}),"deckView"===g&&O&&(0,l.jsx)(sA,{handleSharePanelOpen:r,dayCount:I}),"deckView"===g&&!O&&(0,l.jsx)(sb,{viewData:_,dayCount:I}),"cardEngagement"===g&&(0,l.jsx)(rG,{docId:n.id,viewerFilter:y,currentViewerFilterCount:D,onAnalyticsPanelClose:s}),(0,l.jsx)(r$,{creatorId:(null===(i=n.createdBy)||void 0===i?void 0:i.id)||"",viewers:P,currentViewerFilterCount:D,docCreatedDate:w,contributors:n.editors||[],cardCount:(null==c?void 0:c.memoStats.cardCount)||0,handleTableRowClick:z,hasIndividualAnalytics:A}),P.length>3&&!A&&(0,l.jsx)(eh.z,{variant:"ghost",size:"sm",color:"gray.600",colorScheme:"gray",onClick:()=>T({segmentEvent:ez.AA.GAMMA_PRO_UPSELL_SUBSCRIPTION_INDIVIDUAL_ANALYTICS}),children:(0,l.jsx)(h.cC,{id:"BKBX4n",values:{0:P.length-3}})}),!A&&(0,l.jsx)(rs.m,{segmentEvent:ez.AA.GAMMA_PRO_UPSELL_SUBSCRIPTION_INDIVIDUAL_ANALYTICS,description:m.ag._({i
1d:"GYgPBy"})})]})]})]})]})]})},sI=()=>(0,l.jsxs)(o.k,{direction:"column",py:2,children:[(0,l.jsx)(rr.O,{h:10,width:"40%",mb:4}),(0,l.jsx)(rr.O,{h:40,mb:4}),(0,l.jsx)(eJ.g,{align:"stretch",children:[void 0,void 0,void 0].map((e,t)=>(0,l.jsx)(rr.O,{h:12},t))})]}),s_=e=>{let{handleSharePanelOpen:t}=e;return(0,l.jsx)(o.k,{p:3,px:4,mt:2,bg:"gray.100",color:ro,borderRadius:"base",children:(0,l.jsxs)(o.k,{align:"baseline",fontSize:"sm",children:[(0,l.jsx)(d.xu,{pr:2,children:(0,l.jsx)(x.G,{icon:ij.ILF,"aria-label":"user-icon",size:"sm"})}),(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"FNMh4I",components:{0:(0,l.jsx)(a.x,{as:"button",onClick:t,textDecoration:"underline",fontWeight:"600",color:"gray.800"})}})})]})})},sA=e=>{let{handleSharePanelOpen:t,dayCount:i}=e;return(0,l.jsxs)(id.b,{my:4,p:6,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",colorScheme:"gray",children:[(0,l.jsx)(d.Cd,{size:"30px",bg:"gray.500",children:(0,l.jsx)(x.G,{icon:ij.ImE,color:"white"})}),(0,l.jsx)(ic.C,{mt:4,mb:2,fontSize:"md",children:(0,l.jsx)(h.cC,{id:"2OzAI5"})}),i>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(iu.X,{maxWidth:"sm",children:(0,l.jsx)(h.cC,{id:"qQLmo7",values:{dayCount:i}})}),(0,l.jsx)(eh.z,{mt:4,onClick:t,children:(0,l.jsx)(h.cC,{id:"IXzWG0"})})]})]})},sT=e=>{var t,i,n,r,s,o;let{doc:c,onAnalyticsPanelClose:u}=e,x=(0,M.qr)(),m=x.getState(),p=(0,L.X9)(m),{user:g}=(0,eY.SE)(),{data:f,error:C,loading:b,refetch:y}=(0,v.IrH)({variables:{docId:c.id,userId:null==g?void 0:g.id},skip:!(null==g?void 0:g.id),pollInterval:9e5,notifyOnNetworkStatusChange:!0}),k=null!==(o=null==f?void 0:null===(i=f.docCardsStats)||void 0===i?void 0:null===(t=i.everyone)||void 0===t?void 0:t.length)&&void 0!==o?o:0,w=null==f?void 0:null===(n=f.docCardsStats)||void 0===n?void 0:n.cardCount,S=(0,j.useMemo)(()=>{var e;return(null==f?void 0:null===(e=f.docCardsStats)||void 0===e?void 0:e.everyone)||[]},[null==f?void 0:f.docCardsStats]),E=(0,j.useMemo)(()=>rf(S,"viewTimePercent"),[S]);if(!g)return null;let I=g.id===(null===(r=c.createdBy)||void 0===r?void 0:r.id),_=null===(s=c.editors)||void 0===s?void 0:s.some(e=>e.user.id===g.id),A={name:g.displayName,id:g.id,profileImg:g.profileImageUrl,email:g.email,isContributor:_,isCreator:I};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(nY.x,{children:[(0,l.jsx)(h.cC,{id:"ZlwDi6"}),(0,l.jsx)(a.x,{fontSize:"sm",fontWeight:"normal",letterSpacing:"normal",color:"gray.500",noOfLines:1,children:c.title||(0,l.jsx)(h.cC,{id:"wja8aL"})})]}),(0,l.jsx)(tc.o,{}),(0,l.jsx)(rn.i,{}),(0,l.jsx)(tu.f,{children:(0,l.jsxs)(d.xu,{children:[(0,l.jsx)(r2,{user:A}),void 0!==w&&(0,l.jsx)(rN,{description:(0,l.jsx)(h.cC,{id:"YJOrjl",values:{cardsViewed:k,totalCards:w}})}),b&&!C&&(0,l.jsx)(rz,{includeDescription:!0}),C&&(0,l.jsx)(rd,{error:C,refetch:y,px:0}),!C&&!b&&(0,l.jsx)(rT,{cards:p.tree,scaleToMax:!0,includeChildren:!0,left
1Label:(0,l.jsx)(h.cC,{id:"ml51m3"}),rightLabel:(0,l.jsx)(h.cC,{id:"8R7bfR"}),cardLookupTable:E,tooltipLabel:(0,l.jsx)(rP,{}),onAnalyticsPanelClose:u}),(0,l.jsxs)(id.b,{children:[(0,l.jsx)(ra.z,{}),(0,l.jsx)(h.cC,{id:"Znuvj3",values:{GAMMA_PROPER_NOUN:K.N6,GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})]})]})})]})},sO=e=>{let{doc:t,mode:i,isAnalyticsPanelOpen:n,onAnalyticsPanelClose:r,onSharePanelOpen:s}=e,a=(0,en.i)({base:"sm",md:"2xl",lg:"4xl"}),d=!!s&&"full"==i,c=(0,j.useCallback)(()=>{s&&(s(),r())},[s,r]);return(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(nK.u_,{onClose:r,isOpen:n,size:a,blockScrollOnMount:!1,children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{mx:2,minW:0,children:["full"===i?(0,l.jsx)(sE,{doc:t,handleSharePanelOpen:c,onAnalyticsPanelClose:r,canShare:d}):(0,l.jsx)(sT,{doc:t,onAnalyticsPanelClose:r}),(0,l.jsx)(rn.i,{my:4}),(0,l.jsx)(tx.m,{children:(0,l.jsxs)(o.k,{justifyContent:d?"space-between":"flex-end",flex:1,children:[d&&(0,l.jsx)(eh.z,{leftIcon:(0,l.jsx)(x.G,{icon:u.zBy}),variant:"ghost",onClick:c,children:(0,l.jsx)(h.cC,{id:"IXzWG0"})}),(0,l.jsx)(eh.z,{variant:"solid",onClick:r,children:(0,l.jsx)(h.cC,{id:"DPfwMq"})})]})})]})]})})},sP=e=>{let{doc:t}=e,i=(0,ez.z$)(),{isOpen:n,onClose:r,onOpen:s}=(0,tL.M)({id:"analyticsPanelDisclosure"}),o=(0,j.useCallback)(()=>{null==i||i.track(ez.AA.DOC_ANALYTICS_VIEWED,{docId:null==t?void 0:t.id,source:"toolbar_doc_menu",type:"personal"}),s()},[i,null==t?void 0:t.id,s]);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.Ma4,fixedWidth:!0}),onClick:o,children:(0,l.jsx)(h.cC,{id:"ZlwDi6"})}),t&&n&&(0,l.jsx)(sO,{doc:t,isAnalyticsPanelOpen:n,onAnalyticsPanelClose:r,mode:"personal"})]})};var sD=i(82554),sR=i(99793),sG=i(12985);let sz=e=>{let{label:t,initialValue:n="",updateValue:r,helperText:s,language:o,...a}
1=e,[c,u]=(0,j.useState)(n),[x,h]=(0,j.useState)(null),m=(0,tr.Kt)(r,100),[p,g]=(0,j.useState)();(0,j.useEffect)(()=>{"css"===o?Promise.all([i.e(8917),i.e(7120),i.e(6214)]).then(i.bind(i,96214)).then(e=>{g(e.css())}):"html"===o&&Promise.all([i.e(8917),i.e(7120),i.e(6214),i.e(4100),i.e(2163)]).then(i.bind(i,22163)).then(e=>{g(e.html())})},[o]),(0,tr.vm)(()=>{h(null),m(c)},[c,m],[c]);let f=[p].filter(Boolean);return(0,l.jsxs)(i1.NI,{isInvalid:!!x,children:[(0,l.jsx)(i2.l,{children:t}),x&&(0,l.jsx)(sR.J1,{children:x}),s&&(0,l.jsx)(i1.Q6,{children:s}),(0,l.jsx)(d.xu,{border:"1px solid",borderColor:"gray.200",fontSize:"md",position:"relative",children:(0,l.jsx)(j.Suspense,{fallback:(0,l.jsx)("span",{}),children:(0,l.jsx)(sG.B,{value:c,extensions:f,onChange:u,...a})})})]})};var sN=i(61840);let sM=(0,j.memo)(e=>{let{isOpen:t,onClose:i,editor:n}=e,r=(0,sN.A)(n),{bodyStart:s}=(0,M.CG)(L.$p),o=(0,j.useCallback)(e=>{null==n||n.commands.updateNestedAttributesAtPos(0,{customCode:{bodyStart:e}})},[n]);return(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(to.d,{returnFocusOnClose:!1,isOpen:t,placement:"right",onClose:i,size:"lg",children:[(0,l.jsx)(ta.Z,{background:"none"}),(0,l.jsxs)(td.s,{onKeyDown:r,"data-testid":"custom-code-drawer",motionProps:{variants:{enter:{x:"0%",transition:{duration:.2}},exit:{x:"100%",transition:{duration:.1}}}},children:[(0,l.jsx)(tc.o,{}),(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"E16GGw"})}),(0,l.jsx)(tu.f,{overflowX:"hidden",children:(0,l.jsx)(sz,{label:m.ag._({id:"fC5kYg"}),helperText:m.ag._({id:"0AZNtw"}),initialValue:s,updateValue:o,language:"html",height:"600px"})}),(0,l.jsx)(tx.m,{children:(0,l.jsx)(eh.z,{w:"100%",variant:"solid",onClick:i,children:(0,l.jsx)(h.cC,{id:"DPfwMq"})})})]})]})})});sM.displayName="CustomCodeDrawer";let sL=e=>{let{editor:t}=e,{isOpen:i,onOpen:n,onClose:r}=(0,tL.M)({id:"codeEditor"});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.dT$,fixedWidth:!0}),onClick:n,children:(0,l.jsxs)(ex.U,{children:[(0,l.jsx)(h.cC,{id:"cnlGIm"}),(0,l.jsx)(nN.L,{}),(0,l.jsx)(sD.C,{colorScheme:"green",ml:2,children:(0,l.jsx)(h.cC,{id:"YBt9YP"})})]})}),(0,l.jsx)(sM,{editor:t,isOpen:i,onClose:r})]})},sF=e=>{let{doc:t}=e,[i]=(0,v.LT4)(),[n]=(0,v.iX9)(),r=(0,j.useCallback)(e=>()=>{if(!t.id)return;let r={id:t.id};e?i({variables:r,optimisticResponse:{archiveDoc:{...r,archived:e,__typename:"Doc"}}}):n({variables:r,optimisticResponse:{unarchiveDoc:{...r,archived:e,__typename:"Doc"}}})},[i,t.id,n]);return t.archived?(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.ZeM,fixedWidth:!0}),onClick:r(!1),children:(0,l.jsx)(h.cC,{id:"yKu/3Y"})}):(0,l.jsx)(nH.s,{"data-testid":"doc-menu-trash-button",color:"red.500",icon:(0,l.jsx)(x.G,{icon:u.XAH,fixedWidth:!0}),onClick:r(!0),children:(0,l.jsx)(h.cC,{id:"NOLglc",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})})};var sU=i(82282),sW=i(31807),sH=i(20678);let sV=e=>{var t,i;let{doc:n}=e,r=(null==n?void 0:n.createdTime)&&(0,sU.Z)((0,sW.Z)(n.createdTime),"PPP"),s=(0,sH.$)(null==n?void 0:n.title);return(0,l.jsxs)(d.xu,{px:4,py:2,maxW:"300px",children:[(0,l.jsx)(a.x,{noOfLines:6,children:s}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,l.jsx)(h.cC,{id:"jlWdji",values:{createdTime:r}})}),(0,l.jsx)(ep.kH,{label:null==n?void 0:null===(t=n.createdBy)||void 0===t?void 0:t.email,children:(0,l.jsx)(a.x,{display:"inline-block",fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,l.jsx)(h.cC,{id:"t490IT",values:{0:null==n?void 0:null===(i=n.createdBy)||void 0===i?void 0:i.displayName}})})})]})},sB=e=>{let{doc:t,editor:i}=e,n=(0,nE.e)(),r=(0,j.useCallback)(()=>{if(!i)return;let e=i.getJSON();n({docId:t.id,initialContent:e,source:"editor_toolbar_doc_menu_duplicate",newWindow:!(0,ef.Q5)()})},[t.id,n,i]);return(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.kZ_,fixedWidth:!0}),onClick:r,children:(0,l.jsx)(h.cC,{id:"0Fcoqv",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})})})};var sK=i(18412);let sq=()=>(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.kwI,fixedWidth:!0}),onClick:()=>{sK.T.emit("openSharePanel",{view:"export"})},children:(0,l.jsx)(h.cC,{id:"U8WPSi"})}),sY=e=>{let{site:t,path:i}=e,n=(0,eA.AR)({site:t,path:i});return n?(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"kcKqQj"}),children:(0,l.jsx)(I.h,{ml:-1,href:n,as:ii(),target:"_blank","aria-label":m.ag._({i
1d:"WklWxF"}),variant:"ghost",color:"gray.500",size:"xs",icon:(0,l.jsx)(x.G,{icon:u.ZE5})})}):null},sZ=e=>{var t,i;let{doc:n,site:r,showCreatedInfo:s}=e,o=(0,sH.$)(null==n?void 0:n.title),c=null===(t=r.routes)||void 0===t?void 0:t.find(e=>e.docId===n.id),u=(0,eA.jl)(n,r);return(0,l.jsxs)(d.xu,{px:4,pb:2,maxW:"300px",children:[(0,l.jsxs)(ex.U,{align:"start",children:[(0,l.jsx)(a.x,{noOfLines:2,children:o}),u&&(0,l.jsx)(sY,{site:r,path:null==c?void 0:c.path})]}),c&&(0,l.jsx)(sX,{path:c.path}),s&&"createdTime"in n&&(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",noOfLines:1,mt:2,children:(0,l.jsx)(h.cC,{id:"oJFw5Q",values:{0:(0,nM.Dw)(n.createdTime)}})}),"createdBy"in n&&s&&(0,l.jsx)(a.x,{display:"inline-block",fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,l.jsx)(h.cC,{id:"t490IT",values:{0:null==n?void 0:null===(i=n.createdBy)||void 0===i?void 0:i.displayName}})})]})},sX=e=>{let{path:t}=e;return"/"===t?(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"wFCbbC"})}):(0,l.jsx)(a.x,{fontFamily:"mono",fontSize:"sm",color:"gray.500",children:t})};var sJ=i(24772),sQ=i(36371),s$=i(73582),s0=i(2969),s1=i(3181),s2=i(13272),s5=i(41098),s4=i(82729),s3=i(39402),s9=i(7344),s6=i(41004),s7=i(63367);let s8=(0,j.forwardRef)((e,t)=>{var i;let{children:n,size:r="md",disabled:s=!1,tooltip:o,...a}=e,d=(0,s9.X)(),c=d.value===a.value,{getCheckboxProps:u,getInputProps:x}=(0,s7.x)({...a,isChecked:c,onChange:d.onChange,name:null!==(i=d.name)&&void 0!==i?i:a.name}),{...h}=u(),m=x(),p=(0,l.jsxs)(eh.z,{boxShadow:"none",bg:"transparent",as:"label",borderColor:"transparent",borderX:"none",size:r,disabled:s,style:{marginLeft:0,marginInlineStart:0},_hover:{bg:s?"transparent":"trueblue.50",cursor:s?"default":"pointer"},_first:{borderTopLeftRadius:"md",borderBottomLeftRadius:"md"},_last:{borderTopRightRadius:"md",borderBottomRightRadius:"md"},_checked:{bg:"transparent",color:"trueblue.500"},radioGroup:"orientation",...h,ref:t,children:[(0,l.jsx)("input",{...m,disabled:s,hidden:!0}),n]});return o?(0,l.jsx)(ep.kH,{...o,children:p}):p}),le=e=>{let{options:t,onChange:i,size:n,disabled:r=!1,value:s,...o}=e,a=(0,j.useRef)({}
1),[c,u]=(0,j.useState)({left:0,top:0,width:0,height:0});return(0,j.useEffect)(()=>{var e;let t=s?null===(e=a.current[s])||void 0===e?void 0:e.current:void 0;if(!t){u({left:c.left+c.width/2,top:c.top+c.height/2,width:0,height:0});return}u({left:t.offsetLeft,top:t.offsetTop,width:t.offsetWidth,height:t.offsetHeight})},[s,n]),(0,l.jsxs)(s9.E,{bg:"gray.200",pos:"relative",p:.5,borderRadius:"md",onChange:function(e){console.log(e),i(e)},value:s,boxSizing:"border-box",...o,children:[(0,l.jsx)(d.xu,{as:s6.E.div,pos:"absolute",zIndex:50,bg:r?"gray.100":"gradient.light",height:"100%",borderRadius:"md",m:.5,animate:{left:"".concat(c.left,"px"),top:"".concat(c.top,"px"),width:"".concat(c.width,"px"),height:"".concat(c.height,"px")}}),(0,l.jsx)(ex.U,{zIndex:90,pos:"relative",children:t.map(e=>{var t;return(0,l.jsx)(s8,{value:e.value,ref:(t=e.value,a.current[t]||(a.current[t]={current:null}),a.current[t]),size:n,disabled:r,tooltip:e.tooltip,children:e.component},e.value)})})]})};var lt=i(4170),li=i(15539);let ln=e=>{let{updateDocSetting:t,editor:i}=e,{animationsEnabled:n,defaultFullBleed:r,defaultContentWidth:s,presentBackdrop:o,cardDimensions:d}=(0,M.CG)(L.US),c=(0,li.l)(d),p=(0,e7.ye)("editorAnimationsEnabled"),[g,f]=(0,j.useState)("fluid"),[v,C]=(0,j.useState)(c.orientation),b=(0,li.l)(g),y=p||void 0!==n;return(0,j.useEffect)(()=>{if(d&&v&&c.orientation&&c.orientation!==v){let e=c.counterOrientation;t("cardDimensions",e)}},[d,v]),(0,j.useEffect)(()=>{if(d){if(!c.hide){f(d);return}f(c.counterOrientation||"fluid")}},[d]),(0,l.jsxs)(tT.K,{spacing:5,mt:4,divider:(0,l.jsx)(rn.i,{}),children:[(0,l.jsx)(lr,{title:m.ag._({id:"jBvtuq"}),description:m.ag._({id:"Q3Qdcd"}),icon:u.qnl,control:(0,l.jsxs)(ex.U,{children:[(0,l.jsxs)(tJ.v,{isLazy:!0,children:[(0,l.jsx)(tQ.j,{minW:36,textAlign:"left",as:eh.z,size:"sm",variant:"plain",leftIcon:c.icon?(0,l.jsx)(x.G,{icon:c.icon,fixedWidth:!0}):void 0,rightIcon:(0,l.jsx)(x.G,{icon:ij.ptq}),children:b.label()}),(0,l.jsx)(t$.q,{maxW:"400px",children:(0,l.jsx)(t0._,{value:g||"fluid",type:"radio",onChange:e=>{t("cardDimensions",e)},children:Object.entries(li.b).map(e=>{let[t,{label:i,description:n,hide:r}]=e;return r?null:(0,l.jsxs)(t1.i,{value:t,children:[(0,l.jsxs)(a.x,{children:[i(),"fluid"===t&&(0,l.jsxs)(l.Fragment,{children:[" ",(0,l.jsx)(sD.C,{colorScheme:"gray",ml:1,children:(0,l.jsx)(h.cC,{id:"ovBPCi"})})]})]}),(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",children:n()})]},t)})})})]}),c.orientation&&(0,l.jsx)(le,{size:"sm",name:"orientation",disabled:!c.orientation,value:c.orientation,onChange:e=>{c.counterOrientation&&C(e)},options:[{value:s3.L9.landscape,component:(0,l.jsx)(x.G,{icon:u.r9b}),tooltip:{label:m.ag._({id:"XxIeKn"}),placement:"top"}},{value:s3.L9.portrait,component:(0,l.jsx)(x.G,{icon:u.j8N}),tooltip:{label:m.ag._({id:"3bV9gD"}),placement:"top"}}]})]})}),(0,l.jsx)(lr,{title:m.ag._({id:"lklIf1"}),description:m.ag._({id:"aJ+ISV"}),icon:u.dH7,value:"lg"===s,onChange:e=>{t("defaultContentWidth",e?"lg":void 0),i.commands.resetCardSettings({container:{width:void 0}})}}),(0,l.jsx)(lr,{title:m.ag._({id:"lsVq2Z"}),description:m.ag._({id:"u/0NJZ"}),icon:u.r9b,value:"full"===r,onChange:e=>{t("defaultFullBleed",e?"full":void 0),i.commands.resetCardSettings({cardSize:"default"})}}),(0,l.jsx)(lr,{title:m.ag._({id:"7VfbQM"}),description:m.ag._({id:"XZHPlI"}),icon:u.UHQ,value:o,onChange:e=>t("presentBackdrop",e)}),y&&(0,l.jsx)(lr,{title:m.ag._({id:"HgWdP3"}),description:m.ag._({id:"XsKE1m"}),icon:u.kq2,value:(0,lt.C)({animationsEnabled:n}),onChange:e=>{t("animationsEnabled",e)}}),(0,l.jsxs)(tT.K,{children:[(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.600",children:(0,l.jsx)(h.cC,{id:"ymPKi7"})}),(0,l.jsxs)(ex.U,{alignItems:"flex-start",spacing:"4",children:[(0,l.jsx)(ll,{label:m.ag._({id:"wl99H6"}),cardDimensions:c,isWide:"lg"===s,showBackdrop:"full"!==r,scaleCardUp:!1}),(0,l.jsx)(ll,{label:m.ag._({id:"GWjDlt"}),cardDimensions:c,isWide:"lg"===s,showBackdrop:o&&"full"!==r,scaleCardUp:!o||"full"===r})]})]})]})},lr=e=>{let{title:t,description:i,icon:n,children:r,helpDescription:s,value:o,onChange:d,control:c,direction:u="row"}=e;return(0,l.jsxs)(tT.K,{alignItems:"flex-start",spacing:2,direction:u,children:[n&&(0,l.jsx)(a.x,{fontSize:"lg",width:8,maxW:8,children:(0,l.jsx)(x.G,{icon:n,fixedWidth:!0})}),(0,l.jsxs)(tT.K,{spacing:4,flex:1,children:[(0,l.jsxs)(tT.K,{spacing:1,children:[(0,l.jsxs)(eX.X,{size:"sm",fontWeight:"semibold",children:[t," ",s?(0,l.jsx)(ep.Yq,{label:s,ml:1}):null]}),(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.600",children:i}),c]}),r]}),d&&(0,l.jsx)(s5.r,{isChecked:o,onChange:e=>d(e.target.checked)})]})},ls=e=>{let{hideExtraLines:t}=e;return(0,l.jsxs)(tT.K,{w:"100%",py:2,px:2.5,children:[(0,l.jsx)(d.xu,{w:20,h:1.5,bg:"gray.200"}),(0,l.jsxs)(ex.U,{flex:"1",alignItems:"flex-start",children:[(0,l.jsx)(s4.o,{ratio:4/3,color:"gray.600",w:12,bg:"gray.200",children:(0,l.jsx)(d.xu,{fontSize:"lg",children:(0,l.jsx)(x.G,{icon:u.VmB})})}),(0,l.jsxs)(tT.K,{flex:"1",spacing:"1",children:[(0,l.jsx)(d.xu,{h:1,bg:"gray.200"}),(0,l.jsx)(d.xu,{h:1,bg:"gray.200"}),(0,l.jsx)(d.xu,{h:1,bg:"gray.200"}),(0,l.jsx)(d.xu,{w:t?"80%":"100%",h:1,bg:"gray.200"}),!t&&(0,l.jsx)(d.xu,{w:"80%",h:1,bg:"gray.200"})]})]})]})},ll=e=>{let{cardDimensions:t,showBackdrop:i,isWide:n,label:r,scaleCardUp:s}=e,c={boxShadow:"".concat(i?"sm":""),w:"".concat(n?"85%":"65%"),mx:"auto",borderRadius:"sm",bg:"white",transform:"".concat(s?"scale(1.15)":"none")};return(0,l.jsxs)(tT.K,{flex:"1",alignItems:"center",sx:{"*":{transition:"all 0.2s ease"}},spacing:1.5,maxW:"50%",mx:"auto",children:[(0,l.jsx)(o.k,{bg:i?"gray.200":"white",borderWidth:"1px",borderColor:"gray.200",width:"100%",minH:32,borderRadius:"sm",alignItems:"center",py:2,overflow:"hidden",children:t.aspectRatio?(0,l.jsx)(s4.o,{...c,ratio:t.aspectRatio,children:(0,l.jsx)(d.xu,{children:(0,l.jsx)(ls,{hideExtraLines:n})})}):(0,l.jsx)(tT.K,{...c,children:(0,l.jsx)(ls,{hideExtraLines:n})})}),(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.700",children:r})]})};var lo=i(64743),la=i(55891);let ld=e=>{let{editor:t}=e,i=(0,M.CG)(L.Pu),n=(0,M.CG)(L.XV),r=(0,j.useCallback)(e=>{null==t||t.commands.updateNestedAttributesAtPos(0,e)},[t]);return(0,l.jsx)(la.o,{editor:t,background:n,updateNestedAttributes:r,defaultMessage:(0,l.jsxs)(id.b,{children:[(0,l.jsx)(ra.z,{}),(0,l.jsx)(h.cC,{id:"dyXYfJ"})]}),isDark:(0,tf.wj)(i),isValidSource:lo.Rr})};var lc=i(85573);let lu=e=>{let{length:t,idealLength:i,maxLength:n}=e;return(0,l.jsxs)(a.x,{fontSize:"xs",color:t>=n?"red.400":"gray.500",children:[t>=n&&(0,l.jsx)(x.G,{icon:ij.e7M})," ",t,"/",i]})};var lx=i(66625),lh=i(25566),lm=i(60536),lp=i(82476),lg=i(92768),lj=i(37733),lf=i(56920),lv=i(55274);let lC=(e,t)=>{var i;return null==e?void 0:null===(i=e.routes.find(e=>e.docId===t))||void 0===i?void 0:i.path},lb=()=>
1{let e=(0,iR.p)(),[t,i]=(0,j.useState)(!1),{openPageSetup:n}=(0,lv.AA)(),r=(0,ib._O)(),s=(0,M.CG)(iU.yx),o=(0,M.CG)(eE.lH),[c,{loading:u}]=(0,v.qbt)(),x=lC(o,null==s?void 0:s.id),[m,p]=(0,j.useState)(()=>(0,eA.es)(x||"")),[g,f]=(0,j.useState)(()=>(0,eA.es)(x||"")),C=(0,eA.gT)({routes:(null==o?void 0:o.routes)||[],path:(0,eA.fJ)(m),docId:null==s?void 0:s.id}),b=!!C,y=g!==m&&!b,k=(0,j.useCallback)(()=>{p(g)},[g]),w=(0,j.useCallback)(()=>{if(!y)return;if(!(null==o?void 0:o.id)||!(null==s?void 0:s.id)){console.error("Missing site or doc");return}let t=(0,eA.Is)(m);c({variables:{input:{siteId:o.id,docId:s.id,path:t}},refetchQueries:["GetSite"]}).then(()=>{f((0,eA.es)(t)),p((0,eA.es)(t)),i(!0)}).catch(t=>{e({status:"error",title:(0,l.jsx)(h.cC,{id:"dl5vwx"}),description:t.message}),console.error("[UrlSlugForm] Error setting route",t.message)})},[y,null==s?void 0:s.id,m,c,null==o?void 0:o.id,e]);return r?(0,l.jsxs)(tT.K,{pb:6,children:[(0,l.jsx)(tT.K,{direction:"row",children:(0,l.jsxs)(a.x,{children:[(0,l.jsx)(h.cC,{id:"dq8+qI"})," "]})}),(0,l.jsx)(nN.L,{}),(0,l.jsx)(tT.K,{spacing:2,children:(0,l.jsx)(ex.U,{spacing:1,children:(0,l.jsxs)(i1.NI,{as:"fieldset",isInvalid:b,children:[(0,l.jsx)(ex.U,{children:(0,l.jsxs)(ip.B,{children:[(0,l.jsx)(lg.Ui,{children:"/"}),(0,l.jsx)(lc.I,{isDisabled:u,bg:"white",flex:2,value:m,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),w())},onChange:e=>{let t=(0,lf.IR)(e.currentTarget.value);p(t)}}),(0,l.jsx)(lj.R,{in:y,unmountOnExit:!0,children:(0,l.jsx)(d.xu,{ml:2,children:(0,l.jsxs)(em.h,{w:"100%",children:[(0,l.jsx)(eh.z,{variant:"solid",isLoading:u,isDisabled:b,onClick:w,children:(0,l.jsx)(h.cC,{id:"tfDRzk"})}),(0,l.jsx)(eh.z,{onClick:k,children:(0,l.jsx)(h.cC,{id:"dEgA5A"})})]})})})]})}),C?(0,l.jsx)(sR.J1,{justifyContent:"flex-end",alignItems:"flex-start",children:(0,l.jsx)(a.x,{fontSize:"xs",children:(0,l.jsx)(h.cC,{id:"DQaTdC",components:{0:(0,l.jsx)(nS.r,{textDecoration:"underline",onClick:()=>n(C.docId,"preview")})}})})}):(0,l.jsxs)(tT.K,{spacing:2,children:[(0,l.jsx)(i1.Q6,{fontSize:"sm",children:(0,l.jsx)(h.cC,{id:"ZMlbHK"})}),t&&(0,l.jsxs)(id.b,{status:"warning",variant:"left-accent",fontSize:"sm",children:[(0,l.jsx)(ra.z,{}),(0,l.jsx)(iu.X,{children:(0,l.jsx)(h.cC,{id:"ZyBxCy"})})]})]})]})})})]}):(0,l.jsx)(l.Fragment,{})},ly=e=>{let{updateDocSetting:t}=e,{metaDescription:i}=(0,M.CG)(L.US),n=(0,M.CG)(L.yx),r=(0,M.CG)((0,lx.cn)(null==n?void 0:n.id)),s=(0,M.CG)(lx.$4),[o,c]=(0,j.useState)(()=>(null==n?void 0:n.title)||""),[u,x]=(0,j.useState)(()=>i||""),p=n&&!!n.site&&(0,eA.Vr)(n.site),[g]=(0,v.D1_)(),f=(0,j.useCallback)(e=>{n&&g({variables:{id:n.id,title:e}})},[n,g]),C=(0,tr.Kt)(f,300),b=(0,j.useCallback)(e=>{c(e.target.value.substring(0,lp.S8)),C(e.target.value.substring(0,lp.S8))},[C]),k=(0,j.useCallback)(e=>{t("metaDescription",e)},[t]),w=(0,tr.Kt)(k,300),S=(0,M.CG)(lx.NN),E=null==S?void 0:S.previewUrl,I=(0,q.dU)(null==n?void 0:n.organization),_=(0,y.U)(o||r,I),A=(0,y.V)(u||s,I);return(0,l.jsxs)(tT.K,{spacing:4,children:[(0,l.jsxs)(i1.NI,{children:[(0,l.jsxs)(ex.U,{justifyContent:"center",children:[(0,l.jsx)(i2.l,{flex:"1",children:(0,l.jsx)(h.cC,{id:"MHrjPM"})}),(0,l.jsx)(lu,{length:o.length||0,idealLength:lp.si,maxLength:lp.S8})]}
1),(0,l.jsx)(lc.I,{value:o,placeholder:r||m.ag._({id:"bTzMt5"}),_placeholder:{opacity:1,color:"gray.500"},onKeyDown:e=>{"Enter"===e.key&&f(o)},onChange:b,"data-title-input":!0})]}),(null==n?void 0:n.site)&&(0,l.jsx)(lb,{}),(0,l.jsxs)(i1.NI,{children:[(0,l.jsxs)(ex.U,{justifyContent:"center",children:[(0,l.jsx)(i2.l,{flex:"1",children:(0,l.jsx)(h.cC,{id:"Nu4oKW"})}),(0,l.jsx)(lu,{length:u.length||0,idealLength:lp.cl,maxLength:lp.Us})]}),(0,l.jsx)(ig.g,{bg:"white",rows:4,value:u,placeholder:(null==s?void 0:s.trim())||m.ag._({id:"2VBqT4"}),onChange:e=>{x(e.target.value.substring(0,lp.Us)),w(e.target.value.substring(0,lp.Us))}})]}),(0,l.jsxs)(d.xu,{p:4,pt:3,bg:"gray.100",borderRadius:"md",children:[(0,l.jsxs)(tT.K,{spacing:2,mb:4,children:[(0,l.jsx)(a.x,{size:"sm",children:(0,l.jsx)(h.cC,{id:"h8sMnd"})}),(0,l.jsx)(lk,{title:_,description:A,screenshotUrl:E})]}),p&&(0,l.jsxs)(tT.K,{spacing:2,children:[(0,l.jsx)(rn.i,{}),(0,l.jsx)(a.x,{size:"sm",children:(0,l.jsx)(h.cC,{id:"d3xOlk"})}),(0,l.jsx)(lw,{title:_,description:A,screenshotUrl:E}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"Ubf8D8"})})]})]}),(0,l.jsx)(lm.V,{label:(0,l.jsx)(h.cC,{id:"SDyz5I"}),segmentEvent:lh.AA.GAMMA_PRO_UPSELL_PAGE_SETUP_REMOVE_WATERMARK,doc:n})]})},lk=e=>{let{title:t,description:i,screenshotUrl:n}=e;return(0,l.jsxs)(d.xu,{cursor:"not-allowed",bg:"white",border:"1px solid",borderColor:"gray.200",borderRadius:"md",overflow:"hidden",children:[(0,l.jsx)(s4.o,{ratio:1200/630,bg:"gray.300",borderBottom:"1px solid",borderColor:"gray.200",children:(0,l.jsx)(d.xu,{bgColor:"gray.200",bgImage:"url(".concat(n,")"),backgroundSize:"cover",position:"relative"})}),(0,l.jsxs)(tT.K,{px:4,py:3,spacing:1,children:[(0,l.jsx)(a.x,{fontSize:"md",fontWeight:"bold",noOfLines:2,children:t}),(0,l.jsx)(a.x,{fontSize:"xs",noOfLines:2,children:i})]})]})},lw=e=>{let{title:t,description:i}=e;return(0,l.jsxs)(tT.K,{cursor:"not-allowed",bg:"white",border:"1px solid",borderColor:"gray.200",borderRadius:"md",overflow:"hidden",px:4,py:3,spacing:1,pos:"relative",children:[(0,l.jsx)(a.x,{color:"blue.600",fontSize:"lg",lineHeight:1.3,noOfLines:2,children:t}),(0,l.jsx)(a.x,{color:"gray.700",fontSize:"sm",noOfLines:3,children:i})]})},lS=["cards","background","preview"],lE=e=>{let{editor:t}=e,i=(0,M.CG)(L.ke),{isOpen:n,onClose:r,onOpen:s}=(0,tL.M)({id:"pageSetupDisclosure"}),[o,a]=(0,j.useState)(0);(0,j.useEffect)(()=>{let e=e=>{let t=lS.indexOf(e);a(t),s()},t=sK.T.on("openPageSetup",e),i=tW.pw.on(tW.TI.OPEN_PAGE_SETUP,e);return()=>{t(),i()}},[s,r]);let c=(0,sN.A)(t),m=(0,j.useCallback)((e,i)=>{null==t||t.commands.updateNestedAttributesAtPos(0,{settings:{[e]:i}})},[t]),p=(0,sJ.S)({base:"calc(100% - 1rem)",lg:"auto"}),g=(0,sJ.S)({base:"bottom",lg:"right"})||"right";return t?(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(to.d,{returnFocusOnClose:!1,isOpen:n,placement:g,onClose:r,size:"md",blockScrollOnMount:!1,children:[(0,l.jsx)(ta.Z,{background:{base:void 0,lg:"none"}}),(0,l.jsxs)(td.s,{"data-testid":"page-setup-drawer",onKeyDown:c,h:p,borderTopRadius:{base:"xl",lg:"none"},transform:"none !important",children:[(0,l.jsx)(tc.o,{}),(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"fvaOtb"})}),(0,l.jsx)(tu.f,{overflowX:"hidden",children:(0,l.jsxs)(sQ.m,{variant:"soft-rounded",size:"sm",isFitted:!0,isLazy:!0,index:o,onChange:a,children:[(0,l.jsxs)(s$.t,{children:[(0,l.jsxs)(s0.O,{children:[(0,l.jsx)(d.xu,{mr:2,children:(0,l.jsx)(x.G,{icon:u.s2})}),(0,l.jsx)(h.cC,{id:"Ccpbzh"})]}),(0,l.jsxs)(s0.O,{children:[(0,l.jsx)(d.xu,{mr:2,children:(0,l.jsx)(x.G,{icon:u.UHQ})}),(0,l.jsx)(h.cC,{id:"GtJbUa"})]}),(0,l.jsxs)(s0.O,{children:[(0,l.jsx)(d.xu,{mr:2,children:(0,l.jsx)(x.G,{icon:u.g4A})}),(0,l.jsx)(h.cC,{id:"rdUucN"})]})]}),(0,l.jsxs)(s1.n,{children:[(0,l.jsx)(s2.x,{p:2,mt:4,children:(0,l.jsx)(ln,{editor:t,updateDocSetting:m},i)}),(0,l.jsx)(s2.x,{p:2,mt:4,children:(0,l.jsx)(ld,{editor:t,updateDocSetting:m},i)}),(0,l.jsx)(s2.x,{p:2,mt:4,children:(0,l.jsx)(ly,{editor:t,updateDocSetting:m},i)})]})]})})]})]})}):null},lI=e=>{let{editor:t,withDrawer:i=!1,onClick:n,icon:r,label:s}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nH.s,{icon:r||(0,l.jsx)(x.G,{icon:u.gr5,fixedWidth:!0}),onClick:n||(()=>{sK.T.emit("openPageSetup","cards")}),children:s||(0,l.jsx)(h.cC,{id:"Kx2GmY"})}),i&&(0,l.jsx)(lE,{editor:t})]})},l_=e=>{let{site:t}=e,i=(0,sU.Z)((0,sW.Z)(t.createdTime),"PPP");return(0,l.jsxs)(d.xu,{px:4,pb:2,maxW:"300px",children:[(0,l.jsx)(a.x,{noOfLines:6,children:t.name}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,l.jsx)(h.cC,{id:"jlWdji",values:{createdTime:i}})})]})},lA=e=>{let{onClose:t,domainName:i,onDelete:n,isDeleting:r}=e;return(0,l.jsxs)(nK.u_,{isOpen:!0,onClose:t,trapFocus:!1,size:"xl",isCentered:!0,closeOnOverlayClick:!1,children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{children:[(0,l.jsx)(nY.x,{children:(0,l.jsx)(tT.K,{spacing:0,children:(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"T3exbL",values:{domainName:i}})})})}),(0,l.jsx)(tu.f,{children:(0,l.jsx)(tT.K,{spacing:4,children:(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"DkFGZj"})})})}),(0,l.jsx)(tx.m,{children:(0,l.jsxs)(em.h,{children:[(0,l.jsx)(eh.z,{isDisabled:r,variant:"ghost",colorScheme:"gray",onClick:t,children:(0,l.jsx)(h.cC,{id:"dEgA5A"})}),(0,l.jsx)(eh.z,{variant:"ghost",colorScheme:"red",isLoading:r,onClick:n,loadingText:m.ag._({i
1d:"EF2EU9"}),children:(0,l.jsx)(h.cC,{id:"cnGeoo"})})]})})]})]})};var lT=i(56453),lO=i(75397);let lP=e=>{let{isOpen:t,onClose:i,domain:n,siteId:r}=e,s=(0,iR.p)(),o=null==n?void 0:n.name,d=null==o?void 0:o.split(".")[0].split("-").slice(-1)[0],[c,u]=(0,j.useState)(null==o?void 0:o.split(".")[0].split("-").slice(0,-1).join("-")),x=null==o?void 0:o.split(".").slice(1).join("."),[p,{loading:g}]=(0,v.gVY)(),f=(0,j.useCallback)(()=>{p({variables:{input:{siteId:r,name:c}}}).then(()=>{s({title:(0,l.jsx)(h.cC,{id:"oMgC5V"}),description:(0,l.jsx)(h.cC,{id:"tIBLtD"}),duration:3e3,position:"top",isClosable:!1,status:"success"}),i()}).catch(e=>{s({title:(0,l.jsx)(h.cC,{id:"YoFYYT"}),description:(0,l.jsx)(h.cC,{id:"Wd0ucu"}),duration:3e3,position:"top",isClosable:!1,status:"error"}),console.error("[BuiltInDomainEditModal] Failed to change domain name:",e)})},[p,r,c,s,i]);return(0,l.jsxs)(nK.u_,{isOpen:t,onClose:i,size:"md",closeOnOverlayClick:!1,children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{children:[(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"zPTAcG"})}),(0,l.jsx)(tc.o,{}),(0,l.jsx)(tu.f,{children:(0,l.jsxs)(i1.NI,{children:[(0,l.jsxs)(ex.U,{children:[(0,l.jsx)(lc.I,{value:c,onKeyDown:e=>{"Enter"===e.key&&f()},onChange:e=>{let t=(0,lf.IR)(e.target.value);u(t)},placeholder:m.ag._({id:"dcSbw0"})}),(0,l.jsxs)(i2.l,{whiteSpace:"nowrap",children:["-",d,".",x]})]}),(0,l.jsx)(i1.Q6,{lineHeight:"normal",children:(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"8lTjum"})})})]})}),(0,l.jsxs)(tx.m,{children:[(0,l.jsx)(eh.z,{onClick:i,mr:3,variant:"ghost",children:(0,l.jsx)(h.cC,{id:"dEgA5A"})}),(0,l.jsx)(eh.z,{variant:"solid",onClick:f,isLoading:g,isDisabled:c.length<3,children:(0,l.jsx)(h.cC,{id:"tfDRzk"})})]})]})]})},lD={pending:{tooltip:(0,l.jsx)(h.cC,{id:"/BjVEU"}),badgeText:(0,l.jsx)(h.cC,{id:"bl9677"}),badgeColorScheme:"yellow"},failed:{tooltip:(0,l.jsx)(h.cC,{id:"7Bj3x9"}),badgeText:(0,l.jsx)(h.cC,{id:"7Bj3x9"}),badgeColorScheme:"red"}},lR=e=>{let{status:t,onClick:i}=e;if("verified"===t)return null;let{tooltip:n,badgeText:r,badgeColorScheme:s}=lD[t];return(0,l.jsx)(ep.kH,{label:n,placement:"top",children:(0,l.jsx)(sD.C,{display:"flex",justifyContent:"center",colorScheme:s,cursor:i?"pointer":"default",onClick:i||void 0,children:r})})},lG=e=>{let{domain:t,onDomainSetupClick:i,path:n,onDeleteClick:r,numDomains:s,siteId:o}=e,d=(0,eA.mn)({domain:t,path:n}),c=(0,iR.p)(),p=!t.builtin,g=t.builtin,f=p&&("verified"!==t.status||"verified"===t.status&&s>1),[C]=(0,v.NEQ)(),b=(0,j.useCallback)(async()=>{await C({variables:{id:t.id}}),c({title:(0,l.jsx)(h.cC,{id:"LIAJwx"}),status:"success",duration:3e3,position:"top",isClosable:!0})},[C,t.id,c]),{isOpen:y,onOpen:k,onClose:S}=(0,w.q)({id:"edit-domain-modal"});return(0,l.jsxs)(lT.Z,{variant:"outline",children:[(0,l.jsx)(lO.e,{children:(0,l.jsxs)(ex.U,{children:["verified"===t.status?(0,l.jsx)(ep.kH,{label:d,placement:"top",children:(0,l.jsx)(eh.z,{as:nS.r,variant:"link",href:d,target:"_blank",rightIcon:(0,l.jsx)(x.G,{icon:ij.wlW,size:"xs"}),children:t.name})}):(0,l.jsx)(a.x,{children:t.name}),(0,l.jsx)(nN.L,{}),(0,l.jsx)(lR,{status:t.status,onClick:"failed"===t.status?b:null}),(0,l.jsxs)(em.h,{children:[g&&(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"zPTAcG"}),placement:"top",children:(0,l.jsx)(I.h,{onClick:k,"aria-label":m.ag._({id:"zPTAcG"}),size:"sm",variant:"ghost",icon:(0,l.jsx)(x.G,{icon:u.Xcf})})}),p&&(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"UqSZMD"}),placement:"top",children:(0,l.jsx)(I.h,{onClick:()=>{i(t.name)},"aria-label":m.ag._({id:"UqSZMD"}),size:"sm",variant:"ghost",colorScheme:"blackAlpha",icon:(0,l.jsx)(x.G,{icon:u.DBf})})}),f&&(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"C2YqXi"}),placement:"top",children:(0,l.jsx)(I.h,{onClick:()=>{r(null==t?void 0:t.id)},"aria-label":m.ag._({id:"C2YqXi"}),size:"sm",variant:"ghost",colorScheme:"red",icon:(0,l.jsx)(x.G,{icon:u.Vui})})})]})]})}),(0,l.jsx)(lP,{isOpen:y,onClose:S,domain:t,siteId:o})]})},lz=e=>{let{isOpen:t,onClose:i,domainName:n,onTransferConfirm:r,onTransferCancel:s,domainToTransfer:o,isTransferring:d}=e,c=(0,j.useCallback)(()=>{s(),i()},[i,s]),u=(0,j.useCallback)(async()=>{r(),i()},[i,r]);return o?(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(nK.u_,{isOpen:t,onClose:c,size:"lg",children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{children:[(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"hqplvI"})}),(0,l.jsx)(tc.o,{}),(0,l.jsx)(tu.f,{children:(0,l.jsxs)(tT.K,{spacing:2,children:[(0,l.jsx)(a.x,{children:o.siteArchived?(0,l.jsx)(h.cC,{id:"SeHn75",values:{domainName:n,0:o.siteName}}):(0,l.jsx)(h.cC,{id:"tX38ij",values:{domainName:n,0:o.siteName}})}),(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"rKH6wM"})})]})}),(0,l.jsxs)(tx.m,{children:[(0,l.jsx)(eh.z,{variant:"ghost",mr:3,onClick:c,children:(0,l.jsx)(h.cC,{id:"yz7wBu"})}),(0,l.jsx)(eh.z,{isLoading:d,variant:"ghost",colorScheme:"red",onClick:u,children:(0,l.jsx)(h.cC,{id:"vTZxnA"})})]})]})]})}):(0,l.jsx)(l.Fragment,{})},lN=e=>{var t;let{site:i,path:n,onDomainSetupClick:r,onAddDomain:s,isAddingDomain:o,refetchSites:a}=e,d=(0,iR.p)(),{currentWorkspace:c}
1=(0,eY.SE)(),[u,x]=(0,j.useState)(),[p,g]=(0,j.useState)(),[f,C]=(0,j.useState)(""),{isOpen:b,onOpen:y,onClose:k}=(0,w.q)({id:"delete-domain-modal"}),{isOpen:S,onOpen:E,onClose:I}=(0,tL.M)({id:"transferDomainModal"}),[_,{loading:A}]=(0,v.KtP)({fetchPolicy:"network-only",nextFetchPolicy:"network-only"}),T=i.domains.find(e=>e.id===u),O=(0,eA.m6)(f)&&void 0===i.domains.find(e=>e.name===f),[P,{loading:D}]=(0,v.Yqv)(),[R,{loading:G}]=(0,v.dLz)(),[z,N]=(0,j.useState)(void 0),M=(0,j.useCallback)(async e=>{var t;let n=await _({variables:{name:e,workspaceId:null==c?void 0:c.id}}),r=null==n?void 0:null===(t=n.data)||void 0===t?void 0:t.domains,l=null==r?void 0:r[0];if(i&&l){g(l),E();return}s(e),g(void 0),C("")},[null==c?void 0:c.id,_,s,E,i]);(0,tr.vm)(()=>{u?N(null==T?void 0:T.name):N(void 0)},[u,null==T?void 0:T.name],[u]);let L=(0,j.useCallback)(()=>{k(),x(()=>void 0)},[k]),F=(0,j.useCallback)(async()=>{T&&(await P({variables:{id:u}}),await a(),d({title:(0,l.jsx)(h.cC,{id:"V4fbcv",values:{0:T.name}}),status:"success",duration:3e3,position:"top",isClosable:!0}),L())},[a,P,u,T,L,d]),U=(0,ib.Y)("custom_domains"),W=(0,eA.Zz)(i.domains),H=(0,j.useCallback)(()=>{g(void 0)},[]),V=(0,j.useCallback)(async()=>{p&&(await R({variables:{id:null==p?void 0:p.id,siteId:i.id},refetchQueries:["GetSite"]}),d({title:(0,l.jsx)(h.cC,{id:"dHhDGG",values:{0:p.name}}),position:"top",status:"success",duration:5e3}),C(""),g(void 0))},[p,i.id,d,R]);return(0,l.jsxs)(tT.K,{spacing:4,p:2,children:[(0,l.jsxs)(i1.NI,{children:[(0,l.jsx)(i2.l,{children:(0,l.jsx)(h.cC,{id:"AZ4xlc"})}),U&&(0,l.jsxs)(ex.U,{mb:2,children:[(0,l.jsx)(lc.I,{bg:"white",placeholder:(null==i?void 0:null===(t=i.domains)||void 0===t?void 0:t.length)?m.ag._({id:"B6e4xs"}):m.ag._({id:"1y9z1r"}),value:f,onChange:e=>C(e.target.value),onKeyDown:e=>{"Enter"===e.key&&O&&(e.preventDefault(),M(f))}}),(0,l.jsx)(tT.K,{children:(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"aUB5ST"}),placement:"top",shouldWrapChildren:!0,isDisabled:O,children:(0,l.jsx)(eh.z,{isDisabled:!O,variant:"plain",onClick:()=>{M(f)},isLoading:o||A,children:(0,l.jsx)(h.cC,{id:"EdEpYN"})})})})]})]}),W.map(e=>(0,l.jsx)(lG,{domain:e,onDomainSetupClick:r,path:n,onDeleteClick:e=>{x(e),y()},numDomains:i.domains.length||0,siteId:i.id},e.id)),!U&&(0,l.jsx)(rs.m,{segmentEvent:ez.AA.GAMMA_PRO_UPSELL_DOMAINS,title:(0,l.jsx)(h.cC,{id:"r3cvvP"}),description:(0,l.jsx)(h.cC,{id:"AhVuiC",values:{GAMMA_PROPER_NOUN:K.N6}})}),b&&(0,l.jsx)(lA,{onClose:L,onDelete:F,domainName:z,isDeleting:D}),(0,l.jsx)(lz,{isOpen:S,onClose:I,onTransferCancel:H,domainName:f,domainToTransfer:p,onTransferConfirm:V,isTransferring:G})]})};var lM=i(97010),lL=i(44438);let lF=async e=>{let t=await fetch("/api/domains/connectToken").then(e=>e.json()).then(e=>{if(!e.auth_token)throw Error("No auth token returned");return e.auth_token});if(!window.entri)throw Error("Entri not found");let{domain:i,dnsRecords:n}=(0,eA.Yd)(e),r={applicationId:"gamma",token:t,prefilledDomain:i,dnsRecords:n};return console.log("[launchEntri] Launching Entri with config",r),window.entri.showEntri(r),new Promise((e,t)=>{let i=n=>{console.log("onEntriClose: event",n),window.removeEventListener("onEntriClose",i),n.detail.success?e(n.detail):t(n.detail)};window.addEventListener("onEntriClose",i,!1)})},lU=e=>{let{isOpen:t,onClose:i,domainName:n,onDomainConfirmed:r}=e,[s,d]=(0,j.useState)("initial"),c=(0,j.useRef)(!1),[m,p]=(0,j.useState)(()=>void 0!==window.entri),[g,f]=(0,j.useState)(!1),v=(0,iR.p)();(0,tr.Gq)(lp.oc,{predicate:()=>void 0===window.entri,onload:()=>{p(!0),c.current=!0}});let{dnsRecords:C,isRootDomain:b,subdomain:y}=(0,j.useMemo)(()=>(0,eA.Yd)(n||""),[n]);return(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(nK.u_,{isOpen:t,onClose:i,size:"3xl",children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{children:[(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"xQMU8T",values:{domainName:n}})}),(0,l.jsx)(tc.o,{}),(0,l.jsxs)(tu.f,{children:["initial"===s&&(0,l.jsx)(lT.Z,{variant:"filled",children:(0,l.jsx)(lO.e,{children:(0,l.jsxs)(tT.K,{spacing:4,py:4,mx:"auto",children:[(0,l.jsxs)(tT.K,{spacing:2,children:[(0,l.jsxs)(tT.K,{spacing:1,children:[(0,l.jsx)(a.x,{textAlign:"center",fontSize:"2xl",children:(0,l.jsx)(x.G,{icon:u.g4A,size:"lg"})}),(0,l.jsx)(a.x,{fontWeight:"semibold",fontSize:"lg",textAlign:"center",children:(0,l.jsx)(h.cC,{id:"w5l5pM"})})]}),(0,l.jsx)(a.x,{textAlign:"center",maxW:"unset",children:(0,l.jsx)(h.cC,{id:"MhdvBQ"})})]}),(0,l.jsx)(o.k,{align:"center",justify:"center",w:"100%",children:(0,l.jsxs)(tT.K,{w:64,maxW:"100%",children:[(0,l.jsx)(eh.z,{size:"md",variant:"solid",isDisabled:!m,isLoading:g,onClick:()=>{n&&(f(!0),lF(n).then(e=>{console.log("[ENTRI] Successfully setup domain",e),v({title:(0,l.jsx)(h.cC,{id:"p8Oc6N"}),description:(0,l.jsx)(h.cC,{id:"HqV46b"}),status:"success",duration:3e3,isClosable:!0,position:"top"}),null==r||r(n)}).catch(e=>{v({title:(0,l.jsx)(h.cC,{id:"l/2jzv"}),description:e.message,status:"error",duration:3e3,isClosable:!0,position:"top"})}).finally(()=>{f(!1)}))},children:(0,l.jsx)(h.cC,{id:"qu+sXe"})}),(0,l.jsxs)(ex.U,{children:[(0,l.jsx)(rn.i,{}),(0,l.jsx)(a.x,{color:"gray.600",children:(0,l.jsx)(h.cC,{id:"BzEFor"})}),(0,l.jsx)(rn.i,{})]}),(0,l.jsx)(eh.z,{size:"md",variant:"plain",onClick:()=>{d("manualSetup")},children:(0,l.jsx)(h.cC,{id:"ANIrop"})})]})})]})})}),"manualSetup"===s&&(0,l.jsx)(lT.Z,{variant:"filled",children:(0,l.jsx)(lO.e,{children:(0,l.jsxs)(tT.K,{spacing:6,children:[(0,l.jsx)(a.x,{fontWeight:"semibold",fontSize:"lg",children:(0,l.jsx)(h.cC,{id:"L5N7HX"})}),(0,l.jsxs)(rH.i,{variant:"simple",children:[(0,l.jsx)(rL.h,{children:(0,l.jsxs)(rF.Tr,{children:[(0,l.jsx)(rU.Th,{children:(0,l.jsx)(h.cC,{id:"6YtxFj"})}),(0,l.jsx)(rU.Th,{children:(0,l.jsx)(h.cC,{id:"+zy2Nq"})}),(0,l.jsx)(rU.Th,{isNumeric:!0,children:(0,l.jsx)(h.cC,{id:"HKH+W+"})})]})}),(0,l.jsx)(rV.p,{children:(C||[]).map(e=>(0,l.jsxs)(rF.Tr,{children:[(0,l.jsx)(rB.Td,{fontFamily:"mono",children:e.host}),(0,l.jsx)(rB.Td,{fontFamily:"mono",children:e.type}),(0,l.jsx)(rB.Td,{isNumeric:!0,fontFamily:"mono",children:e.value})]},e.value))})]}),(0,l.jsxs)(id.b,{status:"info",colorScheme:"orange",children:[(0,l.jsx)(ra.z,{}),(0,l.jsxs)(tT.K,{children:[(0,l.jsx)(a.x,{fontWeight:"bold",fontSize:"md",children:(0,l.jsx)(h.cC,{id:"NxHkkp"})}
1),(0,l.jsxs)(lM.GS,{pl:"4",spacing:"2",children:[b?1===lp.Co.length?(0,l.jsx)(lM.HC,{children:(0,l.jsx)(h.cC,{id:"YMrXdT",values:{0:lp.Co[0]},components:{0:(0,l.jsx)(lL.E,{colorScheme:"gray"}),1:(0,l.jsx)(lL.E,{colorScheme:"gray"}),2:(0,l.jsx)(lL.E,{colorScheme:"gray"})}})}):(0,l.jsx)(lM.HC,{children:(0,l.jsx)(h.cC,{id:"FM+LNW",values:{0:lp.Co.slice(0,-1).map(e=>(0,l.jsx)(lL.E,{colorScheme:"gray",children:e},e)),1:lp.Co.slice(-1)[0]},components:{0:(0,l.jsx)(lL.E,{colorScheme:"gray"}),1:(0,l.jsx)(ex.U,{display:"inline",divider:(0,l.jsx)("span",{children:", "})}),2:(0,l.jsx)(lL.E,{colorScheme:"gray"}),3:(0,l.jsx)(lL.E,{colorScheme:"gray"})}})}):null,(0,l.jsx)(lM.HC,{children:(0,l.jsx)(h.cC,{id:"Jmb6Yp",values:{subdomain:y,GAMMA_SITES_HOST:lp.ax},components:{0:(0,l.jsx)(lL.E,{colorScheme:"gray"}),1:(0,l.jsx)(lL.E,{colorScheme:"gray"}),2:(0,l.jsx)(lL.E,{colorScheme:"gray"})}})})]})]})]}),r&&(0,l.jsxs)(ex.U,{justifyContent:"space-between",children:[(0,l.jsx)(eh.z,{variant:"plain",onClick:()=>d("initial"),children:(0,l.jsx)(h.cC,{id:"iH8pgl"})}),(0,l.jsx)(eh.z,{variant:"solid",onClick:()=>{i(),null==r||r(n)},size:"md",mx:"auto",children:(0,l.jsx)(h.cC,{id:"RyhVuk"})})]})]})})})]}),(0,l.jsx)(tx.m,{})]})]})})},lW=e=>{let{children:t,shouldWrap:i=!1}=e;return i?(0,l.jsx)(iN.W,{py:16,maxW:"container.md",children:t}):(0,l.jsx)(l.Fragment,{children:t})},lH=e=>{let{showHeadings:t=!0}=e,{currentWorkspace:i}=(0,eY.SE)(),n=(0,M.CG)(eE.lH),{refetch:r}=(0,iW.ZUZ)({variables:{id:null==n?void 0:n.id},fetchPolicy:"cache-first",skip:!(null==n?void 0:n.id)}),{isOpen:s,onOpen:d,onClose:c}=(0,tL.M)({id:"domainSetupModal"}),u=null==n?void 0:n.domains.find(e=>
1"pending"===e.status),[x,m]=(0,j.useState)(null),[p,{loading:g}]=(0,iW.kui)(),[f,v]=(0,j.useState)();(0,j.useEffect)(()=>{if(!u)return;let e=setInterval(()=>{r()},1e4);return()=>{clearInterval(e)}},[u,r,n]);let C=(0,j.useCallback)(e=>{v(e),d()},[d]),b=(0,j.useCallback)(e=>{"addDomain"===x&&(p({variables:{input:{siteId:null==n?void 0:n.id,name:e}}}),c())},[p,x,c,null==n?void 0:n.id]);return console.debug("%cDomainsPanel debug","background-color: #cc00ff",{site:n}),(0,l.jsx)(o.k,{w:"100%",flex:1,direction:"column",mt:4,children:(0,l.jsxs)(lW,{shouldWrap:t,children:[t&&(0,l.jsxs)(tT.K,{spacing:1,mb:4,children:[(0,l.jsx)(eX.X,{children:(0,l.jsx)(h.cC,{id:"AZ4xlc"})}),(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"KuoJwF"})})]}),n?(0,l.jsx)(lN,{site:n,onDomainSetupClick:C,onAddDomain:e=>{d(),v(e),m("addDomain")},isAddingDomain:g,refetchSites:r}):(0,l.jsx)(tp.AA,{}),s&&f&&(0,l.jsx)(lU,{domainName:f,isOpen:s,onClose:()=>{c(),m(null)},onDomainConfirmed:x?b:null})]})})};var lV=i(20437),lB=i(99787),lK=i(16494),lq=i(19576),lY={src:"/_next/static/media/no-navbar.e9d28333.png"},lZ={src:"/_next/static/media/top-navbar.97a69a83.png"};let lX=e=>{let t=(0,M.CG)(eE.lH);return t?(0,l.jsx)(lJ,{site:t,...e}):null},lJ=e=>{let{site:t,showHeadings:i=!0,doc:n}=e,r=(0,iR.p)(),s=(0,e7.ye)("sitesNav"),[d,c]=(0,j.useState)(t.name),[p,g]=(0,j.useState)(t.gtmContainerId),[f,C]=(0,j.useState)(t.navEnabled),[b,y]=(0,j.useState)(!1),[k,w]=(0,j.useState)(!1),[S,E]=(0,j.useState)(null),{currentWorkspace:_}=(0,eY.SE)(),[A]=(0,v.Iyu)(),T=(0,j.useCallback)(async()=>{if(!(null==t?void 0:t.id))return;y(!0);let e={siteId:null==t?void 0:t.id,name:d,navEnabled:f,gtmContainerId:p};!f||(null==t?void 0:t.navContent)||(e.navContent=(0,eR.JB)()),await A({variables:{input:e}}),r({title:(0,l.jsx)(h.cC,{id:"bZn5Ok"}),status:"success",isClosable:!0,position:"top"}),y(!1)},[p,d,f,null==t?void 0:t.id,null==t?void 0:t.navContent,r,A]),O=(0,j.useCallback)(async e=>{(null==t?void 0:t.id)&&(w(!0),await A({variables:{input:{siteId:null==t?void 0:t.id,faviconUrl:e}}}),r({title:e?(0,l.jsx)(h.cC,{id:"64GEyu"}):(0,l.jsx)(h.cC,{id:"/K2cLG"}),status:"success",isClosable:!0,position:"top"}),w(!1))},[null==t?void 0:t.id,r,A]),P=d!==(null==t?void 0:t.name)||f!==(null==t?void 0:t.navEnabled)||p!==(null==t?void 0:t.gtmContainerId);return(0,l.jsx)(o.k,{w:"100%",flex:1,direction:"column",px:2,children:(0,l.jsxs)(lW,{shouldWrap:i,children:[i&&(0,l.jsx)(eX.X,{fontSize:"3xl",letterSpacing:"tight",fontWeight:"800",mb:12,children:(0,l.jsx)(h.cC,{id:"Tz0i8g"})}),(0,l.jsxs)(tT.K,{spacing:4,mt:6,children:[(0,l.jsxs)(i1.NI,{children:[(0,l.jsx)(ex.U,{justifyContent:"center",children:(0,l.jsx)(i2.l,{flex:"1",children:(0,l.jsx)(h.cC,{id:"Lve3H6"})})}),(0,l.jsx)(lc.I,{onChange:e=>{c(e.currentTarget.value)},placeholder:m.ag._({id:"ZiMSMQ"}),value:d})]}),(0,l.jsxs)(i1.NI,{children:[(0,l.jsx)(ex.U,{justifyContent:"center",children:(0,l.jsx)(i2.l,{flex:"1",children:(0,l.jsx)(h.cC,{id:"+Qaboy"})})}
1),(0,l.jsx)(o.k,{h:"150px",w:"100%",position:"relative",justify:"center",align:"center",children:(null==t?void 0:t.faviconUrl)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.k,{align:"center",justify:"center",w:"128px",h:"128px",border:"1px solid var(--chakra-colors-blackAlpha-200)",children:(0,l.jsx)(tV.E,{src:null==t?void 0:t.faviconUrl,maxW:"100px",maxH:"100px",borderRadius:"sm"})}),(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"XyBdok"}),children:(0,l.jsx)(I.h,{zIndex:2,position:"absolute",top:0,right:0,isRound:!0,isDisabled:k,size:"sm",icon:(0,l.jsx)(x.G,{icon:u.XAH}),"aria-label":m.ag._({id:"XyBdok"}),onClick:()=>O(null)})})]}):k||S===lK.D.Uploading?(0,l.jsx)(tP.$,{}):(0,l.jsx)(lB.un,{orgId:null==_?void 0:_.id,uploadType:"icon",editType:"icon",dropHereText:m.ag._({id:"hVCCpY",values:{0:"%{browse}"}}),customHeight:"150px",customFontSize:"xs",showTip:!1,onUploadStart:()=>{E(lK.D.Uploading)},onUploadSuccess:async(e,t)=>{let{src:i,uploadResultStep:n}=e;"optimized"===n&&(await O(i),E(lK.D.Done))},onUploadFailed:e=>{E(lK.D.Error),r({title:(0,l.jsx)(h.cC,{id:"aECahe"})}),console.error("[Site SettingsPanel] Favicon upload error",e)},sx:{width:"100%",".uppy-Root":{border:"1px solid var(--chakra-colors-gray-200)",borderRadius:"md",width:"100%"},".uppy-DragDrop-label":{fontSize:"xs",color:"gray.500"},".uppy-DragDrop--isDragDropSupported":{border:"none"},".uppy-DragDrop-arrow":{transform:"scale(0.85)"}}})}),(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",mt:2,children:(0,l.jsx)(h.cC,{id:"ifTGl2"})})]}),s&&(0,l.jsxs)(i1.NI,{children:[(0,l.jsx)(ex.U,{justifyContent:"center",children:(0,l.jsx)(i2.l,{flex:"1",children:(0,l.jsx)(h.cC,{id:"UxKoFf"})})}),(0,l.jsxs)(lV.M,{columns:2,spacing:6,flex:1,children:[(0,l.jsx)(lQ,{name:m.ag._({id:"Nom9QG"}),src:lZ.src,isSelected:f,onClick:()=>{C(!0)}}),(0,l.jsx)(lQ,{name:m.ag._({id:"BvDFuc"}),src:lY.src,isSelected:!f,onClick:()=>{C(!1)}})]})]}),(0,l.jsxs)(i1.NI,{children:[(0,l.jsx)(ex.U,{justifyContent:"center",children:(0,l.jsx)(i2.l,{flex:"1",children:(0,l.jsx)(h.cC,{id:"d4WWfP"})})}),(0,l.jsxs)(o.k,{sx:{".gtm-prefix::before":{content:'"GTM\\2009-"'}},children:[(0,l.jsx)(o.k,{className:"gtm-prefix",position:"absolute",alignItems:"center",color:(null==p?void 0:p.length)?"gray.800":"gray.500",fontWeight:"400",h:10,pl:4}),(0,l.jsx)(lc.I,{pl:16,placeholder:"XXXXXX",value:p,onChange:e=>{let t=lq.R.sanitize(e.currentTarget.value);g(t.replace(/[\W_]+/g,"").toUpperCase().slice(0,10))}})]}),(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",mt:2,children:(0,l.jsx)(h.cC,{id:"6LEeiE",components:{0:(0,l.jsx)("br",{}),1:(0,l.jsx)(eh.z,{"aria-label":"Learn more about Google Tag Manager",as:"a",px:1,textDecoration:"underline",variant:"ghost",href:"https://support.google.com/tagmanager/answer/6103696?hl=en",target:"_blank",size:"xs",rightIcon:(0,l.jsx)(nB.h,{ml:-1})})}})})]}),n&&(0,l.jsx)(lm.V,{label:(0,l.jsx)(h.cC,{id:"SDyz5I"}),segmentEvent:lh.AA.GAMMA_PRO_UPSELL_SITE_REMOVE_WATERMARK,doc:n}),(0,l.jsx)(o.k,{w:"100%",flex:1,direction:"column",align:"flex-end",justify:"flex-end",pb:8,children:(0,l.jsx)(em.h,{children:(0,l.jsx)(eh.z,{variant:"solid",isDisabled:!P,onClick:T,isLoading:b,children:(0,l.jsx)(h.cC,{id:"tfDRzk"})})})})]})]})})},lQ=e=>{let{name:t,src:i,onClick:n,isSelected:r,...s}=e;return(0,l.jsxs)(tT.K,{p:2,bg:r?"trueblue.50":"transparent",_hover:{bg:"trueblue.50",cursor:"pointer"},borderRadius:"md",spacing:2,...s,transitionProperty:"common",transitionDuration:"normal",onClick:n,children:[(0,l.jsx)(d.xu,{height:"80px",bg:"gray.50",borderRadius:"md",borderWidth:"1px",overflow:"hidden",children:i&&(0,l.jsx)(tV.E,{src:i,width:"100%",height:"100%",objectFit:"contain",borderRadius:"md"})}),(0,l.jsxs)(ex.U,{children:[r&&(0,l.jsx)(d.xu,{children:(0,l.jsx)(x.G,{icon:u.LEp})}),(0,l.jsx)(a.x,{fontSize:"sm",fontWeight:"500",children:t})]})]})},l$=(0,j.memo)(e=>{let{editor:t}=e,{bodyStart:i}=(0,M.CG)(L.$p),n=(0,j.useCallback)(e=>{null==t||t.commands.updateNestedAttributesAtPos(0,{customCode:{bodyStart:e}})},[t]);return(0,l.jsx)(o.k,{w:"100%",flex:1,direction:"column",p:2,pt:6,children:(0,l.jsx)(sz,{label:m.ag._({id:"fC5kYg"}
1),helperText:m.ag._({id:"0AZNtw"}),initialValue:i,updateValue:n,language:"html",height:"600px"})})});l$.displayName="CustomCodePanel";let l0=(0,j.memo)(e=>{let{selectedPanel:t,setSelectedPanel:i}=e,n=(0,e7.ye)("docCustomCode");return(0,l.jsx)(tT.K,{spacing:4,children:(0,l.jsx)(tT.K,{spacing:8,children:(0,l.jsxs)(em.h,{variant:"ghost",size:"sm",borderRadius:"full",w:"100%",children:[(0,l.jsx)(eh.z,{borderRadius:"full",leftIcon:(0,l.jsx)(x.G,{icon:u.ovd,fixedWidth:!0}),"data-website-panel-active-view-button":"domains",colorScheme:"domains"===t?"trueblue":"gray",bg:"domains"===t?"trueblue.100":void 0,onClick:()=>i("domains"),flex:1,children:(0,l.jsx)(h.cC,{id:"AZ4xlc"})}),(0,l.jsx)(eh.z,{borderRadius:"full",leftIcon:(0,l.jsx)(x.G,{icon:u.gr5,fixedWidth:!0}),"data-website-panel-active-view-button":"website",colorScheme:"website"===t?"trueblue":"gray",bg:"website"===t?"trueblue.100":void 0,onClick:()=>i("website"),flex:1,children:(0,l.jsx)(h.cC,{id:"Tz0i8g"})}),n&&(0,l.jsx)(eh.z,{borderRadius:"full",leftIcon:(0,l.jsx)(x.G,{icon:u.dT$,fixedWidth:!0}),"data-website-panel-active-view-button":"code",colorScheme:"code"===t?"trueblue":"gray",bg:"code"===t?"trueblue.100":void 0,onClick:()=>i("code"),flex:1,children:(0,l.jsx)(h.cC,{id:"E16GGw"})})]})})})});l0.displayName="SettingsPanelHeader";let l1=e=>{let{onEnable:t,isLoading:i}=e;return(0,l.jsxs)(tT.K,{align:"center",justify:"center",spacing:6,flex:1,p:6,mt:8,bg:"gray.50",borderRadius:"md",children:[(0,l.jsx)(tV.E,{src:"https://cdn.gamma.app/zc87vhr30n8uf3n/9f0b4d71d10f4d388e50febe89bb1853/optimized/Sal-Chill-Cloud.svg",w:"200px"}),(0,l.jsx)(eX.X,{fontFamily:"p22-mackinac-pro",fontWeight:"700",size:"md",children:(0,l.jsx)(h.cC,{id:"2xMidw"})}),(0,l.jsx)(a.x,{fontSize:"sm",textAlign:"center",css:{textWrap:"balance"},children:(0,l.jsx)(h.cC,{id:"RxQ97P",components:{0:(0,l.jsx)("code",{})}})}),(0,l.jsxs)(em.h,{children:[(0,l.jsx)(eh.z,{variant:"solid",onClick:t,isLoading:i,children:(0,l.jsx)(h.cC,{id:"JHMOcq"})}),(0,l.jsx)(eh.z,{as:nS.r,variant:"plain",isExternal:!0,href:"https://help.gamma.app/en/articles/8429268-how-to-publish-your-page-to-a-custom-domain",rightIcon:(0,l.jsx)(x.G,{icon:u.gJF}),children:(0,l.jsx)(h.cC,{id:"zwWKhA"})})]}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"qdah/E"})})]})};var l2=i(28165),l5=i(25925);let l4=(0,s6.E)(d.xu),l3={initial:{opacity:0,translateY:-40},animate:{opacity:1,translateY:0},exit:{opacity:0,translateY:40},transition:{duration:.3}},l9=e=>{let{isLoading:t,onChange:i,isChecked:n,isDisabled:r,enabledText:s,disabledText:a}=e;return(0,l.jsxs)(o.k,{cursor:r?"not-allowed":"pointer",className:(0,c.cx)("gamma-switch-container",t&&"loading",n?"active":""),opacity:r?.6:1,children:[(0,l.jsx)(d.xu,{as:"label",className:"text",fontSize:"sm",justifyContent:"center",htmlFor:"gamma-checkbox",position:"relative",overflow:"hidden",children:(0,l.jsx)(l5.M,{initial:!1,children:t?(0,l.jsx)(l4,{as:"span",position:"absolute",...l3,children:(0,l.jsx)(tP.$,{size:"sm"})},"loading"):n?(0,l.jsx)(l4,{as:"span",position:"absolute",...l3,children:s},"checked"):(0,l.jsx)(l4,{as:"span",position:"absolute",...l3,children:a},"unchecked")})}),(0,l.jsxs)(d.xu,{as:"label",className:"switch",pointerEvents:r?"none":"auto",children:[(0,l.jsx)("input",{id:"gamma-checkbox",type:"checkbox",onChange:i,disabled:t||r}),(0,l.jsx)("span",{className:"slider round"})]})]})},l6=(0,l2.F4)({"0%":{transform:"scale(1)",opacity:1},"50%":{transform:"scale(1.7)",opacity:0},"100%":{transform:"scale(1)",opacity:0}}),l7=(0,l2.F4)({"0%":{transform:"scale(1)",opacity:1},"15%":{transform:"scale(1)",opacity:1},"60%":{transform:"scale(1.7)",opacity:0},"100%":{transform:"scale(1)",opacity:0}}),l8=(0,l2.F4)({"0%":{transform:"scale(1)"},"30%":{transform:"scale(1)"},"50%":{transform:"scale(1.05)"},"70%":{transform:"scale(1)"},"100%":{transform:"scale(1)"}}),oe=e=>{let{icon:t,showDisabled:i=!1,shouldPulse:n=!1,bg:r="gray.200",color:s="gray.800"}=e;return(0,l.jsx)(d.Cd,{color:s,textAlign:"center",bg:r,size:8,opacity:i?.5:1,position:"relative",animation:n?"".concat(l8," 2.7s infinite"):"none",sx:{":before":n?{position:"absolute",top:0,left:0,width:"100%",height:"100%",borderRadius:"50%",content:"''",boxShadow:"inset 0 0 0 3px #6910D166",transition:"transform 0.2s, opacity 0.2s",animation:"".concat(l6," 2.7s infinite")}:{},":after":n?{position:"absolute",top:0,left:0,width:"100%",height:"100%",borderRadius:"50%",content:"''",boxShadow:"inset 0 0 0 2px #6910D133",transition:"transform 0.2s, opacity 0.2s",animation:"".concat(l7," 2.7s infinite")}:{}},children:i?(0,l.jsxs)("span",{className:"fa-stack",children:[(0,l.jsx)(x.G,{icon:u.u6k,className:"fa-stack-1x"}),(0,l.jsx)(x.G,{icon:t,className:"fa-stack-1x"})]}):(0,l.jsx)(x.G,{size:"1x",icon:t})})},ot=e=>{let{isLoading:t=!1,site:i,onChange:n,disabledText:r,doc:s}=e,c=(0,eA.Vr)(i),x=(0,ek.Lu)(),m=(0,eY.py)("manage",s),p=x||m,g=(0,eA.k2)(i),j=p?r||(t?(0,l.jsx)(h.cC,{id:"mkk40+"}):c?(0,l.jsx)(h.cC,{id:"f4CBNf"}):(0,l.jsx)(h.cC,{id:"5G4vd5"})):(0,l.jsx)(h.cC,{id:"Z2uNdQ"});return(0,l.jsxs)(ex.U,{w:"100%",justify:"space-between","data-testid":"toggle-website-settings",children:[(0,l.jsx)(d.xu,{children:(0,l.jsxs)(o.k,{alignItems:"center",children:[(0,l.jsx)(oe,{shouldPulse:g,bg:g?"#6910D1":"gray.200",color:g?"white":"gray.800",icon:g?u.cL$:u.g4A}),(0,l.jsxs)(d.xu,{ml:3,children:[(0,l.jsx)(ex.U,{children:(0,l.jsx)(a.x,{children:g?(0,l.jsx)(h.cC,{id:"MuDTSp"}):c?(0,l.jsx)(h.cC,{id:"AAm5jh"}):(0,l.jsx)(h.cC,{id:"HzFHhy"})})}),(0,l.jsx)(o.k,{align:"center",children:(0,l.jsx)(ex.U,{spacing:1,align:"center",children:(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",css:{textWrap:"balance"},children:i&&g?(0,l.jsx)(nL,{site:i}):c?(0,l.jsx)(h.cC,{id:"N4VTXP"}):(0,l.jsx)(h.cC,{id:"1bmqGL"})})})})]})]})}),(0,l.jsx)(d.xu,{children:(0,l.jsx)(ep.kH,{label:j,placement:"top",shouldWrapChildren:!0,children:(0,l.jsx)(l9,{isChecked:c,isDisabled:!!(t||r||!p),isLoading:t,onChange:n})})})]})},oi=e=>{var t,i;
1let{doc:n,isOpen:r,onOpen:s,onPublishSettingsClose:a}=e,d=(0,iR.p)(),c=(0,M.TL)(),u=(0,M.CG)(eE.lH),x=(0,M.CG)(eE.$U),{editor:m}=(0,n4._i)(),{currentWorkspace:p}=(0,eY.SE)(),[g,f]=(0,j.useState)(!1),[C]=(0,v.V$$)(),[b]=(0,v.cxO)(),[y]=(0,v.A0Z)(),[k]=(0,v.UoQ)(),[w,S]=(0,j.useState)("domains"),E=n.id,I=n.title,_=null==p?void 0:p.id,A=null==n?void 0:null===(t=n.theme)||void 0===t?void 0:t.id,T=!1==!!n.site?null:(null===(i=n.site)||void 0===i?void 0:i.enabled)?"enabled":"disabled",O=(null==u?void 0:u.archived)?(0,l.jsx)(h.cC,{id:"VAyYv6"}):null;(0,j.useEffect)(()=>{let e=sK.T.on("openSiteSettings",e=>{S(e),s()});return()=>{e()}},[s]);let P=(0,j.useCallback)(async()=>{if(_){f(!0),k({variables:{id:E,themeId:null}});try{await C({variables:{input:{workspaceId:_,name:I,themeId:A,routes:[{docId:E,path:"/"}]}},refetchQueries:["GetDoc"]}).then(e=>{let{data:t}=e;(0,eE.zs)(c)({site:null==t?void 0:t.createSite,docId:E})})}catch(e){console.error("[WebsiteSettingsModal] Failed to create site",e.message),d({title:(0,l.jsx)(h.cC,{id:"Pdboh4"}),description:(0,l.jsx)(h.cC,{id:"8wxFbh"}),status:"error",duration:5e3,isClosable:!0,position:"top"})}finally{f(!1)}}},[C,c,E,I,A,d,k,_]),D=(0,j.useCallback)(async()=>{if(x){f(!0);try{await b({variables:{id:x},update:(e,t)=>{let{data:i}=t;e.updateQuery({query:v.yE1,variables:{id:E}},e=>e&&e.doc?{...e,doc:{...e.doc,site:null==i?void 0:i.disableSite}}:e)}})}catch(e){console.error("[WebsiteSettingsModal] Failed to deactivate site",e.message),d({title:(0,l.jsx)(h.cC,{id:"ksq4sM"}),description:(0,l.jsx)(h.cC,{id:"VE0YVl"}),status:"error",duration:5e3,isClosable:!0,position:"top"})}finally{f(!1)}}},[b,E,x,d]),R=(0,j.useCallback)(async()=>{if(x){f(!0);try{await y({variables:{id:x},update:(e,t)=>{let{data:i}=t;e.updateQuery({query:v.yE1,variables:{id:E}},e=>e&&e.doc?{...e,doc:{...e.doc,site:null==i?void 0:i.enableSite}}:e)}})}catch(e){console.error("[WebsiteSettingsModal] Failed to re-activate site",e.message),d({title:(0,l.jsx)(h.cC,{id:"aQnYTJ"}),description:(0,l.jsx)(h.cC,{id:"E2sPQM"}),status:"error",duration:5e3,isClosable:!0,position:"top"})}finally{f(!1)}}},[E,y,x,d]),G=(0,j.useCallback)(()=>{null===T?P():"enabled"===T?D():"disabled"===T&&R()},[P,D,R,T]);return(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsx)(to.d,{isOpen:r,onClose:a,size:"lg",children:(0,l.jsxs)(td.s,{p:0,shadow:"xl",children:[(0,l.jsxs)(nY.x,{children:[(0,l.jsx)(h.cC,{id:"WtsmDd"})," ",(0,l.jsx)(sD.C,{colorScheme:"green",ml:2,fontSize:"sm",letterSpacing:"normal",children:(0,l.jsx)(h.cC,{id:"YBt9YP"})})]}),(0,l.jsx)(tc.o,{}),(0,l.jsxs)(tu.f,{children:[(0,l.jsxs)(eJ.g,{spacing:4,align:"stretch",children:[(0,l.jsx)(ot,{isLoading:g,site:u,doc:n,onChange:G,disabledText:O}),!!u&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nU,{context:"settings"}),(0,l.jsx)(rn.i,{}),"disabled"===T&&(0,l.jsxs)(id.b,{status:"warning",mb:6,children:[(0,l.jsx)(ra.z,{}),(0,l.jsx)(h.cC,{id:"CHu+l0"})]}),(0,l.jsxs)(o.k,{direction:"column",children:[(0,l.jsx)(l0,{selectedPanel:w,setSelectedPanel:S}),"website"===w?(0,l.jsx)(lX,{showHeadings:!1,doc:n}):"domains"===w?(0,l.jsx)(lH,{showHeadings:!1}):"code"===w?(0,l.jsx)(l$,{editor:m}):null]})]})]}),!u&&(0,l.jsx)(l1,{onEnable:G,isLoading:g})]})]})})})},on=e=>{let{doc:t}=e,i=!!(null==t?void 0:t.site),{isOpen:n,onClose:r,onOpen:s}=(0,tL.M)({id:"PublishSettingsDisclosure"});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.g4A,fixedWidth:!0}),onClick:s,children:i?(0,l.jsx)(h.cC,{id:"gKmuNS"}):(0,l.jsx)(h.cC,{id:"wzvDe1"})}),t&&(0,l.jsx)(oi,{isOpen:n,onOpen:s,doc:t,onPublishSettingsClose:r})]})};var or=i(84010),os=i(43019);let ol=(e,t)=>{let i=[],n=e=>{if(t(e)&&i.push(e),e.content)for(let t of e.content)n(t)};return n(e),i},oo=()=>({today:m.ag._({id:"ecUA8p"}),thisWeek:m.ag._({id:"yByRxz"}),earlier:m.ag._({id:"HGg4T/"})}),oa=()=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(rr.O,{w:"350px",h:12}),(0,l.jsx)(or.N,{mt:3,w:64,noOfLines:1})]}),od=e=>{let{createdTime:t,editors:i,isLatest:n,onClick:r,showPaywall:s,paywallCount:c}=e;if(!i||!i.length)return(0,l.jsx)(l.Fragment,{});let u=s?"linear-gradient(rgb(0, 0, 0) 15%, transparent 100%)":"",x=(0,l.jsxs)(s0.O,{flexDirection:"row",borderRadius:"base",style:{WebkitMaskImage:u,maskImage:u},border:"none",isDisabled:s,opacity:"1 !important",onClick:r,alignItems:"flex-start",width:"100%",textAlign:"left",children:[(0,l.jsxs)(o.k,{w:"100%",direction:"column",children:[(0,l.jsx)(a.x,{fontSize:"sm",children:t5()((0,tZ.P9)(t))}),(0,l.jsx)(a.x,{fontSize:"xs",flex:1,children:i[0].displayName})]}),n&&(0,l.jsx)(sD.C,{colorScheme:"green",py:"0.5",fontSize:"0.65em",children:(0,l.jsx)(h.cC,{id:"wL3cK8"})})]});return s?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ep.kH,{placement:"top",
1isDisabled:!s,label:s?(0,l.jsx)(h.cC,{id:"PYTBm5",values:{paywallCount:c}}):void 0,children:(0,l.jsx)(d.xu,{mb:4,children:x})}),(0,l.jsx)(rs.m,{isNarrow:!0,segmentEvent:ez.AA.GAMMA_PRO_UPSELL_CALLOUT_CHANGE_HISTORY,description:(0,l.jsx)(h.cC,{id:"mVKYtH"})})]}):x},oc=e=>{var t;let i=(0,q.Yt)(),{items:n,paywalledItems:r}=(0,j.useMemo)(()=>{if("unlimited"===i)return{items:e,paywalledItems:[]};let t=parseInt(i),n=e.filter((e,i)=>0===i||(0,sW.Z)(e.createdTime)>=new Date(Date.now()-864e5*t)),r=e.slice(n.length,e.length),s=r.length?r[0]:null;return{items:n.concat(s?[s]:[]),paywalledItems:r}},[i,e]),s=(0,j.useMemo)(()=>(0,tZ.yd)({items:n,sortBy:"createdTime"}),[n]);return{groupedSnapshots:s,paywalledSnapshotId:null===(t=r[0])||void 0===t?void 0:t.id,paywallCount:r.length}},ou=e=>{let{groupedSnapshots:t,paywalledSnapshotId:i,paywallCount:n,onClick:r,showFetchMore:s,onFetchMoreClick:o,isFetchingMore:a}=e;return(0,l.jsxs)(s$.t,{w:"100%",children:[Object.entries(t).filter(e=>{let[,t]=e;return t.length}).map((e,t)=>{let[s,o]=e;return(0,l.jsxs)(j.Fragment,{children:[(0,l.jsx)(ep.NZ,{px:4,py:2,mx:0,mt:2,children:oo()[s]}),o.map((e,s)=>{let{createdTime:o,editors:a,id:d}=e;return(0,l.jsx)(od,{onClick:()=>r(d),isLatest:0===t&&0===s,createdTime:o,editors:a,showPaywall:i===d,paywallCount:n},d)})]},s)}),s&&(0,l.jsx)(eh.z,{isLoading:a,onClick:o,children:(0,l.jsx)(h.cC,{id:"yQ2kGp"})})]})},ox=()=>(0,l.jsxs)(s$.t,{w:"100%",children:[(0,l.jsx)(rr.O,{h:16}),(0,l.jsx)(rr.O,{h:16,mt:2}),(0,l.jsx)(rr.O,{h:16,mt:2}),(0,l.jsx)(rr.O,{h:16,mt:2}),(0,l.jsx)(rr.O,{h:16,mt:2}),(0,l.jsx)(rr.O,{h:16,mt:2}),(0,l.jsx)(rr.O,{h:16,mt:2}),(0,l.jsx)(rr.O,{h:16,mt:2})]}),oh=e=>{let{title:t,createdBy:i,createdTime:n,numSnapshots:r}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.x,{mt:1,children:(0,l.jsx)(h.cC,{id:"yf//Op",values:{numSnapshots:r,0:(0,nM.Dw)(n),1:(0,nM.Dw)(n)}})}),(0,l.jsx)(a.x,{color:"gray.500",fontSize:"sm",fontWeight:"normal",letterSpacing:"normal",children:(0,l.jsx)(h.cC,{id:"JVHTIo",values:{title:t,0:(null==i?void 0:i.displayName)?null==i?void 0:i.displayName:"Unknown",1:(0,nM.p6)(n,"PPp")}})})]})},om="snapshot-editor-root",op=e=>{let{id:t,doc:i,content:n}=e,r=(0,j.useMemo)(()=>{if(n)return ol(n,e=>e.type===e8.W4).map(e=>{var t;return{__typename:"Card",id:(null===(t=e.attrs)||void 0===t?void 0:t.id)||"",docId:i.id,title:(0,os.getCardTitle)(e),createdTime:i.createdTime,updatedTime:i.updatedTime,archived:!1}})},[n,i]);return(0,l.jsx)(eO.fb,{reduxData:{cards:r},initialContent:n,doc:i,docId:i.id,scrollingParentSelector:".".concat(om),isInsideDrawer:!0},t)},og=e=>{let{isOpen:t,onClose:i,doc:n}=e,r=(0,iR.p)(),{getCollaborativeEditorInstance:s}=(0,n4._i)(),[a,c]=(0,j.useState)(!1),{loading:u,data:x,called:m,fetchMore:p}=(0,v.pfN)({variables:{docId:n.id,first:25},skip:!n||!t,fetchPolicy:"network-only",nextFetchPolicy:"network-only"}),[g,{loading:f,data:C}]=(0,v.opq)({nextFetchPolicy:"cache-only"}),b=(null==x?void 0:x.snapshots.edges.map(e=>e.node))||[],{groupedSnapshots:y,paywalledSnapshotId:k,paywallCount:w}=oc(b),S=null==x?void 0:x.snapshots.pageInfo,E=!!(!k&&m&&(null==S?void 0:S.hasNextPage)&&(null==S?void 0:S.endCursor)),I=(0,j.useCallback)(()=>{(null==S?void 0:S.hasNextPage)&&(null==S?void 0:S.endCursor)&&(c(!0),p({variables:{after:S.endCursor}}).finally(()=>{c(!1)}))},[p,null==S?void 0:S.endCursor,null==S?void 0:S.hasNextPage]),_=b[0];(0,j.useEffect)(()=>{(null==_?void 0:_.id)&&g({variables:{snapshotId:_.id,docId:n.id}})},[n.id,g,null==_?void 0:_.id]);let A=(0,sH.$)(null==n?void 0:n.title),T="createdBy"in n?n.createdBy:void 0,O=null==n?void 0:n.createdTime,P=null==C?void 0:C.snapshot,D=P&&P.id===n.currentSnapshotId;return(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(to.d,{placement:"bottom",onClose:i,isOpen:t,trapFocus:!0,isFullHeight:!0,blockScrollOnMount:!1,children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(td.s,{borderTopRadius:"xl",h:"calc(var(--100vh) - 24px)",transform:"none !important",children:[(0,l.jsx)(tc.o,{}),(0,l.jsxs)(nY.x,{borderBottom:"1px solid #000",borderColor:"gray.200",children:[u&&(0,l.jsx)(oa,{}),n&&b&&(0,l.jsx)(oh,{numSnapshots:(null==b?void 0:b.length)||0,createdBy:T,createdTime:O,title:A})]}),(0,l.jsx)(tu.f,{p:0,h:"100%",children:(0,l.jsxs)(o.k,{direction:"row",h:"100%",children:[(0,l.jsx)(d.xu,{p:2,w:"17rem",overflowY:"auto",bg:"gray.50",children:(0,l.jsxs)(sQ.m,{variant:"soft-rounded",orientation:"vertical",size:"md",children:[u&&(0,l.jsx)(ox,{}),!u&&b&&(0,l.jsx)(ou,{onClick:e=>{g({variables:{snapshotId:e,docId:n.id}})},groupedSnapshots:y,paywalledSnapshotId:k,paywallCount:w,showFetchMore:E,onFetchMoreClick:I,isFetchingMore:a})]})}),(0,l.jsx)(o.k,{flex:1,bg:"gray.100",overflowY:"scroll",justifyContent:"center",alignContent:"center",alignItems:"flex-start",width:"100%",height:"100%",className:om,css:{"--editor-width":"calc(100vw - 17rem)"},children:(0,l.jsxs)(o.k,{direction:"column",position:"relative",width:"100%",height:"100%",children:[(0,l.jsx)(ty.Y,{}),(!P||f)&&(0,l.jsx)(tp.AA,{}),P&&!f&&(0,l.jsx)(op,{id:P.id,doc:n,content:null==P?void 0:P.content.default})]})})]})}),(0,l.jsx)(tx.m,{borderTop:"1px solid #000",borderColor:"gray.200",children:(0,l.jsxs)(em.h,{spacing:4,children:[(0,l.jsx)(eh.z,{variant:"ghost",onClick:i,children:(0,l.jsx)(h.cC,{id:"dEgA5A"})}
1),(0,l.jsx)(ep.kH,{label:D?(0,l.jsx)(h.cC,{id:"HJo72u"}):(0,l.jsx)(h.cC,{id:"sonTm1"}),shouldWrapChildren:!0,children:(0,l.jsx)(eh.z,{variant:"solid",isDisabled:!P||D,onClick:()=>{var e;if(!P)return;let t=null==b?void 0:null===(e=b.find(e=>e.id===P.id))||void 0===e?void 0:e.createdTime,n=s();if(!n)return;n.commands.setContent(P.content.default,!0);let{annotationsAbsolute:o}=P.content;o?n.commands.restoreAnnotations(o):n.commands.clearAnnotations(),i(),r({title:(0,l.jsx)(h.cC,{id:"7ovf4C"}),description:(0,l.jsx)(h.cC,{id:"DTim6X",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc,0:t?(0,nM.p6)(t,"PPp"):"selected snapshot"}}),status:"success",duration:5e3,isClosable:!0})},children:(0,l.jsx)(h.cC,{id:"yKu/3Y"})})})]})})]})]})})},oj=e=>{let{doc:t}=e,{isOpen:i,onClose:n,onOpen:r}=(0,tL.M)({id:"snapshotsDrawer"});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.SZw,fixedWidth:!0}),onClick:r,children:(0,l.jsx)(h.cC,{id:"6Z5x06"})}),t&&(0,l.jsx)(og,{doc:t,isOpen:i,onClose:n})]})},of=()=>{let e=ia();return e?(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.Fzb,fixedWidth:!0}),as:nS.r,href:e,target:(0,ef.Q5)()?"_self":"_blank",children:(0,l.jsx)(h.cC,{id:"7U0bM7"})}):null},ov=e=>{let{editor:t}=e,i=(0,j.useCallback)(()=>{t&&t.commands.undo()},[t]);return(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.paY,fixedWidth:!0}),onClick:i,command:(0,ep.cE)("Mod+Z"),children:(0,l.jsx)(h.cC,{id:"9uI/rE"})})},oC=e=>{let{doc:t,editorWrapperEl:i,scrollingParentSelector:n}=e,{isConnected:r}=(0,v.$gs)(),{user:s}=(0,eY.SE)(),o=(0,eY.py)("view",t),a=(0,eY.py)("edit",t),d=(0,eY.py)("manage",t);(0,ek.O1)();let c=(0,M.CG)(eE.lH);(null==t?void 0:t.id)&&(0,eA.Rh)({site:c,docId:t.id});let{editor:u}=(0,tH._)(),x=(0,M.CG)(L.hN),h=!!s&&!d&&!t.site,m=!!(s&&0!==s.workspaceMemberships.length&&!t.site),p=(0,e7.ye)("docCustomCode")&&a;return r?(0,l.jsxs)(t$.q,{zIndex:"popover",maxH:"100vh",minW:"280px",maxW:"360px",overflow:"auto",children:[(0,l.jsxs)(nV.k,{children:[c?(0,l.jsx)(sZ,{doc:t,site:c}):(0,l.jsx)(sV,{doc:t}),(0,l.jsx)(nW.R,{}),x&&(0,l.jsx)(ov,{editor:u}),a&&(0,l.jsx)(oj,{doc:t}),t.site&&(0,l.jsx)(ri,{editorWrapperEl:i,scrollingParentSelector:n}),(0,l.jsx)(of,{}),a&&u&&(0,l.jsx)(lI,{editor:u,withDrawer:!0}),o&&!!s&&(0,l.jsx)(sq,{}),p&&(0,l.jsx)(sL,{editor:u})]}),c?(0,l.jsx)(nW.R,{}):null,(0,l.jsxs)(nV.k,{children:[c&&(0,l.jsx)(l_,{site:c}),c?null:(0,l.jsx)(nW.R,{}),h&&(0,l.jsx)(sP,{doc:t}),d&&(0,l.jsx)(on,{doc:t}),m&&(0,l.jsx)(sB,{doc:t,editor:u}),d&&(0,l.jsx)(nX,{site:c}),!t.site&&d?(0,l.jsx)(sF,{doc:t}):null]})]}):(0,l.jsxs)(t$.q,{zIndex:"popover",maxH:"100vh",minW:"280px",overflow:"auto",children:[c?(0,l.jsx)(l_,{site:c}):(0,l.jsx)(sV,{doc:t}),(0,l.jsx)(ob,{})]})},ob=()=>(0,l.jsx)(t$.q,{zIndex:"popover",maxH:"100vh",minW:"280px",overflow:"auto",children:(0,l.jsx)(tB.V,{label:(0,l.jsx)(h.cC,{id:"IdcoRx"}),isConnected:!1,maxWidth:"300px"})}
1),oy=e=>{let{isDisabled:t,onClick:i,isPublishing:n}=e;return(0,l.jsx)(ep.kH,{placement:"top",label:(0,l.jsx)(h.cC,{id:"Bq2yPr"}),shouldWrapChildren:!0,isDisabled:!t,children:(0,l.jsx)(nH.s,{icon:(0,l.jsx)(d.xu,{children:(0,l.jsx)(x.G,{icon:u.PQh,fixedWidth:!0})}),onClick:i,closeOnSelect:!1,isDisabled:n||t,children:(0,l.jsxs)(o.k,{direction:"row",w:"100%",justify:"space-between",align:"center",children:[(0,l.jsx)(h.cC,{id:"jNnwuI"}),n&&(0,l.jsx)(tP.$,{size:"xs"})]})})})},ok=e=>{let{title:t,path:i}=e;return(0,l.jsxs)(l.Fragment,{children:[t?"".concat(t," "):"",i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(lL.E,{as:"span",fontFamily:"mono",children:i})," "]})]})},ow=e=>{let{onClose:t,doc:i,site:n,path:r}=e,{push:s}=(0,eg.useRouter)(),[o,{loading:d}]=(0,v.nRC)(),c=(0,iR.p)(),u=(0,M.CG)(eE.B$),x=(0,j.useCallback)(async()=>{if((null==i?void 0:i.id)&&n){if(await o({variables:{id:i.id},refetchQueries:["GetSite","GetDoc"]}),c({title:(0,l.jsx)(h.cC,{id:"oMgC5V"}),description:(0,l.jsx)(h.cC,{id:"gw6aHP",components:{0:(0,l.jsx)(ok,{title:null==i?void 0:i.title,path:r})}}),status:"success",duration:1e4,position:"top",isClosable:!0}),u===i.id){let e=(0,ev.hm)({site:n,docId:i.id});e&&await s(e)}t()}},[null==i?void 0:i.id,null==i?void 0:i.title,n,u,o,c,r,t,s]);return(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(nK.u_,{onClose:t,isOpen:!0,size:"xl",children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{children:[(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"kbKU/5"})}),(0,l.jsx)(tc.o,{isDisabled:d}),(0,l.jsx)(tu.f,{children:(0,l.jsxs)(tT.K,{spacing:4,children:[(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"YOtIqx",values:{0:null==i?void 0:i.title,1:r&&(0,l.jsx)(lL.E,{as:"span",fontFamily:"mono",colorScheme:"blackAlpha",children:r})}})}),(0,l.jsx)(a.x,{color:"red.500",children:(0,l.jsx)(h.cC,{id:"2xOCJW"})})]})}),(0,l.jsx)(tx.m,{children:(0,l.jsxs)(em.h,{children:[(0,l.jsx)(eh.z,{variant:"ghost",onClick:t,children:(0,l.jsx)(h.cC,{id:"dEgA5A"})}),(0,l.jsx)(eh.z,{variant:"ghost",colorScheme:"red",onClick:x,isLoading:d,children:(0,l.jsx)(h.cC,{id:"O1M1zi"})})]})})]})]})})},oS=e=>{var t;let{site:i,doc:n,path:r}=e,{isOpen:s,onOpen:o,onClose:a}=(0,w.q)({id:"confirm-remove-page-modal"}),c=(null==i?void 0:i.routes)&&(null==i?void 0:null===(t=i.routes)||void 0===t?void 0:t.length)>1;return(0,l.jsxs)(l.Fragment,{children:[s&&(0,l.jsx)(ow,{site:i,doc:n,path:r,onClose:a}),(0,l.jsx)(ep.kH,{placement:"top",isDisabled:c,label:(0,l.jsx)(h.cC,{id:"PBFhJK"}),shouldWrapChildren:!0,children:(0,l.jsx)(nH.s,{color:"red.500",isDisabled:!c,icon:(0,l.jsx)(d.xu,{children:(0,l.jsx)(x.G,{icon:u.XAH,fixedWidth:!0})}),onClick:o,children:(0,l.jsx)(h.cC,{id:"cnGeoo"})})})]})},oE=e=>{let{site:t,doc:i,route:n,isTopToolbar:r=!1,hasChanges:s,onToggleOffline:o,...a}=e,{openPageSetup:c}=(0,lv.AA)(),{editor:m}=(0,tH._)(),{replace:p}=(0,eg.useRouter)(),{isConnected:g}=(0,v.$gs)(),j=(null==i?void 0:i.id)&&(0,eA.Rh)({site:t,docId:i.id}),{publishDoc:f,isPublishing:C}=iH({doc:i,site:t,path:j}),b=(0,eA.Vr)(t),y=(0,M.CG)(L.yx),k=(0,eY.py)("edit",y),w=(0,eY.py)("edit",y),S=(0,eY.py)("manage",y),E=(0,ek.O1)(),I=(0,M.CG)(L.hN);return g?(0,l.jsx)(nz.h,{children:i&&(0,l.jsxs)(t$.q,{...a,zIndex:"popover",maxH:"100vh",minW:"280px",maxW:"380px",overflow:"auto",children:[(0,l.jsx)(sZ,{doc:i,site:t,showCreatedInfo:!0}),(0,l.jsx)(nW.R,{}),E&&!n.offline&&(s||C)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(oy,{onClick:f,isDisabled:!b,isPublishing:C}),(0,l.jsx)(nW.R,{})]}),!!o&&(0,l.jsx)(nH.s,{onClick:o,icon:(0,l.jsx)(d.xu,{children:(0,l.jsx)(x.G,{icon:n.offline?u.gMD:u.uoY,fixedWidth:!0})}),children:n.offline?(0,l.jsx)(h.cC,{id:"i/zQgj"}):(0,l.jsx)(h.cC,{id:"ySCSAn"})}),(0,l.jsx)(nH.s,{icon:(0,l.jsx)(d.xu,{children:(0,l.jsx)(x.G,{icon:ij.sl_,fixedWidth:!0})}),onClick:()=>{let e=(0,ev.yQ)({docId:i.id,preview:!0});p(e,void 0,{shallow:!0})},children:(0,l.jsx)(h.cC,{id:"rdUucN"})}),(0,l.jsx)(nW.R,{}),w&&m&&(0,l.jsx)(lI,{onClick:()=>c(n.docId,"cards"),withDrawer:r,editor:m}),w&&m&&(0,l.jsx)(lI,{icon:(0,l.jsx)(x.G,{icon:u.Lc0,fixedWidth:!0}),onClick:()=>c(n.docId,"preview"),label:(0,l.jsx)(h.cC,{id:"hInFGi"}),editor:m}),I&&r&&(0,l.jsx)(ov,{editor:m}),k&&r&&(0,l.jsx)(oj,{doc:i}),S&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nW.R,{}),(0,l.jsx)(oS,{site:t,doc:i,path:j})]})]})}):(0,l.jsx)(ob,{})};var oI=i(83669);let o_=e=>
1{if(!e)return{path:"untitled-page",title:m.ag._({id:"kveQAJ"})};let t=e.filter(e=>e.path.startsWith("/untitled-page"));if(0===t.length)return{title:m.ag._({id:"kveQAJ"}),path:"untitled-page"};let i=Math.max(...e.map(e=>{let[t,i]=e.path.match(/^\/untitled-page-?(\d+)/)||["","1"];return Number(i)}));return{title:m.ag._({id:"kveQAJ"})+" "+String(i+1),path:"untitled-page-".concat(i+1)}},oA=e=>{let{site:t}=e,i=(0,oI.b)(),{isOpen:n,onClose:r,onOpen:s}=(0,tL.M)({id:"add-page-ai-modal"}),[o,d]=(0,j.useState)(!1),c=(0,j.useCallback)(()=>{s()},[s]),p=(0,j.useCallback)(()=>{let{path:e}=o_(null==t?void 0:t.routes);d(!0),i({path:(0,eA.Is)(e),siteId:null==t?void 0:t.id,routes:null==t?void 0:t.routes}).then(()=>{d(!1)})},[i,null==t?void 0:t.id,null==t?void 0:t.routes]);return(0,l.jsxs)(tJ.v,{children:[(0,l.jsx)(ep.kH,{label:m.ag._({id:"yLRlZm"}),placement:"bottom",children:(0,l.jsx)(tQ.j,{as:I.h,isRound:!0,size:"xs",isLoading:o,onFocus:e=>e.preventDefault(),"data-testid":"add-page",icon:(0,l.jsx)(x.G,{icon:u.r8p}),sx:{span:{flexGrow:0}}})}),(0,l.jsx)(nz.h,{children:(0,l.jsx)(t$.q,{maxW:"350px",zIndex:"tooltip",children:(0,l.jsxs)(nV.k,{title:m.ag._({id:"yLRlZm"}),children:[(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:ij.JyM,fixedWidth:!0}),onClick:c,children:(0,l.jsxs)(ex.U,{align:"flex-start",children:[(0,l.jsxs)(tT.K,{spacing:0,children:[(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"OppH33"})}),(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"P/o+t+"})})]}),(0,l.jsx)(nN.L,{}),(0,l.jsx)(sD.C,{h:"fit-content",colorScheme:"trueblue",ml:2,children:(0,l.jsx)(h.cC,{id:"jsQZMk"})})]})}),(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.r8p,fixedWidth:!0}),onClick:p,children:(0,l.jsxs)(tT.K,{spacing:0,children:[(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"SSZKB9"})}),(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"S65lUr"})})]})})]})})}),(0,l.jsx)(iQ,{isOpen:n,onClose:r})]})},oT=e=>{if(!e)return{path:"untitled-page",title:m.ag._({id:"kveQAJ"})};let t=e.filter(e=>e.path.startsWith("/untitled-page"));if(0===t.length)return{title:m.ag._({id:"kveQAJ"}),path:"untitled-page"};let i=Math.max(...e.map(e=>{let[t,i]=e.path.match(/^\/untitled-page-?(\d+)/)||["","1"];return Number(i)}));return{title:m.ag._({id:"kveQAJ"})+" "+String(i+1),path:"untitled-page-".concat(i+1)}},oO=e=>{let{isOpen:t,onClose:i,site:n}=e,r=(0,oI.b)(),[s,o]=(0,j.useState)(()=>oT(null==n?void 0:n.routes).title),[d,c]=(0,j.useState)(()=>oT(null==n?void 0:n.routes).path),u=(0,j.useRef)(null),[x,p]=(0,j.useState)(!1),g=(null==n?void 0:n.routes.map(e=>e.path))||[],f=g.includes("/".concat(d)),v=(0,eu.ff)("gray.900","gray.50"),C=(0,j.useCallback)(()=>{x||f||(p(!0),r({title:s,path:(0,eA.Is)(d),siteId:null==n?void 0:n.id,routes:null==n?void 0:n.routes}).then(()=>{p(!1),i()}))},[r,f,x,i,d,null==n?void 0:n.id,null==n?void 0:n.routes,s]);return((0,j.useEffect)(()=>{t&&setTimeout(()=>{u.current&&u.current.select()},50)},[t]),n)?(0,l.jsxs)(nK.u_,{isOpen:t,onClose:i,size:"xl",children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{color:v,children:[(0,l.jsx)(nY.x,{children:(0,l.jsxs)(tT.K,{children:[(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"yLRlZm"})}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",fontWeight:"normal",letterSpacing:"normal",children:(0,l.jsx)(h.cC,{id:"7TUZvz"})})]})}),(0,l.jsx)(tc.o,{}),(0,l.jsx)(tu.f,{children:(0,l.jsxs)(tT.K,{spacing:4,children:[(0,l.jsxs)(i1.NI,{children:[(0,l.jsxs)(ex.U,{justifyContent:"center",children:[(0,l.jsx)(i2.l,{flex:"1",children:(0,l.jsx)(h.cC,{id:"MHrjPM"})}),(0,l.jsx)(lu,{length:s.length||0,idealLength:lp.si,maxLength:lp.S8})]}),(0,l.jsx)(lc.I,{ref:u,value:s,onChange:e=>{o(e.target.value),c((0,lf.IR)(e.target.value))},_placeholder:{opacity:1,color:"gray.500"},onKeyDown:e=>{"Enter"===e.key&&C()}})]}),(0,l.jsxs)(i1.NI,{isInvalid:f,children:[(0,l.jsx)(ex.U,{justifyContent:"center",children:(0,l.jsx)(i2.l,{flex:"1",children:(0,l.jsx)(h.cC,{id:"dq8+qI"})})}),(0,l.jsxs)(ip.B,{children:[(0,l.jsx)(lg.Ui,{children:"/"}),(0,l.jsx)(lc.I,{fontFamily:"mono",value:d,onKeyDown:e=>{"Enter"===e.key&&C()},onChange:e=>{c((0,lf.IR)(e.target.value))}
1,placeholder:m.ag._({id:"bTzMt5"}),_placeholder:{opacity:1,color:"gray.500"}})]}),f&&!x&&(0,l.jsx)(sR.J1,{children:(0,l.jsx)(h.cC,{id:"hw1fjn"})})]})]})}),(0,l.jsx)(tx.m,{children:(0,l.jsxs)(em.h,{children:[(0,l.jsx)(eh.z,{colorScheme:"gray",variant:"ghost",onClick:i,children:(0,l.jsx)(h.cC,{id:"dEgA5A"})}),(0,l.jsx)(eh.z,{onClick:C,isDisabled:f,variant:"solid",isLoading:x,children:(0,l.jsx)(h.cC,{id:"yLRlZm"})})]})})]})]}):(0,l.jsx)(l.Fragment,{})},oP=e=>{let{site:t}=e,{isOpen:i,onClose:n,onOpen:r}=(0,w.q)();return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(d.xu,{bgColor:"gray.50",textAlign:"center",p:4,m:2,children:[(0,l.jsx)(a.x,{fontSize:"sm",children:(0,l.jsx)(h.cC,{id:"6TCEnS"})}),(0,l.jsx)(a.x,{fontSize:"sm",mt:2,fontWeight:"bold",children:(0,l.jsx)(nS.r,{color:"trueblue.600",href:"#",onClick:r,children:(0,l.jsx)(h.cC,{id:"S0WoXy"})})})]}),i&&(0,l.jsx)(oO,{isOpen:i,onClose:n,site:t})]})},oD=e=>{let{icon:t,isSelected:i,children:n,href:r}=e,s=(0,j.useRef)(null),o=(0,eu.ff)("gray.600","gray.50"),a=(0,eu.ff)("trueblue.50","whiteAlpha.100"),c=(0,eu.ff)("gray.900","gray.50"),u=(0,eu.ff)("blackAlpha.50","whiteAlpha.100"),x=(0,eu.ff)("gray.600","gray.50"),h=(0,eu.ff)("trueblue.400","trueblue.200");(0,j.useEffect)(()=>{if(!i||!(null==s?void 0:s.current))return;let{inView:e}=(0,eU.v4)(s.current)||{};e||s.current.scrollIntoView()},[i]);let m=(0,j.useCallback)(e=>{e.target.closest('[data-id="sidebar-item-menu-button"]')&&e.preventDefault(),e.target.closest('[data-id="sidebar-item-menu-list"]')&&e.stopPropagation()},[]);return(0,l.jsx)(ii(),{href:r,passHref:!0,shallow:!0,children:(0,l.jsx)(eh.z,{ref:s,onClick:m,variant:"ghost",justifyContent:"flex-start",fontWeight:"500",w:"100%",size:"sm",color:i?c:o,bgColor:i?a:"transparent",_hover:{bgColor:i?a:u,color:i?c:x},h:"auto",py:1.5,px:2,role:"group",children:(0,l.jsxs)(ex.U,{alignItems:"start",justify:"flex-start",w:"100%",spacing:2,children:[(0,l.jsx)(d.xu,{color:i?h:o,mt:"0.2em",w:4,children:t}),(0,l.jsx)(tT.K,{flex:1,direction:"row",minW:0,align:"start",justifyContent:"flex-start",children:n})]})})})},oR=e=>{let{title:t,children:i}=e;return(0,l.jsxs)(ex.U,{justify:"space-between",children:[(0,l.jsx)(a.x,{fontSize:"sm",fontWeight:"600",px:1,py:1.5,color:"gray.500",children:t}),i&&i]})},oG=(e,t,i)=>i?(0,l.jsx)(tP.$,{size:"xs"}):e?(0,l.jsx)(x.G,{icon:u.t22,fixedWidth:!0}):t?(0,l.jsx)(x.G,{icon:u.BKg,fixedWidth:!0}):(0,l.jsx)(x.G,{icon:u.gMD,fixedWidth:!0}),oz=e=>{let{site:t,isSelected:i,doc:n,route:r,hasChanges:s,onToggleOffline:o}=e,a=(0,eu.ff)("trueblue.50","whiteAlpha.200"),c=(0,eu.ff)("trueblue.100","whiteAlpha.200");return(0,l.jsx)(tJ.v,{modifiers:[{name:"flip",enabled:!0,options:{fallbackPlacements:["right"]}}],children:e=>{let{isOpen:h}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tQ.j,{"data-id":"sidebar-item-menu-button",ml:3,as:I.h,isRound:!0,variant:"ghost",py:2,size:"xs",_hover:{bgColor:i?c:a},icon:(0,l.jsx)(d.xu,{className:"ellipsis-icon",transitionProperty:"common",transitionDuration:"normal",_groupHover:{opacity:1},_hover:{opacity:1},_active:{opacity:1},opacity:h?1:0,children:(0,l.jsx)(x.G,{icon:u.S6C,fixedWidth:!0})})}),(0,l.jsx)(nz.h,{children:(0,l.jsx)(oE,{site:t,doc:n,route:r,hasChanges:s,"data-id":"sidebar-item-menu-list",onToggleOffline:o})})]})}})},oN=e=>{var t;let{route:i,isHome:n,isSelected:r}=e,{docId:s,doc:d}=i,c=(0,tr.gF)(),u=(0,M.CG)(eE.lH),x=(0,M.CG)((0,eE.hZ)(s)),m=(0,j.useRef)(null),p=(0,M.CG)(eE.B$),[g,{loading:f}]=(0,v.qbt)(),C=oG(n,x,f),b="currentColor",y=(0,eu.ff)("gray.500","gray.400"),k=(0,eu.ff)("trueblue.400","trueblue.200"),w=(0,j.useCallback)(async()=>{if(!(null==d?void 0:d.id)||!u)return;let e=!(null==i?void 0:i.offline);await g({variables:{input:{siteId:u.id,docId:d.id,offline:e,path:null==i?void 0:i.path}}})},[null==d?void 0:d.id,i,g,u]);(0,j.useEffect)(()=>{if(!m.current||p!==s)return;let{inView:e}=(0,eU.v4)(m.current)||{};e||m.current.scrollIntoView()},[p,s]);let S=(0,ev.yQ)({docId:s});return(0,l.jsxs)(oD,{icon:C,"data-sidebar-doc":s,isSelected:r,href:S,children:[(0,l.jsxs)(tT.K,{flex:1,spacing:"3px",alignItems:"flex-start",justifyContent:"flex-start",w:"100%",minW:0,children:[(0,l.jsx)(a.x,{textAlign:"left",color:r?k:b,noOfLines:2,maxW:"100%",whiteSpace:"normal",children:(0,sH.$)(null===(t=i.doc)||void 0===t?void 0:t.t
1itle)}),(0,l.jsxs)(ex.U,{color:y,children:[x&&!i.offline?(0,l.jsx)(ep.kH,{label:(0,l.jsxs)(tT.K,{spacing:1,children:[(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"cFW7WD"})}),(0,l.jsx)(a.x,{fontSize:"xs",color:"whiteAlpha.700",children:(0,l.jsx)(h.cC,{id:"qliBJ3"})})]}),placement:"top",children:(0,l.jsx)(o.k,{bg:r?k:b,minW:1.5,minH:1.5,borderRadius:"full"})}):null,(0,l.jsx)(a.x,{mt:"-1px",textAlign:"left",noOfLines:1,fontFamily:n?void 0:"mono",fontSize:"xs",whiteSpace:"normal",wordBreak:"break-all",children:n?(0,l.jsx)(h.cC,{id:"i0qMbr"}):i.path})]})]}),w&&c&&u&&(0,l.jsx)(oz,{site:u,doc:d,route:i,hasChanges:x,isSelected:r,onToggleOffline:w})]})},oM=()=>{let e=(0,M.CG)(eE.lH),{openSiteSettings:t}=(0,lv.AA)(),i=(0,M.CG)(eE.B$),{onlineRoutes:n,offlineRoutes:r}=(0,j.useMemo)(()=>{let t=(null==e?void 0:e.routes)?[...e.routes]:[],i=t.sort(function(e,t){return e.path<t.path?-1:e.path>t.path?1:0}).sort((e,t)=>"/"===e.path?-1:"/"===t.path?1:0);return{onlineRoutes:i.filter(e=>!e.offline),offlineRoutes:i.filter(e=>e.offline)}},[null==e?void 0:e.routes]);return e?(0,l.jsxs)(tT.K,{spacing:2,w:"100%",p:0,children:[(0,l.jsx)(nU,{context:"pages",openSiteSettings:()=>t("website")}),(0,l.jsxs)(oR,{title:(0,l.jsx)(h.cC,{id:"wRR604"}),children:[(0,l.jsx)(nN.L,{}),(0,l.jsx)(oA,{site:e})]}),(0,l.jsxs)(tT.K,{spacing:1,px:0,children:[0===n.length&&(0,l.jsx)(oP,{site:e}),n.map(e=>{let t=e.docId===i;return(0,l.jsx)(oN,{route:e,isHome:"/"===e.path,isSelected:t},e.id)}),r.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(oR,{title:(0,l.jsx)(h.cC,{id:"1DdXjE"})}),r.map(e=>{let t=e.docId===i;return(0,l.jsx)(oN,{route:e,isHome:"/"===e.path,isSelected:t},e.id)})]})]})]}):(0,l.jsx)(l.Fragment,{})},oL=()=>{let e=(0,eT.Yy)();return(0,l.jsx)(ep.Wk,{isDark:e,children:(0,l.jsx)(e$.s,{bg:e?"gray.900":"white",borderRight:"1px solid",borderColor:e?"gray.800":"gray.200","data-panelid":"pages-panel",overflowX:"hidden",px:6,pt:4,children:(0,l.jsx)(oM,{})})})};oL.panelPosition="left";var oF=i(11093);let oU=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"body",i=(0,M.TL)(),n=(0,eU.As)("editor"),r=J(),s=(0,M.CG)(L.yn,e2()),l=(0,M.CG)(L.k8,e2()),o=!!(null==l?void 0:l.pos);(0,j.useEffect)(()=>{if(!e)return;let t=eS()(()=>{s&&i((0,L.Qx)({attached:!1}))},500,{leading:!0}),n=(0,eH.B$)({topOffset:100,requiredCookie:"spotlightScrollDebug=true"});return document.addEventListener("wheel",t,!0),()=>{n(),t.cancel(),document.removeEventListener("wheel",t,!0)}},[e,i,s,o,t]);let a=(0,M.CG)(L.ks,e2());(0,j.useEffect)(()=>{if(!e||a)return;let t=eS()(()=>{if(n.inProgress)return;let t=(0,oF.lI)(e,100,r);if(!t){console.debug("[useHandleScrollAndSelectionChange][handleScroll] Unable to find topPosPct.");return}i((0,L.Us)(t))},250,{trailing:!0,maxWait:500}),s=eS()(()=>{let t=e.state.selection;if(t instanceof n5.c)return;let r=document.querySelector(n.scrollSelector||""),s=null==r?void 0:r.getBoundingClientRect(),l=e.state.selection.from,o=(0,oF.Sh)(e,l);if(!r||!s||!o){console.debug("[useHandleScrollAndSelectionChange][handleSelectionChange] missing data",{domNodeToUse:o});return}let a=o.getBoundingClientRect(),d=e.view.coordsAtPos(l),c=parseFloat(((d.top-a.y)/a.height).toFixed(2));i((0,L.Us)({pos:l,pct:c}))},250,{trailing:!0,maxWait:500});return t(),e.on("selectionUpdate",s),window.addEventListener("scroll",t,!0),()=>{e.off("selectionUpdate",s),window.removeEventListener("scroll",t,!0)}},[e,i,n,a,r])},oW=()=>{let e=(0,iR.p)(),t=(0,M.TL)(),i=(0,j.useCallback)(i=>{let{collaborator:n,localIsFollowing:r,localIsAttached:s}=i,d={attached:!0};r?s?d.following=null:e.closeAll():(d.following=n.sessionId,e.closeAll(),e({duration:2e3,position:"bottom",render:function(){return(0,l.jsxs)(o.k,{bg:"gray.50",p:3,px:6,align:"center",borderRadius:"md",shadow:"md",children:[(0,l.jsx)(rK.q,{size:"sm",src:n.profileImageUrl,border:"solid 2px ".concat(n.color),color:rp()(n.color).isDark()?"white":"black",bg:n.color}),(0,l.jsx)(a.x,{ml:2,children:(0,l.jsx)(h.cC,{id:"lULvWe",values:{0:n.name}})})]})}})),console.debug("[CollaboratorsPanel] Clicked on collaborator ".concat(n.name,". Setting following to ").concat(d)),t((0,L.Qx)(d))},[e,t]);return i},oH=e=>{let{editor:t,collaborators:i,user:n}=e,r=(0,j.useRef)(!1),s=oW(),l=new URLSearchParams(window.location.search),o=l.get("following_id"),a=l.get("follow_on_start");(0,j.useEffect)(()=>
1{if(r.current||!a||(null==n?void 0:n.id)===o||!t)return;let e=i.find(e=>e.id===o);e&&(s({collaborator:e,localIsAttached:!1,localIsFollowing:!1}),r.current=!0)},[o,a,t,i,n,s])},oV="sessionId1",oB=eM.hj.create({addStorage:()=>({user:{}}),addCommands(){return{user:e=>()=>{let t=(0,M.bh)();return this.storage.user=nw()({},this.storage.user,e),t.dispatch((0,L.MU)({sessionId:oV})),t.dispatch((0,L.Tx)({collaborators:[this.storage.user]})),!0}}}}),oK=e=>{var t;let{docId:i,snapshotId:n,scrollingParentSelector:r,onCreate:s,theme:a,hideMadeWithGammaBadge:c=!1}=e,[u]=(0,j.useState)(()=>[nA.F,nO.$1.configure({scrollerSelector:r}),oB,nT._g]),{user:x,isUserLoading:h,anonymousUser:m,color:p}=(0,eY.SE)(),[g,f]=(0,j.useState)(),{data:C,loading:b,error:y}=(0,v.EDv)({variables:{docId:i,snapshotId:n},skip:!n}),k=(0,M.CG)(iU.yx);(0,j.useEffect)(()=>{!h&&g&&g.commands.user({id:(null==x?void 0:x.id)||m.id,color:p.value,sessionId:oV,idleSince:null,name:(null==x?void 0:x.displayName)||m.displayName||"",profileImageUrl:(null==x?void 0:x.profileImageUrl)||"",isReady:!h})},[g,x,p,h,m]);let w=C&&void 0!==C.snapshot&&!b&&k;return(0,l.jsxs)(d.xu,{"data-testid":"public-static-editor-wrapper",flex:"1",height:"100%",children:[!w||y?(0,l.jsxs)(o.k,{direction:"column",height:"100%",flex:"1",bg:"gray.100",alignItems:"center",justifyContent:"center",children:[!w&&(0,l.jsx)(tP.$,{}),y&&(0,l.jsxs)(tO.M,{h:"100%",children:["There was an error loading this ",K.Yc,":"," ",y.message]})]}):(0,l.jsx)(d.xu,{"data-testid":"public-static-editor-wrapper-inner",transitionProperty:"common",transitionDuration:"750ms",transitionTimingFunction:"ease-out",opacity:w?1:0,children:(0,l.jsx)(eO.yE,{doc:k,editorId:"main",docId:i,theme:a||void 0,extensions:u,onCreate:e=>{let{editor:t}=e;f(t),setTimeout(()=>{s&&s(t)},10)},readOnly:!0,initialContent:null===(t=C.snapshot)||void 0===t?void 0:t.content.default,scrollingParentSelector:r})}),g&&(0,l.jsx)(eq,{editor:g,backoffFactor:2}),!c&&(0,l.jsx)(nP.m,{docWorkspace:null==k?void 0:k.organization})]})},oq={[eV.q.DOC_VIEW]:"doc",[eV.q.SLIDE_VIEW]:"present"},oY=e=>{let t=(0,f.I0)(),i=(0,ev.SJ)(),n=i.mode,r=(0,M.CG)(L.gh),s=(0,j.useCallback)(e=>{let t=e||r,{mode:i}=(0,ev.SJ)(),n=oq[t];i!==n&&(0,nc.lO)({query:{...(0,ev.SJ)(),mode:n},emitChange:!1})},[r]);(0,nQ.r)(s,[r]),(0,j.useEffect)(()=>nc.fI.on("changed",()=>s()),[s]),(0,tr.vm)(function(){if(!e)return;let i=n===oq.SLIDE_VIEW?eV.q.SLIDE_VIEW:eV.q.DOC_VIEW,{cardId:r}=(0,ev.sY)();i===eV.q.SLIDE_VIEW&&(r?(console.debug("[useQuerySync] initializeModeFromQuery - Entering slide view -> spotlightCardById:",r),e.commands.spotlightCardById(r)):(console.debug("[useQuerySync] initializeModeFromQuery - Entering slide view -> spotlightCurrentCard"),e.commands.spotlightCurrentCard())),t((0,L.PM)({mode:i})),s(i)},[e,t,n,s],[e])};var oZ=i(58184);let oX=e=>{let t=(0,M.CG)(L.uD),i=(0,M.CG)(L.e0),{handlePresentNavigationEvent:n}=(0,oZ._)(lh.R0.PRESENTER_VIEW_POPUP);(0,j.useEffect)(()=>{if(!t)return;let r=t=>{let{payload:r}=t;if(e)try{let e=JSON.parse(r),{payload:t}=e,{action:s,eventKey:l,method:o,toSessionId:a,fromUserId:d}=t;if(a!==(null==i?void 0:i.sessionId)||d!==(null==i?void 0:i.id))return;switch(s){case"goToCard":{let{cardId:e}=t;if(!e)break;n({eventType:s,eventKey:l,method:o,payload:{cardId:e}});break}case"toggleSpotlight":case"arrowRight":case"arrowLeft":case"arrowDown":case"arrowUp":case"restart":case"toggleExpanded":case"cancelCurrentAction":n({eventType:s,eventKey:l,method:o});break;default:console.warn("[usePresenterViewMessages] Unknown message type",t)}}catch(e){console.error("[usePresenterViewMessages] Error parsing message",e)}};return t.on("stateless",r),()=>{t.off("stateless",r)}},[e,null==i?void 0:i.sessionId,null==i?void 0:i.id,n,t])};var oJ=i(48105),oQ=i(75692),o$=i(63176),o0=i(19376),o1=i(5365),o2=i(6185),o5=i.n(o2),o4=i(68642),o3=i(27875),o9=i.n(o3),o6=i(93814);let o7={easeOutLinear:rg.gA,easeOutSine:rg.vh,easeOutCubic:rg.w2,easeOutCirc:rg.ei,easeOutQuad:rg.hl,easeOutQuart:rg.Y3,easeOutExpo:rg.ad,bezierCustom1:o5()(.13,.97,.035,.73),bezierCustom2:o5()(.105,1.15,.15,.355)},o8={UP:"up",DOWN:"down"},ae=e=>e?+new Date-+new Date(e):1/0,at=(e,t)=>
1{let i=(0,j.useMemo)(()=>new o4.Lethargy(6,120,.3,150),[]),{easing:n="easeOutCubic",touchpadFactor:r=1.5,triggerThreshold:s=1200}=t||{},l=(0,eU.As)("editor"),o=(0,M.CG)(L.i2),a=(0,j.useRef)(null),d=(0,j.useRef)(null),c=(0,j.useRef)(null),u=(0,j.useRef)(!1),x=(0,j.useRef)(null),h=(0,j.useRef)(null),[m,p]=(0,j.useState)(!1),[g,f]=(0,j.useState)(!1),v=(0,j.useRef)({counterTarget:0,counterCurrent:0,direction:o8.DOWN}),C=(0,j.useCallback)(()=>{var e;if(!a.current)return;let{counterTarget:t}=v.current,i=t/s*100,n=(null!=i?i:0)*2.64,r="".concat(n," ").concat(264-n),l=null===(e=a.current.querySelector(".chakra-progress"))||void 0===e?void 0:e.lastElementChild,o=a.current.querySelector(".chakra-progress__indicator");o&&o.setAttribute("stroke-dasharray",r),l&&(l.innerHTML="".concat(i.toFixed(0),"%"))},[s]),b=(0,j.useCallback)(()=>{let e=c.current,t=d.current;if(!t||!e)return;let i=e.querySelector(".chakra-progress__indicator"),r=t.querySelector(".chakra-progress__indicator");if(!i||!r)return;let l=v.current.counterCurrent/s,o=550>ae(h.current),a=(o?1:null!=l?l:0)*264,u="".concat(a," ").concat(264-a),x=56*o7[n](Math.min(l,1)),m=Math.max(56-x,0);e.style.transform="translateY(".concat(m,"px)"),t.style.transform="translateY(-".concat(m,"px)"),r.setAttribute("stroke-dasharray",u),i.setAttribute("stroke-dasharray",u)},[n,s]),y=(0,j.useCallback)(()=>{let e;if(u.current)return;let t=i=>{let n=e?i-e:0;e=i;let r=v.current.counterTarget-v.current.counterCurrent;if(.1>Math.abs(r)){v.current.counterCurrent=v.current.counterTarget,b(),u.current=!1;return}v.current.counterCurrent=(0,rg.t7)(v.current.counterCurrent,v.current.counterTarget,o9()(.3*(60/(n?1e3/n:60)),.3,1)),b(),requestAnimationFrame(t)};requestAnimationFrame(t)},[b]),k=(0,j.useCallback)(()=>{v.current.counterTarget=0,p(!1),f(!1),C(),y()},[y,C]);return(0,j.useEffect)(()=>{let t,n;if(!o||!e)return k();let a=document.querySelector((0,o6.U8)(o));if(!a)return k();let u=t=>{if(t.target.closest("[data-comments-wrapper]"))return;let o=i.check(t);if(null===c.current||null===d.current)return;let a=ae(x.current);if(a<500||a<1e3&&!1===o)return;let u=ae(h.current);if(u<500||u<1e3&&!1===o)return;let m=0===Math.abs(t.deltaY)?v.current.direction:t.deltaY>0?o8.DOWN:o8.UP,g="down"===m?l.isAtBottom():l.isAtTop();if(!g)return;clearTimeout(n);let j=t.wheelDeltaY?t.wheelDeltaY===-3*t.deltaY:0===t.deltaMode,b=Math.abs(void 0!==t.deltaY?t.deltaY:40),w=b*(j?r:1);if(m!==v.current.direction){v.current.direction=m,k();return}f(m===o8.DOWN),p(m===o8.UP),v.current.counterTarget+=w,v.current.direction=m;let S=v.current.counterTarget/s;S>=1?(e.commands.spotlightNextCard(m===o8.UP,m===o8.UP?"bottom":"top"),h.current=+new Date,setTimeout(()=>{k(),C()},250),setTimeout(()=>{h.current=null},1e3)):n=setTimeout(k,500),y(),C()},m=()=>{x.current=+new Date,clearTimeout(t),k(),t=setTimeout(()=>{x.current=null},1e3)};return a.addEventListener("scroll",m),a.addEventListener("wheel",u,{passive:!0}),C(),()=>{a.removeEventListener("scroll",m),a.removeEventListener("wheel",u)}},[e,i,y,n,r,s,l,C,b,k,o]),{debugRef:a,nextCardRef:c,prevCardRef:d,showNextCard:g,showPrevCard:m}},ai=e=>{let{editor:t}=e,i=(0,e7.ye)("debugLogging"),[n,r]=(0,j.useState)("easeOutExpo"),[s,o]=(0,j.useState)(1.5),[a,d]=(0,j.useState)(1200),{debugRef:c,nextCardRef:u,prevCardRef:x,showNextCard:h,showPrevCard:m}=at(t,{easing:n,touchpadFactor:s,triggerThreshold:a}),{prevCard:p,nextCard:g}=(0,M.CG)(e=>{let t=(0,L.i2)(e)||"",i=(0,L.X9)(e),n=i.parents[t]||[],r=n.reduce((e,t)=>e[t],i.tree),s=Object.keys(r),l=null,o=null;return s.forEach((e,n)=>{if(e!==t)return;let r=i.parents[t];0===n?r.length&&(l={cardId:r[r.length-1],isSibling:!1}):l={cardId:s[n-1],isSibling:!0},n===s.length-1?r.length&&(o={cardId:r[r.length-1],isSibling:!1}):o={cardId:s[n+1],isSibling:!0}}),{prevCard:l,nextCard:o}},e2()),f=null==g?void 0:g.cardId,v=null==p?void 0:p.cardId,C=(0,j.useMemo)(()=>{let e=null,i=null;return t&&t.state.doc.descendants(t=>!(0,eW.KH)(t)||(t.attrs.id===v?e=t:t.attrs.id===f&&(i=t),!!(!e&&v)||!!(!i&&f))),{prev:e,next:i}},[t,f,v]);return(0,l.jsxs)(l.Fragment,{children:[i&&(0,l.jsx)(an,{ref:c,setEasing:r,setTouchpadFactor:o,setTriggerThreshold:d}
1),(0,l.jsx)(ar,{ref:x,direction:"up",node:C.prev,enabled:m,offset:16}),(0,l.jsx)(ar,{ref:u,direction:"down",node:C.next,enabled:h,offset:24})]})},an=j.forwardRef((e,t)=>{let{setEasing:i,setTouchpadFactor:n,setTriggerThreshold:r}=e;return(0,l.jsxs)(o.k,{position:"absolute",alignItems:"center",bg:"gray.100",left:2,bottom:16,zIndex:"overlay",borderRadius:"md",border:"solid 2px var(--chakra-colors-trueblue-300)",p:1,children:[(0,l.jsxs)(tJ.v,{closeOnSelect:!1,children:[(0,l.jsx)(tQ.j,{as:eh.z,colorScheme:"trueblue",children:"Options"}),(0,l.jsxs)(t$.q,{minWidth:"240px",children:[(0,l.jsx)(ep.kH,{label:"How much total scrolling work do we need to do to trigger next/prev card?",placement:"right",children:(0,l.jsxs)(a.x,{color:"gray",fontSize:"sm",fontWeight:"600",ml:2,pb:2,children:["Scroll Threshold"," ",(0,l.jsxs)("i",{children:["(default=",1200,")"]})]})}),(0,l.jsxs)(o$.Y2,{defaultValue:1200,min:100,max:1e4,precision:0,step:100,onChange:(e,t)=>r(t),children:[(0,l.jsx)(o$.zu,{}),(0,l.jsxs)(o$.Fi,{children:[(0,l.jsx)(o$.WQ,{}),(0,l.jsx)(o$.Y_,{})]})]}),(0,l.jsx)(nW.R,{}),(0,l.jsx)(ep.kH,{label:"How much extra weight do we give to touchpad scroll events?",placement:"right",children:(0,l.jsxs)(a.x,{color:"gray",fontSize:"sm",fontWeight:"600",ml:2,pb:2,children:["Touchpad Multiplier"," ",(0,l.jsxs)("i",{children:["(default=",1.5,")"]})]})}),(0,l.jsxs)(o$.Y2,{defaultValue:1.5,min:1,max:10,precision:1,step:.1,onChange:(e,t)=>
1n(t),children:[(0,l.jsx)(o$.zu,{}),(0,l.jsxs)(o$.Fi,{children:[(0,l.jsx)(o$.WQ,{}),(0,l.jsx)(o$.Y_,{})]})]}),(0,l.jsx)(nW.R,{}),(0,l.jsxs)(t0._,{defaultValue:"easeOutExpo",title:"Easing (of peek element)",type:"radio",onChange:e=>i(e),children:[(0,l.jsx)(t1.i,{value:"easeOutLinear",children:"easeOutLinear"}),(0,l.jsx)(t1.i,{value:"easeOutSine",children:"easeOutSine"}),(0,l.jsx)(t1.i,{value:"easeOutCubic",children:"easeOutCubic"}),(0,l.jsx)(t1.i,{value:"easeOutCirc",children:"easeOutCirc"}),(0,l.jsx)(t1.i,{value:"easeOutQuad",children:"easeOutQuad"}),(0,l.jsx)(t1.i,{value:"easeOutQuart",children:"easeOutQuart"}),(0,l.jsx)(t1.i,{value:"easeOutExpo",children:"easeOutExpo"}),(0,l.jsx)(t1.i,{value:"bezierCustom1",children:"bezierCustom1"}),(0,l.jsx)(t1.i,{value:"bezierCustom2",children:"bezierCustom2"})]})]})]}),(0,l.jsx)(o.k,{ref:t,direction:"column",alignItems:"center",width:"85px",ml:1,sx:{".chakra-progress__indicator":{transition:"none !important",opacity:1}},children:(0,l.jsx)(o0.D,{value:40,color:"trueblue.500",children:(0,l.jsx)(o1.i,{})})})]})});an.displayName="PeekDebugger";let ar=j.forwardRef((e,t)=>{let{direction:i,enabled:n,node:r,offset:s}
1=e,[d,c]=(0,j.useState)(!1),[h,m]=(0,j.useState)(r);(0,j.useEffect)(()=>{c(!0);let e=setTimeout(()=>{c(!1),m(r)},550);return()=>{clearTimeout(e)}},[r]);let p=(0,j.useMemo)(()=>h?(0,os.getCardTitle)(h.toJSON()):"",[h]),g=!!h;return(0,l.jsx)(o.k,{ref:t,pointerEvents:"none",position:"absolute",justifyContent:"center",width:"100%",zIndex:"overlay",top:"up"===i?"".concat(s,"px"):"inherit",bottom:"down"===i?"".concat(s,"px"):"inherit",children:(0,l.jsxs)(o.k,{bg:"gray.100",borderRadius:"md",boxShadow:"md",h:"".concat(40,"px"),maxWidth:"450px",justifyContent:"center",opacity:n?1:0,transition:"opacity ".concat(300,"ms ease-out"),textAlign:"center",alignItems:"center",direction:"row",px:2,sx:{".chakra-progress__indicator":{transition:"none !important",opacity:1}},children:[(0,l.jsx)(o0.D,{display:g?"block":"none",color:"trueblue.500",size:"20px",thickness:"16px",children:(0,l.jsx)(o1.i,{visibility:d?"visible":"hidden",children:(0,l.jsx)(x.G,{icon:u.fV7,fontSize:"14px",style:{color:"var(--chakra-colors-gray-100)",backgroundColor:"var(--chakra-colors-trueblue-500)",borderRadius:"10px"}})})}),g||"up"!==i?g||"down"!==i?null:(0,l.jsx)(x.G,{icon:u.m5q,size:"xs",color:"var(--chakra-colors-gray-600)"}):(0,l.jsx)(x.G,{icon:u.ytF,size:"xs",color:"var(--chakra-colors-gray-600)"}),(0,l.jsx)(o.k,{width:1}),(0,l.jsx)(a.x,{noOfLines:1,textOverflow:"ellipsis",overflowX:"hidden",fontSize:"md",color:g?"gray.800":"gray.600",px:2,children:g?p:"down"===i?"End of presentation":"Start of presentation"})]})})});ar.displayName="PeekCardTab";let as=()=>{let[e,t]=(0,j.useState)(["",[],{}]),i=(0,M.qr)();return(0,j.useEffect)(()=>i.subscribe(()=>{let e=i.getState(),n=(0,L.X9)(e),r=(0,L.i2)(e)||"",s=n.parents[r]||[],l={};Object.keys(n.tree).forEach(e=>{let t=[],i=e=>{Object.keys(e).forEach(n=>{t.push(n),i(e[n])})};i(n.tree[e]),l[e]=t}),t([r,s,l])}),[i]),e},al=()=>{let[e,t,i]=as(),n=Object.keys(i);return(0,l.jsx)(ex.U,{position:"fixed",bottom:0,w:"100vw",zIndex:10,background:"blackAlpha.200",px:"6px",py:"2px",align:"end",spacing:"2px",opacity:e?1:0,transitionProperty:"opacity",transitionDuration:"normal",children:n.map((r,s)=>{let o=[...t,e][0],a=n.indexOf(o),d=i[o],c=0,u=100;if(e&&d&&-1===n.indexOf(e)){let t=d.indexOf(e);c=(t+1)/d.length*100,u=1/d.length*100}return(0,l.jsx)(ad,{cardId:r,state:s===a?"current":s<=a?"prev":"next",percent:c,unit:u},r)})})},ao="var(--chakra-colors-trueblue-200)",aa="var(--chakra-colors-trueblue-100)",ad=e=>{let{cardId:t,state:i,percent:n,unit:r}=e,s="linear-gradient(to right, ".concat(ao," 0% ").concat(n,"%, ").concat("var(--chakra-colors-trueblue-300)"," ").concat(n,"% ").concat(n+r,"%, ").concat(aa," ").concat(n+r,"% 100%)");return(0,l.jsx)(o.k,{borderRadius:"2px",flex:"1",h:"6px",bg:"current"===i?s:"prev"===i?ao:aa},t)},ac=(0,ie.ZP)("Esc"),au=e=>{let{editor:t,showNavigationControls:i}=e,n=(0,f.v9)(L.gh),r=n===eV.q.SLIDE_VIEW,[s,d]=(0,j.useState)(null),c=(0,f.v9)(L.JA),u=(0,j.useRef)(c),x=(0,f.I0)(),m=r&&!c,p=(0,oQ.tE)({enabled:m,setActiveKey:d});return oX(t),(0,j.useEffect)(()=>{x((0,L.e)({isEditingInSlideView:!1}))},[r,x]),u.current=c,(0,j.useEffect)(()=>ej.F7.on("keydown","SLIDE_VIEW",e=>!!(u.current&&ac(e))&&(x((0,L.e)({isEditingInSlideView:!1})),e.preventDefault(),!0)),[x]),(0,oJ.us)(),(0,l.jsxs)(l.Fragment,{children:[r&&(0,l.jsx)(ai,{editor:t}),r&&(0,l.jsx)(al,{}),r&&(0,l.jsx)(o.k,{position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none",justify:"flex-end",children:(0,l.jsxs)(o.k,{bg:"gray.50",position:"fixed",bottom:6,right:6,p:3,px:6,justify:"flex-end",align:"center",opacity:c?1:0,pointerEvents:c?"auto":"none",transitionProperty:"opacity, transform",transitionDuration:"normal",transitionTimingFunction:"ease",transform:c?"translate(0,0)":"translate(0,100%)",borderRadius:"md",shadow:"md",zIndex:"overlay",children:[(0,l.jsx)(a.x,{size:"sm",mr:3,children:(0,l.jsx)(h.cC,{id:"DjD/sG"})}),(0,l.jsx)(eh.z,{size:"sm",variant:"solid",onClick:()=>x((0,L.e)({isEditingInSlideView:!1})),children:(0,l.jsx)(h.cC,{id:"DPfwMq"})})]})}),r&&i&&(0,l.jsx)(oQ.nP,{activeKey:s,spotlightingByBlock:p})]})};var ax=i(50423);let ah={duration:.25,delay:.75},am={duration:.25},ap="filmstrip-root",ag=".".concat(ap),aj="filmstrip-scroller",af=".".concat(aj),av=j.createContext({navItemPreviewRefMap:{}});function aC(){let e=(0,j.useContext)(av);return e}var ab=i(76643),ay=i(6110),ak=i(22662),aw=i(791),aS=i(17007);let aE=e=>{let{content:t,selection:i}=(0,aw.i)(e),n=!!(null==t?void 0:t.content),r=(0,j.useMemo)(()=>{var e;if(!n)return[];let i=t.content,r=(null==i?void 0:i[0].content)||[],s=null===(e=t.content)||void 0===e?void 0:e[0].attrs;return r.map(e=>{var t;if(!s||!(null===(t=e.attrs)||void 0===t?void 0:t.id))return null;let i={cardId:e.attrs.id,isDragging:!1,displayBehavior:"normal"};return i}).filter(e=>null!==e)},[t,n]),s=(0,M.CG)(aS.ZD,(e,t)=>e2()(e,t)),l=s.map(e=>{let t=r.find(t=>t.cardId===e.cardId);if(!t)return null;let i={...e};return i}).filter(e=>null!==e),o=(0,M.CG)(aS.Ae);return{isDragging:o,cards:o?l:r,editorContent:t,selection:i,isLoaded:n}};var aI=i(66028);let a_=e=>({backgroundColor:e?"gray.700":"gray.200",activeButtonColor:e?"gray.50":"trueblue.500",inactiveButtonColor:e?"gray.50":"gray.900",closeButtonColorScheme:e?"gray":"blackAlpha"}),aA=e=>{let{onClose:t,isDark:i,viewPreference:n,setViewPreference:r}=e,s="list"===n,{activeButtonColor:a,inactiveButtonColor:d,backgroundColor:c,closeButtonColorScheme:p}=a_(i),g=(0,ez.z$)(),f=(0,j.useCallback)(e=>()=>{r(e),null==g||g.track(ez.AA.FILMSTRIP_TOGGLE_VIEW,{view:e})},[g,r]);return(0,l.jsxs)(o.k,{p:"8px",pb:"2px",children:[(0,l.jsxs)(ex.U,{spacing:0,bg:c,p:.5,borderRadius:"md",children:[(0,l.jsx)(ep.kH,{label:"Filmstrip view",children:(0,l.jsx)(eh.z,{size:"xs",variant:s?"ghost":"plain",color:s?d:a,onClick:f("film"),"data-testid":"filmstrip-view-button",children:(0,l.jsx)(ex.U,{children:(0,l.jsx)(x.G,{icon:u.CjD})})})}),(0,l.jsx)(ep.kH,{label:"List view",children:(0,l.jsx)(eh.z,{size:"xs",variant:s?"plain":"ghost",color:s?a:d,onClick:f("list"),"data-testid":"list-view-button",children:(0,l.jsx)(ex.U,{children:(0,l.jsx)(x.G,{icon:u.Zrf})})})})]}),(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"C8DFL7"}),shortcut:"Mod+\\",children:(0,l.jsx)(I.h,{variant:"ghost","aria-label":m.ag._({i
1d:"C8DFL7"}),"data-testid":"close-filmstrip-button",colorScheme:p,isRound:!0,size:"xs",icon:(0,l.jsx)(x.G,{icon:u.g82}),outlineOffset:"0px",ml:"auto",onClick:e=>{e.stopPropagation(),t()},onMouseDown:aI.br})})]})};var aT=i(73208),aO=i(65895),aP=i(38564),aD=i(56143),aR=i(43818),aG=i(50381),az=i.n(aG),aN=i(9850),aM=i.n(aN),aL=i(86323),aF=i(50105),aU=i(33169),aW=i(87008),aH=i(38322);let aV=(e,t)=>{let i=aP.Gk.getState(e.state).undoManager,n=i.undoStack[i.undoStack.length-1];n&&n.meta.set("filmstripState",t)},aB=e=>{let t=(0,M.CG)(ak.wg),i=(0,M.CG)(ak.zq),n=(0,M.TL)(),r=(0,iR.p)(),s=(0,j.useCallback)((i,n,s)=>{var o;if(!e)return;let a=(0,eW.Lz)(e,t);if(!a.length)return;let d=tm.HY.from(a),c=(0,aW.G8)(d,e.schema);if(!c){r({title:(0,l.jsx)(h.cC,{id:"fFgBN7",values:{errorMessage:n}}),status:"error",duration:3e3,position:"top"});return}null===(o=document.getSelection())||void 0===o||o.removeAllRanges(),az()(c,{format:"text/html"});let u=aF.Z.getState(e.state);u&&!s&&u.clearCutData(),r({title:(0,l.jsx)(h.cC,{id:"8p/xVT",values:{0:a.length,1:i.one,2:i.other}}),status:"success",duration:3e3,position:"top"})},[e,t,r]),o=(0,j.useCallback)(()=>{s({one:"Copied card.",other:"Copied ".concat(t.length," cards.")},"Error copying card.",!1)},[s,t]),d=(0,j.useCallback)(function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!e)return;let r=(0,ak.ym)((0,M.bh)().getState());n((0,ak.jf)()),e.commands.deleteCardsById(t,i),aV(e,r)},[n,e,t]),c=(0,j.useCallback)(()=>{if(!e)return;let i="";if(1===t.length){let n=(0,eW.Bw)(e,t[0]);n&&(i=(0,aR.getCardTitle)(n.node.toJSON())||"")}d();let n=i?'"'.concat(i,'"'):m.ag._({id:"FyJPFh"}),s=r({title:(0,l.jsxs)(ex.U,{children:[(0,l.jsx)(a.x,{noOfLines:1,children:(0,l.jsx)(h.cC,{id:"OJTPnC",values:{displayTitle:n,0:t.length,1:t.length}})}),(0,l.jsx)(nS.r,{textDecoration:"underline",onClick:()=>{(0,aD.Yw)(e.state),r.close(s)},children:(0,l.jsx)(h.cC,{id:"9uI/rE"})})]}),status:"info",duration:3e3,position:"top"})},[d,e,t,r]),u=(0,j.useCallback)(()=>{s({one:"Cut card.",other:"Cut ".concat(t.length," cards")},"Error cutting card.",!0),d(!0)},[d,s,t]),x=(0,j.useCallback)(()=>{if(!e)return;let s=(0,eW.Lz)(e,t);if(s.length){let t=(0,eW.Bw)(e,i),o=t?t.pos+t.node.nodeSize:e.state.doc.content.size-1,a=s.map(e=>(0,eI.hs)(aM()(e.toJSON()))),d=a.map(e=>(0,aU.Zs)(e)),c=(0,ak.ym)((0,M.bh)().getState());e.chain().insertContentAt(o,d,{updateSelection:!1}).command(e=>{let{tr:t}=e,i=(0,aH.t)(t.doc.resolve(o));return i&&(t=t.setSelection(i)),!0}).scrollIntoView().run(),aV(e,c),n((0,ak.xi)({beforeCardId:null==t?void 0:t.node.attrs.id,cardCount:d.length})),r({title:(0,l.jsx)(h.cC,{id:"ClnFsQ",values:{0:s.length,1:s.length}}),status:"success",duration:3e3,position:"top"})}},[n,e,i,r,t]),p=(0,j.useCallback)(()=>{if(!e)return;let t=(0,ak.zq)((0,M.bh)().getState()),i=(0,eW.Bw)(e,t);if(!i)return;let{pos:r}=i,s=e.view.state.doc.nodeAt(r);if(!s){console.error("[Filmstrip] Cannot append card. Node unknown");return}let l=r+s.nodeSize,o=aL.e1.blankCard;(0,aL.ZT)({key:"blankCard",nodeName:"card"},lh.fe.FILMSTRIP_CARD_MENU);let a=(0,ak.ym)((0,M.bh)().getState());e.chain().insertContentAt(l,(0,aU.Zs)(o),{updateSelection:!1}).command(e=>{let{tr:t}=e,i=(0,aH.t)(t.doc.resolve(l));return i&&(t=t.setSelection(i)),!0}).scrollIntoView().run(),aV(e,a),n((0,ak.xi)({beforeCardId:null==i?void 0:i.node.attrs.id,cardCount:1}))},[n,e]);return{handleAddCard:p,handleCopy:o,handleDelete:c,handleCut:u,handleDuplicate:x}},aK=e=>{let{children:t,icon:i,onClick:n,shouldHide:r=!1,...s}=e;return r?null:(0,l.jsx)(nH.s,{icon:i,onClick:n,...s,children:t})},aq=(0,j.memo)(e=>{let{isDark:t}=e;return(0,l.jsxs)(d.xu,{as:"span",className:"fa-layers fa-fw",children:[(0,l.jsx)(x.G,{fixedWidth:!0,icon:u.lCX}),(0,l.jsx)(x.G,{icon:ij.diR,transform:"shrink-4 right-6 down-4",color:"var(--menu-bg, white)"}),(0,l.jsx)(x.G,{icon:ij.diR,transform:"shrink-7 right-6 down-4"}),(0,l.jsx)(x.G,{icon:ij.r8p,color:t?"var(--chakra-colors-gray-800)":"var(--chakra-colors-gray-100)",transform:"shrink-10 right-6 down-4"})]})});aq.displayName="AddCardIcon";let aY=(e,t)=>{if(0===e.length||!t)return null;if(1===e.length){let i=(0,eW.Bw)(t,e[0]);if(!i)return null;{let e=(0,os.getCardTitle)(i.node.toJSON());return e||"Untitled card"}}return"Multiple cards selected"},aZ=(0,j.forwardRef)((e,t)=>{let{editor:i,isOpen:n,onClose:r,readOnly:s,clearPositioning:o,rootStyles:d,isDark:c}=e,m=(0,M.CG)(L.yx),p=(0,iR.p)(),{handleCopy:g,handleDelete:f,handleCut:v,handleDuplicate:C,handleAddCard:b}=aB(i),y=(0,M.CG)(ak.wg),k=1===y.length,w=(0,j.useMemo)(()=>k?(0,ev.gq)({cardId:y[0],docId:null==m?void 0:m.id,isPresentMode:!1}):"",[null==m?void 0:m.id,k,y]),{onCopy:S}=(0,iG.V)(w),E=(0,j.useCallback)(()=>{S(),p({title:(0,l.jsx)(h.cC,{id:"h5GS+N"}),status:"success",duration:3e3,position:"top"})},[S,p]),I=(0,aO.K)(),_=(0,j.useMemo)(()=>aY(y,i),[i,y]),A=(0,j.useMemo)(()=>c?{"--menu-bg":"var(--chakra-colors-gray-900)","&:focus":{"--menu-bg":"var(--chakra-colors-gray-800)"}}:{},[c]);return(0,l.jsx)(tJ.v,{isOpen:n,onClose:r,children:(0,l.jsxs)(t$.q,{className:"filmstrip-card-menu",onContextMenu:e=>{e.preventDefault()},zIndex:"popover",ref:t,rootProps:{style:d},w:"260px",overflowY:"auto",onTransitionEnd:()=>{n||o()},children:[_&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.x,{pl:3,color:c?"gray.400":"gray.600",noOfLines:1,"data-testid":"filmstrip-card-menu-card-title",children:_}),(0,l.jsx)(nW.R,{})]}),(0,l.jsx)(aK,{"data-testid":"filmstrip-card-menu-item-cut",shouldHide:s,command:(0,ep.cE)("Mod+X"),icon:(0,l.jsx)(x.G,{fixedWidth:!0,icon:u.EQg}),onClick:v,children:(0,l.jsx)(h.cC,{id:"cCd8Bs"})}),(0,l.jsx)(aK,{"data-testid":"filmstrip-card-menu-item-copy",shouldHide:s,command:(0,ep.cE)("Mod+C"),icon:(0,l.jsx)(x.G,{fixedWidth:!0,icon:u.kZ_}),onClick:g,children:(0,l.jsx)(h.cC,{id:"he3ygx"})}),(0,l.jsx)(aK,{"data-testid":"filmstrip-card-menu-item-duplicate",shouldHide:s,command:(0,ep.cE)("Mod+D"),icon:(0,l.jsx)(x.G,{fixedWidth:!0,icon:u.WM4}),onClick:C,children:(0,l.jsx)(h.cC,{id:"euc6Ns"})}),(0,l.jsx)(aK,{"data-testid":"filmstrip-card-menu-item-add-card",shouldHide:s,icon:(0,l.jsx)(aq,{isDark:c}),onClick:b,sx:A,children:(0,l.jsx)(h.cC,{id:"90n2YU"})}),!s&&(0,l.jsx)(nW.R,{}),(0,l.jsx)(aK,{"data-testid":"filmstrip-card-menu-item-copy-link",shouldHide:!k,icon:(0,l.jsx)(aT.x,{isLocked:!I,isDark:c}),onClick:E,children:(0,l.jsx)(h.cC,{id:"F0YmUY"})}),(0,l.jsx)(aK,{"data-testid":"filmstrip-card-menu-item-delete",color:c?"red.300":"red.500",icon:(0,l.jsx)(x.G,{icon:u.XAH,fixedWidth:!0}),onClick:f,shouldHide:s,children:(0,l.jsx)(h.cC,{id:"cnGeoo"})})]})})});aZ.displayName="FilmstripCardMenuComponent";let aX=(0,j.memo)(aZ);var aJ=i(15151),aQ=i(56253);let a$=(0,s6.E)(d.xu),a0=e=>{let{isEditorFocused:t,isFilmstripSelected:i,shouldHide:n,cardId:r,isDraggingCard:s,index:d}=e;return(0,l.jsxs)(o.k,{boxShadow:i?"var(--fs-item-selected-box-sha
1dow)":t?"var(--fs-item-focused-box-shadow)":"var(--fs-item-box-shadow)",transitionProperty:"common",transitionDuration:"normal",borderRadius:"sm",overflow:"hidden",display:n?"none":void 0,children:[(0,l.jsx)(a1,{cardId:r}),(0,l.jsx)(l5.M,{children:!n&&!s&&(0,l.jsx)(a$,{position:"absolute",exit:{opacity:0},transition:{duration:.2},bottom:1,left:1,px:1.5,borderRadius:"md",boxShadow:"base",borderWidth:"1px",borderColor:"var(--fs-item-card-number-border-color)",bg:"var(--fs-item-card-number-background-color)",color:"var(--fs-item-card-number-color)",fontWeight:600,fontSize:"xs",children:(0,l.jsx)(a.x,{children:d})},d)})]})},a1=e=>{let{cardId:t}=e,{navItemPreviewRefMap:i}=aC(),n=(0,M.CG)(L.Pu),r=(0,aJ.J)(n,!1);return(0,l.jsx)(o.k,{className:"filmstrip-nav-item-wrapper",sx:tb.n,css:{"--editor-font-size":"calc(var(--editor-width) / ".concat(aQ.DB,")"),"--thumbnail-min-height":"calc(var(--editor-width) * 0.4)"},justifyContent:"center",overflow:"hidden",pointerEvents:"none",bg:"gray.100",minH:"var(--thumbnail-min-height)",maxH:"calc(var(--editor-width) * 1.5)",w:"var(--editor-width)",children:(0,l.jsx)("div",{className:"ProseMirror",children:(0,l.jsx)(o.k,{className:"doc-content-wrapper",direction:"column",align:"center",sx:r,children:(0,l.jsx)("div",{style:{width:"100%"},ref:e=>{e&&(i[t]=e)}})})})})},a2=e=>{let{cardId:t,index:i,isEditorFocused:n,isFilmstripSelected:r}=e,{title:s}=(0,e4.T)({cardId:t});return(0,l.jsxs)(o.k,{className:"filmstrip-nav-item-wrapper",w:"var(--editor-width)",justifyContent:"flex-start",fontSize:"xs",borderRadius:"sm",boxShadow:r?"var(--fs-text-item-selected-box-shadow)":n?"var(--fs-item-focused-box-shadow)":"var(--fs-item-box-shadow)",color:r?"trueblue.500":void 0,transitionProperty:"common",transitionDuration:"normal",_hover:{".filmstrip-text-item-number":{display:"none"},".filmstrip-text-drag-handle":{display:"block"}},children:[(0,l.jsxs)(o.k,{alignItems:"center",bg:r?"trueblue.100":"var(--fs-text-item-card-number-bg-color)",transitionProperty:"common",transitionDuration:"normal",children:[(0,l.jsx)(d.xu,{className:"filmstrip-text-item-number",w:6,fontSize:i>=1e3?"0.6rem":void 0,textAlign:"center",overflow:"hidden",whiteSpace:"nowrap",children:i}),(0,l.jsx)(d.xu,{className:"filmstrip-text-drag-handle",display:"none",textAlign:"center",w:6,fontSize:"md",_hover:{cursor:"grab"},children:(0,l.jsx)(x.G,{icon:u.Okg})})]}),(0,l.jsx)(o.k,{"data-testid":"filmstrip-text-item-title",p:2,pl:"4px",flex:1,bg:r?"trueblue.50":"var(--fs-text-item-bg-color)",alignItems:"center",overflow:"hidden",transitionProperty:"common",transitionDuration:"normal",children:(0,l.jsx)(a.x,{noOfLines:1,children:s||"Untitled"})})]})},a5=e=>{let{filmstripItemRef:t,cardId:i,isFilmstripSelected:n,currentFocusedCard:r,editor:s,isAnimating:l}=e,o=(0,eU.As)("filmstrip"),a=(0,M.CG)(ak.DM);(0,j.useEffect)(()=>{t.current&&i===r&&((null==s?void 0:s.isFocused)&&!l?o.scrollElementIntoView({element:t.current,offsetFromTop:120}):n&&i===a&&requestAnimationFrame(()=>{if(!t.current||!o.scroller)return;let e=o.scroller.getBoundingClientRect(),i=t.current.getBoundingClientRect(),n=i.top,r=i.bottom,s=i.height,l=0,a=t.current.closest(".reorder-item");if(a instanceof HTMLElement&&(l=a.offsetTop),r>=e.bottom){let e=o.scroller,t=l+s,i=Math.max(0,t-e.clientHeight+4);o.scrollTo({top:i})}else n<=e.top&&o.scrollTo({top:l})}))},[i,r,s,a,n,o,t,l])},a4=()=>{let e=(0,en.i)({lg:100,xl:125,"2xl":150})||100,t=(0,M.CG)(ak.K5),i=null!==t?t:e;return{previewWidth:i,width:i+40,fontSize:i/aQ.DB}},a3=(0,s6.E)(o.k),a9=e=>{let{card:t,index:i,isFirst:n,isEditorFocused:r,currentFocusedCard:s,isFilmstripSelected:o,readOnly:c,shouldHide:u,isDragInProgress:x,numberOfCardsDragging:h,onContextClick:m,editor:p,isAnimating:g,showTextOnly:f}=e,{cardId:v,isDragging:C}=t,b=(0,j.useRef)(null);a5({filmstripItemRef:b,cardId:v,isFilmstripSelected:o,currentFocusedCard:s,editor:p,isAnimating:g});let y=(0,M.TL)(),{previewWidth:k}=a4(),w=(0,j.useCallback)(e=>{if(!v)return;let t=e.shiftKey,i=!t&&(e.metaKey||e.ctrlKey);if(t&&!c)y((0,ak.YC)({id:v,currentFocusedCard:s}));else if(i&&!c)y((0,ak.sY)({id:v}));else{if(x)return;y((0,ak.Ti)({id:v})),y((0,L.Qx)({attached:!1})),p&&(0,il.YS)({cardId:v,editor:p})}},[v,c,y,s,x,p]);return(0,l.jsxs)(d.xu,{className:"filmstrip-item",ref:b,pos:"relative",pt:f?void 0:1,mt:f?1.5:n?void 0:1,onClick:w,onContextMenu:m,cursor:"pointer",userSelect:"none",transitionProperty:"common",transitionDuration:"normal",display:u?"none":void 0,"data-filmstrip-selected":o,"data-filmstrip-view":f?"list":"filmstrip",css:{"--editor-width":"".concat(k,"px")}
1,children:[f&&(0,l.jsx)(a2,{cardId:v,index:i,isFilmstripSelected:o,isEditorFocused:r}),(0,l.jsx)(a0,{shouldHide:f,cardId:v,index:i,isDraggingCard:C,isFilmstripSelected:o,isEditorFocused:r}),(0,l.jsx)(l5.M,{children:h&&(0,l.jsx)(d.xu,{position:"absolute",bottom:0,left:0,transform:"translate(-50%, 50%)",children:(0,l.jsx)(a3,{initial:{scale:.5,opacity:0},exit:{scale:.5,opacity:0},animate:{scale:1,opacity:1},h:5,minW:5,px:1,borderRadius:"full",bg:"trueblue.300",color:"white",fontSize:"xs",fontWeight:600,boxShadow:"sm",justify:"center",align:"center",children:(0,l.jsx)(a.x,{children:h})},"badge-number")})})]})};var a6=i(28316),a7=i(91073);let a8=(0,j.memo)(e=>{let{content:t,theme:i}=e,[n,r]=(0,j.useState)(!1);return((0,j.useEffect)(()=>{requestAnimationFrame(()=>{r(!0)})},[]),n)?(0,l.jsx)(tb.m,{theme:i,content:t,isThumbnail:!0,portalComponent:de}):null}),de=e=>{let{renderers:t}=e,{navItemPreviewRefMap:i}=aC();return(0,l.jsx)(l.Fragment,{children:Object.entries(t).map(e=>{let[t,n]=e,r=n.props.node;if("document"===r.type.name)return null;let s=(0,a7.KH)(r)?i[r.attrs.id]:null;return a6.createPortal(n.reactElement,s||n.element,t)})})};a8.displayName="FilmstripPreviewEditor";var dt=i(33522);let di=(0,j.memo)(e=>{let{onClose:t,isDark:i,isResizing:n,setIsResizing:r}=e,{previewWidth:s}=a4(),a=(0,j.useRef)(null),c=(0,j.useRef)(s),u=(0,j.useRef)(null),x=(0,M.TL)(),h=(0,j.useCallback)(e=>{if(e.preventDefault(),!a.current||!c.current||!u.current)return;let{width:i,x:n}=a.current,r=e.clientX-n,s=i+r;if(s<=30){t();return}let l=o9()(i+r,90,200);l!==c.current&&(c.current=l,u.current.innerHTML="\n .filmstrip-nav-item-wrapper {\n --editor-width: ".concat(l,"px;\n }"))},[t]),m=(0,dt.Z_)(h,30),p=(0,j.useCallback)(e=>{e.preventDefault(),a.current={x:e.clientX,width:c.current},r(!0);let t=()=>{a.current=null,u.current&&(u.current.innerHTML=""),x((0,ak.lh)({width:c.current})),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",t),requestAnimationFrame(()=>{r(!1)})};document.addEventListener("mousemove",m),document.addEventListener("mouseup",t)},[x,r,m]);return(0,l.jsxs)(o.k,{className:"filmstrip-resizer",css:{"--resizer-width":"24px","--resizer-offset":"4px","--drag-handle-width":"4px"},pos:"absolute",top:0,bottom:0,right:"calc(var(--resizer-width) * -1 + var(--resizer-offset))",opacity:0,w:"var(--resizer-width)",bg:i?"whiteAlpha.200":"blackAlpha.200",h:"100%",transitionProperty:"common",transitionDuration:"normal",transitionTimingFunction:"ease",justify:"center",alignItems:"center",borderTopEndRadius:"md",borderBottomEndRadius:"md",boxShadow:"md",_hover:{cursor:"ew-resize"},onMouseDown:p,zIndex:10,children:[(0,l.jsx)("style",{ref:u}),(0,l.jsx)(d.xu,{position:"relative",left:"calc(var(--resizer-offset) - (var(--drag-handle-width) / 2))",bg:"white",borderRadius:"full",w:"var(--drag-handle-width)",h:"40px",opacity:n?1:.6,transitionProperty:"common",transitionDuration:"normal"})]})});di.displayName="FilmstripResizer";let dn=e=>({"--fs-item-border-color":e?"var(--chakra-colors-whiteAlpha-300)":"var(--chakra-colors-gray-200)","--fs-text-item-selected-border-color":"var(--chakra-colors-trueblue-100)","--fs-item-box-shadow":"0 0 0 1px var(--fs-item-border-color)","--fs-item-focused-box-shadow":"0 0 0 2px var(--chakra-ring-color)","--fs-item-selected-box-shadow":"0 0 0 2px var(--chakra-colors-trueblue-300)","--fs-text-item-selected-box-shadow":"0 0 0 1px var(--fs-text-item-selected-border-color)","--fs-item-card-number-border-color":e?"var(--chakra-colors-gray-800)":"var(--chakra-colors-gray-200)","--fs-item-selected-text-color":e?"var(--chakra-colors-trueblue-200)":"var(--chakra-colors-trueblue-500)","--fs-item-card-number-color":e?"var(--chakra-colors-gray-100)":"var(--chakra-colors-gray-800)","--fs-item-card-number-background-color":e?"var(--chakra-colors-gradient-dark)":"var(--chakra-colors-gradient-light)","--fs-text-item-bg-color":e?"var(--chakra-colors-gray-800)":"var(--chakra-colors-gray-100)","--fs-text-item-card-number-bg-color":e?"var(--chakra-colors-gray-700)":"var(--chakra-colors-gray-200)"}),dr=(e,t)=>
1{if(!e||!t)return{id:null,pos:null};let{$from:i,from:n,to:r}=e,s=null,l=null;return i.doc.nodesBetween(n,r,(e,t)=>{let n=i.doc.resolve(t).depth;return!(!s&&(0,eW.KH)(e))||1!==n||(s=e.attrs.id,l=t,!1)}),{id:s,pos:l}},ds=()=>{var e;return!!(null===(e=document.activeElement)||void 0===e?void 0:e.closest(ag))},dl=()=>{let e=(0,j.useRef)(null),[t,i]=(0,j.useState)(!1),[n,r]=(0,j.useState)([0,0]),[s,l]=(0,j.useState)("bottom"),o=(0,M.TL)(),a=(0,j.useCallback)(()=>{i(!1)},[]),d=(0,j.useCallback)(()=>{r([0,0]),l("bottom")},[]),c=(0,j.useCallback)(e=>{i(!0),r(e)},[]),u=(0,j.useCallback)(t=>i=>{var n;i.preventDefault(),o((0,ak.uu)({id:t})),c([i.clientX,i.clientY]);let r=null===(n=e.current)||void 0===n?void 0:n.offsetHeight;if(null==r)return;let s=window.innerHeight<i.clientY+r,a=i.clientY<r;s&&!a?l("top"):s&&a?l("center"):l("bottom")},[o,e,c]),x=(0,j.useMemo)(()=>{var t;let i=n[1],r=null===(t=e.current)||void 0===t?void 0:t.offsetHeight,l=r?window.innerHeight-(i+r+8):void 0,o="center"===s&&l?"translateY(".concat(l,"px)"):"top"===s?"translateY(-100%)":void 0;return{left:n[0],top:n[1],transform:o,transformOrigin:"top"}},[s,n]);return{menuRef:e,isFilmstripCardMenuOpen:t,onFilmstripCardMenuClose:a,handleContextMenu:u,menuRootStyles:x,clearPositioning:d}},da=eS()(e8.YS,200),dd=e=>{let{isFocused:t,readOnly:i,firstFocusedCardId:n,editor:r,isDragging:s}=e,{handleCopy:l,handleDelete:o,handleCut:a,handleDuplicate:d}=aB(r),c=(0,M.TL)(),u=(0,M.qr)();(0,j.useEffect)(()=>eQ.F7.on("keydown","FILMSTRIP",e=>{if(!t)return!1;switch(e.key){case"Escape":if(s)return c((0,aS.vL)()),!0;return!1;case"Backspace":case"Delete":if(!i)return o(),!0;return!1;case"a":case"A":if(!i&&(e.ctrlKey||e.metaKey))return e.preventDefault(),c((0,ak.td)({currentFocusedCard:n})),!0;return!1;case"c":case"C":if(!i&&(e.ctrlKey||e.metaKey))return l(),!0;return!1;case"d":case"D":if(!i&&(e.ctrlKey||e.metaKey))return e.preventDefault(),d(),!0;return!1;case"x":case"X":if(!i&&(e.ctrlKey||e.metaKey))return a(),!0;return!1;case"ArrowDown":{c((0,ak.ut)({direction:"down",withShift:!i&&e.shiftKey,currentFocusedCard:n}));let t=(0,ak.wg)(u.getState()),s=t[0];return!e.shiftKey&&r&&s&&(da({cardId:s,editor:r}),c((0,L.Qx)({attached:!1}))),!0}case"ArrowUp":{c((0,ak.ut)({direction:"up",withShift:!i&&e.shiftKey,currentFocusedCard:n}));let t=(0,ak.wg)(u.getState()),s=t[0];return!e.shiftKey&&r&&s&&(da({cardId:s,editor:r}),c((0,L.Qx)({attached:!1}))),!0}default:return!1}}),[c,n,t,s,o,l,d,a,i,r,u])};var dc=i(3402);let du=e=>{let t=(0,M.qr)(),i=(0,iR.p)(),n=(0,M.TL)();(0,j.useEffect)(()=>{let r=r=>{var s;let o=t.getState();if(!e||!ds()||!(0,L.hN)(o))return;let a=null===(s=r.clipboardData)||void 0===s?void 0:s.getData("text/html");if(!a)return;let{content:d}=(0,dc.T)(a,e.schema),c=d.content.filter(e=>(0,a7.KH)(e));if(c.length){let t=(0,eW.Bw)(e,(0,ak.zq)(o)),s=t?t.pos+t.node.nodeSize:e.state.doc.content.size-1,a=c.map(e=>(0,eI.hs)(aM()(e.toJSON()))),d=a.map(e=>(0,aU.Zs)(e)),u=(0,ak.ym)((0,M.bh)().getState());e.chain().insertContentAt(s,d,{updateSelection:!1}).command(e=>{let{tr:t}=e;t.setMeta("annotationEvent",{type:"filmstrip-paste",insertPos:s});let i=(0,aH.t)(t.doc.resolve(s));return i&&(t=t.setSelection(i)),!0}).scrollIntoView().run(),r.preventDefault(),aV(e,u),n((0,ak.xi)({beforeCardId:null==t?void 0:t.node.attrs.id,cardCount:d.length})),i({title:(0,l.jsx)(h.cC,{id:"3viq5b",values:{0:c.length,1:c.length}}),status:"success",duration:3e3,position:"top"})}};return document.addEventListener("paste",r),()=>{document.removeEventListener("paste",r)}},[n,e,t,i])};var dx=i(30453);let dh=()=>{let e=(0,dx.o)(),t=(0,j.useRef)(null),i=(0,j.useRef)(),n=(0,j.useRef)(),r=(0,j.useRef)(),s=(0,j.useCallback)(e=>{if(!r.current)return;let t=dp(r.current),s=e.target;if(!t||!s||void 0===i.current||void 0===n.current)return;let l=s.scrollTop-i.current;t.y=n.current-l},[]),l=(0,j.useCallback)((e,i)=>{let n=t.current;if(!n)return;let r=n.getBoundingClientRect(),s=i.point.y,l=e.target;if(!(l instanceof Element))return;let o=l.closest("[draggable]"),a=null==o?void 0:o.parentElement;a&&(s<r.top+25&&(o!==a.firstElementChild||n.scrollTop>0)?n.scrollTop-=5:s>r.bottom-25&&(o!==a.lastElementChild||n.scrollTop<n.scrollHeight)&&(n.scrollTop+=5
1))},[]),o=(0,j.useCallback)(()=>{let s=t.current,l=dm(e);if(!s||!l)return;r.current=l,i.current=s.scrollTop;let o=dp(l);o&&(n.current=o.y)},[e]),a=(0,j.useCallback)(()=>{i.current=void 0,n.current=void 0,r.current=void 0},[]);return{scrollerRef:t,onScroll:s,dragControls:e,onDrag:l,onDragStart:o,onDragEnd:a}},dm=e=>{try{return Array.from(e.componentControls).find(e=>e.isDragging)}catch(e){console.error("[caught] findDraggingElementControls",e);return}},dp=e=>{try{return e.panSession.history[0]}catch(e){console.error("[caught] getDraggingElementStartPoint",e);return}},dg=(0,s6.E)(o.k),dj=(0,s6.E)(d.xu),df="data-".concat(iy.dh),dv=e=>({initial:{x:-e},animate:{x:0,transition:ah},exit:{x:-e,transition:am}}),dC=e=>{let{onClose:t,editor:i,readOnly:n}=e,[r,s]=(0,j.useState)(!1),[a,c]=(0,F.I)(U.H.filmstripViewPreference,"film"),u=(0,j.useRef)(null),{cards:x,isDragging:h,editorContent:m,selection:p,isLoaded:g}=aE(i),{id:f}=(0,j.useMemo)(()=>dr(p,i),[i,p]),v=(0,M.TL)(),C=(0,M.CG)(ak.wg),b=(0,M.CG)(aS.pe),y=(0,M.CG)(aS.u9),k=(0,M.CG)(aS.K3),[w,S]=(0,j.useState)(!1),{menuRef:E,isFilmstripCardMenuOpen:I,onFilmstripCardMenuClose:_,clearPositioning:A,handleContextMenu:T,menuRootStyles:O}=dl(),P=(0,j.useCallback)(()=>{if(_(),r){var e;null===(e=u.current)||void 0===e||e.focus()}},[r,_]),{scrollerRef:D,onScroll:R,dragControls:G,onDrag:z,onDragStart:N,onDragEnd:W}=dh(),H=(0,j.useCallback)(e=>()=>{if(S(!0),N(),u.current){let e=u.current.getBoundingClientRect().height;u.current.style.height="".concat(e,"px")}let t=C.includes(e)?C:[e];v((0,ak.WF)({selectedCardIdsToDrag:t})),v((0,aS.CA)({cardIds:x.map(e=>e.cardId),leaderCardId:e,selectedCardIds:t}))},[x,v,C,N]),V=(0,j.useCallback)(()=>{i&&(v((0,aS.vL)()),i.commands.rearrangeCardsById(x.map(e=>e.cardId),y),W())},[x,v,i,y,W]),B=(0,j.useCallback)(()=>{u.current&&(u.current.style.height="auto"),S(!1)},[]);du(i),dd({isFocused:r,readOnly:n,firstFocusedCardId:f,editor:i,isDragging:h}),(0,ab.O)({ref:u,handler(e){E.current&&E.current.contains(e.target)||(I&&_(),v((0,ak.Mt)()))}});let K=(0,M.CG)(L.Pu),q=(0,eu.ff)("whiteAlpha.600","whiteAlpha.100"),Y=(0,eu.ff)("#F9FAFBDD","gray.900"),Z=(0,eu.ff)("gray.800","gray.200"),X=(0,eu.ff)("blackAlpha.400","whiteAlpha.500"),{colorMode:J}=(0,eu.If)(),Q="dark"===J,$=(0,j.useMemo)(()=>dn(Q),[Q]),[ee,et]=(0,j.useState)(!1),{width:ei}=a4(),en=dv(ei),er=(0,j.useMemo)(()=>{let e=y.length;return h&&e>1?e:null}
1,[h,y.length]),[es,el]=(0,j.useState)(!1),eo=(0,eU.As)("filmstrip");return(0,j.useEffect)(()=>{eo.setScrollSelector(af)},[eo]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(o.k,{pointerEvents:"none",position:"absolute",direction:"column",left:2,top:14,bottom:2,justifyContent:"center",color:Z,children:[i&&g&&(0,l.jsx)(a8,{content:m,theme:K}),(0,l.jsxs)(d.xu,{pos:"relative",pointerEvents:"auto",_hover:{".filmstrip-resizer":{opacity:es?0:1}},maxHeight:"100%",children:[(0,l.jsxs)(dg,{ref:u,"data-guider-highlight":"filmstrip",className:ap,[df]:!0,pos:"relative",direction:"column",zIndex:11,...en,onAnimationStart:()=>{el(!0)},onAnimationComplete:()=>{el(!1)},tabIndex:0,_focus:{outline:"none"},onFocus:()=>{s(!0),null==i||i.commands.blur()},onBlur:e=>{var t,i;u.current&&(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||(null===(i=E.current)||void 0===i?void 0:i.contains(e.relatedTarget))||s(!1)},borderRadius:"md",bg:Y,borderWidth:"1px",borderColor:q,shadow:"lg",backdropFilter:"blur(20px)",maxHeight:"100%",alignSelf:"flex-start",children:[(0,l.jsx)(aA,{isDark:Q,onClose:t,viewPreference:a,setViewPreference:c}),(0,l.jsx)(dj,{className:aj,layoutScroll:!0,overflowY:"auto",position:"relative",sx:{"&::-webkit-scrollbar":{opacity:1,width:"5px"},"&::-webkit-scrollbar-track":{opacity:0,width:"5px"},"&::-webkit-scrollbar-thumb":{background:X,borderRadius:"full"},...$},ref:D,onScroll:R,p:"8px",pt:0,children:(0,l.jsx)(ay.t.Group,{onReorder:e=>{let t=e.map(e=>e.cardId);v((0,aS.k)({reorderedCardIds:t}))},values:x,axis:"y",children:i&&g&&x.map((e,t)=>{let{cardId:r,displayBehavior:s}=e,o=C.includes(r),d=k===r;return(0,l.jsx)(ay.t.Item,{drag:!n&&"y",value:e,onDragStart:H(r),onDragEnd:V,onDragTransitionEnd:B,className:"reorder-item",dragControls:G,transition:{layout:{duration:ee?0:void 0}},onDrag:z,style:{position:"relative",listStyle:"none"},children:(0,l.jsx)(a9,{readOnly:n,editor:i,card:e,index:h&&void 0!==b[r]?b[r]:t+1,isFirst:0===t,shouldHide:"hidden"===s,isDragInProgress:w,isEditorFocused:f===r&&i.isFocused,isFilmstripSelected:!!o,currentFocusedCard:f,numberOfCardsDragging:d?er:null,onContextClick:T(r),isAnimating:es,showTextOnly:"list"===a})},r)})})})]}),(0,l.jsx)(di,{onClose:t,isDark:Q,isResizing:ee,setIsResizing:et})]})]}),i&&(0,l.jsx)(aX,{ref:E,editor:i,readOnly:n,isOpen:I,onClose:P,clearPositioning:A,rootStyles:O,isDark:Q})]})},db=()=>{let e=(0,M.TL)(),t=(0,M.CG)(ak.GX),i=(0,en.i)({base:!1,lg:!0}
1)||!1,[n,r]=(0,j.useState)(!1),[s,l]=(0,j.useState)(!1),o=(0,j.useCallback)(()=>{e((0,ak.dQ)({isOpen:!1})),e((0,ak.Mt)()),l(!0)},[e]),a=(0,j.useCallback)(()=>{i||r(!0),e((0,ak.dQ)({isOpen:!0}))},[i,e]),d=!i&&n;return(0,j.useEffect)(()=>{let t=!i&&!n,r=i&&!s;t?e((0,ak.dQ)({isOpen:!1})):r&&e((0,ak.dQ)({isOpen:!0}))},[e,i,n,s]),{onClose:o,onOpen:a,isOpen:t&&(i||!i&&d)}},dy=(0,s6.E)(eh.z),dk=(0,j.memo)(()=>{let{editor:e}=(0,n4._i)(),{isOpen:t,onClose:i,onOpen:n}=db(),r=(0,j.useRef)({navItemPreviewRefMap:{}}),s=(0,iy.Br)("edit"),a=(0,M.CG)(L.hN),d=(0,eT.Yy)(),[c,m]=(0,j.useState)(!1),p=(0,j.useCallback)(()=>{m(!0),setTimeout(()=>{n()}),setTimeout(()=>{m(!1)},750)},[n]);return(0,j.useEffect)(()=>eQ.F7.on("keydown","FILMSTRIP",e=>!!(0,ie.ZP)("Mod+\\")(e)&&(t?i():p(),!0)),[t,i,p]),(0,l.jsx)(av.Provider,{value:r.current,children:(0,l.jsx)(ep.Wk,{isDark:d,children:(0,l.jsx)(l5.M,{children:t?(0,l.jsx)(dC,{onClose:i,editor:e,readOnly:!s||!a},"filmstrip"):(0,l.jsx)(ep.kH,{placement:"top-end",label:(0,l.jsx)(h.cC,{id:"7ShgZt"}),isDisabled:c,shortcut:"Mod+\\",children:(0,l.jsxs)(dy,{initial:{opacity:0}
1,animate:{opacity:1,transition:am},exit:{opacity:0,transition:ah},zIndex:11,css:{"--trigger-height":"var(--chakra-sizes-14)"},tabIndex:-1,position:"fixed",left:2,top:"calc(50% - (var(--trigger-height) / 2) + var(--chakra-sizes-5))",borderRadius:"xl","data-guider-highlight":"filmstrip",h:"var(--trigger-height)",w:8,onClick:p,children:[(0,l.jsx)(ax.TX,{children:(0,l.jsx)(h.cC,{id:"7ShgZt"})}),c?(0,l.jsx)(o.k,{children:(0,l.jsx)(tP.$,{size:"sm"})}):(0,l.jsx)(x.G,{icon:u.CjD})]},"filmstrip-opener")})})})})});dk.displayName="Filmstrip";var dw=i(94207),dS=i(83905),dE=i(26900),dI=i(44631),d_=i(56256);let dA=e=>{let{isOpen:t,onClose:i,onSaveSuccess:n,docId:r}=e,s=(0,iR.p)(),o=(0,j.useRef)(null),[a,d]=(0,j.useState)(""),[c,{loading:u}]=(0,v.D1_)(),x=()=>{c({variables:{id:r,title:a}}).then(()=>{d(()=>""),n()}).catch(e=>{console.error(e),s({title:(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(h.cC,{id:"AToAqe",values:{0:e.message}})}),position:"top",status:"error"})})};return(0,l.jsxs)(nK.u_,{returnFocusOnClose:!1,onClose:i,closeOnOverlayClick:!0,isOpen:t,initialFocusRef:o,children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{children:[(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"kq/0Sg",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})}),(0,l.jsx)(tc.o,{}),(0,l.jsx)(tu.f,{children:(0,l.jsx)(lc.I,{ref:o,value:a,required:!0,placeholder:(0,sH.$)(),onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"===e.key&&x()}})}),(0,l.jsx)(tx.m,{children:(0,l.jsx)(tT.K,{spacing:2,direction:"row",align:"center",children:(0,l.jsx)(eh.z,{isLoading:u,isDisabled:u||!a||!a.length,onClick:()=>{x()},children:(0,l.jsx)(h.cC,{id:"tfDRzk"})})})})]})]})},dT=(0,j.memo)(e=>{let{doc:t}=e,i=(0,j.useCallback)(()=>sK.T.emit("openSharePanel",{view:"invite"}),[]),{isOpen:n,onClose:r,onOpen:s}=(0,tL.M)({id:"analyticsModalDisclosure"}),{isOpen:a,onOpen:d,onClose:c}=(0,tL.M)({id:"titleModalDisclosure"}),p=(0,ez.z$)(),{user:g}=(0,eY.SE)(),f=(0,eY.py)("manage",t)&&!!g,v=(0,j.useCallback)(()=>{t&&(t.title&&""!==t.title?i():d())},[t,i,d]),C=(0,j.useCallback)(e=>()=>{null==p||p.track(ez.AA.DOC_ANALYTICS_VIEWED,{docId:null==t?void 0:t.id,source:e,type:"full"}),s()},[p,null==t?void 0:t.id,s]);return f&&t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.k,{children:(0,l.jsx)(ep.kH,{closeOnMouseDown:!1,closeOnClick:!1,label:(0,l.jsx)(h.cC,{id:"YaUqUV"}),children:(0,l.jsx)(d_.r,{"data-guider-highlight":"view-analytics-button","aria-label":m.ag._({id:"YaUqUV"}),onMouseDown:aI.br,onClick:C("toolbar_analytics_block"),icon:(0,l.jsx)(x.G,{icon:u.Ma4})})})}),a&&(0,l.jsx)(dA,{onClose:c,isOpen:a,onSaveSuccess:()=>{c(),i()},docId:null==t?void 0:t.id}),n&&(0,l.jsx)(sO,{doc:t,onSharePanelOpen:v,onAnalyticsPanelClose:r,isAnalyticsPanelOpen:n,mode:"full"})]}):null});var dO=i(58905),dP=i(75230),dD=i(64951),dR=i(25215),dG=i(58450),dz=i(41421),dN=i(7e4);let dM=(0,s6.E)(o.k),dL=e=>{let{doc:t}=e;return(0,l.jsx)(dM,{initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},children:(0,l.jsx)(l5.M,{initial:!1,children:(0,l.jsx)(dV,{doc:t})})})},dF=(0,j.memo)(e=>{let{doc:t}=e,{editor:i}=(0,n4._i)(),{isConnected:n}=(0,v.$gs)(),r=(0,iR.p)(),s=(0,j.useRef)(null),o=(0,j.useRef)(null),[a,{loading:c}]=(0,v.D1_)(),[u,x]=(0,j.useState)(null),[p,g]=(0,j.useState)(!1),[f,C]=(0,j.useState)(!1),b=(0,eY.py)("edit",t),y=(0,j.useCallback)(()=>{if(!i)return"";let[e]=(0,eM.N2)(i.state.doc,eW.KH);if(!e)return"";let t=(0,os.getCardTitle)(e.node.toJSON());return t||""},[i]);(0,j.useEffect)(()=>{!t||p||c||(x(t.title||""),C(!!t.titleEdited))},[t,p,c]);let k=()=>{s.current.style.width=o.current.offsetWidth+0+"px"},w=(0,eu.ff)("gray.800","gray.200");return(0,l.jsx)(ep.kH,{label:b?n?(0,l.jsx)(h.cC,{id:"2wxgft"}):(0,l.jsx)(h.cC,{id:"Cb+Bgk"}):null,"aria-label":m.ag._({id:"2wxgft"}),children:(0,l.jsxs)(dO.C,{value:u||"",placeholder:u||y(),isDisabled:c||!b||!n,isPreviewFocusable:b,maxW:300,width:"100%",fontWeight:"normal",onCancel:()=>{k(),g(!1)},onFocus:()=>{k(),t&&!c&&g(!0)},onChange:e=>{k(),p&&(x(e),C(!!e))},onSubmit:()=>{if(!t||c)return;g(!1);let e=u||y();a({variables:{id:t.id,title:e,titleEdited:f}}).catch(e=>{console.error(e),r({title:(0,l.jsx)(h.cC,{id:"AToAqe",values:{0:e.message}}),position:"top",status:"error"})})},children:[(0,l.jsx)(dP.w,{px:1,py:.5,display:p?"inline":"block",overflowX:"hidden",textOverflow:"ellipsis",color:f?w:"inherit"}),(0,l.jsx)(dD.V,{ref:s,px:1,py:.5,color:f?w:"inherit",maxW:300,_focus:{outline:"none",shadow:"0 0 0 2px rgb(66 153 225 / 60%)"}}),(0,l.jsx)(d.xu,{ref:o,as:"span",display:"inline-block",position:"absolute",left:"-9999px",opacity:0,zIndex:-1,minW:"180px",px:1,dangerouslySetInnerHTML:{__html:i3().sanitize((u||"").replace(/\s/g," "))}})]})})});dF.displayName="EditableDocTitle";let dU=e=>{let{cardId:t,isEllipsis:i,value:n,onClick:r}=e,s=(0,e4.c)(t);if(i)return(0,l.jsx)(x.G,{icon:u.cNd});if(!t&&!n)return null;let o=n||(null==s?void 0:s.title)||"";return(0,l.jsx)(a.x,{noOfLines:1,onClick:r,maxW:180,fontWeight:"normal",children:o})},dW=e=>{let{isPresentModeFlat:t}=e;return e=>{let i=(0,L.gh)(e),n=(0,L.i2)(e)||"",r=(0,L.X9)(e),s=r.parents[n]||[];if("DOC_VIEW"===i||t)return[{isHome:!0},{isDocTitle:!0}];let l=s[0],o=s[s.length-1];return[{isHome:!0},s.length>1?{cardId:l}:null,s.length>2?{isEllipsis:!0}
1:null,s.length>0?{cardId:o}:null,{cardId:n}]}},dH=()=>{let e=(0,e7.ye)("presentModeFlat"),t=(0,M.CG)(dW({isPresentModeFlat:e}),(e,t)=>JSON.stringify(e)===JSON.stringify(t));return t},dV=(0,j.memo)(e=>{let{doc:t}=e,i=dH(),[n]=(0,dN.X)(U.H.lastHomeUrl,"/"),r=(0,e7.ye)("offline"),{user:s}=(0,eY.SE)(),{isConnected:c}=(0,v.$gs)(),{confirmNavigation:p}=(0,n4._i)(),{push:g}=(0,eg.useRouter)(),j=(0,en.i)({base:"xs",sm:"sm"}),f=(0,eu.ff)("gray.500","gray.400"),C=(0,eu.ff)("gray.800","gray.100");return(0,l.jsxs)(ex.U,{spacing:0,as:eh.z,textAlign:"left",px:0,_hover:{color:C},h:8,bg:"transparent",boxShadow:"none",border:"none",children:[(0,l.jsx)(dR.a,{display:"flex",alignItems:"center",whiteSpace:"nowrap",size:j,spacing:["4px","8px"],separator:(0,l.jsx)(d.xu,{color:"gray.300",mt:["0.2rem","0.125rem"],children:(0,l.jsx)(x.G,{icon:u._tD})}),children:i.map((e,r)=>{if(!e)return null;let o=r===i.length-1,{cardId:a,isEllipsis:d,isDocTitle:c,isHome:h,value:m}=e,j=h?"home":d?"ellipsis":a||m||r;if(h&&!s)return null;let v={as:ii(),href:n||"/",colorScheme:"gray",fontWeight:"normal","data-testid":"toolbar-home-link"};return(0,l.jsx)(dG.g,{children:(0,l.jsx)(dM,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},children:(0,l.jsx)(dz.A,{isCurrentPage:o,pointerEvents:o&&!c?"none":"inherit",color:o?f:"inherit",...h?{...v}:{},children:c?(0,l.jsx)(dF,{doc:t}):h?(0,l.jsx)(nS.r,{href:v.href,onClick:e=>{let t=!e.shiftKey&&(e.metaKey||e.ctrlKey);t||(e.preventDefault(),p().then(()=>{g(v.href)}))},mr:1,children:(0,l.jsx)(x.G,{size:"1x",icon:u.J9Y})}):(0,l.jsx)(dU,{cardId:a,value:m,isEllipsis:d,onClick:()=>{a&&(0,ry.D)({cardId:a,method:"push"})}})})},j)},j)})}),!c&&(0,l.jsx)(ep.kH,{label:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.x,{mr:2,children:(0,l.jsx)(h.cC,{id:"ysdDIA"})}),r&&(0,l.jsx)(a.x,{color:"gray.300",children:(0,l.jsx)(h.cC,{id:"+QNhGE"})})]}),"aria-label":m.ag._({id:"IcHxhR"}),children:(0,l.jsx)(o.k,{color:"gray.300",alignItems:"center",pr:3,children:(0,l.jsx)(x.G,{icon:u.bKP})})})]})});dV.displayName="BreadcrumbGroup";var dB=i(82642),dK=i(62453),dq=i(93274),dY=i(28957);let dZ=()=>{let{user:e,anonymousUser:t}=(0,eY.SE)(),i=(0,f.I0)(),n=(0,iR.p)(),{editor:r}=(0,n4._i)(),{collaborators:d,followers:c}=(0,f.v9)((0,L._h)((null==e?void 0:e.id)||t.id));oH({editor:r,collaborators:d,user:e});let u=(0,f.v9)(L.Ok),x=(0,f.v9)(L.e0),p=(0,f.v9)(L.yn),g=(0,f.v9)(L.gs),v=(0,f.v9)(L.JA);(0,j.useEffect)(()=>{u.forEach(e=>{n({duration:2e3,position:"bottom",render:function(){return(0,l.jsxs)(o.k,{bg:"gray.50",p:3,px:6,align:"center",borderRadius:"md",shadow:"md",children:[(0,l.jsx)(rK.q,{size:"sm",src:e.profileImageUrl,border:"solid 2px ".concat(e.color),color:rp()(e.color).isDark()?"white":"black",bg:e.color,ignoreFallback:!0}),(0,l.jsx)(a.x,{ml:2,children:(0,l.jsx)(h.cC,{id:"DSaSKH",values:{0:e.name}})})]})}})})},[u,n]),(0,j.useEffect)(()=>{let e=!p&&g&&!v;if(!r||!e)return;n.closeAll();let t=n({id:"detached-toast",render:()=>(0,l.jsxs)(o.k,{bg:"gray.50",p:3,px:6,m:4,justify:"flex-end",align:"center",borderRadius:"md",shadow:"md",children:[(0,l.jsx)(a.x,{size:"sm",mr:6,children:(0,l.jsx)(h.cC,{id:"PjodLp"})}),(0,l.jsxs)(em.h,{size:"sm",alignItems:"center",children:[(0,l.jsx)(eh.z,{onClick:()=>{i((0,L.Qx)({attached:!0}))},variant:"solid",children:(0,l.jsx)(h.cC,{id:"f/C2ic"})}),(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"5JWVnj"}),children:(0,l.jsx)(I.h,{isRound:!0,variant:"ghost",size:"xs","aria-label":m.ag._({id:"5JWVnj"}),icon:(0,l.jsx)(dB.T,{}),onClick:()=>{i((0,L.Qx)({attached:!1,following:null}))}})})]})]}),position:"bottom",duration:null});return()=>{n.close(t)}},[r,p,g,v,n,i]),(0,j.useEffect)(()=>{g||!r||r.isDestroyed||i((0,L.Qx)({following:null}))},[r,g,i]);let C=(0,en.i)({base:4,md:6,xl:8})||6,b=C/(c.length?2:1),y=C/(d.length?2:1);return(0,l.jsx)(o.k,{children:(0,l.jsxs)(ex.U,{divider:(0,l.jsx)(dK.c,{borderColor:"gray.200"}),children:[c.length&&(0,l.jsx)(dX,{type:s.FOLLOWERS,collaborators:c,max:y,isEveryone:0===d.length,localCollaborator:x,localIsAttached:p}),d.length&&(0,l.jsx)(dX,{type:s.COLLABORATORS,collaborators:d,max:b,isEveryone:0===c.length,localCollaborator:x,localIsAttached:p})]})})};(r=s||(s={})).FOLLOWERS="FOLLOWERS",r.COLLABORATORS="COLLABORATORS";let dX=e=>{let{collaborators:t,localCollaborator:i,localIsAttached:n,type:r,max:d,isEveryone:c}=e,u=oW(),x=r===s.FOLLOWERS,p=t.length>d,g=p?t.slice(0,d-1):t,j=p?t.length-d+1:0,f=e=>{let{localIsFollowing:t,collaborator:i}=e;x||u({localIsFollowing:t,localIsAttached:n,collaborator:i})};return(0,l.jsx)(dY.S,{children:(0,l.jsxs)(dq.H,{size:"sm",spacing:
1x?-2:0,children:[x&&(0,l.jsx)(dJ,{isEveryone:c}),g.map((e,t)=>{var r;let s=(null==i?void 0:null===(r=i.memoState)||void 0===r?void 0:r.following)===e.sessionId,d=!!e.idleSince,c=!x&&(p||g.length-1!==t);return(0,l.jsx)(ep.Vw,{ignoreFallback:!0,name:e.name,label:(0,l.jsxs)(o.k,{direction:"column",justify:"center",align:"center",children:[(0,l.jsx)(a.x,{children:e.name}),(0,l.jsx)(a.x,{fontSize:"xs",children:x?(0,l.jsx)(h.cC,{id:"iRohzP"}):s&&n?(0,l.jsx)(h.cC,{id:"1QTvS5"}):(0,l.jsx)(h.cC,{id:"2Ldadb"})})]}),pointerEvents:d?"none":"auto",opacity:d?.4:1,transitionProperty:"common",transitionDuration:"normal",src:e.profileImageUrl,border:"solid 2px ".concat(e.color),nubbin:s&&n,bg:e.color,shadow:"base",color:rp()(e.color).isDark()?"white":"black",cursor:x?"":"pointer",boxProps:c?{marginEnd:-2}:{},onClick:()=>f({localIsFollowing:s,collaborator:e})},e.sessionId)}),j>0&&(0,l.jsxs)(ep.Z9,{tooltipLabel:m.ag._({id:"25VyZX"}),onClick:e=>{var n;let r=t.find(t=>t.id===e.id),s=!!(r&&(null==i?void 0:null===(n=i.memoState)||void 0===n?void 0:n.following)===r.sessionId);f({localIsFollowing:s,collaborator:r})},avatars:t,count:j,disabled:x,children:[(0,l.jsx)(a.x,{px:2,children:x?(0,l.jsx)(h.cC,{id:"vliZud",values:{0:t.length}}):(0,l.jsx)(h.cC,{id:"sC4bhw",values:{0:t.length}})}),!x&&(0,l.jsx)(a.x,{px:2,fontSize:"sm",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"miJbY4"})}),(0,l.jsx)(nW.R,{})]})]})})},dJ=e=>{let{isEveryone:t}=e,[i,n]=(0,j.useState)(!1),[r,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(!1);return((0,j.useEffect)(()=>{!i&&t&&(s(!0),n(!0),setTimeout(()=>{s(!1)},3e3))},[t,i]),t)?(0,l.jsx)(d.xu,{fontSize:"sm",color:"",px:2,mr:2,children:(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"w7dTyp"}),isOpen:o||r,children:(0,l.jsx)(d.xu,{mr:2,px:1,bg:"green.300",color:"green.900",borderRadius:"full",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:(0,l.jsx)(x.G,{icon:u.Mdf})})})}):(0,l.jsx)(d.xu,{fontSize:"sm",color:"gray.700",pr:4,children:(0,l.jsx)(x.G,{icon:u.Mdf})})};var dQ=i(46164),d$=i(43970);let d0=(0,s6.E)(d.xu),d1=e=>{let{commentFeedItems:t,editor:i,doc:n,user:r}=e;return i&&r?(0,l.jsx)(tT.K,{p:2,children:(0,l.jsx)(l5.M,{initial:!1,children:t.map(e=>(0,l.jsx)(d0,{layout:!0,initial:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.85},bg:"gray.100",borderColor:"gray.200",borderWidth:"1px",borderRadius:"md",shadow:"sm",children:(0,l.jsx)(d$.q,{comment:e,editor:i,selfUser:r,docId:n.id,userCanComment:!1,instanceType:"notification"},e.id)},e.id))})}):null};var d2=i(38140),d5=i(14274);let d4=e=>!!e.comment&&null!==e.timeout,d3=e=>{let{user:t,docId:i,docComments:n=[],pauseExiration:r=!1,duration:s=5e3}=e,l=(0,iR.p)(),o=null==t?void 0:t.id,a=(0,j.useMemo)(()=>{if(!o)return null;let e=new d2.default(d5.v.KNOCK_PUBLIC_KEY);return e.authenticate(o),e},[o]),[d,c]=(0,j.useState)({}),u=(0,j.useRef)(!0),x=(0,j.useRef)(r);x.current=r,(0,j.useEffect)(()=>()=>{u.current=!1},[]);let h=(0,j.useCallback)(()=>c({}),[]),m=(0,j.useCallback)(e=>{c(t=>Object.entries(t).reduce((t,i)=>{let[n,r]=i,s=!0===e?-1===r.timeout:n===e;return s||(t[n]=r),t},{}))},[]);return(0,j.useEffect)(()=>{r||m(!0)},[m,r]),(0,j.useEffect)(()=>{Object.entries(d).forEach(e=>{let[t,{entry:i,timeout:r}]=e;if(null===r){let e=i.data.commentId,r=null==n?void 0:n.find(t=>t.id===e);if(r){let e=setTimeout(()=>{u.current&&(x.current?c(e=>{let i={...e};return i[t].timeout=-1,i}):m(t))},s);c(n=>({...n,[t]:{entry:i,comment:r,timeout:e}}))}}})},[d,n,s,m]),(0,j.useEffect)(()=>{if(!a||!i)return;let e=a.feeds.initialize(d5.v.KNOCK_FEED_ID,{source:"new-comment",status:"unseen"}),t=e.listenForUpdates();e.on("messages.new",t=>{let{entries:n}=t,[r]=n;r.data.docId===i&&(c(e=>({...e,[r.id]:{entry:r,timeout:null}})),e.markAsSeen(r).then(()=>{console.debug("New notification marked as seen")}).catch(e=>{console.error("Unable to mark notification as seen",e)}))});let n=v.C9N.on("status",e=>{let{isConnected:t}=e,i=a.client();t?i.connectSocket():i.disconnectSocket()});return()=>{n(),t()}},[i,l,a]),{reset:h,comments:Object.values(d).filter(d4).map(e=>e.comment)}},d9=e=>{var t;let{toggleCommentsPanel:i,isCommentsPanelOpen:n,doc:r,mode:s}=e,{user:o}=(0,eY.SE)(),{editor:a}=(0,n4._i)(),[d,c]=(0,tr.XI)(),{comments:h,reset:m}=d3({user:o,docId:null==r?void 0:r.id,docComments:null==r?void 0:r.comments,pauseExiration:c}),p=!!(a&&r&&r.comments);(0,j.useEffect)(()=>
1{if(!p)return;let{commentId:e}=(0,ev.sY)();e&&tW.pw.emit(tW.TI.OPEN_POPUP_COMMENT,{commentId:e,highlightComment:!0})},[p]),(0,j.useEffect)(()=>{(n||s===eV.q.SLIDE_VIEW)&&m()},[n,m,s]);let g=!!h.length&&!n&&s!==eV.q.SLIDE_VIEW,f=(null==r?void 0:null===(t=r.comments)||void 0===t?void 0:t.filter(e=>e.status===v.Ux9.Open).length)||0;return(0,l.jsxs)(S.J,{isLazy:!0,lazyBehavior:"keepMounted",returnFocusOnClose:!1,isOpen:g,placement:"bottom",children:[(0,l.jsx)(E.x,{children:(0,l.jsx)(d_.h,{onMouseDown:aI.br,onClick:i,icon:(0,l.jsx)(x.G,{icon:u.Mzg}),isActive:n,"aria-label":n?"Hide comments":"Show comments",borderRadius:5,children:f})}),(0,l.jsx)(nz.h,{children:r&&(0,l.jsxs)(_.y,{bg:"white",shadow:"lg",border:"none",ref:d,children:[(0,l.jsx)(dQ.Q,{bg:"white"}),(0,l.jsx)(d1,{editor:a,user:o,commentFeedItems:h,doc:r})]})})]})},d6=()=>(0,l.jsx)(o.k,{children:(0,l.jsx)(ep.kH,{closeOnMouseDown:!1,closeOnClick:!1,label:(0,l.jsx)(h.cC,{id:"EVnzPs"}),children:(0,l.jsx)(d_.r,{"data-guider-highlight":"design-partner-button","aria-label":"Edit with AI",colorScheme:"trueblue",variant:"plain",onClick:()=>{iA.T.emit("toggle",{})},icon:(0,l.jsx)(x.G,{icon:u.JyM})})})}),d7=(0,s6.E)(d.xu),d8=()=>{let e=(0,M.CG)(L.WI),t=(0,M.CG)(L.yn);return(0,l.jsx)(l5.M,{initial:!1,children:e&&t&&(0,l.jsx)(d7,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},position:"absolute",pointerEvents:"none",borderTop:"solid ".concat(4,"px ").concat(e.color),top:0,left:0,bottom:0,right:0,height:"var(--100vh)"})})},ce=e=>{let{doc:t,editorWrapperEl:i,scrollingParentSelector:n}=e;return(0,l.jsxs)(tJ.v,{placement:"bottom-end",modifiers:[{name:"flip",enabled:!0,options:{fallbackPlacements:["left"]}}],children:[(0,l.jsx)(tQ.j,{as:d_.r,borderRadius:"md",icon:(0,l.jsx)(x.G,{icon:u.cNd}),onMouseDown:aI.br,"data-testid":"doc-toolbar-menu-button"}),(0,l.jsx)(nz.h,{children:t&&(0,l.jsx)(oC,{doc:t,scrollingParentSelector:n,editorWrapperEl:i})})]})},ct=e=>{let{docId:t,enabled:i,enterSlideView:n}=e,r=(0,M.CG)(L.e0),s=(0,j.useRef)(null),l=(0,iR.p)();(0,j.useEffect)(()=>{!i&&s.current&&s.current.close()},[i]),(0,j.useEffect)(()=>{let e=()=>{var e;null===(e=s.current)||void 0===e||e.close()};return window.addEventListener("beforeunload",e),()=>{var t;window.removeEventListener("beforeunload",e),null===(t=s.current)||void 0===t||t.close()}},[]);let o=(0,j.useCallback)(()=>{if(!t||!(null==r?void 0:r.sessionId))return;let e=(0,ev.C3)({docId:t,sessionId:r.sessionId}),i=window.open(e,"present-view","popup,left=0,top=0,width=720,height=580");i?s.current=i:(l({title:"Failed to open presenter view.",description:"Please allow popups for this site and try again.",status:"error",position:"top",duration:5e3}),console.error("[usePresenterViewToggle] Failed to open presenter view")),n({fullscreen:!1})},[t,n,null==r?void 0:r.sessionId,l]);return{handlePresentViewClick:o}};var ci=i(73235),cn=i(21979);function cr(){let e=(0,ci._)(["\n 0% { transform: scale(1.0); filter: brightness(1.0); }\n 3% { transform: scale(1.0); filter: brightness(1.0); }\n 8% { transform: scale(0.90); filter: brightness(1.30); }\n 18% { transform: scale(1.05); filter: brightness(1.0); }\n 30% { transform: scale(1.0); filter: brightness(1.0); }\n "]);return cr=function(){return e},e}let cs=e=>({followOnStart:!0,followingId:e}),cl=e=>{switch(e){case"edit":return m.ag._({id:"UZN1cZ"});case"comment":return m.ag._({id:"jFTs0A"});case"view":return m.ag._({id:"Ya6CJ0"});default:return m.ag._({id:"Txd1qM"})}},co=e=>{var t,i;let{isOpen:n,onClose:r,accessLinkUrl:s,onPlayClick:o}=e,{user:c}=(0,eY.SE)(),{replace:u}=(0,eg.useRouter)(),p=cs(null==c?void 0:c.id),[g,f]=(0,j.useState)(p),v=(0,ev.eo)(s,g),{user:C,color:b}=(0,eY.SE)(),y=(0,M.CG)(iU.yx),k=null==y?void 0:null===(i=y.accessLinks)||void 0===i?void 0:null===(t=i[0])||void 0===t?void 0:t.permission,w=(0,l2.F4)(cr());return(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(nK.u_,{isOpen:n,onClose:r,size:"lg",children:[(0,l.jsx)(ta.Z,{}),(0,l.jsxs)(nq.h,{children:[(0,l.jsx)(nY.x,{children:(0,l.jsx)(h.cC,{id:"88XnIQ"})}),(0,l.jsx)(tc.o,{}),(0,l.jsx)(rn.i,{}),(0,l.jsx)(tu.f,{pt:"6",children:(0,l.jsxs)(tT.K,{spacing:"4",children:[(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"oYTLJe",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc,0:cl(k)},components:{0:(0,l.jsx)(a.x,{as:"span",fontWeight:"bold",borderBottom:"1px dashed",borderColor:"gray.400",display:"inline-block"}),1:(0,l.jsx)(ep.kH,{label:m.ag._({id:"8LnpqL"}),placement:"top"})}})}),(0,l.jsx)(d.xu,{mb:"2",children:(0,l.jsx)(cn.I,{url:v,variant:"solid"})}),(0,l.jsxs)(id.b,{children:[(0,l.jsx)(ra.z,{}),(0,l.jsxs)(ex.U,{flexBasis:"100%",alignItems:"top",children:[(0,l.jsx)(a.x,{fontSize:"sm",width:"100%",children:(0,l.jsx)(h.cC,{id:"EApNIe"})}),(0,l.jsxs)(d.xu,{position:"relative",textShadow:"sm",children:[(0,l.jsx)(rK.q,{animation:"".concat(w," 2s infinite ease-out"),name:null==C?void 0:C.displayName,src:null==C?void 0:C.profileImageUrl,size:"md",border:"solid 3px ".concat(b.value),shadow:"lg"}),(0,l.jsx)(d.xu,{position:"absolute",top:"1.75rem",left:"1.75rem",outline:"0 0 2px rgba(255,255,255,1.0)",sx:{path:{stroke:"white",strokeWidth:48}},color:"black",children:(0,l.jsx)(x.G,{icon:ij.qaO,fixedWidth:!0})})]})]})]})]})}),(0,l.jsx)(tx.m,{children:(0,l.jsxs)(em.h,{children:[(0,l.jsx)(eh.z,{variant:"ghost",colorScheme:"gray",onClick:()=>{r()},children:(0,l.jsx)(h.cC,{id:"DPfwMq"})}),(0,l.jsx)(eh.z,{variant:"solid",onClick:()=>{r(),o(),u(v,v,{shallow:!0})},leftIcon:(0,l.jsx)(x.G,{icon:ij.zc}),children:(0,l.jsx)(h.cC,{id:"tbDuNX"})})]})})]})]})})},ca=e=>{var t,i,n,r;let{doc:s,docEditorType:c,isStaticEditor:p,enterSlideView:g,exitSlideView:f,setExitedFullscreenByClick:v,isFullscreen:C,enterFullscreen:b,exitFullscreen:y,shouldHide:k}=e,{onOpen:w,onClose:S,isOpen:E}=(0,tL.M)({id:"meetModal"}),{user:I}=(0,eY.SE)(),_=(0,M.CG)(L.gh),A=(0,j.useRef)(_);(0,j.useEffect)(()=>{A.current=_},[_]);let{shortcutLabel:T,shortcutIcon:O,shortcutKeys:P,buttonLabel:D}=nJ()[_],R=null==s?void 0:null===(i=s.accessLinks)||void 0===i?void 0:null===(t=i[0])||void 0===t?void 0:t.url,G=!!(null==s?void 0:null===(r=s.accessLinks)||void 0===r?void 0:null===(n=r[0])||void 0===n?void 0:n.permission),z=(0,eY.py)("manage",s||void 0),N=!p&&I&&R&&z,F=(0,e7.ye)("cardNotes"),U=_===eV.q.SLIDE_VIEW,W=_===eV.q.DOC_VIEW,H=F&&c!==dI.Z.PUBLIC_STATIC,{handlePresentViewClick:V}=ct({docId:null==s?void 0:s.id,enabled:F&&U,enterSlideView:g}),B=(0,e7.ye)("presentFullScreen"),K=(0,M.CG)(L.e_),q="present"===K.primaryAction?"solid":"plain";return(0,l.jsxs)(o.k,{display:k?"none":"flex",children:[(0,l.jsxs)(em.h,{isAttached:!0,size:"sm","data-guider-highlight":"present-button-group","data-editor-mode":U?"slide":"doc",children:[(0,l.jsx)(ep.kH,{closeOnMouseDown:!1,closeOnClick:!1,label:T,shortcut:P,children:(0,l.jsx)(d_.h,{fontWeight:"normal",size:"sm",variant:q,onClick:()=>{U?f():g({fullscreen:B})},onMouseDown:aI.br,icon:(0,l.jsx)(x.G,{icon:O}),"data-present-button":!0,children:D})}),(0,l.jsxs)(tJ.v,{children:[(0,l.jsx)(tQ.j,{variant:q,as:d_.r,icon:(0,l.jsx)(x.G,{icon:u.ptq})}),(0,l.jsx)(nz.h,{children:(0,l.jsxs)(t$.q,{zIndex:"popover",children:[W&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(nV.k,{title:m.ag._({i
1d:"tbDuNX"}),children:[H&&(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.s0r,fixedWidth:!0}),onClick:V,children:(0,l.jsxs)(tT.K,{spacing:"0",children:[(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"T+GUKl"})}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.600",children:(0,l.jsx)(h.cC,{id:"ACelDx"})})]})}),H&&(0,l.jsx)(nW.R,{}),(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.Rkb,fixedWidth:!0}),command:(0,ep.cE)("Mod+Enter"),onClick:()=>g({fullscreen:!1}),children:(0,l.jsx)(h.cC,{id:"LRFe2O"})}),(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.tc$,fixedWidth:!0}),command:(0,ep.cE)("Mod+Shift+Enter"),onClick:()=>g({fullscreen:!0}),children:(0,l.jsx)(h.cC,{id:"OwIqiD"})})]}),N&&(0,l.jsx)(nW.R,{})]}),U&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:ij.Bg$,fixedWidth:!0}),command:(0,ep.cE)("Esc"),onClick:f,children:(0,l.jsx)(h.cC,{id:"5Rfo7J"})}),(H||N)&&(0,l.jsx)(nW.R,{}),H&&(0,l.jsx)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.s0r,fixedWidth:!0}),onClick:V,children:(0,l.jsxs)(tT.K,{spacing:"0",children:[(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"T+GUKl"})}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.600",children:(0,l.jsx)(h.cC,{id:"ACelDx"})})]})})]}),N&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ep.kH,{isDisabled:G,label:(0,l.jsx)(h.cC,{id:"zk6wKo"}),children:(0,l.jsx)(d.xu,{children:(0,l.jsx)(nH.s,{onClick:()=>{var e;(null==s?void 0:null===(e=s.accessLinks)||void 0===e?void 0:e[0].permission)&&w()},isDisabled:!G,icon:(0,l.jsx)(x.G,{icon:u.ASo,fixedWidth:!0}),children:(0,l.jsx)(tT.K,{spacing:"0",children:(0,l.jsx)(h.cC,{id:"z7gRub",components:{0:(0,l.jsx)(a.x,{}),1:(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.600"})}})})})})}),(0,l.jsx)(co,{isOpen:E,onClose:S,accessLinkUrl:R,onPlayClick:()=>{g({fullscreen:!1})}})]})]})})]})]}),U&&(0,l.jsx)(o.k,{ml:U?2:0,children:(0,l.jsx)(ep.kH,{label:C?"Exit full screen":"Enter full screen",children:(0,l.jsx)(d_.r,{"aria-label":C?"Exit full screen":"Enter full screen",borderRadius:"md",icon:(0,l.jsx)(x.G,{icon:C?u.Qj4:u.TL5}),onClick:C?()=>{v(!0),y()}:b})})})]})},cd=e=>{let{doc:t}=e,{replace:i}=(0,eg.useRouter)(),n=(0,M.CG)(eE.lH),r=null==t?void 0:t.id,s=(0,eA.D5)({site:n,docId:r}),{publishDoc:c,publishSite:p,isPublishing:g}=iH({doc:t,site:n,path:s}),{statusText:f,detailText:v,lastPublishedTime:C,needsPublish:b,publishEnabled:y}=nF(g),k=n&&(0,eA.jl)(t,n),w=(0,j.useCallback)(()=>{if(!r)return;let e=(0,ev.yQ)({docId:r,preview:!0});i(e,void 0,{shallow:!0})},[r,i]);return n?(0,l.jsx)(o.k,{children:(0,l.jsxs)(em.h,{isAttached:!0,size:"sm",children:[(0,l.jsx)(ep.kH,{closeOnMouseDown:!1,closeOnClick:!1,isDisabled:!y,label:b&&!g?(0,l.jsxs)(tT.K,{children:[f,(0,l.jsx)(a.x,{color:"gray.400",children:(0,l.jsx)(h.cC,{id:"FmP7uY"})})]}):(0,l.jsx)(h.cC,{id:"o+bOqE"}),children:(0,l.jsx)(d_.h,{fontWeight:"normal",size:"sm",variant:"solid",onClick:p,onMouseDown:aI.br,isDisabled:!y,isLoading:g,icon:b?(0,l.jsx)(x.G,{icon:u.A$k}):(0,l.jsx)(x.G,{icon:u.LEp}),"data-publish-button":!0,children:b?(0,l.jsx)(h.cC,{id:"EEYbdt"}):(0,l.jsx)(h.cC,{id:"u3wRF+"})})}),(0,l.jsxs)(tJ.v,{children:[(0,l.jsx)(tQ.j,{variant:"solid",as:d_.r,isDisabled:!y,icon:(0,l.jsx)(x.G,{icon:u.ptq})}),(0,l.jsx)(nz.h,{children:(0,l.jsxs)(t$.q,{zIndex:"popover",maxW:"360px",children:[(0,l.jsxs)(tT.K,{w:"100%",p:2,direction:"column",spacing:.5,children:[(0,l.jsx)(a.x,{fontSize:"sm",children:f}),v&&(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",children:v}),C&&(null==t?void 0:t.site)&&(0,l.jsxs)(ex.U,{mx:2,mt:2,children:[(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",children:k?C:(0,l.jsx)(h.cC,{id:"0bSVwO"})}),k&&(0,l.jsx)(sY,{site:t.site,path:(0,eA.fJ)(s)})]})]}),(0,l.jsx)(nW.R,{}),(0,l.jsxs)(nV.k,{title:m.ag._({id:"EEYbdt"}),children:[(0,l.jsxs)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.A$k,fixedWidth:!0}),onClick:p,alignItems:"baseline",children:[(0,l.jsx)(h.cC,{id:"1EeNDU"}),(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"TG5c7I"})})]}),(0,l.jsxs)(nH.s,{icon:(0,l.jsx)(x.G,{icon:u.PQh,fixedWidth:!0}),onClick:c,alignItems:"baseline",children:[(0,l.jsx)(h.cC,{id:"jNnwuI"}),(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"+s7ng3"})})]})]}),(0,l.jsx)(nW.R,{}
1),(0,l.jsx)(nV.k,{title:m.ag._({id:"rdUucN"}),children:(0,l.jsx)(ep.kH,{label:(0,l.jsx)(h.cC,{id:"aChIoL"}),children:(0,l.jsx)(d.xu,{children:(0,l.jsx)(nH.s,{onClick:w,icon:(0,l.jsx)(x.G,{icon:ij.sl_,fixedWidth:!0}),alignItems:"baseline",children:(0,l.jsx)(tT.K,{spacing:"0",children:(0,l.jsx)(h.cC,{id:"Y5Jq49",components:{0:(0,l.jsx)(a.x,{}),1:(0,l.jsx)(a.x,{fontSize:"xs",color:"gray.500"})}})})})})})})]})})]})]})}):null};var cc=i(86513),cu=i(60740),cx=i(16710),ch=i(62549);let cm=e=>{var t,i;let{doc:n,showAnalytics:r=!0,showSharePublic:s=!0,showEmbed:o=!0,showButton:c=!0}=e,{isOpen:u,onClose:x,onOpen:m}=(0,tL.M)({id:"analyticsModalDisclosure"}),{isSharePanelOpen:p,onSharePanelOpen:g,onSharePanelClose:f,view:v,setView:C}=(0,cu.y)(),{user:b,currentWorkspace:y}=(0,eY.SE)(),{editor:k}=(0,n4._i)(),w=(0,eY.py)("view",n),S=(0,eY.py)("edit",n),E=(0,eY.py)("manage",n),I=(0,ez.z$)();(0,j.useEffect)(()=>sK.T.on("openSharePanel",e=>{let{view:t}=e;g(),C(t)}),[g,C]);let _=(0,j.useCallback)(()=>{null==I||I.track(ez.AA.DOC_ANALYTICS_VIEWED,{docId:null==n?void 0:n.id,source:"share_panel",type:E?"full":"personal"}),m()},[I,E,null==n?void 0:n.id,m]);if(!w||!b||!n)return null;let A=n.collaborators||[],T=n.channels||[],O=(0,ch.Hs)([...A].sort((e,t)=>e.user.id===b.id?-1:t.user.id===b.id?1:0).map(e=>e.user.id===b.id?"You":e.user.displayName||"").concat(n.orgAccess?T.map(e=>{let{name:t}=e;return t||""}):[])),P=(0,cx.h_)(n,b),D=P?(0,cx.Xp)()[P]:null,R=(0,cx.Gi)(n,y);return null===D?(console.error("[SharePanel] Unknown VisibilityValue for doc",n),null):(0,l.jsxs)(l.Fragment,{children:[c&&(0,l.jsx)(ep.kH,{label:(0,l.jsxs)(l.Fragment,{children:[R&&(0,l.jsx)(a.x,{fontWeight:"bold",children:(0,l.jsx)(h.cC,{id:"OS9x6e",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}})}),D.title(null==n?void 0:null===(t=n.organization)||void 0===t?void 0:t.name)?(0,l.jsx)(a.x,{children:D.title(null==n?void 0:null===(i=n.organization)||void 0===i?void 0:i.name)}):null,(0,l.jsx)(a.x,{fontSize:"xs",children:D.subtitle?D.subtitle(O||""):""})]}),children:(0,l.jsx)("span",{children:(0,l.jsx)(d_.h,{"data-guider-highlight":"share-button",onMouseDown:aI.br,icon:(0,l.jsx)(d.xu,{children:(0,l.jsx)(cc.aA,{visibility:D,isFromOtherOrg:R})}),isDisabled:!S,onClick:g,children:(0,l.jsx)(h.cC,{id:"Z8lGw6"})})})}),(0,l.jsx)(cc.WQ,{doc:n,editor:k,isSharePanelOpen:p,onSharePanelOpen:g,onSharePanelClose:f,onAnalyticsPanelOpen:_,view:v,setView:C,showAnalytics:r,showSharePublic:s,showEmbed:o}),u&&(0,l.jsx)(sO,{doc:n,onSharePanelOpen:g,onAnalyticsPanelClose:x,isAnalyticsPanelOpen:u,mode:E?"full":"personal"})]})},cp=(0,s6.E)(o.k),cg=e=>(0,l.jsx)(cp,{initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},children:(0,l.jsx)(l5.M,{initial:!1,children:(0,l.jsx)(cf,{...e})})}),cj=["home","siteTitle","pageSwitcher"],cf=(0,j.memo)(e=>{let{doc:t,isPagesPanelOpen:i,togglePagesPanel:n,pagesPanelEnabled:r=!1}=e,[s]=(0,dN.X)(U.H.lastHomeUrl,"/"),c=(0,e7.ye)("offline"),p=(0,M.CG)(eE.lH),{user:g}=(0,eY.SE)(),{isConnected:j}=(0,v.$gs)(),{confirmNavigation:f}=(0,n4._i)(),{push:C}=(0,eg.useRouter)(),b=(0,en.i)({base:"xs",sm:"sm"}),y=(0,eu.ff)("gray.700","gray.300"),k=(0,eu.ff)("gray.500","gray.400"),w=(0,eu.ff)("gray.700","gray.100"),S={base:"140px",sm:"220px",xl:"300px"};return(0,l.jsxs)(ex.U,{spacing:0,as:eh.z,bg:"transparent",boxShadow:"none",border:"none",textAlign:"left",px:0,h:8,_hover:{color:w},_active:{boxShadow:"none"},children:[(0,l.jsx)(dR.a,{display:"flex",alignItems:"center",whiteSpace:"nowrap",size:b,spacing:["4px","8px"],variant:"plainButton",separator:(0,l.jsx)(d.xu,{color:"gray.300",mt:["0.2rem","0.125rem"],children:(0,l.jsx)(x.G,{icon:u._tD})}),children:cj.map((e,o)=>{if(!e)return null;if("siteTitle"===e){if(!t||!t.site||!r)return null;let e=null==p?void 0:p.routes.length;if(e&&1===e)return null}let d=o===cj.length-1,c="home"===e,h="siteTitle"===e;if(c&&!g)return null;let j={as:ii(),href:s||"/",colorScheme:"gray",fontWeight:"normal","data-testid":"toolbar-home-link"};return(0,l.jsx)(dG.g,{isCurrentPage:!1,children:(0,l.jsx)(cp,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},children:(0,l.jsx)(dz.A,{_hover:{cursor:h?"default":"pointer"},color:d?k:y,...c?{...j}:{},children:c?(0,l.jsx)(nS.r,{as:d_.h,ml:-2,mr:-1,href:j.href,onClick:e=>{let t=!e.shiftKey&&(e.metaKey||e.ctrlKey);t||(e.preventDefault(),f().then(()=>{C(j.href)}))},children:(0,l.jsx)(x.G,{size:"1x",icon:u.J9Y})}):h?(0,l.jsx)(a.x,{noOfLines:1,maxW:S,fontWeight:"normal",display:"block",children:null==p?void 0:p.name}):(0,l.jsxs)(ex.U,{spacing:0,children:[(0,l.jsx)(dF,{doc:t}),r&&(0,l.jsx)(d_.r,{size:"sm",variant:"ghost",onClick:()=>{null==n||n()}
1,"aria-label":m.ag._({id:"TRfYMF"}),icon:(0,l.jsx)(x.G,{size:"1x",icon:i?u.onQ:u.gc2}),minW:0,px:2})]})})},e)},e)})}),!j&&(0,l.jsx)(ep.kH,{label:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.x,{mr:2,children:(0,l.jsx)(h.cC,{id:"ysdDIA"})}),c&&(0,l.jsx)(a.x,{color:"gray.300",children:(0,l.jsx)(h.cC,{id:"+QNhGE"})})]}),"aria-label":m.ag._({id:"IcHxhR"}),children:(0,l.jsx)(o.k,{color:"gray.300",alignItems:"center",pr:3,children:(0,l.jsx)(x.G,{icon:u.bKP})})})]})});cf.displayName="PageBreadcrumbGroup";let cv=e=>{let{spotlightingByBlock:t}=e,{editor:i}=(0,n4._i)(),n=(0,j.useCallback)(()=>{t?null==i||i.commands.turnOffSpotlight():null==i||i.commands.spotlightNextBlock()},[i,t]);return(0,l.jsx)(o.k,{children:(0,l.jsx)(ep.kH,{closeOnMouseDown:!1,closeOnClick:!1,label:(0,l.jsxs)(a.x,{whiteSpace:"nowrap",children:[t?"Turn off spotlight":"Turn on spotlight",(0,l.jsx)(a.x,{as:"span",display:"inline",color:"gray.400",ml:2,children:"S"})]}),children:(0,l.jsx)(d_.h,{colorScheme:"trueblue",variant:t?"solid":"plain",onClick:e=>{n(),e.target.blur()},icon:(0,l.jsx)(x.G,{icon:u.QMW}),children:"Spotlight"})})})};var cC=i(56745),cb=i(86963),cy=i(52394),ck=i(83947);let cw=(0,j.memo)(e=>{let{isOpen:t,onClose:i,openThemeEditor:n,openThemeEditorWithDefaultTheme:r,setDocTheme:s}=e,o=(0,M.CG)(L.Pu),a=(0,j.useCallback)(()=>{tW.pw.emit(tW.TI.OPEN_PAGE_SETUP,"background"),null==i||i()},[i]);return(0,l.jsx)(ep.Wk,{isDark:!1,children:(0,l.jsxs)(to.d,{returnFocusOnClose:!1,isOpen:t,placement:"right",onClose:i,size:"md",children:[(0,l.jsx)(ta.Z,{background:"none"}),(0,l.jsxs)(td.s,{"data-testid":"doc-theme-drawer","data-doc-theme-drawer":!0,motionProps:{variants:{enter:{x:"0%",transition:{duration:.2}},exit:{x:"100%",transition:{duration:.1}}}},children:[(0,l.jsx)(nY.x,{pb:4,children:(0,l.jsx)(ck.v,{title:(0,l.jsx)(h.cC,{id:"FEr96N"}),openThemeEditorWithDefaultTheme:r,showDrawerCloseButton:!0,currentTheme:o})}),(0,l.jsx)(tu.f,{overflowX:"hidden","data-theme-picker-scroll-container":!0,children:(0,l.jsx)(cy.t,{currentTheme:o,openBackgroundPanel:a,setTheme:s,openThemeEditor:n,openThemeEditorWithDefaultTheme:r})})]})]})})});cw.displayName="DocThemeDrawer";let cS=(0,j.memo)(()=>{var e;let t=(0,iR.p)(),[i]=(0,v.Iyu)(),n=(0,M.CG)(eE.$U),{docId:r,getCollaborativeEditorInstance:s}=(0,n4._i)(),{isOpen:a,onOpen:d,onClose:c}=(0,tL.M)({id:"themeEditor"}),{isOpen:u,onOpen:x,onClose:m}=(0,tL.M)({id:"themeStyleDrawer"}),p=null===(e=s())||void 0===e?void 0:e.state.doc.toJSON(),g=(0,M.CG)(L.Pu),[f,C]=(0,cb.g)(),b=s(),{openThemeEditor:y,openThemeEditorWithDefaultTheme:k}=(0,eT.LW)(b,d,C),w=(0,ez.z$)(),{updateDocThemeWithAccentImages:S}=(0,eT.vi)({docId:r,editor:b}),E=(0,j.useCallback)(e=>{n&&e.id!==g.id&&i({variables:{input:{siteId:n,themeId:e.id}},update:(t,i)=>{let{data:r}=i,s=t.readFragment({id:"Theme:".concat(e.id),fragment:v.ASj,fragmentName:"DefaultThemeFields"});t.updateQuery({query:v.BYL,variables:{id:n}},e=>e&&e.site&&s?{...e,site:{...e.site,...null==r?void 0:r.updateSite,theme:s}}:e)}}).then(()=>{})},[n,g.id,i]),I=(0,j.useCallback)(e=>{e.id!==g.id&&S(e.id).then(()=>{null==w||w.track(ez.AA.DOC_THEME_UPDATED,{doc_id:r,theme_id:e.id})}).catch(e=>{console.error(e),t({title:(0,l.jsx)(h.cC,{id:"Fulf8b",values:{0:e.message}}),position:"top",status:"error"})})},[w,g.id,r,t,S]),_=(0,j.useCallback)(e=>n?E(e):I(e),[n,I,E]);return(0,j.useEffect)(()=>{let e=sK.T.on("toggleThemeBlock",x),t=tW.pw.on(tW.TI.OPEN_THEME_DRAWER,x);return()=>{e(),t()}},[x]),(0,l.jsxs)(o.k,{children:[(0,l.jsx)(cw,{isOpen:u&&!a,onClose:m,openThemeEditor:y,openThemeEditorWithDefaultTheme:k,setDocTheme:_}),(0,l.jsx)(cC.z,{isOpen:a,onClose:c,state:f,dispatch:C,docContent:p,onThemeCreated:I,disableDrawerTransition:!0})]})}),cE=(0,j.memo)(()=>{let{isConnected:e}=(0,v.$gs)();return(0,l.jsx)(ep.kH,{label:e?(0,l.jsx)(h.cC,{id:"JkEyR8"}):(0,l.jsx)(h.cC,{id:"GvC+mL",components:{0:(0,l.jsx)(a.x,{}),1:(0,l.jsx)(a.x,{color:"gray.300"})}}),"aria-label":m.ag._({id:"JkEyR8"}),children:(0,l.jsx)(d.xu,{children:(0,l.jsx)(d_.h,{"data-guider-highlight":"toolbar-theme-button",onClick:()=>{sK.T.emit("toggleThemeBlock",!0)},isDisabled:!e,icon:(0,l.jsx)(x.G,{icon:u.q2v}),"data-testid":"toolbar-theme-button",children:(0,l.jsx)(h.cC,{id:"FEr96N"})})})})});cE.displayName="ThemeToolbarButton";let cI=()=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(cS,{}),(0,l.jsx)(cE,{})]});cS.displayName="ThemeDrawers";let c_=[.5,.8,.9,1,1.1,1.2,1.5,2],cA=e=>"".concat((100*e).toFixed(0),"%"),cT=()=>{let e=(0,e7.ye)("presentZoom"),{editor:t}=(0,n4._i)(),i=(0,ez.z$)(),n=(0,f.I0)(),r=(0,M.CG)(L.SU),s=(0,j.useCallback)(e=>{n((0,L.Ic)({zoomLevel:e})),n((0,L.fT)({enabled:!1})),null==i||i.track(ez.AA.DOC_ZOOMED,{direction:"set",level:e})},[n,i]),o=(0,j.useCallback)(()=>{n((0,L.fT)({enabled:!0}))},[n]),d=(0,j.useCallback)(()=>{let e=Math.min(o6.v4,r+.1);n((0,L.Ic)({zoomLevel:e})),n((0,L.fT)({enabled:!1})),null==i||i.track(ez.AA.DOC_ZOOMED,{direction:"in",level:e})},[n,i,r]),c=(0,j.useCallback)(()=>{let e=Math.max(o6.Ou,r-.1);n((0,L.Ic)({zoomLevel:e})),n((0,L.fT)({enabled:!1})),null==i||i.track(ez.AA.DOC_ZOOMED,{direction:"in",level:e})},[n,i,r]),p=(0,j.useCallback)(()=>{let e=o6.aX;n((0,L.Ic)({zoomLevel:e})),n((0,L.fT)({enabled:!1})),null==i||i.track(ez.AA.DOC_ZOOMED,{direction:"reset",level:e})},[n,i]),g=(0,M.CG)(n$.C),v=(0,oJ.rJ)();return((0,j.useEffect)(()=>
1{if(e)return ej.F7.on("keydown","PRESENT_BLOCK",e=>{let i=e.target instanceof HTMLElement&&(0,eH.Hx)(e.target);return!(g||!t||(0,oF.KB)(t))&&!i&&((0,ie.ZP)("=")(e)?(d(),e.preventDefault(),!0):(0,ie.ZP)("-")(e)?(c(),e.preventDefault(),!0):(0,ie.ZP)("0")(e)?(p(),e.preventDefault(),!0):!!(0,ie.ZP)("9")(e)&&(o(),e.preventDefault(),!0))})},[g,e,t,d,c,p,o]),e)?(0,l.jsxs)(em.h,{spacing:"0",size:"sm",variant:"ghost",isAttached:!0,borderWidth:"1px",borderRadius:"md",children:[(0,l.jsx)(ep.kH,{closeOnMouseDown:!1,closeOnClick:!1,shortcut:"-",label:m.ag._({id:"FjkaiT"}),children:(0,l.jsx)(I.h,{"aria-label":m.ag._({id:"FjkaiT"}),fontWeight:"normal",onClick:c,icon:(0,l.jsx)(x.G,{icon:u.Kl4})})}),(0,l.jsxs)(tJ.v,{closeOnSelect:!0,children:[(0,l.jsx)(ep.kH,{label:m.ag._({id:"VZ3UQG"}),children:(0,l.jsx)(tQ.j,{minW:20,as:eh.z,variant:"ghost",fontWeight:"400",size:"sm",rightIcon:(0,l.jsx)(x.G,{icon:u.ptq}),children:v?(0,l.jsx)(h.cC,{id:"R9Khdg"}):cA(r)})}),(0,l.jsxs)(t$.q,{maxW:"220px",children:[(0,l.jsx)(t0._,{value:v?"auto":r.toString(),type:"radio",children:(0,l.jsx)(t1.i,{value:"auto",onClick:o,children:(0,l.jsxs)(ex.U,{children:[(0,l.jsxs)(a.x,{children:[(0,l.jsx)(h.cC,{id:"R9Khdg"})," ",(0,l.jsx)(a.x,{as:"span",color:"gray.500",children:(0,l.jsx)(h.cC,{id:"P9Cyl9"})})]}),(0,l.jsx)(nN.L,{}),(0,l.jsx)(a.x,{as:"span",opacity:"0.6",children:"9"})]})})}),(0,l.jsx)(nW.R,{}),(0,l.jsx)(t0._,{value:v?"auto":r.toString(),type:"radio",children:c_.map(e=>(0,l.jsx)(t1.i,{value:(e/100).toString(),onClick:()=>{s(e)},children:(0,l.jsxs)(ex.U,{children:[(0,l.jsx)(a.x,{children:cA(e)}),(0,l.jsx)(nN.L,{}),e===o6.aX&&(0,l.jsx)(a.x,{as:"span",opacity:"0.6",children:"0"})]})},e))})]})]}),(0,l.jsx)(ep.kH,{closeOnMouseDown:!1,closeOnClick:!1,shortcut:"+",label:m.ag._({id:"AWOSPo"}),children:(0,l.jsx)(I.h,{fontWeight:"normal","aria-label":m.ag._({id:"AWOSPo"}),onClick:d,icon:(0,l.jsx)(x.G,{icon:u.r8p})})})]}):null},cO=(0,j.memo)(function(e){let{scrollingParentSelector:t,toggleCommentsPanel:n,isCommentsPanelOpen:r,isPagesPanelOpen:s,togglePagesPanel:a,editorWrapperEl:d,docEditorType:c,isDark:u}=e,[x]=(0,dw.a)(["(max-width: 840px)","(min-width: 841px)"]),h=(0,en.i)({base:!0,lg:!1}),m=(0,ev.LQ)(window.location.href),p=(0,M.CG)(L.gh),g=(0,M.CG)(iU.yx),f=(0,M.CG)(eE.lH),{editor:v}=(0,n4._i)(),C=(0,eY.py)("comment",g),b=(0,ek.O1)(),y=(0,ek.lP)(),{enabled:k}=(0,dE.g)(v),w=(0,eA.Vr)(f),S="SLIDE_VIEW"!==p,E=(0,M.CG)(L.hN),I=c!==dI.Z.COLLABORATIVE,_=c===dI.Z.PUBLIC_STATIC,A=(0,M.CG)(L.Tf),T=(0,M.CG)((0,X.SL)("left")),O=(0,M.CG)((0,X.SL)("right")),P=(0,e7.ye)("aiChat"),{enterSlideView:D,exitSlideView:R,setExitedFullscreenByClick:G,isFullscreen:z,enterFullscreen:F,exitFullscreen:U}=rt({editorWrapperEl:d,scrollingParentSelector:t});window.exportToPptx=async e=>{if(!v)return;let{exportToPptx:t}=await Promise.all([i.e(9775),i.e(5743),i.e(2966)]).then(i.bind(i,42648));return t(v,e)};let W=N((0,j.useCallback)(e=>{let t=H.current;if(!t)return!1;let i=t.querySelector("[data-active]")||t.querySelector('[aria-expanded="true"]')||T||O;return!!i||e.clientY<100},[T,O]),!A),H=(0,j.useRef)(null),V=!A||A&&W,B=!(0,ef.s2)()&&!m;return v?(0,l.jsx)(ep.Wk,{isDark:u,children:(0,l.jsxs)(o.k,{"data-editor-toolbar":!0,ref:H,bg:u?"gray.900":"white",borderBottomWidth:"1px",borderBottomColor:u?"whiteAlpha.100":"blackAlpha.100",zIndex:dS.S.toolbar,left:0,right:0,py:1.5,alignItems:"center",p:2,pr:6,transform:V?void 0:"translateY(-100%)",pointerEvents:"none",sx:{"&:focus-within":{marginTop:0},"> *":{pointerEvents:"auto"},"> #toolbar-spacer":{pointerEvents:"none"}},transitionProperty:"transform",transitionDuration:"normal",transitionTimingFunction:"ease-in-out","data-print-hidden":!0,children:[(0,l.jsx)(d8,{}),!_&&(0,l.jsx)(ex.U,{children:f?(0,l.jsx)(cg,{doc:g,pagesPanelEnabled:b,isPagesPanelOpen:s,togglePagesPanel:a}):(0,l.jsx)(dL,{doc:g})}),(0,l.jsx)(nN.L,{pointerEvents:"none",id:"toolbar-spacer"}),(0,l.jsxs)(ex.U,{children:[!x&&(0,l.jsx)(dZ,{}),!x&&!S&&(0,l.jsx)(cT,{}),!x&&!S&&(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(cv,{spotlightingByBlock:k})}),!x&&!I&&E&&y&&(0,l.jsx)(cI,{}),!I&&(0,l.jsx)(cm,{doc:g,showButton:!x}),B&&!w&&(0,l.jsx)(ca,{doc:g,isStaticEditor:I,editorWrapperEl:d,scrollingParentSelector:t,enterSlideView:D,exitSlideView:R,setExitedFullscreenByClick:G,is
1Fullscreen:z,enterFullscreen:F,exitFullscreen:U,shouldHide:x,docEditorType:c}),B&&w&&b&&(0,l.jsx)(cd,{doc:g}),!I&&C&&(0,l.jsx)(d9,{doc:g,mode:p,isCommentsPanelOpen:r,toggleCommentsPanel:n}),!x&&h&&!I&&E&&P&&(0,l.jsx)(d6,{}),!x&&!I&&!w&&(0,l.jsx)(dT,{doc:g}),!x&&!I&&(0,l.jsx)(ce,{doc:g,editorWrapperEl:d,scrollingParentSelector:t}),!_&&(0,l.jsx)(o.k,{children:(0,l.jsx)(tp.DY,{showRing:!0})})]})]})}):null});var cP=i(35503),cD=i(59322);let cR=(0,ie.ZP)("mod+S"),cG=(0,ie.ZP)("mod+shift+O"),cz=()=>{let e=(0,iR.p)();(0,j.useEffect)(()=>{let t=t=>{cR(t)&&(t.preventDefault(),e.isActive("save_toast")||e({id:"save_toast",title:(0,l.jsx)(h.cC,{id:"4ebE67"}),status:"success",duration:5e3,isClosable:!0}))},i=(0,eH.B$)({requiredCookie:"cardCollapseDebug=true"});return window.addEventListener("keydown",t),()=>{null==i||i(),window.removeEventListener("keydown",t)}},[e])},cN=()=>{let e=(0,M.qr)(),t=(0,M.TL)(),{editor:i}=(0,n4._i)();(0,j.useEffect)(()=>{if(!i)return;let n=n=>{if(!cG(n))return;n.preventDefault();let r=e.getState(),{cardIdMap:s,cardIds:l,memoState:{expandedCards:o}}=r.TipTap,a=(0,L.i2)(r),{total:d,expanded:c,cardIds:u}=l.reduce((e,t)=>{let i=!0===o[t],n=s.parents[t]||[],r=n.length>0,l=!a||n.includes(a);return r&&l&&(e.cardIds.push(t),e.total++,e.expanded+=i?1:0),e},{total:0,expanded:0,cardIds:[]});t((0,L.bj)({disable:!0})),setTimeout(()=>{t((0,L.bj)({disable:!1}))},100);let x=d===c;cM(i,100,!x),(0,n1.Nn)(u,x)};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n)}},[t,e,i])},cM=(e,t,i)=>{let n;let r=(0,eU.cC)("editor");for(let t=200;t>0;t-=25){var s;let i;let l=(0,oF.Je)(e,r.scrollSelector,t);(null===(s=l.pos)||void 0===s?void 0:s.pos)&&(e.state.doc.nodeAt(l.pos.pos)?i=l.pos.pos:e.state.doc.nodeAt(l.pos.inside)&&(i=l.pos.inside),i&&(!n||i>n)&&(n=i))}if(!n){console.warn("[pinPageDuringAnimation] No result for getTopCenterIshNode");return}let l=cL(e,n,i);if(!l){console.warn("[pinPageDuringAnimation] No element for getElementToPin");return}(0,eH.wO)({element:l,requiredCookie:"cardCollapseDebug=true"});let o=+new Date,a=r.scroller.scrollTop,d=(0,eH.LY)(l,r.scrollSelector),c=a-d,u=c<0?0:Math.max(c+200,0),x=()=>{if(!l)return;let e=(0,eH.LY)(l,r.scrollSelector);r.scroller.scroll({top:a+(e-d-u)});let i=+new Date-o;i<t&&requestAnimationFrame(x)};x()},cL=(e,t,i)=>{let n=e.state.doc.resolve(t),r=e.state.doc.nodeAt(t),s=(0,oF.Sh)(e,t);if(!r){console.warn("[getElementToPin] nodeAt null for $pos",n);return}let l=(0,oF.nv)(n,()=>!0).reverse();for(l.push({start:n.start(n.depth+1),pos:t,depth:n.depth,node:r});l.length;){let t=l.shift();if(!t)continue;let n=(0,eW.KH)(t.node),r=(0,cP.SA)(t.node),o=(0,cD.CU)(t.node),a=n||t.node.isAtom?t.pos:t.start;s=(0,oF.Sh)(e,a);let d=!i&&n&&t.depth>2;if(d||r||o)break}for(;(null==s?void 0:s.offsetParent)===null&&s.parentElement;)s=s.parentElement;return s};var cF=i(95993),cU=i(39486),cW=i(9449),cH=i(22537),cV=i(1010),cB=i(52906),cK=i(42505),cq=i(6501),cY=i(13793);class cZ extends cF.GJ{constructor(e){super({transform:async(t,i)=>{var n;if("data"!==t.event){i.enqueue(t);return}let{content:r}=t.data,s=r.attrs.id,l=r.content.find(e=>"cardAccentLayoutItem"===e.type);l&&(!l.attrs.background||(null===(n=l.attrs.background)||void 0===n?void 0:n.type)===cY.E.NONE)&&(l.attrs.background=(0,cq.Bv)(e,s),(0,cq.Tm)(r)),i.enqueue(t)}})}}var cX=i(50775),cJ=i(97253),cQ=i(90775);class c$ extends cF.GJ{async loadImage(e){let{editor:t,loadImageId:i,loadImageParams:n,cardIndex:r,cardId:s,node:l,theme:o,interactionId:a}=e,d=await (0,cX.B)({loadImageId:i,loadImageParams:n,context:{docId:t.gammaDocId,workspaceId:t.gammaOrgId,interactionId:a}});if(this.streamingCardIndex===r){this.loadedImageAttrs[i]=(0,cJ.j6)(l,d),"cardAccentLayoutItem"===l.type.name&&"error"===d.loadImageStatus&&(this.loadedImageAttrs[i]={...l.attrs,background:(0,cq.Bv)(o,s)});return}requestAnimationFrame(()=>{(0,cK.tf)({editor:t,loadImageId:i,newAttrs:d,node:l,theme:o,cardId:s})})}constructor({editor:e,theme:t,interactionId:i}){let n=async(n,r)=>{if("data"!==n.event){r.enqueue(n);return}let{index:s,id:l}=n.data;this.streamingCardIndex=s,(0,cQ.N)(n.data.content,n=>{var r;if("text"===n.type)return;let o=tm.NB.fromJSON(e.schema,{type:n.type,attrs:n.attrs}),a=(0,cJ.XU)(o);if(!a||"queued"!==a.loadImageStatus||!a.loadImageId||!a.loadImageParams)return;let{loadImageId:d,loadImageParams:c}=a;this.imageAttrs[d]||(this.imageAttrs[d]=o.attrs),this.loadImagePromises[d]||(this.loadImagePromises[d]=this.loadImage({editor:e,loadImageId:d,loadImageParams:c,cardIndex:s,cardId:l,theme:t,node:o,interactionId:i})),n.attrs=null!==(r=this.loadedImageAttrs[d])&&void 0!==r?r:this.imageAttrs[d]}),n.data.cardComplete&&this.streamingCardIndex++,r.enqueue(n)};super({transform:n}),this.streamingCardIndex=0,this.imageAttrs={},this.loadedImageAttrs={},this.loadImagePromises={}}}var c0=i(91760);let c1=function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;
1if(0===t.length)throw Error("Cannot have empty path");let r=[...t],s={...e},l=s,o=0;for(;t.length>0;){if(!l.content)throw Error("Can't surround a node with children");let e=r.shift();if(0===r.length){let t=l.content.slice(0,e);t.push(i),l.content=t;break}if(o<n){let t=l.content.slice(0);t.splice(e,1,{...t[e]}),l.content=t,l=l.content[e]}else{let t=l.content.slice(0,e+1);t.splice(e,1,{...t[e]}),l.content=t,l=l.content[e]}o++}return s};class c2 extends cF.GJ{constructor(e){let t=async(t,i)=>{if("done"===t.event||"cancel"===t.event){i.enqueue(t);return}let n=(0,M.bh)(),r=null;for(let s of function* e(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if("text"===t.type){let e=t.text.split(" ");for(let t=0;t<e.length;t++){let s={type:"text",text:e.slice(0,t+1).join(" ")};yield c1(n,r,s,i)}return}if(!t.content){yield c1(n,r,t,i);return}let s=0;for(let l of t.content){let t=[...r,s];for(let r of e(l,i,n,t))yield r;s++}}(t.data.content,1)){if(!s)continue;r&&i.enqueue(r),r={id:t.id,event:"data",data:{...t.data,content:s,cardComplete:!1}};let l=(0,iM.qn)(e)(n.getState());await c5(l)}r&&i.enqueue({...r,data:{...r.data,cardComplete:!0}})};super({transform:t}),this.index=0,this.startTime=performance.now()}}let c5=e=>new Promise(t=>c0.iK(t,e));var c4=i(7144),c3=i(98991);let c9=e=>{let{enabled:t,type:i}=e,n=(0,c3.As)(i),r=(0,j.useRef)(!0);(0,j.useEffect)(()=>{if(!t)return;let e=n.scroller;if(!e)return;let i=()=>{n.isAtBottom(40)?r.current=!0:r.current=!1},s=()=>{r.current=!1};return e.addEventListener("wheel",i,{passive:!0}),e.addEventListener("touchend",i,{passive:!0}),e.addEventListener("touchstart",s,{passive:!0}),e.addEventListener("touchmove",s,{passive:!0}),()=>{e.removeEventListener("wheel",i),e.removeEventListener("touchend",i),e.removeEventListener("touchstart",s),e.removeEventListener("touchmove",s)}},[n,t]);let s=(0,j.useCallback)(()=>{if(r.current){var e;null===(e=n.scroller)||void 0===e||e.scrollTo({top:n.scroller.scrollHeight,behavior:"auto"})}},[n]),l=(0,dt.Z_)(s,100);return l};var c6=i(87148),c7=i(16268);let c8="[CONTENT_FILTER]",ue=()=>(0,l.jsxs)(id.b,{status:"error",variant:"solid",children:[(0,l.jsx)(ra.z,{}),(0,l.jsx)(iu.X,{children:(0,l.jsxs)(tT.K,{children:[(0,l.jsx)("strong",{children:(0,l.jsx)(h.cC,{id:"7g5s/N"})}),(0,l.jsx)(a.x,{children:(0,l.jsx)(h.cC,{id:"Xp43Ei"})})]})})]}),ut=()=>(0,l.jsxs)(id.b,{variant:"light",children:[(0,l.jsx)(tP.$,{size:"sm",mr:2}),(0,l.jsxs)(iu.X,{children:[(0,l.jsx)("strong",{children:(0,l.jsx)(h.cC,{id:"n2cF1o"})})," ",(0,l.jsx)(h.cC,{id:"BFGwQA"})]})]}),ui=e=>{let{editor:t,content:i,cardId:n,cardIndex:r,cardComplete:s}=e,l=(0,eM.N2)(t.state.doc,e=>(0,a7.KH)(e))[0],o=(0,eM.N2)(t.state.doc,e=>(0,a7.KH)(e)&&e.attrs.id===n)[0];if(!l)throw Error("Doc does not have a first card");let a=o?{from:o.pos,to:o.pos+o.node.nodeSize}:0===r?{from:l.pos,to:l.pos+l.node.nodeSize}:t.state.doc.nodeSize-3;try{if(t.commands.insertContentAt(a,i,{updateSelection:0===r}),s&&0===r){let e=(0,aH.t)(t.state.doc.resolve(l.pos));e&&t.commands.command(t=>{let{tr:i}=t;return i.setSelection(e),!0})}}catch(e){console.warn("[useCreateFromStream] ERROR updating card"),console.warn(e)}},un=e=>{let{docId:t,store:i,generateInfo:n,editor:r,lazyImages:s}=e;if(!n.lastEventId||!n.streamId||!n.interactionId){console.error("Trying to resume stream for doc (id=".concat(t,") without lastEventId or streamId or interactionId"),{lastEventId:n.lastEventId,streamId:n.streamId,interactionId:n.interactionId});return}cH.a.trackRequestSent(i,{interface:"wizard",streaming:!0,interactionId:n.interactionId,isResuming:!0});let{stream:l}=(0,cW.pM)({interactionId:n.interactionId,lastEventId:n.lastEventId,streamId:n.streamId,retries:3});return(0,cU.Nl)({stream:l,docId:t,interactionId:n.interactionId,lastCompletedCardId:n.lastCompletedCardId,lastCompletedCardIndex:n.lastCompletedCardIndex,options:{lazyImages:s,imageOptions:n.imageOptions,docFormatKey:(0,c6.hx)((0,c6.VA)(r)).key},store:i})},ur=(e,t)=>{let i=(0,M.CG)(L.Pu),n=(0,M.qr)(),r=(0,M.TL)(),s=(0,M.CG)(L.KV),l=(0,e7.ye)("streamResumingEnabled"),o=(0,e7.ye)("generatorLazyImages"),a=(0,j.useRef)(!1),{isStreaming:d,onStreamData:c,onStreamDone:u,onStreamError:x,onStreamStart:h,onAbortStream
1:m}=us({docId:e}),p=c9({enabled:d,type:"editor"}),g=(0,j.useCallback)(async r=>{let s,l;if(!t)return;h({editor:t});let o=ul({streamResponse:r,editor:t,store:n,theme:i,docId:e}),d=o.getReader();try{for(;!(s=await d.read()).done;)if(s.value){if(a.current){console.log("[AIStream] has aborted -- no longer reading stream");break}l=s.value,"data"===l.event&&(c({value:l.data,editor:t,streamResponse:r}),p())}}catch(e){x({err:e,streamResponse:r,editor:t});return}a.current||(l&&"done"!==l.event&&console.error('[AIStream] incomplete stream: last message received is not `event="done"`',{lastMessage:l}),u({editor:t,streamResponse:r}))},[e,t,c,u,x,h,p,n,i]);(0,Y.v)(()=>{if(!t||!s||d||!e)return;let i=(0,iM.oH)(e)(n.getState()),r=(0,iM.nl)(n.getState());if(i){"running"===i.status&&g(i);return}if(!l||r)return;let{generateInfo:a,generateStatus:c}=(0,c6.VA)(t);if("streaming"!==c){let i=new URLSearchParams(window.location.search);if(i.get("restream")){let i={interactionId:a.interactionId,streamId:a.streamId},r=un({docId:e,generateInfo:{...i,lastEventId:"0",lastCompletedCardId:null,imageOptions:a.imageOptions||{provider:"aiGenerated"},lastCompletedCardIndex:null},editor:t,store:n,lazyImages:o});r&&g(r)}return}let u=(0,L.yx)(n.getState()),x=(null==u?void 0:u.createdTime)&&Date.now()-new Date(u.createdTime).getTime()>36e5;if(x){t.commands.updateAttributesAtPos(0,{generateStatus:"done"});return}let h=un({docId:e,generateInfo:a,editor:t,store:n,lazyImages:o});h&&g(h)},[e,t,n,s,h,x,c,u,l,g,d,o],[t,s]),(0,j.useEffect)(()=>()=>{let i=(0,iM.oH)(e)(n.getState());t&&i&&"running"===i.status&&(a.current=!0,m({editor:t,streamResponse:i}))},[r,e,m,t,n])},us=e=>{let{docId:t}=e,i=(0,iR.p)(),n=(0,M.TL)(),r=(0,M.qr)(),s=(0,e7.ye)("aiWizardUploadImages"),[o,a]=(0,j.useState)(!1),d=(0,e7.ye)("debugLogging"),c=(0,j.useRef)(null);(0,j.useEffect)(()=>()=>{c.current&&(i.close(c.current),c.current=null)},[i]);let u=(0,j.useCallback)(()=>{c.current||(c.current=i({id:"ai-generating-toast",isClosable:!1,render:()=>ut(),position:"top",duration:null}))},[i]),x=(0,j.useCallback)(e=>{let{editor:t}=e;t&&(a(!0),t.commands.setAIGenerationRunning(!0),u())},[u]),m=(0,j.useCallback)(e=>{let{editor:t,value:i,streamResponse:n}=e;if(!n||!t)return;let{id:r,cardComplete:l,index:o,content:a}=i;ui({editor:t,content:a,cardId:r,cardIndex:o,cardComplete:l}),l&&s&&(0,cK.g1)({editor:t,cardId:r})},[s]),p=(0,j.useCallback)(e=>{var t,s,o;let{editor:u,streamResponse:x}=e;if(!u||!x)return;let m=x.id,p=(0,c6.hx)((0,c6.VA)(u)),{generateInfo:g}=(0,c6.VA)(u);a(!1),u.commands.setAIGenerationRunning(!1),u.commands.updateAttributesAtPos(0,{generateStatus:"done"});let j=(0,cB.NV)(),f=j.debugInfo();d&&console.log("[AIStream] ImageStore DEBUG",{imageStore:j,debug:f}),(0,cB.Uu)(),n((0,iM.G0)({id:m,status:"complete"}));let v=(0,c7.R)(u),C=new TextEncoder().encode(JSON.stringify(u.state.doc.toJSON())),b=v?v/C.byteLength:void 0;cH.a.trackStreamComplete(r,m,{imageProvider:null===(t=g.imageOptions)||void 0===t?void 0:t.provider,numImageSearches:f.requests.length,imageSearches:f.requests,ydocToJsonRatio:b});let y=(0,L.yx)(r.getState());y&&(null===(s=y.docGenerateInput)||void 0===s?void 0:s.id)?(0,c4.d)((null===(o=g.imageOptions)||void 0===o?void 0:o.provider)==="aiGenerated"?"generateV2WithImages":"generateV2"):(0,c4.d)("wizardCreation"),c.current&&i.update(c.current,{title:(0,l.jsx)(h.cC,{id:"2/LpWt",values:{0:p.generationLabel||p.label}}),status:"success",position:"top",duration:3e3,isClosable:!0})},[n,d,r,i]),g=(0,j.useCallback)(e=>{let{err:s,editor:o,streamResponse:u}=e,x=u.id,{errorMessage:m,errorCode:p}=(0,cV.uS)(s);console.error("StreamError: ",{interactionId:x,errorMessage:m,errorCode:p,stack:s.stack}),d&&console.log("StreamError: (".concat(p,") - ").concat(m),s.stack),a(!1),o.commands.setAIGenerationRunning(!1),o.commands.updateAttributesAtPos(0,{generateStatus:"done"}),(0,cB.Uu)(),n((0,iM.G0)({id:x,status:"error"}));let g=(0,iM.Sn)(x)(r.getState());if(g){let{latency:e,...i}=g;(0,ni.pQ)({...i,errorName:"StreamError",errorMessage:m,errorCode:p,outputMessage:"",latency:e||performance.now()-i.startTime,isResuming:u.isResuming,docId:t})}c.current&&(m===c8?i.update(c.current,{render:ue,position:"top",duration:null,isClosable:!0}):i.update(c.current,{title:(0,l.jsx)(h.cC,{id:"sbsGk/"}),status:"error",position:"top",duration:null,isClosable:!0}))},[n,t,d,r,i]),f=(0,j.useCallback)(e=>{let{editor:t,streamResponse:i}=e,s=i.id;a(!1),t.commands.setAIGenerationRunning(!1),cH.a.trackStreamAbort(r,{interactionId:s,abortReason:"leave-editor"}),n((0,iM.Of)({id:s}))},[n,r]);return{isStreaming:o,onStreamStart:x,onStreamData:m,onStreamError:g,onStreamDone:p,onAbortStream
1:f}},ul=e=>{let{streamResponse:t,editor:i,store:n,docId:r,theme:s}=e,{id:l,stream:o}=t,a=!0;return o.pipeThrough(new cZ(s)).pipeThrough(new c2(t.id)).pipeThrough(new c$({editor:i,theme:s,interactionId:l})).pipeThrough(new cF.GJ({transform(e,t){if("done"===e.event&&"content_filter"===e.finishReason){t.error(Error(c8));return}t.enqueue(e)}})).pipeThrough((0,cU.c1)(e=>{a&&"data"===e.event&&(cH.a.trackStreamStart(n,{interactionId:l,docId:r}),t.isResuming&&(i.commands.deleteCardsAfter(t.lastCompletedCardId||null),t.lastCompletedCardId&&(console.log("[AIStream] refetchLazyImages",t.lastCompletedCardId),(0,cK.JZ)({editor:i,lastCompletedCardId:t.lastCompletedCardId,theme:s}))),a=!1),"data"===e.event&&e.data.cardComplete&&i.commands.updateNestedAttributesAtPos(0,{generateInfo:{lastEventId:e.id,lastCompletedCardId:e.data.id,lastCompletedCardIndex:e.data.index}})}))},uo="doc_archived_warning",ua=(e,t)=>{let i=(0,iR.p)(),[n]=(0,v.iX9)(),[r]=(0,v.sJX)(),s=null==e?void 0:e.site;(0,j.useEffect)(()=>()=>{i.close(uo)},[]),(0,j.useEffect)(()=>{if(s&&!s.archived){i.close(uo);return}!e||e.site||e.archived||i.close(uo)});let o=(0,j.useCallback)(async()=>{if((null==s?void 0:s.id)&&await r({variables:{id:s.id},optimisticResponse:{unarchiveSite:{id:s.id,__typename:"Site"}}}),!(null==e?void 0:e.id))return;let t={id:e.id};await n({variables:t,optimisticResponse:{unarchiveDoc:{...t,archived:!1,__typename:"Doc"}}}),i({title:(0,l.jsx)(h.cC,{id:"o8va6N"}),status:"success",position:"top",isClosable:!0,duration:5e3})},[null==e?void 0:e.id,i,null==s?void 0:s.id,n,r]);(0,j.useEffect)(()=>{e&&t===dI.Z.COLLABORATIVE&&((null==s?void 0:s.archived)||(null==e?void 0:e.archived))&&!i.isActive(uo)&&i({id:uo,title:(0,l.jsxs)(a.x,{"data-testid":"trash-confirmation-toast",children:[(0,l.jsx)(h.cC,{id:"fkHPZu"})," ",(0,l.jsx)(nS.r,{textDecoration:"underline",onClick:o,children:(0,l.jsx)(h.cC,{id:"7wfwc0"})})]}),status:"warning",position:"top",isClosable:!1,duration:null})},[e,t,o,s,i,n])},ud=()=>{let e=(0,e7.ye)("filmstrip"),t=(0,M.CG)(iU.fh),i=(0,iy.Br)("comment"),n=(0,M.CG)(L.gh),r=(0,M.CG)((0,X.SL)("left")),s=(0,M.CG)(eC.Lw);return e&&t===dI.Z.COLLABORATIVE&&i&&n===eV.q.DOC_VIEW&&!(0,ef.s2)()&&!r&&!s};var uc=i(85e3),uu=i(60265);let ux=()=>{let e=J(),t=Q(),i=uh(),n=(0,en.i)({base:!1,lg:!0,[i?"3xl":"2xl"]:!1}),r=(0,M.CG)(L.Hl),s=(0,M.CG)(ak.GX),l=ud(),o=(0,uc.k)(),a=(0,sJ.S)({base:"0px",[uu.K0]:t3.bk})||"0px",{width:d}=a4(),c=(0,j.useMemo)(()=>({"--doc-padding-left":s&&l&&n?"".concat(d,"px"):"0px","--doc-padding-right":r?a:o?"60px":"0px","--present-padding-left":"".concat(e,"px"),"--present-padding-right":"".concat(t,"px"),"--comment-slide-margin":a}),[d,s,e,r,t,o,n,a,l]);return c},uh=()=>{let{editor:e}=(0,n4._i)(),{defaultContentWidth:t}=(0,M.CG)(L.US);if("lg"===t)return!0;if(!e)return!1;let{doc:i}=e.state;return(0,oF.Jn)(i.firstChild.content).some(e=>(0,a7.KH)(e)&&"lg"===e.attrs.container.width)};var um=i(85679),up=i(82655),ug=i(44663),uj=i(27902);let uf=e=>{let{launchIntercomUI:t}=e;return function(e){let{onClose:i}=e;return(0,l.jsxs)(o.k,{p:4,color:"white",bg:"yellow.500",borderRadius:"md",alignItems:"center",position:"relative",children:[(0,l.jsx)(eZ.P,{size:"sm",onClick:i,position:"absolute",insetEnd:1,top:1}),(0,l.jsx)(x.G,{icon:up.xHz,size:"2x"}),(0,l.jsxs)(o.k,{direction:"column",ml:3,children:[(0,l.jsx)(d.xu,{children:(0,l.jsx)(a.x,{lineHeight:6,fontSize:"sm",children:(0,l.jsx)(h.cC,{id:"4YARE9",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc},components:{0:(0,l.jsx)("b",{})}})})}),(0,l.jsx)(a.x,{lineHeight:6,fontSize:"sm",pt:2,children:(0,l.jsx)(h.cC,{id:"Enj8Kw",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc},components:{0:(0,l.jsx)(eh.z,{as:nS.r,variant:"link",textDecoration:"underline",fontSize:"sm",onClick:()=>{t()},colorScheme:"white"})}})})]})]})}},uv="no-snapshot-warning",uC=(e,t)=>{let i=(0,ug.G)(),n=(0,iR.p)(),r=(0,uj.z$)(),s=null==e?void 0:e.id,l=t===dI.Z.COLLABORATIVE&&(null==e?void 0:e.currentSnapshotId)===null;(0,j.useEffect)(()=>{!l||n.isActive(uv)||(n({id:uv,render:uf({launchIntercomUI:i}),duration:null,position:"top",isClosable:!0}),null==r||r.track(ez.xW.NO_CURRENT_SNAPSHOT,{docId:s}))},[r,s,i,l,n])},ub=e=>{let t=(0,M.TL)(),i=(0,M.CG)(ak.GX),n=(0,j.useRef)(!1);(0,j.useEffect)(()=>{!e||n.current||i||(n.current=!0,t((0,ak.dQ)({isOpen:!0})))},[t,i,e])},uy=e=>{let{togglePagesPanel:t,isPagesPanelOpen:i}=e,n=(0,M.TL)(),r=(0,M.qr)(),{asPath:s}=(0,eg.useRouter)(),l=(0,M.CG)(eC.tv),o=(0,j.useRef)(i),a=(0,eA.BZ)(s),d=(0,j.useRef)(t);d.current=t,(0,nQ.r)(()=>{let e=(0,X.SL)("left")(r.getState()),t=d.current;a&&e?(t({override:"closed",disableTransition:!1}),o.current=!0):a||t({override:o.current?"open":"closed",disableTransition:!1})},[a]),(0,j.useEffect)(()=>{let e=a?(0,ef.s2)()?"mobile":l||"desktop":null;n((0,eC.Tj)({previewSize:e}))},[n,a,l])};var uk=i(56675);let uw=e=>{let t=(0,uk.x)(),i=(0,M.CG)((0,lx.cn)(e));(0,j.useEffect)(()=>{i&&t.cache.updateQuery({query:iW.yE1,variables:{id:e}},e=>{if(!(null==e?void 0:e.doc))return e;let t=e.doc;return t.titleEdited?e:{doc:{...t,title:i}}})},[i,t,e])};var uS=i(56400);let uE=(e,t)=>{let{isUnauthorized:i}=(0,tH._)();(0,ez.If)(n=>{!0!==i&&void 0!==i&&(n.track(ez.AA.DOC_VIEWED,{doc_id:e}),t===dI.Z.EXAMPLE_STATIC&&n.track(ez.AA.EXAMPLE_VIEWED,{doc_id:e}))},[e,t,i]),(0,uS.d)();let n=(0,e7.ye)("realUserMetrics"),r=t===dI.Z.COLLABORATIVE&&n,s=(0,e7.ye)("rumKeystrokeSampleRate");(0,n0.lh)(r,s)},uI=e=>{let t=(0,f.I0)(),i=(0,ez.z$)();(0,j.useEffect)(()=>{let n;let r=()=>{let r=(0,M.bh)().getState();n=(0,L.Q5)(r),(0,n1.I7)(e),t((0,L.lx)({isEditingDisabled:!0})),null==i||i.trackDocEvent(ez.AA.DOC_PRINTED)},s=()=>{t((0,L.lx)({isEditingDisabled:!1})),t((0,L.xn)({expandedCardsMap:n}))};return window.addEventListener("beforeprint",r),window.addEventListener("afterprint",s),(
1)=>{window.removeEventListener("beforeprint",r),window.removeEventListener("afterprint",s)}},[t,e,i])};var u_=i(34972),uA=i(50788),uT=i(741),uO=i(94465),uP=i(42703),uD=i(90383);let uR=e=>"tablet"===e?"768px":"mobile"===e?(0,ef.s2)()?"100%":"375px":"100%",uG=e=>{let{loading:t,...i}=e,{editor:n,docId:r,previewSize:s}=i;return(0,l.jsx)(u_.BU,{children:(0,l.jsx)(uA.cL,{children:(0,l.jsx)(o.k,{pos:"relative",justifyContent:"center",bg:"#C5C5C5",flex:1,children:!t&&n&&r?(0,l.jsx)(uz,{...i,editor:n,docId:r}):(0,l.jsx)(d.xu,{flexDirection:"column",w:uR(s),h:"var(--100vh)",bg:"gray.100","data-testid":"preview-editor-loading",inset:0,children:(0,l.jsx)(tO.M,{h:"100%",children:(0,l.jsx)(tT.K,{align:"center",children:(0,l.jsx)(tP.$,{})})})})})})})},uz=e=>{let{docId:t,editor:i,previewSize:n,onCreate:r}=e,s=(0,j.useMemo)(()=>(0,tC.e)().concat(nA.F),[]),a=(0,j.useMemo)(()=>i.getJSON(),[i]),u="mobile"===n?"mobile":"desktop",x=(0,uO.j)({async onCreate(e){let{editor:t}=e;console.debug("[SimpleEditor][onCreate] TipTap editor is now ready"),null==r||r({editor:t})},content:a,extensions:s,editable:!1});x.shouldUsePublishedVersion=!0;let{editorAnimationsClass:h,editorAnimationsCSSVars:m}=(0,eP.k)({editor:x,instanceId:u,scrollingParentSelector:".".concat(dI.B)}),p=(0,M.CG)(eE.lH),g=(0,M.CG)(L.Pu),f=(0,uD.nT)(p),v=f?eR.ZQ:0;return(0,l.jsxs)(d.xu,{className:(0,c.cx)("preview-editor-root",h),style:m,w:uR(n),h:"100%",css:{"--editor-width":"100vw","--doc-padding-top":"".concat(v,"px"),"--editor-padding-top":"".concat(50,"px")},position:"relative",transitionProperty:"width",transitionDuration:"normal",shadow:"xl",children:[p&&f&&(0,l.jsx)(o.k,{pos:"absolute",top:0,left:0,w:"100%",zIndex:"10",children:(0,l.jsx)(uT.n,{theme:g,editable:!1,content:p.navContent},"".concat(t,"__preview-editor-nav__").concat(u,"}"))}),(0,l.jsx)(uP.f,{editor:x},"".concat(t,"__preview-editor__").concat(u,"}"))]})},uN=()=>{let e=(0,M.CG)(eE.lH),t=(0,M.CG)(L.Pu),i=(0,M.qr)(),[n]=(0,v.Iyu)(),r=(0,j.useCallback)(async e=>{var t;let{editor:r}=e,s=null===(t=(0,eE.lH)(i.getState()))||void 0===t?void 0:t.id;s&&await n({variables:{input:{siteId:s,navContent:r.state.doc.toJSON()}}})},[n,i]),s=(0,tr.Kt)(r,500);return e?(0,l.jsx)(o.k,{pos:"absolute",top:0,left:0,w:"100%",zIndex:dS.S.siteNav,children:(0,l.jsx)(uT.n,{theme:t,onUpdate:s,content:e.navContent,editable:!0,scrollingParentSelector:".".concat(dI.B)})}):null},uM="doc-root",uL=e=>{let{isConnected:t}=e;return(0,l.jsx)(o.k,{flex:1,alignItems:"center",justifyContent:"center",color:"gray.500",fontSize:"2xl",children:t?(0,l.jsx)(h.cC,{id:"svObPT",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}}):(0,l.jsxs)(o.k,{m:8,alignItems:"center",direction:"row",children:[(0,l.jsx)(x.G,{icon:u.bKP,size:"4x"}),(0,l.jsx)(a.x,{ml:8,children:(0,l.jsx)(h.cC,{id:"qercPA",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc},components:{0:(0,l.jsx)("strong",{})}})})]})})},uF=e=>{let{doc:t,user:i,docEditorType:n}=e,r=(0,C.$m)(t,i),s=(0,f.v9)(L.gh),o=n===dI.Z.COLLABORATIVE&&!r,a=o&&s===eV.q.SLIDE_VIEW,d=n===dI.Z.COLLABORATIVE&&!i;return d?(0,l.jsx)(nP.m,{docWorkspace:null==t?void 0:t.organization}):a?(0,l.jsx)(B,{}):o?(0,l.jsx)(k.C,{showTourReplay:!0}):null},uU=(0,n4.eT)(e=>{let{docEditorType:t}=e,i=(0,M.TL)(),{docId:n,isUnauthorized:r,setCollaborativeEditorInstance:s,editor:a}=(0,n4._i)(),u=(0,M.CG)(iU.yx),x=(0,M.CG)(eE.lH),h=(0,M.CG)(eE.$U),p=(0,eY.py)("comment",u),f=(0,ek.O1)(),{isConnected:k}=(0,v.$gs)(),w=(0,lv.mb)(null==u?void 0:u.id,h),[S,E]=(0,j.useState)(null),I=(0,M.CG)(eC.tv),_=null!==I,{user:A}=(0,eY.SE)();(0,b.F3)(),ua(u,t),uC(u,t),ur(n,S===n?a:void 0),uw(n),uE(n,t),e_(a,t===dI.Z.COLLABORATIVE),(0,um.j)(),cz();let{editorAnimationsClass:T,editorAnimationsCSSVars:O}=(0,eP.k)({editor:a,scrollingParentSelector:".".concat(uM),disabledOverride:_});cN(),oU(a,".".concat(uM)),oY(a),tl(),uI(a),(0,C.DD)(u,t===dI.Z.COLLABORATIVE);let P=(0,j.useRef)(null),D=(0,eT.Yy)(),R=(0,j.useMemo)(()=>(0,eD.vu)(D),[D]),G=ud();ub(G),console.debug("%c[DocEditorComponent] RENDER - ".concat(n),"background-color: gold");let{togglePanel:z,isPanelOpen:N}=$(oL,f),{togglePanel:L,isPanelOpen:F}=$(t8),{togglePanel:U,isPanelOpen:W}=$(iD);iP({toggleDesignPartnerPanel:U,isDesignPartnerPanelOpen:W,editor:a});let{togglePanel:H,isPanelOpen:V}=$(tt);tn({toggleCardNotesPanel:H,isCardNotesPanelOpen:V,editor:a}),(0,j.useEffect)(()=>()=>{i((0,X.qo)()),i((0,eE.mc)())},[i]),uy({togglePagesPanel:z,isPagesPanelOpen:N});let B=(0,eA.Vr)(x)&&(null==x?void 0:x.navEnabled)&&!_,K=!!(x&&!_&&x.routes.length>1&&a);(0,tr.vm)(()=>{K&&z({override:"open",disableTransition:!1})}
1,[z,K],[K]);let Y=(0,j.useCallback)(()=>!!(a&&a.state.selection.empty),[a]),{leftPanelLifecycle:J,rightPanelLifecycle:Q,globalPanelLifecycle:et}=ee(),ei=(0,q.dU)(null==u?void 0:u.organization),en=(0,y.U)(null==u?void 0:u.title,ei),er=m.ag._({id:"X6YCwz"}),es=m.ag._({id:"abr3hR"}),el=p?49:0,eo=ux(),ea=(0,j.useMemo)(()=>{let e=B?{"--doc-padding-top":eR.ik}:void 0;return{...R,...eo,...e}},[R,eo,B]),eu=(null==u?void 0:u.archived)||(null==x?void 0:x.archived)||_;return(0,l.jsx)(lv.DN.Provider,{value:w,children:(0,l.jsxs)(o.k,{direction:"column",h:"100%",children:[(0,l.jsx)("style",{id:"editorStyleOverride",children:"body {overflow: hidden;}"}),(0,l.jsx)(g(),{children:(0,l.jsx)("title",{children:en})}),(0,l.jsx)(tF,{doc:u,editor:a}),(0,l.jsx)(ey.H9,{isEnabledFn:Y}),_&&h?(0,l.jsx)(eb,{docId:n}):p?(0,l.jsx)(cO,{isDark:D,scrollingParentSelector:".".concat(uM),editorWrapperEl:P.current,docEditorType:t,isPagesPanelOpen:N,togglePagesPanel:z,isCommentsPanelOpen:F,toggleCommentsPanel:L}):null,r?(0,l.jsx)(uL,{isConnected:k}):(0,l.jsxs)(o.k,{id:"doc-main",direction:"row",w:"100%",h:"calc(100% - ".concat(el,"px)"),sx:{"--editor-padding-top":"".concat(el,"px")},"data-testid":"doc-editor-root",ref:P,children:[(0,l.jsx)(ec,{panelLifecycle:J}),(0,l.jsx)(o.k,{flex:"1",direction:"column",position:"relative",minWidth:"0",h:"100%",children:(0,l.jsxs)(d.xu,{flex:"1",overflowY:"auto",overflowX:"hidden",pos:"relative",minWidth:"0",h:"100%",className:(0,c.cx)(uM,T,W&&"design-partner-panel-open"),style:{"--ai-editing-label":"'".concat(er,"'"),"--ai-generating-label":"'".concat(es,"'"),...O},sx:ea,children:[_&&(0,l.jsx)(uG,{loading:n!==S,docId:n,editor:a,previewSize:I},"".concat(n,"__preview-editor")),t===dI.Z.PUBLIC_STATIC?(0,l.jsx)(oK,{docId:n,snapshotId:null==u?void 0:u.currentSnapshotId,scrollingParentSelector:".".concat(uM),onCreate:s}):t===dI.Z.EXAMPLE_STATIC?(0,l.jsx)(nG,{docId:n,snapshotId:null==u?void 0:u.currentSnapshotId,scrollingParentSelector:".".concat(uM),onCreate:s}):(0,l.jsxs)(Z.Mn.Provider,{value:et,children:[(0,l.jsx)(eO.Ge,{doc:u,docId:n,readOnly:eu,hideForPreview:_,onCreate:e=>{s(e),E(e.gammaDocId),e.on("destroy",()=>{E(null)})},scrollingParentSelector:".".concat(uM),animationsExtensionEnabled:!0},"".concat(n,"__collaborative-editor")),a&&(0,l.jsx)(eq,{editor:a})]}),B&&(0,l.jsx)(uN,{}),!_&&(0,l.jsx)(ny,{editor:a},n),(0,l.jsx)(au,{editor:a})]})}),(0,l.jsx)(ed,{panelLifecycle:Q}),(0,l.jsx)(eG.a,{editorId:"main",children:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(uF,{doc:u,user:A,docEditorType:t}),G&&(0,l.jsx)(dk,{})]})})]})]})})});var uW=i(69251),uH=i(11881),uV=i(53596);let uB=e=>{let{theme:t,onClick:i,isChecked:n,index:r,startIndex:s}=e;return(0,l.jsxs)(d.xu,{gridColumnStart:r+1-s,display:s>r?"none":"block",gridRow:1,as:uH.f,p:2,transition:"all 0.2s ease-in-out",bgColor:n?"trueblue.100":"linen.50",textAlign:"left",tabIndex:0,borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_focus:{boxShadow:n?void 0:"outline"},outline:"none",onClick:i,_hover:{bgColor:n?"trueblue.100":"gray.100"},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&i()},"data-theme-id":t.id,"data-testid":n?"current-theme-preview":void 0,cursor:"pointer",children:[(0,l.jsx)(uV.n,{theme:t}),(0,l.jsxs)(tT.K,{direction:"row",spacing:1,pt:1,children:[n&&(0,l.jsx)(tA.n,{w:3,h:"auto",mr:1,color:"trueblue.700"}),(0,l.jsx)(a.x,{fontSize:"sm",noOfLines:1,"data-testid":"theme-name",color:n?"trueblue.700":void 0,children:t.name})]})]})};uB.displayName="DemoDocThemePreview";let uK="linen.50",uq=e=>{let{templateTheme:t,setTheme:n,currentThemeId:r}=e,s=(0,f.v9)(L.gh),a=s===eV.q.SLIDE_VIEW,[d,c]=(0,j.useState)([]),[m,p]=(0,j.useState)(!1),[g,v]=(0,j.useState)(0),C=(0,en.i)({base:3,md:4,lg:5})||3;(0,j.useEffect)(()=>{i.e(4392).then(i.bind(i,44392)).then(e=>{c(e.GLOBAL_THEMES)})},[]);let b=[...t?[t]:[],...d.filter(e=>e.id!==(null==t?void 0:t.id))],y=(0,j.useCallback)(e=>{1===e?v(e=>e+1):v(e=>e-1)},[]);return a?(0,l.jsx)(l.Fragment,{}):(0,l.jsx)(nz.h,{children:(0,l.jsxs)(o.k,{w:"100%",position:"absolute",bottom:0,left:0,bgColor:uK,zIndex:"sticky",direction:"column",borderTop:"3px solid var(--chakra-colors-trueblue-500)",minH:12,p:2,justifyContent:"center",children:[(0,l.jsx)(o.k,{alignItems:"flex-end",justify:"flex-end",children:(0,l.jsx)(eh.z,{variant:"ghost",size:"sm",rightIcon:(0,l.jsx)(x.G,{icon:m?u.gc2:u.onQ}),onClick:()=>p(e=>!e),children:m?(0,l.jsx)(h.cC,{id:"yz7wBu"}):(0,l.jsx)(h.cC,{id:"x6tIe+"})})}),(0,l.jsx)(o.k,{justify:"flex-start",align:"flex-start",bgColor:uK,w:"100%",children:m&&(0,l.jsxs)(tT.K,{direction:"row",align:"center",justify:"center",w:"100%",children:[(0,l.jsx)(I.h,{"aria-label":"Left",onClick:()=>y(-1),variant:"ghost",isDisabled:0===g,icon:(0,l.jsx)(x.G,{icon:u.EyR})}),(0,l.jsx)(uW.r,{w:"100%",flex:1,overflow:"hidden",padding:2,transition:"all 0.2s ease-in-out",templateColumns:["repeat(".concat(C,", calc(100% / ").concat(C," - 1em))")],gap:"0 1em",bgColor:uK,children:b.map((e,t)=>(0,l.jsx)(uB,{index:t,startIndex:g,isChecked:e.id===r,theme:e,onClick:()=>{n(e)}},e.id))}),(0,l.jsx)(I.h,{"aria-label":"Right",variant:"ghost",isDisabled:g+C>b.length,onClick:()=>y(1),icon:(0,l.jsx)(x.G,{icon:u.yOZ})})]})})]})})};var uY=i(89833),uZ=i(34303);let uX=[{description:(0,l.jsx)(h.cC,{id:"gtWy3j"}),shortcut:["â","â"]},{description:(0,l.jsx)(h.cC,{id:"UCxK2S"}),shortcut:["â","â"]},{description:(0,l.jsx)(h.cC,{id:"IkakN2"}),shortcut:"Esc"},{description:(0,l.jsx)(h.cC,{id:"CgmvBu"}),shortcut:"S"},{description:(0,l.jsx)(h.cC,{id:"rEj/lx"}),shortcut:"Enter"},{description:(0,l.jsx)(h.cC,{id:"dQU33K"}),shortcut:"Mod+Shift+O"},{description:(0,l.jsx)(h.cC,{id:"K0Oq/D"}),shortcut:"R"}],uJ=e=>{let{editorWrapperEl:t,scrollingParentSelector:i}=e,{enterSlideView:n,exitSlideView:r,setExitedFullscreenByClick:s,isFullscreen:o,enterFullscreen:a,exitFullscreen:d}=rt({editorWrapperEl:t,scrollingParentSelector:i}),c=(0,M.CG)(L.gh),p=(0,j.useRef)(c);return(0,j.useEffect)(()=>{p.current=c},[c]),(0,l.jsxs)(ex.U,{children:[(0,l.jsxs)(em.h,{isAttached:!0,size:"sm",children:[(0,l.jsx)(ep.kH,{label:c===eV.q.DOC_VIEW?(0,l.jsx)(h.cC,{id:"ek5OwP",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}}):(0,l.jsx)(h.cC,{id:"43JI0J",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}}
1),children:(0,l.jsx)(eh.z,{variant:c===eV.q.DOC_VIEW?"solid":"plain",cursor:c===eV.q.SLIDE_VIEW?"pointer":"auto",onClick:()=>{c===eV.q.SLIDE_VIEW&&r()},leftIcon:(0,l.jsx)(x.G,{icon:u.cwv}),children:(0,l.jsx)(h.cC,{id:"7Zdnlq"})})}),(0,l.jsx)(ep.kH,{label:c===eV.q.SLIDE_VIEW?(0,l.jsx)(h.cC,{id:"Zfr5aa",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}}):(0,l.jsx)(h.cC,{id:"rK6Cev",values:{GAMMA_ARTIFACT_PROPER_NOUN:K.Yc}}),children:(0,l.jsx)(eh.z,{variant:c===eV.q.SLIDE_VIEW?"solid":"plain",cursor:c===eV.q.DOC_VIEW?"pointer":"auto",onClick:()=>{c===eV.q.DOC_VIEW&&n({fullscreen:!1})},leftIcon:(0,l.jsx)(x.G,{icon:u.bgy}),children:(0,l.jsx)(h.cC,{id:"FOoDGS"})})})]}),c===eV.q.SLIDE_VIEW&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(rn.i,{orientation:"vertical"}),(0,l.jsx)(ep.kH,{label:o?(0,l.jsx)(h.cC,{id:"IkOhTI"}):(0,l.jsx)(h.cC,{id:"q8ARHN"}),children:(0,l.jsx)(I.h,{size:"sm","aria-label":o?m.ag._({id:"IkOhTI"}):m.ag._({id:"q8ARHN"}),borderRadius:"md",icon:(0,l.jsx)(x.G,{icon:o?u.Qj4:u.TL5}),onClick:o?()=>{s(!0),d()}:a})}),(0,l.jsxs)(S.J,{children:[(0,l.jsx)(E.x,{children:(0,l.jsx)(eh.z,{size:"sm",variant:"plain",fontWeight:"normal",children:(0,l.jsx)(h.cC,{id:"77Emn0"})})}),(0,l.jsxs)(_.y,{border:"1px solid #eee !important",children:[(0,l.jsx)(dQ.Q,{}),(0,l.jsx)(uY.u,{}),(0,l.jsx)(A.b,{children:(0,l.jsx)(uZ.A,{list:uX})})]})]})]})]})},uQ=(0,j.memo)(function(e){let{scrollingParentSelector:t,editorWrapperEl:i}=e;(0,M.CG)(iU.yx);let n=(0,j.useRef)(null);return(0,l.jsx)(o.k,{ref:n,bg:"white",borderBottom:"3px solid var(--chakra-colors-trueblue-600)",position:"absolute",zIndex:"overlay",top:0,left:0,right:0,p:2,alignItems:"flex-start",justifyContent:"flex-start",pr:6,children:(0,l.jsx)(o.k,{direction:"column",w:"100%",children:(0,l.jsx)(uJ,{editorWrapperEl:i,scrollingParentSelector:t})})})});var u$=i(5689),u0=i(91148);let u1=e=>{let{toggleToCPanel:t,initializeToCPanel:i,isToCPanelOpen:n}=e,{breakpoints:{xl:r}}=(0,u0.F)(),s=(0,M.CG)(L.gh),[l,o]=(0,j.useState)(s!==eV.q.SLIDE_VIEW),[a,d]=(0,j.useState)(!1),c=(0,f.I0)();(0,tr.vm)(()=>{i()},[r,t,i,c],[]),(0,tr.vm)(()=>{s===eV.q.SLIDE_VIEW?(o(n),t({disableTransition:!1,override:"closed"})):a&&s===eV.q.DOC_VIEW&&t({disableTransition:!1,override:l?"open":"closed"})},[t,n,l,s,a],[s])},u2="doc-root",u5=(0,n4.eT)(e=>{var t;let{docEditorType:i=dI.Z.COLLABORATIVE}=e,{docId:n,setCollaborativeEditorInstance:r,editor:s}=(0,n4._i)(),a=(0,M.CG)(iU.yx);uE(n,i),(0,um.j)(),cz(),cN(),oU(s,".".concat(u2)),oY(s),tl(),uI(s),(0,C.DD)(a,i===dI.Z.COLLABORATIVE);let c=(0,j.useRef)(null),u=null==a?void 0:a.theme,[x,h]=(0,j.useState)(()=>u),m=(0,M.TL)(),p=(0,j.useRef)(!1),{data:f}=(0,v.EDv)({variables:{docId:n,snapshotId:null==a?void 0:a.currentSnapshotId},skip:!(null==a?void 0:a.currentSnapshotId)}),b=null==f?void 0:null===(t=f.snapshot)||void 0===t?void 0:t.content.default;console.debug("%c[DemoDocEditorComponent] RENDER - ".concat(n),"background-color: gold"),(0,j.useEffect)(()=>{u&&!p.current&&(h(u),p.current=!0)},[u]),(0,j.useEffect)(()=>{if(!s)return;let e=null==x?void 0:x.config.accentBackgrounds;if(!e||0===e.length){b&&s.commands.setContent(b);return}s.commands.updateThemeAccentImages(e)},[s,x,b]);let{togglePanel:y,isPanelOpen:k,initPanel:w}=$(u$.Q);u1({toggleToCPanel:y,isToCPanelOpen:k,initializeToCPanel:w}),(0,j.useEffect)(()=>()=>{m((0,X.qo)())},[m]);let{leftPanelLifecycle:S,globalPanelLifecycle:E}=ee();return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("style",{id:"editorStyleOverride",children:"body {overflow: hidden;}"}),(0,l.jsx)(g(),{children:(0,l.jsxs)("title",{children:["".concat(a?(0,sH.$)(a.title)+" | ":""),"Gamma"]})}),(0,l.jsxs)(o.k,{id:"doc-main",direction:"row",w:"100%",h:"100%","data-testid":"doc-editor-root",ref:c,children:[(0,l.jsx)(ec,{panelLifecycle:S}),(0,l.jsxs)(o.k,{flex:"1",direction:"column",position:"relative",minWidth:"0",h:"100%",children:[s&&(0,l.jsx)(uQ,{scrollingParentSelector:".".concat(u2),editorWrapperEl:c.current,setTheme:h,currentThemeId:(null==x?void 0:x.id)||(null==u?void 0:u.id),templateTheme:u}),(0,l.jsxs)(d.xu,{flex:"1",overflowY:"auto",overflowX:"hidden",minWidth:"0",h:"100%",className:u2,children:[(0,l.jsx)(oK,{docId:n,snapshotId:null==a?void 0:a.currentSnapshotId,scrollingParentSelector:".".concat(u2),onCreate:r,theme:x,hideMadeWithGammaBadge:!0}),(0,l.jsx)(au,{editor:s,showNavigationControls:!0})]})]}),(0,l.jsx)(uq,{setTheme:h,currentThemeId:(null==x?void 0:x.id)||(null==u?void 0:u.id),templateTheme:u})]})]})});var u4=i(73077);let u3="body",u9=e=>
1{let t=(0,c3.As)(e),[i,n]=(0,j.useState)("up");return(0,j.useEffect)(()=>{let e=document.querySelector(t.scrollSelector);if(!e)return;let i=(null==e?void 0:e.scrollTop)||0,r=e=>Math.abs(e-i)>0,s=e=>{let t=e>i&&!(i>0&&0===e)&&!(e>0&&0===i);return t},l=()=>{let t=(null==e?void 0:e.scrollTop)||0;if(r(t)){let e=s(t)?"down":"up";n(e),i=t>0?t:0}},o=D()(()=>window.requestAnimationFrame(l),500,{leading:!0});return null==e||e.addEventListener("scroll",o),()=>null==e?void 0:e.removeEventListener("scroll",o)},[t.scrollSelector]),i};var u6=i(62685),u7=i(1887);let u8=e=>{let t=(0,M.CG)(L.e_),i=(0,M.TL)(),n=(0,j.useCallback)(e=>{i((0,L.Qt)({docAttrs:{format:e}}))},[i]);return(0,l.jsx)(em.h,{size:"sm",isAttached:!0,my:2,children:u7.n.map(e=>(0,l.jsx)(eh.z,{isActive:e.key===t.key,onClick:()=>n(e.key),children:t5()(e.label)},e.key))})},xe=(0,j.memo)(()=>(0,l.jsx)(d.xu,{w:"100%",h:"1px",bg:"gray.200",my:2,mx:-2,_first:{display:"none"},_last:{display:"none"}}));xe.displayName="MenuDivider";let xt=(0,j.memo)(e=>{let{icon:t,children:i,...n}=e;return(0,l.jsx)(d.xu,{as:"button",w:"100%",textAlign:"left",px:2,py:2,fontWeight:"500",color:"gray.700",transition:"all 0.2s",_hover:{bg:"gray.100"},_focus:{outline:"none"},_active:{bg:"gray.200"},borderRadius:"md",...n,children:(0,l.jsxs)(ex.U,{children:[t&&(0,l.jsx)(d.xu,{children:t}),(0,l.jsx)(d.xu,{children:i})]})})});xt.displayName="MenuItem";let xi=e=>{var t,i;let{isOpen:n,onClose:r,doc:s,editingEnabled:d}=e,{user:c}=(0,eY.SE)(),{isConnected:m}=(0,v.$gs)(),p=(0,nE.e)(),{editor:g}=(0,n4._i)(),f=(0,sH.$)(null==s?void 0:s.title),C=(null==s?void 0:s.createdTime)&&(0,sU.Z)((0,sW.Z)(s.createdTime),"PPP"),b=null==s?void 0:s.id,{isOpen:y,onClose:k,onOpen:w}=(0,tL.M)({id:"analyticsPanelDisclosure"}),[S]=(0,v.LT4)(),[E]=(0,v.iX9)(),I=(0,ez.z$)(),_=(0,eY.py)("manage",s)&&!!c,A=(0,eY.py)("manage",s)&&!!c,T=!!(c&&0!==c.workspaceMemberships.length),O=(0,e7.ye)("docFormats"),P=(0,j.useCallback)(async()=>{if(!g)return;let e=g.getJSON();await p({docId:b,initialContent:e,source:"editor_toolbar_doc_menu_duplicate",newWindow:!1}),r()},[b,p,g,r]),D=(0,j.useCallback)(()=>{null==I||I.track(ez.AA.DOC_ANALYTICS_VIEWED,{docId:b,source:"toolbar_doc_menu",type:"personal"}),w()},[I,b,w]),R=(0,j.useCallback)(e=>()=>{if(!b)return;let t={id:b};e?S({variables:t,optimisticResponse:{archiveDoc:{...t,archived:e,__typename:"Doc"}}}):E({variables:t,optimisticResponse:{unarchiveDoc:{...t,archived:e,__typename:"Doc"}}})},[S,b,E]);return(0,l.jsxs)(l.Fragment,{children:[s&&(0,l.jsx)(ep.Aj,{isOpen:n,onClose:r,children:(0,l.jsxs)(o.k,{w:"100%",h:n?"100%":void 0,direction:"column",children:[(0,l.jsxs)(ex.U,{align:"flex-start",p:6,children:[(0,l.jsxs)(tT.K,{spacing:0,children:[(0,l.jsx)(a.x,{fontSize:"2xl",fontWeight:"bold",letterSpacing:"tight",noOfLines:6,children:f}),(0,l.jsx)(a.x,{fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,l.jsx)(h.cC,{id:"jlWdji",values:{createdTime:C}})}),(0,l.jsx)(ep.kH,{label:null==s?void 0:null===(t=s.createdBy)||void 0===t?void 0:t.email,children:(0,l.jsx)(a.x,{display:"inline-block",fontSize:"sm",color:"gray.500",noOfLines:1,children:(0,l.jsx)(h.cC,{id:"t490IT",values:{0:null==s?void 0:null===(i=s.createdBy)||void 0===i?void 0:i.displayName}})})})]}),(0,l.jsx)(nN.L,{}),(0,l.jsx)(eZ.P,{mt:-2,onClick:e=>{e.stopPropagation(),r()}})]}),(0,l.jsxs)(tT.K,{p:3,pt:0,children:[O&&(0,l.jsx)(u8,{}),(0,l.jsx)(xe,{}),A&&(0,l.jsx)(xt,{icon:(0,l.jsx)(x.G,{icon:u.nNP,fixedWidth:!0}),onClick:()=>{r(),sK.T.emit("openSharePanel",{view:"invite"})},children:(0,l.jsx)(h.cC,{id:"iyga2M"})}),d&&(0,l.jsx)(xt,{icon:(0,l.jsx)(x.G,{icon:u.q2v,fixedWidth:!0}),onClick:()=>{r(),sK.T.emit("toggleThemeBlock",!0)},"data-testid":"mobile-theme-button",children:(0,l.jsx)(h.cC,{id:"W15e8B"})}),(0,l.jsx)(xe,{}),m&&(0,l.jsxs)(l.Fragment,{children:[!!c&&A&&(0,l.jsx)(xt,{icon:(0,l.jsx)(x.G,{icon:u.Ma4,fixedWidth:!0}),onClick:()=>{r(),D()},children:(0,l.jsx)(h.cC,{id:"qcxxQS"})}),T&&(0,l.jsx)(xt,{icon:(0,l.jsx)(x.G,{icon:u.kZ_,fixedWidth:!0}),onClick:P,children:(0,l.jsx)(h.cC,{id:"euc6Ns"})}),_&&(0,l.jsx)(xt,{icon:(0,l.jsx)(x.G,{icon:u.kwI,fixedWidth:!0}),onClick:()=>{r(),sK.T.emit("openSharePanel",{view:"export"})},children:(0,l.jsx)(h.cC,{id:"U8WPSi"})}),(0,l.jsx)(xt,{icon:(0,l.jsx)(x.G,{icon:u.gr5,fixedWidth:!0}),onClick:()=>{r(),sK.T.emit("openPageSetup","cards")},children:(0,l.jsx)(h.cC,{id:"Kx2GmY"})}),A&&(0,l.jsx)(xe,{}),A?s.archived?(0,l.jsx)(xt,{icon:(0,l.jsx)(x.G,{icon:u.ZeM,fixedWidth:!0}),onClick:R(!1),children:(0,l.jsx)(h.cC,{id:"yKu/3Y"})}):(0,l.jsx)(xt,{"data-testid":"doc-menu-trash-button",color:"red.500",icon:(0,l.jsx)(x.G,{icon:u.XAH,fixedWidth:!0}),onClick:R(!0),children:(0,l.jsx)(h.cC,{id:"1C/Yjq"})}):null]})]})]})}),s&&y&&(0,l.jsx)(sO,{doc:s,isAnalyticsPanelOpen:y,onAnalyticsPanelClose:k,mode:"full"}),d&&(0,l.jsx)(lE,{editor:g}),d&&(0,l.jsx)(cS,{})]})},xn=e=>{var t,i,n;let{doc:r,editor:s,commentsEnabled:o,editingEnabled:d,onCommentFeedOpen:c,onTocOpen:h}=e,[m]=(0,dN.X)(U.H.lastHomeUrl,"/"),{user:p}=(0,eY.SE)(),g=(0,eY.py)("manage",r),C=(null==r?void 0:null===(t=r.comments)||void 0===t?void 0:t.filter(e=>e.status===v.Ux9.Open).length)||0,b=u9("editor"),y=(0,f.v9)(L.Pu),k=(0,u6.Jh)(y),S=null!==(i=y.config.bodyColor)&&void 0!==i?i:(0,tj.wj)(y)?"white":"gray.800",E=null!==(n=y.accentColor)&&void 0!==n?n:(0,tj.wj)(y)?"trueblue.300":"trueblue.700",_=(0,j.useCallback)(()=>{s&&s.commands.undo()},[s]),{isOpen:A,onOpen:T,onClose:O}=(0,w.q)();return r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(xi,{doc:r,isOpen:A,onClose:O,editingEnabled:d}
1),(0,l.jsxs)(ex.U,{p:1,px:2,bg:"gray.50",shadow:"lg",position:"sticky",top:0,transitionProperty:"common",transitionDuration:"normal",transform:"up"==b?"translate(0px,0px)":"translate(0px,-100%)",opacity:"up"==b?1:0,zIndex:"sticky",sx:{...(0,u6.Oj)(k,y,!0),border:"none",filter:"none",borderRadius:0},color:S,children:[p&&(0,l.jsx)(ii(),{href:m,passHref:!0,legacyBehavior:!0,children:(0,l.jsx)(I.h,{as:nS.r,"aria-label":"Home",color:S,_hover:{bg:"transparent",color:E},icon:(0,l.jsx)(x.G,{icon:u.J9Y,size:"1x"}),variant:"ghost"})}),(0,l.jsx)(a.x,{flex:1,fontSize:"sm",noOfLines:1,ml:2,color:S,children:null==r?void 0:r.title}),(0,l.jsxs)(em.h,{variant:"ghost",children:[o&&(0,l.jsx)(eh.z,{color:S,_hover:{bg:"transparent",color:E},fontSize:"sm",onClick:c,leftIcon:(0,l.jsx)(x.G,{icon:u.Mzg}),children:C}),d&&(0,l.jsx)(I.h,{color:S,"aria-label":"Undo",onClick:_,_hover:{bg:"transparent",color:E},icon:(0,l.jsx)(x.G,{icon:u.X7o})}),!d&&(0,l.jsx)(I.h,{color:S,"aria-label":"Open table of contents",_hover:{bg:"transparent",color:E},onClick:h,icon:(0,l.jsx)(x.G,{icon:u.xiG})}),(g||d)&&(0,l.jsx)(I.h,{color:S,"aria-label":"Open toolbar",_hover:{bg:"transparent",color:E},onClick:T,icon:(0,l.jsx)(x.G,{icon:u.S6C})})]})]})]}):null},xr=e=>{let{doc:t,docEditorType:i,commentsEnabled:n=!0}=e,{docId:r,setCollaborativeEditorInstance:s,editor:a}=(0,n4._i)(),{isOpen:d,onOpen:c,onClose:u}=(0,w.q)({id:"mobile-comment-feed-panel-drawer"}),{isOpen:x,onOpen:h,onClose:m}=(0,w.q)({id:"mobile-toc-drawer"}),[p,g]=(0,j.useState)(null);console.debug("%c[MobileEditorWrapper] RENDER - ".concat(r),"background-color: gold");let f=(0,e7.ye)("mobileEditing"),v=(0,eY.py)("edit",t),C=f&&v;return(0,l.jsxs)(o.k,{ref:(0,j.useCallback)(e=>g(e),[]),direction:"column",flex:1,children:[(0,l.jsx)(xn,{doc:t,editor:a,onCommentFeedOpen:c,commentsEnabled:!C&&n,editingEnabled:C,onTocOpen:h}),i===dI.Z.PUBLIC_STATIC?(0,l.jsx)(oK,{docId:r,snapshotId:null==t?void 0:t.currentSnapshotId,scrollingParentSelector:u3,onCreate:s}):i===dI.Z.EXAMPLE_STATIC?(0,l.jsx)(nG,{docId:r,snapshotId:null==t?void 0:t.currentSnapshotId,scrollingParentSelector:u3,onCreate:s}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eO.Ge,{doc:t,docId:r,readOnly:!C,onCreate:s,scrollingParentSelector:u3}),a&&(0,l.jsx)(eq,{editor:a})]}),n&&d&&(0,l.jsx)(ep.Aj,{isOpen:d,onClose:u,drawerProps:{autoFocus:!1},children:(0,l.jsx)(t7,{onClose:u,editor:a})}),x&&(0,l.jsx)(ep.Aj,{isOpen:x,onClose:m,children:(0,l.jsx)(u4.o,{rootElement:p,handleClose:m})}),(0,l.jsx)(cm,{doc:t,showButton:!1}),(0,l.jsx)(eG.a,{children:(0,l.jsx)(ny,{editor:a})})]})},xs=(0,n4.eT)(e=>{let{docEditorType:t}=e,{docId:i,isUnauthorized:n,editor:r}=(0,n4._i)();uE(i,t),ur(i,r),(0,um.j)();let s=(0,j.useRef)(null),a=(0,M.CG)(iU.yx);console.debug("%c[MobileDocViewerComponent] RENDER - ".concat(i),"background-color: gold");let d=t===dI.Z.COLLABORATIVE;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(g(),{children:[(0,l.jsxs)("title",{children:["".concat(a?(0,sH.$)(a.title)+" | ":""),"Gamma"]}),(0,l.jsx)("meta",{name:"viewport",content:"width=device-width, user-scalable=no"})]}),(0,l.jsx)(l2.xB,{styles:{html:{overflowX:"hidden"},body:{overflow:"hidden scroll",WebkitOverflowScrolling:"touch"}}}),n?(0,l.jsxs)(o.k,{flex:1,alignItems:"center",justifyContent:"center",color:"gray.500",fontSize:"2xl",p:6,textAlign:"center",children:["It looks like you don't have access to this"," ",K.Yc,"."]}):(0,l.jsx)(o.k,{id:"doc-main",direction:"column",w:"100%",h:"100%","data-testid":"doc-editor-root",ref:s,flex:"1",children:(0,l.jsx)(xr,{doc:a,docEditorType:t,commentsEnabled:d})})]})})},55274:function(e,t,i){"use strict";i.d(t,{AA:function(){return u},DN:function(){return d},mb:function(){return c}});var n=i(5632),r=i(2784),s=i(91994),l=i(47968),o=i(78462),a=i(18412);let d=(0,r.createContext)({openPageSetup:(e,t)=>{},openSiteSettings:e=>{},openSharePanel:(e,t)=>{}}),c=(e,t)=>{let{push:i}=(0,n.useRouter)(),d=(0,s.qr)();return(0,r.useMemo)(()=>({openPageSetup:async(n,r)=>{if(!t)return;let s=()=>a.T.emit("openPageSetup",r);if(n!==e){let e=(0,o.yQ)({docId:n});await i(e);let t=d.subscribe(()=>{(0,l.ke)(d.getState())===n&&(s(),t())})}else s()},openSiteSettings:e=>{a.T.emit("openSiteSettings",e)},openSharePanel:async(t,n)=>{let r=()=>a.T.emit("openSharePanel",n);if(t!==e){let e=(0,o.yQ)({docId:t});await i(e);let n=d.subscribe(()=>{(0,l.ke)(d.getState())===t&&(r(),n())})}else r()}}),[e,i,t,d])},u=()=>(0,r.useContext)(d)},7e4:function(e,t,i){"use strict";i.d(t,{X:function(){return s}});var n=i(2784),r=i(18733);
1function s(e,t){let[i,s]=(0,n.useState)(()=>{try{let i=r.Q.getItem(e);if(null===i)return t;return JSON.parse(i)}catch(e){return console.error("[useSessionStorage.getItem] Error getting sessionStorage item",e),t}}),l=(0,n.useCallback)(t=>{try{r.Q.setItem(e,JSON.stringify(t)),s(t)}catch(e){console.error("[useSessionStorage.setItem] Error setting sessionStorage item",e)}},[e]);return[i,l]}},62376:function(){},6991:function(){},76298:function(){},4466:function(){},43839:function(){},2517:function(){}},function(e){e.O(0,[9774,7662,8433,2182,2812,8774,6694,4078,3273,9025,5333,4424,8707,146,3661,3016,116,2545,235,5112,3693,931,2808,6618,205,592,7685,2252,1537,6656,2681,8794,9718,9656,6390,887,2285,5641,2888,179],function(){return e(e.s=64535)}),_N_E=e.O()}]); 2//# sourceMappingURL=[docId]-9c7dcfc5756b0189.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.