(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,408930,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686);e.i(592121);let i=e=>{let i,a,o=(0,t.c)(6),{baseClass:l}=e,{navOpen:s,setNavOpen:c}=(0,n.useNav)(),d=`${l}__mobile-close`;o[0]!==c?(i=()=>{c(!1)},o[0]=c,o[1]=i):i=o[1];let u=s?void 0:-1;return o[2]!==d||o[3]!==i||o[4]!==u?(a=(0,r.jsx)("button",{className:d,onClick:i,tabIndex:u,type:"button",children:(0,r.jsx)(n.Hamburger,{isActive:!0})}),o[2]=d,o[3]=i,o[4]=u,o[5]=a):a=o[5],a};e.s(["NavHamburger",0,i])},857945,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686),i=e.i(694654),a=e.i(592121);let o="settings-menu-button",l=e=>{let a,l=(0,t.c)(3),{settingsMenu:c}=e,{t:d}=(0,i.useTranslation)();return c&&0!==c.length?(l[0]!==c||l[1]!==d?(a=(0,r.jsx)(n.Popup,{button:(0,r.jsx)(n.GearIcon,{ariaLabel:d("general:menu")}),className:o,horizontalAlign:"left",id:"settings-menu",size:"small",verticalAlign:"bottom",children:c.map(s)}),l[0]=c,l[1]=d,l[2]=a):a=l[2],a):null};function s(e,t){return(0,r.jsx)(a.Fragment,{children:e},`settings-menu-item-${t}`)}e.s(["SettingsMenuButton",0,l])},973092,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(929127),i=e.i(541686),a=e.i(265055),o=e.i(694654),l=e.i(634513),s=e.i(961123),c=e.i(267966),d=e.i(592121);let u="nav",h=e=>{let h,f=(0,t.c)(13),{groups:p,navPreferences:m}=e,g=(0,s.usePathname)(),{config:b}=(0,a.useConfig)(),{admin:y,folders:v,routes:x}=b,{routes:w}=y,{browseByFolder:k}=w,{admin:S}=x,{i18n:C}=(0,o.useTranslation)();if(f[0]!==S||f[1]!==v||f[2]!==k||f[3]!==p||f[4]!==C||f[5]!==m?.groups||f[6]!==g){let e,t=(0,c.formatAdminURL)({adminRoute:S,path:k}),a=g.startsWith(t);f[8]!==S||f[9]!==C||f[10]!==m?.groups||f[11]!==g?(e=(e,t)=>{let{entities:a,label:o}=e;return(0,r.jsx)(i.NavGroup,{isOpen:m?.groups?.[o]?.open,label:o,children:a.map((e,t)=>{let a,o,{slug:s,type:d,label:h}=e;d===l.EntityType.collection&&(a=(0,c.formatAdminURL)({adminRoute:S,path:`/collections/${s}`}),o=`nav-${s}`),d===l.EntityType.global&&(a=(0,c.formatAdminURL)({adminRoute:S,path:`/globals/${s}`}),o=`nav-global-${s}`);let f=g.startsWith(a)&&["/",void 0].includes(g[a.length]),p=(0,r.jsxs)(r.Fragment,{children:[f&&(0,r.jsx)("div",{className:`${u}__link-indicator`}),(0,r.jsx)("span",{className:`${u}__link-label`,children:(0,n.getTranslation)(h,C)})]});return g===a?(0,r.jsx)("div",{className:`${u}__link`,id:o,children:p},t):(0,r.jsx)(i.Link,{className:`${u}__link`,href:a,id:o,prefetch:!1,children:p},t)})},t)},f[8]=S,f[9]=C,f[10]=m?.groups,f[11]=g,f[12]=e):e=f[12],h=(0,r.jsxs)(d.Fragment,{children:[v&&v.browseByFolder&&(0,r.jsx)(i.BrowseByFolderButton,{active:a}),p.map(e)]}),f[0]=S,f[1]=v,f[2]=k,f[3]=p,f[4]=C,f[5]=m?.groups,f[6]=g,f[7]=h}else h=f[7];return h};e.s(["DefaultNavClient",0,h])},50900,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686);e.i(592121);let i=()=>{let e,i=(0,t.c)(2),{navOpen:a}=(0,n.useNav)();return i[0]!==a?(e=(0,r.jsx)(n.Hamburger,{closeIcon:"collapse",isActive:a}),i[0]=a,i[1]=e):e=i[1],e};e.s(["NavHamburger",0,i])},797077,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686);e.i(592121);let i=e=>{let i,a,o=(0,t.c)(9),{baseClass:l,children:s,className:c}=e,{hydrated:d,navOpen:u,shouldAnimate:h}=(0,n.useNav)(),f=u&&`${l}--nav-open`,p=h&&`${l}--nav-animate`,m=d&&`${l}--nav-hydrated`;o[0]!==l||o[1]!==c||o[2]!==f||o[3]!==p||o[4]!==m?(i=[l,c,f,p,m].filter(Boolean),o[0]=l,o[1]=c,o[2]=f,o[3]=p,o[4]=m,o[5]=i):i=o[5];let g=i.join(" ");return o[6]!==s||o[7]!==g?(a=(0,r.jsx)("div",{className:g,children:s}),o[6]=s,o[7]=g,o[8]=a):a=o[8],a};e.s(["Wrapper",0,i])},103e3,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686),i=e.i(265055),a=e.i(694654),o=e.i(592121);let l="not-found",s=e=>{let s,c,d,u,h=(0,t.c)(10),{marginTop:f}=e,p=void 0===f?"large":f,{setStepNav:m}=(0,n.useStepNav)(),{t:g}=(0,a.useTranslation)(),{config:b}=(0,i.useConfig)(),{routes:y}=b,{admin:v}=y;h[0]!==m||h[1]!==g?(s=()=>{m([{label:g("general:notFound")}])},c=[m,g],h[0]=m,h[1]=g,h[2]=s,h[3]=c):(s=h[2],c=h[3]),(0,o.useEffect)(s,c);let x=p&&`${l}--margin-top-${p}`;h[4]!==x?(d=[l,x].filter(Boolean),h[4]=x,h[5]=d):d=h[5];let w=d.join(" ");return h[6]!==v||h[7]!==g||h[8]!==w?(u=(0,r.jsx)("div",{className:w,children:(0,r.jsxs)(n.Gutter,{className:`${l}__wrap`,children:[(0,r.jsxs)("div",{className:`${l}__content`,children:[(0,r.jsx)("h1",{children:g("general:nothingFound")}),(0,r.jsx)("p",{children:g("general:sorryNotFound")})]}),(0,r.jsx)(n.Button,{className:`${l}__button`,el:"link",size:"large",to:v,children:g("general:backToDashboard")})]})}),h[6]=v,h[7]=g,h[8]=w,h[9]=u):u=h[9],u};e.s(["NotFoundClient",0,s])},925864,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(265055),i=e.i(694654),a=e.i(961123),o=e.i(267966),l=e.i(420381),s=e.i(592121),c=e.i(605913),d=t,u=r,h=i;let f=e=>{let t,r=(0,c.c)(6),{localeOptions:n,onChange:i}=e,{t:a}=(0,h.useTranslation)();if(r[0]!==n||r[1]!==i||r[2]!==a){let e;r[4]!==i?(e=e=>i(e),r[4]=i,r[5]=e):e=r[5],t=(0,d.jsx)(u.SelectField,{field:{name:"locale",label:a("general:locale"),options:n},onChange:e,path:"locale"}),r[0]=n,r[1]=i,r[2]=a,r[3]=t}else t=r[3];return t};var p=c,m=t,g=r,b=s;let y="{",v="[",x="}",w="]",k="query-inspector",S=({type:e,comma:t=!1,position:r})=>{let n="object"===e?x:w,i="object"===e?y:v,a="end"===r?n:i;return(0,m.jsxs)("span",{className:`${k}__bracket ${k}__bracket--position-${r}`,children:[a,"end"===r&&t?",":null]})},C=e=>{let t,r=(0,p.c)(2),{isEmpty:n,object:i,objectKey:a,parentType:o,trailingComma:l}=e,s=void 0!==n&&n,c=void 0===o?"object":o,d=void 0!==l&&l,u=i?Object.keys(i):[],h=u.length,[f,y]=b.useState(!0),v="object"===c||"array"===c;return r[0]!==f?(t=()=>y(!f),r[0]=f,r[1]=t):t=r[1],(0,m.jsxs)("li",{className:v?`${k}__row-line--nested`:"",children:[(0,m.jsxs)("button",{"aria-label":"toggle",className:`${k}__list-toggle ${s?`${k}__list-toggle--empty`:""}`,onClick:t,type:"button",children:[s?null:(0,m.jsx)(g.ChevronIcon,{className:`${k}__toggle-row-icon ${k}__toggle-row-icon--${f?"open":"closed"}`}),(0,m.jsxs)("span",{children:[a&&`"${a}": `,(0,m.jsx)(S,{position:"start",type:c}),s?(0,m.jsx)(S,{comma:d,position:"end",type:c}):null]})]}),(0,m.jsx)("ul",{className:`${k}__json-children ${v?`${k}__json-children--nested`:""}`,children:f&&u.map((e,t)=>{let r,n=i[e],o=t===h-1;if(null===n?r="null":n instanceof Date?(r="date",n=n.toISOString()):r=Array.isArray(n)?"array":"object"==typeof n?"object":"number"==typeof n?"number":"boolean"==typeof n?"boolean":"string","object"===r||"array"===r)return(0,m.jsx)(C,{isEmpty:0===n.length||0===Object.keys(n).length,object:n,objectKey:"object"===c?e:void 0,parentType:r,trailingComma:!o},`${e}-${t}`);if("date"===r||"string"===r||"null"===r||"number"===r||"boolean"===r){let i=!!("object"===c&&e),l=[`${k}__row-line`,`${k}__value-type--${r}`,`${k}__row-line--${a?"nested":"top"}`].filter(Boolean).join(" ");return(0,m.jsxs)("li",{className:l,children:[i?(0,m.jsx)("span",{children:`"${e}": `}):null,(0,m.jsx)("span",{className:`${k}__value`,children:JSON.stringify(n)}),o?"":","]},`${e}-${t}`)}})}),!s&&(0,m.jsx)("span",{className:v?`${k}__bracket--nested`:"",children:(0,m.jsx)(S,{comma:d,position:"end",type:c})})]})},_="query-inspector",j=()=>{let e,{id:c,collectionSlug:d,globalSlug:u,initialData:h,isTrashed:p}=(0,r.useDocumentInfo)(),m=(0,a.useSearchParams)(),{i18n:g,t:b}=(0,i.useTranslation)(),{code:y}=(0,r.useLocale)(),{config:{defaultDepth:v,localization:x,routes:{api:w},serverURL:k},getEntityConfig:S}=(0,n.useConfig)(),j=S({collectionSlug:d}),N=S({globalSlug:u}),T=x&&x.locales.map(e=>({label:e.label,value:e.code})),E=!1;j&&(E=(0,l.hasDraftsEnabled)(j),e=`/${d}/${c}`),N&&(E=(0,l.hasDraftsEnabled)(N),e=`/globals/${u}`);let[A,R]=s.useState(h),[M,I]=s.useState("true"===m.get("draft")),[L,P]=s.useState(m?.get("locale")||y),[D,O]=s.useState(m.get("depth")||v.toString()),[F,B]=s.useState(!0),[$,U]=s.useState(!1),[z,H]=s.useState(k||"");s.useEffect(()=>{k||H(window.location.origin)},[k]);let W="string"==typeof h?.deletedAt,V=new URLSearchParams({depth:D,draft:String(M),locale:L,trash:W?"true":"false"}).toString(),q=(0,o.formatAdminURL)({apiRoute:w,path:`${e}?${V}`,serverURL:z});return s.useEffect(()=>{(async()=>{try{let e=await fetch(q,{credentials:F?"include":"omit",headers:{"Accept-Language":g.language},method:"GET"});try{let t=await e.json();R(t)}catch(e){r.toast.error("Error parsing response"),console.error(e)}}catch(e){r.toast.error("Error making request"),console.error(e)}})()},[g.language,q,F]),(0,t.jsxs)(r.Gutter,{className:[_,$&&`${_}--fullscreen`].filter(Boolean).join(" "),right:!1,children:[(0,t.jsx)(r.SetDocumentStepNav,{collectionSlug:d,globalLabel:N?.label,globalSlug:u,id:c,isTrashed:p,pluralLabel:j?j?.labels?.plural:void 0,useAsTitle:j?j?.admin?.useAsTitle:void 0,view:"API"}),(0,t.jsxs)("div",{className:`${_}__configuration`,children:[(0,t.jsxs)("div",{className:`${_}__api-url`,children:[(0,t.jsxs)("span",{className:`${_}__label`,children:["API URL ",(0,t.jsx)(r.CopyToClipboard,{value:q})]}),(0,t.jsx)("a",{href:q,rel:"noopener noreferrer",target:"_blank",children:q})]}),(0,t.jsx)(r.Form,{initialState:{authenticated:{initialValue:F||!1,valid:!0,value:F||!1},depth:{initialValue:Number(D||0),valid:!0,value:Number(D||0)},draft:{initialValue:M||!1,valid:!0,value:M||!1},locale:{initialValue:L,valid:!0,value:L}},children:(0,t.jsxs)("div",{className:`${_}__form-fields`,children:[(0,t.jsxs)("div",{className:`${_}__filter-query-checkboxes`,children:[E&&(0,t.jsx)(r.CheckboxField,{field:{name:"draft",label:b("version:draft")},onChange:()=>I(!M),path:"draft"}),(0,t.jsx)(r.CheckboxField,{field:{name:"authenticated",label:b("authentication:authenticated")},onChange:()=>B(!F),path:"authenticated"})]}),T&&(0,t.jsx)(f,{localeOptions:T,onChange:P}),(0,t.jsx)(r.NumberField,{field:{name:"depth",admin:{step:1},label:b("general:depth"),max:10,min:0},onChange:e=>O(e?.toString()),path:"depth"})]})})]}),(0,t.jsxs)("div",{className:`${_}__results-wrapper`,children:[(0,t.jsx)("div",{className:`${_}__toggle-fullscreen-button-container`,children:(0,t.jsx)("button",{"aria-label":"toggle fullscreen",className:`${_}__toggle-fullscreen-button`,onClick:()=>U(!$),type:"button",children:(0,t.jsx)(r.MinimizeMaximizeIcon,{isMinimized:!$})})}),(0,t.jsx)("div",{className:`${_}__results`,children:(0,t.jsx)(C,{object:A})})]})]})};e.s(["APIViewClient",0,j],925864)},544888,e=>{"use strict";var t=e.i(699173),r=e.i(541686);e.i(592121);let n=e=>(0,t.jsx)(r.DefaultEditView,{...e});e.s(["EditView",0,n])},711967,e=>{"use strict";var t=e.i(592121);let r=(0,t.createContext)({selectedLocales:[]}),n=()=>(0,t.use)(r);e.s(["SelectedLocalesContext",0,r,"useSelectedLocales",0,n])},969399,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(265055),i=e.i(694654),a=e.i(961123),o=e.i(592121),l=t,s=e.i(929127),c=r,d=n,u=i,h=e.i(634513),f=a,p=e.i(267966),m=o;let g="restore-version",b="restore-version",y=({className:e,collectionConfig:t,globalConfig:r,label:n,originalDocID:i,status:a,versionDateFormatted:o,versionID:y})=>{let{config:{routes:{admin:v,api:x}}}=(0,d.useConfig)(),{toggleModal:w}=(0,c.useModal)(),k=(0,f.useRouter)(),{i18n:S,t:C}=(0,u.useTranslation)(),[_,j]=(0,m.useState)(!1),{startRouteTransition:N}=(0,c.useRouteTransition)(),T=C(r?"version:aboutToRestoreGlobal":"version:aboutToRestore",{label:(0,s.getTranslation)(n,S),versionDate:o}),E="draft"!==a&&t?.versions?.drafts,A=(0,m.useCallback)(async()=>{let e,n=(0,p.formatAdminURL)({apiRoute:x,path:""});t&&(n=`${n}/${t.slug}/versions/${y}?draft=${_}`,e=(0,p.formatAdminURL)({adminRoute:v,path:`/collections/${t.slug}/${i}`})),r&&(n=`${n}/globals/${r.slug}/versions/${y}?draft=${_}`,e=(0,p.formatAdminURL)({adminRoute:v,path:`/globals/${r.slug}`}));let a=await h.requests.post(n,{headers:{"Accept-Language":S.language}});if(200===a.status){let t=await a.json();return c.toast.success(t.message),N(()=>k.push(e))}c.toast.error(C("version:problemRestoringVersion"))},[x,t,r,S.language,y,_,v,i,N,k,C]);return(0,l.jsxs)(m.Fragment,{children:[(0,l.jsx)("div",{className:[g,e].filter(Boolean).join(" "),children:(0,l.jsx)(c.Button,{buttonStyle:"primary",className:[E&&`${g}__restore-as-draft-button`].filter(Boolean).join(" "),onClick:()=>w(b),size:"xsmall",SubMenuPopupContent:E?()=>(0,l.jsx)(c.PopupList.ButtonGroup,{children:(0,l.jsx)(c.PopupList.Button,{onClick:()=>[j(!0),w(b)],children:C("version:restoreAsDraft")})}):null,children:C("version:restoreThisVersion")})}),(0,l.jsx)(c.ConfirmationModal,{body:T,confirmingLabel:C("version:restoring"),heading:C("version:confirmVersionRestoration"),modalSlug:b,onConfirm:A})]})};var v=t,x=r,w=i,k=o,S=e.i(605913),C=t,_=r,j=i,N=a,T=o;let E="version-drawer",A=({depth:e,uuid:t})=>`version-drawer_${e}_${t}`,R=e=>{let{collectionSlug:t,docID:r,drawerSlug:n,globalSlug:i}=e,{isTrashed:a}=(0,_.useDocumentInfo)(),{closeModal:o}=(0,_.useModal)(),l=(0,N.useSearchParams)(),s=(0,T.useRef)(l),{renderDocument:c}=(0,_.useServerFunctions)(),[d,u]=(0,T.useState)(void 0),[h,f]=(0,T.useState)(!0),p=(0,T.useRef)(!1),{t:m}=(0,j.useTranslation)(),g=(0,T.useCallback)(e=>{(async()=>{f(!0);try{let r=!!i,o=t??i,s=await c({collectionSlug:o,docID:e,drawerSlug:n,paramsOverride:{segments:[r?"globals":"collections",o,...a?["trash"]:[],r?void 0:String(e),"versions"].filter(Boolean)},redirectAfterDelete:!1,redirectAfterDuplicate:!1,searchParams:Object.fromEntries(l.entries()),versions:{disableGutter:!0,useVersionDrawerCreatedAtCell:!0}});s?.Document&&(u(s.Document),f(!1))}catch(e){_.toast.error(e?.message||m("error:unspecific")),o(n)}})()},[o,t,n,i,a,c,l,m]);return((0,T.useEffect)(()=>{p.current&&s.current===l||(s.current=l,g(r),p.current=!0)},[r,g,l]),h)?(0,C.jsx)(_.LoadingOverlay,{}):d},M=e=>{let t,r=(0,S.c)(6),{collectionSlug:n,docID:i,drawerSlug:a,globalSlug:o}=e,{t:l}=(0,j.useTranslation)();return r[0]!==n||r[1]!==i||r[2]!==a||r[3]!==o||r[4]!==l?(t=(0,C.jsx)(_.Drawer,{className:E,gutter:!0,slug:a,title:l("version:selectVersionToCompare"),children:(0,C.jsx)(R,{collectionSlug:n,docID:i,drawerSlug:a,globalSlug:o})}),r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=t):t=r[5],t},I=e=>{let t,r,n,i,a,o,l,s,c=(0,S.c)(29),{collectionSlug:d,docID:u,globalSlug:h}=e,f=(0,_.useEditDepth)(),p=(0,T.useId)(),{closeModal:m,modalState:g,openModal:b,toggleModal:y}=(0,_.useModal)(),[v,x]=(0,T.useState)(!1);c[0]!==f||c[1]!==p?(t=A({depth:f,uuid:p}),c[0]=f,c[1]=p,c[2]=t):t=c[2];let w=t;c[3]!==w||c[4]!==g?(r=()=>{x(!!g[w]?.isOpen)},n=[g,w],c[3]=w,c[4]=g,c[5]=r,c[6]=n):(r=c[5],n=c[6]),(0,T.useEffect)(r,n),c[7]!==w||c[8]!==y?(i=()=>{y(w)},c[7]=w,c[8]=y,c[9]=i):i=c[9];let k=i;c[10]!==m||c[11]!==w?(a=()=>{m(w)},c[10]=m,c[11]=w,c[12]=a):a=c[12];let j=a;c[13]!==w||c[14]!==b?(o=()=>{b(w)},c[13]=w,c[14]=b,c[15]=o):o=c[15];let N=o;c[16]!==d||c[17]!==u||c[18]!==w||c[19]!==h?(l=()=>(0,C.jsx)(M,{collectionSlug:d,docID:u,drawerSlug:w,globalSlug:h}),c[16]=d,c[17]=u,c[18]=w,c[19]=h,c[20]=l):l=c[20];let E=l;return c[21]!==E||c[22]!==j||c[23]!==f||c[24]!==w||c[25]!==v||c[26]!==N||c[27]!==k?(s={closeDrawer:j,Drawer:E,drawerDepth:f,drawerSlug:w,isDrawerOpen:v,openDrawer:N,toggleDrawer:k},c[21]=E,c[22]=j,c[23]=f,c[24]=w,c[25]=v,c[26]=N,c[27]=k,c[28]=s):s=c[28],s},L="compare-version",P=(0,k.memo)(e=>{let{collectionSlug:t,docID:r,globalSlug:n,onChange:i,versionFromID:a,versionFromOptions:o}=e,{t:l}=(0,w.useTranslation)(),{Drawer:s,openDrawer:c}=I({collectionSlug:t,docID:r,globalSlug:n}),d=(0,k.useMemo)(()=>[...o,{label:(0,v.jsx)("span",{className:`${L}-moreVersions`,children:l("version:moreVersions")}),value:"more"}],[l,o]),u=(0,k.useMemo)(()=>o.find(e=>e.value===a),[o,a]),h=(0,k.useCallback)(e=>{"more"===e.value?c():i(e)},[i,c]);return(0,v.jsxs)("div",{className:[x.fieldBaseClass,L].filter(Boolean).join(" "),children:[(0,v.jsx)(x.ReactSelect,{isClearable:!1,isSearchable:!1,onChange:h,options:d,placeholder:l("version:selectVersionToCompare"),value:u}),(0,v.jsx)(s,{})]})});var D=t,O=r;let F="select-version-locales",B=({locales:e,localeSelectorOpen:t,onChange:r})=>(0,D.jsx)(O.AnimateHeight,{className:F,height:t?"auto":0,id:`${F}-locales`,children:(0,D.jsx)(O.PillSelector,{onClick:({pill:t})=>{r({locales:e.map(e=>e.name===t.name?{...e,selected:!t.selected}:e)})},pills:e})});var $=e.i(711967),U=S,z=s,H=n,W=r,V=i,q=p,G=o;let K=e=>{let t,r,n=(0,U.c)(24),{id:i,collectionConfig:a,globalConfig:o,isTrashed:l,versionToCreatedAtFormatted:s,versionToID:c}=e,{config:d}=(0,H.useConfig)(),{setStepNav:u}=(0,W.useStepNav)(),{i18n:h,t:f}=(0,V.useTranslation)(),p=(0,W.useLocale)(),{title:m}=(0,W.useDocumentTitle)();return n[0]!==a||n[1]!==d||n[2]!==o||n[3]!==h||n[4]!==i||n[5]!==l||n[6]!==u||n[7]!==f||n[8]!==m||n[9]!==s?(t=()=>{let{routes:e}=d,{admin:t}=e;if(a){let e=a.slug,r=a.labels?.plural,n=l?`/collections/${e}/trash/${i}`:`/collections/${e}/${i}`,o=[{label:(0,z.getTranslation)(r,h),url:(0,q.formatAdminURL)({adminRoute:t,path:`/collections/${e}`})}];l&&o.push({label:f("general:trash"),url:(0,q.formatAdminURL)({adminRoute:t,path:`/collections/${e}/trash`})}),o.push({label:m,url:(0,q.formatAdminURL)({adminRoute:t,path:n})},{label:f("version:versions"),url:(0,q.formatAdminURL)({adminRoute:t,path:`${n}/versions`})},{label:s,url:void 0}),u(o);return}if(o){let e=o.slug;u([{label:o.label,url:(0,q.formatAdminURL)({adminRoute:t,path:`/globals/${e}`})},{label:f("version:versions"),url:(0,q.formatAdminURL)({adminRoute:t,path:`/globals/${e}/versions`})},{label:s}])}},n[0]=a,n[1]=d,n[2]=o,n[3]=h,n[4]=i,n[5]=l,n[6]=u,n[7]=f,n[8]=m,n[9]=s,n[10]=t):t=n[10],n[11]!==a||n[12]!==d||n[13]!==o||n[14]!==h||n[15]!==i||n[16]!==l||n[17]!==p||n[18]!==u||n[19]!==f||n[20]!==m||n[21]!==s||n[22]!==c?(r=[d,u,i,l,p,f,h,a,o,m,s,c],n[11]=a,n[12]=d,n[13]=o,n[14]=h,n[15]=i,n[16]=l,n[17]=p,n[18]=u,n[19]=f,n[20]=m,n[21]=s,n[22]=c,n[23]=r):r=n[23],(0,G.useEffect)(t,r),null},Y="view-version",J=({canUpdate:e,modifiedOnly:l,RenderedDiff:s,selectedLocales:c,versionFromCreatedAt:d,versionFromID:u,versionFromOptions:h,versionToCreatedAt:f,versionToCreatedAtFormatted:p,VersionToCreatedAtLabel:m,versionToID:g,versionToStatus:b})=>{let{config:v,getEntityConfig:x}=(0,n.useConfig)(),{code:w}=(0,r.useLocale)(),{i18n:k,t:S}=(0,i.useTranslation)(),[C,_]=(0,o.useState)([]),[j,N]=o.default.useState(!1);(0,o.useEffect)(()=>{v.localization&&_(v.localization.locales.map(e=>{let t=e.label;return"string"!=typeof e.label&&e.label[w]&&(t=e.label[w]),{name:e.code,Label:t,selected:c.includes(e.code)}}))},[w,v.localization,c]);let{id:T,collectionSlug:E,globalSlug:A,isTrashed:R}=(0,r.useDocumentInfo)(),{startRouteTransition:M}=(0,r.useRouteTransition)(),{collectionConfig:I,globalConfig:L}=(0,o.useMemo)(()=>({collectionConfig:x({collectionSlug:E}),globalConfig:x({globalSlug:A})}),[E,A,x]),D=(0,a.useRouter)(),O=(0,a.usePathname)(),F=(0,a.useSearchParams)(),[U,z]=(0,o.useState)(l),H=(0,o.useCallback)(e=>{let t=new URLSearchParams(Array.from(F.entries()));if(e?.versionFromID&&t.set("versionFrom",e?.versionFromID),e?.selectedLocales)if(e.selectedLocales.length){let r=[];for(let t of e.selectedLocales)t.selected&&r.push(t.name);t.set("localeCodes",JSON.stringify(r))}else t.delete("localeCodes");e?.modifiedOnly===!1?t.set("modifiedOnly","false"):e?.modifiedOnly===!0&&t.delete("modifiedOnly");let r=t.toString(),n=r?`?${r}`:"";M(()=>D.push(`${O}${n}`))},[O,D,F,M]),W=(0,o.useCallback)(e=>{let t=e.target.checked;z(t),H({modifiedOnly:t})},[H]),V=(0,o.useCallback)(({locales:e})=>{_(e),H({selectedLocales:e})},[H]),q=(0,o.useCallback)(e=>{H({versionFromID:e.value})},[H]),{localization:G}=v,J=(0,o.useMemo)(()=>S("version:versionAgo",{distance:(0,r.formatTimeToNow)({date:f,i18n:k})}),[f,k,S]),Z=(0,o.useMemo)(()=>d?S("version:versionAgo",{distance:(0,r.formatTimeToNow)({date:d,i18n:k})}):void 0,[d,k,S]);return(0,t.jsxs)("main",{className:Y,children:[(0,t.jsxs)(r.Gutter,{className:`${Y}-controls-top`,children:[(0,t.jsxs)("div",{className:`${Y}-controls-top__wrapper`,children:[(0,t.jsx)("h2",{children:k.t("version:compareVersions")}),(0,t.jsxs)("div",{className:`${Y}-controls-top__wrapper-actions`,children:[(0,t.jsx)("span",{className:`${Y}__modifiedCheckBox`,children:(0,t.jsx)(r.CheckboxInput,{checked:U,id:"modifiedOnly",label:k.t("version:modifiedOnly"),onToggle:W})}),G&&(0,t.jsxs)(r.Pill,{"aria-controls":`${Y}-locales`,"aria-expanded":j,className:`${Y}__toggle-locales`,icon:(0,t.jsx)(r.ChevronIcon,{direction:j?"up":"down"}),onClick:()=>N(e=>!e),pillStyle:"light",size:"small",children:[(0,t.jsxs)("span",{className:`${Y}__toggle-locales-label`,children:[S("general:locales"),":"," "]}),(0,t.jsx)("span",{className:`${Y}__toggle-locales-list`,children:C.filter(e=>e.selected).map(e=>e.name).join(", ")})]})]})]}),G&&(0,t.jsx)(B,{locales:C,localeSelectorOpen:j,onChange:V})]}),(0,t.jsx)(r.Gutter,{className:`${Y}-controls-bottom`,children:(0,t.jsxs)("div",{className:`${Y}-controls-bottom__wrapper`,children:[(0,t.jsxs)("div",{className:`${Y}__version-from`,children:[(0,t.jsxs)("div",{className:`${Y}__version-from-labels`,children:[(0,t.jsx)("span",{children:S("version:comparingAgainst")}),Z&&(0,t.jsx)("span",{className:`${Y}__time-elapsed`,children:Z})]}),(0,t.jsx)(P,{collectionSlug:E,docID:T,globalSlug:A,onChange:q,versionFromID:u,versionFromOptions:h})]}),(0,t.jsxs)("div",{className:`${Y}__version-to`,children:[(0,t.jsxs)("div",{className:`${Y}__version-to-labels`,children:[(0,t.jsx)("span",{children:S("version:currentlyViewing")}),(0,t.jsx)("span",{className:`${Y}__time-elapsed`,children:J})]}),(0,t.jsxs)("div",{className:`${Y}__version-to-version`,children:[m,e&&!R&&(0,t.jsx)(y,{className:`${Y}__restore`,collectionConfig:I,globalConfig:L,label:I?.labels.singular||L?.label,originalDocID:T,status:b,versionDateFormatted:p,versionID:g})]})]})]})}),(0,t.jsx)(K,{collectionConfig:I,globalConfig:L,id:T,isTrashed:R,versionToCreatedAtFormatted:p,versionToID:g}),(0,t.jsx)(r.Gutter,{className:`${Y}__diff-wrap`,children:(0,t.jsx)($.SelectedLocalesContext,{value:{selectedLocales:C.map(e=>e.name)},children:f&&s})})]})};e.s(["DefaultVersionView",0,J],969399)},829850,717495,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686),i=e.i(265055),a=e.i(694654),o=e.i(154035),l=e.i(592121),s=o;function c(e,t){return JSON.stringify(e)!==JSON.stringify(t)}function d(e,t){return[...new Map(e.map(e=>[e[t],e])).values()]}function u({baseVersionField:e,config:t,field:r,row:n,valueFromRow:i,valueToRow:a}){let o=[],l=[];if("array"===r.type&&"fields"in r)o=r.fields,l=e.rows?.length?e.rows[n]:e.fields;else if("blocks"===r.type)if(a?.blockType===i?.blockType)o=(t?.blocksMap?.[a?.blockType]??(("blocks"in r||"blockReferences"in r)&&(r.blockReferences??r.blocks)?.find(e=>"string"!=typeof e&&e.slug===a?.blockType)||{fields:[]})).fields,l=e.rows?.length?e.rows[n]:e.fields;else{let s=t?.blocksMap?.[a?.blockType]??(("blocks"in r||"blockReferences"in r)&&(r.blockReferences??r.blocks)?.find(e=>"string"!=typeof e&&e.slug===a?.blockType)||{fields:[]}),c=t?.blocksMap?.[i?.blockType]??(("blocks"in r||"blockReferences"in r)&&(r.blockReferences??r.blocks)?.find(e=>"string"!=typeof e&&e.slug===i?.blockType)||{fields:[]});o=d([...s.fields,...c.fields],"name"),l=e.rows?.length?e.rows[n]:e.fields}return{fields:o,versionFields:l}}function h({config:e,fields:t,locales:r,parentIsLocalized:n,valueFrom:i,valueTo:a}){let o=0;return t.forEach(t=>{if("name"in t&&"id"===t.name)return;let l=t.type;switch(l){case"array":case"blocks":if(r&&(0,s.fieldShouldBeLocalized)({field:t,parentIsLocalized:n}))r.forEach(l=>{let s=i?.[t.name]?.[l]??[],c=a?.[t.name]?.[l]??[];o+=f({config:e,field:t,locales:r,parentIsLocalized:n||t.localized,valueFromRows:s,valueToRows:c})});else{let l=i?.[t.name]??[],s=a?.[t.name]??[];o+=f({config:e,field:t,locales:r,parentIsLocalized:n||t.localized,valueFromRows:l,valueToRows:s})}break;case"checkbox":case"code":case"date":case"email":case"join":case"json":case"number":case"point":case"radio":case"relationship":case"richText":case"select":case"text":case"textarea":case"upload":r&&(0,s.fieldShouldBeLocalized)({field:t,parentIsLocalized:n})?r.forEach(e=>{c(a?.[t.name]?.[e],i?.[t.name]?.[e])&&o++}):c(a?.[t.name],i?.[t.name])&&o++;break;case"collapsible":case"row":o+=h({config:e,fields:t.fields,locales:r,parentIsLocalized:n||t.localized,valueFrom:i,valueTo:a});break;case"group":(0,s.groupHasName)(t)?r&&(0,s.fieldShouldBeLocalized)({field:t,parentIsLocalized:n})?r.forEach(l=>{o+=h({config:e,fields:t.fields,locales:r,parentIsLocalized:n||t.localized,valueFrom:i?.[t.name]?.[l],valueTo:a?.[t.name]?.[l]})}):o+=h({config:e,fields:t.fields,locales:r,parentIsLocalized:n||t.localized,valueFrom:i?.[t.name],valueTo:a?.[t.name]}):o+=h({config:e,fields:t.fields,locales:r,parentIsLocalized:n||t.localized,valueFrom:i,valueTo:a});break;case"tabs":t.tabs.forEach(t=>{"name"in t&&r&&t.localized?r.forEach(l=>{o+=h({config:e,fields:t.fields,locales:r,parentIsLocalized:n||t.localized,valueFrom:i?.[t.name]?.[l],valueTo:a?.[t.name]?.[l]})}):"name"in t?o+=h({config:e,fields:t.fields,locales:r,parentIsLocalized:n||t.localized,valueFrom:i?.[t.name],valueTo:a?.[t.name]}):o+=h({config:e,fields:t.fields,locales:r,parentIsLocalized:n||t.localized,valueFrom:i,valueTo:a})});break;case"ui":break;default:throw Error(`Unexpected field.type in countChangedFields : ${String(l)}`)}}),o}function f({config:e,field:t,locales:r,parentIsLocalized:n,valueFromRows:i=[],valueToRows:a=[]}){let o=0,l=0;for(;i[l]||a[l];){let s=i?.[l]||{},c=a?.[l]||{},{fields:d}=u({baseVersionField:{type:"text",fields:[],path:"",schemaPath:""},config:e,field:t,row:l,valueFromRow:s,valueToRow:c});o+=h({config:e,fields:d,locales:r,parentIsLocalized:n||t.localized,valueFrom:s,valueTo:c}),l++}return o}e.s(["getFieldsForRowComparison",0,u],717495);let p="diff-collapser",m=e=>{let s,c=(0,t.c)(19),{children:d,field:u,fields:m,hideGutter:g,initCollapsed:b,isIterable:y,Label:v,locales:x,parentIsLocalized:w,valueFrom:k,valueTo:S}=e,C=void 0!==g&&g,_=void 0!==b&&b,j=void 0!==y&&y,{t:N}=(0,a.useTranslation)(),[T,E]=(0,l.useState)(_),{config:A}=(0,i.useConfig)();if(c[0]!==v||c[1]!==d||c[2]!==A||c[3]!==u||c[4]!==m||c[5]!==C||c[6]!==T||c[7]!==j||c[8]!==x||c[9]!==w||c[10]!==N||c[11]!==k||c[12]!==S){let e,t,i;if(j){if(!(0,o.fieldIsArrayType)(u)&&!(0,o.fieldIsBlockType)(u))throw Error("DiffCollapser: field must be an array or blocks field when isIterable is true");let t=k??[],r=S??[];if(!Array.isArray(t)||!Array.isArray(r))throw Error("DiffCollapser: valueFrom and valueTro must be arrays when isIterable is true");e=f({config:A,field:u,locales:x,parentIsLocalized:w,valueFromRows:t,valueToRows:r})}else e=h({config:A,fields:m,locales:x,parentIsLocalized:w,valueFrom:k,valueTo:S});let a=T&&`${p}__content--is-collapsed`,l=C&&`${p}__content--hide-gutter`;c[14]!==a||c[15]!==l?(t=[`${p}__content`,a,l].filter(Boolean),c[14]=a,c[15]=l,c[16]=t):t=c[16];let g=t.join(" ");c[17]!==T?(i=()=>E(!T),c[17]=T,c[18]=i):i=c[18],s=(0,r.jsxs)("div",{className:p,children:[(0,r.jsxs)(n.FieldDiffLabel,{children:[(0,r.jsxs)("button",{"aria-label":T?"Expand":"Collapse",className:`${p}__toggle-button`,onClick:i,type:"button",children:[(0,r.jsx)("div",{className:`${p}__label`,children:v}),(0,r.jsx)(n.ChevronIcon,{direction:T?"right":"down",size:"small"})]}),e>0&&T&&(0,r.jsx)("span",{className:`${p}__field-change-count`,children:N("version:changedFieldsCount",{count:e})})]}),(0,r.jsx)("div",{className:g,children:d})]}),c[0]=v,c[1]=d,c[2]=A,c[3]=u,c[4]=m,c[5]=C,c[6]=T,c[7]=j,c[8]=x,c[9]=w,c[10]=N,c[11]=k,c[12]=S,c[13]=s}else s=c[13];return s};e.s(["DiffCollapser",0,m],829850)},213431,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(239396),i=e.i(592121);let a="render-field-diffs",o=e=>{let o,s,c,d=(0,t.c)(6),{parent:u,versionFields:h}=e,f=void 0!==u&&u,[p,m]=i.default.useState(!1);d[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{m(!0)},s=[],d[0]=o,d[1]=s):(o=d[0],s=d[1]),(0,i.useEffect)(o,s);let g=`${a}${f?` ${a}--parent`:""}`;return d[2]!==p||d[3]!==g||d[4]!==h?(c=(0,r.jsx)("div",{className:g,children:p?h?.map(l):(0,r.jsx)(i.Fragment,{children:(0,r.jsx)(n.ShimmerEffect,{height:"8rem",width:"100%"})})}),d[2]=p,d[3]=g,d[4]=h,d[5]=c):c=d[5],c};function l(e,t){if(e.fieldByLocale){let n=[];for(let[i,o]of Object.entries(e.fieldByLocale))n.push((0,r.jsx)("div",{className:`${a}__locale`,"data-field-path":o.path,"data-locale":i,children:(0,r.jsx)("div",{className:`${a}__locale-value`,children:o.CustomComponent})},[i,t].join("-")));return(0,r.jsx)("div",{className:`${a}__field`,children:n},t)}return e.field?(0,r.jsx)("div",{className:`${a}__field field__${e.field.type}`,"data-field-path":e.field.path,children:e.field.CustomComponent},t):null}e.s(["RenderVersionFieldsToDiff",0,o])},630741,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(929127),i=e.i(694654);e.i(592121);var a=e.i(711967),o=e.i(829850),l=e.i(213431);let s="collapsible-diff",c=e=>{let c,d=(0,t.c)(8),{baseVersionField:u,comparisonValue:h,field:f,parentIsLocalized:p,versionValue:m}=e,{i18n:g}=(0,i.useTranslation)(),{selectedLocales:b}=(0,a.useSelectedLocales)();return u.fields?.length?(d[0]!==u.fields||d[1]!==f||d[2]!==g||d[3]!==p||d[4]!==b||d[5]!==h||d[6]!==m?(c=(0,r.jsx)("div",{className:s,children:(0,r.jsx)(o.DiffCollapser,{fields:f.fields,Label:"label"in f&&f.label&&"function"!=typeof f.label&&(0,r.jsx)("span",{children:(0,n.getTranslation)(f.label,g)}),locales:b,parentIsLocalized:p||f.localized,valueFrom:h,valueTo:m,children:(0,r.jsx)(l.RenderVersionFieldsToDiff,{versionFields:u.fields})})}),d[0]=u.fields,d[1]=f,d[2]=g,d[3]=p,d[4]=b,d[5]=h,d[6]=m,d[7]=c):c=d[7],c):null};e.s(["Collapsible",0,c])},110559,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686),i=e.i(265055),a=e.i(694654),o=e.i(634513);e.i(592121);let l="date-diff",s=e=>{let s,c=(0,t.c)(7),{comparisonValue:d,field:u,locale:h,nestingLevel:f,versionValue:p}=e,{i18n:m}=(0,a.useTranslation)(),{config:g}=(0,i.useConfig)(),{admin:b}=g,{dateFormat:y}=b,v=d?(0,o.formatDate)({date:"string"==typeof d?new Date(d):d,i18n:m,pattern:y}):"",x=p?(0,o.formatDate)({date:"string"==typeof p?new Date(p):p,i18n:m,pattern:y}):"",w=(0,n.escapeDiffHTML)(v),k=(0,n.escapeDiffHTML)(x),S=`

`+w+"

",C=`

`+k+"

";if(c[0]!==u.label||c[1]!==m||c[2]!==h||c[3]!==f||c[4]!==S||c[5]!==C){let{From:e,To:t}=(0,n.getHTMLDiffComponents)({fromHTML:S,postProcess:n.unescapeDiffHTML,toHTML:C,tokenizeByCharacter:!1});s=(0,r.jsx)(n.FieldDiffContainer,{className:l,From:e,i18n:m,label:{label:u.label,locale:h},nestingLevel:f,To:t}),c[0]=u.label,c[1]=m,c[2]=h,c[3]=f,c[4]=S,c[5]=C,c[6]=s}else s=c[6];return s};e.s(["DateDiffComponent",0,s])},415619,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(929127),i=e.i(694654);e.i(592121);var a=e.i(711967),o=e.i(829850),l=e.i(213431);let s="group-diff",c=e=>{let c,d=(0,t.c)(9),{baseVersionField:u,comparisonValue:h,field:f,locale:p,parentIsLocalized:m,versionValue:g}=e,{i18n:b}=(0,i.useTranslation)(),{selectedLocales:y}=(0,a.useSelectedLocales)();return d[0]!==u.fields||d[1]!==f||d[2]!==b||d[3]!==p||d[4]!==m||d[5]!==y||d[6]!==h||d[7]!==g?(c=(0,r.jsx)("div",{className:s,children:(0,r.jsx)(o.DiffCollapser,{fields:f.fields,Label:"label"in f&&f.label&&"function"!=typeof f.label?(0,r.jsxs)("span",{children:[p&&(0,r.jsx)("span",{className:`${s}__locale-label`,children:p}),(0,n.getTranslation)(f.label,b)]}):(0,r.jsxs)("span",{className:`${s}__locale-label ${s}__locale-label--no-label`,children:[""]}),locales:y,parentIsLocalized:m||f.localized,valueFrom:h,valueTo:g,children:(0,r.jsx)(l.RenderVersionFieldsToDiff,{versionFields:u.fields})})}),d[0]=u.fields,d[1]=f,d[2]=b,d[3]=p,d[4]=m,d[5]=y,d[6]=h,d[7]=g,d[8]=c):c=d[8],c};e.s(["Group",0,c])},348343,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(929127),i=e.i(265055),a=e.i(694654),o=e.i(154035);e.i(592121);var l=e.i(711967),s=e.i(829850),c=e.i(213431),d=e.i(717495);let u="iterable-diff",h=e=>{let h,f=(0,t.c)(12),{baseVersionField:p,comparisonValue:m,field:g,locale:b,parentIsLocalized:y,versionValue:v}=e,{i18n:x,t:w}=(0,a.useTranslation)(),{selectedLocales:k}=(0,l.useSelectedLocales)(),{config:S}=(0,i.useConfig)();if(!(0,o.fieldIsArrayType)(g)&&!(0,o.fieldIsBlockType)(g))throw Error(`Expected field to be an array or blocks type but got: ${g.type}`);let C=Math.max(Array.isArray(v)?v.length:0,Array.isArray(m)?m.length:0);return f[0]!==p||f[1]!==S||f[2]!==g||f[3]!==x||f[4]!==b||f[5]!==C||f[6]!==y||f[7]!==k||f[8]!==w||f[9]!==m||f[10]!==v?(h=(0,r.jsx)("div",{className:u,children:(0,r.jsxs)(s.DiffCollapser,{field:g,isIterable:!0,Label:"label"in g&&g.label&&"function"!=typeof g.label&&(0,r.jsxs)("span",{children:[b&&(0,r.jsx)("span",{className:`${u}__locale-label`,children:b}),(0,n.getTranslation)(g.label,x)]}),locales:k,parentIsLocalized:y,valueFrom:m,valueTo:v,children:[C>0&&(0,r.jsx)("div",{className:`${u}__rows`,children:Array.from({length:C},(e,t)=>{let n=v?.[t]||{},i=m?.[t]||{},{fields:a,versionFields:l}=(0,d.getFieldsForRowComparison)({baseVersionField:p,config:S,field:g,row:t,valueFromRow:i,valueToRow:n});if(!l?.length)return null;let h=String(t+1).padStart(2,"0"),f=(0,o.fieldIsArrayType)(g)?`${w("general:item")} ${h}`:`${w("fields:block")} ${h}`;return(0,r.jsx)("div",{className:`${u}__row`,children:(0,r.jsx)(s.DiffCollapser,{fields:a,hideGutter:!0,Label:(0,r.jsxs)("div",{className:`${u}-label-container`,children:[(0,r.jsx)("div",{className:`${u}-label-prefix`}),(0,r.jsx)("span",{className:`${u}__label`,children:f})]}),locales:k,parentIsLocalized:y||g.localized,valueFrom:i,valueTo:n,children:(0,r.jsx)(c.RenderVersionFieldsToDiff,{versionFields:l})})},t)})}),0===C&&(0,r.jsx)("div",{className:`${u}__no-rows`,children:x.t("version:noRowsFound",{label:"labels"in g&&g.labels?.plural?(0,n.getTranslation)(g.labels.plural,x):x.t("general:rows")})})]})}),f[0]=p,f[1]=S,f[2]=g,f[3]=x,f[4]=b,f[5]=C,f[6]=y,f[7]=k,f[8]=w,f[9]=m,f[10]=v,f[11]=h):h=f[11],h};e.s(["Iterable",0,h])},184475,e=>{"use strict";var t=e.i(699173);e.i(592121);var r=e.i(213431);let n="row-diff",i=({baseVersionField:e})=>(0,t.jsx)("div",{className:n,children:(0,t.jsx)(r.RenderVersionFieldsToDiff,{versionFields:e.fields})});e.s(["Row",0,i])},188380,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(929127),i=e.i(541686),a=e.i(694654);e.i(592121);let o="select-diff",l=(e,t,r)=>r&&Array.isArray(e)?e.map(e=>t.find(t=>("string"==typeof t?t:t.value)===e)||String(e)):t.find(t=>("string"==typeof t?t:t.value)===e)||String(e),s=(e,t)=>{if(Array.isArray(e))return e.map(e=>{if("string"==typeof e)return e;let r=(0,n.getTranslation)(e.label,t);return"string"==typeof r?r:e.value}).join(", ");if("string"==typeof e)return e;let r=(0,n.getTranslation)(e.label,t);return"string"==typeof r?r:e.value},c=e=>{let n,c=(0,t.c)(7),{comparisonValue:d,field:u,locale:h,nestingLevel:f,versionValue:p}=e,{i18n:m}=(0,a.useTranslation)(),g="options"in u&&u.options,b=void 0!==d?s(l("string"==typeof d?d:JSON.stringify(d),g,u.hasMany),m):"",y=void 0!==p?s(l("string"==typeof p?p:JSON.stringify(p),g,u.hasMany),m):"",v="

"+(0,i.escapeDiffHTML)(b)+"

",x="

"+(0,i.escapeDiffHTML)(y)+"

";if(c[0]!==u.label||c[1]!==m||c[2]!==h||c[3]!==f||c[4]!==v||c[5]!==x){let{From:e,To:t}=(0,i.getHTMLDiffComponents)({fromHTML:v,postProcess:i.unescapeDiffHTML,toHTML:x,tokenizeByCharacter:!0});n=(0,r.jsx)(i.FieldDiffContainer,{className:o,From:e,i18n:m,label:{label:u.label,locale:h},nestingLevel:f,To:t}),c[0]=u.label,c[1]=m,c[2]=h,c[3]=f,c[4]=v,c[5]=x,c[6]=n}else n=c[6];return n};e.s(["Select",0,c])},673204,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(929127),i=e.i(694654);e.i(592121);var a=e.i(711967),o=e.i(829850),l=e.i(213431);let s="tabs-diff",c=e=>{let n,i=(0,t.c)(13),{baseVersionField:o,comparisonValue:l,field:c,versionValue:u}=e,{selectedLocales:h}=(0,a.useSelectedLocales)();if(i[0]!==o.tabs||i[1]!==c||i[2]!==e||i[3]!==h||i[4]!==l||i[5]!==u){let t;i[7]!==c||i[8]!==e||i[9]!==h||i[10]!==l||i[11]!==u?(t=(t,n)=>{if(!t?.fields?.length)return null;let i=c.tabs?.[n];return i?(0,r.jsx)("div",{className:`${s}__tab`,children:(()=>{if("name"in i&&h&&i.localized)return h.map((n,a)=>{let o={...e,comparisonValue:l?.[t.name]?.[n],fieldTab:i,locale:n,tab:t,versionValue:u?.[t.name]?.[n]};return(0,r.jsx)("div",{className:`${s}__tab-locale`,children:(0,r.jsx)("div",{className:`${s}__tab-locale-value`,children:(0,r.jsx)(d,{...o},n)})},[n,a].join("-"))});if(!("name"in t)||!t.name)return(0,r.jsx)(d,{fieldTab:i,...e,tab:t},n);{let a={...e,comparisonValue:l?.[t.name],fieldTab:i,tab:t,versionValue:u?.[t.name]};return(0,r.jsx)(d,{...a},n)}})()},n):null},i[7]=c,i[8]=e,i[9]=h,i[10]=l,i[11]=u,i[12]=t):t=i[12],n=(0,r.jsx)("div",{className:s,children:o.tabs.map(t)}),i[0]=o.tabs,i[1]=c,i[2]=e,i[3]=h,i[4]=l,i[5]=u,i[6]=n}else n=i[6];return n},d=e=>{let c,d=(0,t.c)(10),{comparisonValue:u,fieldTab:h,locale:f,parentIsLocalized:p,tab:m,versionValue:g}=e,{i18n:b}=(0,i.useTranslation)(),{selectedLocales:y}=(0,a.useSelectedLocales)();return m.fields?.length?(d[0]!==h.fields||d[1]!==h.localized||d[2]!==b||d[3]!==f||d[4]!==p||d[5]!==y||d[6]!==m||d[7]!==u||d[8]!==g?(c=(0,r.jsx)(o.DiffCollapser,{fields:h.fields,Label:"label"in m&&m.label&&"function"!=typeof m.label&&(0,r.jsxs)("span",{children:[f&&(0,r.jsx)("span",{className:`${s}__locale-label`,children:f}),(0,n.getTranslation)(m.label,b)]}),locales:y,parentIsLocalized:p||h.localized,valueFrom:u,valueTo:g,children:(0,r.jsx)(l.RenderVersionFieldsToDiff,{versionFields:m.fields})}),d[0]=h.fields,d[1]=h.localized,d[2]=b,d[3]=f,d[4]=p,d[5]=y,d[6]=m,d[7]=u,d[8]=g,d[9]=c):c=d[9],c):null};e.s(["Tabs",0,c])},256770,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686),i=e.i(694654);e.i(592121);let a="text-diff";function o(e){return"string"==typeof e?{tokenizeByCharacter:!0,value:(0,n.escapeDiffHTML)(e)}:"number"==typeof e?{tokenizeByCharacter:!0,value:String(e)}:"boolean"==typeof e?{tokenizeByCharacter:!1,value:String(e)}:e&&"object"==typeof e?{tokenizeByCharacter:!1,value:`
${(0,n.escapeDiffHTML)(JSON.stringify(e,null,2))}
`}:{tokenizeByCharacter:!0,value:void 0}}let l=e=>{let l,s=(0,t.c)(8),{comparisonValue:c,field:d,locale:u,nestingLevel:h,versionValue:f}=e,{i18n:p}=(0,i.useTranslation)(),m="";if(f==c&&(m=''),s[0]!==d.label||s[1]!==p||s[2]!==u||s[3]!==h||s[4]!==m||s[5]!==c||s[6]!==f){let e=o(c),t=o(f),i=!0;e.value?.length?i=e.tokenizeByCharacter:t.value?.length&&(i=t.tokenizeByCharacter);let g=e.value??m,b=t.value??m,{From:y,To:v}=(0,n.getHTMLDiffComponents)({fromHTML:"

"+g+"

",postProcess:n.unescapeDiffHTML,toHTML:"

"+b+"

",tokenizeByCharacter:i});l=(0,r.jsx)(n.FieldDiffContainer,{className:a,From:y,i18n:p,label:{label:d.label,locale:u},nestingLevel:h,To:v}),s[0]=d.label,s[1]=p,s[2]=u,s[3]=h,s[4]=m,s[5]=c,s[6]=f,s[7]=l}else l=s[7];return l};e.s(["Text",0,l])},710011,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686),i=e.i(265055),a=e.i(694654),o=e.i(634513),l=e.i(592121);function s({currentLocale:e,currentlyPublishedVersion:t,latestDraftVersion:r,t:n,version:i}){let a=i.version._status;if("draft"===a){if(t?.updatedAt>r?.updatedAt)return{name:"draft",label:n("version:draft"),pillStyle:"light"};let e=i.id===r?.id;return{name:e?"currentDraft":"draft",label:n(e?"version:currentDraft":"version:draft"),pillStyle:"light"}}if("published"===a&&i.publishedLocale&&e!==i.publishedLocale)return{name:"currentDraft",label:n("version:currentDraft"),pillStyle:"light"};let o=t&&i.id===t.id;return{name:o?"currentlyPublished":"previouslyPublished",label:n(o?"version:currentlyPublished":"version:previouslyPublished"),pillStyle:o?"success":"light"}}let c="version-pill-label",d=(e,t)=>(0,r.jsx)(n.Pill,{pillStyle:t,size:"small",children:e}),u=e=>{let u,h=(0,t.c)(14),{currentlyPublishedVersion:f,disableDate:p,doc:m,labelFirst:g,labelOverride:b,labelStyle:y,labelSuffix:v,latestDraftVersion:x}=e,w=void 0!==p&&p,k=void 0!==g&&g,S=void 0===y?"pill":y,{config:C}=(0,i.useConfig)(),{admin:_,localization:j}=C,{dateFormat:N}=_,{i18n:T,t:E}=(0,a.useTranslation)(),{code:A}=(0,n.useLocale)();if(h[0]!==A||h[1]!==f||h[2]!==N||h[3]!==w||h[4]!==m||h[5]!==T||h[6]!==k||h[7]!==b||h[8]!==S||h[9]!==v||h[10]!==x||h[11]!==j||h[12]!==E){let{label:e,pillStyle:t}=s({currentLocale:A,currentlyPublishedVersion:f,latestDraftVersion:x,t:E,version:m}),i=(0,r.jsxs)("span",{children:[b||e,v]}),a=!w&&m.updatedAt,p=a?(0,o.formatDate)({date:m.updatedAt,i18n:T,pattern:N}):null,g=Array.isArray(m.publishedLocale)?m.publishedLocale[0]:m.publishedLocale,y=j&&j?.locales?j.locales.find(e=>e.code===g):null,C=y?y?.label?.[T?.language]||y?.label:null;u=(0,r.jsxs)("div",{className:c,children:[k?(0,r.jsxs)(l.default.Fragment,{children:["pill"===S?d(i,t):(0,r.jsx)("span",{className:`${c}-text`,children:i}),a&&(0,r.jsx)("span",{className:`${c}-date`,children:p})]}):(0,r.jsxs)(l.default.Fragment,{children:[a&&(0,r.jsx)("span",{className:`${c}-date`,children:p}),"pill"===S?d(i,t):(0,r.jsx)("span",{className:`${c}-text`,children:i})]}),C&&(0,r.jsx)(n.Pill,{size:"small",children:C})]}),h[0]=A,h[1]=f,h[2]=N,h[3]=w,h[4]=m,h[5]=T,h[6]=k,h[7]=b,h[8]=S,h[9]=v,h[10]=x,h[11]=j,h[12]=E,h[13]=u}else u=h[13];return u};e.s(["VersionPillLabel",0,u],710011)},105216,e=>{"use strict";var t=e.i(699173),r=e.i(265055),n=e.i(541686),i=e.i(694654),a=e.i(634513),o=e.i(961123);let l=e=>{let{rowData:l}=e,{id:s,updatedAt:c}=void 0===l?{}:l,{config:d}=(0,r.useConfig)(),{admin:u}=d,{dateFormat:h}=u,{closeAllModals:f}=(0,n.useModal)(),p=(0,o.useRouter)(),m=(0,o.usePathname)(),g=(0,o.useSearchParams)(),{startRouteTransition:b}=(0,n.useRouteTransition)(),{i18n:y}=(0,i.useTranslation)();return(0,t.jsx)("button",{className:"created-at-cell",onClick:()=>{f();let e=new URLSearchParams(Array.from(g.entries()));s&&e.set("versionFrom",String(s));let t=e.toString(),r=t?`?${t}`:"";b(()=>p.push(`${m}${r}`))},type:"button",children:(0,a.formatDate)({date:c,i18n:y,pattern:h})})};e.s(["VersionDrawerCreatedAtCell",0,l])},95347,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686),i=e.i(694654);e.i(592121);var a=e.i(710011);let o="autosave-cell",l=e=>{let l,s=(0,t.c)(5),{currentlyPublishedVersion:c,latestDraftVersion:d,rowData:u}=e,{t:h}=(0,i.useTranslation)();return s[0]!==c||s[1]!==d||s[2]!==u||s[3]!==h?(l=(0,r.jsxs)("div",{className:`${o}__items`,children:[u?.autosave&&(0,r.jsx)(n.Pill,{size:"small",children:h("version:autosave")}),(0,r.jsx)(a.VersionPillLabel,{currentlyPublishedVersion:c,disableDate:!0,doc:u,labelFirst:!1,labelStyle:"pill",latestDraftVersion:d})]}),s[0]=c,s[1]=d,s[2]=u,s[3]=h,s[4]=l):l=s[4],l};e.s(["AutosaveCell",0,l])},296107,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(265055),i=e.i(694654),a=e.i(634513),o=e.i(267966);e.i(592121);let l=e=>{let l,{collectionSlug:s,docID:c,globalSlug:d,isTrashed:u,rowData:h}=e,{id:f,updatedAt:p}=void 0===h?{}:h,{config:m}=(0,n.useConfig)(),{admin:g,routes:b}=m,{dateFormat:y}=g,{admin:v}=b,{i18n:x}=(0,i.useTranslation)(),w=u?"trash/":"";return s&&(l=(0,o.formatAdminURL)({adminRoute:v,path:`/collections/${s}/${w}${c}/versions/${f}`})),d&&(l=(0,o.formatAdminURL)({adminRoute:v,path:`/globals/${d}/versions/${f}`})),(0,t.jsx)(r.Link,{href:l,prefetch:!1,children:(0,a.formatDate)({date:p,i18n:x,pattern:y})})};e.s(["CreatedAtCell",0,l])},676577,e=>{"use strict";var t=e.i(699173),r=e.i(592121);function n({id:e}){return(0,t.jsx)(r.Fragment,{children:e})}e.s(["IDCell",0,n])},986206,e=>{"use strict";var t=e.i(605913),r=e.i(699173),n=e.i(541686),i=e.i(694654),a=e.i(961123),o=e.i(592121);let l=e=>{let l,s,c=(0,t.c)(13),{baseClass:d,columns:u,paginationLimits:h}=e,{data:f,handlePageChange:p,handlePerPageChange:m}=(0,n.useListQuery)(),g=(0,a.useSearchParams)();c[0]!==g?(l=g.get("limit"),c[0]=g,c[1]=l):l=c[1];let b=l,{i18n:y}=(0,i.useTranslation)(),v=f?.totalDocs||0,x=!f;return c[2]!==d||c[3]!==u||c[4]!==f||c[5]!==p||c[6]!==m||c[7]!==y||c[8]!==b||c[9]!==h||c[10]!==x||c[11]!==v?(s=(0,r.jsxs)(o.default.Fragment,{children:[(0,r.jsx)(n.LoadingOverlayToggle,{name:"versions",show:x}),0===v&&(0,r.jsx)("div",{className:`${d}__no-versions`,children:y.t("version:noFurtherVersionsFound")}),v>0&&(0,r.jsxs)(o.default.Fragment,{children:[(0,r.jsx)(n.Table,{columns:u,data:f?.docs}),(0,r.jsxs)("div",{className:`${d}__page-controls`,children:[(0,r.jsx)(n.Pagination,{hasNextPage:f.hasNextPage,hasPrevPage:f.hasPrevPage,limit:f.limit,nextPage:f.nextPage,numberOfNeighbors:1,onChange:p,page:f.page,prevPage:f.prevPage,totalPages:f.totalPages}),f?.totalDocs>0&&(0,r.jsxs)(o.default.Fragment,{children:[(0,r.jsxs)("div",{className:`${d}__page-info`,children:[f.page*f.limit-(f.limit-1),"-",f.totalPages>1&&f.totalPages!==f.page?f.limit*f.page:f.totalDocs," ",y.t("general:of")," ",f.totalDocs]}),(0,r.jsx)(n.PerPage,{handleChange:m,limit:b?Number(b):10,limits:h})]})]})]})]}),c[2]=d,c[3]=u,c[4]=f,c[5]=p,c[6]=m,c[7]=y,c[8]=b,c[9]=h,c[10]=x,c[11]=v,c[12]=s):s=c[12],s};e.s(["VersionsViewClient",0,l])},17223,e=>{"use strict";var t=e.i(699173),r=e.i(848083),n=e.i(961123),i=e.i(592121);e.i(605913);var a=i;let o=a.default.createContext({isTransitioning:!1,startRouteTransition:e=>{"function"==typeof e&&e()},transitionProgress:0}),l=()=>a.default.use(o),s=/https?|ftp|gopher|file/;function c(e){return"string"!=typeof e&&("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function d(e){let t=new URLSearchParams;return Object.entries(e).forEach(([e,r])=>{Array.isArray(r)?r.forEach(r=>t.append(e,c(r))):t.set(e,c(r))}),t}function u(e){let{auth:t}=e,{hostname:r}=e,n=e.protocol||"",i=e.pathname||"",a=e.hash||"",o=e.query||"",l=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?l=t+e.host:r&&(l=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(l+=":"+e.port)),o&&"object"==typeof o&&(o=String(d(o)));let c=e.search||o&&`?${o}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||s.test(n))&&!1!==l?(l="//"+(l||""),i&&"/"!==i[0]&&(i="/"+i)):l||(l=""),a&&"#"!==a[0]&&(a="#"+a),c&&"?"!==c[0]&&(c="?"+c),i=i.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${l}${i}${c}${a}`}let h="default"in r.default?r.default.default:r.default;function f(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}let p=({children:e,href:r,onClick:i,preventDefault:a=!0,ref:o,replace:s,scroll:c,...d})=>{let p=(0,n.useRouter)(),{startRouteTransition:m}=l();return(0,t.jsx)(h,{href:r,onClick:e=>{if(f(e))return;i&&i(e),a&&e.preventDefault();let t="string"==typeof r?r:u(r);m(()=>{s?p.replace(t,{scroll:c}):p.push(t,{scroll:c})})},ref:o,...d,children:e})};e.s(["Link",0,p],17223)},423693,825259,e=>{"use strict";var t=e.i(514514);let r=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],n=(0,t.default)("thumbs-down",r);e.s(["ThumbsDown",0,n],423693);let i=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],a=(0,t.default)("thumbs-up",i);e.s(["ThumbsUp",0,a],825259)},695018,(e,t,r)=>{var n=1e3,i=6e4,a=36e5,o=864e5,l=6048e5,s=315576e5;function c(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),c=(t[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return r*s;case"weeks":case"week":case"w":return r*l;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*a;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function d(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=a?Math.round(e/a)+"h":t>=i?Math.round(e/i)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}function u(e){var t=Math.abs(e);return t>=o?h(e,t,o,"day"):t>=a?h(e,t,a,"hour"):t>=i?h(e,t,i,"minute"):t>=n?h(e,t,n,"second"):e+" ms"}function h(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return c(e);if("number"===r&&isFinite(e))return t.long?u(e):d(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},702660,(e,t,r)=>{t.exports=function(t){function r(e){let t=0;for(let r=0;r{if("%%"===t)return"%";a++;let o=n.formatters[i];if("function"==typeof o){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return l.namespace=e,l.useColors=n.useColors(),l.color=n.selectColor(e),l.extend=i,l.destroy=n.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==n.namespaces&&(r=n.namespaces,a=n.enabled(e)),a),set:e=>{o=e}}),"function"==typeof n.init&&n.init(l),l}function i(e,t){let r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function a(e){for(let t of(n.save(e),n.namespaces=e,n.names=[],n.skips=[],("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean)))"-"===t[0]?n.skips.push(t.slice(1)):n.names.push(t)}function o(e,t){let r=0,n=0,i=-1,a=0;for(;r"-"+e)].join(",");return n.enable(""),e}function s(e){for(let t of n.skips)if(o(e,t))return!1;for(let t of n.names)if(o(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.debug=n,n.default=n,n.coerce=c,n.disable=l,n.enable=a,n.enabled=s,n.humanize=e.r(695018),n.destroy=d,Object.keys(t).forEach(e=>{n[e]=t[e]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=r,n.enable(n.load()),n}},272851,(e,t,r)=>{var n=e.i(546584);function i(){let e;return"u">typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("u">typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"u">typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"u">typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function a(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}}function o(){let e;try{e=r.storage.getItem("debug")||r.storage.getItem("DEBUG")}catch(e){}return!e&&void 0!==n.default&&"env"in n.default&&(e=n.default.env.DEBUG),e}function l(){try{return localStorage}catch(e){}}r.formatArgs=function e(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),e.splice(i,0,r)},r.save=a,r.load=o,r.useColors=i,r.storage=l(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=e.r(702660)(r);let{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},695881,(e,t,r)=>{"use strict";var n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.createLogger=l,r.log=s;let i=n(e.r(272851));i.default.log=console.info.bind(console);let a=console.error.bind(console),o="wx-next";function l(e){let t=(0,i.default)(`${o}:${e}`),r=(0,i.default)(`${o}:debug:${e}`),n=(0,i.default)(`${o}:error:${e}`),s=(0,i.default)(`${o}:warn:${e}`),c=(0,i.default)(`${o}:lifecycle:${e}`);n.log=a,s.log=console.warn.bind(console);let d=(e,...r)=>{t(e,...r)};return d.info=(e,...r)=>{t(e,...r)},d.debug=(e,...t)=>{r(e,...t)},d.error=(e,...t)=>{n(e,...t)},d.warn=(e,...t)=>{s(e,...t)},d.lifecycle=(e,...t)=>{c(e,...t)},d.extend=t=>l(`${e}:${t}`),d}function s(e,t,...r){l(e)(t,...r)}},627163,e=>{"use strict";var t=e.i(514514);let r=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],n=(0,t.default)("copy",r);e.s(["Copy",0,n],627163)},294832,e=>{"use strict";var t=e.i(514514);let r=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],n=(0,t.default)("ellipsis",r);e.s(["default",0,n])},292e3,405757,955653,283584,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(632137),i=e.i(627163),a=e.i(294832),a=a,o=e.i(423693),l=e.i(825259);function s({IconComponent:e,onClick:i,active:a=!0,ariaLabel:o,tooltip:l}){return(0,t.jsx)(r.Button,{tooltip:l,"aria-label":o,onClick:i,type:"button",className:(0,n.cn)("m-0 border-none bg-transparent p-0 text-white",!a&&"opacity-50"),icon:(0,t.jsx)(e,{className:"h-5 w-5"})})}function c({feedback:e,isMoreOpen:n,onClickGood:d,onClickBad:u,onClickCopy:h,onToggleMore:f,menuOptions:p}){return(0,t.jsxs)("div",{className:"flex gap-4 py-1",children:[(0,t.jsx)(s,{IconComponent:l.ThumbsUp,onClick:d,tooltip:"Good generation",active:"good"===e}),(0,t.jsx)(s,{IconComponent:o.ThumbsDown,onClick:u,tooltip:"Bad generation",active:"bad"===e}),h&&(0,t.jsx)(s,{IconComponent:i.Copy,onClick:h,tooltip:"Copy to clipboard"}),p&&(0,t.jsx)(r.Popup,{forceOpen:n,onToggleClose:()=>f(!1),onToggleOpen:()=>f(!0),size:"large",buttonType:"custom",button:(0,t.jsx)(s,{IconComponent:a.default}),children:(0,t.jsx)(r.PopupList.ButtonGroup,{children:p.map(e=>(0,t.jsx)(r.PopupList.Button,{onClick:e.onClick,children:e.title},e.key))})})]})}e.s(["FeedbackToolbar",0,c],292e3);var d=t,u=r,h=n,f=e.i(514514);let p=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],m=(0,f.default)("loader",p);var g=e.i(592121);let b="feedback-form-dialog",y="confirmation-modal";function v({title:e="Report Issue",placeholder:t="Tell us about the issue you experienced",loading:r=!1,open:n,onClose:i,onSubmit:a}){let[o,l]=(0,g.useState)("");return(0,d.jsx)(u.Modal,{slug:b,title:e,open:n,closeOnBlur:!0,onClose:i,className:y,children:(0,d.jsxs)("div",{className:(0,h.cn)(`${y}__wrapper`,"w-full max-w-xl"),children:[(0,d.jsxs)("div",{className:`${y}__content`,children:[(0,d.jsx)("h1",{children:e}),(0,d.jsxs)("div",{children:[(0,d.jsx)(u.FieldLabel,{label:"Feedback",required:!0,path:"feedback"}),(0,d.jsx)(u.TextareaInput,{value:o,onChange:e=>l(e.target.value),path:"feedback",required:!0,rows:4,placeholder:t})]})]}),(0,d.jsxs)("div",{className:`${y}__controls`,children:[(0,d.jsx)(u.Button,{type:"button",size:"large",buttonStyle:"secondary",onClick:i,children:"Cancel"}),(0,d.jsx)(u.Button,{size:"large",disabled:!o.trim()||r,buttonStyle:"primary",onClick:async()=>{await a(o.trim()),l("")},icon:r?(0,d.jsx)(m,{className:"h-4 w-4 animate-spin"}):void 0,children:"Submit"})]})]})})}e.s(["FEEDBACK_FORM_DIALOG_SLUG",0,b,"default",0,v],405757),e.s(["FeedbackFormDialog",0,v],955653);var x=g;function w(e){let[t,r]=(0,x.useState)(!1);return{loading:t,onSubmit:(0,x.useCallback)(async t=>{r(!0);try{return e?await e(t):console.log(t),{success:!0}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Something went wrong"}}finally{r(!1)}},[e])}}e.s(["useSubmitIssue",0,w],283584)},181443,e=>{"use strict";function t(e){if("string"==typeof e)return e.trim()||void 0}let r=["weather-com-web","weather-com-mobile-web","weather-com-mobile-web-samsung"];function n(e){return e.endsWith("-promo")?e.slice(0,-6):e}function i(e){if("string"!=typeof e)return!1;let t=n(e.trim());return r.includes(t)}e.s(["isPageScopableChannel",0,i,"normalizePageScope",0,t])},997905,e=>{"use strict";var t=e.i(181443);function r(e){if("string"==typeof e)return e||void 0;if(e&&"object"==typeof e&&"id"in e){let{id:t}=e;return"string"==typeof t?t:void 0}}function n(e){return r(e&&"object"==typeof e&&"channel"in e?e.channel:void 0)}function i(e){let r=e&&"object"==typeof e&&"page"in e?e.page:void 0;return(0,t.normalizePageScope)(r)}function a(e,r){let n=(0,t.normalizePageScope)(r);return n?`${e} — ${n}`:e}function o(e){if(!e||"object"!=typeof e||!("channelOverrides"in e))return[];let t=e.channelOverrides;if(!t||"object"!=typeof t||!("channelHeadlines"in t))return[];let r=t.channelHeadlines;return Array.isArray(r)?r:[]}function l(e){return o(e).filter(e=>!!e&&"object"==typeof e)}function s(e,t){return e.findIndex(e=>r(e.channel)===t&&!i(e))}function c(e,t){let r=new Map;e.forEach((e,t)=>{if(i(e))return;let a=n(e);a&&!r.has(a)&&r.set(a,t)});let a=e.length,o=[];for(let e of t){let t=r.get(e);void 0!==t?o.push({type:"replace",rowIndex:t,channelId:e}):(o.push({type:"add",channelId:e}),r.set(e,a),a+=1)}return o}e.s(["findUnscopedRowIndex",0,s,"formatChannelRowLabel",0,a,"getChannelHeadlineArray",0,o,"getRowChannelId",0,n,"getRowPageScope",0,i,"planGroupApply",0,c,"readChannelHeadlineRows",0,l])},119058,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(423693),a=e.i(825259),o=r,l=e.i(695881),s=e.i(62728);let c=["seoFields","channelHeadlines","seoRecommendations","contentTags","relatedArticles"],d=["seoFields","channelHeadlines","seoRecommendations","contentTags","relatedArticles"],u=(0,l.createLogger)("payload:analyze-content:hook");function h({documentId:e,collection:t,locale:r="en"}){let[n,i]=(0,o.useState)(d),[a,l]=(0,o.useState)(!1),[c,f]=(0,o.useState)(null),[p,m]=(0,o.useState)(null),[g,b]=(0,o.useState)({seoFields:void 0,channelHeadlines:void 0,seoRecommendations:void 0,contentTags:void 0,relatedArticles:void 0}),[y,v]=(0,o.useState)(new Set),x=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{x.current?.abort()},[]);let w=(0,o.useCallback)(e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),k=(0,o.useCallback)(async()=>{if(!e||0===n.length)return;l(!0),m(null),f(null),v(new Set),b({seoFields:void 0,channelHeadlines:void 0,seoRecommendations:void 0,contentTags:void 0,relatedArticles:void 0}),x.current?.abort();let i=new AbortController;x.current=i;let a=setTimeout(()=>i.abort(),18e4);try{let{data:a,error:o}=await (0,s.tryCatch)(fetch("/api/payload/v1/ai/analyze-content",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",signal:i.signal,body:JSON.stringify({documentId:e,collection:t,steps:n,locale:r})}));if(o)return void(o instanceof Error&&"AbortError"===o.name?m("Analysis timed out — please try again"):m(o instanceof Error?o.message:"Network error"));if(!a)return void m("No response received");let{data:l,error:c}=await (0,s.tryCatch)(a.json());if(c||!l)return void m("Failed to parse analysis response");if(!l.success)return void m(l.error||"Analysis failed");l.data&&f(l.data)}finally{clearTimeout(a),l(!1),x.current=null}},[e,t,n,r]),S=(0,o.useCallback)(async(e,t,r)=>{if(!c?.overallTraceId)return{success:!1,error:"Run an analysis before leaving feedback."};b(r=>({...r,[e]:t}));let n={traceId:c.overallTraceId,step:e,feedback:t,comment:r},{error:i}=await (0,s.tryCatch)(fetch("/api/payload/v1/ai/analyze-content/feedback",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)}));return i?(u.warn("Failed to submit feedback",{error:i}),{success:!1,error:i instanceof Error?i.message:"Failed to submit feedback"}):{success:!0}},[c]);return{selectedSteps:n,toggleStep:w,isAnalyzing:a,results:c,error:p,analyze:k,submitFeedback:S,feedbackState:g,dismissedSuggestions:y,dismissSuggestion:(0,o.useCallback)(e=>{v(t=>new Set(t).add(e))},[]),createTag:(0,o.useCallback)(async e=>{let t=e.trim();if(!t)return null;let{data:r,error:n}=await (0,s.tryCatch)(fetch("/api/payload/v1/ai/analyze-content/create-tags",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({tagNames:[t]})}));if(n||!r)return u.warn("Failed to create tag",{tagName:t,error:n}),null;let{data:i,error:a}=await (0,s.tryCatch)(r.json());return!a&&i?.success&&i.data?.tags?.[0]?i.data.tags[0]:(u.warn("Tag creation returned no tag",{tagName:t,error:a??i?.error}),null)},[])}}var f=t;let p={seoFields:"SEO",channelHeadlines:"Headlines",seoRecommendations:"Recs",contentTags:"Tags",relatedArticles:"Related"};function m({step:e,checked:t,onChange:r,disabled:n=!1}){return(0,f.jsx)("button",{type:"button",onClick:()=>r(e),disabled:n,style:{padding:"3px 10px",borderRadius:"12px",fontSize:"11px",fontWeight:500,border:`1px solid ${t?"var(--theme-text)":"var(--theme-elevation-300)"}`,background:t?"var(--theme-text)":"transparent",color:t?"var(--theme-bg)":"var(--theme-elevation-500)",cursor:n?"default":"pointer",opacity:n?.5:1,transition:"background 0.15s, color 0.15s, border-color 0.15s",whiteSpace:"nowrap"},children:p[e]})}var g=e.i(292e3),b=e.i(955653),y=e.i(405757),v=e.i(283584),x=e.i(997905),w=t,k=r;function S({step:e,result:t,feedback:r,onFeedback:n,onAcceptField:i,dismissedSuggestions:a,onDismiss:o,existingKeywords:l,categoryName:s,onAcceptChannelHeadline:c,onAcceptContentTag:d,onAcceptNewTag:u}){if(!t.success)return(0,w.jsxs)("div",{style:{color:"var(--theme-error-500)",fontSize:"12px",padding:"8px 0"},children:["Failed: ",t.error||"Unknown error"]});let h=t.data;return(0,w.jsx)("div",{children:(0,w.jsxs)("div",{style:{fontSize:"12px"},children:["seoFields"===e&&(0,w.jsx)(C,{data:h,onAcceptField:i,dismissedSuggestions:a,onDismiss:o,existingKeywords:l,categoryName:s}),"channelHeadlines"===e&&(0,w.jsx)(R,{data:h,onAccept:c}),"seoRecommendations"===e&&(0,w.jsx)(L,{data:h}),"contentTags"===e&&(0,w.jsx)(D,{data:h,onAccept:d,onAcceptNew:u}),"relatedArticles"===e&&(0,w.jsx)(O,{data:h})]})})}function C({data:e,onAcceptField:t,dismissedSuggestions:r,onDismiss:n,existingKeywords:i=[],categoryName:a}){let o=E(e?.keywords??[],a),[l,s]=(0,k.useState)(()=>o),[c,d]=(0,k.useState)(()=>new Set(o.filter(e=>i?.includes(e)??!1)));if((0,k.useEffect)(()=>{let t=E(e?.keywords??[],a);s(t),d(new Set(t.filter(e=>i?.includes(e)??!1)))},[e]),!e)return(0,w.jsx)("div",{children:"No SEO data generated"});let u=e=>{c.has(e)||(d(t=>new Set(t).add(e)),t?.("seo.keywords",e))};return(0,w.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[e.title&&!r.has("seo-title")&&(0,w.jsx)(A,{label:"SEO Title",value:e.title,charLimit:60,onAccept:()=>t?.("seo.title",e.title),onDismiss:()=>n("seo-title")}),e.description&&!r.has("seo-description")&&(0,w.jsx)(A,{label:"SEO Description",value:e.description,charLimit:160,onAccept:()=>t?.("seo.description",e.description),onDismiss:()=>n("seo-description")}),l.length>0&&(0,w.jsxs)("div",{children:[(0,w.jsx)("div",{style:{fontWeight:500,color:"var(--theme-elevation-800)",marginBottom:"4px"},children:"Keywords"}),(0,w.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:l.map(e=>{let t=c.has(e);return(0,w.jsxs)("div",{role:"group","aria-label":e,style:{display:"inline-flex",alignItems:"center",gap:"4px",background:t?"var(--theme-text)":"var(--theme-elevation-100)",borderRadius:"12px",padding:"2px 6px 2px 8px",fontSize:"11px",color:t?"var(--theme-bg)":"var(--theme-elevation-700)",transition:"background 0.15s, color 0.15s"},children:[(0,w.jsx)("button",{type:"button",onClick:()=>u(e),disabled:t,"aria-label":t?`${e} (added)`:`Add keyword ${e}`,style:{background:"none",border:"none",padding:"0",cursor:t?"default":"pointer",color:"inherit",fontSize:"inherit"},children:e}),!t&&(0,w.jsx)("button",{type:"button",onClick:()=>s(t=>t.filter(t=>t!==e)),style:{background:"none",border:"none",cursor:"pointer",padding:"0",lineHeight:1,color:"var(--theme-elevation-500)",fontSize:"12px"},"aria-label":"Remove "+e,children:"×"})]},e)})})]}),e.contentKeywords&&e.contentKeywords.length>0&&(0,w.jsx)(T,{contentKeywords:e.contentKeywords})]})}let _={title:"Title",h1:"H1",body:"Body",h2:"H2",faq:"FAQ"},j={longtail:"Long-tail & questions",entity:"Entities & topics",competitor:"Competitive & aspirational"},N=["longtail","entity","competitor"];function T({contentKeywords:e}){let t=new Map;for(let r of e){let e=r.group??"other",n=t.get(e)??[];n.push(r),t.set(e,n)}let r=[...N.filter(e=>t.has(e)),...t.has("other")?["other"]:[]];return(0,w.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("h4",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"var(--theme-elevation-800)"},children:"Use in your content"}),(0,w.jsx)("div",{style:{color:"var(--theme-elevation-500)",fontSize:"11px"},children:"These aren't added as tags — work them into your writing where shown. Placement in the content is where search ranking comes from."})]}),r.map(e=>{let r=t.get(e)??[],n="other"===e?"Other":j[e];return(0,w.jsxs)("div",{children:[(0,w.jsx)("h5",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--theme-elevation-400)"},children:n}),(0,w.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:r.map((e,t)=>(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",background:"var(--theme-elevation-50)",borderRadius:"4px",padding:"5px 8px"},children:[(0,w.jsx)("span",{style:{fontSize:"12px"},children:e.term}),(0,w.jsx)("span",{style:{flexShrink:0,fontSize:"10px",fontWeight:600,letterSpacing:"0.03em",textTransform:"uppercase",color:"var(--theme-elevation-600)",background:"var(--theme-elevation-100)",borderRadius:"3px",padding:"1px 5px"},children:_[e.placement]})]},`${e.term}-${t}`))})]},e)})]})}function E(e,t){if(!t)return e;let r=t.trim().toLowerCase();return e.filter(e=>e.trim().toLowerCase()!==r)}function A({label:e,value:t,charLimit:r,onAccept:n,onDismiss:i}){let[a,o]=(0,k.useState)(!1),l=void 0!==r&&t.length>r,s=e=>{o(!0),setTimeout(e,180)};return(0,w.jsxs)("div",{style:{background:"var(--theme-elevation-50)",borderRadius:"3px",padding:"6px",opacity:+!a,transform:a?"translateX(-6px)":"translateX(0)",transition:"opacity 0.18s ease, transform 0.18s ease",overflow:"hidden",maxHeight:a?"0":"200px",marginBottom:a?"-6px":"0"},children:[(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"2px"},children:[(0,w.jsx)("div",{style:{fontWeight:500,textTransform:"capitalize"},children:e}),void 0!==r&&(0,w.jsxs)("span",{style:{fontSize:"10px",color:l?"var(--theme-error-500)":"var(--theme-elevation-400)"},children:[t.length,"/",r]})]}),(0,w.jsx)("div",{style:{marginBottom:"4px"},children:t}),(0,w.jsxs)("div",{style:{display:"flex",gap:"4px"},children:[n&&(0,w.jsx)("button",{type:"button",onClick:()=>s(n),className:"btn btn--style-secondary btn--size-small",style:{fontSize:"11px",padding:"2px 6px"},children:"Accept"}),(0,w.jsx)("button",{type:"button",onClick:()=>s(i),className:"btn btn--style-secondary btn--size-small",style:{fontSize:"11px",padding:"2px 6px"},children:"Dismiss"})]})]})}function R({data:e,onAccept:t}){let[r,n]=(0,k.useState)(()=>new Set);return e&&0!==e.length?(0,w.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:e.map(e=>r.has(e.channel)?null:(0,w.jsx)(A,{label:e.channelName,value:e.headline,charLimit:70,onAccept:t?()=>t(e.channel,e.headline):void 0,onDismiss:()=>n(t=>new Set(t).add(e.channel))},e.channel))}):(0,w.jsx)("div",{children:"No channel headlines generated"})}let M={title:"Title",description:"Description",keyword:"Keyword",general:"General",image:"Image",structure:"Structure"},I={high:0,medium:1,low:2};function L({data:e}){if(!e||0===e.length)return(0,w.jsx)("div",{children:"No SEO recommendations generated"});let t={high:"var(--theme-error-500)",medium:"var(--theme-warning-500)",low:"var(--theme-success-500)"},r=[...e].sort((e,t)=>(I[e.priority]??3)-(I[t.priority]??3));return(0,w.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:r.map((e,r)=>(0,w.jsxs)("div",{style:{background:"var(--theme-elevation-50)",borderRadius:"4px",padding:"8px 10px",borderLeft:`3px solid ${t[e.priority]||"var(--theme-elevation-300)"}`},children:[(0,w.jsx)("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"4px"},children:(0,w.jsx)("span",{style:{fontSize:"10px",fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",color:t[e.priority]||"var(--theme-elevation-400)",background:"var(--theme-elevation-100)",borderRadius:"3px",padding:"1px 5px"},children:M[e.type]??e.type})}),(0,w.jsx)("div",{style:{fontWeight:500,fontSize:"12px",marginBottom:"3px"},children:e.suggestion}),(0,w.jsx)("div",{style:{color:"var(--theme-elevation-500)",fontSize:"11px"},children:e.reason})]},r))})}function P(e){return e.tagId??`new:${e.tagName}`}function D({data:e,onAccept:t,onAcceptNew:r}){let[n,i]=(0,k.useState)(()=>new Set),[a,o]=(0,k.useState)(()=>new Set);if(!e||0===e.length)return(0,w.jsx)("div",{children:"No content tags suggested"});let l=e.filter(e=>!e.isNew),s=e.filter(e=>e.isNew),c=async e=>{let l=P(e);if(n.has(l)||a.has(l))return;if(e.tagId){i(e=>new Set(e).add(l)),t?.(e.tagId);return}if(!r)return;o(e=>new Set(e).add(l));let s=await r(e.tagName);o(e=>{let t=new Set(e);return t.delete(l),t}),s&&i(e=>new Set(e).add(l))},d=e=>{let t=P(e),r=n.has(t),i=a.has(t),o=!r&&!i;return(0,w.jsxs)("button",{type:"button",onClick:()=>c(e),disabled:!o,title:r?"Added":i?"Creating tag…":`${Math.round(100*e.confidence)}% confidence — click to add`,style:{display:"inline-flex",alignItems:"center",gap:"4px",borderRadius:"12px",padding:"3px 9px",fontSize:"11px",cursor:o?"pointer":"default",opacity:i?.6:1,transition:"background 0.15s, color 0.15s, opacity 0.15s",background:r?"var(--theme-text)":"var(--theme-elevation-100)",color:r?"var(--theme-bg)":"var(--theme-elevation-700)",border:"none"},children:[e.tagName,r&&(0,w.jsx)("span",{style:{fontSize:"10px"},children:"✓"}),i&&(0,w.jsx)("span",{style:{fontSize:"10px"},children:"…"})]},t)};return(0,w.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[l.length>0&&(0,w.jsxs)("div",{children:[(0,w.jsx)("div",{style:{fontSize:"10px",fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--theme-elevation-400)",marginBottom:"5px"},children:"Existing"}),(0,w.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"5px"},children:l.map(e=>d(e))})]}),s.length>0&&(0,w.jsxs)("div",{children:[(0,w.jsx)("div",{style:{fontSize:"10px",fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--theme-elevation-400)",marginBottom:"5px"},children:"New"}),(0,w.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"5px"},children:s.map(e=>d(e))})]})]})}function O({data:e}){return e&&0!==e.length?(0,w.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:e.map(e=>(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,w.jsx)("a",{href:`/payload/admin/collections/${e.collection}/${e.id}`,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none"},onMouseEnter:e=>e.currentTarget.style.textDecoration="underline",onMouseLeave:e=>e.currentTarget.style.textDecoration="none",children:e.title}),(0,w.jsxs)("span",{style:{color:"var(--theme-elevation-500)",fontSize:"11px",whiteSpace:"nowrap",marginLeft:"8px"},children:[Math.round(100*e.relevanceScore),"%"]})]},e.id))}):(0,w.jsx)("div",{children:"No related articles found"})}let F=["articles","videos","liveblogs"],B="channelOverrides.channelHeadlines";function $(e){if(!e||"object"!=typeof e)return;let t=e.category;if(!t||"object"!=typeof t)return;let r=t.value;if(!r||"object"!=typeof r)return;let n=r.name;return"string"==typeof n?n:void 0}let U={seoFields:"SEO Fields",channelHeadlines:"Headlines",seoRecommendations:"SEO Tips",contentTags:"Tags",relatedArticles:"Related"},z=()=>{let{id:e,collectionSlug:o,data:l}=(0,n.useDocumentInfo)(),s=(0,n.useLocale)(),d=(0,r.useMemo)(()=>$(l),[l]),u=F.includes(o)?o:null,{setValue:f}=(0,n.useField)({path:"seo.title"}),{setValue:p}=(0,n.useField)({path:"seo.description"}),{setValue:w,value:k}=(0,n.useField)({path:"seo.keywords"}),{setValue:C,value:_}=(0,n.useField)({path:"tags"}),{addFieldRow:j,replaceFieldRow:N,getDataByPath:T}=(0,n.useForm)(),[A,R]=(0,r.useState)(!1),[M,I]=(0,r.useState)(null),[L,P]=(0,r.useState)(!0),[D,O]=(0,r.useState)(!1),{selectedSteps:z,toggleStep:H,isAnalyzing:W,results:V,error:q,analyze:G,submitFeedback:K,feedbackState:Y,dismissedSuggestions:J,dismissSuggestion:Z,createTag:X}=h({documentId:e,collection:u||"articles",locale:"string"==typeof s?s:s?.code}),Q=(0,r.useMemo)(()=>c.filter(e=>{if(!V)return!1;let t=V[e];if(void 0===t)return!1;if("seoFields"===e){let e=t.data;if(!e)return!1;let r=!!e.title&&!J.has("seo-title"),n=!!e.description&&!J.has("seo-description"),i=E(e.keywords??[],d).length>0,a=(e.contentKeywords?.length??0)>0;return r||n||i||a}return!0}),[V,J,d]),ee=(0,r.useRef)(!1);(0,r.useEffect)(()=>{V&&(ee.current=!1)},[V]),(0,r.useEffect)(()=>{V&&Q.length>0&&!ee.current&&(ee.current=!0,I(Q[0]??null),P(!0))},[V,Q]);let et=(0,r.useRef)(void 0);(0,r.useEffect)(()=>()=>clearTimeout(et.current),[]);let er=(0,r.useCallback)(e=>{e!==M&&(clearTimeout(et.current),P(!1),O(!1),et.current=setTimeout(()=>{I(e),P(!0)},120))},[M]);(0,r.useEffect)(()=>{if("seoFields"!==M||!V?.seoFields?.success||!V.seoFields.data)return;let e=V.seoFields.data;if(!(e.title||e.description))return;let t=!e.title||J.has("seo-title"),r=!e.description||J.has("seo-description");if(t&&r){let e=Q.indexOf("seoFields");e>=0&&e{if("string"==typeof t){if("seo.title"===e)f(t),n.toast.success("SEO title populated — save to apply");else if("seo.description"===e)p(t),n.toast.success("SEO description populated — save to apply");else if("seo.keywords"===e){let e=Array.isArray(k)?k:[];e.some(e=>e.keyword===t)||(w([...e,{keyword:t}]),n.toast.success("Keyword added — save to apply"))}}},[f,p,w,k]),ei=(0,r.useCallback)((e,t)=>{let r=T(B)??[],i=(0,x.findUnscopedRowIndex)(r,e),a={channel:{value:e,initialValue:e,valid:!0},page:{value:"",initialValue:"",valid:!0},headline:{value:t,initialValue:t,valid:!0}};i>=0?N({path:B,schemaPath:B,rowIndex:i,subFieldState:a}):j({path:B,schemaPath:B,subFieldState:a}),n.toast.success("Headline applied — save to apply")},[j,N,T]),ea=(0,r.useCallback)(e=>{let t=Array.isArray(_)?_:[],r=t.some(t=>t===e||t?.id===e);return r||C([...t,e]),!r},[C,_]),eo=(0,r.useCallback)(e=>{ea(e)&&n.toast.success("Tag added — save to apply")},[ea]),el=(0,r.useCallback)(async e=>{let t=await X(e);return t?(ea(t.id),n.toast.success("Tag created and added — save to apply"),!0):(n.toast.error("Failed to create tag",{description:e}),!1)},[X,ea]),es=(0,r.useCallback)(async()=>{I(null);let e=n.toast.loading("Analyzing content...");await G(),n.toast.dismiss(e)},[G]),{openModal:ec,isModalOpen:ed,closeModal:eu}=(0,n.useModal)(),eh=(0,r.useCallback)(async e=>{if(!M)return;let{success:t,error:r}=await K(M,"bad",e);if(!t)throw Error(r??"Failed to submit issue feedback")},[M,K]),{onSubmit:ef,loading:ep}=(0,v.useSubmitIssue)(eh),em=(0,r.useCallback)(async()=>{if(!M)return;let e=U[M],{success:r,error:i}=await K(M,"good");r?n.toast.message(e,{icon:(0,t.jsx)(a.ThumbsUp,{}),description:"Thanks for the feedback."}):n.toast.error("Failed to submit feedback",{description:i})},[M,K]),eg=(0,r.useCallback)(async()=>{if(!M)return;let e=U[M],{success:r,error:a}=await K(M,"bad");r?n.toast.message(e,{icon:(0,t.jsx)(i.ThumbsDown,{}),description:(0,t.jsxs)("div",{children:["Thanks for the feedback.",(0,t.jsx)(n.Button,{size:"xsmall",buttonStyle:"none",className:"m-0 ml-2 underline",onClick:()=>{ec(y.FEEDBACK_FORM_DIALOG_SLUG)},children:"Report Issue"})]})}):n.toast.error("Failed to submit feedback",{description:a})},[M,K,ec]);if(!e||!u)return null;let eb=M?Q.indexOf(M):-1,ey=eb>0,ev=ebR(e=>!e),className:"flex cursor-pointer items-center gap-1 border-none bg-transparent px-0 py-0.5 text-[11px]",style:{color:"var(--theme-elevation-500)"},children:[(0,t.jsx)("span",{className:`inline-block leading-none transition-transform duration-150 ease-in-out ${A?"rotate-180":"rotate-0"}`,children:"▾"}),"Configs"]}),A&&(0,t.jsx)("div",{className:"mt-1.5 flex flex-col gap-2 rounded p-2 text-[11px]",style:{background:"var(--theme-elevation-50)"},children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.map(e=>(0,t.jsx)(m,{step:e,checked:z.includes(e),onChange:H,disabled:W},e))})})]}),(0,t.jsx)(n.Button,{type:"button",buttonStyle:"primary",size:"small",onClick:es,disabled:W||0===z.length,children:W?"Analyzing...":"Analyze Content"})]}),q&&(0,t.jsx)("div",{className:"mt-2 rounded px-2 py-1.5 text-xs",style:{color:"var(--theme-error-500)",background:"var(--theme-error-50)"},children:q}),(0,t.jsx)(b.FeedbackFormDialog,{open:ed(y.FEEDBACK_FORM_DIALOG_SLUG),onClose:()=>eu(y.FEEDBACK_FORM_DIALOG_SLUG),loading:ep,onSubmit:async e=>{let{success:t,error:r}=await ef(e);t?(n.toast.success("Issue reported successfully"),eu(y.FEEDBACK_FORM_DIALOG_SLUG)):n.toast.error("Failed to report issue",{description:r})}}),V&&Q.length>0&&(0,t.jsxs)("div",{className:"mt-3.5",children:[(0,t.jsx)("div",{className:"flex",style:{borderBottom:"1px solid var(--theme-elevation-150)"},children:Q.map(e=>{let r=V[e],n=M===e,i=r&&!r.success;return(0,t.jsx)("button",{type:"button",onClick:()=>er(e),style:{padding:"6px 10px",fontSize:"11px",fontWeight:n?600:400,border:"none",borderBottom:n?"2px solid var(--theme-text)":"2px solid transparent",background:"none",cursor:"pointer",color:i?"var(--theme-error-500)":n?"var(--theme-text)":"var(--theme-elevation-500)",whiteSpace:"nowrap",transition:"color 0.15s",marginBottom:"-1px"},children:U[e]},e)})}),(0,t.jsx)("div",{className:`min-h-[40px] pt-2.5 transition-all duration-150 ease-in-out ${L?"translate-x-0 opacity-100":"translate-x-2 opacity-0"}`,children:M&&ex&&(0,t.jsx)(S,{step:M,result:ex,feedback:Y[M],onFeedback:K,onAcceptField:en,onAcceptChannelHeadline:ei,onAcceptContentTag:eo,onAcceptNewTag:el,dismissedSuggestions:J,onDismiss:Z,existingKeywords:Array.isArray(k)?k.map(e=>e.keyword):[],categoryName:d})}),(0,t.jsxs)("div",{className:"mt-4 flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>ey&&er(Q[eb-1]),disabled:!ey,style:{fontSize:"11px",padding:"2px 8px",border:"1px solid var(--theme-elevation-200)",borderRadius:"3px",background:"none",cursor:ey?"pointer":"default",opacity:ey?1:.3,color:"var(--theme-elevation-600)"},children:"← Prev"}),(0,t.jsx)("button",{type:"button",onClick:()=>ev&&er(Q[eb+1]),disabled:!ev,style:{fontSize:"11px",padding:"2px 8px",border:"1px solid var(--theme-elevation-200)",borderRadius:"3px",background:"none",cursor:ev?"pointer":"default",opacity:ev?1:.3,color:"var(--theme-elevation-600)"},children:"Next →"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[M&&(0,t.jsx)(g.FeedbackToolbar,{feedback:Y[M],isMoreOpen:D,onToggleMore:O,onClickGood:em,onClickBad:eg}),(0,t.jsxs)("div",{className:"text-[11px]",style:{color:"var(--theme-elevation-400)"},children:[eb+1," / ",Q.length," ·"," ",(V.totalDurationMs/1e3).toFixed(1),"s"]})]})]})]})]})};e.s(["AnalyzeContentPanel",0,z],119058)},549116,e=>{"use strict";let t={"&":" and ","@":" at ","%":" percent ",$:" dollar ","€":" euro ","£":" pound ","¥":" yen ","#":" number ","+":" plus ","=":" equals ","°":" degrees ","–":"-","—":"-","‒":"-","―":"-","−":"-"},r=RegExp(Object.keys(t).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"g"),n="untitled-",i=8,a=80,o=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function l(e){let t=5381;for(let r=0;r>>0).toString(36).padStart(i,"0").slice(0,i)}function s(e){let t=(e??"").trim();return t?`${n}${l(t)}`:`${n}untitled`}let c=e=>{if(!e)return"";if(e.lengtht[e]??e);if((n=(n=n.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu,"")).replace(/\//g,"-").replace(/\s+/g,"-").replace(/[^a-z0-9-]+/g,"").replace(/-+/g,"-").replace(/^-+|-+$/g,"")).length>a){let e=n.slice(0,a),t=e.lastIndexOf("-");n=t>a/2?e.slice(0,t):e}return n},d=e=>{let t=c(e);return t||s(e??"")};e.s(["MAX_SLUG_LENGTH",0,a,"SLUG_PATTERN",0,o,"formatSlugWithFallback",0,d])},349882,e=>{"use strict";function t(e){if("string"==typeof e)return e;if(Array.isArray(e))return e.map(e=>t(e)).join(" ");if("object"==typeof e&&null!==e){let r=e;if(r.body&&"object"==typeof r.body&&null!==r.body){let e=r.body;if(e.root)return t(e.root)}if("text"===r.type&&r.text||r.text)return String(r.text);if(r.children&&Array.isArray(r.children))return r.children.map(e=>t(e)).join(" ");if(r.content&&Array.isArray(r.content))return r.content.map(e=>t(e)).join(" ");let n=[];for(let[e,i]of Object.entries(r))if("string"==typeof i)n.push(i);else if(Array.isArray(i)){let e=t(i);e&&n.push(e)}else if("object"==typeof i&&null!==i){let e=t(i);e&&n.push(e)}return n.join(" ")}return""}function r(e){if(!e||"object"!=typeof e)return"";let t=e;return"text"===t.type&&"string"==typeof t.text?t.text:Array.isArray(t.children)?t.children.map(e=>r(e)).join(" "):t.root&&"object"==typeof t.root?r(t.root):""}function n(e){return e&&"string"==typeof e?e.trim().split(/\s+/).filter(e=>e.length>0).length:0}e.s(["countWords",0,n,"extractTextFromJson",0,t,"extractTextFromLexical",0,r])},745259,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(509388),a=r;function o(e,t,{signal:r,edges:n}={}){let i,a=null,l=null!=n&&n.includes("leading"),s=null==n||n.includes("trailing"),c=()=>{null!==a&&(e.apply(i,a),i=void 0,a=null)},d=()=>{s&&c(),p()},u=null,h=()=>{null!=u&&clearTimeout(u),u=setTimeout(()=>{u=null,d()},t)},f=()=>{null!==u&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},g=function(...e){if(r?.aborted)return;i=this,a=e;let t=null==u;h(),l&&t&&c()};return g.schedule=h,g.cancel=p,g.flush=m,r?.addEventListener("abort",p,{once:!0}),g}function l(e,t){let[r,n]=(0,a.useState)(e);return(0,a.useEffect)(()=>{let r=o(e=>{n(e)},t);return r(e),()=>{r.cancel()}},[e,t]),r}var s=e.i(549116);let c=(e,t)=>{let r=t?.protocols??["http","https"];if(!e||"string"!=typeof e)return!1;try{let t=new URL(e),n=t.protocol.slice(0,-1);if(!r.includes(n)||!t.hostname||!/^[a-zA-Z0-9.-]+$/.test(t.hostname)||!e.includes("://"))return!1;return!0}catch{return!1}};var d=e.i(349882);let u={rules:{titlePresence:{lens:"seo",weight:1},metaTitlePresence:{lens:"seo",weight:1},metaTitleLength:{lens:"seo",weight:1,band:{idealMin:55,idealMax:75,hardMin:40,hardMax:90,floorScore:.1}},metaDescriptionPresence:{lens:"seo",weight:1},metaDescriptionLength:{lens:"seo",weight:1,band:{idealMin:110,idealMax:160,hardMin:60,hardMax:210,floorScore:.1}},canonicalValidity:{lens:"seo",weight:1},slugQuality:{lens:"seo",weight:1},featuredImagePresence:{lens:"seo",weight:1},keywordInTitle:{lens:"aeo",weight:1},keywordInDescription:{lens:"aeo",weight:1},bodyWordCount:{lens:"aeo",weight:1,band:{idealMin:230,idealMax:1/0,hardMin:50,hardMax:1/0,floorScore:.1}},headingStructure:{lens:"aeo",weight:1},imageAltText:{lens:"aeo",weight:1},schemaDatePublished:{lens:"aeo",weight:1},schemaArticleSection:{lens:"aeo",weight:1},schemaWordCount:{lens:"aeo",weight:1},llmAnswerQuality:{lens:"aeo",weight:.25},llmCitability:{lens:"geo",weight:.25},llmSemanticCoverage:{lens:"aeo",weight:.25}}},h=["seo","aeo","geo"];function f(e,t){let{idealMin:r,idealMax:n,hardMin:i,hardMax:a,floorScore:o}=t;return e>=r&&e=a?o:o+(a-e)/(a-n)*(1-o):1}function p(e){return Math.round(100*e)/100}function m(...e){for(let t of e)if("string"==typeof t&&t.trim().length>0)return t.trim();return""}function g(e,t){if(!e||"object"!=typeof e)return;let r=e;if("heading"===r.type&&"string"==typeof r.tag&&t.push(r.tag),Array.isArray(r.children))for(let e of r.children)g(e,t);r.root&&"object"==typeof r.root&&g(r.root,t)}function b(e){let t=e.seo?.keywords;return Array.isArray(t)?t.map(e=>e?.keyword).filter(e=>"string"==typeof e&&e.trim().length>0).map(e=>e.trim().toLowerCase()):[]}let y="(?{try{let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return RegExp(`${y}${t}${v}`,"u").test(r)}catch{return r.includes(e)}})}function w(e){let t=e.seo?.schema?.wordCount;if("number"==typeof t&&t>0)return t;let r=e.content?.body;return r?(0,d.countWords)((0,d.extractTextFromLexical)(r)):0}function k(e){let t=e.featuredImage;if(!t||"images"!==t.relationTo)return null;let r=t.value;return r&&"object"==typeof r?r:null}let S=[{id:"titlePresence",evaluate:e=>{let t=m(e.title);return{score:+!!t,detail:t?"title present":"title missing"}}},{id:"metaTitlePresence",evaluate:e=>{let t=m(e.seo?.title);return{score:+!!t,detail:t?"meta title present":"meta title missing"}}},{id:"metaTitleLength",evaluate:(e,t)=>{let r=m(e.seo?.title);if(!r||!t.band)return{score:0,detail:"meta title missing"};let{length:n}=r;return{score:f(n,t.band),detail:`meta title ${n} chars (ideal ${t.band.idealMin}-${t.band.idealMax})`}}},{id:"metaDescriptionPresence",evaluate:e=>{let t=m(e.seo?.description);return{score:+!!t,detail:t?"meta description present":"meta description missing"}}},{id:"metaDescriptionLength",evaluate:(e,t)=>{let r=m(e.seo?.description);if(!r||!t.band)return{score:0,detail:"meta description missing"};let{length:n}=r;return{score:f(n,t.band),detail:`meta description ${n} chars (ideal ${t.band.idealMin}-${t.band.idealMax})`}}},{id:"canonicalValidity",evaluate:e=>{let t=m(e.seo?.canonicalUrl);if(!t)return{score:null,detail:"no canonical URL set"};let r=c(t);return{score:+!!r,detail:r?"canonical URL valid":"canonical URL invalid"}}},{id:"slugQuality",evaluate:e=>{let t=m(e.slug);if(!t)return{score:0,detail:"slug missing"};let r=t.length ${s.MAX_SLUG_LENGTH} chars`}}},{id:"featuredImagePresence",evaluate:e=>{let t=e.featuredImage,r=!!(t&&t.value&&("string"==typeof t.value||"object"==typeof t.value));return{score:+!!r,detail:r?"featured image present":"featured image missing"}}},{id:"keywordInTitle",evaluate:e=>{let t=b(e);if(0===t.length)return{score:0,detail:"no keywords configured"};let r=x(`${m(e.title)} ${m(e.seo?.title)}`,t);return{score:+!!r,detail:r?"keyword present in title":"no keyword in title"}}},{id:"keywordInDescription",evaluate:e=>{let t=b(e);if(0===t.length)return{score:0,detail:"no keywords configured"};let r=x(m(e.seo?.description),t);return{score:+!!r,detail:r?"keyword present in description":"no keyword in description"}}},{id:"bodyWordCount",evaluate:(e,t)=>{let r=w(e);return 0===r?{score:0,detail:"no body content"}:t.band?{score:f(r,t.band),detail:`${r} words (ideal >= ${t.band.idealMin})`}:{score:1,detail:`${r} words`}}},{id:"headingStructure",evaluate:e=>{let t=[];g(e.content?.body,t);let r=t.some(e=>"h1"!==e.toLowerCase());return{score:+!!r,detail:r?"has non-H1 heading":"no non-H1 heading"}}},{id:"imageAltText",evaluate:e=>{let t=k(e);if(!t)return{score:null,detail:"featured image not populated (alt text unreadable)"};let r=m(t.seo?.altText);return{score:+!!r,detail:r?"alt text present":"alt text missing"}}},{id:"schemaDatePublished",evaluate:e=>{let t=m(e.seo?.schema?.datePublished);return{score:+!!t,detail:t?"schema datePublished set":"schema datePublished missing"}}},{id:"schemaArticleSection",evaluate:e=>{let t=m(e.seo?.schema?.articleSection);return{score:+!!t,detail:t?"schema articleSection set":"schema articleSection missing"}}},{id:"schemaWordCount",evaluate:e=>{let t=e.seo?.schema?.wordCount,r="number"==typeof t&&t>0;return{score:+!!r,detail:r?"schema wordCount set":"schema wordCount missing"}}}];function C(e,t,r){let n=[];for(let i of t){let t=r.rules[i.id];if(!t)continue;let{score:a,detail:o}=i.evaluate(e,t);n.push({id:i.id,lens:t.lens,score:null===a?null:p(a),weight:t.weight,detail:o})}return n}function _(e){let t=0,r=0;for(let n of e)null!==n.score&&(t+=n.score*n.weight,r+=n.weight);return 0===r?0:Math.round(t/r*100)}function j(){return{composite:0,lenses:h.map(e=>({lens:e,score:0,applicableRules:0})),rules:[]}}function N(e){if(!e||"object"!=typeof e)return j();let t=C(e,S,u),r=h.map(e=>{let r=t.filter(t=>t.lens===e);return{lens:e,score:_(r),applicableRules:r.filter(e=>null!==e.score).length}});return{composite:_(t),lenses:r,rules:t}}function T(e,t){if(0===t.length)return e;let r=new Set(t.map(e=>e.id)),n=[...e.rules.filter(e=>!r.has(e.id)),...t],i=h.map(e=>{let t=n.filter(t=>t.lens===e);return{lens:e,score:_(t),applicableRules:t.filter(e=>null!==e.score).length}});return{composite:_(n),lenses:i,rules:n}}var E=t,A=r;let R={titlePresence:"Add a headline — every article needs a title.",metaTitlePresence:"Add an SEO meta title in the SEO tab.",metaTitleLength:"Adjust the meta title to 55–75 characters.",metaDescriptionPresence:"Add an SEO meta description in the SEO tab.",metaDescriptionLength:"Adjust the meta description to 110–160 characters.",canonicalValidity:"Fix the canonical URL — it must be a valid absolute URL.",slugQuality:"Use a URL-safe slug: lowercase letters, numbers, and single hyphens, ≤ 80 chars.",featuredImagePresence:"Set a featured image for SERP thumbnails and cards.",keywordInTitle:"Include a target keyword in the title or meta title.",keywordInDescription:"Include a target keyword in the meta description.",bodyWordCount:"Expand the body to at least 230 words.",headingStructure:"Add at least one subheading (H2 or lower) to the body.",imageAltText:"Add alt text to the featured image (edit the Image record).",schemaDatePublished:"Set the schema datePublished in the SEO tab.",schemaArticleSection:"Set the schema articleSection in the SEO tab.",schemaWordCount:"Schema word count is auto-calculated on save — save to populate it."},M="Review this field to improve the score.";function I(e){return R[e]??M}let L="AI dimensions reflect the last save.";function P(e,t){let r=t.seo?.visibilityScore?.breakdown,n=Array.isArray(r?.rules)?r.rules:[],i=new Set(e.rules.map(e=>e.id)),a=n.filter(e=>!!e&&"string"==typeof e.id&&!i.has(e.id)&&(null===e.score||"number"==typeof e.score));return 0===a.length?{score:e,aiRuleIds:new Set}:{score:T(e,a),aiRuleIds:new Set(a.map(e=>e.id))}}let D={seo:"SEO",aeo:"AEO",geo:"GEO"},O={seo:"#3b82f6",aeo:"#8b5cf6",geo:"#14b8a6"};function F(e){return null!==e.score&&e.score=80?"var(--theme-success-500)":e>=50?"var(--theme-warning-500)":"var(--theme-error-500)"}function $(e){return O[e]??"var(--theme-elevation-600)"}let U=({score:e,showPreSaveNote:t=!1,aiRuleIds:r})=>{let n=(0,A.useMemo)(()=>e.rules.filter(F),[e.rules]),i=(0,A.useMemo)(()=>{let t={};if(!r?.size)return t;for(let n of e.rules)null!==n.score&&r.has(n.id)&&(t[n.lens]=(t[n.lens]??0)+1);return t},[e.rules,r]),a=!!r?.size,o=e=>r?.has(e.id)&&e.detail?e.detail:I(e.id);return(0,E.jsxs)("div",{className:"field-type ui","aria-live":"polite",children:[(0,E.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,E.jsx)("span",{className:"text-2xl leading-none font-semibold",style:{color:B(e.composite)},children:e.composite}),(0,E.jsx)("span",{className:"text-[11px] tracking-wide uppercase",style:{color:"var(--theme-elevation-500)"},children:"/ 100 current"})]}),(0,E.jsx)("div",{className:"mt-2.5 flex flex-col gap-1.5",children:e.lenses.map(e=>(0,E.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,E.jsx)("span",{className:"font-medium",style:{color:$(e.lens)},children:D[e.lens]??e.lens}),(0,E.jsxs)("span",{className:"font-medium",style:{color:B(e.score)},children:[e.score,(0,E.jsxs)("span",{className:"ml-1 text-[10px]",style:{color:"var(--theme-elevation-400)"},children:["(",e.applicableRules," rules",i[e.lens]?` \xb7 ${i[e.lens]} AI`:"",")"]})]})]},e.lens))}),n.length>0?(0,E.jsx)("ul",{"aria-label":"Visibility score improvement suggestions",className:"mt-3 flex list-none flex-col gap-1.5 p-0",children:n.map(e=>(0,E.jsxs)("li",{className:"text-[11px] leading-snug",style:{color:"var(--theme-elevation-600)"},children:[(0,E.jsx)("span",{className:"mr-1.5 inline-block rounded px-1 py-px align-middle text-[9px] font-semibold tracking-wide uppercase",style:{color:$(e.lens),border:`1px solid ${$(e.lens)}`},children:D[e.lens]??e.lens}),o(e)]},e.id))}):(0,E.jsx)("div",{className:"mt-3 text-[11px]",style:{color:"var(--theme-success-600)"},children:"All applicable checks pass."}),a&&(0,E.jsx)("div",{className:"mt-3 text-[10px] leading-snug",style:{color:"var(--theme-elevation-400)"},children:L}),t&&(0,E.jsx)("div",{className:"mt-3 text-[10px] leading-snug",style:{color:"var(--theme-elevation-400)"},children:"Live score; may differ slightly from the saved score until you save (image alt text and word count finalize on save)."})]})},z=500,H=()=>{let{collectionSlug:e}=(0,n.useDocumentInfo)(),[a]=(0,n.useAllFormFields)(),o=(0,r.useMemo)(()=>(0,i.reduceFieldsToValues)(a,!0),[a]),s=l((0,r.useMemo)(()=>JSON.stringify({title:o.title,seo:o.seo,slug:o.slug,featuredImage:o.featuredImage,body:o.content?.body}),[a]),z),c=(0,r.useRef)(o);c.current=o;let{score:d,aiRuleIds:u}=(0,r.useMemo)(()=>P(N(c.current),c.current),[s]);return"articles"!==e?null:(0,t.jsxs)("div",{className:"field-type ui",children:[(0,t.jsx)(n.FieldLabel,{label:"Visibility Score (current — unsaved)"}),(0,t.jsx)(U,{score:d,showPreSaveNote:!0,aiRuleIds:u})]})};e.s(["LiveVisibilityScorePanel",0,H],745259)},553329,e=>{"use strict";async function t(e){try{return{data:await e,error:null}}catch(e){return{data:null,error:e}}}e.s(["tryCatch",0,t])},878367,e=>{"use strict";let t=(0,e.i(695881).createLogger)("payload:debugHeader"),r={none:0,view:1,edit:2,full:3,admin:4};function n(e,n,i){if(!e)return t.debug("[checkPermission] No user - denying access"),!1;let a=e;if(!0===a.isAdmin)return t.debug("[checkPermission] User is admin - granting access"),!0;let o=r[i]||0,l=a.permissions;if(l&&"object"==typeof l&&!Array.isArray(l)&&void 0!==l[n]){let e=(r[l[n]]||0)>=o;return t.debug(`[checkPermission] Permission ${e?"granted":"denied"} via permissions map:`,{resource:n,access:l[n],requiredAccess:i}),e}if(Array.isArray(a.roles)){for(let e of a.roles)if("string"!=typeof e&&Array.isArray(e.permissions)){for(let a of e.permissions)if(a.resource===n&&(r[a.access]||0)>=o)return t.debug("[checkPermission] Permission granted via role:",{role:e.name,resource:n,access:a.access,requiredAccess:i}),!0}}return t.warn("[checkPermission] No matching permission found - denying access:",{userId:e.id,username:a.username,resource:n,requiredAccess:i}),!1}e.s(["checkPermission",0,n])},306635,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(553329),a=e.i(878367);let o=["articles","videos","liveblogs"];function l(e){return"string"==typeof e&&o.some(t=>t===e)}let s=e=>new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}),c=()=>{let{user:e}=(0,n.useAuth)(),{id:o,collectionSlug:c,unpublishedVersionCount:d,hasPublishedDoc:u}=(0,n.useDocumentInfo)(),h=(0,n.useFormModified)()||d>0&&u,[f,p]=(0,r.useState)(null),[m,g]=(0,r.useState)(!0),[b,y]=(0,r.useState)(!1),[v,x]=(0,r.useState)(!1),w=l(c)&&(0,a.checkPermission)(e??null,c,"edit");(0,r.useEffect)(()=>{if(!o||!w){g(!1),y(!1);return}g(!0),y(!1);let e=!1;return(async()=>{let{data:t,error:r}=await (0,i.tryCatch)(fetch(`/api/payload/v1/google-index/status?documentId=${encodeURIComponent(String(o))}&collection=${encodeURIComponent(String(c))}`,{credentials:"include"}));if(!e&&!r&&t){let{data:e}=await (0,i.tryCatch)(t.json());e?.success&&(y(!!e.submittable),p(e.lastSubmittedAt??null))}e||g(!1)})(),()=>{e=!0}},[o,c,w]);let k=(0,r.useCallback)(async()=>{if(h)return;x(!0);let{data:e,error:t}=await (0,i.tryCatch)(fetch("/api/payload/v1/google-index/submit",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:o,collection:c})}));if(!t&&e){let{data:t}=await (0,i.tryCatch)(e.json());t?.success?(p(t.submittedAt??new Date().toISOString()),n.toast.success("Submitted to Google Index.")):n.toast.error(t?.error??"Submission to Google failed. Please try again, or contact an administrator if it keeps happening.",{duration:1/0,closeButton:!0})}else n.toast.error("Could not reach the server to submit. Please try again.",{duration:1/0,closeButton:!0});x(!1)},[o,c,h]);if(!o||!w||m||!b)return null;let S=!!f;return(0,t.jsxs)("div",{className:"my-4 rounded-md border border-gray-200 bg-gray-50 p-3 text-sm dark:border-gray-700 dark:bg-gray-800/40",children:[(0,t.jsx)("p",{className:"m-0 mb-2 font-medium",children:"Submit to Google Index"}),(0,t.jsx)("p",{className:"m-0 mb-3 text-gray-700 dark:text-gray-300",children:"Push this page to Google's Indexing API for faster crawl of time-sensitive breaking-news and live coverage. Supplemental to sitemaps — use for genuinely urgent updates, not routine posts."}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(n.Button,{buttonStyle:"primary",size:"small",type:"button",onClick:k,disabled:v||h,children:v?"Submitting…":S?"Re-submit":"Submit to Google Index"}),(0,t.jsx)("span",{"aria-live":"polite",className:"text-gray-600 dark:text-gray-300",children:f?`Last submitted: ${s(f)}`:"Not yet submitted"})]}),h&&(0,t.jsxs)("p",{role:"alert",className:"m-0 mt-3 rounded border border-[color:var(--theme-error-500,#b00020)] bg-[var(--theme-error-50,#fdecea)] px-2.5 py-2 text-xs leading-[1.4] text-[color:var(--theme-error-700,#7a0014)]",children:[(0,t.jsx)("strong",{children:"Unsaved or unpublished changes."})," Save and re-publish before submitting to Google Index, so the URL sent to Google matches the live page."]})]})};e.s(["SubmitToGoogleIndexButton",0,c],306635)},171301,e=>{"use strict";var t=e.i(699173),r=e.i(541686);let n=({path:e,field:n,maxCharacters:i})=>{let{label:a,required:o,localized:l}=n,{value:s}=(0,r.useField)({path:e||n.name}),c=("string"==typeof s?s:"").length,d="number"==typeof i&&c>i;return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,t.jsx)(r.FieldLabel,{required:o,path:e||n.name,label:a,localized:l}),(0,t.jsx)("div",{className:"flex items-center gap-2 text-[0.8125rem] text-zinc-500","aria-live":"polite","aria-atomic":"true",children:(0,t.jsx)("span",{className:d?"font-medium text-red-600":void 0,children:null!=i?`${c}/${i} characters`:`${c} characters`})})]})};e.s(["CharacterCountLabel",0,n])},989673,195241,e=>{"use strict";var t=e.i(514514);let r=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],n=(0,t.default)("wand-sparkles",r);e.s(["Wand2",0,n],989673);let i=(0,e.i(695881).createLogger)("AiSlashCommand");async function a(e,t,r,n,i){let a=await fetch("/api/payload/v1/ai/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:e}],personaId:"editor",docId:t,docCollection:r}),signal:i});if(!a.ok)throw Error(`AI request failed: ${a.status}`);let o=a.body;if(!o)throw Error("AI response body is not readable");let l=o.getReader(),s=new TextDecoder,c="";for(;;){let{done:e,value:t}=await l.read();if(e)break;let r=(c+=s.decode(t,{stream:!0})).split("\n");for(let e of(c=r.pop()??"",r)){if(!e.startsWith("data: "))continue;let t=e.slice(6).trim();if(!(!t||t.startsWith("x-msg-id:")))try{let e=JSON.parse(t);"text-delta"===e.type&&"string"==typeof e.delta&&n(e.delta)}catch{}}}}async function o(e){await fetch("/api/payload/v1/ai/apply-trace",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(e=>{i.warn("emitApplyTrace failed",{err:e})})}e.s(["emitApplyTrace",0,o,"streamAiSuggestion",0,a],195241)},700267,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(989673),a=e.i(195241);let o="Do not look up any documents. Do not ask questions. Do not add explanation or context. Output only the rewritten text, nothing else.\n\n",l="Write the output in sentence case: capitalize only the first word and the first word after a colon or em-dash, capitalize proper nouns (place names, storm names, brand names) and acronyms (e.g. NWS, NOAA), and lowercase every other word.\n\n",s=e=>"number"==typeof e,c=e=>s(e)?` Keep the result within ${e} characters.`:"",d={improve:e=>`Rewrite the following text to be higher quality.${s(e)?c(e):" Match the length and format of the input exactly — if the input is a short phrase or headline, output a short phrase or headline of the same approximate length."}`,shorten:e=>`Write a shorter version of the following text, keeping only the essential information.${c(e)}`,expand:e=>`Write a more detailed version of the following text.${s(e)?` Do not exceed ${e} characters — this is a hard limit.`:""}`};function u(e,t,r,n){let i=r?l:"";return`${o}${i}${d[e](n)} ${t}`}let h={improve:"Improve",shorten:"Shorten",expand:"Expand"},f=({path:e,field:o,actions:l,maxCharacters:s,sentenceCase:c})=>{let{label:d,required:f,localized:p}=o,{value:m,setValue:g}=(0,n.useField)({path:e||o.name}),b="string"==typeof m?m.length:0,y="string"==typeof m?m.trim().length:0,v="number"==typeof s&&b>s,{id:x,collectionSlug:w}=(0,n.useDocumentInfo)(),k=null!=x?String(x):void 0,S=w,[C,_]=(0,r.useState)(""),[j,N]=(0,r.useState)(!1),[T,E]=(0,r.useState)(!1),[A,R]=(0,r.useState)(null),M=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{M.current?.abort()},[]);let I=(0,r.useCallback)(async e=>{let t="string"==typeof m?m:"";if(!t.trim())return;M.current?.abort();let r=new AbortController;M.current=r,E(!0),_(""),N(!0),R(null);let n=u(e,t,c,s);try{await (0,a.streamAiSuggestion)(n,k,S,e=>{_(t=>t+e)},r.signal)}catch(e){"AbortError"!==e.name&&R("AI generation failed. Please try again.")}finally{N(!1)}},[m,k,S,c,s]),L=(0,r.useCallback)(()=>{g(C.trim()),E(!1),_("")},[C,g]),P=(0,r.useCallback)(()=>{M.current?.abort(),E(!1),_(""),R(null)},[]);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,t.jsx)(n.FieldLabel,{required:f,path:e||o.name,label:d,localized:p}),(0,t.jsxs)("div",{className:"flex items-center gap-2",style:{flexShrink:0},children:["number"==typeof s&&(0,t.jsxs)("span",{className:`text-[0.8125rem] ${v?"font-medium text-red-600":"text-zinc-500"}`,"aria-live":"polite","aria-atomic":"true",children:[b,"/",s]}),y>0&&(0,t.jsx)(n.Popup,{buttonType:"custom",size:"fit-content",horizontalAlign:"right",button:(0,t.jsx)(n.Button,{type:"button",buttonStyle:"none",className:"m-0","aria-label":"AI actions",icon:(0,t.jsx)(i.Wand2,{className:"h-5 w-5"})}),render:({close:e})=>(0,t.jsx)(n.PopupList.ButtonGroup,{children:l.map(r=>(0,t.jsx)(n.PopupList.Button,{onClick:()=>{e(),I(r)},children:h[r]},r))})})]})]}),T&&(0,t.jsxs)("div",{"aria-live":"polite",style:{marginTop:"6px",padding:"10px 12px",fontSize:"13px"},children:[(0,t.jsx)("div",{style:{whiteSpace:"pre-wrap",lineHeight:1.55,color:A?"var(--theme-error-500)":"var(--theme-text)",minHeight:"32px"},children:A??(C||(j?"Generating…":""))}),!A&&!j&&C&&(0,t.jsxs)("div",{style:{display:"flex",gap:"6px",justifyContent:"flex-end"},children:[(0,t.jsx)(n.Button,{type:"button",buttonStyle:"secondary",size:"small",onClick:P,children:"Discard"}),(0,t.jsx)(n.Button,{type:"button",buttonStyle:"primary",size:"small",onClick:L,children:"Accept"})]})]})]})};e.s(["AiFieldActionLabel",0,f],700267)},482317,e=>{"use strict";var t=e.i(514514);let r=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],n=(0,t.default)("x",r);e.s(["X",0,n],482317)},768891,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(482317);let a="Type keyword, press Enter",o="Add keyword",l="Keywords",s="Press Enter or comma to add. Paste comma-separated values to add multiple at once. Click a keyword to edit it.",c=/[,\n\t]/,d=e=>e.split(c).map(e=>e.trim()).filter(Boolean),u=(e,t,r)=>{let n=t.toLowerCase();return e.some((e,t)=>t!==r&&e.keyword.toLowerCase()===n)},h=({field:e,path:c,schemaPath:h,readOnly:f})=>{let{label:p,required:m,localized:g}=e,b=c??e.name,y=h??b,{addFieldRow:v,removeFieldRow:x,dispatchFields:w}=(0,n.useForm)(),k=(0,n.useFormFields)(([e])=>{let t=[],r=0,n=e[`${b}.${r}.keyword`];for(;n;){let i="string"==typeof n.value?n.value:"",a=e[`${b}.${r}.id`],o="string"==typeof a?.value?a.value:void 0;t.push({keyword:i,id:o}),r++,n=e[`${b}.${r}.keyword`]}return JSON.stringify(t)}),S=(0,r.useMemo)(()=>k?JSON.parse(k):[],[k]),[C,_]=(0,r.useState)(""),[j,N]=(0,r.useState)(null),[T,E]=(0,r.useState)(""),A=(0,r.useCallback)(()=>{N(null),E("")},[]),R=(0,r.useCallback)(e=>{let t=new Set(S.map(({keyword:e})=>e.toLowerCase()));for(let r of e){let e=r.toLowerCase();t.has(e)||(t.add(e),v({path:b,schemaPath:y,subFieldState:{keyword:{value:r,initialValue:r,valid:!0}}}))}},[S,b,y,v]),M=(0,r.useCallback)(e=>{e=S.length||x({path:b,rowIndex:e})},[b,S.length,x]),I=(0,r.useCallback)(e=>{let t=S[e];!f&&t&&(N(e),E(t.keyword))},[f,S]),L=(0,r.useCallback)(()=>{if(null===j||j>=S.length)return;let e=S[j],t=T.trim();t?e&&t!==e.keyword&&!u(S,t,j)&&w({type:"UPDATE",path:`${b}.${j}.keyword`,value:t}):M(j),A()},[j,T,S,M,b,w,A]),P=(0,r.useCallback)(e=>{"Enter"===e.key&&(e.preventDefault(),L()),"Escape"===e.key&&A()},[L,A]),D=(0,r.useCallback)(()=>{R(d(C)),_("")},[C,R]),O=(0,r.useCallback)(e=>{("Enter"===e.key||","===e.key)&&(e.preventDefault(),D()),"Backspace"===e.key&&""===C&&S.length>0&&M(S.length-1)},[D,C,S.length,M]),F=(0,r.useCallback)(e=>{let t=d(e.clipboardData.getData("text"));t.length>=1&&(e.preventDefault(),R(t),_(""))},[R]);return(0,t.jsxs)("div",{className:"field-type array",children:[(0,t.jsx)(n.FieldLabel,{label:p,required:m,path:b,localized:g}),(0,t.jsxs)("div",{role:"list","aria-label":"string"==typeof p?p:l,className:"flex flex-wrap items-center gap-1.5 rounded border border-[var(--theme-elevation-150)] bg-[var(--theme-input-bg)] px-2 py-1.5",children:[S.map(({keyword:e,id:r},n)=>(0,t.jsx)("span",{role:"listitem",className:"inline-flex items-center gap-1 rounded bg-[var(--theme-elevation-100)] px-2 py-0.5 text-[0.8125rem]",children:j===n?(0,t.jsx)("input",{type:"text",value:T,onChange:e=>E(e.target.value),onKeyDown:P,onBlur:L,autoFocus:!0,className:"w-auto border-none bg-transparent p-0 text-[0.8125rem] outline-none",style:{width:`${Math.max(T.length,1)}ch`},"aria-label":"Edit keyword"}):(0,t.jsxs)(t.Fragment,{children:[f?e:(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),I(n)},className:"border-none bg-transparent p-0 text-[0.8125rem] text-inherit","aria-label":`Edit ${e}`,children:e}),!f&&(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),M(n)},className:"ml-0.5 border-none bg-transparent p-0 leading-none text-[var(--theme-elevation-400)] hover:text-[var(--theme-elevation-800)]","aria-label":`Remove ${e}`,children:(0,t.jsx)(i.X,{size:12,"aria-hidden":"true"})})]})},r??e)),!f&&(0,t.jsx)("input",{type:"text",value:C,onChange:e=>_(e.target.value),onKeyDown:O,onBlur:D,onPaste:F,placeholder:0===S.length?a:"",className:"min-w-[120px] flex-1 border-none bg-transparent p-0 text-sm outline-none","aria-label":o})]}),!f&&(0,t.jsx)("p",{className:"mt-1 text-xs text-[var(--theme-elevation-400)]",children:s})]})};e.s(["KeywordsChipInput",0,h])},205144,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(549116);let a=({field:e,fieldToUse:a,checkboxFieldPath:o,path:l,readOnly:s})=>{let{label:c}=e,d=l?.includes(".")?`${l}.${o}`:o,{value:u,setValue:h}=(0,n.useField)({path:l||e.name}),{dispatchFields:f}=(0,n.useForm)(),p=(0,n.useFormFields)(([e])=>e[d]?.value),m=(0,n.useFormFields)(([e])=>e[a]?.value);(0,r.useEffect)(()=>{if(p)if(m){let e=(0,i.formatSlugWithFallback)(m);u!==e&&h(e)}else""!==u&&h("")},[m,p,h,u]);let g=(0,r.useCallback)(e=>{e.preventDefault(),f({type:"UPDATE",path:d,value:!p})},[p,d,f]),b=s||p;return(0,t.jsxs)("div",{className:"field-type slug-field-component",children:[(0,t.jsxs)("div",{className:"label-wrapper",children:[(0,t.jsx)(n.FieldLabel,{htmlFor:`field-${l}`,label:c}),(0,t.jsx)(n.Button,{className:"lock-button",buttonStyle:"none",onClick:g,children:p?"Unlock":"Lock"})]}),(0,t.jsx)(n.TextInput,{value:u,onChange:h,path:l||e.name,readOnly:!!b})]})};e.s(["SlugComponent",0,a])},410991,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);let i=({field:e,fieldToUse:i,checkboxFieldPath:a,path:o,readOnly:l})=>{let{label:s}=e,c=o?.includes(".")?`${o}.${a}`:a,{value:d,setValue:u}=(0,n.useField)({path:o||e.name}),{dispatchFields:h}=(0,n.useForm)(),f=(0,n.useFormFields)(([e])=>e[c]?.value),p=(0,n.useFormFields)(([e])=>e[i]?.value);(0,r.useEffect)(()=>{f&&(p?u(p):""!==d&&u(""))},[p,f,u,d]);let m=(0,r.useCallback)(e=>{e.preventDefault(),h({type:"UPDATE",path:c,value:!f})},[f,c,h]),g=l||f;return(0,t.jsxs)("div",{className:"field-type pubdate-field-component",children:[(0,t.jsxs)("div",{className:"label-wrapper",children:[(0,t.jsx)(n.FieldLabel,{htmlFor:`field-${o}`,label:s}),(0,t.jsx)(n.Button,{className:"lock-button",buttonStyle:"none",onClick:m,children:f?"Unlock":"Lock"})]}),(0,t.jsx)(n.TextInput,{value:d,onChange:u,path:o||e.name,readOnly:!!g})]})};e.s(["PublishDateComponent",0,i])},931533,971761,e=>{"use strict";function t(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{t(n.result)},n.onerror=r,n.readAsDataURL(e)})}var r=e.i(592121);function n(){let[e,n]=(0,r.useState)(!1);return{loading:e,onGenerateAltText:(0,r.useCallback)(async e=>{n(!0);try{let r={};"url"in e?r.imageUrl=e.url:"file"in e&&(r.imageBase64=await t(e.file));let n=await fetch("/api/payload/v1/content/alttext",{method:"POST",body:JSON.stringify(r)});if(!n.ok)throw Error("Failed to generate alt text");let{data:i}=await n.json();if(i?.altText)return{success:!0,altText:i.altText,traceId:i.langfuseTraceId,observationId:i.langfuseObservationId};throw Error("Failed to generate alt text")}catch(e){return{success:!1,error:e instanceof Error?e.message:"Something went wrong"}}finally{n(!1)}},[])}}e.s(["useGenerateAltText",0,n],931533);var i=e.i(699173),a=r,o=e.i(292e3),l=e.i(955653),s=e.i(405757),c=e.i(283584),d=e.i(541686),u=e.i(423693),h=e.i(825259),f=r;function p({traceId:e,observationId:t,altText:r}){let[n,i]=(0,f.useState)(),[a,o]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{i(void 0)},[e]),{feedback:n,loading:a,onSubmit:(0,f.useCallback)(async(n,a)=>{if(!e)return{success:!1,error:"Unable to submit feedback because trace information is missing."};o(!0);try{let o=await fetch("/api/payload/v1/content/alttext/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({traceId:e,observationId:t,score:+("good"===n),altText:r,feedbackType:n,comment:a?.comment})});if(!o.ok){let e=await o.json().catch(()=>null);throw Error(e?.error||"Failed to submit alt text feedback")}return i(n),{success:!0,error:null}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Something went wrong"}}finally{o(!1)}},[r,t,e])}}function m({open:e,onClose:t,onSubmit:r,loading:n}){return(0,i.jsx)(l.FeedbackFormDialog,{open:e,onClose:t,loading:n,onSubmit:async e=>{try{let{success:n,error:i}=await r(e);if(n)d.toast.success("Issue reported successfully"),t();else throw Error(i)}catch(e){d.toast.error("Failed to report issue",{description:e instanceof Error?e.message:"Something went wrong"})}}})}function g({altText:e,onRegenerate:t,onCopy:r,traceId:n,observationId:l}){let[f,b]=(0,a.useState)(!1),{feedback:y,onSubmit:v,loading:x}=p({traceId:n,observationId:l,altText:e}),w=(0,a.useCallback)(async e=>{let t=await v("bad",{comment:e});if(!t.success)throw Error(t.error??"Failed to submit issue feedback")},[v]),{onSubmit:k,loading:S}=(0,c.useSubmitIssue)(w),{openModal:C,isModalOpen:_,closeModal:j}=(0,d.useModal)(),N=()=>{b(!1)},T=[{key:"regenerate",title:"Regenerate",onClick:()=>{t(),N()}},{key:"report-issue",title:"Report Issue",onClick:()=>{N(),C(s.FEEDBACK_FORM_DIALOG_SLUG)}}],E=(0,a.useCallback)(async()=>{if(!n)return void d.toast.message("Alt Text Auto-generate",{description:"Generate alt text before leaving feedback."});let{success:e,error:t}=await v("good");e?d.toast.message("Alt Text Auto-generate",{description:"Thanks for the feedback.",icon:(0,i.jsx)(h.ThumbsUp,{})}):d.toast.error("Failed to submit feedback",{description:t})},[v,n]),A=(0,a.useCallback)(async()=>{if(!n)return void d.toast.message("Alt Text Auto-generate",{description:"Generate alt text before leaving feedback."});let{success:e,error:t}=await v("bad");e?d.toast.message("Alt Text Auto-generate",{icon:(0,i.jsx)(u.ThumbsDown,{}),description:(0,i.jsxs)("div",{children:["Thanks for the feedback.",(0,i.jsx)(d.Button,{size:"xsmall",buttonStyle:"none",className:"m-0 ml-2 underline",onClick:()=>{C(s.FEEDBACK_FORM_DIALOG_SLUG)},children:"Report Issue"})]})}):d.toast.error("Failed to submit feedback",{description:t})},[v,C,n]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.FeedbackToolbar,{isMoreOpen:f,feedback:y,onToggleMore:b,onClickGood:()=>{x||E()},onClickBad:()=>{x||A()},onClickCopy:r,menuOptions:T}),(0,i.jsx)(m,{open:_(s.FEEDBACK_FORM_DIALOG_SLUG),onClose:()=>{j(s.FEEDBACK_FORM_DIALOG_SLUG)},onSubmit:k,loading:S})]})}e.s(["default",0,g],971761)},240148,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(931533),a=e.i(971761),o=e.i(627163);let l=({path:e,field:l})=>{let{label:s,required:c,localized:d}=l,{value:u,setValue:h}=(0,n.useField)({path:e}),[f,p]=(0,r.useState)({}),m=(0,n.useFormFields)(([e])=>{let t=e.file?.value;if(t instanceof File)return{file:t};let r=e.url?.value;return"string"==typeof r&&r.length>0?{url:r}:null}),{onGenerateAltText:g,loading:b}=(0,i.useGenerateAltText)(),y=(0,r.useCallback)(async()=>{let e=n.toast.loading("Generating alt text...");if(m){let e=await g(m);e.success?(h(e.altText),p({traceId:e.traceId,observationId:e.observationId})):n.toast.error("Failed to generate alt text",{description:e.error})}n.toast.dismiss(e)},[m,g,h]);return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,t.jsx)(n.FieldLabel,{required:c,path:e,label:s,localized:d}),m&&(0,t.jsx)("div",{className:"flex h-10 items-center",children:u?(0,t.jsx)(a.default,{altText:u,onRegenerate:y,onCopy:()=>{n.toast.message("Alt Text copied to clipboard",{icon:(0,t.jsx)(o.Copy,{})}),navigator.clipboard.writeText(u)},traceId:f.traceId,observationId:f.observationId}):(0,t.jsx)(n.Button,{buttonStyle:"none",className:"m-0 mb-1 underline",disabled:b,onClick:y,children:"Auto-generate"})})]})};e.s(["AltTextWithAutoGenerateComponent",0,l])},995334,e=>{"use strict";var t=e.i(699173);let r={contentTags:{letter:"C",color:"#1d4ed8",bgColor:"#dbeafe",label:"Content",content:!0},categoryTags:{letter:"K",color:"#be185d",bgColor:"#fce7f3",label:"Category",content:!1},analyticsTag:{letter:"A",color:"#7c3aed",bgColor:"#ede9fe",label:"Analytics",content:!0},region:{letter:"R",color:"#059669",bgColor:"#d1fae5",label:"Region",content:!0},state:{letter:"S",color:"#d97706",bgColor:"#fef3c7",label:"State",content:!0},location:{letter:"L",color:"#0891b2",bgColor:"#cffafe",label:"Location",content:!0},affiliate:{letter:"F",color:"#4d7c0f",bgColor:"#ecfccb",label:"Affiliate",content:!1}};function n(e){let t=Object.entries(r);return e?.contentOnly?t.filter(([,e])=>e.content):t}function i(){return n({contentOnly:!0}).map(([e])=>e)}function a(e){return"string"==typeof e&&e in r}let o={md:{box:"18px",radius:"4px",fontSize:"11px"},sm:{box:"16px",radius:"3px",fontSize:"10px"}};function l({type:e,size:n="md"}){let i=r[e];if(!i)return null;let a=o[n];return(0,t.jsx)("span",{title:i.label,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:a.box,height:a.box,borderRadius:a.radius,fontSize:a.fontSize,fontWeight:700,lineHeight:1,color:i.color,backgroundColor:i.bgColor,flexShrink:0,verticalAlign:"middle"},children:i.letter})}e.s(["TAG_TYPE_CONFIG",0,r,"TagTypeBadge",0,l,"getContentTagTypes",0,i,"getLegendEntries",0,n,"isTagType",0,a])},465191,e=>{"use strict";async function t(e){let t=new URLSearchParams;t.set("where[id][in]",e.join(",")),t.set("limit","100"),t.set("depth","0");let r=await fetch(`/api/payload/tags?${t.toString()}`);if(r.ok){let e=await r.json();return e?.docs??[]}return[]}e.s(["fetchTagsByIds",0,t])},332221,160672,134110,664157,403528,485415,149993,e=>{"use strict";var t=e.i(699173);function r({size:e=16}){return(0,t.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,t.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}e.s(["SearchIcon",0,r],332221);var n=e.i(592121),i=e.i(541686),a=e.i(995334);let o={name:"locationSubtype",label:"Location Subtype",type:"select",required:!0,index:!0,defaultValue:"city",options:[{label:"Country",value:"country"},{label:"Region",value:"region"},{label:"State / Province",value:"state"},{label:"DMA",value:"dma"},{label:"City",value:"city"},{label:"Postal Code",value:"postalCode"},{label:"Point of Interest",value:"poi"},{label:"Custom",value:"custom"}],admin:{condition:e=>e?.type==="location"}},l={};if("options"in o)for(let e of o.options??[])"string"==typeof e?l[e]=e:"string"==typeof e.value&&"string"==typeof e.label&&(l[e.value]=e.label);function s(e){return"string"==typeof e?e:e&&"object"==typeof e&&"id"in e?e.id:""}function c(e,t){let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return RegExp(`\\b${r}\\b`).test(e)}function d(e){let t=e.name||"";if(!t)return"";if(e.dmaCd)return c(t,e.dmaCd)?t:`${t} (${e.dmaCd})`;let r=e.adminDistrictCode||e.countryCode;return r&&!c(t,r)?`${t}, ${r}`:t}function u(e){if("location"===e.type&&e.locationSubtype){let t=l[e.locationSubtype];if(t)return t}return e.type?a.TAG_TYPE_CONFIG[e.type]?.label||e.type:""}function h(e,t,r){if(e.has("all")||0===e.size)return[...r];let n=new Set;for(let r of e){let e=t.find(e=>e.key===r);if(e)for(let t of e.types)n.add(t)}return[...n]}function f(e,t){if(!e.has("all")&&0!==e.size)for(let r of e){let e=t.find(e=>e.key===r);if(e?.locationSubtypes)return[...e.locationSubtypes]}}e.s(["getActiveLocationSubtypes",0,f,"getActiveTypes",0,h,"getTagDisplayName",0,d,"getTagId",0,s,"getTagTypeLabel",0,u],160672);var p=e.i(465191);function m(e){let{value:t,setValue:r}=(0,i.useField)({path:e}),[a,o]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(!t||!Array.isArray(t)||0===t.length)return void o([]);let e=t.filter(e=>"object"==typeof e&&null!==e&&"id"in e&&"type"in e);if(e.length===t.length)return void o(e);let r=t.map(s).filter(Boolean);0!==r.length&&(0,p.fetchTagsByIds)(r).then(e=>o(e),()=>o(e))},[t]);let l=(0,n.useMemo)(()=>t&&Array.isArray(t)?new Set(t.map(s).filter(Boolean)):new Set,[t]),c=(0,n.useCallback)(e=>{l.has(e.id)||(r([...t?t.map(s).filter(Boolean):[],e.id]),o(t=>[...t,e]))},[t,r,l]),d=(0,n.useCallback)(e=>{t&&Array.isArray(t)&&(r(t.map(s).filter(t=>t!==e)),o(t=>t.filter(t=>t.id!==e)))},[t,r]);return{value:t,setValue:r,resolvedTags:a,selectedIds:l,handleAddTag:c,handleRemoveTag:d}}e.s(["useTagSelection",0,m],134110);var g=n;let b={docs:[],totalDocs:0,hasNextPage:!1,nextPage:null};async function y(e,t,r,n,i){let a=new URLSearchParams,o=e.trim();o?(a.set("where[and][0][or][0][name][like]",o),a.set("where[and][0][or][1][dmaCd][like]",o),a.set("where[and][1][type][in]",t.join(",")),n&&a.set("where[and][2][locationSubtype][in]",n.join(","))):n?(a.set("where[and][0][type][in]",t.join(",")),a.set("where[and][1][locationSubtype][in]",n.join(","))):a.set("where[type][in]",t.join(",")),a.set("limit","25"),a.set("depth","0"),a.set("sort","name"),i&&i>1&&a.set("page",String(i));let l=await fetch(`/api/payload/tags?${a.toString()}`,{signal:r});if(l.ok){let e=await l.json();return{docs:e?.docs??[],totalDocs:e?.totalDocs??0,hasNextPage:e?.hasNextPage??!1,nextPage:e?.nextPage??null}}return b}function v({filterOptions:e,allTagTypes:t}){let[r,n]=(0,g.useState)([]),[i,a]=(0,g.useState)(!1),[o,l]=(0,g.useState)(!1),[s,c]=(0,g.useState)(0),[d,u]=(0,g.useState)(null),[p,m]=(0,g.useState)(!1),b=(0,g.useRef)(null),x=(0,g.useRef)(null),w=(0,g.useCallback)(async(r,i)=>{b.current&&b.current.abort();let o=new AbortController;b.current=o;let s=h(i,e,t),d=f(i,e);a(!0),x.current={query:r,filters:i};try{let e=await y(r,s,o.signal,d);n(e.docs),l(e.hasNextPage),c(e.totalDocs),u(e.nextPage)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;n([]),l(!1),c(0),u(null)}finally{b.current===o&&a(!1)}},[e,t]),k=(0,g.useCallback)(async()=>{if(!o||null===d||!x.current)return;let r=new AbortController;b.current=r;let{query:i,filters:a}=x.current,s=h(a,e,t),p=f(a,e);m(!0);try{let e=await y(i,s,r.signal,p,d);n(t=>[...t,...e.docs]),l(e.hasNextPage),c(e.totalDocs),u(e.nextPage)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;l(!1),u(null)}finally{b.current===r&&m(!1)}},[o,d,e,t]);return(0,g.useEffect)(()=>()=>{b.current&&b.current.abort()},[]),{searchResults:r,isSearching:i,doSearch:w,hasNextPage:o,totalDocs:s,loadMore:k,isLoadingMore:p}}e.s(["useTagSearch",0,v],664157);var x=t;function w({options:e,active:t,onToggle:r}){return(0,x.jsx)("div",{style:{display:"flex",gap:"4px",marginBottom:"6px",flexWrap:"wrap"},children:e.map(e=>{let n=t.has(e.key);return(0,x.jsx)("button",{type:"button","aria-pressed":n,onClick:()=>r(e.key),style:{padding:"3px 10px",fontSize:"12px",fontWeight:n?600:400,borderRadius:"4px",border:n?"1px solid var(--theme-elevation-400)":"1px solid var(--theme-elevation-150)",backgroundColor:n?"var(--theme-elevation-200)":"var(--theme-bg)",color:"var(--theme-text)",cursor:"pointer",transition:"all 0.15s ease"},children:e.label},e.key)})})}e.s(["FilterToggleBar",0,w],403528);var k=t,S=t,C=a;function _({tag:e,onSelect:t,className:r,showTypeLabel:n=!1}){return(0,S.jsxs)("button",{type:"button",className:r,onClick:()=>t(e),style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",borderBottom:"1px solid var(--theme-elevation-50)",backgroundColor:"transparent",cursor:"pointer",textAlign:"left",fontSize:"13px",color:"var(--theme-text)",transition:"background-color 0.1s"},children:[e.type&&(0,S.jsx)(C.TagTypeBadge,{type:e.type}),(0,S.jsx)("span",{style:{flex:1},children:d(e)}),n&&e.type&&(0,S.jsx)("span",{style:{fontSize:"11px",color:"var(--theme-elevation-400)"},children:u(e)})]})}function j({isSearching:e,results:t,searchQuery:r,onSelect:n,hoverClassName:i,showTypeLabel:a=!1,hasNextPage:o,remainingCount:l,onLoadMore:s,isLoadingMore:c}){let d=1===t.length?`${t.length} tag shown.`:`${t.length} tags shown.`,u=e?"Searching tags":c?"Loading more tags":t.length>0?`${d}${o&&l?` ${l} remaining.`:""}`:r?"No tags found":"Type to search tags";return(0,k.jsxs)("div",{style:{maxHeight:"240px",overflowY:"auto",border:"1px solid var(--theme-elevation-150)",borderTop:"none",borderRadius:"0 0 4px 4px",backgroundColor:"var(--theme-bg)"},children:[(0,k.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:u}),e&&(0,k.jsx)("div",{style:{padding:"10px 12px",fontSize:"13px",color:"var(--theme-elevation-400)"},children:"Searching..."}),!e&&0===t.length&&(0,k.jsx)("div",{style:{padding:"10px 12px",fontSize:"13px",color:"var(--theme-elevation-400)"},children:r?"No tags found":"Type to search tags"}),!e&&t.map(e=>(0,k.jsx)(_,{tag:e,onSelect:n,className:i,showTypeLabel:a},e.id)),!e&&o&&s&&(0,k.jsx)("button",{type:"button",onClick:s,disabled:c,style:{display:"block",width:"100%",padding:"8px 12px",fontSize:"12px",border:"none",borderTop:"1px solid var(--theme-elevation-100)",backgroundColor:"transparent",cursor:c?"default":"pointer",color:"var(--theme-elevation-500)",textAlign:"center"},children:c?"Loading...":l?`Show more (${l} remaining)`:"Show more"})]})}e.s(["TagSearchResults",0,j],485415);var N=t,T=a;function E({tag:e,onRemove:t}){return(0,N.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"3px 6px 3px 5px",borderRadius:"4px",border:"1px solid var(--theme-elevation-150)",backgroundColor:"var(--theme-elevation-50)",fontSize:"13px",lineHeight:"1.4"},children:[e.type&&(0,N.jsx)(T.TagTypeBadge,{type:e.type}),(0,N.jsx)("a",{href:`/payload/admin/collections/tags/${e.id}`,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--theme-text)",textDecoration:"none"},children:d(e)||e.id}),(0,N.jsx)("button",{type:"button",onClick:()=>t(e.id),style:{marginLeft:"2px",padding:"0 2px",border:"none",background:"none",cursor:"pointer",color:"var(--theme-elevation-400)",fontSize:"16px",lineHeight:1},"aria-label":`Remove ${e.name||e.id}`,children:"×"})]})}e.s(["TagPill",0,E],149993)},367674,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);let i=e=>e?.trim().replace(/ /g,"-").replace(/[^\w-]+/g,"").toLowerCase();var a=r;let o=["analyticsTag","contentTags","location","region","state"];function l(){let[e,t]=(0,a.useState)(!1);return{loading:e,onGenerateTags:(0,a.useCallback)(async e=>{t(!0);try{let t=await fetch("/api/payload/v1/content/generate-tags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,tags:[]})});if(t.status>400)throw Error("Failed to generate tags");let r=await t.json();if(!r.success)throw Error(r.error||"Failed to generate tags");let n=r.data.results.filter(({result:e})=>!0===e),a=Array.from(new Map(n.map(({tag:e,...t})=>[e,{tag:e,...t}])).values()),l=(await Promise.all(a.map(async({tag:e})=>{try{let t=await fetch(`/api/payload/tags?where[name][equals]=${encodeURIComponent(e)}`);if(!t.ok)throw Error("Failed to fetch tag");let r=await t.json(),n=r.docs?.[0];if(n?.id)return n;let a=await fetch("/api/payload/tags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,type:"contentTags",slug:i(e)})});if(!a.ok){let e=await a.text();throw Error(`Failed to create tag: ${a.status} ${e}`)}let o=await a.json();if(!o?.doc?.id)throw Error("Invalid tag creation response: missing doc or id");return o.doc}catch(t){return console.error("Error creating tag",{error:t,tag:e}),null}}))).filter(e=>!!e&&(e.id&&"string"==typeof e.id?!e.type||!!o.includes(e.type)||(console.warn(`Tag ${e.id} (${e.name}) has invalid type: ${e.type}. Expected one of: ${o.join(", ")}`),!1):(console.warn("Tag missing or invalid ID:",e),!1))).map(e=>e.id);return{success:!0,tagIds:l,traceId:r.data.langfuseTraceId,classifications:r.data.results}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Something went wrong"}}finally{t(!1)}},[])}}var s=r;function c(){let[e,t]=(0,s.useState)(!1);return{loading:e,onExtractLocations:(0,s.useCallback)(async e=>{t(!0);try{let t=await fetch("/api/payload/v1/ai/extract-locations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,description:e.description,bodyText:e.bodyText,contentType:e.contentType,existingTagIds:e.existingTagIds,liveblogEntryIds:e.liveblogEntryIds})});if(!t.ok)throw Error("Failed to extract locations");let r=await t.json();if(!r.success)throw Error(r.error||"Failed to extract locations");return{success:!0,newTagIds:r.data.newTagIds,extractedLocations:r.data.extractedLocations,resolvedLocations:r.data.resolvedLocations,traceId:r.data.langfuseTraceId}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Something went wrong"}}finally{t(!1)}},[])}}function d(e){switch(e){case"videos":return"video";case"liveblogs":return"liveblog";default:return"article"}}var u=t,h=r,f=e.i(292e3),p=e.i(955653),m=e.i(405757),g=e.i(283584),b=n,y=e.i(423693),v=e.i(825259),x=r;function w({traceId:e,observationId:t,classifications:r,selectedTagIds:n}){let[i,a]=(0,x.useState)(),[o,l]=(0,x.useState)(!1);return(0,x.useEffect)(()=>{a(void 0)},[e]),{feedback:i,loading:o,onSubmit:(0,x.useCallback)(async(i,o)=>{if(!e)return{success:!1,error:"Unable to submit feedback because trace information is missing."};l(!0);try{let l=await fetch("/api/payload/v1/content/generate-tags/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({traceId:e,observationId:t,score:+("good"===i),feedbackType:i,classificationResults:r,selectedTagIds:n,comment:o?.comment})});if(!l.ok){let e=await l.json().catch(()=>null);throw Error(e?.error||"Failed to submit tag generation feedback")}return a(i),{success:!0,error:null}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Something went wrong"}}finally{l(!1)}},[r,t,n,e])}}var k=r;function S({traceId:e,extractedLocations:t,resolvedLocations:r,selectedTagIds:n}){let[i,a]=(0,k.useState)(),[o,l]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{a(void 0)},[e]),{feedback:i,loading:o,onSubmit:(0,k.useCallback)(async(i,o)=>{if(!e)return{success:!1,error:"Unable to submit feedback because trace information is missing."};l(!0);try{let l=await fetch("/api/payload/v1/ai/extract-locations/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({traceId:e,score:+("good"===i),feedbackType:i,extractedLocations:t,resolvedLocations:r,selectedTagIds:n,comment:o?.comment})});if(!l.ok){let e=await l.json().catch(()=>null);throw Error(e?.error||"Failed to submit location extraction feedback")}return a(i),{success:!0,error:null}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Something went wrong"}}finally{l(!1)}},[t,r,n,e])}}function C(e){return e.map(e=>{if(!e)return null;if("string"==typeof e)return e;if("object"==typeof e){if("id"in e&&"string"==typeof e.id)return e.id;if("value"in e){let t=e.value;if("string"==typeof t)return t;if(t&&"object"==typeof t&&"id"in t&&"string"==typeof t.id)return t.id}}return null}).filter(e=>!!e)}function _({open:e,onClose:t,onSubmit:r,loading:n}){return(0,u.jsx)(p.FeedbackFormDialog,{open:e,onClose:t,loading:n,onSubmit:async e=>{try{let{success:n,error:i}=await r(e);if(n)b.toast.success("Issue reported successfully"),t();else throw Error(i||"Failed to submit issue feedback")}catch(e){b.toast.error("Failed to report issue",{description:e instanceof Error?e.message:"Something went wrong"})}}})}function j({selectedTags:e,tagGeneration:t,locationExtraction:r}){let[n,i]=(0,h.useState)(!1),a=(0,h.useMemo)(()=>C(e),[e]),{feedback:o,onSubmit:l,loading:s}=w({traceId:t?.traceId,classifications:t?.classifications,selectedTagIds:a}),{feedback:c,onSubmit:d,loading:p}=S({traceId:r?.traceId,extractedLocations:r?.extractedLocations,resolvedLocations:r?.resolvedLocations,selectedTagIds:a}),x=o===c?o:o??c,k=s||p,N=!!t?.traceId,T=!!r?.traceId,E=(0,h.useCallback)(async e=>{let t=[];if(N&&t.push(l("bad",{comment:e})),T&&t.push(d("bad",{comment:e})),(await Promise.allSettled(t)).every(e=>"rejected"===e.status||"fulfilled"===e.status&&!e.value.success))throw Error("Failed to submit issue feedback")},[N,T,l,d]),{onSubmit:A,loading:R}=(0,g.useSubmitIssue)(E),{openModal:M,isModalOpen:I,closeModal:L}=(0,b.useModal)(),P=()=>{i(!1)},D=(0,h.useMemo)(()=>{let e=[];return t&&e.push({key:"regenerate",title:"Regenerate tags",onClick:()=>{t.onRegenerate(),P()}}),r&&e.push({key:"re-extract",title:r.traceId?"Re-extract locations":"Extract locations",onClick:()=>{r.onReExtract(),P()}}),e.push({key:"report-issue",title:"Report Issue",onClick:()=>{P(),M(m.FEEDBACK_FORM_DIALOG_SLUG)}}),e},[t,r,M]),O=(0,h.useCallback)(async()=>{if(!N&&!T)return void b.toast.message("AI Tags",{description:"Run an AI action before leaving feedback."});let e=[];N&&e.push(l("good")),T&&e.push(d("good")),(await Promise.allSettled(e)).every(e=>"rejected"===e.status||"fulfilled"===e.status&&!e.value.success)?b.toast.error("Failed to submit feedback"):b.toast.message("AI Tags",{description:"Thanks for the feedback.",icon:(0,u.jsx)(v.ThumbsUp,{})})},[N,T,l,d]),F=(0,h.useCallback)(async()=>{if(!N&&!T)return void b.toast.message("AI Tags",{description:"Run an AI action before leaving feedback."});let e=[];N&&e.push(l("bad")),T&&e.push(d("bad")),(await Promise.allSettled(e)).every(e=>"rejected"===e.status||"fulfilled"===e.status&&!e.value.success)?b.toast.error("Failed to submit feedback"):b.toast.message("AI Tags",{icon:(0,u.jsx)(y.ThumbsDown,{}),description:(0,u.jsxs)("div",{children:["Thanks for the feedback.",(0,u.jsx)(b.Button,{size:"xsmall",buttonStyle:"none",className:"m-0 ml-2 underline",onClick:()=>{M(m.FEEDBACK_FORM_DIALOG_SLUG)},children:"Report Issue"})]})})},[N,T,l,d,M]);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(f.FeedbackToolbar,{isMoreOpen:n,feedback:x,onToggleMore:i,onClickGood:()=>{k||O()},onClickBad:()=>{k||F()},menuOptions:D}),(0,u.jsx)(_,{open:I(m.FEEDBACK_FORM_DIALOG_SLUG),onClose:()=>{L(m.FEEDBACK_FORM_DIALOG_SLUG)},onSubmit:A,loading:R})]})}var N=e.i(349882),T=e.i(995334),E=e.i(160672),A=e.i(134110),R=e.i(664157),M=e.i(332221),I=e.i(149993),L=e.i(485415),P=e.i(403528);let D=(0,T.getContentTagTypes)(),O=[{key:"all",label:"All",types:[...D]},{key:"content",label:"Content",types:["contentTags"]},{key:"analytics",label:"Analytics",types:["analyticsTag"]},{key:"location",label:"Location",types:["location","region","state"]}],F=` .tags-autogen-search-result:hover { background-color: var(--theme-elevation-50); } `,B=e=>{let{field:i,path:a}=e,{collectionSlug:o}=(0,n.useDocumentInfo)(),s="videos"===o,u=d(o),{value:h,setValue:f,resolvedTags:p,selectedIds:m,handleAddTag:g,handleRemoveTag:b}=(0,A.useTagSelection)(a),{searchResults:y,isSearching:v,doSearch:x}=(0,R.useTagSearch)({filterOptions:O,allTagTypes:D}),[w,k]=(0,r.useState)({}),S=(0,n.useFormFields)(([e])=>{let t=e["content.channelVideos.0.url"]?.value;if(t&&"string"==typeof t&&t.length>0){let r=e.title?.value;return{url:t,title:r,description:e.description?.value?(0,N.extractTextFromJson)(e.description.value):"",transcript:e["content.transcript"]?.value?(0,N.extractTextFromJson)(e["content.transcript"].value):""}}return null}),{loading:C,onGenerateTags:_}=l(),B=(0,r.useCallback)(async()=>{if(S)if(S.title&&S.description&&S.transcript){let e=n.toast.loading("Generating tags..."),t=await _(S);if(t.success){let e=p.filter(e=>"location"===e.type||"region"===e.type||"state"===e.type).map(e=>e.id);f([...new Set([...t.tagIds??[],...e])]),k({traceId:t.traceId,classifications:t.classifications})}else n.toast.error("Failed to generate tags",{description:t.error}),k({});n.toast.dismiss(e)}else n.toast.error("Title, description, and transcript are required")},[_,f,S,p]),$=(0,n.useFormFields)(([e])=>{let t,r=e.title?.value||"";if(!r)return null;let n=e.description?.value||e.subHeadline?.value,i=n?(0,N.extractTextFromJson)(n):"",a=e["content.body"]?.value||e["content.transcript"]?.value,o=a?(0,N.extractTextFromJson)(a):"";if("content.liveblogEntries"in e){let r=e["content.liveblogEntries"]?.value;Array.isArray(r)&&(t=r.map(e=>"string"==typeof e?e:e?.id??e?.value).filter(e=>"string"==typeof e))}return{title:r,description:i,bodyText:o,liveblogEntryIds:t}}),[U,z]=(0,r.useState)({}),{loading:H,onExtractLocations:W}=c(),V=(0,r.useCallback)(async()=>{if(!$?.title)return void n.toast.error("Title is required for location extraction");let e=h?h.map(E.getTagId).filter(Boolean):[],t=n.toast.loading("Extracting locations..."),r=await W({title:$.title,description:$.description,bodyText:$.bodyText,contentType:u,existingTagIds:e,liveblogEntryIds:$.liveblogEntryIds});r.success?(r.newTagIds.length>0?(f([...e,...r.newTagIds]),n.toast.success(`Added ${r.newTagIds.length} location tag${r.newTagIds.length>1?"s":""}`)):n.toast.info("No new locations found in content"),z({traceId:r.traceId,extractedLocations:r.extractedLocations,resolvedLocations:r.resolvedLocations})):(n.toast.error("Failed to extract locations",{description:r.error}),z({})),n.toast.dismiss(t)},[$,u,h,f,W]),[q,G]=(0,r.useState)(!1),[K,Y]=(0,r.useState)(new Set(["all"])),[J,Z]=(0,r.useState)(""),[X,Q]=(0,r.useState)(!1),ee=(0,r.useRef)(null),et=(0,r.useRef)(null),er=(0,r.useRef)(null),en=(0,r.useCallback)(e=>{Y(t=>{if("all"===e)return new Set(["all"]);let r=new Set(t);return(r.delete("all"),r.has(e)?r.delete(e):r.add(e),0===r.size)?new Set(["all"]):r})},[]);(0,r.useEffect)(()=>{if(q&&X)return ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{x(J,K)},300),()=>{ee.current&&clearTimeout(ee.current)}},[J,K,q,X,x]),(0,r.useEffect)(()=>{let e=e=>{et.current&&!et.current.contains(e.target)&&Q(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,r.useEffect)(()=>{q?setTimeout(()=>er.current?.focus(),50):(Q(!1),Z(""))},[q]);let ei=(0,r.useCallback)(e=>{g(e),Z(""),er.current?.focus()},[g]),ea=(0,r.useMemo)(()=>y.filter(e=>!m.has(e.id)),[y,m]),eo=(0,r.useMemo)(()=>{let e={};for(let t of p){let r=t.type;r&&(e[r]=(e[r]||0)+1)}return e},[p]);return(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("style",{children:F}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px",gap:"8px"},children:[(0,t.jsx)(n.FieldLabel,{label:i.label,required:i.required,path:a}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[s&&(0,t.jsx)("div",{style:{display:"flex",alignItems:"center"},children:h&&h.length>0?(0,t.jsx)(j,{selectedTags:h||[],tagGeneration:{traceId:w.traceId,classifications:w.classifications,onRegenerate:B},locationExtraction:$?.title?{traceId:U.traceId,extractedLocations:U.extractedLocations,resolvedLocations:U.resolvedLocations,onReExtract:V}:void 0}):S?(0,t.jsx)(n.Button,{buttonStyle:"none",className:"m-0 mb-0 underline",disabled:C,onClick:B,children:"Auto-generate"}):null}),$?.title&&!(s&&h&&h.length>0)&&(0,t.jsx)("div",{style:{display:"flex",alignItems:"center"},children:U.traceId?(0,t.jsx)(j,{selectedTags:h||[],locationExtraction:{traceId:U.traceId,extractedLocations:U.extractedLocations,resolvedLocations:U.resolvedLocations,onReExtract:V}}):(0,t.jsx)(n.Button,{buttonStyle:"none",className:"m-0 mb-0 underline",disabled:H,onClick:V,children:H?"Extracting locations...":"Extract locations"})}),(0,t.jsx)("button",{type:"button",onClick:()=>G(e=>!e),title:q?"Close search":"Search tags",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"4px",border:q?"1px solid var(--theme-elevation-400)":"1px solid var(--theme-elevation-150)",backgroundColor:q?"var(--theme-elevation-100)":"transparent",color:q?"var(--theme-text)":"var(--theme-elevation-400)",cursor:"pointer",transition:"all 0.15s ease",flexShrink:0},children:(0,t.jsx)(M.SearchIcon,{size:14})})]})]}),p.length>0&&(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:p.map(e=>(0,t.jsx)(I.TagPill,{tag:e,onRemove:b},e.id))}),(0,t.jsx)("div",{style:{display:"flex",gap:"10px",marginBottom:"8px",flexWrap:"wrap"},children:(0,T.getLegendEntries)({contentOnly:!0}).map(([e,r])=>{let n=eo[e]||0;return(0,t.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"var(--theme-elevation-500)",opacity:n>0?1:.5},children:[(0,t.jsx)(T.TagTypeBadge,{type:e}),(0,t.jsxs)("span",{children:[r.label,n>0&&(0,t.jsxs)("span",{style:{fontWeight:600},children:[" (",n,")"]})]})]},e)})}),q&&(0,t.jsxs)("div",{ref:et,style:{padding:"8px",border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",backgroundColor:"var(--theme-elevation-50)"},children:[(0,t.jsx)(P.FilterToggleBar,{options:O,active:K,onToggle:en}),(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("input",{ref:er,type:"text",placeholder:"Search tags...",value:J,onChange:e=>Z(e.target.value),onFocus:()=>{Q(!0),x(J,K)},style:{width:"100%",padding:"8px 12px",fontSize:"14px",border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",backgroundColor:"var(--theme-input-bg)",color:"var(--theme-text)",outline:"none"}}),X&&(0,t.jsx)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:100,boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:(0,t.jsx)(L.TagSearchResults,{isSearching:v,results:ea,searchQuery:J,onSelect:ei,hoverClassName:"tags-autogen-search-result",showTypeLabel:!0})})]})]})]})};e.s(["TagsWithAutoGenerateComponent",0,B],367674)},814461,721949,e=>{"use strict";let t=["affiliate","analyticsTag","categoryTags","contentTags","location","region","state"],r=[{key:"all",label:"All",types:[...t]},{key:"content",label:"Content",types:["contentTags"]},{key:"category",label:"Category",types:["categoryTags"]},{key:"location",label:"Location",types:["location","region","state"]},{key:"region",label:"Region",types:["location"],locationSubtypes:["region"]},{key:"state",label:"State",types:["location"],locationSubtypes:["state"]},{key:"city",label:"City",types:["location"],locationSubtypes:["city"]},{key:"poi",label:"POI",types:["location"],locationSubtypes:["poi"]},{key:"analytics",label:"Analytics",types:["analyticsTag"]},{key:"affiliate",label:"Affiliate",types:["affiliate"]}];e.s(["CONTENT_QUERY_FILTER_OPTIONS",0,r,"CONTENT_QUERY_TAG_TYPES",0,t],814461);var n=e.i(699173),i=e.i(592121),a=e.i(798973),o=e.i(664157),l=e.i(332221),s=e.i(403528),c=e.i(485415);function d({selectedIds:e,onSelect:t,filterOptions:r,allTagTypes:u,hoverClassName:h,showTypeLabel:f=!1,isOpen:p,onToggleOpen:m,panelContainerRef:g}){let[b,y]=(0,i.useState)(!1),v=void 0!==p,x=v?p:b,[w,k]=(0,i.useState)(new Set(["all"])),[S,C]=(0,i.useState)(""),_=(0,i.useRef)(null),j=(0,i.useRef)(null),{searchResults:N,isSearching:T,doSearch:E,hasNextPage:A,totalDocs:R,loadMore:M,isLoadingMore:I}=(0,o.useTagSearch)({filterOptions:r,allTagTypes:u}),L=(0,i.useCallback)(e=>{k(new Set([e]))},[]);(0,i.useEffect)(()=>{if(x)return _.current&&clearTimeout(_.current),_.current=setTimeout(()=>{E(S,w)},300),()=>{_.current&&clearTimeout(_.current)}},[S,w,x,E]),(0,i.useEffect)(()=>{x?(E(S,w),setTimeout(()=>j.current?.focus(),50)):C("")},[x]);let P=(0,i.useMemo)(()=>N.filter(t=>!e.has(t.id)),[N,e]),D=(0,i.useCallback)(e=>{t(e),C(""),j.current?.focus()},[t]),O=` .${h}:hover { background-color: var(--theme-elevation-50); } `;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("style",{children:O}),(0,n.jsx)("button",{type:"button",onClick:()=>v?m?.():y(e=>!e),title:x?"Close search":"Search tags",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"4px",border:x?"1px solid var(--theme-elevation-400)":"1px solid var(--theme-elevation-150)",backgroundColor:x?"var(--theme-elevation-100)":"transparent",color:x?"var(--theme-text)":"var(--theme-elevation-400)",cursor:"pointer",transition:"all 0.15s ease",flexShrink:0},children:(0,n.jsx)(l.SearchIcon,{size:14})}),x&&(()=>{let e=(0,n.jsxs)("div",{style:{padding:"8px",border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",backgroundColor:"var(--theme-elevation-50)"},children:[(0,n.jsx)(s.FilterToggleBar,{options:r,active:w,onToggle:L}),(0,n.jsxs)("div",{children:[(0,n.jsx)("input",{ref:j,type:"text",placeholder:"Search tags...",value:S,onChange:e=>C(e.target.value),style:{width:"100%",padding:"8px 12px",fontSize:"14px",border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",backgroundColor:"var(--theme-input-bg)",color:"var(--theme-text)",outline:"none"}}),(0,n.jsx)(c.TagSearchResults,{isSearching:T,results:P,searchQuery:S,onSelect:D,hoverClassName:h,showTypeLabel:f,hasNextPage:A,remainingCount:R-N.length,onLoadMore:M,isLoadingMore:I})]})]});return g?.current?(0,a.createPortal)(e,g.current):e})()]})}e.s(["TagSearchPanel",0,d],721949)},992044,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(814461),i=e.i(134110),a=e.i(149993),o=e.i(721949);let l=e=>{let{field:l,path:s}=e,{resolvedTags:c,selectedIds:d,handleAddTag:u,handleRemoveTag:h}=(0,i.useTagSelection)(s);return(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)(r.FieldLabel,{label:l.label,required:l.required,path:s}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",marginBottom:"8px"},children:[(0,t.jsx)(o.TagSearchPanel,{selectedIds:d,onSelect:u,filterOptions:n.CONTENT_QUERY_FILTER_OPTIONS,allTagTypes:n.CONTENT_QUERY_TAG_TYPES,hoverClassName:"cq-tags-search-result",showTypeLabel:!0}),c.map(e=>(0,t.jsx)(a.TagPill,{tag:e,onRemove:h},e.id))]})]})};e.s(["ContentQueryTagsComponent",0,l])},137486,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(995334),a=e.i(134110),o=e.i(664157),l=e.i(332221),s=e.i(149993),c=e.i(485415),d=e.i(403528);let u=(0,i.getContentTagTypes)(),h=[{key:"all",label:"All",types:[...u]},{key:"content",label:"Content",types:["contentTags"]},{key:"analytics",label:"Analytics",types:["analyticsTag"]},{key:"location",label:"Location",types:["location","region","state"]}],f=` .tags-search-result:hover { background-color: var(--theme-elevation-50); } `,p=e=>{let{field:p,path:m}=e,{resolvedTags:g,selectedIds:b,handleAddTag:y,handleRemoveTag:v}=(0,a.useTagSelection)(m),{searchResults:x,isSearching:w,doSearch:k,hasNextPage:S,totalDocs:C,loadMore:_,isLoadingMore:j}=(0,o.useTagSearch)({filterOptions:h,allTagTypes:u}),[N,T]=(0,r.useState)(!1),[E,A]=(0,r.useState)(new Set(["all"])),[R,M]=(0,r.useState)(""),[I,L]=(0,r.useState)(!1),P=(0,r.useRef)(null),D=(0,r.useRef)(null),O=(0,r.useRef)(null),F=(0,r.useCallback)(e=>{A(t=>{if("all"===e)return new Set(["all"]);let r=new Set(t);return(r.delete("all"),r.has(e)?r.delete(e):r.add(e),0===r.size)?new Set(["all"]):r})},[]);(0,r.useEffect)(()=>{if(N&&I)return P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{k(R,E)},300),()=>{P.current&&clearTimeout(P.current)}},[R,E,N,I,k]),(0,r.useEffect)(()=>{let e=e=>{D.current&&!D.current.contains(e.target)&&L(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,r.useEffect)(()=>{N?setTimeout(()=>O.current?.focus(),50):(L(!1),M(""))},[N]);let B=(0,r.useCallback)(e=>{y(e),M(""),O.current?.focus()},[y]),$=(0,r.useMemo)(()=>x.filter(e=>!b.has(e.id)),[x,b]),U=(0,r.useMemo)(()=>{let e={};for(let t of g){let r=t.type;r&&(e[r]=(e[r]||0)+1)}return e},[g]);return(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("style",{children:f}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[(0,t.jsx)(n.FieldLabel,{label:p.label,required:p.required,path:m}),(0,t.jsx)("button",{type:"button",onClick:()=>T(e=>!e),title:N?"Close search":"Search tags",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"4px",border:N?"1px solid var(--theme-elevation-400)":"1px solid var(--theme-elevation-150)",backgroundColor:N?"var(--theme-elevation-100)":"transparent",color:N?"var(--theme-text)":"var(--theme-elevation-400)",cursor:"pointer",transition:"all 0.15s ease",flexShrink:0},children:(0,t.jsx)(l.SearchIcon,{size:14})})]}),g.length>0&&(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:g.map(e=>(0,t.jsx)(s.TagPill,{tag:e,onRemove:v},e.id))}),(0,t.jsx)("div",{style:{display:"flex",gap:"10px",marginBottom:"8px",flexWrap:"wrap"},children:(0,i.getLegendEntries)({contentOnly:!0}).map(([e,r])=>{let n=U[e]||0;return(0,t.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"var(--theme-elevation-500)",opacity:n>0?1:.5},children:[(0,t.jsx)(i.TagTypeBadge,{type:e}),(0,t.jsxs)("span",{children:[r.label,n>0&&(0,t.jsxs)("span",{style:{fontWeight:600},children:[" (",n,")"]})]})]},e)})}),N&&(0,t.jsxs)("div",{ref:D,style:{padding:"8px",border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",backgroundColor:"var(--theme-elevation-50)"},children:[(0,t.jsx)(d.FilterToggleBar,{options:h,active:E,onToggle:F}),(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("input",{ref:O,type:"text",placeholder:"Search tags...",value:R,onChange:e=>M(e.target.value),onFocus:()=>{L(!0),k(R,E)},style:{width:"100%",padding:"8px 12px",fontSize:"14px",border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",backgroundColor:"var(--theme-input-bg)",color:"var(--theme-text)",outline:"none"}}),I&&(0,t.jsx)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:100,boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:(0,t.jsx)(c.TagSearchResults,{isSearching:w,results:$,searchQuery:R,onSelect:B,hoverClassName:"tags-search-result",showTypeLabel:!0,hasNextPage:S,remainingCount:Math.max(0,(C??0)-x.length),onLoadMore:_,isLoadingMore:j})})]})]})]})};e.s(["TagsFieldComponent",0,p])},13235,e=>{"use strict";var t=e.i(699173),r=e.i(541686);let n=e=>{let{field:n,path:i}=e,a=n.label||"Location Point",{value:o,setValue:l}=(0,r.useField)({path:i}),s=o?.[0]??"",c=o?.[1]??"",d=e=>{let t=""===e.target.value?null:parseFloat(e.target.value),r=o?.[0]??0;null===t?l(void 0):l([r,t])},u=e=>{let t=""===e.target.value?null:parseFloat(e.target.value),r=o?.[1]??0;null===t?l(void 0):l([t,r])};return(0,t.jsxs)("div",{className:"field-type point",children:[(0,t.jsx)(r.FieldLabel,{label:a,path:i}),(0,t.jsxs)("div",{style:{display:"flex",gap:"16px"},children:[(0,t.jsxs)("div",{style:{flex:1},children:[(0,t.jsx)("label",{style:{display:"block",fontSize:"12px",fontWeight:500,color:"var(--theme-elevation-500)",marginBottom:"4px"},children:"Latitude"}),(0,t.jsx)("input",{type:"number",step:"any",value:c,onChange:d,placeholder:"e.g. 33.749",style:{width:"100%",padding:"10px 14px",fontSize:"14px",border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",backgroundColor:"var(--theme-input-bg)",color:"var(--theme-text)"}})]}),(0,t.jsxs)("div",{style:{flex:1},children:[(0,t.jsx)("label",{style:{display:"block",fontSize:"12px",fontWeight:500,color:"var(--theme-elevation-500)",marginBottom:"4px"},children:"Longitude"}),(0,t.jsx)("input",{type:"number",step:"any",value:s,onChange:u,placeholder:"e.g. -84.388",style:{width:"100%",padding:"10px 14px",fontSize:"14px",border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",backgroundColor:"var(--theme-input-bg)",color:"var(--theme-text)"}})]})]})]})};e.s(["LatLngPointField",0,n])},410119,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);let i=({field:e,checkboxFieldPath:i,path:a,readOnly:o,adMetricId:l,adMetricName:s,adMetricLock:c=!0,adMetricType:d="article"})=>{let{label:u}=e,[h,f]=(0,r.useState)(l),[p,m]=(0,r.useState)(s),g=(0,r.useRef)(null),{setValue:b}=(0,n.useField)({path:a||e.name}),{dispatchFields:y}=(0,n.useForm)(),v=(0,n.useFormFields)(([e])=>e[i]?.value),x=(0,n.useFormFields)(([e])=>e);(0,r.useEffect)(()=>{x[i]?.value===void 0&&y({type:"UPDATE",path:i,value:c})},[c,i,y,x]);let w=(0,n.useFormFields)(([e])=>e.category&&e.category.value?e.category.value.value:""),[{data:k},{setParams:S}]=(0,n.usePayloadAPI)(`/api/payload/tags/${w||"placeholder"}?depth=1&draft=false&locale=en-US`);(0,r.useEffect)(()=>{if(v){if(!w){f(null),m("No ad metric selected"),b(null);return}if(k){let e=k,t="video"===d?"videoAdMetric":"articleAdMetric",r=e?.[t];if(r){let e=null;"object"==typeof r&&null!==r?(e=r.id,r.name&&m(r.name)):"string"==typeof r&&(e=r),e&&(f(e),b(e))}else f(null),m("No ad metric found for this category"),b(null)}}},[k,w,v,b,d]),(0,r.useEffect)(()=>{w&&w!==g.current?(S({id:w,depth:1,draft:!1,locale:"en-US"}),g.current=w):!w&&g.current&&(g.current=null,v&&(f(null),m("No ad metric selected"),b(null)))},[w,S,v,b]);let C=(0,r.useCallback)(e=>{e.preventDefault(),y({type:"UPDATE",path:i,value:!v}),y({type:"UPDATE",path:"coreMetadata.adMetricLock",value:!v})},[v,i,y]),_=(0,r.useMemo)(()=>o||v,[o,v]),j=(0,r.useMemo)(()=>({...e,label:"",filterOptions:{type:{equals:"adMetrics"}}}),[e]);return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(n.FieldLabel,{htmlFor:`field-${a}`,label:u}),(0,t.jsx)(n.Button,{className:"m-0 pb-[0.3125rem]",buttonStyle:"none",onClick:C,children:v?"Specify Manually":"Generate from Category"})]}),v?(0,t.jsx)(n.TextInput,{path:a,value:p||"No ad metric selected",readOnly:_}):(0,t.jsx)(n.RelationshipField,{field:j,path:a})]})};e.s(["AdMetricComponent",0,i])},470254,e=>{"use strict";let t="snowcast",r="dashboards-snowcast",n="en-US";e.s(["CONTENT_LOCALE",0,n,"SNOWCAST_CATEGORY_SLUG",0,t,"SNOWCAST_DASHBOARD_RESOURCE_SLUG",0,r])},265672,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(695881),a=e.i(465191),o=r,l=e.i(553329),s=e.i(470254);let c="/api/payload/v1/snowcast/generate-skeleton",d="Could not populate this article from SnowCast. Please try again.";function u(){let[e,t]=(0,o.useState)(!1);return{isPopulating:e,populate:(0,o.useCallback)(async(e,r)=>{t(!0);try{let t=new URLSearchParams({articleId:e,region:r}),{data:n,error:i}=await (0,l.tryCatch)(fetch(`${c}?${t.toString()}`,{method:"POST",credentials:"same-origin"}));if(i||!n)return{outcome:"failed",message:"Could not reach the server. Check your connection and try again.",retryable:!0};let{data:a}=await (0,l.tryCatch)(n.json());if(a?.outcome==="skipped")return{outcome:"skipped",message:a.message??d};if(!n.ok||a?.success!==!0)return{outcome:"failed",message:a?.message??a?.error??d,retryable:a?.retryable??!0};let o=await h(e);return{outcome:"populated",fields:a.fields??[],title:o.title,body:o.body}}finally{t(!1)}},[])}}async function h(e){let t=new URLSearchParams({draft:"true",locale:s.CONTENT_LOCALE,depth:"0"}),{data:r,error:n}=await (0,l.tryCatch)(fetch(`/api/payload/articles/${encodeURIComponent(e)}?${t.toString()}`,{credentials:"same-origin"}));if(n||!r?.ok)return{title:null,body:null};let{data:i}=await (0,l.tryCatch)(r.json());return{title:"string"==typeof i?.title?i.title:null,body:i?.content?.body??null}}var f=e.i(349882),p=s;function m(e){if("string"==typeof e)return e||null;if(e&&"object"==typeof e){let t=e["en-US"];if("string"==typeof t)return t||null}return null}function g(e){if(!e)return null;if("string"==typeof e)return e||null;if("object"!=typeof e)return null;let t=e;if(!("value"in t)&&!("id"in t)&&"en-US"in t)return g(t["en-US"]);if("value"in t){let e=t.value;if("string"==typeof e)return e||null;if(e&&"object"==typeof e&&"id"in e){let t=e.id;return t?String(t):null}return null}return"id"in t&&t.id?String(t.id):null}function b(e){let t=Array.isArray(e)?e:Array.isArray(e?.["en-US"])?e["en-US"]:[],r=[];for(let e of t)if("string"==typeof e)e&&r.push(e);else if(e&&"object"==typeof e&&"id"in e){let t=e.id;t&&r.push(String(t))}return r}function y(e){return!!e&&m(e.slug)===p.SNOWCAST_CATEGORY_SLUG}function v(e){let t=new Set;for(let r of e){if(r?.type!=="location"||"region"!==m(r?.locationSubtype))continue;let e=m(r?.slug);e&&t.add(e)}return 0===t.size?{status:"none"}:t.size>1?{status:"ambiguous",slugs:[...t].sort()}:{status:"ok",slug:[...t][0]}}function x(e){if(!e||"object"!=typeof e)return!0;if(""!==(0,f.extractTextFromLexical)(e).trim())return!1;let t=e.root,r=t?.children;return!Array.isArray(r)||!r.some(e=>{if(!e||"object"!=typeof e)return!1;if("paragraph"!==e.type)return!0;let t=e.children;return Array.isArray(t)&&t.length>0})}let w=(0,i.createLogger)("payload:PopulateFromSnowcastField"),k="title",S="content.body",C="category",_="tags",j="populate-from-snowcast-confirm",N=()=>{let{id:e}=(0,n.useDocumentInfo)(),{closeModal:i,openModal:o}=(0,n.useModal)(),{dispatchFields:l}=(0,n.useForm)(),{value:s}=(0,n.useField)({path:C}),{value:c}=(0,n.useField)({path:_}),{value:d}=(0,n.useField)({path:S}),{isPopulating:h,populate:f}=u(),[p,m]=(0,r.useState)(!1),[N,E]=(0,r.useState)({status:"none"});(0,r.useEffect)(()=>()=>{i(j)},[i]);let A=g(s),R=b(c).join(",");(0,r.useEffect)(()=>{if(!A){m(!1),E({status:"none"});return}let e=!1,t=[A,...R.split(",").filter(Boolean)];return(0,a.fetchTagsByIds)(t).then(t=>{if(e)return;let r=t;m(y(r.find(e=>String(e?.id)===A)??null)),E(v(r.filter(e=>String(e?.id)!==A)))},t=>{e||(w.error("Could not resolve tags for the SnowCast button",t),m(!1),E({status:"none"}))}),()=>{e=!0}},[A,R]);let M=(0,r.useCallback)(async()=>{if("ok"!==N.status||"string"!=typeof e)return;let t=await f(e,N.slug);"failed"===t.outcome?n.toast.error("Could not populate from SnowCast",{description:t.message}):"skipped"===t.outcome?n.toast.info(t.message):(null!==t.title&&l({type:"UPDATE",path:k,initialValue:t.title,value:t.title}),null!==t.body&&l({type:"UPDATE",path:S,initialValue:t.body,value:t.body}),n.toast.success(`Populated the ${N.slug} forecast. Already saved as a draft — publishing is unchanged.`))},[l,e,f,N]),I=(0,r.useCallback)(()=>{"none"===N.status?n.toast.error("This article has no SnowCast region tag",{description:"Add the region tag for the area this forecast covers, then try again."}):"ambiguous"===N.status?n.toast.error("This article has more than one region tag",{description:`Remove all but one of: ${N.slugs.join(", ")}. Leaving several would mean guessing which forecast you want.`}):x(d)?M():o(j)},[d,o,N,M]);if(!p)return null;let L="string"!=typeof e,P=!L&&"ok"!==N.status;return(0,t.jsxs)("div",{className:"mt-8 mb-4",children:[(0,t.jsx)(n.Button,{buttonStyle:"primary",disabled:h||L,margin:!1,onClick:I,size:"medium",children:h?"Populating…":"Populate from Synoptic"}),(0,t.jsx)("div",{"aria-live":"polite",className:P?"mt-2 rounded border border-red-200 bg-red-50 p-3 text-sm text-red-800 dark:border-red-700 dark:bg-red-900/20 dark:text-red-200":"mt-2 text-sm text-gray-500",role:P?"alert":void 0,children:L?"Save this article once before populating it from SnowCast.":h?"Fetching the current SnowCast forecast…":T(N)}),(0,t.jsx)(n.ConfirmationModal,{body:(0,t.jsxs)("p",{className:"text-lg leading-relaxed",children:["This replaces the headline and body of this article with the current SnowCast forecast for"," ",(0,t.jsx)("strong",{children:"ok"===N.status?N.slug:"this region"}),". Anything currently written in the body will be lost. Tags, category and publication state are not changed."]}),confirmingLabel:"Populating…",confirmLabel:"Replace content",heading:"Replace this article's content?",modalSlug:j,onConfirm:M})]})};function T(e){switch(e.status){case"ok":return`Pulls the current forecast for "${e.slug}" into the headline and body.`;case"ambiguous":return`This article has several region tags (${e.slugs.join(", ")}). Leave one, so there is no question which forecast to pull.`;case"none":return"This article has no SnowCast region tag. Add the region tag for the area this forecast covers."}}e.s(["BODY_PATH",0,S,"CATEGORY_PATH",0,C,"PopulateFromSnowcastField",0,N,"TAGS_PATH",0,_,"TITLE_PATH",0,k],265672)},942419,208893,765111,e=>{"use strict";let t=["atmosphere","retrocast"];function r(e){return void 0!==e&&t.includes(e)}function n(e){return r(e[0])}function i(e){let t="string"==typeof e?new Date(e):e,r=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),i=String(t.getUTCDate()).padStart(2,"0");return`${r}/${n}/${i}`}e.s(["isDatelessCategoryPathSegments",0,n],942419),e.s(["formatDate",0,i],208893);var a=e.i(699173);let o={marginTop:"6px",marginBottom:"6px",padding:"8px 10px",border:"1px solid var(--theme-error-500, #b00020)",borderRadius:"4px",background:"var(--theme-error-50, #fdecea)",color:"var(--theme-error-700, #7a0014)",fontSize:"12px",lineHeight:1.4},l={marginTop:"6px",marginBottom:"6px",padding:"8px 10px",border:"1px solid var(--theme-warning-500, #b27300)",borderRadius:"4px",background:"var(--theme-warning-50, #fff7e6)",color:"var(--theme-warning-700, #7a4f00)",fontSize:"12px",lineHeight:1.4},s=({noun:e,assetNameMissing:t,slugIsFallback:r,currentValue:n})=>{let i="string"==typeof n&&n.trim().length>0,s=!!t&&!i;return s||r?(0,a.jsxs)(a.Fragment,{children:[s&&(0,a.jsxs)("div",{role:"alert",style:o,children:[(0,a.jsx)("strong",{children:"No assetName generated."})," This ",e," is unreachable by content-queries, partner feeds, and byAssetName routes until fixed. Confirm slug, category, and publishDate are all set, and that the category tag has pathSegments configured."]}),r&&(0,a.jsxs)("div",{role:"status",style:l,children:[(0,a.jsx)("strong",{children:"Slug auto-generated."})," The headline contained no slug-safe characters, so the system substituted a deterministic fallback. Override the slug manually or edit the headline if you want a readable URL."]})]}):null};e.s(["AssetNameBanner",0,s],765111)},938061,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(942419),a=e.i(208893),o=e.i(765111);let l=({field:e,checkboxFieldPath:l,path:s,readOnly:c,pathSegments:d,formattedDate:u,initialValue:h,sampleAssetName:f,slugIsFallback:p,assetNameMissing:m})=>{let{label:g}=e,b=(0,n.useLocale)(),[y,v]=(0,r.useState)(d),x=(0,r.useRef)(null),{value:w,setValue:k}=(0,n.useField)({path:s||e.name}),{dispatchFields:S}=(0,n.useForm)(),C=(0,n.useFormFields)(([e])=>e[l]?.value),_=(0,n.useFormFields)(([e])=>{let t=e.slug?.value;return"string"==typeof t?t:""}),j=(0,n.useFormFields)(([e])=>e.category&&e.category.value?e.category.value.value:""),N=(0,n.useFormFields)(([e])=>e.publishDate?.value),[{data:T},{setParams:E}]=(0,n.usePayloadAPI)(`/api/payload/tags/${j||"placeholder"}`);(0,r.useEffect)(()=>{j&&T&&T.pathSegments&&v(T.pathSegments.map(e=>e.segment))},[T,j]),(0,r.useEffect)(()=>{j&&j!==x.current&&(E({id:j}),x.current=j)},[j,E]);let A=(0,r.useMemo)(()=>{if(N)try{let e=new Date(N);if(isNaN(e.getTime()))return console.warn("Invalid publishDate value:",N),u;let t=(0,a.formatDate)(N);if(t.includes("NaN"))return console.warn("Formatted date contains NaN:",t),u;return t}catch(e){console.warn("Error formatting publishDate client-side:",e)}return u},[N,u]),R=(0,r.useMemo)(()=>{if(!_||0===y.length)return null;let e=!(0,i.isDatelessCategoryPathSegments)(y);if(e&&!A)return null;let t=[];return"en-US"!==b.code&&t.push(b.code),e&&t.push(A),t.push(...y,_),t},[b.code,A,y,_]),M=(0,r.useMemo)(()=>R?`/${R.join("/")}`.replace(/\/+/g,"/"):f?f.replace("[slug]",_||"[slug]").replace(/\/+/g,"/"):"",[R,f,_]);(0,r.useEffect)(()=>{C&&M&&(S({type:"UPDATE",path:s,value:M}),k(M))},[C,M,k,S,s]);let I=(0,r.useCallback)(e=>{e.preventDefault(),S({type:"UPDATE",path:l,value:!C})},[C,l,S]),L=(0,r.useMemo)(()=>c||C,[c,C]);return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(n.FieldLabel,{htmlFor:`field-${s}`,label:g}),(0,t.jsx)(n.Button,{className:"m-0 pb-[0.3125rem]",buttonStyle:"none",onClick:I,children:C?"Specify Manually":"Generate from Fields"})]}),(0,t.jsx)(o.AssetNameBanner,{noun:"article",assetNameMissing:m,currentValue:w,slugIsFallback:p}),(0,t.jsx)(n.TextInput,{value:w||h||"",onChange:k,path:s||e.name,readOnly:!!L}),!C&&(0,t.jsxs)("p",{style:{fontSize:"12px",color:"var(--theme-elevation-500)",marginTop:"4px",lineHeight:1.4},children:["Expected pattern:"," ",(0,t.jsxs)("code",{style:{fontSize:"11px"},children:["/","{YYYY/MM/DD}","/","{category}","/","{topic}","/","{slug}"]}),(0,t.jsx)("br",{}),"Example:"," ",(0,t.jsx)("code",{style:{fontSize:"11px"},children:"/2025/10/17/news/weather/hurricane-updates"})]})]})};e.s(["ArticleAssetNameComponent",0,l])},305391,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);let i="seo.schema.dateModified",a=()=>{let{setValue:e}=(0,n.useField)({path:i}),a=(0,r.useCallback)(()=>{e(new Date().toISOString()),n.toast.success("Marked as substantive update. Save the article to publish the change.")},[e]);return(0,t.jsx)(n.PopupList.ButtonGroup,{children:(0,t.jsx)(n.PopupList.Button,{id:"mark-substantive-update",onClick:a,children:"Mark as Substantive Update"})})};e.s(["SCHEMA_DATE_MODIFIED_PATH",0,i,"SubstantiveUpdateEditMenuItem",0,a])},597078,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);let i=({field:e,checkboxFieldPath:i,path:a,readOnly:o,slug:l,initialValue:s,sampleAssetName:c})=>{let{label:d}=e,{value:u,setValue:h}=(0,n.useField)({path:a||e.name}),{dispatchFields:f}=(0,n.useForm)(),p=(0,n.useFormFields)(([e])=>e[i]?.value),m=(0,n.useFormFields)(([e])=>{let t=e.slug?.value;return"string"==typeof t?t:""}),g=(0,r.useMemo)(()=>{let e=m||l;return`/bios/${e}`},[m,l]);(0,r.useEffect)(()=>{p&&g&&(f({type:"UPDATE",path:a,value:g}),h(g))},[p,g,h,f,a]);let b=(0,r.useCallback)(e=>{e.preventDefault(),f({type:"UPDATE",path:i,value:!p})},[p,i,f]),y=(0,r.useMemo)(()=>o||p,[o,p]);return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(n.FieldLabel,{htmlFor:`field-${a}`,label:d}),(0,t.jsx)(n.Button,{className:"m-0 pb-[0.3125rem]",buttonStyle:"none",onClick:b,children:p?"Specify Manually":"Generate from Slug"})]}),(0,t.jsx)(n.TextInput,{value:u||s||"",onChange:h,path:a||e.name,readOnly:!!y})]})};e.s(["AuthorAssetNameComponent",0,i])},745100,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(942419),a=e.i(208893),o=e.i(765111);let l=({field:e,checkboxFieldPath:l,path:s,readOnly:c,pathSegments:d,formattedDate:u,initialValue:h,sampleAssetName:f,slugIsFallback:p,assetNameMissing:m})=>{let{label:g}=e,b=(0,n.useLocale)(),[y,v]=(0,r.useState)(d),x=(0,r.useRef)(null),{value:w,setValue:k}=(0,n.useField)({path:s||e.name}),{dispatchFields:S}=(0,n.useForm)(),C=(0,n.useFormFields)(([e])=>e[l]?.value),_=(0,n.useFormFields)(([e])=>{let t=e.slug?.value;return"string"==typeof t?t:""}),j=(0,n.useFormFields)(([e])=>e.category&&e.category.value?e.category.value.value:""),N=(0,n.useFormFields)(([e])=>e.publishDate?.value),[{data:T},{setParams:E}]=(0,n.usePayloadAPI)(`/api/payload/tags/${j||"placeholder"}`);(0,r.useEffect)(()=>{j&&T&&T.pathSegments&&v(T.pathSegments.map(e=>e.segment))},[T,j]),(0,r.useEffect)(()=>{j&&j!==x.current&&(E({id:j}),x.current=j)},[j,E]);let A=(0,r.useMemo)(()=>{if(N)try{let e=new Date(N);if(isNaN(e.getTime()))return console.warn("Invalid publishDate value:",N),u;let t=(0,a.formatDate)(N);if(t.includes("NaN"))return console.warn("Formatted date contains NaN:",t),u;return t}catch(e){console.warn("Error formatting publishDate client-side:",e)}return u},[N,u]),R=(0,r.useMemo)(()=>{if(!_||0===y.length)return null;let e=!(0,i.isDatelessCategoryPathSegments)(y);if(e&&!A)return null;let t=[];return"en-US"!==b.code&&t.push(b.code),e&&t.push(A),t.push(...y,"liveblogs",_),t},[b.code,A,y,_]),M=(0,r.useMemo)(()=>R?`/${R.join("/")}`.replace(/\/+/g,"/"):f?f.replace("[slug]",_||"[slug]").replace(/\/+/g,"/"):"",[R,f,_]);(0,r.useEffect)(()=>{C&&M&&k(M)},[C,M,k]);let I=(0,r.useCallback)(e=>{e.preventDefault(),S({type:"UPDATE",path:l,value:!C})},[C,l,S]),L=(0,r.useMemo)(()=>c||C,[c,C]);return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(n.FieldLabel,{htmlFor:`field-${s}`,label:g}),(0,t.jsx)(n.Button,{className:"m-0 pb-[0.3125rem]",buttonStyle:"none",onClick:I,children:C?"Specify Manually":"Generate from Fields"})]}),(0,t.jsx)(o.AssetNameBanner,{noun:"liveblog",assetNameMissing:m,currentValue:w,slugIsFallback:p}),(0,t.jsx)(n.TextInput,{value:w||h||"",onChange:k,path:s||e.name,readOnly:!!L}),!C&&(0,t.jsxs)("p",{style:{fontSize:"12px",color:"var(--theme-elevation-500)",marginTop:"4px",lineHeight:1.4},children:["Expected pattern:"," ",(0,t.jsxs)("code",{style:{fontSize:"11px"},children:["/","{YYYY/MM/DD}","/","{category}","/","{topic}","/liveblogs/","{slug}"]}),(0,t.jsx)("br",{}),"Example:"," ",(0,t.jsx)("code",{style:{fontSize:"11px"},children:"/2025/10/17/news/thunderstorms/liveblogs/test-liveblog"})]})]})};e.s(["LiveblogAssetNameComponent",0,l])},533410,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(208893),a=e.i(942419),o=e.i(765111);let l=({field:e,checkboxFieldPath:l,path:s,readOnly:c,pathSegments:d,formattedDate:u,initialValue:h,sampleAssetName:f,slugIsFallback:p,assetNameMissing:m})=>{let{label:g}=e,b=(0,n.useLocale)(),[y,v]=(0,r.useState)(d),x=(0,r.useRef)(null),{value:w,setValue:k}=(0,n.useField)({path:s||e.name}),{dispatchFields:S}=(0,n.useForm)(),C=(0,n.useFormFields)(([e])=>e[l]?.value),_=(0,n.useFormFields)(([e])=>{let t=e.slug?.value;return"string"==typeof t?t:""}),j=(0,n.useFormFields)(([e])=>e.category&&e.category.value?e.category.value.value:""),N=(0,n.useFormFields)(([e])=>e.publishDate?.value),[{data:T},{setParams:E}]=(0,n.usePayloadAPI)(`/api/payload/tags/${j||"placeholder"}`);(0,r.useEffect)(()=>{j&&T&&T.pathSegments&&v(T.pathSegments.map(e=>e.segment))},[T,j]),(0,r.useEffect)(()=>{j&&j!==x.current&&(E({id:j}),x.current=j)},[j,E]);let A=(0,r.useMemo)(()=>{if(N)try{let e=new Date(N);if(isNaN(e.getTime()))return console.warn("Invalid publishDate value:",N),u;let t=(0,i.formatDate)(N);if(t.includes("NaN"))return console.warn("Formatted date contains NaN:",t),u;return t}catch(e){console.warn("Error formatting publishDate client-side:",e)}return u},[N,u]),R=(0,r.useMemo)(()=>{if(!_||0===y.length)return null;let e=!(0,a.isDatelessCategoryPathSegments)(y);if(e&&!A)return null;let t=[];return"en-US"!==b.code&&t.push(b.code),e&&t.push(A),t.push(...y,"video",_),t},[b.code,A,y,_]),M=(0,r.useMemo)(()=>R?`/${R.join("/")}`.replace(/\/+/g,"/"):f?f.replace("[slug]",_||"[slug]").replace(/\/+/g,"/"):"",[R,f,_]);(0,r.useEffect)(()=>{C&&M&&(S({type:"UPDATE",path:s,value:M}),k(M))},[C,M,k,S,s]);let I=(0,r.useCallback)(e=>{e.preventDefault(),S({type:"UPDATE",path:l,value:!C})},[C,l,S]),L=(0,r.useMemo)(()=>c||C,[c,C]);return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(n.FieldLabel,{htmlFor:`field-${s}`,label:g}),(0,t.jsx)(n.Button,{className:"m-0 pb-[0.3125rem]",buttonStyle:"none",onClick:I,children:C?"Specify Manually":"Generate from Fields"})]}),(0,t.jsx)(o.AssetNameBanner,{noun:"video",assetNameMissing:m,currentValue:w,slugIsFallback:p}),(0,t.jsx)(n.TextInput,{value:w||h||"",onChange:k,path:s||e.name,readOnly:!!L}),!C&&(0,t.jsxs)("p",{style:{fontSize:"12px",color:"var(--theme-elevation-500)",marginTop:"4px",lineHeight:1.4},children:["Expected pattern:"," ",(0,t.jsxs)("code",{style:{fontSize:"11px"},children:["/","{YYYY/MM/DD}","/","{category}","/","{topic}","/video/","{slug}"]}),(0,t.jsx)("br",{}),"Example:"," ",(0,t.jsx)("code",{style:{fontSize:"11px"},children:"/2025/10/17/news/seattle/video/weather-forecast"})]})]})};e.s(["VideoAssetNameComponent",0,l])},683870,e=>{"use strict";var t=e.i(514514);let r=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],n=(0,t.default)("circle-check",r);e.s(["CheckCircle2",0,n],683870)},638510,e=>{"use strict";var t=e.i(514514);let r=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],n=(0,t.default)("clock",r);e.s(["Clock",0,n],638510)},157710,e=>{"use strict";var t=e.i(514514);let r=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],n=(0,t.default)("loader-circle",r);e.s(["default",0,n])},976411,e=>{"use strict";var t=e.i(514514);let r=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],n=(0,t.default)("circle-x",r);e.s(["XCircle",0,n],976411)},299218,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(683870),i=e.i(638510),a=e.i(157710),a=a,o=e.i(514514);let l=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],s=(0,o.default)("user-check",l);var c=e.i(976411),d=e.i(592121);let u={"awaiting-transcribe":{icon:(0,t.jsx)(i.Clock,{"aria-hidden":"true",size:14,color:"var(--theme-warning-500)"}),label:"Awaiting Transcript",color:"var(--theme-warning-600)",bg:"var(--theme-warning-100)"},transcribing:{icon:(0,t.jsx)(a.default,{"aria-hidden":"true",size:14,color:"var(--theme-warning-500)"}),label:"Transcribing",color:"var(--theme-warning-600)",bg:"var(--theme-warning-100)"},"transcribe-failed":{icon:(0,t.jsx)(c.XCircle,{"aria-hidden":"true",size:14,color:"var(--theme-error-500)"}),label:"Transcript Failed",color:"var(--theme-error-600)",bg:"var(--theme-error-100)"},"awaiting-approval":{icon:(0,t.jsx)(s,{"aria-hidden":"true",size:14,color:"var(--theme-warning-500)"}),label:"Awaiting Approval",color:"var(--theme-warning-600)",bg:"var(--theme-warning-100)"},"awaiting-transcode":{icon:(0,t.jsx)(i.Clock,{"aria-hidden":"true",size:14,color:"var(--theme-warning-500)"}),label:"Awaiting Transcode",color:"var(--theme-warning-600)",bg:"var(--theme-warning-100)"},transcoding:{icon:(0,t.jsx)(a.default,{"aria-hidden":"true",size:14,color:"var(--theme-warning-500)"}),label:"Transcoding",color:"var(--theme-warning-600)",bg:"var(--theme-warning-100)"},ready:{icon:(0,t.jsx)(n.CheckCircle2,{"aria-hidden":"true",size:14,color:"var(--theme-success-500)"}),label:"Ready",color:"var(--theme-success-600)",bg:"var(--theme-success-100)"},"transcode-failed":{icon:(0,t.jsx)(c.XCircle,{"aria-hidden":"true",size:14,color:"var(--theme-error-500)"}),label:"Transcode Failed",color:"var(--theme-error-600)",bg:"var(--theme-error-100)"}},h=new Set(["awaiting-transcribe","transcribing","awaiting-approval","awaiting-transcode","transcoding"]),f=1e4,p=e=>"string"==typeof e&&e.length>0?e:null,m=()=>{let{id:e}=(0,r.useDocumentInfo)(),n=(0,r.useFormFields)(([e])=>p(e?.["coreMetadata.sourceStatus"]?.value)),i=(0,r.useFormFields)(([e])=>p(e?.["coreMetadata.sourceStatusReason"]?.value)),[a,o]=(0,d.useState)(null),l=a?a.status:n,s=a?a.reason:i,c=!!e&&null!==l&&h.has(l);if((0,d.useEffect)(()=>{if(!c)return;let t=new AbortController,r=!1,n=setInterval(async()=>{try{let n=await fetch(`/api/payload/videos/${e}?depth=0`,{signal:t.signal,credentials:"include"});if(!n.ok||r)return;let i=await n.json();if(r)return;let a=p(i?.coreMetadata?.sourceStatus);if(!a||!(a in u))return;o({status:a,reason:p(i?.coreMetadata?.sourceStatusReason)})}catch{}},f);return()=>{r=!0,t.abort(),clearInterval(n)}},[e,c]),!l||!(l in u))return null;let m=u[l],g=("transcode-failed"===l||"transcribe-failed"===l)&&s?s:void 0;return(0,t.jsxs)("div",{role:"status",title:g,"aria-label":g?`Transcode status: ${m.label}. ${g}`:`Transcode status: ${m.label}`,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:4,backgroundColor:m.bg,color:m.color,fontSize:12,fontWeight:600,whiteSpace:"nowrap"},children:[m.icon,m.label]})};e.s(["TRANSCODE_POLL_INTERVAL_MS",0,f,"TranscodeStatusIndicator",0,m],299218)},396751,e=>{"use strict";var t=e.i(699173),r=e.i(680852),n=e.i(541686);let i=({path:e,maxWidth:i=100,maxHeight:a=100})=>{let{value:o}=(0,n.useField)({path:e});return o?(0,t.jsxs)("div",{children:[(0,t.jsx)(r.default,{src:o,alt:"Thumbnail",width:i,height:a,style:{maxWidth:`${i}px`,maxHeight:`${a}px`,objectFit:"cover"},onError:e=>{e.currentTarget.style.display="none"}}),(0,t.jsx)("div",{className:"mt-1 truncate text-xs text-gray-500",children:o})]}):null},a=i;e.s(["ThumbnailPreview",0,i,"default",0,a])},175e3,e=>{"use strict";var t=e.i(699173),r=e.i(995334);function n({contentOnly:e}={}){return(0,t.jsx)("div",{style:{display:"flex",gap:"10px",flexWrap:"wrap"},children:(0,r.getLegendEntries)({contentOnly:e}).map(([e,n])=>(0,t.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"var(--theme-elevation-500)"},children:[(0,t.jsx)(r.TagTypeBadge,{type:e}),(0,t.jsx)("span",{children:n.label})]},e))})}e.s(["TagTypeLegend",0,n])},351083,e=>{"use strict";var t=e.i(699173),r=e.i(175e3);let n=()=>(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{style:{margin:"0 0 6px 0"},children:"Each row is ORed (match any tag in the row). Rows are ANDed together (must match all rows)."}),(0,t.jsx)(r.TagTypeLegend,{})]});e.s(["TagFiltersDescription",0,n])},155144,359539,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(747961);let i=({title:e,titleId:r,desc:n,descId:i,...a},o)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:o,"aria-labelledby":r,"aria-describedby":i,...a,children:[n?(0,t.jsx)("desc",{id:i,children:n}):null,void 0===e?(0,t.jsx)("title",{id:r,children:"Checkmark"}):e?(0,t.jsx)("title",{id:r,children:e}):null,(0,t.jsx)("path",{fill:"currentColor",d:"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1m-1 9.795-2.5-2.5.795-.795L7 9.205 10.705 5.5l.798.793z"})]}),a=(0,r.forwardRef)(i),o=r.default.forwardRef((e,r)=>(0,t.jsx)(n.BaseIcon,{ref:r,icon:a,...e}));o.displayName="CheckmarkFilled",e.s(["CheckmarkFilled",0,o],155144);var l=t,s=r,c=n;let d=({title:e,titleId:t,desc:r,descId:n,...i},a)=>(0,l.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":t,"aria-describedby":n,...i,children:[r?(0,l.jsx)("desc",{id:n,children:r}):null,void 0===e?(0,l.jsx)("title",{id:t,children:"Past"}):e?(0,l.jsx)("title",{id:t,children:e}):null,(0,l.jsxs)("g",{fill:"currentColor",children:[(0,l.jsx)("path",{d:"M10.643 10.647a.5.5 0 0 1-.707 0l-2.152-2.15a1 1 0 0 1-.293-.706V4a.5.5 0 0 1 1.001 0v3.376a1 1 0 0 0 .293.707l1.858 1.86a.5.5 0 0 1 0 .704"}),(0,l.jsx)("path",{d:"M7.992 1a6.99 6.99 0 0 0-5.006 2.115V1.5a.5.5 0 0 0-1.001 0v3a.5.5 0 0 0 .5.5H5.49a.5.5 0 1 0 0-1H3.526a6.01 6.01 0 0 1 10.155 2.089 5.99 5.99 0 0 1-2.761 7.163 6.01 6.01 0 0 1-7.554-1.41A6 6 0 0 1 2.004 8.5a.534.534 0 0 0-.52-.5.473.473 0 0 0-.483.499 7 7 0 0 0 4.309 5.968 7.02 7.02 0 0 0 7.637-1.517A6.997 6.997 0 0 0 7.992 1"})]})]}),u=(0,s.forwardRef)(d),h=s.default.forwardRef((e,t)=>(0,l.jsx)(c.BaseIcon,{ref:t,icon:u,...e}));h.displayName="Past",e.s(["Past",0,h],359539)},957265,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(155144),a=e.i(359539),o=t,l=r,s=e.i(747961);let c=({title:e,titleId:t,desc:r,descId:n,...i},a)=>(0,o.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":t,"aria-describedby":n,...i,children:[r?(0,o.jsx)("desc",{id:n,children:r}):null,void 0===e?(0,o.jsx)("title",{id:t,children:"Dot Mark"}):e?(0,o.jsx)("title",{id:t,children:e}):null,(0,o.jsx)("path",{fill:"currentColor",d:"M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8"})]}),d=(0,l.forwardRef)(c),u=l.default.forwardRef((e,t)=>(0,o.jsx)(s.BaseIcon,{ref:t,icon:d,...e}));u.displayName="DotMark";var h=t,f=r,p=s;let m=({title:e,titleId:t,desc:r,descId:n,...i},a)=>(0,h.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":t,"aria-describedby":n,...i,children:[r?(0,h.jsx)("desc",{id:n,children:r}):null,void 0===e?(0,h.jsx)("title",{id:t,children:"Image"}):e?(0,h.jsx)("title",{id:t,children:e}):null,(0,h.jsxs)("g",{fill:"currentColor",children:[(0,h.jsx)("path",{d:"M9.5 7a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3m0-2a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"}),(0,h.jsx)("path",{d:"M13 2H3a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1m0 11H3v-3l2.5-2.5 2.795 2.795a1 1 0 0 0 1.41 0L10.5 9.5 13 12zm0-2.415L11.205 8.79a1 1 0 0 0-1.41 0L9 9.585 6.205 6.79a1 1 0 0 0-1.41 0L3 8.585V3h10z"})]})]}),g=(0,f.forwardRef)(m),b=f.default.forwardRef((e,t)=>(0,h.jsx)(p.BaseIcon,{ref:t,icon:g,...e}));b.displayName="Image";var y=t,v=r,x=s;let w=({title:e,titleId:t,desc:r,descId:n,...i},a)=>(0,y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":t,"aria-describedby":n,...i,children:[r?(0,y.jsx)("desc",{id:n,children:r}):null,void 0===e?(0,y.jsx)("title",{id:t,children:"Document Blank"}):e?(0,y.jsx)("title",{id:t,children:e}):null,(0,y.jsx)("path",{fill:"currentColor",d:"m12.85 4.65-3.5-3.5A.45.45 0 0 0 9 1H4a1.003 1.003 0 0 0-1 1v12a1.003 1.003 0 0 0 1 1h8a1.003 1.003 0 0 0 1-1V5a.45.45 0 0 0-.15-.35M9 2.2 11.8 5H9zM12 14H4V2h4v3a1.003 1.003 0 0 0 1 1h3z"})]}),k=(0,v.forwardRef)(w),S=v.default.forwardRef((e,t)=>(0,y.jsx)(x.BaseIcon,{ref:t,icon:k,...e}));S.displayName="DocumentBlank";var C=t,_=r,j=s;let N=({title:e,titleId:t,desc:r,descId:n,...i},a)=>(0,C.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":t,"aria-describedby":n,...i,children:[r?(0,C.jsx)("desc",{id:n,children:r}):null,void 0===e?(0,C.jsx)("title",{id:t,children:"Playlist Video"}):e?(0,C.jsx)("title",{id:t,children:e}):null,(0,C.jsxs)("g",{fill:"currentColor",children:[(0,C.jsx)("path",{fillRule:"evenodd",d:"M14 4a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM6.414 7a.21.21 0 0 0-.205.208v4.584a.2.2 0 0 0 .06.148.21.21 0 0 0 .249.035l4.167-2.292a.2.2 0 0 0 .079-.077.2.2 0 0 0 .028-.106.2.2 0 0 0-.028-.106.2.2 0 0 0-.08-.077L6.519 7.025A.2.2 0 0 0 6.414 7",clipRule:"evenodd"}),(0,C.jsx)("path",{d:"M12.5 2h-9a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1M9.5 0h-3a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1"})]})]}),T=(0,_.forwardRef)(N),E=_.default.forwardRef((e,t)=>(0,C.jsx)(j.BaseIcon,{ref:t,icon:T,...e}));E.displayName="PlaylistVideoFilled";var A=t,R=r,M=s;let I=({title:e,titleId:t,desc:r,descId:n,...i},a)=>(0,A.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":t,"aria-describedby":n,...i,children:[r?(0,A.jsx)("desc",{id:n,children:r}):null,void 0===e?(0,A.jsx)("title",{id:t,children:"Video Horizontal"}):e?(0,A.jsx)("title",{id:t,children:e}):null,(0,A.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2 3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1zm.15 1.25a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0m3.225-.6a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2m2.025.6a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0m3.225-.6a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2m2.025.6a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0m-9.9 6.9a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2m2.025.6a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0M8 11.15a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2m2.025.6a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0m3.225-.6a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2M6 5.5v5L11 8z",clipRule:"evenodd"})]}),L=(0,R.forwardRef)(I),P=R.default.forwardRef((e,t)=>(0,A.jsx)(M.BaseIcon,{ref:t,icon:L,...e}));P.displayName="VideoHorizontal";var D=t,O=r,F=s;let B=({title:e,titleId:t,desc:r,descId:n,...i},a)=>(0,D.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":t,"aria-describedby":n,...i,children:[r?(0,D.jsx)("desc",{id:n,children:r}):null,void 0===e?(0,D.jsx)("title",{id:t,children:"Video Vertical"}):e?(0,D.jsx)("title",{id:t,children:e}):null,(0,D.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zm-.35 1.75a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0m.6 2.025a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2M3.65 8a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0m.6 2.025a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2m-.6 3.225a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0m8.1-11.1a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2m-.6 3.225a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0m.6 2.025a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2m-.6 3.225a.6.6 0 1 1 1.2 0 .6.6 0 0 1-1.2 0m.6 2.025a.6.6 0 1 0 0 1.2.6.6 0 0 0 0-1.2M6 5.5v5L10 8z",clipRule:"evenodd"})]}),$=(0,O.forwardRef)(B),U=O.default.forwardRef((e,t)=>(0,D.jsx)(F.BaseIcon,{ref:t,icon:$,...e}));U.displayName="VideoVertical";var z=t,H=r,W=s;let V=({title:e,titleId:t,desc:r,descId:n,...i},a)=>(0,z.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":t,"aria-describedby":n,...i,children:[r?(0,z.jsx)("desc",{id:n,children:r}):null,void 0===e?(0,z.jsx)("title",{id:t,children:"Calendar"}):e?(0,z.jsx)("title",{id:t,children:e}):null,(0,z.jsx)("path",{fill:"currentColor",d:"M13 2h-2v-.5a.5.5 0 0 0-1 0V2H6v-.5a.5.5 0 0 0-1 0V2H3c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h10c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1m0 11H3V6h10zm0-8H3V3h2v.5a.5.5 0 0 0 1 0V3h4v.5a.5.5 0 0 0 1 0V3h2z"})]}),q=(0,H.forwardRef)(V),G=H.default.forwardRef((e,t)=>(0,z.jsx)(W.BaseIcon,{ref:t,icon:q,...e}));G.displayName="Calendar";let K={article:{Icon:S,label:"Article"},video:{Icon:E,label:"Video"},image:{Icon:b,label:"Image"},liveblog:{Icon:G,label:"Liveblog"}},Y={vertical:{Icon:U,label:"Vertical video"},horizontal:{Icon:P,label:"Horizontal video"}},J={published:{Icon:i.CheckmarkFilled,label:"Published"},changed:{Icon:i.CheckmarkFilled,label:"Changed"},draft:{Icon:u,label:"Draft"},expired:{Icon:a.Past,label:"Expired"}},Z=e=>e.endsWith("s")?e.slice(0,-1):e,X=(e,{aspectRatio:t}={})=>{if("string"!=typeof e)return null;let r=Z(e);if("video"===r&&"string"==typeof t){let e=Y[t];if(e)return e}return K[r]??null},Q=e=>{let t="string"==typeof e&&e in J?e:"draft";return{...J[t],key:t}},ee=({type:e,aspectRatio:i,className:a,fallback:o=null})=>{let[l,s]=(0,r.useState)(!1),c=X(e,{aspectRatio:i});if(!c)return(0,t.jsx)(t.Fragment,{children:o});let{Icon:d,label:u}=c;return(0,t.jsxs)("span",{className:`relative inline-flex items-center ${a??""}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:()=>s(!0),onBlur:()=>s(!1),children:[(0,t.jsx)(d,{ariaHidden:!0,title:"",className:"size-4 text-current"}),(0,t.jsx)("span",{className:"sr-only",children:u}),(0,t.jsx)(n.Tooltip,{show:l,children:u})]})},et=({status:e,showLabel:i=!1,className:a})=>{let[o,l]=(0,r.useState)(!1),{Icon:s,label:c,key:d}=Q(e),u="published"===d||"changed"===d?"text-[color:var(--theme-success-500)]":"expired"===d?"text-[color:var(--theme-error-500)]":"text-[color:var(--theme-elevation-400)]";return(0,t.jsxs)("span",{className:`relative inline-flex items-center gap-1 ${u} ${a??""}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onFocus:()=>l(!0),onBlur:()=>l(!1),children:[(0,t.jsx)(s,{ariaHidden:!0,title:"",className:"size-4 text-current"}),(0,t.jsx)("span",{className:i?"text-xs":"sr-only",children:c}),!i&&(0,t.jsx)(n.Tooltip,{show:o,children:c})]})};e.s(["ContentTypeBadge",0,ee,"StatusBadge",0,et],957265)},753618,e=>{"use strict";var t=e.i(592121);let r="#1d4ed8",n="#1e3a8a33",i=null,a=new Set;function o(e){for(let t of(i=e,a))t()}function l(e){return a.add(e),()=>a.delete(e)}function s(){return i}function c(){return(0,t.useSyncExternalStore)(l,s,s)}e.s(["LOCAL_BLUE",0,r,"LOCAL_ROW_BG",0,n,"setLocalPreview",0,o,"useLocalPreview",0,c])},210601,e=>{"use strict";var t=e.i(592121);let r="#7c3aed",n="#4c1d9533",i=null,a=new Set;function o(e){for(let t of(i=e,a))t()}function l(e){return a.add(e),()=>a.delete(e)}function s(){return i}function c(){return(0,t.useSyncExternalStore)(l,s,s)}e.s(["RELATED_PURPLE",0,r,"RELATED_ROW_BG",0,n,"setRelatedPreview",0,o,"useRelatedPreview",0,c])},666933,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(37429),a=e.i(181443),o=e.i(957265),l=e.i(753618),s=e.i(210601);let c={ok:"Ranked by the trending signal snapshot.","snapshot-read-failed":"The trending snapshot could not be read, so results fell back to most-recent.","snapshot-missing-or-stale":"No fresh trending snapshot for this market, so results fell back to most-recent.","below-min-score":"No content scored at or above this row’s Minimum Score, so results fell back to most-recent.","no-items-in-selected-types":"The snapshot ranked no content in the selected content types, so results fell back to most-recent."};function d(e){if(!Array.isArray(e))return[];let t=[];for(let r of e){if(!r||"object"!=typeof r)continue;let e=r;"string"==typeof e.queryId&&("snapshot"===e.path||"recency"===e.path)&&"string"==typeof e.reason&&e.reason in c&&t.push({queryId:e.queryId,path:e.path,reason:e.reason,market:"string"==typeof e.market?e.market:"",snapshotGeneratedAt:"string"==typeof e.snapshotGeneratedAt?e.snapshotGeneratedAt:null,snapshotItemCount:"number"==typeof e.snapshotItemCount?e.snapshotItemCount:null,amplitudeAvailable:"boolean"==typeof e.amplitudeAvailable?e.amplitudeAvailable:null,newzdashAvailable:"boolean"==typeof e.newzdashAvailable?e.newzdashAvailable:null,amplitudeHasData:"boolean"==typeof e.amplitudeHasData?e.amplitudeHasData:null,newzdashHasData:"boolean"==typeof e.newzdashHasData?e.newzdashHasData:null,resultCount:"number"==typeof e.resultCount?e.resultCount:0,evaluatedAt:"string"==typeof e.evaluatedAt?e.evaluatedAt:"",items:u(e.items)})}return t}function u(e){if(!Array.isArray(e))return[];let t=[];for(let r of e){if(!r||"object"!=typeof r)continue;let e=r;if("string"!=typeof e.id)continue;let n=e=>"number"==typeof e?e:0;t.push({id:e.id,score:n(e.score),velocity:n(e.velocity),keywordOverlap:n(e.keywordOverlap),recency:n(e.recency),recentViews:n(e.recentViews),baselineViews:n(e.baselineViews),matchedTerms:Array.isArray(e.matchedTerms)?e.matchedTerms.filter(e=>"string"==typeof e):[]})}return t}function h(e){let t=[],r=e.velocity>=e.keywordOverlap;if(0===e.recentViews?t.push("keyword match only — no views in window"):r?t.push(`surging (velocity ${e.velocity.toFixed(2)})`):t.push(`keyword-led (overlap ${e.keywordOverlap.toFixed(2)})`),e.recentViews>0){let r=`${e.recentViews.toLocaleString()} views`;if(e.baselineViews>=1){let n=e.recentViews/e.baselineViews;t.push(n>=1?`${r} (${n.toFixed(1)}\xd7 baseline)`:`${r} (below its ${Math.round(e.baselineViews).toLocaleString()} baseline)`)}else t.push(r)}return t.join(" · ")}function f(e){return 0===e.recentViews}function p(e){return Array.isArray(e)&&0!==e.length?e:[]}function m(e){let t=0;return e.map(e=>"placeholder"===e.kind?e:{...e,position:++t})}let g=()=>{let{data:e}=(0,n.useDocumentInfo)(),c=(0,n.useFormSubmitted)(),[u,g]=(0,r.useState)({}),[b,k]=(0,r.useState)(!1),[S,C]=(0,r.useState)(!1),[_,j]=(0,r.useState)(null),[N,T]=(0,r.useState)(null),E=(0,r.useRef)(c);(0,r.useEffect)(()=>{c&&!E.current&&e?.id&&(j(null),T(null),fetch(`/api/payload/content-queries/${e.id}?depth=0`).then(e=>e.ok?e.json():null).then(e=>{let t=p(e?.mergedContent);t.length>0&&(j(t),T(e?.trendingDiagnostics??null))}).catch(()=>{})),E.current=c},[c,e?.id]);let A=(0,r.useMemo)(()=>_??p(e?.mergedContent),[e?.mergedContent,_]),R=(0,l.useLocalPreview)(),M=(0,s.useRelatedPreview)(),I=(0,r.useMemo)(()=>{let t=A.map((e,t)=>({kind:"merged",item:e,originalIndex:t})),r=Array.isArray(e?.queries)?e.queries:[],n=r.findIndex(e=>e?.queryType==="local"),i=r.findIndex(e=>e?.queryType==="related");if(-1===n&&-1===i)return m(t);let a=new Map;r.forEach((e,t)=>{e?.id&&a.set(String(e.id),t)});let o=e=>{let r=t.findIndex(t=>{let r=t.item.sourceQueryID?String(t.item.sourceQueryID):null,n=r?a.get(r):void 0;return void 0!==n&&n>e});return -1===r?t.length:r},l=R?.items??[],s=M?.items??[],c=[];-1!==n&&c.push({rowIndex:n,entries:l.length>0?l.map(e=>({kind:"local",item:e})):[{kind:"placeholder",slot:"local"}]}),-1!==i&&c.push({rowIndex:i,entries:s.length>0?s.map(e=>({kind:"related",item:e})):[{kind:"placeholder",slot:"related"}]}),c.sort((e,t)=>e.rowIndex-t.rowIndex);let d=[],u=0;for(let e of c){let r=o(e.rowIndex);for(;u{let t=N??e?.trendingDiagnostics,r=new Map;for(let e of d(t))for(let t of e.items)r.set(t.id,t);return r},[e?.trendingDiagnostics,N]),F=(0,r.useCallback)(e=>{g(t=>({...t,[e]:!t[e]})),C(!1)},[]),B=(0,r.useCallback)(()=>{let e={};A.forEach((t,r)=>{e[r]=!0}),g(e),C(!0)},[A]),$=(0,r.useCallback)(()=>{g({}),C(!1)},[]),U=e=>e.id&&e.url?"drupal"===e.source?`https://cms.weather.com${e.url}`:"payload"===e.source?`/payload/admin/collections/articles/${e.id}`:null:null;return 0===I.length?(0,t.jsxs)("div",{className:"field-type",style:{marginBottom:"1.5rem"},children:[(0,t.jsx)("h4",{style:{marginBottom:"0.5rem"},children:"Merged Content"}),(0,t.jsx)("p",{style:{color:"var(--theme-elevation-500)",fontSize:"0.875rem"},children:"No merged content available. Content will be populated when the query job runs."})]}):(0,t.jsxs)("div",{className:"field-type",style:{marginBottom:"1.5rem"},children:[(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.75rem",flexWrap:"wrap",gap:"0.5rem"},children:[(0,t.jsxs)("h4",{style:{margin:0,fontSize:"1rem"},children:["Merged Content"," ",(0,t.jsxs)("span",{style:{fontSize:"0.85rem",color:"var(--theme-elevation-500)",fontWeight:"normal"},children:["(",A.length," items",P>0?(0,t.jsxs)(t.Fragment,{children:[" + ",(0,t.jsxs)("span",{style:{color:l.LOCAL_BLUE,fontWeight:600},children:[P," local preview"]})]}):null,D>0?(0,t.jsxs)(t.Fragment,{children:[" + ",(0,t.jsxs)("span",{style:{color:s.RELATED_PURPLE,fontWeight:600},children:[D," related preview"]})]}):null,")"]})]}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,t.jsx)("p",{style:{fontSize:"0.8rem",color:"var(--theme-elevation-500)",margin:0},children:"This field automatically compiles and updates content from various data sources into one ordered list."}),(0,t.jsx)("button",{type:"button",onClick:S?$:B,style:{padding:"0.3rem 0.6rem",fontSize:"0.75rem",backgroundColor:"var(--theme-elevation-100)",border:"1px solid var(--theme-elevation-200)",borderRadius:"4px",cursor:"pointer",color:"var(--theme-elevation-800)",whiteSpace:"nowrap"},children:S?"Collapse All":"Expand All"})]})]}),(0,t.jsx)("div",{style:{border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",overflow:"visible"},children:L.map((e,r)=>{let n=r===L.length-1;if("placeholder"===e.kind)return(0,t.jsx)(y,{slot:e.slot,isLast:n},`${e.slot}-slot`);if("related"===e.kind)return(0,t.jsx)(v,{item:e.item,position:e.position??0,isLast:n},`related:${e.item.collection}:${e.item.id}`);if("local"===e.kind)return(0,t.jsx)(x,{item:e.item,position:e.position??0,isLast:n},`local:${e.item.collection}:${e.item.id}`);let{item:l,originalIndex:s,position:c}=e,d=s,p=l.overrideTitle||l.title||l.headline||"Untitled",m=l.overrideThumbnail||l.thumbnail,g=u[d],b=U(l),k=l.pinned,S=l.type??l.contentType,C=O.get(String(l.assetId??""))??O.get(String(l.id??"")),_=!!C&&f(C);return(0,t.jsxs)("div",{style:{borderBottom:n?"none":"1px solid var(--theme-elevation-100)"},children:[(0,t.jsxs)("div",{"data-testid":`merged-content-row-${l.id}`,onClick:()=>F(d),style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.5rem 0.75rem",cursor:"pointer",backgroundColor:g?"var(--theme-elevation-50)":"transparent",transition:"background-color 0.15s"},onMouseEnter:e=>{g||(e.currentTarget.style.backgroundColor="var(--theme-elevation-50)")},onMouseLeave:e=>{g||(e.currentTarget.style.backgroundColor="transparent")},children:[(0,t.jsx)("span",{style:{fontSize:"0.8rem",color:"var(--theme-elevation-400)",minWidth:"1.5rem",textAlign:"right"},children:c}),m?(0,t.jsx)("div",{style:{width:"40px",height:"28px",borderRadius:"3px",overflow:"hidden",flexShrink:0},children:(0,t.jsx)(i.default,{src:m,alt:p,width:40,height:28,style:{width:"100%",height:"100%",objectFit:"cover"},onError:e=>{e.currentTarget.style.display="none"}})}):(0,t.jsx)("div",{style:{width:"40px",height:"28px",borderRadius:"3px",backgroundColor:"var(--theme-elevation-100)",flexShrink:0}}),(0,t.jsx)(o.ContentTypeBadge,{type:S,aspectRatio:l.aspectRatio,className:"shrink-0 text-[color:var(--theme-elevation-600)]",fallback:(0,t.jsx)("span",{className:"shrink-0 text-[color:var(--theme-elevation-400)]",title:`Unknown type: ${S??"none"}`,children:"?"})}),l.channelHeadlines&&l.channelHeadlines.length>0&&(0,t.jsxs)("span",{style:{fontSize:"0.7rem",padding:"0.1rem 0.4rem",borderRadius:"3px",backgroundColor:"#8b5cf620",color:"#8b5cf6",fontWeight:600,flexShrink:0,whiteSpace:"nowrap"},role:"img","aria-label":`${l.channelHeadlines.length} channel headline override(s)`,title:`${l.channelHeadlines.length} channel headline override(s)`,children:["CH ",l.channelHeadlines.length]}),k&&(0,t.jsx)("span",{style:{fontSize:"0.75rem",flexShrink:0},children:"📌"}),(0,t.jsxs)("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:"1px"},children:[(0,t.jsx)("span",{style:{fontSize:"0.9rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p}),C&&(0,t.jsxs)("span",{"data-testid":`trending-signal-${l.id}`,style:{fontSize:"0.7rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:_?"var(--theme-warning-500)":"var(--theme-elevation-450)"},children:[h(C),C.matchedTerms.length>0&&` \xb7 matched: ${C.matchedTerms.join(", ")}`]})]}),C&&(0,t.jsx)("span",{"data-testid":`trending-score-${l.id}`,style:{fontSize:"0.7rem",padding:"0.15rem 0.4rem",borderRadius:"3px",fontVariantNumeric:"tabular-nums",flexShrink:0,backgroundColor:_?"var(--theme-warning-100)":"var(--theme-elevation-100)",color:_?"var(--theme-warning-600)":"var(--theme-elevation-600)"},title:"Trending score (0-1) from the signal snapshot",children:C.score.toFixed(2)}),(0,t.jsx)("span",{style:{fontSize:"0.7rem",padding:"0.15rem 0.4rem",borderRadius:"3px",backgroundColor:"payload"===l.source?"#3b82f620":"reachEngine"===l.source?"#f5be0b20":"#f9731620",color:"payload"===l.source?"#3b82f6":"reachEngine"===l.source?"#f5be0b":"#f97316",flexShrink:0,minWidth:"50px",textAlign:"center"},children:"reachEngine"===l.source?"reach":l.source||"unknown"}),(0,t.jsx)("div",{style:{width:"1rem",flexShrink:0,textAlign:"center"},children:b&&(0,t.jsx)("a",{href:b,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),style:{fontSize:"0.8rem",color:"var(--theme-elevation-500)",textDecoration:"none"},title:"Open in new tab",children:"↗"})}),(0,t.jsx)("span",{style:{fontSize:"0.8rem",color:"var(--theme-elevation-400)",transition:"transform 0.15s",transform:g?"rotate(90deg)":"rotate(0deg)",flexShrink:0},children:"▶"})]}),g&&(0,t.jsxs)("div",{style:{padding:"0.75rem 1rem 0.75rem 3.5rem",backgroundColor:"var(--theme-elevation-50)",fontSize:"0.85rem",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0.5rem 2rem"},children:[(0,t.jsx)(w,{label:"ID",value:l.id}),(0,t.jsx)(w,{label:"Asset Name",value:l.assetName}),(0,t.jsx)(w,{label:"URL",value:l.url}),(0,t.jsx)(w,{label:"Content Type",value:l.contentType}),(0,t.jsx)(w,{label:"Source",value:l.source}),(0,t.jsx)(w,{label:"Provider",value:l.providername}),(0,t.jsx)(w,{label:"Category",value:l.category?.title}),(0,t.jsx)(w,{label:"Duration",value:l.duration}),(0,t.jsx)(w,{label:"Aspect Ratio",value:l.aspectRatio}),(0,t.jsx)(w,{label:"Publish Date",value:l.publishdate}),(0,t.jsx)(w,{label:"Last Modified",value:l.lastmodifieddate}),(0,t.jsx)(w,{label:"Source Query ID",value:l.sourceQueryID}),l.description&&(0,t.jsx)("div",{style:{gridColumn:"1 / -1"},children:(0,t.jsx)(w,{label:"Description",value:l.description})}),l.caption&&(0,t.jsx)("div",{style:{gridColumn:"1 / -1"},children:(0,t.jsx)(w,{label:"Caption",value:l.caption})}),l.channelHeadlines&&l.channelHeadlines.length>0&&(0,t.jsxs)("div",{style:{gridColumn:"1 / -1"},children:[(0,t.jsx)("span",{style:{color:"var(--theme-elevation-500)",marginRight:"0.5rem"},children:"Channel Headlines:"}),(0,t.jsx)("div",{style:{marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.25rem"},children:l.channelHeadlines.map((e,r)=>{let n=(0,a.normalizePageScope)(e.page);return(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:"0.5rem",paddingLeft:"0.5rem"},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",padding:"0.1rem 0.35rem",borderRadius:"3px",backgroundColor:"#8b5cf620",color:"#8b5cf6",flexShrink:0},children:e.channel}),n&&(0,t.jsx)("span",{style:{fontSize:"0.75rem",padding:"0.1rem 0.35rem",borderRadius:"3px",backgroundColor:"var(--theme-elevation-100)",color:"var(--theme-elevation-600)",flexShrink:0},title:`Only applies on ${n}`,children:n}),(0,t.jsx)("span",{style:{wordBreak:"break-word"},children:e.headline})]},r)})})]})]})]},l.id||d)})}),I.length>20&&(0,t.jsx)("button",{type:"button",onClick:()=>k(e=>!e),style:{marginTop:"0.5rem",padding:"0.4rem 0.75rem",fontSize:"0.75rem",backgroundColor:"var(--theme-elevation-100)",border:"1px solid var(--theme-elevation-200)",borderRadius:"4px",cursor:"pointer",color:"var(--theme-elevation-800)"},children:b?"Show fewer":`Show all ${I.length} items (${I.length-20} more)`})]})},b={local:{accent:l.LOCAL_BLUE,background:l.LOCAL_ROW_BG,badge:"local",copy:"Local content injects here at runtime, resolved from each viewer’s location. Use the preview above to see sample items."},related:{accent:s.RELATED_PURPLE,background:s.RELATED_ROW_BG,badge:"related",copy:"Related content injects here at runtime, matched against the asset the reader is viewing. Use the preview above to see sample items."}};function y({slot:e,isLast:r}){let{accent:n,background:i,badge:a,copy:o}=b[e];return(0,t.jsx)("div",{style:{borderBottom:r?"none":"1px solid var(--theme-elevation-100)"},children:(0,t.jsxs)("div",{"data-testid":`${e}-slot-placeholder`,style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.5rem 0.75rem",backgroundColor:i,border:`1px dashed ${n}55`,borderLeft:"none",borderRight:"none"},children:[(0,t.jsx)("span",{"aria-hidden":"true",style:{minWidth:"1.5rem"}}),(0,t.jsx)("div",{"aria-hidden":"true",style:{width:"40px",height:"28px",borderRadius:"3px",border:`1px dashed ${n}80`,flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1,fontSize:"0.85rem",color:"var(--theme-elevation-500)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),(0,t.jsx)("span",{style:{fontSize:"0.7rem",padding:"0.15rem 0.4rem",borderRadius:"3px",backgroundColor:`${n}20`,color:n,flexShrink:0,minWidth:"50px",textAlign:"center"},children:a}),(0,t.jsx)("div",{"aria-hidden":"true",style:{width:"1rem",flexShrink:0}}),(0,t.jsx)("span",{"aria-hidden":"true",style:{width:"0.8rem",flexShrink:0}})]})})}function v({item:e,position:n,isLast:a}){let o=e.url&&e.url.startsWith("/")?e.url:null,l=e.title||"Untitled",[c,d]=(0,r.useState)(!1);return(0,t.jsx)("div",{style:{borderBottom:a?"none":"1px solid var(--theme-elevation-100)"},children:(0,t.jsxs)("div",{"data-testid":"related-preview-row",style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.5rem 0.75rem",backgroundColor:s.RELATED_ROW_BG},children:[(0,t.jsx)("span",{style:{minWidth:"1.5rem",fontSize:"0.8rem",color:"var(--theme-elevation-500)"},children:n}),e.thumbnail&&!c?(0,t.jsx)("div",{style:{width:"40px",height:"28px",borderRadius:"3px",overflow:"hidden",flexShrink:0},children:(0,t.jsx)(i.default,{src:e.thumbnail,alt:e.title??e.id,width:40,height:28,style:{width:"100%",height:"100%",objectFit:"cover"},onError:()=>d(!0)})}):(0,t.jsx)("div",{"aria-hidden":"true","data-testid":"related-thumb-fallback",style:{width:"40px",height:"28px",borderRadius:"3px",backgroundColor:`${s.RELATED_PURPLE}30`,flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1,fontSize:"0.85rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l}),null!==e.score?(0,t.jsx)("span",{style:{fontSize:"0.7rem",color:"var(--theme-elevation-500)",flexShrink:0},children:e.score.toFixed(3)}):null,(0,t.jsx)("span",{style:{fontSize:"0.7rem",padding:"0.15rem 0.4rem",borderRadius:"3px",backgroundColor:`${s.RELATED_PURPLE}20`,color:s.RELATED_PURPLE,flexShrink:0,minWidth:"50px",textAlign:"center"},children:"related"}),o?(0,t.jsx)("a",{href:o,target:"_blank",rel:"noopener noreferrer",style:{width:"1rem",flexShrink:0,fontSize:"0.75rem"},"aria-label":`Open ${l} in a new tab`,children:"↗"}):(0,t.jsx)("div",{"aria-hidden":"true",style:{width:"1rem",flexShrink:0}}),(0,t.jsx)("span",{"aria-hidden":"true",style:{width:"0.8rem",flexShrink:0}})]})})}function x({item:e,position:n,isLast:a}){let s=e.url&&e.url.startsWith("/")?e.url:null,[c,d]=(0,r.useState)(!1);return(0,t.jsx)("div",{style:{borderBottom:a?"none":"1px solid var(--theme-elevation-100)"},children:(0,t.jsxs)("div",{"data-testid":`local-preview-row-${e.id}`,style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.5rem 0.75rem",backgroundColor:l.LOCAL_ROW_BG},children:[(0,t.jsx)("span",{style:{fontSize:"0.8rem",color:"var(--theme-elevation-400)",minWidth:"1.5rem",textAlign:"right"},children:n}),e.thumbnail&&!c?(0,t.jsx)("div",{style:{width:"40px",height:"28px",borderRadius:"3px",overflow:"hidden",flexShrink:0},children:(0,t.jsx)(i.default,{src:e.thumbnail,alt:e.title??e.id,width:40,height:28,style:{width:"100%",height:"100%",objectFit:"cover"},onError:()=>d(!0)})}):(0,t.jsx)("div",{"aria-hidden":"true","data-testid":"local-thumb-fallback",style:{width:"40px",height:"28px",borderRadius:"3px",backgroundColor:`${l.LOCAL_BLUE}30`,flexShrink:0}}),(0,t.jsx)(o.ContentTypeBadge,{type:e.type??void 0,className:"shrink-0 text-[color:var(--theme-elevation-600)]",fallback:(0,t.jsx)("span",{className:"shrink-0 text-[color:var(--theme-elevation-400)]",title:`Unknown type: ${e.type??"none"}`,children:"?"})}),(0,t.jsx)("span",{style:{flex:1,fontSize:"0.9rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s?(0,t.jsx)("a",{href:s,target:"_blank",rel:"noreferrer",style:{color:"inherit",textDecoration:"none"},children:e.title??e.id}):e.title??e.id}),"number"==typeof e.score&&Number.isFinite(e.score)&&(0,t.jsx)("span",{title:"Semantic relevance to the row's search query",style:{fontSize:"0.75rem",color:"var(--theme-elevation-500)",flexShrink:0},children:e.score.toFixed(2)}),(0,t.jsx)("span",{style:{fontSize:"0.7rem",padding:"0.15rem 0.4rem",borderRadius:"3px",backgroundColor:`${l.LOCAL_BLUE}20`,color:l.LOCAL_BLUE,flexShrink:0,minWidth:"50px",textAlign:"center"},children:"local"}),(0,t.jsx)("div",{style:{width:"1rem",flexShrink:0,textAlign:"center"},children:s&&(0,t.jsx)("a",{href:s,target:"_blank",rel:"noreferrer",style:{fontSize:"0.8rem",color:"var(--theme-elevation-500)",textDecoration:"none"},title:"Open in new tab",children:"↗"})}),(0,t.jsx)("span",{"aria-hidden":"true",style:{width:"0.8rem",flexShrink:0}})]})})}function w({label:e,value:r}){return r?(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{style:{color:"var(--theme-elevation-500)",marginRight:"0.5rem"},children:[e,":"]}),(0,t.jsx)("span",{style:{wordBreak:"break-all"},children:r})]}):null}let k=g;e.s(["MergedContentViewer",0,g,"default",0,k],666933)},710746,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(747961);let i=({title:e,titleId:r,desc:n,descId:i,...a},o)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:o,"aria-labelledby":r,"aria-describedby":i,...a,children:[n?(0,t.jsx)("desc",{id:i,children:n}):null,void 0===e?(0,t.jsx)("title",{id:r,children:"Close"}):e?(0,t.jsx)("title",{id:r,children:e}):null,(0,t.jsx)("path",{fill:"currentColor",d:"M12.809 4.113a.652.652 0 1 0-.922-.922L8 7.078 4.113 3.19a.652.652 0 1 0-.922.922L7.078 8 3.19 11.887a.652.652 0 0 0 .922.922L8 8.922l3.887 3.887a.652.652 0 1 0 .922-.922L8.922 8z"})]}),a=(0,r.forwardRef)(i),o=r.default.forwardRef((e,r)=>(0,t.jsx)(n.BaseIcon,{ref:r,icon:a,...e}));o.displayName="Close",e.s(["Close",0,o])},862719,208047,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(747961);let i=({title:e,titleId:r,desc:n,descId:i,...a},o)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:o,"aria-labelledby":r,"aria-describedby":i,...a,children:[n?(0,t.jsx)("desc",{id:i,children:n}):null,void 0===e?(0,t.jsx)("title",{id:r,children:"Edit"}):e?(0,t.jsx)("title",{id:r,children:e}):null,(0,t.jsx)("g",{fill:"currentColor",children:(0,t.jsx)("path",{d:"M15 13.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5M12.7 4.5c.4-.4.4-1 0-1.4l-1.8-1.8c-.4-.4-1-.4-1.4 0L2.586 8.214A2 2 0 0 0 2 9.628V11a1 1 0 0 0 1 1h1.372a2 2 0 0 0 1.414-.586zM10.2 2 12 3.8l-1.5 1.5-1.8-1.8zM3 11V9.2l5-5L9.8 6l-5 5z"})})]}),a=(0,r.forwardRef)(i),o=r.default.forwardRef((e,r)=>(0,t.jsx)(n.BaseIcon,{ref:r,icon:a,...e}));o.displayName="Edit",e.s(["Edit",0,o],862719);let l=e=>{if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t},s=(e,t=new Date)=>{let r=l(e);return!!r&&r.getTime(){"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(862719),a=e.i(710746),o=e.i(37429),l=e.i(208047),s=e.i(957265);let c=e=>e?.sizes?.small?.url??e?.thumbnailURL??e?.url??null,d=e=>{if(!e||"object"!=typeof e)return null;if("relationTo"in e&&"value"in e){let{relationTo:t,value:r}=e;if(!r||"object"!=typeof r)return null;if("maps"===t){let{imageUrl:e}=r;return e?{url:e}:null}return"images"!==t?null:r}return e},u=["articles","videos","liveblogs","images"],h=["articles","videos","liveblogs"],f={_status:{in:["published","changed"]}},p=e=>"string"==typeof e||"number"==typeof e,m=e=>"string"==typeof e&&u.includes(e),g=e=>{if(null===e||"object"!=typeof e)return!1;let{relationTo:t,value:r}=e;return m(t)&&p(r)},b=e=>`${e.relationTo}:${e.value}`,y=(e,t,r)=>{let n=e.slice();if(t=n.length||r=n.length||t===r)return n;let[i]=n.splice(t,1);return n.splice(r,0,i),n},v=e=>{let t={articles:[],videos:[],liveblogs:[],images:[]};for(let r of e)t[r.relationTo].push(r.value);return t},x=e=>{let t=v(e);return Object.fromEntries(u.map(e=>{let r=t[e],n="images"===e?{}:f;return[e,r.length>0?{...n,id:{not_in:r}}:n]}))},w=(e,t)=>e?"images"===t?c(e):"videos"===t?c(d(e.content?.featuredImage))??e.content?.keyFrameImage??null:c(d(e.featuredImage)):null,k=e=>{if(!e)return null;let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let r=t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),n=t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});return`${r} ${n}`},S=e=>{let t=k(e);return t?`Published ${t}`:"Not Published"},C=(e,t)=>h.includes(t)?` – ${S(e)}`:"",_=e=>{let t=k(e);return t?` – Created ${t}`:""},j=(e,t,r=new Date)=>({title:e.title??e.name??e.assetName??"",status:(0,l.isPromotionExpired)(e.coreMetadata?.promotionExpireDate,r)?"expired":"images"===t?"published":e._status??void 0,thumbnailUrl:w(e,t),publishSuffix:"images"===t?_(e.createdAt):C(e.publishDate,t)}),N="inline-flex shrink-0 items-center justify-center rounded border-none bg-transparent p-2 text-[color:var(--theme-elevation-600)] hover:bg-[color:var(--theme-elevation-150)] disabled:cursor-not-allowed disabled:opacity-50",T="flex items-center gap-2 rounded border px-2.5 py-2.5 text-sm",E="border-[color:var(--theme-elevation-150)] bg-[color:var(--theme-input-bg)] hover:border-[color:var(--theme-elevation-300)] hover:bg-[color:var(--theme-elevation-100)]",A={draft:"border-[color:var(--theme-warning-250)] bg-[color:var(--theme-warning-50)] hover:border-[color:var(--theme-warning-500)] hover:bg-[color:var(--theme-warning-100)]",expired:"border-[color:var(--theme-error-250)] bg-[color:var(--theme-error-50)] hover:border-[color:var(--theme-error-500)] hover:bg-[color:var(--theme-error-100)]"},R=e=>`${T} ${(e?A[e]:void 0)??E}`,M=({index:e,relationTo:r,title:n,status:l,thumbnailUrl:c,publishSuffix:d="",disabled:u,canEdit:h,onEdit:f,onRemove:p,dragHandle:m,rootRef:g,style:b})=>(0,t.jsxs)("div",{ref:g,style:b,className:R(l),children:[(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-1 pr-1",children:[m,(0,t.jsx)("span",{className:"w-5 text-right text-[color:var(--theme-text)]",children:e+1})]}),(0,t.jsx)("div",{className:"ml-1 h-7 w-10 shrink-0 overflow-hidden rounded-sm bg-[color:var(--theme-elevation-100)]",children:c?(0,t.jsx)(o.default,{src:c,alt:"",width:40,height:28,style:{width:"100%",height:"100%",objectFit:"cover"},onError:e=>{e.currentTarget.style.display="none"}}):null}),(0,t.jsx)(s.StatusBadge,{status:l,className:"px-1"}),(0,t.jsx)(s.ContentTypeBadge,{type:r,className:"px-1"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate pl-1 text-[color:var(--theme-text)]",children:`${n}${d}`}),h&&(0,t.jsx)("button",{type:"button",onClick:f,disabled:u,className:`${N} hover:text-[color:var(--theme-elevation-1000)]`,title:"Edit","aria-label":`Edit ${n}`,children:(0,t.jsx)(i.Edit,{ariaHidden:!0,title:"",className:"pointer-events-none size-5 text-current"})}),(0,t.jsx)("button",{type:"button",onClick:p,disabled:u,className:`${N} hover:text-red-500`,title:"Remove","aria-label":`Remove ${n}`,children:(0,t.jsx)(a.Close,{ariaHidden:!0,title:"",className:"pointer-events-none size-5 text-current"})})]}),I={draft:!0,depth:1,limit:100},L={articles:["title","_status","publishDate","featuredImage","coreMetadata.promotionExpireDate"],videos:["title","_status","publishDate","content.featuredImage","content.keyFrameImage","content.aspectRatio","coreMetadata.promotionExpireDate"],liveblogs:["title","_status","publishDate","featuredImage","coreMetadata.promotionExpireDate"],images:[]},P=(e,t)=>{if(0===t.length)return"";let r=[...t].map(String).sort(),n=L[e].map(e=>`select${e.split(".").map(e=>`[${e}]`).join("")}=true`).join("&"),i=[`where[id][in]=${r.join(",")}`,n].filter(Boolean).join("&");return`/api/payload/${e}?${i}&`},D=({field:e,path:i})=>{let a=i??e.name,{value:o,setValue:l,disabled:s}=(0,n.useField)({path:a}),{permissions:c}=(0,n.useAuth)(),d=(0,r.useMemo)(()=>Array.isArray(o)?o.filter(g):[],[o]),h=(0,r.useMemo)(()=>v(d),[d]),[{data:f}]=(0,n.usePayloadAPI)(P("articles",h.articles),{initialParams:I}),[{data:w}]=(0,n.usePayloadAPI)(P("videos",h.videos),{initialParams:I}),[{data:k}]=(0,n.usePayloadAPI)(P("liveblogs",h.liveblogs),{initialParams:I}),[{data:S}]=(0,n.usePayloadAPI)(P("images",h.images),{initialParams:I}),C=(0,r.useMemo)(()=>{let e=new Map,t=new Date,r=(r,n)=>{let i=r?.docs;if(Array.isArray(i))for(let r of i)r?.id!=null&&e.set(b({relationTo:n,value:r.id}),j(r,n,t))};return r(f,"articles"),r(w,"videos"),r(k,"liveblogs"),r(S,"images"),e},[f,w,k,S]),[_,N]=(0,r.useState)({}),T=e=>{let t=b(e);return _[t]??C.get(t)};(0,r.useEffect)(()=>{N(e=>{let t=new Set(d.map(b)),r=Object.entries(e).filter(([e])=>t.has(e));return r.length===Object.keys(e).length?e:Object.fromEntries(r)})},[d]);let E=(0,r.useMemo)(()=>x(d),[d]),[A,,{openDrawer:R,closeDrawer:L}]=(0,n.useListDrawer)({collectionSlugs:[...u],filterOptions:E}),[D,O]=(0,r.useState)(null),F=(0,r.useRef)(null),[B,$]=(0,r.useState)(0),[U,,{openDrawer:z,isDrawerOpen:H}]=(0,n.useDocumentDrawer)({collectionSlug:D?.relationTo??"articles",id:D?String(D.value):void 0});(0,r.useEffect)(()=>{D&&z()},[D,z]),(0,r.useEffect)(()=>{H||O(null)},[H]);let W=(0,r.useCallback)(e=>{F.current=e,O(e),$(e=>e+1)},[]),V=(0,r.useCallback)(({doc:e})=>{let t=F.current;if(!t||e?.id==null)return;let r=b(t),n=j(e,t.relationTo);N(e=>({...e,[r]:{...n,thumbnailUrl:n.thumbnailUrl??e[r]?.thumbnailUrl??C.get(r)?.thumbnailUrl??null}}))},[C]),q=(0,r.useCallback)(e=>!!c?.collections?.[e]?.read,[c]),G=(0,r.useCallback)(({collectionSlug:e,doc:t})=>{L();let r=t?.id;if(!m(e)||!p(r))return;let n={relationTo:e,value:r},i=b(n);d.some(e=>b(e)===i)||l([...d,n])},[L,d,l]),K=(0,r.useCallback)(e=>{l(d.filter(t=>b(t)!==e))},[d,l]),Y=(0,r.useCallback)(({moveFromIndex:e,moveToIndex:t})=>{s||e!==t&&l(y(d,e,t))},[s,d,l]);return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsx)(n.FieldLabel,{label:e.label,path:a}),(0,t.jsx)(U,{onSave:V},`${D?b(D):"none"}-${B}`),d.length>0&&(0,t.jsx)(n.DraggableSortable,{ids:d.map(b),onDragEnd:Y,className:"mb-2 flex flex-col gap-1.5",children:d.map((e,r)=>{let i=b(e),a=T(e),o=a?.title||String(e.value);return(0,t.jsx)(n.DraggableSortableItem,{id:i,children:({attributes:l,listeners:c,setNodeRef:d,transform:u,transition:h,isDragging:f})=>(0,t.jsx)(M,{rootRef:d,style:{transform:u,transition:h,opacity:f?.5:void 0},index:r,relationTo:e.relationTo,title:o,status:a?.status,thumbnailUrl:a?.thumbnailUrl??null,publishSuffix:a?.publishSuffix??"",disabled:s,canEdit:q(e.relationTo),onEdit:()=>W(e),onRemove:()=>K(i),dragHandle:(0,t.jsx)("button",{type:"button",className:`inline-flex shrink-0 touch-none items-center border-none bg-transparent p-0 ${s?"cursor-not-allowed opacity-50":"cursor-grab"}`,"aria-label":`Reorder ${o}`,disabled:s,...s?{}:l,...s?{}:c,children:(0,t.jsx)(n.DragHandleIcon,{})})})},i)})}),(0,t.jsx)(n.Button,{buttonStyle:"secondary",size:"small",disabled:s,onClick:R,children:0===d.length?"Choose published content":"Add more"}),(0,t.jsx)(A,{allowCreate:!1,onSelect:G})]})},O=D;e.s(["CONTENT_COLLECTIONS",0,u,"ContentIdField",0,D,"ContentIdRowView",0,M,"PUBLISHED_WHERE",0,f,"arrayMove",0,y,"buildContentFetchUrl",0,P,"buildDrawerFilter",0,x,"default",0,O,"formatCreatedSuffix",0,_,"formatPublishDate",0,S,"formatPublishSuffix",0,C,"groupIdsByCollection",0,v,"isContentCollectionSlug",0,m,"isRelationshipItem",0,g,"itemKey",0,b,"mapDocToRow",0,j,"resolveThumbnailUrl",0,w],962191),e.i(962191);var F=l;e.s(["CONTENT_COLLECTIONS",0,u,"ContentIdField",0,D,"ContentIdRowView",0,M,"PUBLISHED_WHERE",0,f,"arrayMove",0,y,"buildContentFetchUrl",0,P,"buildDrawerFilter",0,x,"default",0,O,"formatCreatedSuffix",0,_,"formatPublishDate",0,S,"formatPublishSuffix",0,C,"groupIdsByCollection",0,v,"isContentCollectionSlug",0,m,"isPromotionExpired",()=>F.isPromotionExpired,"isRelationshipItem",0,g,"itemKey",0,b,"mapDocToRow",0,j,"resolveThumbnailUrl",0,w],450049)},1319,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);let i=e=>e.split("_")[0]??"",a=({type:e,exclude:n,onPick:i,placeholder:a})=>{let[o,l]=(0,r.useState)(""),[s,c]=(0,r.useState)([]),[d,u]=(0,r.useState)(!1),[h,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(!1),g=(0,r.useRef)(null);(0,r.useEffect)(()=>(g.current&&clearTimeout(g.current),o)?(g.current=setTimeout(async()=>{u(!0),f(null);try{let t=new URLSearchParams;t.set("where[type][equals]",e),t.set("where[name][like]",o),t.set("limit","20"),t.set("depth","0");let r=await fetch(`/api/payload/tags?${t.toString()}`,{credentials:"include"});if(!r.ok)throw Error(`HTTP ${r.status}`);let n=await r.json();c(n.docs??[])}catch(e){f(e instanceof Error?e.message:"search failed"),c([])}finally{u(!1)}},200),()=>{g.current&&clearTimeout(g.current)}):void c([]),[o,e]);let b=(0,r.useMemo)(()=>n?.length?s.filter(e=>!n.includes(e.id)):s,[s,n]);return(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("input",{type:"text",value:o,onChange:e=>{l(e.target.value),m(!0)},onFocus:()=>m(!0),onBlur:()=>setTimeout(()=>m(!1),150),placeholder:a,style:{width:"100%",padding:"6px 8px",border:"1px solid var(--theme-elevation-150)",borderRadius:4,background:"var(--theme-input-bg)",color:"var(--theme-text)",fontSize:14}}),p&&o&&(0,t.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:4,background:"var(--theme-elevation-50)",border:"1px solid var(--theme-elevation-150)",borderRadius:4,maxHeight:280,overflowY:"auto",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.08)"},children:[d&&(0,t.jsx)("div",{style:{padding:8},children:"Searching…"}),h&&(0,t.jsx)("div",{style:{padding:8,color:"var(--theme-error-500)"},children:h}),!d&&!h&&0===b.length&&(0,t.jsx)("div",{style:{padding:8,color:"var(--theme-elevation-500)"},children:"No matches."}),b.map(e=>(0,t.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),i(e),l(""),c([]),m(!1)},style:{display:"block",width:"100%",padding:"6px 8px",textAlign:"left",background:"transparent",border:"none",cursor:"pointer",color:"var(--theme-text)",fontSize:14},children:[e.name,e.versions?.length?(0,t.jsxs)("span",{style:{fontSize:11,marginLeft:8,color:"var(--theme-elevation-500)"},children:["v",e.versions.join(", v")]}):null]},e.id))]})]})},o=({version:e})=>(0,t.jsxs)("span",{style:{display:"inline-block",padding:"1px 6px",marginRight:4,borderRadius:3,fontSize:10,fontWeight:600,background:"1.0"===e?"var(--theme-elevation-100)":"var(--theme-success-100, #d1fadf)",color:"var(--theme-text)",border:"1px solid var(--theme-elevation-200)"},children:["v",e]}),l=({tag:e,onRemove:r})=>(0,t.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"3px 8px",marginRight:4,marginBottom:4,borderRadius:12,background:"var(--theme-elevation-50)",border:"1px solid var(--theme-elevation-150)",fontSize:12},children:[(e.versions??[]).map(e=>(0,t.jsx)(o,{version:e},e)),(0,t.jsx)("span",{children:e.name}),(0,t.jsx)("button",{type:"button","aria-label":`Remove ${e.name}`,onClick:r,style:{background:"transparent",border:"none",color:"var(--theme-elevation-500)",cursor:"pointer",padding:0,lineHeight:1,fontSize:14},children:"×"})]}),s=e=>e?.value,c=({field:e,path:o})=>{let c=o||e.name,{rows:d=[]}=(0,n.useField)({hasRows:!0,potentiallyStalePath:o}),{addFieldRow:u,removeFieldRow:h,dispatchFields:f}=(0,n.useForm)(),[p]=(0,n.useAllFormFields)(),{data:m}=(0,n.useDocumentInfo)(),[g,b]=(0,r.useState)(()=>{let e=new Map;for(let t of m?.analyticsTagMappings??[])for(let r of("object"==typeof t.analyticsTag&&t.analyticsTag&&e.set(t.analyticsTag.id,t.analyticsTag),t.iabTags??[]))"object"==typeof r&&r&&e.set(r.id,r);return e}),y=(0,r.useCallback)(e=>{b(t=>{if(t.has(e.id))return t;let r=new Map(t);return r.set(e.id,e),r})},[]),v=(0,r.useCallback)(e=>{b(t=>{let r=!1,n=new Map(t);for(let t of e)n.has(t.id)||(n.set(t.id,t),r=!0);return r?n:t})},[]),x=(0,r.useMemo)(()=>d.map((e,t)=>{let r=s(p[`${c}.${t}.analyticsTag`]),n=s(p[`${c}.${t}.iabTags`]),i="string"==typeof r?r:r?.id??"",a=(n??[]).map(e=>"string"==typeof e?e:e?.id??"");return{rowId:e.id,analyticsTagId:i,iabTagIds:a}}),[d,p,c]),w=(0,r.useMemo)(()=>x.map(e=>e.analyticsTagId).filter(Boolean),[x]);(0,r.useEffect)(()=>{let e=new Set;for(let t of x)for(let r of(t.analyticsTagId&&e.add(t.analyticsTagId),t.iabTagIds))e.add(r);let t=Array.from(e).filter(e=>!g.has(e));if(0===t.length)return;let r=new URLSearchParams;r.set("where[id][in]",t.join(",")),r.set("limit",String(t.length)),r.set("depth","0");let n=!1;return fetch(`/api/payload/tags?${r.toString()}`,{credentials:"include"}).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{n||v(e.docs??[])}).catch(()=>{}),()=>{n=!0}},[x,g,v]);let[k,S]=(0,r.useState)(!1),[C,_]=(0,r.useState)(null),[j,N]=(0,r.useState)([]),[T,E]=(0,r.useState)(null),A=(0,r.useCallback)(()=>{S(!1),_(null),N([]),E(null)},[]),R=(0,r.useCallback)(()=>{if(!C)return void E("Pick an Analytics Tag first.");if("analyticsTag"!==C.type)return void E(`"${C.name}" is type "${C.type}" — Analytics Tag column requires type "analyticsTag".`);let e=j.find(e=>"iabTags"!==e.type);if(e)return void E(`"${e.name}" is type "${e.type}" — IAB Tags column requires type "iabTags".`);if(w.includes(C.id))return void E(`"${C.name}" is already mapped — edit the existing row instead.`);for(let e of(y(C),j))y(e);let t=d.length;u({path:c,schemaPath:c,rowIndex:t}),f({type:"UPDATE",path:`${c}.${t}.analyticsTag`,value:C.id}),f({type:"UPDATE",path:`${c}.${t}.iabTags`,value:j.map(e=>e.id)}),A()},[C,j,w,d.length,c,u,f,y,A]),M=(0,r.useCallback)(e=>{h({path:c,rowIndex:e})},[c,h]),I=(0,r.useCallback)((e,t)=>{let r=x[e]?.iabTagIds??[];f({type:"UPDATE",path:`${c}.${e}.iabTags`,value:r.filter((e,r)=>r!==t)})},[x,c,f]),L=(0,r.useCallback)((e,t)=>{if("iabTags"!==t.type)return;let r=x[e]?.iabTagIds??[];r.includes(t.id)||(y(t),f({type:"UPDATE",path:`${c}.${e}.iabTags`,value:[...r,t.id]}))},[x,c,f,y]),[P,D]=(0,r.useState)(""),O=(0,r.useMemo)(()=>{if(!P.trim())return x.map((e,t)=>t);let e=P.toLowerCase();return x.map((t,r)=>{let n=g.get(t.analyticsTagId);return n?.name?.toLowerCase().includes(e)?r:-1}).filter(e=>e>=0)},[x,P,g]),F={padding:"8px 10px",borderBottom:"1px solid var(--theme-elevation-100)",verticalAlign:"top"};return(0,t.jsxs)("div",{style:{marginBottom:24},children:[(0,t.jsx)(n.FieldLabel,{label:"string"==typeof e.label?e.label:"Mappings",path:o||e.name}),e.admin?.description&&(0,t.jsx)("p",{style:{fontSize:12,color:"var(--theme-elevation-500)",margin:"4px 0 12px"},children:"string"==typeof e.admin.description?e.admin.description:""}),(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8,gap:12},children:[(0,t.jsx)("input",{type:"text",value:P,onChange:e=>D(e.target.value),placeholder:`Filter ${x.length} mapping${1===x.length?"":"s"} by analytics tag name…`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--theme-elevation-150)",borderRadius:4,background:"var(--theme-input-bg)",color:"var(--theme-text)",fontSize:14}}),(0,t.jsx)("button",{type:"button",onClick:()=>S(!k),style:{padding:"6px 12px",border:"1px solid var(--theme-elevation-200)",borderRadius:4,background:k?"var(--theme-elevation-100)":"var(--theme-success-500, #008558)",color:k?"var(--theme-text)":"#fff",cursor:"pointer",fontSize:14,fontWeight:500},children:k?"Cancel":"+ Add Mapping"})]}),k&&(0,t.jsxs)("div",{style:{padding:12,marginBottom:8,border:"1px solid var(--theme-elevation-200)",borderRadius:4,background:"var(--theme-elevation-50)"},children:[(0,t.jsxs)("div",{style:{marginBottom:8},children:[(0,t.jsx)("label",{style:{display:"block",fontSize:12,fontWeight:600,marginBottom:4},children:"Analytics Tag"}),C?(0,t.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:8,padding:"4px 8px",border:"1px solid var(--theme-elevation-200)",borderRadius:4,background:"var(--theme-elevation-100)"},children:[(0,t.jsx)("strong",{children:C.name}),(0,t.jsx)("button",{type:"button","aria-label":"Clear analytics tag",onClick:()=>_(null),style:{background:"transparent",border:"none",cursor:"pointer",color:"var(--theme-elevation-500)"},children:"×"})]}):(0,t.jsx)(a,{type:"analyticsTag",exclude:w,placeholder:"Search analytics tags by name…",onPick:e=>{_(e),E(null)}})]}),(0,t.jsxs)("div",{style:{marginBottom:8},children:[(0,t.jsx)("label",{style:{display:"block",fontSize:12,fontWeight:600,marginBottom:4},children:"IAB Tags"}),(0,t.jsx)("div",{style:{marginBottom:6},children:j.map(e=>(0,t.jsx)(l,{tag:e,onRemove:()=>N(j.filter(t=>t.id!==e.id))},e.id))}),(0,t.jsx)(a,{type:"iabTags",exclude:j.map(e=>e.id),placeholder:"Search IAB tags by name…",onPick:e=>N([...j,e])})]}),T&&(0,t.jsx)("div",{style:{color:"var(--theme-error-500)",fontSize:13,marginBottom:8},children:T}),(0,t.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,t.jsx)("button",{type:"button",onClick:R,disabled:!C,style:{padding:"6px 12px",border:"1px solid var(--theme-elevation-200)",borderRadius:4,background:C?"var(--theme-success-500, #008558)":"var(--theme-elevation-100)",color:C?"#fff":"var(--theme-elevation-400)",cursor:C?"pointer":"not-allowed",fontSize:14,fontWeight:500},children:"Save Mapping"}),(0,t.jsx)("button",{type:"button",onClick:A,style:{padding:"6px 12px",border:"1px solid var(--theme-elevation-200)",borderRadius:4,background:"transparent",color:"var(--theme-text)",cursor:"pointer",fontSize:14},children:"Cancel"})]})]}),0===x.length?(0,t.jsxs)("div",{style:{padding:24,textAlign:"center",color:"var(--theme-elevation-500)",background:"var(--theme-elevation-50)",border:"1px dashed var(--theme-elevation-200)",borderRadius:4},children:["No mappings yet. Click ",(0,t.jsx)("strong",{children:"+ Add Mapping"})," to start."]}):(0,t.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13,border:"1px solid var(--theme-elevation-150)"},children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{style:{background:"var(--theme-elevation-100)",textAlign:"left"},children:[(0,t.jsx)("th",{style:{...F,width:"20%"},children:"Analytics Tag"}),(0,t.jsx)("th",{style:{...F,width:"60%"},children:"IAB Tags"}),(0,t.jsx)("th",{style:{...F,width:"12%"},children:"iabcId"}),(0,t.jsx)("th",{style:{...F,width:"8%"}})]})}),(0,t.jsxs)("tbody",{children:[0===O.length&&P&&(0,t.jsx)("tr",{children:(0,t.jsxs)("td",{colSpan:4,style:{...F,textAlign:"center",color:"var(--theme-elevation-500)"},children:['No mappings match "',P,'".']})}),O.map(e=>{let r=x[e];if(!r)return null;let n=g.get(r.analyticsTagId),o=r.iabTagIds.map(e=>g.get(e)).filter(e=>!!e),s=o[0]?.name??"";return(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{style:F,children:n?.name??(0,t.jsx)("span",{style:{color:"var(--theme-error-500)",fontStyle:"italic"},children:"(unresolved)"})}),(0,t.jsxs)("td",{style:F,children:[(0,t.jsx)("div",{style:{marginBottom:4},children:o.map((r,n)=>(0,t.jsx)(l,{tag:r,onRemove:()=>I(e,n)},r.id))}),(0,t.jsx)(a,{type:"iabTags",exclude:o.map(e=>e.id),placeholder:"+ Add IAB tag…",onPick:t=>L(e,t)})]}),(0,t.jsx)("td",{style:F,children:(0,t.jsx)("code",{style:{fontSize:12},children:s?i(s):"—"})}),(0,t.jsx)("td",{style:F,children:(0,t.jsx)("button",{type:"button","aria-label":`Remove mapping for ${n?.name??"row"}`,onClick:()=>M(e),style:{background:"transparent",border:"1px solid var(--theme-elevation-200)",borderRadius:4,padding:"4px 8px",color:"var(--theme-error-500)",cursor:"pointer",fontSize:12},children:"Remove"})})]},r.rowId)})]})]})]})};e.s(["IabMappingTable",0,c])},813395,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(961123),a=e.i(553329),o=e.i(695881),l=e.i(878367);let s=(0,o.createLogger)("payload:RecreateRegionButton"),c="/api/payload/v1/snowcast/generate-skeleton",d=new Set(["failed","skipped"]),u=({path:e})=>{let{user:o}=(0,n.useAuth)(),u=(0,i.useRouter)(),[h,f]=(0,r.useState)(!1),p=(0,r.useMemo)(()=>e?e.split(".").slice(0,-1).join("."):"",[e]),{regionSlug:m,outcome:g,contentState:b}=(0,n.useFormFields)(([e])=>({regionSlug:e[`${p}.regionSlug`]?.value,outcome:e[`${p}.outcome`]?.value,contentState:e[`${p}.contentState`]?.value})),y=(0,r.useMemo)(()=>(0,l.checkPermission)(o??null,"articles","edit"),[o]),v=(0,r.useCallback)(async()=>{if(!m)return;f(!0);let e=n.toast.loading(`Recreating ${m}…`);try{let e=new URLSearchParams({region:m});"skeleton"===b&&e.set("populate","false");let{data:t,error:r}=await (0,a.tryCatch)(fetch(`${c}?${e.toString()}`,{method:"POST",credentials:"include"}));if(r||!t)return void n.toast.error("Could not reach the server",{description:"Check your connection and try again."});let{data:i}=await (0,a.tryCatch)(t.json());if(!t.ok||i?.success!==!0)return void n.toast.error(`Could not recreate ${m}`,{description:i?.message??i?.error??"The region was not recreated. Please try again."});n.toast.success(`Recreated ${m}`,{description:"deduped"===i.outcome?"An article for this region already existed and was reused.":void 0}),u.refresh()}finally{n.toast.dismiss(e),f(!1)}},[b,m,u]);return y&&m&&g&&d.has(g)?(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(n.Button,{buttonStyle:"secondary",disabled:h,margin:!1,onClick:()=>{v().catch(e=>{s.error("Recreate failed unexpectedly",e)})},size:"small",children:h?"Recreating…":`Recreate ${m}`})}):null};e.s(["RecreateRegionButton",0,u])},464067,e=>{"use strict";var t=e.i(699173),r=e.i(541686);let n=Object.freeze({created:"var(--theme-success-500)",deduped:"var(--theme-elevation-500)",skipped:"var(--theme-warning-500)",failed:"var(--theme-error-500)"}),i="var(--theme-text)";function a(e){return e?n[e]??i:i}let o=()=>{let{data:e,rowNumber:n}=(0,r.useRowLabel)(),i=e?.regionSlug,o=e?.outcome;return i?(0,t.jsxs)("span",{children:[i,o?(0,t.jsxs)(t.Fragment,{children:[" — ",(0,t.jsx)("span",{style:{color:a(o),fontWeight:600},children:o})]}):null]}):(0,t.jsxs)("span",{children:["Region ",String((n??0)+1).padStart(2,"0")]})};e.s(["SnowcastRegionStatusRowLabel",0,o],464067)},818969,e=>{"use strict";var t=e.i(699173);let r=(0,e.i(301857).default)(()=>e.A(256717).then(e=>e.CoverageMapInner),{loadableGenerated:{modules:[150964]},ssr:!1,loading:()=>null}),n=({circles:e,loading:n,emptyHint:i,summary:a,warning:o})=>(0,t.jsxs)("div",{className:"wx-bg-map",children:[(0,t.jsx)("div",{className:"wx-bg-map__label",children:"Coverage preview"}),(0,t.jsxs)("div",{className:"wx-bg-map__canvas",children:[(0,t.jsx)("div",{className:"wx-bg-map__surface",children:(0,t.jsx)(r,{circles:e})}),(0,t.jsxs)("div",{className:"wx-bg-legend","aria-hidden":"true",children:[(0,t.jsxs)("span",{className:"wx-bg-legend__item",children:[(0,t.jsx)("span",{className:"wx-bg-legend__swatch wx-bg-legend__swatch--priority"}),"Priority"]}),(0,t.jsxs)("span",{className:"wx-bg-legend__item",children:[(0,t.jsx)("span",{className:"wx-bg-legend__swatch wx-bg-legend__swatch--standard"}),"Standard"]})]})]}),n?(0,t.jsx)("p",{className:"wx-bg-map__hint",children:"Loading…"}):0===e.length?(0,t.jsx)("p",{className:"wx-bg-map__hint",children:i}):a?(0,t.jsx)("p",{className:"wx-bg-map__hint",children:a}):null,o?(0,t.jsx)("p",{className:"wx-bg-map__warning",role:"status","aria-live":"polite",children:o}):null,(0,t.jsx)("p",{className:"wx-bg-map__credit",children:"© Mapbox · OpenStreetMap"})]});e.s(["CoverageMap",0,n])},430673,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(265055),i=e.i(541686),a=e.i(695881),o=e.i(553329),l=e.i(818969),s=e.i(461998);let c=(0,a.createLogger)("WeatherBackgroundMap"),d=()=>{let{config:e}=(0,n.useConfig)(),{id:a}=(0,i.useDocumentInfo)(),[d,u]=(0,r.useState)([]),[h,f]=(0,r.useState)([]),[p,m]=(0,r.useState)(!1),g=(0,i.useFormFields)(([e])=>(0,s.extractTagIds)(e.tags?.value).join(",")),b=(0,i.useFormFields)(([e])=>Number(e.radiusMiles?.value)||0),y=(0,i.useFormFields)(([e])=>Number(e.code?.value)||0),v=(0,i.useFormFields)(([e])=>e.name?.value??""),x=(0,i.useFormFields)(([e])=>{let t=e.dayPart?.value;return"night"===t?"night":"both"===t?"both":"day"}),w=(0,i.useFormFields)(([e])=>!!e.priority?.value);(0,r.useEffect)(()=>{let t=!1,r=g?g.split(",").filter(Boolean):[];if(0===r.length){u([]),f([]);return}let n=`${e.serverURL??""}${e.routes?.api??"/api"}`;return m(!0),Promise.all(r.map(async e=>{let{data:t,error:r}=await (0,o.tryCatch)(fetch(`${n}/tags/${e}?depth=0`,{credentials:"include"}));if(r||!t?.ok)return c.warn("Could not resolve location tag for coverage preview",{tagId:e,status:t?.status??null,error:r}),null;let{data:i,error:a}=await (0,o.tryCatch)(t.json());return a?(c.warn("Could not parse location tag for coverage preview",{tagId:e,error:a}),null):{point:(0,s.parseLocationTagDoc)(i),missing:(0,s.locationTagMissingPoint)(i)}})).then(e=>{t||(u(e.map(e=>e?.point??null).filter(e=>null!==e)),f(e.map(e=>e?.missing??null).filter(e=>null!==e)),m(!1))}),()=>{t=!0}},[g,e]);let k=(0,r.useMemo)(()=>d.map(e=>({id:`${a??"doc"}:${e.id}`,docId:a?String(a):"",title:v,name:e.name,lat:e.lat,lng:e.lng,radiusMiles:b,code:y,dayPart:x,priority:w})),[d,b,y,v,x,w,a]);return(0,t.jsx)(l.CoverageMap,{circles:k,loading:p,emptyHint:"Attach a location tag to preview where this video is served.",warning:(0,s.missingPointWarning)(h),summary:d.length>0?`${d.length} location${d.length>1?"s":""} \xb7 ${b} mi radius`:void 0})};e.s(["WeatherBackgroundMap",0,d])},579909,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(265055),i=e.i(818969),a=e.i(461998);let o=1e3,l=()=>{let{config:e}=(0,n.useConfig)(),[l,s]=(0,r.useState)([]),[c,d]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{let t=!1,r=`${e.serverURL??""}${e.routes?.api??"/api"}`;return(async()=>{d(!0);try{let e=await fetch(`${r}/weather-backgrounds?depth=0&limit=${o}`,{credentials:"include"});if(!e.ok){t||s([]);return}let n=await e.json(),i=(Array.isArray(n?.docs)?n.docs:[]).map(e=>{let t=e;return{id:String(t.id),name:"string"==typeof t.name?t.name:"",radiusMiles:Number(t.radiusMiles)||0,code:Number(t.code)||0,dayPart:"night"===t.dayPart?"night":"both"===t.dayPart?"both":"day",priority:!!t.priority,tagIds:(0,a.extractTagIds)(t.tags)}}),l=[...new Set(i.flatMap(e=>e.tagIds))],c=new Map;await Promise.all(l.map(async e=>{try{let t=await fetch(`${r}/tags/${e}?depth=0`,{credentials:"include"});if(!t.ok)return;let n=(0,a.parseLocationTagDoc)(await t.json());n&&c.set(e,n)}catch{}})),t||s((0,a.buildCoverageCircles)(i,c))}catch{t||s([])}finally{t||d(!1)}})(),()=>{t=!0}},[e]),(0,t.jsx)(i.CoverageMap,{circles:l,loading:c,emptyHint:"No location-targeted backgrounds yet.",summary:l.length>0?`${l.length} location-targeted background${l.length>1?"s":""}`:void 0})};e.s(["WeatherBackgroundsListMap",0,l])},359133,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(995334);function i({ok:e,summary:r}){return(0,t.jsxs)("span",{style:{marginLeft:"6px",fontWeight:400,color:e?"var(--theme-elevation-500)":"var(--theme-warning-500)"},children:["· ",r]})}let a=({queryTypeLabel:e,contentType:a,tagRows:o,authorNames:l,detail:s,trendingStatus:c})=>{if(void 0!==o){let i=l??[],s=o.length>0||i.length>0;return(0,t.jsxs)("span",{children:[(0,t.jsx)("strong",{children:e})," - ",a??"All",s?" ":" (no filters)",o.map((e,i)=>(0,t.jsxs)(r.default.Fragment,{children:[i>0&&" AND ","(",e.map((e,i)=>(0,t.jsxs)(r.default.Fragment,{children:[i>0&&" OR ",e.type&&(0,n.isTagType)(e.type)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.TagTypeBadge,{type:e.type,size:"sm"})," "]}),e.name]},i)),")"]},i)),i.length>0&&(0,t.jsxs)(t.Fragment,{children:[o.length>0&&" AND ","(by ",i.map((e,n)=>(0,t.jsxs)(r.default.Fragment,{children:[n>0&&" OR ",e]},n)),")"]})]})}return(0,t.jsxs)("span",{children:[(0,t.jsx)("strong",{children:e}),s?` - ${s}`:"",c&&(0,t.jsx)(i,{...c})]})};e.s(["QueriesRowLabelClient",0,a])},49494,e=>{"use strict";var t=e.i(699173),r=e.i(541686);let n=()=>{let{data:e,rowNumber:n}=(0,r.useRowLabel)(),i=e?.label?.trim();if(i)return(0,t.jsx)("span",{children:i});let a=e?.sourceType==="local"?"Local":e?.sourceType==="search"?"Search":e?.sourceType==="contentQuery"?"Content Query":"Source";return(0,t.jsx)("span",{children:`${a} ${n??1}`})};e.s(["ContentSyndicationSourceRowLabel",0,n])},671574,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);let i=({field:e,path:i})=>{let{label:a,name:o}=e,{value:l,setValue:s}=(0,n.useField)({path:i||o}),[c,d]=(0,r.useState)([]),[u,h]=(0,r.useState)(""),[f,p]=(0,r.useState)(!1),[m,g]=(0,r.useState)(null),[b,y]=(0,r.useState)(1),[v,x]=(0,r.useState)(0),[w]=(0,r.useState)(50),[k,S]=(0,r.useState)(1),[C,_]=(0,r.useState)(!1),[j,N]=(0,r.useState)(!1),T=(0,r.useCallback)(async(e,t)=>{p(!0),g(null);try{let r=new URLSearchParams({page:e.toString(),limit:w.toString()});t&&t.trim()&&(r.append("search",t.trim()),r.append("caseInsensitive","true"),r.append("searchById","true"));let n=await fetch(`/api/payload/v1/kalliope/cmqs/all?${r.toString()}`,{next:{revalidate:3600,tags:["kalliope-cmqs"]}});if(!n.ok)throw Error(`Error fetching CMQs: ${n.status} ${n.statusText}`);let i=await n.json();if(!i.data){console.debug("Unexpected API response format:",i),d([]),x(0),S(1),_(!1),N(!1);return}d(i.data);let a=i.meta?.count!==void 0?i.meta.count:i.data.length;x(a);let o=Math.max(1,Math.ceil(a/w));S(o),_(!!i.links.next||e1),console.debug("Pagination data:",{totalItems:a,totalPages:o,currentPage:e,hasNext:!!i.links.next||e1})}catch(e){console.debug("Error fetching CMQs:",e),g(e instanceof Error?e.message:"Failed to fetch CMQs")}finally{p(!1)}},[w]),[E,A]=(0,r.useState)(u);(0,r.useEffect)(()=>{let e=setTimeout(()=>{A(u.trim()),y(1)},300);return()=>clearTimeout(e)},[u]);let R=(0,r.useMemo)(()=>(e,t)=>{T(e,t)},[T]);(0,r.useEffect)(()=>{R(b,E)},[b,E,R]);let M=(0,r.useMemo)(()=>c.map(e=>{let t=e.attributes?.title||"Untitled",r=e.attributes?.drupal_internal__nid,n=r?`NID: ${r} | ${e.id}`:e.id;return{label:`${t} (${n})`,value:e.id}}),[c]),I=e=>{e>=1&&e{h(e.target.value)}}),f&&(0,t.jsx)("div",{className:"loading-state",children:"Loading CMQs..."}),m&&(0,t.jsxs)("div",{className:"error-state",children:["Error: ",m]}),!f&&!m&&(0,t.jsxs)(t.Fragment,{children:[0===M.length&&(0,t.jsxs)("div",{className:"no-results",children:['No CMQs found matching "',u,'"']}),(0,t.jsx)(n.SelectInput,{path:i||o,value:l,name:o,options:M,isClearable:!0,className:"py-5",onChange:e=>{e?Array.isArray(e)?s(""):s(e.value||""):s("")}}),v>0&&(0,t.jsxs)("div",{className:"pagination mt-4 flex items-center justify-between",children:[(0,t.jsx)("div",{className:"text-sm text-gray-500",children:v>0?(0,t.jsxs)(t.Fragment,{children:["Showing"," ",Math.min((b-1)*w+1,v)," -"," ",Math.min(b*w,v)," of ",v," ","CMQs"]}):(0,t.jsx)(t.Fragment,{children:"No results found"})}),k>1&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>I(1),disabled:1===b,className:"rounded border px-2 py-1 disabled:opacity-50",children:"First"}),(0,t.jsx)("button",{type:"button",onClick:()=>I(b-1),disabled:!j,className:"rounded border px-2 py-1 disabled:opacity-50",children:"Previous"}),(0,t.jsxs)("span",{className:"px-2 py-1",children:["Page ",b," of ",k]}),(0,t.jsx)("button",{type:"button",onClick:()=>I(b+1),disabled:!C,className:"rounded border px-2 py-1 disabled:opacity-50",children:"Next"}),(0,t.jsx)("button",{type:"button",onClick:()=>I(k),disabled:b===k,className:"rounded border px-2 py-1 disabled:opacity-50",children:"Last"})]})]})]})]})};e.s(["KalliopeCMQSSelect",0,i])},793210,e=>{"use strict";var t=e.i(699173),r=e.i(680852),n=e.i(541686);let i=({path:e})=>{let[i]=(0,n.useAllFormFields)(),a=i[e]?.rows;if(!a?.length)return null;let o=a.map(e=>{let t=e.lastRenderedPath,r=i[`${t}.src`]?.value,n=i[`${t}.variant`]?.value;return r?{src:r,variant:n}:null}).filter(Boolean);return 0===o.length?null:(0,t.jsxs)("div",{className:"flex flex-col flex-wrap gap-2",children:[(0,t.jsx)("span",{className:"text-md text-white-500 mr-2 shrink-0",children:"Src Set"}),(0,t.jsx)("div",{className:"flex flex-wrap",children:o.map(({src:e,variant:n},i)=>(0,t.jsxs)("div",{className:"mr-2 flex flex-col items-center",children:[(0,t.jsx)(r.default,{src:e,alt:n??`image-${i}`,width:100,height:100,style:{objectFit:"cover",maxWidth:100,maxHeight:100},onError:e=>{e.currentTarget.style.display="none"}}),n&&(0,t.jsx)("div",{className:"ml-1 truncate text-xs text-gray-500",children:n})]},i))})]})},a=i;e.s(["SrcSetPreview",0,i,"default",0,a])},563926,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(878367);let a=()=>{let{user:e}=(0,n.useAuth)(),{id:a}=(0,n.useDocumentInfo)(),[o,l]=(0,r.useState)(!1),[s,c]=(0,r.useState)(!1),d=o||s,u=(0,i.checkPermission)(e??null,"content-queries","edit"),h=(0,i.checkPermission)(e??null,"content-queries","admin"),f=(0,r.useCallback)(async()=>{l(!0);try{let e=await fetch(`/api/payload/v1/content-queries/${a}/clear-lock`,{method:"POST",credentials:"include"}),t=await e.json();t.success?(n.toast.success("Lock cleared"),window.location.reload()):n.toast.error(t.error||"Failed to clear lock",{duration:1/0,closeButton:!0})}catch{n.toast.error("Failed to clear lock",{duration:1/0,closeButton:!0})}finally{l(!1)}},[a]),p=(0,r.useCallback)(async()=>{c(!0);try{let e=await fetch(`/api/payload/v1/content-queries/${a}/force-update`,{method:"POST",credentials:"include"}),t=await e.json();t.success?(n.toast.success(t.message),window.location.reload()):n.toast.error(t.error||"Failed to force update",{duration:1/0,closeButton:!0})}catch{n.toast.error("Failed to force update",{duration:1/0,closeButton:!0})}finally{c(!1)}},[a]);return a&&u?(0,t.jsx)("div",{className:"field-type ui read-only",children:(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:"8px"},children:[(0,t.jsx)("button",{type:"button",className:"btn btn--style-primary btn--size-medium",style:{width:"33%"},onClick:p,disabled:d,children:s?"Updating...":"Force Update"}),h&&(0,t.jsx)("button",{type:"button",className:"btn btn--style-primary btn--size-medium",style:{width:"33%"},onClick:f,disabled:d,children:o?"Clearing...":"Clear Lock"})]})}):null};e.s(["AdminActionsField",0,a])},381477,895711,66396,676037,527983,354622,78160,582853,e=>{"use strict";var t=e.i(592121),r=e.i(33347),n=t;let i=0,a=1,o=2,l=3;e.s(["ERROR_REVALIDATE_EVENT",0,l,"FOCUS_EVENT",0,i,"MUTATE_EVENT",0,o,"RECONNECT_EVENT",0,a],966341);var s=e.i(359394);let c=new WeakMap,d=()=>{},u=d(),h=Object,f=e=>e===u,p=e=>"function"==typeof e,m=(e,t)=>({...e,...t}),g=e=>p(e.then),b={},y={},v="undefined",x=typeof window!=v,w=typeof document!=v,k=x&&"Deno"in window,S=()=>x&&typeof window.requestAnimationFrame!=v,C=(e,t)=>{let r=c.get(e);return[()=>!f(t)&&e.get(t)||b,n=>{if(!f(t)){let i=e.get(t);t in y||(y[t]=i),r[5](t,m(i,n),i||b)}},r[6],()=>!f(t)&&t in y?y[t]:!f(t)&&e.get(t)||b]},_=!0,j=()=>_,[N,T]=x&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[d,d],E={isOnline:j,isVisible:()=>{let e=w&&document.visibilityState;return f(e)||"hidden"!==e}},A={initFocus:e=>(w&&document.addEventListener("visibilitychange",e),N("focus",e),()=>{w&&document.removeEventListener("visibilitychange",e),T("focus",e)}),initReconnect:e=>{let t=()=>{_=!0,e()},r=()=>{_=!1};return N("online",t),N("offline",r),()=>{T("online",t),T("offline",r)}}},R=!n.default.useId,M=!x||k,I=e=>S()?window.requestAnimationFrame(e):setTimeout(e,1),L=M?n.useEffect:n.useLayoutEffect,P="u">typeof navigator&&navigator.connection,D=!M&&P&&(["slow-2g","2g"].includes(P.effectiveType)||P.saveData),O=new WeakMap,F=e=>h.prototype.toString.call(e),B=(e,t)=>e===`[object ${t}]`,$=0,U=e=>{let t,r,n=typeof e,i=F(e),a=B(i,"Date"),o=B(i,"RegExp"),l=B(i,"Object");if(h(e)!==e||a||o)t=a?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=O.get(e))return t;if(t=++$+"~",O.set(e,t),Array.isArray(e)){for(r=0,t="@";r{if(p(e))try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?U(e):"",t]},H=0,W=()=>++H;async function V(...e){let[t,r,n,i]=e,a=m({populateCache:!0,throwOnError:!0},"boolean"==typeof i?{revalidate:i}:i||{}),l=a.populateCache,s=a.rollbackOnError,d=a.optimisticData,h=e=>"function"==typeof s?s(e):!1!==s,b=a.throwOnError;if(p(r)){let e=r,n=[];for(let r of t.keys())!/^\$(inf|sub)\$/.test(r)&&e(t.get(r)._k)&&n.push(r);return Promise.all(n.map(y))}return y(r);async function y(r){let i,[s]=z(r);if(!s)return;let[m,y]=C(t,s),[v,x,w,k]=c.get(t),S=()=>{let e=v[s];return(p(a.revalidate)?a.revalidate(m().data,r):!1!==a.revalidate)&&(delete w[s],delete k[s],e&&e[0])?e[0](o).then(()=>m().data):m().data};if(e.length{i=e,j=!0}),N!==x[s][0]){if(j)throw i;return _}j&&T&&h(i)&&(l=!0,y({data:M,_c:u}))}if(l&&!j&&(p(l)?y({data:l(_,M),error:u,_c:u}):y({data:_,error:u,_c:u})),x[s][1]=W(),Promise.resolve(S()).then(()=>{y({_c:u})}),j){if(b)throw i;return}return _}}let q=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},G=(e,t)=>{if(!c.has(e)){let r=m(A,t),n=Object.create(null),o=V.bind(u,e),l=d,s=Object.create(null),h=(e,t)=>{let r=s[e]||[];return s[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},f=(t,r,n)=>{e.set(t,r);let i=s[t];if(i)for(let e of i)e(r,n)},p=()=>{if(!c.has(e)&&(c.set(e,[n,Object.create(null),Object.create(null),Object.create(null),o,f,h]),!M)){let t=r.initFocus(setTimeout.bind(u,q.bind(u,n,i))),o=r.initReconnect(setTimeout.bind(u,q.bind(u,n,a)));l=()=>{t&&t(),o&&o(),c.delete(e)}}};return p(),[e,o,p,l]}return[e,c.get(e)[4]]},K=(e,t,r,n,i)=>{let a=r.errorRetryCount,o=i.retryCount,l=~~((Math.random()+.5)*(1a))&&setTimeout(n,l,i)},Y=s.dequal,[J,Z]=G(new Map),X=m({onLoadingSlow:d,onSuccess:d,onError:d,onErrorRetry:K,onDiscarded:d,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:D?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:D?5e3:3e3,compare:Y,isPaused:()=>!1,cache:J,mutate:Z,fallback:{}},E),Q=(e,t)=>{let r=m(e,t);if(t){let{use:n,fallback:i}=e,{use:a,fallback:o}=t;n&&a&&(r.use=n.concat(a)),i&&o&&(r.fallback=m(i,o))}return r},ee=(0,n.createContext)({}),et=e=>{let{value:t}=e,r=(0,n.useContext)(ee),i=p(t),a=(0,n.useMemo)(()=>i?t(r):t,[i,r,t]),o=(0,n.useMemo)(()=>i?a:Q(r,a),[i,r,a]),l=a&&a.provider,s=(0,n.useRef)(u);l&&!s.current&&(s.current=G(l(o.cache||J),a));let c=s.current;return c&&(o.cache=c[0],o.mutate=c[1]),L(()=>{if(c)return c[2]&&c[2](),c[3]},[]),(0,n.createElement)(ee.Provider,m(e,{value:o}))};e.s(["UNDEFINED",0,u],895711);var er=e.i(966341);let en="$inf$";var ei=t;let ea=x&&window.__SWR_DEVTOOLS_USE__,eo=ea?window.__SWR_DEVTOOLS_USE__:[],el=()=>{ea&&(window.__SWR_DEVTOOLS_REACT__=ei.default)},es=e=>p(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],ec=()=>{let e=(0,ei.useContext)(ee);return(0,ei.useMemo)(()=>m(X,e),[e])},ed=e=>(t,r,n)=>{let i=r&&((...e)=>{let[n]=z(t),[,,,i]=c.get(J);if(n.startsWith(en))return r(...e);let a=i[n];return f(a)?r(...e):(delete i[n],a)});return e(t,i,n)},eu=eo.concat(ed),eh=e=>function(...t){let r=ec(),[n,i,a]=es(t),o=Q(r,a),l=e,{use:s}=o,c=(s||[]).concat(eu);for(let e=c.length;e--;)l=c[e](l);return l(n,i||o.fetcher||null,o)},ef=(e,t,r)=>{let n=t[e]||(t[e]=[]);return n.push(r),()=>{let e=n.indexOf(r);e>=0&&(n[e]=n[n.length-1],n.pop())}},ep=(e,t)=>(...r)=>{let[n,i,a]=es(r),o=(a.use||[]).concat(t);return e(n,i,{...a,use:o})};el(),e.s(["subscribeCallback",0,ef,"useSWRConfig",0,ec,"withArgs",0,eh,"withMiddleware",0,ep],66396),e.s(["serialize",0,z],676037),e.s(["getTimestamp",0,W],527983);var em=er;e.s(["useIsomorphicLayoutEffect",0,L],354622),e.s(["IS_REACT_LEGACY",0,R],78160),e.s(["mergeObjects",0,m],582853);let eg=()=>{},eb=eg(),ey=(new WeakMap,t.default.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}})),ev={dedupe:!0},ex=Promise.resolve(u),ew=(e,n,i)=>{let{cache:a,compare:o,suspense:l,fallbackData:s,revalidateOnMount:h,revalidateIfStale:b,refreshInterval:y,refreshWhenHidden:v,refreshWhenOffline:x,keepPreviousData:w,strictServerPrefetchWarning:k}=i,[S,_,j,N]=c.get(a),[T,E]=z(e),A=(0,t.useRef)(!1),P=(0,t.useRef)(!1),D=(0,t.useRef)(T),O=(0,t.useRef)(n),F=(0,t.useRef)(i),B=()=>F.current,$=()=>B().isVisible()&&B().isOnline(),[U,H,q,G]=C(a,T),K=(0,t.useRef)({}).current,Y=f(s)?f(i.fallback)?u:i.fallback[T]:s,J=(e,t)=>{for(let r in K){let n=r;if("data"===n){if(!o(e[n],t[n])&&(!f(e[n])||!o(ea,t[n])))return!1}else if(t[n]!==e[n])return!1}return!0},Z=(0,t.useMemo)(()=>{let e=!!T&&!!n&&(f(h)?!B().isPaused()&&!l&&!1!==b:h),t=t=>{let r=m(t);return(delete r._k,e)?{isValidating:!0,isLoading:!0,...r}:r},r=U(),i=G(),a=t(r),o=r===i?a:t(i),s=a;return[()=>{let e=t(U());return J(e,s)?(s.data=e.data,s.isLoading=e.isLoading,s.isValidating=e.isValidating,s.error=e.error,s):(s=e,e)},()=>o]},[a,T]),X=(0,r.useSyncExternalStore)((0,t.useCallback)(e=>q(T,(t,r)=>{J(r,t)||e()}),[a,T]),Z[0],Z[1]),Q=!A.current,ee=S[T]&&S[T].length>0,et=X.data,er=f(et)?Y&&g(Y)?ey(Y):Y:et,en=X.error,ei=(0,t.useRef)(er),ea=w?f(et)?f(ei.current)?er:ei.current:et:er,eo=T&&f(er),el=!M&&(0,r.useSyncExternalStore)(()=>d,()=>!1,()=>!0);k&&el&&!l&&eo&&console.warn(`Missing pre-initiated data for serialized key "${T}" during server-side rendering. Data fethcing should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);let es=(!ee||!!f(en))&&(Q&&!f(h)?h:!B().isPaused()&&(l?!f(er)&&b:f(er)||b)),ec=!!(T&&n&&Q&&es),ed=f(X.isValidating)?ec:X.isValidating,eu=f(X.isLoading)?ec:X.isLoading,eh=(0,t.useCallback)(async e=>{let t,r,n=O.current;if(!T||!n||P.current||B().isPaused())return!1;let a=!0,l=e||{},s=!j[T]||!l.dedupe,c=()=>R?!P.current&&T===D.current&&A.current:T===D.current,d={isValidating:!1,isLoading:!1},h=()=>{H(d)},m=()=>{let e=j[T];e&&e[1]===r&&delete j[T]},g={isValidating:!0};f(U().data)&&(g.isLoading=!0);try{if(s&&(H(g),i.loadingTimeout&&f(U().data)&&setTimeout(()=>{a&&c()&&B().onLoadingSlow(T,i)},i.loadingTimeout),j[T]=[n(E),W()]),[t,r]=j[T],t=await t,s&&setTimeout(m,i.dedupingInterval),!j[T]||j[T][1]!==r)return s&&c()&&B().onDiscarded(T),!1;d.error=u;let e=_[T];if(!f(e)&&(r{let t=S[T];t&&t[0]&&t[0](em.ERROR_REVALIDATE_EVENT,e)},{retryCount:(l.retryCount||0)+1,dedupe:!0})))}return a=!1,h(),!0},[T,a]),ep=(0,t.useCallback)((...e)=>V(a,D.current,...e),[]);if(L(()=>{O.current=n,F.current=i,f(et)||(ei.current=et)}),L(()=>{if(!T)return;let e=eh.bind(u,ev),t=0;B().revalidateOnFocus&&(t=Date.now()+B().focusThrottleInterval);let r=ef(T,S,(r,n={})=>{if(r==em.FOCUS_EVENT){let r=Date.now();B().revalidateOnFocus&&r>t&&$()&&(t=r+B().focusThrottleInterval,e())}else if(r==em.RECONNECT_EVENT)B().revalidateOnReconnect&&$()&&e();else if(r==em.MUTATE_EVENT)return eh();else if(r==em.ERROR_REVALIDATE_EVENT)return eh(n)});return P.current=!1,D.current=T,A.current=!0,H({_k:E}),es&&!j[T]&&(f(er)||M?e():I(e)),()=>{P.current=!0,r()}},[T]),L(()=>{let e;function t(){let t=p(y)?y(U().data):y;t&&-1!==e&&(e=setTimeout(r,t))}function r(){!U().error&&(v||B().isVisible())&&(x||B().isOnline())?eh(ev).then(t):t()}return t(),()=>{e&&(clearTimeout(e),e=-1)}},[y,v,x,T]),(0,t.useDebugValue)(ea),l){if(!R&&M&&eo)throw Error("Fallback data is required when using Suspense in SSR.");eo&&(O.current=n,F.current=i,P.current=!1);let e=N[T];if(ey(!f(e)&&eo?ep(e):ex),!f(en)&&eo)throw en;let t=eo?eh(ev):ex;!f(ea)&&eo&&(t.status="fulfilled",t.value=!0),ey(t)}return{mutate:ep,get data(){return K.data=!0,ea},get error(){return K.error=!0,en},get isValidating(){return K.isValidating=!0,ed},get isLoading(){return K.isLoading=!0,eu}}};h.defineProperty(et,"defaultValue",{value:X});let ek=eh(ew);e.s(["default",0,ek],381477)},120455,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(381477),i=e.i(541686),a=e.i(878367),o=e.i(753618);let l={tags:{type:{in:["location"]}}},s="Atlanta",c=`/api/payload/tags?${new URLSearchParams({"where[and][0][type][equals]":"location","where[and][1][name][equals]":s,limit:"1",depth:"0"}).toString()}`,d=e=>fetch(e,{credentials:"include"}).then(e=>e.ok?e.json():null),u=()=>{let{user:e}=(0,i.useAuth)(),{id:s}=(0,i.useDocumentInfo)(),[u,h]=(0,r.useState)(null),[f,p]=(0,r.useState)(!1),[m,g]=(0,r.useState)(null),b=(0,a.checkPermission)(e??null,"content-queries","edit"),[y,,{openDrawer:v,closeDrawer:x}]=(0,i.useListDrawer)({collectionSlugs:["tags"],filterOptions:l});(0,r.useEffect)(()=>()=>(0,o.setLocalPreview)(null),[]);let{data:w}=(0,n.default)(c,d,{revalidateOnFocus:!1,revalidateOnReconnect:!1});(0,r.useEffect)(()=>{let e=w?.docs?.[0];e&&"string"==typeof e.id&&h(t=>t??{id:e.id,label:e.name||e.id})},[w]);let k=(0,r.useCallback)(({doc:e})=>{if(e&&"string"==typeof e.id){let t="string"==typeof e.title&&e.title||"string"==typeof e.name&&e.name||e.id;h({id:e.id,label:t}),(0,o.setLocalPreview)(null),g(null)}x()},[x]),S=(0,r.useCallback)(async()=>{if(!u)return void i.toast.error("Select a location tag first.",{duration:1/0,closeButton:!0});p(!0);try{let e=await fetch(`/api/payload/v1/content-queries/${encodeURIComponent(String(s))}/local-preview`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({tagId:u.id})}),t=await e.json();if(t.success&&t.data){(0,o.setLocalPreview)({items:t.data.items,usedQuery:t.data.usedQuery});let e=t.data.usedQuery?`query: “${t.data.usedQuery}”`:"geo + recency";g(t.data.items.length>0?`${t.data.items.length} local item(s) for ${u.label} shown inline in Merged Content below (${e}).`:`No local content found for ${u.label} (${e}).`),i.toast.success(`Fetched ${t.data.items.length} local item(s) for ${u.label}`)}else(0,o.setLocalPreview)(null),g(null),i.toast.error(t.error||"Failed to fetch local content",{duration:1/0,closeButton:!0})}catch{(0,o.setLocalPreview)(null),g(null),i.toast.error("Failed to fetch local content",{duration:1/0,closeButton:!0})}finally{p(!1)}},[s,u]);return b?(0,t.jsxs)("div",{className:"field-type ui",style:{marginBottom:"1.5rem"},children:[(0,t.jsx)("label",{className:"field-label",children:"Local Content Preview"}),s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"0.5rem"},children:[(0,t.jsx)("button",{type:"button",className:"btn btn--style-secondary btn--size-medium",onClick:v,disabled:f,children:u?`Location: ${u.label}`:"Search location tag…"}),(0,t.jsx)("button",{type:"button",className:"btn btn--style-primary btn--size-medium",onClick:S,disabled:f||!u,children:f?"Fetching…":"Fetch"})]}),(0,t.jsx)("p",{style:{fontSize:"0.8rem",color:"var(--theme-elevation-500)",margin:0},"aria-live":"polite",children:m??(0,t.jsxs)(t.Fragment,{children:["Local items render inline in Merged Content below, as"," ",(0,t.jsx)("span",{style:{color:o.LOCAL_BLUE,fontWeight:600},children:"dark-blue “local” rows"})," ","at the position of this query’s Local Content row. At runtime that slot is filled from the viewer’s own location."]})}),(0,t.jsx)(y,{onSelect:k})]}):(0,t.jsx)("p",{style:{opacity:.7},children:"Save this content query first to preview its Local Content row."})]}):null};e.s(["LocalContentPreview",0,u])},532919,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(878367),a=e.i(210601);let o=["articles","videos","liveblogs"];function l(e){return e.endsWith("s")?e.slice(0,-1):e}let s=()=>{let{user:e}=(0,n.useAuth)(),{id:s}=(0,n.useDocumentInfo)(),[c,d]=(0,r.useState)(null),[u,h]=(0,r.useState)(!1),[f,p]=(0,r.useState)(null),m=(0,i.checkPermission)(e??null,"content-queries","edit"),[g,,{openDrawer:b,closeDrawer:y}]=(0,n.useListDrawer)({collectionSlugs:[...o]});(0,r.useEffect)(()=>()=>(0,a.setRelatedPreview)(null),[]);let v=(0,r.useCallback)(({doc:e,collectionSlug:t})=>{if(e&&"string"==typeof e.id&&t){let r="string"==typeof e.title&&e.title||"string"==typeof e.assetName&&e.assetName||e.id;d({id:e.id,collection:t,label:r}),(0,a.setRelatedPreview)(null),p(null)}y()},[y]),x=(0,r.useCallback)(async()=>{if(!c)return void n.toast.error("Select a content item first.",{duration:1/0,closeButton:!0});h(!0);try{let e=await fetch(`/api/payload/v1/content-queries/${encodeURIComponent(String(s))}/related-preview`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({seedId:c.id,seedCollection:c.collection})}),t=await e.json();if(t.success&&t.data){(0,a.setRelatedPreview)({items:t.data.items,seedId:t.data.seedId,seedCollection:t.data.seedCollection,ranking:t.data.ranking});let e="blended"===t.data.ranking?"blended with performance":"semantic similarity";p(t.data.items.length>0?`${t.data.items.length} related item(s) for “${c.label}” shown inline in Merged Content below (${e}).`:`No related content found for “${c.label}” (${e}). If it was just published its embedding may not exist yet.`),n.toast.success(`Fetched ${t.data.items.length} related item(s) for “${c.label}”`)}else(0,a.setRelatedPreview)(null),p(null),n.toast.error(t.error||"Failed to fetch related content",{duration:1/0,closeButton:!0})}catch{(0,a.setRelatedPreview)(null),p(null),n.toast.error("Failed to fetch related content",{duration:1/0,closeButton:!0})}finally{h(!1)}},[s,c]);return m?(0,t.jsxs)("div",{className:"field-type ui",style:{marginBottom:"1.5rem"},children:[(0,t.jsx)("label",{className:"field-label",children:"Related Content Preview"}),s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"0.5rem"},children:[(0,t.jsx)("button",{type:"button",className:"btn btn--style-secondary btn--size-medium",onClick:b,disabled:u,children:c?`${l(c.collection)}: ${c.label}`:"Search content to match against…"}),(0,t.jsx)("button",{type:"button",className:"btn btn--style-primary btn--size-medium",onClick:x,disabled:u||!c,children:u?"Fetching…":"Fetch"})]}),(0,t.jsx)("p",{style:{fontSize:"0.8rem",color:"var(--theme-elevation-500)",margin:0},"aria-live":"polite",children:f??(0,t.jsxs)(t.Fragment,{children:["Related items render inline in Merged Content below, as"," ",(0,t.jsx)("span",{style:{color:a.RELATED_PURPLE,fontWeight:600},children:"purple “related” rows"})," ","at the position of this query’s Related Content row. At runtime that slot is filled from the asset the reader is viewing."]})}),(0,t.jsx)(g,{onSelect:v})]}):(0,t.jsx)("p",{style:{opacity:.7},children:"Save this content query first to preview its Related Content row."})]}):null};e.s(["RelatedContentPreview",0,s])},694767,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);let i=e=>{let t=e.replace(/ /g,"-").replace(/[^\w\-\\/]+/g,"").replace(/\/+/g,"/").toLowerCase();return(t.startsWith("/")?t:`/${t}`).replace(/\/+/g,"/")},a=({field:e,fieldToUse:a,checkboxFieldPath:o,path:l,readOnly:s})=>{let{label:c}=e,d=l?.includes(".")?`${l}.${o}`:o,{value:u,setValue:h}=(0,n.useField)({path:l||e.name}),{dispatchFields:f}=(0,n.useForm)(),p=(0,n.useFormFields)(([e])=>e[d]?.value),m=(0,n.useFormFields)(([e])=>e[a]?.value);(0,r.useEffect)(()=>{if(p)if(m){let e=i(m);u!==e&&h(e)}else""!==u&&h("")},[m,p,h,u]);let g=(0,r.useCallback)(e=>{e.preventDefault(),f({type:"UPDATE",path:d,value:!p})},[p,d,f]),b=s||p;return(0,t.jsxs)("div",{className:"field-type assetName-field-component",children:[(0,t.jsxs)("div",{className:"label-wrapper",children:[(0,t.jsx)(n.FieldLabel,{htmlFor:`field-${l}`,label:c}),(0,t.jsx)(n.Button,{className:"lock-button",buttonStyle:"none",onClick:g,children:p?"Specify Manually":"Generate from Title"})]}),(0,t.jsx)(n.TextInput,{value:u,onChange:h,path:l||e.name,readOnly:!!b})]})};e.s(["AssetNameComponent",0,a],694767)},718365,e=>{"use strict";var t=e.i(514514);let r=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],n=(0,t.default)("external-link",r);e.s(["ExternalLink",0,n],718365)},747087,e=>{"use strict";function t(e){return e?e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/[_-]+/g," ").split(/\s+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}e.s(["capitalizeTokenName",0,t])},868028,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(718365),a=e.i(482317),o=e.i(747087);let l=500,s={video:"videos",article:"articles",liveblog:"liveblogs"};function c(e){if(!e)return null;if("string"==typeof e)return e;if("number"==typeof e)return String(e);if("object"==typeof e&&null!==e&&"id"in e){let t=e.id;return"string"==typeof t||"number"==typeof t?String(t):null}return null}function d(e){return"string"===e||"video"===e||"article"===e||"liveblog"===e}let u=e=>{let{path:i,schemaPath:a,field:s}=e,u=i||s.name,h=a||u,{addFieldRow:p,removeFieldRow:m,dispatchFields:g,setModified:b}=(0,n.useForm)(),y=(0,n.useFormFields)(([e])=>e.ctaLandingPage),v=c(y?.value),[{data:x}]=(0,n.usePayloadAPI)(v?`/api/payload/tags/${v}`:""),w=(0,r.useMemo)(()=>{let e=x?.variables;return Array.isArray(e)?e.flatMap(e=>{if(!e||"object"!=typeof e)return[];let{name:t,label:r,type:n}=e;if("string"!=typeof t||!d(n))return[];let i="string"==typeof r&&r.trim()?r:(0,o.capitalizeTokenName)(t);return[{name:t,label:i,type:n}]}):[]},[x]),k=(0,n.useFormFields)(([e])=>{let t=[];for(let r=0;rk?JSON.parse(k):[],[k]),C=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(C.current||!v||x?.id!==v)return;let e=new Set(w.map(e=>e.name)),t=new Set(S.map(e=>e.name)),r=[];for(let t=S.length-1;t>=0;t--){let n=S[t];n&&!e.has(n.name)&&r.push(t)}let n=w.filter(e=>!t.has(e.name));if(0!==r.length||0!==n.length){C.current=!0;try{for(let e of r)m({path:u,rowIndex:e});for(let e of n)p({path:u,schemaPath:h,subFieldState:{name:{value:e.name,initialValue:e.name,valid:!0},value:{value:"",initialValue:"",valid:!0}}})}finally{queueMicrotask(()=>{C.current=!1})}}},[v,x,w,S,u,h,p,m]);let _=(0,r.useMemo)(()=>{let e=new Map;for(let t of S)t.name&&e.set(t.name,t);return e},[S]),j=(e,t)=>{let r=_.get(e);r&&(g({type:"UPDATE",path:`${u}.${r.index}.value`,value:t}),b(!0))};return v?0===w.length?null:(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsx)(n.FieldLabel,{label:s.label||"CTA Landing Page Variables"}),(0,t.jsxs)("p",{className:"mt-1 mb-3 text-xs text-[var(--theme-elevation-400)]",children:["Values are substituted into $","{name}"," tokens in the landing page URL."]}),(0,t.jsx)("div",{className:"flex flex-col gap-2",children:w.map(e=>(0,t.jsx)(f,{definition:e,currentValue:_.get(e.name)?.value??"",onChange:t=>j(e.name,t)},e.name))})]}):(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsx)(n.FieldLabel,{label:s.label||"CTA Landing Page Variables"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-[var(--theme-elevation-400)]",children:"Select a CTA Landing Page above to fill in its variables."})]})},h="inline-flex items-center rounded-sm bg-[var(--theme-elevation-100)] px-1.5 py-0.5 text-[0.6875rem] font-medium uppercase tracking-wide text-[var(--theme-elevation-600)]",f=({definition:e,currentValue:r,onChange:n})=>{let{name:i,label:o,type:l}=e;return"string"===l?(0,t.jsxs)("div",{className:"rounded-md border border-[var(--theme-elevation-150)] bg-[var(--theme-elevation-50)] p-3",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:o}),(0,t.jsx)("code",{className:"text-[0.75rem] text-[var(--theme-elevation-500)]",children:`\${${i}}`}),(0,t.jsx)("span",{className:h,children:"string"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded border border-[var(--theme-elevation-150)] bg-[var(--theme-input-bg)] px-2.5 py-1.5 focus-within:border-[var(--theme-success-500)]",children:[(0,t.jsx)("input",{type:"text",value:r,onChange:e=>n(e.target.value),placeholder:"Enter a value",className:"min-w-0 flex-1 border-none bg-transparent p-0 text-sm outline-none placeholder:text-[var(--theme-elevation-400)]","aria-label":`Value for ${i}`}),r?(0,t.jsx)("button",{type:"button",onClick:()=>n(""),title:"Clear value","aria-label":"Clear value",className:"inline-flex shrink-0 items-center justify-center rounded border-none bg-transparent p-1 text-[var(--theme-elevation-400)] hover:bg-[var(--theme-elevation-100)] hover:text-[var(--theme-elevation-800)]",children:(0,t.jsx)(a.X,{size:14,"aria-hidden":"true"})}):null]})]}):(0,t.jsx)(p,{name:i,label:o,type:l,currentValue:r,onChange:n})},p=({name:e,label:r,type:o,currentValue:l,onChange:c})=>{let d=s[o],[u,,{openDrawer:f,closeDrawer:p}]=(0,n.useListDrawer)({collectionSlugs:[d],selectedCollection:d}),[{data:m}]=(0,n.usePayloadAPI)(l?`/api/payload/${d}/${l}?depth=0`:""),g=m?.title??m?.name??l,b=l?`/payload/admin/collections/${d}/${l}`:null;return(0,t.jsxs)("div",{className:"rounded-md border border-[var(--theme-elevation-150)] bg-[var(--theme-elevation-50)] p-3",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:r}),(0,t.jsx)("code",{className:"text-[0.75rem] text-[var(--theme-elevation-500)]",children:`\${${e}}`}),(0,t.jsx)("span",{className:h,children:o})]}),l?(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded border border-[var(--theme-elevation-150)] bg-[var(--theme-input-bg)] px-2.5 py-1.5",children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm",title:g,children:g}),b?(0,t.jsx)("a",{href:b,target:"_blank",rel:"noopener noreferrer",title:`Open ${o} in a new tab`,"aria-label":`Open ${o} in a new tab`,className:"inline-flex shrink-0 items-center rounded p-1 text-[var(--theme-elevation-400)] hover:bg-[var(--theme-elevation-100)] hover:text-[var(--theme-elevation-800)]",children:(0,t.jsx)(i.ExternalLink,{size:14,"aria-hidden":"true"})}):null,(0,t.jsx)(n.Button,{buttonStyle:"secondary",size:"small",onClick:()=>f(),children:"Change"}),(0,t.jsx)("button",{type:"button",onClick:()=>c(""),title:"Clear selection","aria-label":"Clear selection",className:"inline-flex shrink-0 items-center justify-center rounded border-none bg-transparent p-1 text-[var(--theme-elevation-400)] hover:bg-[var(--theme-elevation-100)] hover:text-[var(--theme-elevation-800)]",children:(0,t.jsx)(a.X,{size:14,"aria-hidden":"true"})})]}):(0,t.jsxs)(n.Button,{buttonStyle:"secondary",size:"small",onClick:()=>f(),children:["Select ",o]}),(0,t.jsx)(u,{allowCreate:!1,onSelect:({doc:e})=>{e?.id&&c(String(e.id)),p()}})]})};e.s(["CtaVariablesField",0,u])},610641,e=>{"use strict";var t=e.i(699173),r=e.i(541686);let n=({path:e,field:n,isAutoGenerated:i,readOnlyFromProps:a})=>{let{label:o,required:l,admin:s}=n,c=s?.description,{value:d,setValue:u}=(0,r.useField)({path:e}),h=!!a||i;return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsx)(r.FieldLabel,{htmlFor:`field-${e}`,label:o,required:l}),(0,t.jsx)(r.TextInput,{value:d||"",onChange:u,path:e,readOnly:h}),c?(0,t.jsx)(r.FieldDescription,{path:e,description:c}):null]})};e.s(["AutoGeneratedUrlInput",0,n])},170192,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(610641);let i=({field:e,path:i,readOnly:a})=>{let o=i||e.name,l=(0,r.useFormFields)(([e])=>e.ctaSource?.value==="content");return(0,t.jsx)(n.AutoGeneratedUrlInput,{path:o,field:e,isAutoGenerated:l,readOnlyFromProps:a})};e.s(["CtaUrlField",0,i])},771114,e=>{"use strict";var t=e.i(699173),r=e.i(541686);function n(e){let t=e?.targetPlatform;return Array.isArray(t)?t:"both"===t?["ios","android"]:"string"==typeof t&&t?[t]:[]}let i=e=>{let t=n(e);return t.includes("ios")||t.includes("android")},a=e=>n(e).includes("web"),o=e=>i(e)&&a(e)&&e?.ctaSource==="content"&&e?.webUsesAppContent!==!1;var l=e.i(610641);let s=({field:e,path:n,readOnly:i})=>{let a=n||e.name,s=(0,r.useFormFields)(([e])=>e.webCtaSource?.value==="content"||o({targetPlatform:e.targetPlatform?.value,ctaSource:e.ctaSource?.value,webUsesAppContent:e.webUsesAppContent?.value}));return(0,t.jsx)(l.AutoGeneratedUrlInput,{path:a,field:e,isAutoGenerated:s,readOnlyFromProps:i})};e.s(["WebCtaUrlField",0,s],771114)},617920,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(301857),i=e.i(265055),a=e.i(541686);let o=(0,n.default)(()=>e.A(683080).then(e=>e.DmaCoverageMapInner),{loadableGenerated:{modules:[291880]},ssr:!1,loading:()=>null}),l=()=>{let{config:e}=(0,i.useConfig)(),[n,l]=(0,r.useState)([]),[s,c]=(0,r.useState)([]),[d,u]=(0,r.useState)(!1),h=(0,a.useFormFields)(([e])=>{let t=[];for(let r=0;;r++){let n=e[`dmaTargeting.${r}.dmaCode`];if(!n)break;let i=n.value;"string"==typeof i&&i?t.push(i):"number"==typeof i&&t.push(String(i))}return t.join(",")});(0,r.useEffect)(()=>{let t=!1,r=h?h.split(",").filter(Boolean):[];if(0===r.length){l([]),c([]);return}let n=e.serverURL??"";return u(!0),Promise.all(r.map(async e=>{try{let t=await fetch(`${n}/api/payload/v1/location/dma-boundary/${e}`,{credentials:"include"});if(!t.ok)return{code:e,feature:null};let r=await t.json();return{code:e,feature:r?.geometry?{dmaCode:e,geometry:r.geometry}:null}}catch{return{code:e,feature:null}}})).then(e=>{t||(l(e.map(e=>e.feature).filter(e=>null!==e)),c(e.filter(e=>!e.feature).map(e=>e.code)),u(!1))}),()=>{t=!0}},[h,e]);let f=h?h.split(",").filter(Boolean).length:0;return(0,t.jsxs)("div",{style:{marginTop:12},children:[(0,t.jsx)("div",{style:{fontSize:13,fontWeight:600,marginBottom:6},children:"DMA coverage"}),(0,t.jsx)("div",{style:{height:320,borderRadius:6,overflow:"hidden",position:"relative"},children:(0,t.jsx)(o,{features:n})}),(0,t.jsx)("p",{style:{fontSize:12,opacity:.75,marginTop:6},children:d?"Loading boundaries…":0===f?"No DMA targeting — this banner is served to all EN/US users.":`${n.length} of ${f} DMA${f>1?"s":""} shown`+(s.length?` \xb7 not found: ${s.join(", ")}`:"")})]})};e.s(["DmaCoverageMap",0,l])},286047,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(301857),i=e.i(265055),a=e.i(365953);let o=(0,n.default)(()=>e.A(830251).then(e=>e.ContentBannerMapInner),{loadableGenerated:{modules:[187735]},ssr:!1,loading:()=>null}),l=1e3,s={blue:"#3b82f6",green:"#22c55e",yellow:"#eab308"},c=e=>"green"===e||"yellow"===e?e:"blue",d=e=>{let t=Array.isArray(e)?e:"string"==typeof e?[e]:[],r=new Set;for(let e of t){let t=String(e).toLowerCase();"both"===t?(r.add("ios"),r.add("android")):("ios"===t||"android"===t||"web"===t)&&r.add(t)}return[...r]},u=()=>{let{config:e}=(0,i.useConfig)(),[n,u]=(0,r.useState)([]),[h,f]=(0,r.useState)([]),[p,m]=(0,r.useState)(null),[g,b]=(0,r.useState)(!0);(0,r.useEffect)(()=>{let t=!1,r=e.serverURL??"",n=`${r}${e.routes?.api??"/api"}`;return(async()=>{b(!0);try{let e=new Date,i=encodeURIComponent(e.toISOString()),a=`&where[and][0][status][equals]=active&where[and][1][or][0][endDate][exists]=false&where[and][1][or][1][endDate][greater_than_equal]=${i}`,o=await fetch(`${n}/content-banners?depth=0&limit=${l}${a}`,{credentials:"include"});if(!o.ok){t||(u([]),f([]));return}let s=await o.json(),h=(Array.isArray(s?.docs)?s.docs:[]).map(t=>{let r=t,n=(Array.isArray(r.dmaTargeting)?r.dmaTargeting:[]).map(e=>String(e?.dmaCode??"")).filter(e=>/^[0-9]{3,4}$/.test(e));return{id:String(r.id),title:"string"==typeof r.title?r.title:"(untitled)",color:c(r.bannerColor),priority:Number(r.priority)||0,startDate:"string"==typeof r.startDate?r.startDate:null,endDate:"string"==typeof r.endDate?r.endDate:null,scheduled:"string"==typeof r.startDate&&new Date(r.startDate).getTime()>e.getTime(),platforms:d(r.targetPlatform),dmaCodes:n}}),p=[...new Set(h.flatMap(e=>e.dmaCodes))],m=new Map;await Promise.all(p.map(async e=>{try{let t=await fetch(`${r}/api/payload/v1/location/dma-boundary/${e}`,{credentials:"include"});if(!t.ok)return;let n=await t.json();n?.geometry&&m.set(e,n.geometry)}catch{}}));let g=h.flatMap(e=>e.dmaCodes.map(e=>m.get(e)).filter(e=>!!e).map(t=>({bannerId:e.id,title:e.title,color:e.color,priority:e.priority,startDate:e.startDate,endDate:e.endDate,scheduled:e.scheduled,platforms:e.platforms,geometry:t})));t||(u(h),f(g))}catch{t||(u([]),f([]))}finally{t||b(!1)}})(),()=>{t=!0}},[e]);let y=(0,r.useMemo)(()=>{let e=new Map;for(let t of n){let r=e.get(t.title)??{title:t.title,color:t.color,count:0,dmaCount:0,liveCount:0};r.count+=1,r.dmaCount+=t.dmaCodes.length,t.scheduled||(r.liveCount+=1),e.set(t.title,r)}return[...e.values()].map(e=>({...e,scheduled:0===e.liveCount}))},[n]),v=(0,r.useMemo)(()=>n.filter(e=>0===e.dmaCodes.length).length,[n]);return(0,t.jsxs)("div",{style:{margin:"12px 0"},children:[(0,t.jsx)("div",{style:{fontSize:13,fontWeight:600,marginBottom:6},children:"DMA coverage overview"}),(0,t.jsx)("div",{style:{height:420,borderRadius:6,overflow:"hidden",position:"relative"},children:(0,t.jsx)(o,{features:h,selectedTitle:p})}),(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:8},children:y.map(e=>{let r=p===e.title;return(0,t.jsxs)("button",{type:"button",onClick:()=>m(r?null:e.title),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"2px 8px",borderRadius:999,border:`1px solid ${r?"#fff":"transparent"}`,background:"rgba(255,255,255,0.06)",cursor:"pointer",fontSize:12,opacity:p&&!r?.5:1},children:[(0,t.jsx)("span",{style:{width:10,height:10,borderRadius:2,background:e.scheduled?a.SCHEDULED_COLOR:s[e.color]},"aria-hidden":"true"}),e.title,e.count>1?` \xd7${e.count}`:"",0===e.dmaCount?" · all US":"",e.scheduled?" · scheduled":""]},e.title)})}),(0,t.jsx)("p",{style:{fontSize:12,opacity:.75,marginTop:6},children:g?"Loading banner coverage…":0===n.length?"No active content banners.":`${n.length} active banner${n.length>1?"s":""}`+(y.length!==n.length?` \xb7 ${y.length} group${y.length>1?"s":""}`:"")+(v?` \xb7 ${v} with no DMA targeting (served everywhere, not drawn)`:"")})]})};e.s(["ContentBannersListMap",0,u])},404353,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);let i=[{label:"String",value:"string"},{label:"Video",value:"video"},{label:"Article",value:"article"},{label:"Liveblog",value:"liveblog"}];[...i];let a=/\$\{([a-zA-Z][a-zA-Z0-9_]*)\}/g;function o(e){if("string"!=typeof e||0===e.length)return[];let t=new Set,r=[];for(let n of e.matchAll(a)){let e=n[1];e&&!t.has(e)&&(t.add(e),r.push(e))}return r}var l=e.i(747087);let s=500;function c(e){return i.some(t=>t.value===e)}let d=e=>{let{path:a,schemaPath:d,field:u}=e,h=a||u.name,f=d||h,{addFieldRow:p,removeFieldRow:m,dispatchFields:g}=(0,n.useForm)(),b=(0,n.useFormFields)(([e])=>e.baseLink),y=(0,r.useMemo)(()=>o(b?.value),[b?.value]),v=(0,n.useFormFields)(([e])=>{let t=[];for(let r=0;rv?JSON.parse(v):[],[v]),w=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(w.current)return;let e=new Set(y),t=new Set(x.map(e=>e.name)),r=[];for(let t=x.length-1;t>=0;t--){let n=x[t];n&&!e.has(n.name)&&r.push(t)}let n=[];for(let e of y)t.has(e)||n.push(e);if(0!==r.length||0!==n.length){w.current=!0;try{for(let e of r)m({path:h,rowIndex:e});for(let e of n)p({path:h,schemaPath:f,subFieldState:{name:{value:e,initialValue:e,valid:!0},label:{value:"",initialValue:"",valid:!0},type:{value:"string",initialValue:"string",valid:!0}}})}finally{queueMicrotask(()=>{w.current=!1})}}},[y,x,h,f,p,m]);let k=(e,t)=>{g({type:"UPDATE",path:`${h}.${e}.type`,value:t})},S=(e,t)=>{g({type:"UPDATE",path:`${h}.${e}.label`,value:t})},C="string"==typeof u.label?u.label:"Variables";if(0===y.length)return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsx)(n.FieldLabel,{label:C}),(0,t.jsxs)("p",{className:"mt-1 text-xs text-[var(--theme-elevation-400)]",children:["Add $","{name}"," tokens to the Link above to declare variables."]})]});let _=new Map;for(let e of x)e.name&&_.set(e.name,e);return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsx)(n.FieldLabel,{label:C}),(0,t.jsx)("p",{className:"mt-1 mb-3 text-xs text-[var(--theme-elevation-400)]",children:"Tokens detected in the Link. Set a display name and type per variable."}),(0,t.jsx)("div",{className:"flex flex-col gap-2",children:y.map(e=>{let r=_.get(e),n=r?.type??"string",a=r?.label??"",o=!r,s=(0,l.capitalizeTokenName)(e);return(0,t.jsxs)("div",{className:"rounded-md border border-[var(--theme-elevation-150)] bg-[var(--theme-elevation-50)] p-3",children:[(0,t.jsx)("div",{className:"mb-2 flex items-center gap-2",children:(0,t.jsx)("code",{className:"text-[0.8125rem] font-medium",children:`\${${e}}`})}),(0,t.jsxs)("div",{className:"grid grid-cols-[1fr_auto] gap-3",children:[(0,t.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-[var(--theme-elevation-600)]",children:"Display name"}),(0,t.jsx)("input",{type:"text",value:a,disabled:o,onChange:e=>{r&&S(r.index,e.target.value)},placeholder:s,"aria-label":`Display name for ${e}`,className:"rounded border border-[var(--theme-elevation-150)] bg-[var(--theme-input-bg)] px-2.5 py-1.5 text-sm outline-none placeholder:text-[var(--theme-elevation-400)] focus-visible:border-[var(--theme-success-500)] focus-visible:ring-2 focus-visible:ring-[var(--theme-success-500)] disabled:opacity-50"})]}),(0,t.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-[var(--theme-elevation-600)]",children:"Type"}),(0,t.jsx)("select",{value:n,disabled:o,onChange:e=>{if(!r)return;let t=e.target.value;c(t)&&k(r.index,t)},"aria-label":`Type for ${e}`,className:"rounded border border-[var(--theme-elevation-150)] bg-[var(--theme-input-bg)] px-2.5 py-1.5 text-sm outline-none focus-visible:border-[var(--theme-success-500)] focus-visible:ring-2 focus-visible:ring-[var(--theme-success-500)] disabled:opacity-50",children:i.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})]})]})]},e)})})]})};e.s(["TagsVariablesField",0,d],404353)},985911,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686);function i(e){return e.split("-").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function a(e){return e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^\w/,e=>e.toUpperCase())}function o(e){return a(i(e))}function l(e){return e.startsWith("tags-")&&e.length>5?e.substring(5):e}let s=()=>{let{data:e}=(0,n.useRowLabel)(),[,i]=(0,r.useReducer)(e=>e+1,0);(0,r.useEffect)(()=>{i()},[e?.resource,e?.access]);let a=e?.resource||"Unknown Resource",s=e?.access||"none",c=e=>({none:{label:"None",colorClass:"bg-gray-500 text-white"},view:{label:"View",colorClass:"bg-green-600 text-white"},edit:{label:"Edit",colorClass:"bg-blue-600 text-white"},full:{label:"Full",colorClass:"bg-orange-600 text-white"},admin:{label:"Admin",colorClass:"bg-red-600 text-white"}})[e]||{label:e,colorClass:"bg-gray-500 text-white"},d=o(l(a)),u=c(s);return(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2",children:[(0,t.jsx)("span",{className:`w-14 rounded px-2 py-1 text-center text-xs font-medium ${u.colorClass}`,children:u.label}),(0,t.jsx)("span",{className:"font-medium text-slate-800 dark:text-slate-200",children:d})]})},c=s;e.s(["PermissionsRowLabel",0,s,"default",0,c],985911)},687777,e=>{"use strict";var t=e.i(699173),r=e.i(541686);let n=({field:e,path:n,readOnly:i,options:a})=>{let{value:o,setValue:l}=(0,r.useField)({path:n}),s="string"==typeof e.label?e.label:void 0,c="string"==typeof e.admin?.description?e.admin.description:void 0,d=a.map(e=>{let t=e.value.startsWith("__section_");return{...e,disabled:t}});return(0,t.jsx)(r.SelectInput,{path:n,name:e.name,options:d,value:o,onChange:e=>{if(e&&"object"==typeof e&&"value"in e){let t=e.value;t.startsWith("__section_")||l(t)}},label:s,required:e.required,readOnly:i,description:c})},i=n;e.s(["ResourceSelect",0,n,"default",0,i])},964678,e=>{"use strict";let t={mp4:{name:"mp4",label:"MP4",description:"Standard MP4 video format"},m3u8:{name:"m3u8",label:"M3U8",description:"HLS streaming format"},youtube:{name:"youtube",label:"YouTube",description:"YouTube video format"}},r={video:{name:"video",label:"Video",description:"Standard video variant"},ios:{name:"ios",label:"iOS",description:"iOS optimized variant"},android:{name:"android",label:"Android",description:"Android optimized variant"},legacy:{name:"legacy",label:"Legacy",description:"Legacy video format"},web:{name:"web",label:"Web",description:"Web optimized variant"},mweb:{name:"mweb",label:"Mobile Web",description:"Mobile web variant"},ios_app:{name:"ios_app",label:"iOS App",description:"iOS app variant"},android_app:{name:"android_app",label:"Android App",description:"Android app variant"},fallback_web:{name:"fallback_web",label:"Fallback Web",description:"Web fallback variant"},fallback_mweb:{name:"fallback_mweb",label:"Fallback Mobile Web",description:"Mobile web fallback"},fallback_android_app:{name:"fallback_android_app",label:"Fallback Android App",description:"Android app fallback"},fallback_ios_app:{name:"fallback_ios_app",label:"Fallback iOS App",description:"iOS app fallback"},youtube:{name:"youtube",label:"YouTube",description:"YouTube variant"}};function n(){return Object.values(t)}function i(){return Object.values(r)}e.s(["getVideoChannels",0,i,"getVideoFormats",0,n],964678)},258787,e=>{"use strict";function t(e){return"object"==typeof e&&e&&"value"in e?e.value:e||""}function r(e=[],t="-- Select --"){return[{label:t,value:""},...e.map(e=>({label:e.label,value:e.name}))]}function n(e){return r=>{e(t(r))}}e.s(["createSelectChangeHandler",0,n,"createSelectOptions",0,r,"extractSelectValue",0,t])},495407,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(509388),i=e.i(541686),a=e.i(964678),o=e.i(258787);let l=({field:e,path:l,...s})=>{let{value:c,setValue:d}=(0,i.useField)({path:l}),u=(0,r.useRef)(l.split(".").slice(0,-1).join(".")),h=(0,r.useRef)(`${u.current}.url`),f=(0,i.useFormFields)(([e])=>{let t=(0,n.reduceFieldsToValues)(e,!0);return t?.content?.videoFormatUrls||[]}),p=(0,r.useMemo)(()=>{try{return JSON.stringify(f)}catch(e){return""}},[f]),m=(0,r.useMemo)(()=>f,[p]),g=(0,r.useMemo)(()=>{let e=(0,a.getVideoFormats)();return(0,o.createSelectOptions)(e,"-- Select Format --")},[]),{setValue:b}=(0,i.useField)({path:h.current});(0,r.useEffect)(()=>{if(c&&m.length>0){let e=m.find(e=>e&&e.format===c);e&&e.url&&b(e.url)}},[c,m,b]);let y=(0,o.extractSelectValue)(c),v=(0,o.createSelectChangeHandler)(d);return(0,t.jsx)(i.SelectInput,{...s,path:l,name:e.name,required:e.required,label:e.label,options:g,value:y,onChange:v})};e.s(["MappedFormat",0,l])},962146,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(964678),a=e.i(258787);let o=({field:e,path:o})=>{let{value:l,setValue:s}=(0,n.useField)({path:o||e.name}),c=(0,r.useMemo)(()=>{let e=(0,i.getVideoChannels)();return(0,a.createSelectOptions)(e,"-- Select Channel --")},[]),d=(0,a.extractSelectValue)(l),u=(0,a.createSelectChangeHandler)(s);return(0,t.jsx)(n.SelectInput,{path:o||e.name,name:e.name,label:"string"==typeof e.label?e.label:void 0,required:e.required,options:c,value:d,onChange:u})};e.s(["ChannelSelect",0,o])},986013,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(964678),i=e.i(258787);let a=({field:e,path:a})=>{let{value:o,setValue:l}=(0,r.useField)({path:a||e.name}),s=(0,n.getVideoFormats)(),c=(0,i.createSelectOptions)(s,"-- Select Format --"),d=(0,i.extractSelectValue)(o),u=(0,i.createSelectChangeHandler)(l);return(0,t.jsx)(r.SelectInput,{path:a||e.name,name:e.name,label:"string"==typeof e.label?e.label:void 0,required:e.required,options:c,value:d,onChange:u})};e.s(["FormatSelect",0,a])},40819,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(964678);let a=()=>{let{data:e,rowNumber:a}=(0,n.useRowLabel)(),{channelLabel:o,formatLabel:l}=(0,r.useMemo)(()=>{let t=(0,i.getVideoChannels)(),r=(0,i.getVideoFormats)(),n=t.find(t=>t.name===e?.channel),a=n?.label||e?.channel||"Unknown Channel",o=r.find(t=>t.name===e?.format);return{channelLabel:a,formatLabel:o?.label||e?.format||"Unknown Format"}},[e?.channel,e?.format]);return e?.channel||e?.format?(0,t.jsxs)("span",{children:[o," (",l,")"]}):(0,t.jsxs)("span",{children:["Channel Video ",a]})};e.s(["ChannelVideoRowLabel",0,a])},78977,e=>{"use strict";var t=e.i(699173),r=e.i(592121),n=e.i(541686),i=e.i(659425);function a(e){return[...e].sort((e,t)=>{if("string"==typeof e||"string"==typeof t)return 0;let r=e,n=t,i=r?.pin===!0,a=n?.pin===!0;if(i&&!a)return -1;if(!i&&a)return 1;let o=new Date(r?.timestamp?r.timestamp:0);return new Date(n?.timestamp?n.timestamp:0).getTime()-o.getTime()})}var o=t,l=r,s=n,c=i;let d=({onEntrySelect:e,excludedIds:t})=>{let[r,n]=(0,l.useState)(""),[i,a]=(0,l.useState)(""),[d,u]=(0,l.useState)([]),[h,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(-1),g=(0,l.useRef)(null),{theme:b}=(0,c.useTheme)();(0,l.useEffect)(()=>{let e=setTimeout(()=>{a(r.trim())},300);return()=>clearTimeout(e)},[r]);let y=i.length>=2?`/api/payload/liveblog-entries?where[title][contains]=${encodeURIComponent(i)}${t.length>0?`&where[id][not_in]=${t.join(",")}`:""}&limit=10&depth=1&draft=true`:"",[{data:v,isLoading:x}]=(0,s.usePayloadAPI)(y,{initialParams:{draft:!0,limit:10}});(0,l.useEffect)(()=>{if(v?.docs){let e=v.docs.map(e=>({id:e.id,title:"string"==typeof e.title?e.title:"Untitled Entry",timestamp:e.timestamp||"",pin:!!e.pin,_status:e._status}));u(e),f(i.length>=2&&e.length>0)}else u([]),f(!1);m(-1)},[v,i]);let w=(0,l.useCallback)(t=>{e(t),n(""),f(!1),m(-1)},[e]),k=(0,l.useCallback)(e=>{if(h&&0!==d.length)switch(e.key){case"ArrowDown":e.preventDefault(),m(e=>ee>0?e-1:-1);break;case"Enter":if(e.preventDefault(),p>=0&&p{let e=e=>{g.current&&!g.current.contains(e.target)&&(f(!1),m(-1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,o.jsxs)("div",{ref:g,className:"relative",children:[(0,o.jsx)(s.TextInput,{path:"search",placeholder:"Search to add an existing entry...",value:r,onChange:e=>n(e.target.value),onKeyDown:k}),h&&(0,o.jsx)("div",{className:`absolute top-full right-0 left-0 z-50 mt-1 max-h-60 overflow-y-auto rounded-md border shadow-lg ${"dark"===b?"border-gray-700 bg-gray-800":"border-gray-200 bg-white"}`,children:x?(0,o.jsx)("div",{className:"p-3 text-center text-sm text-gray-500",children:"Searching..."}):d.length>0?d.map((e,t)=>(0,o.jsx)("div",{className:`cursor-pointer px-3 py-2 text-sm ${t===p?"dark"===b?"bg-gray-700":"bg-gray-100":"dark"===b?"hover:bg-gray-700":"hover:bg-gray-50"}`,onClick:()=>w(e),onMouseEnter:()=>m(t),children:(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{className:"flex items-center",children:[e.pin&&(0,o.jsx)("span",{className:"mr-2 text-xs",children:"📌"}),(0,o.jsx)("span",{className:"font-medium",children:e.title||"Untitled Entry"}),e._status&&(0,o.jsx)("span",{className:`ml-2 rounded px-1.5 py-0.5 text-xs ${"dark"===b?"bg-gray-600 text-gray-300":"bg-gray-200 text-gray-600"}`,children:e._status})]}),e.timestamp&&(0,o.jsx)("span",{className:"text-xs text-gray-500",children:new Date(e.timestamp).toLocaleDateString()})]})},e.id)):i.length>=2?(0,o.jsxs)("div",{className:"p-3 text-center text-sm text-gray-500",children:['No entries found matching "',i,'"']}):null})]})},u="liveblog-entry-confirm-delete",h=80,f=e=>{let{field:o,path:l,readOnly:s}=e,{label:c,name:f,relationTo:p}=o,{value:m,setValue:g}=(0,n.useField)({path:l||f}),[b,y]=(0,r.useState)([]),[v,x]=(0,r.useState)(0),[w,k]=(0,r.useState)(null),S=(0,r.useMemo)(()=>Array.isArray(m)?m.map(e=>"object"==typeof e?e.id:e):[],[m]),{theme:C}=(0,i.useTheme)(),[{data:_,isLoading:j}]=(0,n.usePayloadAPI)(S.length>0?`/api/payload/liveblog-entries?where[id][in]=${S.join(",")}&`:"",{initialParams:{draft:!0,limit:100}}),[N,,{openDrawer:T,isDrawerOpen:E}]=(0,n.useDocumentDrawer)({collectionSlug:"liveblog-entries",id:w||void 0});(0,r.useEffect)(()=>{null!==w&&T()},[w,T]),(0,r.useEffect)(()=>{E||k(null)},[E]),(0,r.useEffect)(()=>{_?.docs&&y(a(_.docs.map(e=>{let t="string"==typeof e?.title?e?.title:"Untitled Entry",r=e?.timestamp??"",n=!!e?.pin;return{id:e.id,title:t,timestamp:r,pin:n,_status:e._status}})))},[_]),(0,r.useEffect)(()=>{0===S.length&&y(e=>0===e.length?e:[])},[S]);let A=(0,r.useCallback)(({doc:e})=>{let t=String(e.id),r=(Array.isArray(m)?m:[]).map(e=>"object"==typeof e?String(e.id):String(e)).filter(e=>e);if(r.includes(t)){let r=b?.find(e=>e?.id===t);r&&(Object.keys(r).forEach(t=>{let n=e[t];void 0!==n&&(r[t]=n)}),y(a(b)))}else g([...r,t])},[g,m,b]),R=e=>{let t="object"==typeof m?.[0]?{id:e.id}:e.id;g([...Array.isArray(m)?m:[],t])},M=e=>{k(e),x(e=>e+1)},{openModal:I,closeModal:L}=(0,n.useModal)(),[P,D]=(0,r.useState)(null),O=(0,r.useRef)(null),F=e=>{D(e),I(u)},B=(0,r.useCallback)(()=>{L(u),D(null)},[L]),$=(0,r.useCallback)(()=>{P&&Array.isArray(m)&&g(m.filter(e=>("object"==typeof e?e.id:e)!==P.id)),L(u),D(null)},[P,m,g,L]);(0,r.useEffect)(()=>{P&&O.current?.focus()},[P]);let U=e=>{"Escape"===e.key?(e.preventDefault(),B()):"Enter"===e.key&&e.target===e.currentTarget&&(e.preventDefault(),$())},z=P?P.title.length>h?`${P.title.slice(0,h-1)}…`:P.title:"";return(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsx)(N,{drawerSlug:"liveblog-entry-drawer",onSave:A},`${w??"new"}-${v}`),(0,t.jsxs)("div",{className:"field-type",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"w-1/3",children:(0,t.jsx)(n.FieldLabel,{htmlFor:`field-${l}`,label:"Liveblog Entries"})}),!s&&(0,t.jsxs)("div",{className:"mb-3 flex w-2/3 items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"max-w-2xl flex-1",children:(0,t.jsx)(d,{onEntrySelect:R,excludedIds:S})}),(0,t.jsx)("div",{className:"flex space-x-2",children:(0,t.jsx)(n.Button,{onClick:()=>k(void 0),className:"m-0",children:"Create New Entry"})})]})]}),j?(0,t.jsx)("div",{className:"py-2",children:"Loading entries..."}):b.length>0?(0,t.jsx)("div",{className:"space-y-2",children:b.map(e=>(0,t.jsxs)("div",{className:`flex items-baseline justify-between border px-5 py-1.5 ${"dark"===C?"border-gray-800 hover:border-gray-600 hover:bg-gray-900":"border-gray-200 hover:border-gray-300 hover:bg-gray-100"} `,children:[(0,t.jsxs)("div",{className:"flex flex-grow items-center",children:[e.pin&&(0,t.jsx)("span",{className:"mr-2 px-2 py-0.5 pl-0",children:"📌"}),(0,t.jsx)("span",{children:e.title||"Untitled Entry"}),e._status&&(0,t.jsx)("span",{className:`ml-2 rounded bg-gray-700 px-2 py-0.5 text-xs text-gray-300 ${"light"===C?"text-white":""} `,children:e._status}),!s&&(0,t.jsx)(n.Button,{el:"div",buttonStyle:"icon-label",icon:"edit",className:"m-0 p-0",onClick:()=>M(e.id),children:(0,t.jsx)("span",{className:"sr-only",children:"Edit"})})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[e.timestamp&&(0,t.jsx)("span",{className:"whitespace-nowrap",children:new Date(e.timestamp).toLocaleString()}),!s&&(0,t.jsx)(n.Button,{buttonStyle:"icon-label",icon:"x",onClick:()=>F({id:e.id,title:e.title||"Untitled Entry",timestamp:e.timestamp}),className:"m-0 p-1 text-xs hover:text-red-500",children:(0,t.jsx)("span",{className:"sr-only",children:"Remove"})})]})]},e.id))}):(0,t.jsx)("div",{className:"rounded-md border border-dashed py-4 text-center",children:'No entries selected. Click "Add Entry" to select entries.'})]}),(0,t.jsx)(n.Modal,{slug:u,className:"confirmation-modal",closeOnBlur:!0,onClose:B,children:(0,t.jsxs)("div",{ref:O,tabIndex:-1,className:"confirmation-modal__wrapper",role:"alertdialog","aria-modal":"true","aria-label":"Delete liveblog entry","aria-describedby":"liveblog-delete-desc",onKeyDown:U,children:[(0,t.jsxs)("div",{className:"confirmation-modal__content",children:[(0,t.jsx)("h2",{children:"Delete entry"}),(0,t.jsxs)("p",{id:"liveblog-delete-desc",children:["Are you sure you want to delete"," ",(0,t.jsx)("strong",{children:z||"this entry"}),"?"]}),P?.timestamp&&(0,t.jsx)("p",{children:new Date(P.timestamp).toLocaleString()}),(0,t.jsx)("p",{children:"This action cannot be undone."})]}),(0,t.jsxs)("div",{className:"confirmation-modal__controls",children:[(0,t.jsx)(n.Button,{type:"button",size:"large",buttonStyle:"secondary",onClick:B,children:"Cancel"}),(0,t.jsx)(n.Button,{type:"button",size:"large",buttonStyle:"primary",onClick:$,children:"Delete entry"})]})]})})]})};e.s(["LiveblogEntriesField",0,f],78977)},127989,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(592121),i=e.i(104777);let a=(0,i.createServerReference)("60faf298fe327fb7844d030b27630600349b0a3d67",i.callServer,void 0,i.findSourceMapURL,"getKalliopeTaxonomyTermById");var o=i;let l=(0,o.createServerReference)("60e72d952d5b343c8a351cad2209912e21387577ba",o.callServer,void 0,o.findSourceMapURL,"searchKalliopeTaxonomyTerms"),s=25;function c({path:e,type:i,field:o,permissions:d}){let{value:u,setValue:h}=(0,r.useField)({path:e||o.name}),[f,p]=(0,n.useState)(!1),[m,g]=(0,n.useState)(""),[b,y]=(0,n.useState)([]),[v,x]=(0,n.useState)(!1),[w,k]=(0,n.useState)(null),[S,C]=(0,n.useState)(!1),_=(0,n.useMemo)(()=>b.find(e=>e.value===u),[b,u]),j=(0,n.useCallback)(async e=>{if(!d)return;x(!0),k(null),C(!1);let{data:t,success:r,message:n}=await l(e,{limit:s,offset:0,type:i});r?(y(t),C(t.length===s)):k(n),x(!1)},[d,i]),N=(0,n.useCallback)(async()=>{if(!d)return;x(!0),k(null);let{data:e,success:t,message:r}=await l(m,{limit:s,offset:b.length,type:i});t?(y(t=>[...t,...e]),C(e.length===s)):k(r),x(!1)},[d,m,i,b]),T=(0,r.useDebouncedCallback)(e=>{j(e)},300),E=(0,r.useDebouncedCallback)(()=>{N()},300),A=(0,r.useEffectEvent)(async e=>{if(!d)return;x(!0),k(null),C(!1);let{data:t,success:r,message:n}=await a(i,e);r&&t?y([t]):k(n),x(!1)});return(0,n.useEffect)(()=>{u&&A(u)},[]),(0,n.useEffect)(()=>{f&&!_&&j("")},[f]),(0,t.jsxs)("div",{className:"field-type select",children:[(0,t.jsx)(r.FieldLabel,{label:o.label,localized:o.localized,path:e,required:o.required}),w&&(0,t.jsx)("div",{className:"error",children:w}),(0,t.jsx)(r.ReactSelect,{menuIsOpen:f,onMenuOpen:()=>p(!0),onMenuClose:()=>p(!1),disabled:o.admin?.readOnly,isLoading:v,options:b,value:_,backspaceRemovesValue:!0,onChange:e=>{e?Array.isArray(e)?h(""):h(e.value||""):h("")},onInputChange:e=>{let t=e.trim();t.length&&e!==m&&T(t),g(t)},isClearable:!0,showError:!!w,onMenuScrollToBottom:()=>{S&&E()}}),(0,t.jsx)(r.FieldDescription,{description:o.admin?.description,path:e})]})}e.s(["KalliopeTaxonomyTermAutocompleteSearch",0,c],127989)},815134,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(592121),i=e.i(104777);let a=(0,i.createServerReference)("60b44ba5a5ed004408c302fc1400e32286396f5483",i.callServer,void 0,i.findSourceMapURL,"getKalliopeContentById");var o=i;let l=(0,o.createServerReference)("607464ae27ca41e10cf44747e61ffa2eee2f55d908",o.callServer,void 0,o.findSourceMapURL,"getRecentlyModifiedContent");var s=i;let c=(0,s.createServerReference)("70cb94a3dd6f59b74f941475edd8c60a47f352654c",s.callServer,void 0,s.findSourceMapURL,"searchKalliopeContent"),d=25,u=10,h=500,f=3e3;function p({path:e,field:i,permissions:o}){let{value:s,setValue:m}=(0,r.useField)({path:e||i.name}),g=(0,r.useFormFields)(([e])=>e.landingPage),b=g?.value,[{data:y}]=(0,r.usePayloadAPI)(b?`/api/payload/tags/${b}`:""),v=y?.slug||"",{setValue:x}=(0,r.useField)({path:"contentUuid"}),{setValue:w}=(0,r.useField)({path:"contentUrl"}),{setValue:k}=(0,r.useField)({path:"contentImage"}),{setValue:S}=(0,r.useField)({path:"contentCategory"}),{setValue:C}=(0,r.useField)({path:"contentPill"}),{setValue:_}=(0,r.useField)({path:"audienceSegment"}),j=["article","video","verticalvideo"].includes(v),[N,T]=(0,n.useState)(!1),[E,A]=(0,n.useState)(""),[R,M]=(0,n.useState)([]),[I,L]=(0,n.useState)(!1),[P,D]=(0,n.useState)(null),[O,F]=(0,n.useState)(!1),[B,$]=(0,n.useState)(!1),[U,z]=(0,n.useState)(!1),H=(0,n.useMemo)(()=>R.find(e=>{if(!s)return!1;try{let t=JSON.parse(s),r=JSON.parse(e.value);return t.id===r.id}catch{return!1}}),[R,s]),W=(0,n.useCallback)(async e=>{let t;if(!o||!v)return;if("article"===v)t="article";else{if("video"!==v&&"verticalvideo"!==v)return;t="video"}L(!0),D(null),F(!1),z(!1);let{data:r,success:n,message:i}=await c(e,{limit:d,offset:0},t);n?(M(r),F(r.length===d)):D(i),L(!1)},[o,v]),V=(0,n.useCallback)(async()=>{let e;if(!o||!v)return;if("article"===v)e="article";else{if("video"!==v&&"verticalvideo"!==v)return;e="video"}L(!0),D(null),F(!1),z(!0);let{data:t,success:r,message:n}=await l(e);r?M(t):D(n),L(!1)},[o,v]),q=(0,n.useCallback)(async()=>{let e;if(!o||!v)return;if("article"===v)e="article";else{if("video"!==v&&"verticalvideo"!==v)return;e="video"}L(!0),D(null);let{data:t,success:r,message:n}=await c(E,{limit:d,offset:R.length},e);r?(M(e=>[...e,...t]),F(t.length===d)):D(n),L(!1)},[o,v,E,R]),G=(0,n.useCallback)(()=>{m(""),x(null),w(null),k(null),S(null),C(null),_(null)},[m,x,w,k,S,C,_]),K=(0,n.useCallback)(()=>{let e=E.trim();s&&G();let t=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e);0===e.length?V():e.length{q()},h),J=(0,r.useEffectEvent)(async e=>{if(o)try{let t=JSON.parse(e);L(!0),D(null),F(!1);let{data:r,success:n,message:i}=await a(t.id,t.type);n&&r.length>0?M(r):D(i||"Failed to load content"),L(!1)}catch(e){console.error("Error loading selected option:",e),D("Failed to load selected content"),L(!1)}});return((0,n.useEffect)(()=>{s&&J(s)},[]),(0,n.useEffect)(()=>{s&&!j&&(console.log("🔄 Landing page changed to non-content type, clearing content field"),G())},[j,s,G]),(0,n.useEffect)(()=>{!N||H||0!==R.length||I||V()},[N,H,R.length,I,V]),(0,n.useEffect)(()=>{let e;return I?($(!1),e=setTimeout(()=>{$(!0)},f)):$(!1),()=>{e&&clearTimeout(e)}},[I]),j)?(0,t.jsxs)("div",{className:"field-type select",children:[(0,t.jsx)(r.FieldLabel,{label:"string"==typeof i.label?i.label:void 0,localized:i.localized,path:e,required:i.required}),P&&!I&&(0,t.jsx)("div",{style:{padding:"7px 12px",textAlign:"center",fontSize:"0.875rem",color:"#fef2f2",backgroundColor:"rgb(44, 26, 24)",border:"1px solid rgb(218, 75, 72)",borderRadius:"3px",marginBottom:"0.5rem"},children:P}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem",alignItems:"flex-start",marginBottom:"0.5rem"},children:[(0,t.jsx)("div",{style:{flex:1},children:(0,t.jsx)(r.TextInput,{path:"",value:E,placeholder:"Search by title or paste UUID...",onChange:e=>{A(e.target.value),P&&e.target.value.length>0&&D(null)}})}),(0,t.jsx)("button",{type:"button",onClick:K,disabled:i.admin?.readOnly||I,className:"rounded border border-gray-300 bg-gray-50 px-3 py-2 hover:bg-gray-100 disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:hover:bg-gray-700",title:"Search",style:{height:"38px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,t.jsx)("path",{d:"m21 21-4.35-4.35"})]})})]}),I&&(0,t.jsxs)("div",{style:{padding:"1rem",textAlign:"center",fontSize:"0.875rem",color:"#666",border:"1px solid #e5e7eb",borderRadius:"4px",marginBottom:"0.5rem"},children:["Searching...",B&&(0,t.jsx)("div",{style:{marginTop:"0.5rem",fontSize:"0.8rem"},children:"Tip: Use more specific terms or paste a UUID for faster results"})]}),!I&&(0,t.jsx)(r.ReactSelect,{menuIsOpen:N,onMenuOpen:()=>T(!0),onMenuClose:()=>T(!1),disabled:i.admin?.readOnly,isLoading:I,options:R,value:H,backspaceRemovesValue:!0,onChange:e=>{if(e){let t=e.value||"";console.log("✨ Content selected, populating related fields"),m(t);try{let e=JSON.parse(t);console.log("📦 Populating fields with:",{type:e.type,uuid:e.uuid,url:e.url,imageUrl:e.imageUrl}),x(e.uuid),w(e.url||null),k(e.imageUrl||null),S(e.pcollid||null),console.log("✅ Fields populated successfully:",{contentUuid:e.uuid,contentUrl:e.url||null,contentImage:e.imageUrl||null,contentCategory:e.pcollid||null})}catch(e){console.error("❌ Failed to parse content item:",e)}}else console.log("🗑️ Content cleared, clearing related fields"),G()},isClearable:!0,showError:!!P,onMenuScrollToBottom:()=>{O&&!U&&Y()}}),(0,t.jsx)(r.FieldDescription,{description:"string"==typeof i.admin?.description?i.admin.description:void 0,path:e})]}):null}e.s(["KalliopeContentAutocompleteSearch",0,p],815134)},38834,e=>{"use strict";var t=e.i(157710);e.s(["LoaderCircle",()=>t.default])},25033,e=>{"use strict";var t=e.i(514514);let r=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],n=(0,t.default)("circle-check-big",r);e.s(["CheckCircle",0,n],25033)},669625,e=>{"use strict";var t=e.i(514514);let r=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],n=(0,t.default)("triangle-alert",r);e.s(["default",0,n])},135676,e=>{"use strict";var t=e.i(669625);e.s(["AlertTriangle",()=>t.default])},277710,903435,236348,e=>{"use strict";function t(e,i=5){let a=[];function o(e,t,l){if(!(l>i)){if(null==e)return void a.push({path:t,sampleValue:"null",type:"null"});if(Array.isArray(e)){a.push({path:t,sampleValue:`Array(${e.length})`,type:"array"}),e.length>0&&"object"==typeof e[0]&&null!==e[0]?o(e[0],`${t}.0`,l+1):e.length>0&&a.push({path:`${t}.0`,sampleValue:r(e[0]),type:n(e[0])});return}if("object"==typeof e){for(let r of(t&&a.push({path:t,sampleValue:"{...}",type:"object"}),Object.keys(e))){let n=t?`${t}.${r}`:r;o(e[r],n,l+1)}return}a.push({path:t,sampleValue:r(e),type:n(e)})}}return o(e,"",0),a}function r(e){let t=String(e);return t.length>100?t.slice(0,100)+"...":t}function n(e){return null==e?"null":Array.isArray(e)?"array":"number"==typeof e?"number":"boolean"==typeof e?"boolean":"object"==typeof e?"object":"string"}function i(e){return e.filter(e=>"string"===e.type||"number"===e.type||"boolean"===e.type||"array"===e.type)}e.s(["extractSourceFields",0,t,"getLeafFields",0,i],277710);var a=e.i(699173),o=e.i(541686),l=e.i(514514);let s=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],c=(0,l.default)("zap",s);function d({fields:e,onPopulateMappings:t}){return(0,a.jsxs)("div",{style:{marginTop:"12px",border:"1px solid var(--theme-elevation-150)",borderRadius:"4px",padding:"12px"},children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[(0,a.jsxs)("h5",{style:{margin:0,fontSize:"13px",fontWeight:600},children:["Detected Source Fields (",e.length,")"]}),(0,a.jsxs)(o.Button,{onClick:()=>t(e),size:"small",buttonStyle:"secondary",children:[(0,a.jsx)(c,{size:12,style:{marginRight:"4px"}}),"Populate Field Mappings"]})]}),(0,a.jsx)("div",{style:{maxHeight:"200px",overflow:"auto",fontSize:"12px",fontFamily:"monospace"},children:(0,a.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse"},children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{style:{textAlign:"left",padding:"4px 8px",borderBottom:"1px solid var(--theme-elevation-150)",position:"sticky",top:0,backgroundColor:"var(--theme-elevation-50)"},children:"Path"}),(0,a.jsx)("th",{style:{textAlign:"left",padding:"4px 8px",borderBottom:"1px solid var(--theme-elevation-150)",position:"sticky",top:0,backgroundColor:"var(--theme-elevation-50)"},children:"Type"}),(0,a.jsx)("th",{style:{textAlign:"left",padding:"4px 8px",borderBottom:"1px solid var(--theme-elevation-150)",position:"sticky",top:0,backgroundColor:"var(--theme-elevation-50)"},children:"Sample"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{style:{padding:"3px 8px",borderBottom:"1px solid var(--theme-elevation-100)",fontWeight:500},children:e.path}),(0,a.jsx)("td",{style:{padding:"3px 8px",borderBottom:"1px solid var(--theme-elevation-100)",opacity:.7},children:e.type}),(0,a.jsx)("td",{style:{padding:"3px 8px",borderBottom:"1px solid var(--theme-elevation-100)",opacity:.6,maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.sampleValue})]},e.path))})]})})]})}function u(e){let t=e.toLowerCase(),r=t.split(".").pop()||t;return t.includes("enclosure")&&"@_url"===r?"featuredImageUrl":t.includes("media:content")&&"@_url"===r?"videoUrl":t.includes("media:content")&&"@_duration"===r?"duration":t.includes("media:thumbnail")&&"@_url"===r?"thumbnailUrl":t.includes("media:credit")?"mediaCredit":"title"===r||"name"===r?"title":"description"===r||"summary"===r||"subtitle"===r||"sub_title"===r?"description":"body"===r||"content"===r||t.includes("content:encoded")||t.includes("encoded")?"body":"pubdate"===r||"publishdate"===r||"published"===r||"date"===r||"created_at"===r||"createdat"===r?"publishDate":"author"===r||"creator"===r||t.includes("dc:creator")||"authors"===r?"externalAuthors":"category"===r||"categories"===r||"tags"===r?"categories":"link"===r||"canonical"===r?"canonicalUrl":"guid"===r||"sourceid"===r||"identifier"===r||"guid.#text"===t?"sourceId":"duration"===r||"@_duration"===r?"duration":t.includes("media:keywords")||"keywords"===r?"mediaKeywords":t.includes("image")||t.includes("thumbnail")||t.includes("poster")?t.includes("thumb")?"thumbnailUrl":"featuredImageUrl":void 0}function h(e){switch(e){case"body":return{transformation:"htmlToLexical"};case"publishDate":return{transformation:"parseDate"};case"externalAuthors":return{transformation:"joinArray",transformationConfig:{separator:", "}};case"mediaKeywords":return{transformation:"splitComma"};default:return{transformation:"none"}}}function f(e){let t=new Set;return e.map(e=>{let r=u(e.path);if(!r||t.has(r))return null;t.add(r);let{transformation:n,transformationConfig:i}=h(r),a={sourceFieldPath:e.path,targetField:r,transformation:n,enabled:!0,required:"title"===r};return i&&(a.transformationConfig=i),a}).filter(e=>null!==e)}e.s(["SourceFieldsPanel",0,d],903435),e.s(["buildMappingsFromDetectedFields",0,f],236348)},563618,e=>{"use strict";var t=e.i(699173),r=e.i(541686),n=e.i(592121),i=e.i(798973),a=e.i(38834),o=e.i(25033),l=e.i(976411),s=e.i(135676),c=e.i(514514);let d=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],u=(0,c.default)("info",d);var h=e.i(104777);let f=(0,h.createServerReference)("40c73a84dd842f85ff3b56c1eb829a12edcfab809f",h.callServer,void 0,h.findSourceMapURL,"testRssFeedConnection");var p=h;let m=(0,p.createServerReference)("40be94235cbacf2d0889212ac976d604710063efa6",p.callServer,void 0,p.findSourceMapURL,"detectRssSourceFields"),g=["video/mp4","video/quicktime","application/x-mpegURL","application/vnd.apple.mpegurl"],b=["image/jpeg","image/jpg","image/png","image/gif"],y=[/^[A-Za-z]{3},\s+\d{1,2}\s+[A-Za-z]{3}\s+\d{4}\s+\d{2}:\d{2}:\d{2}\s+[+-]\d{2}:?\d{2}$/,/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}$/,/^[A-Za-z]{3},\s+\d{1,2}\s+[A-Za-z]{3}\s+\d{4}\s+\d{2}:\d{2}:\d{2}\s+[A-Za-z]{2,4}$/,/^[A-Za-z]{3},\s+\d{1,2}\s+[A-Za-z]{3}\s+\d{4}\s+\d{2}:\d{2}:\d{2}\s+GMT$/],v="http://search.yahoo.com/mrss/",x="http://purl.org/rss/1.0/modules/content/",w="http://purl.org/dc/elements/1.1/",k="http://purl.org/dc/terms/",S=200,C=1e3,_=500,j=70,N=300,T=300,E=1e3,A=200,R=1280,M=720;function I(e){return y.some(t=>t.test(e))}function L(e){try{return"https:"===new URL(e).protocol}catch{return!1}}function P(e,t){let r=e.getElementsByTagName(t);return r[0]?.textContent?.trim()||void 0}function D(e){let t=new DOMParser().parseFromString(e,"text/xml"),r=t.querySelector("parsererror");if(r)throw Error(`Invalid XML: ${r.textContent}`);let n=t.querySelector("channel");if(!n)throw Error("Invalid RSS feed: missing channel element");let i=O(t),a=F(n),o=B(n);return{feedType:K(o,i),channel:a,items:o,namespaces:i}}function O(e){let t=e.querySelector("rss"),r=t?Array.from(t.attributes):[];return{media:r.some(e=>e.value===v),content:r.some(e=>e.value===x),dc:r.some(e=>e.value===w),dcterms:r.some(e=>e.value===k)}}function F(e){return{title:P(e,"title"),link:P(e,"link"),description:P(e,"description"),pubDate:P(e,"pubDate")}}function B(e){let t=e.getElementsByTagName("item"),r=[];for(let e of Array.from(t))r.push($(e));return r}function $(e){let t={guid:P(e,"guid"),title:P(e,"title"),description:P(e,"description"),link:P(e,"link"),pubDate:P(e,"pubDate"),expireDate:P(e,"expireDate")};return U(e,t),z(e,t),H(e,t),W(e,t),V(e,t),q(e,t),G(e,t),t}function U(e,t){let r=e.getElementsByTagNameNS(v,"content")[0];r&&(t.mediaContent={url:r.getAttribute("url")||void 0,type:r.getAttribute("type")||void 0,medium:r.getAttribute("medium")||void 0,duration:r.getAttribute("duration")||void 0,width:r.getAttribute("width")||void 0,height:r.getAttribute("height")||void 0})}function z(e,t){let r=e.getElementsByTagNameNS(v,"thumbnail")[0];r&&(t.mediaThumbnail={url:r.getAttribute("url")||void 0,width:r.getAttribute("width")||void 0,height:r.getAttribute("height")||void 0})}function H(e,t){let r=e.getElementsByTagNameNS(v,"keywords")[0];if(t.mediaKeywords=r?.textContent?.trim(),t.mediaCategory=P(e,"category"),!t.mediaCategory){let r=e.getElementsByTagNameNS(v,"category")[0];t.mediaCategory=r?.textContent?.trim()}}function W(e,t){let r=e.getElementsByTagNameNS(x,"encoded")[0];r&&(t.contentEncoded=r.textContent?.trim())}function V(e,t){let r=e.getElementsByTagName("enclosure")[0];r&&(t.enclosure={url:r.getAttribute("url")||void 0,length:r.getAttribute("length")||void 0,type:r.getAttribute("type")||void 0})}function q(e,t){let r=e.getElementsByTagNameNS(w,"creator");r.length>0&&(t.dcCreators=Array.from(r).map(e=>e.textContent?.trim()).filter(Boolean))}function G(e,t){let r=e.getElementsByTagName("category");r.length>0&&(t.categories=Array.from(r).map(e=>e.textContent?.trim()).filter(Boolean))}function K(e,t){if(0===e.length)return"unknown";let r=e.some(e=>e.mediaContent?.medium==="video"||e.mediaContent?.type?.startsWith("video/")||e.mediaContent?.url?.match(/\.(mp4|mov|webm|m3u8)(\?|$)/i)),n=e.some(e=>e.contentEncoded||e.link&&e.enclosure?.type?.startsWith("image/"));return r&&!n?"video":n||t.content?"article":"unknown"}function Y(e){let t=[];return e.channel.title?e.channel.title.length>S&&t.push({severity:"warning",field:"channel.title",message:`Channel title exceeds ${S} characters`,details:`${e.channel.title.length} chars`}):t.push({severity:"error",field:"channel.title",message:"Channel title is required"}),e.channel.link?e.channel.link.length>C&&t.push({severity:"warning",field:"channel.link",message:`Channel link exceeds ${C} characters`,details:`${e.channel.link.length} chars`}):t.push({severity:"error",field:"channel.link",message:"Channel link is required"}),e.channel.description&&e.channel.description.length>_&&t.push({severity:"warning",field:"channel.description",message:`Channel description exceeds ${_} characters`,details:`${e.channel.description.length} chars`}),t}function J(e){let t=[],r=new Set;return e.forEach((e,n)=>{let i={itemIndex:n,itemGuid:e.guid};if(e.guid?r.has(e.guid)?t.push({severity:"error",field:"guid",message:`Duplicate GUID found: ${e.guid}`,...i}):r.add(e.guid):t.push({severity:"error",field:"guid",message:"GUID is required for each video item",...i}),e.title?e.title.length>j&&t.push({severity:"warning",field:"title",message:"Video title may be truncated on some devices",details:`${e.title.length} chars`,...i}):t.push({severity:"error",field:"title",message:"Video title is required",...i}),e.description?e.description.length>N&&t.push({severity:"warning",field:"description",message:"Video description exceeds 300 characters",details:`${e.description.length} chars`,...i}):t.push({severity:"error",field:"description",message:"Video description is required",...i}),e.mediaContent?.url){L(e.mediaContent.url)||t.push({severity:"error",field:"media:content.url",message:"Video URL must use HTTPS",...i});let r=e.mediaContent.type;r&&!g.includes(r)&&t.push({severity:"warning",field:"media:content.type",message:`Video type "${r}" may not be supported. Preferred: video/mp4`,...i})}else t.push({severity:"error",field:"media:content",message:"media:content with video URL is required",...i});if(e.pubDate?I(e.pubDate)||t.push({severity:"warning",field:"pubDate",message:"Publication date format may not be recognized",...i}):t.push({severity:"error",field:"pubDate",message:"Publication date is required",...i}),e.mediaKeywords?e.mediaKeywords.length>E&&t.push({severity:"warning",field:"media:keywords",message:"Keywords exceed 1000 characters",details:`${e.mediaKeywords.length} chars`,...i}):t.push({severity:"error",field:"media:keywords",message:"Video keywords are required",...i}),e.mediaThumbnail?.url){L(e.mediaThumbnail.url)||t.push({severity:"warning",field:"media:thumbnail.url",message:"Thumbnail URL should use HTTPS",...i});let r=parseInt(e.mediaThumbnail.width||"0",10),n=parseInt(e.mediaThumbnail.height||"0",10);r>0&&n>0&&(rA&&t.push({severity:"warning",field:"media:category",message:"Category exceeds 200 characters",details:`${e.mediaCategory.length} chars`,...i})}),t}function Z(e){let t=[],r=new Set;return e.forEach((e,n)=>{let i={itemIndex:n,itemGuid:e.guid};e.guid?r.has(e.guid)?t.push({severity:"error",field:"guid",message:`Duplicate GUID found: ${e.guid}`,...i}):r.add(e.guid):t.push({severity:"error",field:"guid",message:"GUID is required for each article item",...i}),e.link?e.link.length>T&&t.push({severity:"warning",field:"link",message:"Link exceeds 300 characters",details:`${e.link.length} chars`,...i}):t.push({severity:"error",field:"link",message:"Article backlink is required",...i}),e.title?e.title.length>j&&t.push({severity:"warning",field:"title",message:"Article title may be truncated on some devices",details:`${e.title.length} chars`,...i}):t.push({severity:"error",field:"title",message:"Article title is required",...i}),e.description?e.description.length>N&&t.push({severity:"warning",field:"description",message:"Article description exceeds 300 characters",details:`${e.description.length} chars`,...i}):t.push({severity:"error",field:"description",message:"Article description is required",...i}),e.contentEncoded?(e.contentEncoded.includes("")||t.push({severity:"info",field:"content:encoded",message:"Article body should contain HTML content wrapped in CDATA",...i}),/