1import{r as f,i as Dr,k as Ls,j as n,L as En,a as Xs,g as X,e as vp,m as pl,O as jp,N as Lu,n as kt,p as Ze,w as Ln,M as Bn,q as In,t as hn,T as un,S as br,v as zi,P as Jt,x as cs,y as Np,z as Iu,A as gl,B as Ou,C as kp,D as Sp,E as Cp,F as _p,G as Tp,H as Du,I as ds,J as Ep,K as Sc,Q as Pu,U as zp,V as Ai,W as Ap,X as Mp,Y as Lp,Z as Ip,_ as Cc,$ as Ru,a0 as wr,a1 as ba,a2 as Op,a3 as Dp,a4 as Pp,a5 as Rp,a6 as $p,a7 as Bp,a8 as Fp,a9 as Wp,aa as Up,ab as Hp,ac as Gp,ad as Yp,ae as Vp,af as wt,ag as Kp}from"./react-vendor-DqWSM9oO.js";import{S as qp,P as Xp,C as $u,R as Jp,T as Zp,O as Bu,a as Fu,b as Wu,D as Uu,A as Hu,c as Gu,d as Qp,e as eg,V as Yu,f as Vu,g as Ku,h as qu,i as Xu,j as Ju,k as tg,l as Zu,m as sg}from"./radix-DHDh1H44.js";import{S as ng,M as rg,A as yr,L as fe,a as Pr,X as He,H as On,I as og,B as ag,b as Qu,C as ef,c as fn,d as xn,e as vr,f as ws,g as xl,h as As,E as At,U as bl,i as Rr,T as wa,j as jr,Y as Nr,V as ig,k as lg,l as Ms,m as cg,n as Mi,P as dg,F as ug,o as fg,p as mg,q as wl,r as qe,s as Li,t as hg,u as tf,v as Ft,R as yl,w as kr,x as pg,y as gg,z as Xt,D as Ii,G as ya,J as bn,K as xg,N as bg,O as Dn,Q as sf,W as wg,Z as yg,_ as nf,$ as vg,a0 as jg,a1 as Ng,a2 as kg,a3 as Sg,a4 as Cg,a5 as _g,a6 as Tg,a7 as Eg,a8 as zg,a9 as Ag,aa as Mg,ab as Lg,ac as Ig,ad as Pn,ae as Og,af as _c,ag as Sr,ah as rf,ai as of,aj as Dg,ak as Pg,al as Rg,am as vl,an as jl,ao as af,ap as Oi,aq as $g,ar as Bg,as as Fg,at as Wg,au as Ug,av as Hg,aw as Gg,ax as Tc,ay as Yg,az as Vg}from"./icons-0OX96zLW.js";import{u as va,a as ja,b as Nl,c as Kg,Q as qg,d as Xg}from"./query-BZBNoImW.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function s(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=s(o);fetch(o.href,a)}})();const $t="/mostek",kl=`${$t}/wejscie`,Jg=`${$t}/reset-hasla`,Zg=new Set(["dashboard","comments"]),Qg=new Set(["dashboard","articles","new-article","edit-article","categories","comments","media","galleries","shorts","topics"]);function ex(e,t){return!e||e==="user"?!1:e==="admin"?!0:e==="moderator"?Zg.has(t):e==="editor"?Qg.has(t):!1}function lf(e){return e==="moderator"?`${$t}/comments`:$t}const cf={articles:"articles",categories:"categories",media:"media",galleries:"galleries",users:"users",ads:"ads",comments:"comments",shorts:"shorts",topics:"topics",settings:"settings",backups:"backups"};function df(){return $t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ss(e,t){if(e==="dashboard")return $t;if(e==="new-article")return`${$t}/articles/new`;if(e==="edit-article"&&t)return`${$t}/articles/${encodeURIComponent(t)}/edit`;const s=cf[e];return s?`${$t}/${s}`:$t}function Di(e){const t=e.replace(new RegExp(`^${df()}/?`),"").replace(/\/$/,"");if(!t)return{view:"dashboard"};if(t==="articles")return{view:"articles"};if(t==="articles/new")return{view:"new-article"};const s=t.match(/^articles\/([^/]+)\/edit$/);if(s)return{view:"edit-article",articleId:decodeURIComponent(s[1])};const r=Object.entries(cf).find(([,o])=>o===t);return r?{view:r[0]}:{view:"dashboard"}}function tx(e,t){const{view:s,articleId:r}=Di(e);return t==="dashboard"?s==="dashboard":t==="articles"?s==="articles"||s==="new-article"||s==="edit-article":t==="new-article"?s==="new-article":s===t&&!r}function sx(e){return e.replace(new RegExp(`^${df()}/?`),"").replace(/\/$/,"")}function Sl(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/Å/g,"l").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const Pi={"porty-i-stocznie":"Porty i Stocznie","technologie-i-edukacja":"Technologie i Edukacja",offshore:"Offshore",historia:"Historia",bezpieczenstwo:"BezpieczeÅstwo","turystyka-i-srodowisko":"Turystyka i Årodowisko"},uf=new Set(Object.keys(Pi));function ff(e,t=[]){return uf.has(e)?!0:t.some(s=>Sl(s)===e)}function nx(e){return`/${Sl(e)}`}function mf(e){return Pi[e]?Pi[e]:null}const Cl="/api";let hf=null;function ar(e){hf=e}function pf(){return hf}async function rx(){try{const e=await fetch(`${Cl}/auth/me`,{credentials:"include"});if(!e.ok)return!1;const t=await e.json();return t.csrfToken?(ar(t.csrfToken),!0):(ar(null),!1)}catch{return!1}}function ox(e,t){return e===403&&(t.code==="CSRF_INVALID"||/csrf/i.test(t.error??""))}function ax(e){const t={"Content-Type":"application/json",...e},s=pf();return s&&(t["X-CSRF-Token"]=s),t}async function ee(e,t,s=!1){var i;const r=((i=t==null?void 0:t.method)==null?void 0:i.toUpperCase())||"GET",o=r!=="GET"&&r!=="HEAD",a=await fetch(`${Cl}${e}`,{credentials:"include",...t,headers:o?ax(t==null?void 0:t.headers):{...t==null?void 0:t.headers}});if(!a.ok){const l=await a.json().catch(()=>({}));if(!s&&o&&ox(a.status,l)&&await rx())return ee(e,t,!0);throw new Error(l.error||a.statusText)}if(a.status!==204)return a.json()}async function ix(e,t){const s=new FormData;s.append("file",t);const r={},o=pf();o&&(r["X-CSRF-Token"]=o);const a=await fetch(`${Cl}${e}`,{method:"POST",credentials:"include",headers:r,body:s});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||a.statusText)}return a.json()}const $={getMe(){return ee("/auth/me").then(e=>(ar(e.csrfToken??null),e))},login(e,t){return ee("/auth/login",{method:"POST",body:JSON.stringify({email:e,password:t})}).then(s=>(ar(s.csrfToken??null),s))},logout(){return ee("/auth/logout",{method:"POST"}).finally(()=>ar(null))},changePassword(e,t){return ee("/auth/password",{method:"PATCH",body:JSON.stringify({current_password:e,new_password:t})})},getSettings(){return ee("/settings")},saveSetting(e,t){return ee(`/settings/${e}`,{method:"PUT",body:JSON.stringify(t)})},getAds(){return ee("/ads")},getActiveAd(e){return ee(`/ads/active/${e}`)},getActiveAds(e){return ee(`/ads/active/${e}/all`)},recordAdImpression(e){return ee(`/ads/${e}/impression`,{method:"POST"})},createAd(e){return ee("/ads",{method:"POST",body:JSON.stringify(e)})},updateAd(e,t){return ee(`/ads/${e}`,{method:"PUT",body:JSON.stringify(t)})},deleteAd(e){return ee(`/ads/${e}`,{method:"DELETE"})},getShorts(e=!1){return ee(`/shorts${e?"?all=true":""}`)},createShort(e){return ee("/shorts",{method:"POST",body:JSON.stringify(e)})},updateShort(e,t){return ee(`/shorts/${e}`,{method:"PATCH",body:JSON.stringify(t)})},deleteShort(e){return ee(`/shorts/${e}`,{method:"DELETE"})},swapShorts(e,t){return ee("/shorts/swap",{method:"POST",body:JSON.stringify({aId:e,bId:t})})},reorderShorts(e){return ee("/shorts/reorder",{method:"POST",body:JSON.stringify({orderedIds:e})})},syncShortsFromYouTube(){return ee("/shorts/sync",{method:"POST"})},getDashboardStats(){return ee("/admin/dashboard-stats")},getTrendingTopics(e=!1){return ee(`/trending-topics${e?"?all=true":""}`)},createTrendingTopic(e){return ee("/trending-topics",{method:"POST",body:JSON.stringify(e)})},updateTrendingTopic(e,t){return ee(`/trending-topics/${e}`,{method:"PATCH",body:JSON.stringify(t)})},deleteTrendingTopic(e){return ee(`/trending-topics/${e}`,{method:"DELETE"})},swapTrendingTopics(e,t){return ee("/trending-topics/swap",{method:"POST",body:JSON.stringify({aId:e,bId:t})})},getGalleries(e){const t=e?`?articleId=${encodeURIComponent(e)}`:"";return ee(`/galleries${t}`)},createGallery(e){return ee("/galleries",{method:"POST",body:JSON.stringify(e)})},updateGallery(e,t){return ee(`/galleries/${e}`,{method:"PATCH",body:JSON.stringify(t)})},deleteGallery(e){return ee(`/galleries/${e}`,{method:"DELETE"})},addGalleryItem(e,t){return ee(`/galleries/${e}/items`,{method:"POST",body:JSON.stringify(t)})},updateGalleryItem(e,t){return ee(`/gallery-items/${e}`,{method:"PATCH",body:JSON.stringify(t)})},deleteGalleryItem(e){return ee(`/gallery-items/${e}`,{method:"DELETE"})},uploadMedia(e){return ix("/media/upload",e)},importMediaUrl(e){return ee("/media/import-url",{method:"POST",body:JSON.stringify({url:e})})},getArticles(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.category&&t.set("category",e.category),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!=null&&t.set("offset",String(e.offset)),e!=null&&e.appOnly&&t.set("appOnly","true"),e!=null&&e.full&&t.set("full","true");const s=t.toString();return ee(`/articles${s?`?${s}`:""}`)},searchArticles(e){const t=new URLSearchParams;e!=null&&e.q&&t.set("q",e.q),e!=null&&e.from&&t.set("from",e.from),e!=null&&e.to&&t.set("to",e.to),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!=null&&t.set("offset",String(e.offset));const s=t.toString();return ee(`/articles/search${s?`?${s}`:""}`)},getRelatedArticles(e,t){const s=new URLSearchParams;t!=null&&t.category&&s.set("category",t.category),(t==null?void 0:t.limit)!=null&&s.set("limit",String(t.limit));const r=s.toString();return ee(`/articles/${encodeURIComponent(e)}/related${r?`?${r}`:""}`)},getPopularArticles(e=6){return ee(`/articles/popular?limit=${e}`)},getSharePreviewArticle(){return ee("/articles/share-preview")},recordArticleView(e){return ee(`/articles/${e}/view`,{method:"POST"})},likeArticle(e){return ee(`/articles/${e}/like`,{method:"POST"})},getArticle(e){return ee(`/articles/${e}`)},getArticleBySlug(e){return ee(`/articles/slug/${encodeURIComponent(e)}`)},getUserArticles(e,t){const s=new URLSearchParams;(t==null?void 0:t.limit)!=null&&s.set("limit",String(t.limit)),(t==null?void 0:t.offset)!=null&&s.set("offset",String(t.offset));const r=s.toString();return ee(`/users/${encodeURIComponent(e)}/articles${r?`?${r}`:""}`)},getArticleByWpId(e){return ee(`/articles/wp/${e}`)},createArticle(e){return ee("/articles",{method:"POST",body:JSON.stringify(e)})},updateArticle(e,t){return ee(`/articles/${e}`,{method:"PUT",body:JSON.stringify(t)})},deleteArticle(e){return ee(`/articles/${e}`,{method:"DELETE"})},getMedia(e){const t=new URLSearchParams;(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!=null&&t.set("offset",String(e.offset)),e!=null&&e.q&&t.set("q",e.q);const s=t.toString();return ee(`/media${s?`?${s}`:""}`)},updateMedia(e,t){return ee(`/media/${e}`,{method:"PATCH",body:JSON.stringify(t)})},deleteMedia(e){return ee(`/media/${e}`,{method:"DELETE"})},getComments(e){const t=new URLSearchParams;e!=null&&e.articleId&&t.set("articleId",e.articleId),e!=null&&e.status&&t.set("status",e.status);const s=t.toString();return ee(`/comments${s?`?${s}`:""}`)},getArticleComments(e){return ee(`/articles/${encodeURIComponent(e)}/comments`)},createComment(e){return ee("/comments",{method:"POST",body:JSON.stringify(e)})},updateCommentStatus(e,t){return ee(`/comments/${e}`,{method:"PATCH",body:JSON.stringify({status:t})})},deleteComment(e){return ee(`/comments/${e}`,{method:"DELETE"})},getUsers(e){const t=new URLSearchParams;e!=null&&e.role&&t.set("role",e.role),e!=null&&e.search&&t.set("search",e.search);const s=t.toString();return ee(`/users${s?`?${s}`:""}`)},updateUserRole(e,t){return ee(`/users/${e}`,{method:"PATCH",body:JSON.stringify({role:t})})},resetUserPassword(e,t){return ee(`/users/${e}/password`,{method:"PATCH",body:JSON.stringify({password:t})})},createUser(e){return ee("/users",{method:"POST",body:JSON.stringify(e)})},deleteUser(e){return ee(`/users/${e}`,{method:"DELETE"})},getCategories(e){const t=new URLSearchParams;e!=null&&e.navOnly&&t.set("navOnly","true");const s=t.toString();return ee(`/categories${s?`?${s}`:""}`)},createCategory(e){return ee("/categories",{method:"POST",body:JSON.stringify(e)})}
1,deleteCategory(e){return ee(`/categories/${e}`,{method:"DELETE"})},getPages(e){const t=new URLSearchParams;e!=null&&e.all&&t.set("all","true"),e!=null&&e.footer&&t.set("footer","true"),e!=null&&e.status&&t.set("status",e.status);const s=t.toString();return ee(`/pages${s?`?${s}`:""}`)},getPage(e){return ee(`/pages/${encodeURIComponent(e)}`)},getPageBySlug(e){return ee(`/pages/slug/${encodeURIComponent(e)}`)},createPage(e){return ee("/pages",{method:"POST",body:JSON.stringify(e)})},updatePage(e,t){return ee(`/pages/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deletePage(e){return ee(`/pages/${encodeURIComponent(e)}`,{method:"DELETE"})},getBackups(){return ee("/backups")},getBackupRestoreStatus(){return ee("/backups/restore-status")},runBackup(){return ee("/backups/run",{method:"POST"})},restoreBackup(e,t){return ee(`/backups/${encodeURIComponent(e)}/restore`,{method:"POST",body:JSON.stringify({confirm:t})})}},gf=6e4;function lx(e){return["pages",(e==null?void 0:e.all)??!1,(e==null?void 0:e.footer)??!1]}function cx(e={}){const t=va({queryKey:lx(e),queryFn:()=>$.getPages({all:e.all,footer:e.footer}),staleTime:gf});return{pages:t.data??[],loading:t.isLoading,error:t.error?t.error instanceof Error?t.error.message:"BÅÄ d pobierania stron":null,refetch:t.refetch}}function dx(e){const t=va({queryKey:["page",e],queryFn:()=>$.getPageBySlug(e),enabled:!!e,staleTime:gf,retry:!1});return{page:t.data,loading:t.isLoading,notFound:t.isError}}function ux(){const e=ja();return f.useCallback(()=>e.invalidateQueries({queryKey:["pages"]}),[e])}/*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */function Ec(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,r=Array(t);s<t;s++)r[s]=e[s];return r}function fx(e){if(Array.isArray(e))return e}function mx(e,t){var s=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(s!=null){var r,o,a,i,l=[],c=!0,d=!1;try{if(a=(s=s.call(e)).next,t!==0)for(;!(c=(r=a.call(s)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(h){d=!0,o=h}finally{try{if(!c&&s.return!=null&&(i=s.return(),Object(i)!==i))return}finally{if(d)throw o}}return l}}function hx(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function px(e,t){return fx(e)||mx(e,t)||gx(e,t)||hx()}function gx(e,t){if(e){if(typeof e=="string")return Ec(e,t);var s={}.toString.call(e).slice(8,-1);return s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set"?Array.from(e):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Ec(e,t):void 0}}const xf=Object.entries,zc=Object.setPrototypeOf,xx=Object.isFrozen,bx=Object.getPrototypeOf,wx=Object.getOwnPropertyDescriptor;let pt=Object.freeze,gt=Object.seal,_n=Object.create,bf=typeof Reflect<"u"&&Reflect,Ri=bf.apply,$i=bf.construct;pt||(pt=function(t){return t});gt||(gt=function(t){return t});Ri||(Ri=function(t,s){for(var r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];return t.apply(s,o)});$i||($i=function(t){for(var s=arguments.length,r=new Array(s>1?s-1:0),o=1;o<s;o++)r[o-1]=arguments[o];return new t(...r)});const jn=tt(Array.prototype.forEach),yx=tt(Array.prototype.lastIndexOf),Ac=tt(Array.prototype.pop),Nn=tt(Array.prototype.push),vx=tt(Array.prototype.splice),Ks=Array.isArray,rr=tt(String.prototype.toLowerCase),Fa=tt(String.prototype.toString),Mc=tt(String.prototype.match),Kn=tt(String.prototype.replace),Lc=tt(String.prototype.indexOf),jx=tt(String.prototype.trim),Nx=tt(Number.prototype.toString),kx=tt(Boolean.prototype.toString),Ic=typeof BigInt>"u"?null:tt(BigInt.prototype.toString),Oc=typeof Symbol>"u"?null:tt(Symbol.prototype.toString),dt=tt(Object.prototype.hasOwnProperty),qn=tt(Object.prototype.toString),ct=tt(RegExp.prototype.test),sn=Sx(TypeError);function tt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var s=arguments.length,r=new Array(s>1?s-1:0),o=1;o<s;o++)r[o-1]=arguments[o];return Ri(e,t,r)}}function Sx(e){return function(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];
vendor: 4,574 bytes, line 2
2return $i(e,s)}}function _e(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rr;if(zc&&zc(e,null),!Ks(t))return e;let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const a=s(o);a!==o&&(xx(t)||(t[r]=a),o=a)}e[o]=!0}return e}function Cx(e){for(let t=0;t<e.length;t++)dt(e,t)||(e[t]=null);return e}function jt(e){const t=_n(null);for(const r of xf(e)){var s=px(r,2);const o=s[0],a=s[1];dt(e,o)&&(Ks(a)?t[o]=Cx(a):a&&typeof a=="object"&&a.constructor===Object?t[o]=jt(a):t[o]=a)}return t}function _x(e){switch(typeof e){case"string":return e;case"number":return Nx(e);case"boolean":return kx(e);case"bigint":return Ic?Ic(e):"0";case"symbol":return Oc?Oc(e):"Symbol()";case"undefined":return qn(e);case"function":case"object":{if(e===null)return qn(e);const t=e,s=ps(t,"toString");if(typeof s=="function"){const r=s(t);return typeof r=="string"?r:qn(r)}return qn(e)}default:return qn(e)}}function ps(e,t){for(;e!==null;){const r=wx(e,t);if(r){if(r.get)return tt(r.get);if(typeof r.value=="function")return tt(r.value)}e=bx(e)}function s(){return null}return s}function Tx(e){try{return ct(e,""),!0}catch{return!1}}const Dc=pt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Wa=pt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ua=pt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ex=pt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ha=pt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),zx=pt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Pc=pt(["#text"]),Rc=pt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
2spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Ga=pt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$c=pt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),so=pt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ax=gt(/{{[\w\W]*|^[\w\W]*}}/g),Mx=gt(/<%[\w\W]*|^[\w\W]*%>/g),Lx=gt(/\${[\w\W]*/g),Ix=gt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ox=gt(/^aria-[\-\w]+$/),Bc=gt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Dx=gt(/^(?:\w+script|data):/i),Px=gt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Rx=gt(/^html$/i),$x=gt(/^[a-z][.\w]*(-[.\w]+)+$/i),Fc=gt(/<[/\w!]/g),Wc=gt(/<[/\w]/g),Bx=gt(/<\/no(script|embed|frames)/i),Fx=gt(/\/>/i),Rt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Wx=function(){return typeof window>"u"?null:window},Ux=function(t,s){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";s&&s.hasAttribute(o)&&(r=s.getAttribute(o));const a="dompurify"+(r?"#"+r:"");try{return t.createPolicy(a,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Uc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ps=function(t,s,r,o){return dt(t,s)&&Ks(t[s])?_e(o.base?jt(o.base):{},t[s],o.transform):r};function wf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Wx();const t=J=>wf(J);if(t.version="3.4.12",t.removed=[],!e||!e.document||e.document.nodeType!==Rt.document||!e.Element)return t.isSupported=!1,t;let s=e.document;const r=s,o=r.currentScript;e.DocumentFragment;const a=e.HTMLTemplateElement,i=e.Node,l=e.Element,c=e.NodeFilter,d=e.NamedNodeMap;d===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const h=e.DOMParser,u=e.trustedTypes,p=l.prototype,m=ps(p,"cloneNode"),b=ps(p,"remove"),x=ps(p,"nextSibling"),g=ps(p,"childNodes"),y=ps(p,"parentNode"),N=ps(p,"shadowRoot"),w=ps(p,"attributes"),k=i&&i.prototype?ps(i.prototype,"nodeType"):null,E=i&&i.prototype?ps(i.prototype,"nodeName"):null;if(typeof a=="function"){const J=s.createElement("template");J.content&&J.content.ownerDocument&&(s=J.content.ownerDocument)}let v,S="",z,B=!1,M=0;const D=function(){if(M>0)throw sn('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},A=function(j){D(),M++;try{return v.createHTML(j)}finally{M--}},U=function(j){D(),M++;try{return v.createScriptURL(j)}finally{M--}},se=function(){return B||(z=Ux(u,o),B=!0),z},P=s,ne=P.implementation,C=P.createNodeIterator,I=P.createDocumentFragment,F=P.getElementsByTagName,ae=r.importNode;let Z=Uc();t.isSupported=typeof xf=="function"&&typeof y=="function"&&ne&&ne.createHTMLDocument!==void 0;const Q=Ax,re=Mx,oe=Lx,Y=Ix,O=Ox,_=Dx,W=Px,de=$x;let he=Bc,ve=null;const R=_e({},[...Dc,...Wa,...Ua,...Ha,...Pc]);let ie=null;const ge=_e({},[...Rc,...Ga,...$c,...so]);
vendor: 8,481 bytes, line 2
2let H=Object.seal(_n(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ce=null,ke=null;const T=Object.seal(_n(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let te=!0,xe=!0,me=!1,at=!0,De=!1,st=!0,Qe=!1,Xe=!1,Je=null,xt=null,It=!1,nt=!1,it=!1,Ut=!1,Ht=!0,mt=!1;const Ot="user-content-";let yt=!0,fs=!1,Dt={},rt=null;const ms=_e({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Is=null;const Pe=_e({},["audio","video","img","source","image","track"]);let Le=null;const et=_e({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",be="http://www.w3.org/2000/svg",pe="http://www.w3.org/1999/xhtml";let ze=pe,Re=!1,Ee=null;const Ge=_e({},[ue,be,pe],Fa),Ie=pt(["mi","mo","mn","ms","mtext"]);let $e=_e({},Ie);const Zt=pt(["annotation-xml"]);let Gt=_e({},Zt);const St=_e({},["title","style","font","a","script"]);let Ct=null;const en=["application/xhtml+xml","text/html"],Da="text/html";let Be=null,K=null;const Ae=s.createElement("form"),Os=function(j){return j instanceof RegExp||j instanceof Function},Gn=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(K&&K===j)return;(!j||typeof j!="object")&&(j={}),j=jt(j),Ct=en.indexOf(j.PARSER_MEDIA_TYPE)===-1?Da:j.PARSER_MEDIA_TYPE,Be=Ct==="application/xhtml+xml"?Fa:rr,ve=Ps(j,"ALLOWED_TAGS",R,{transform:Be}),ie=Ps(j,"ALLOWED_ATTR",ge,{transform:Be}),Ee=Ps(j,"ALLOWED_NAMESPACES",Ge,{transform:Fa}),Le=Ps(j,"ADD_URI_SAFE_ATTR",et,{transform:Be,base:et}),Is=Ps(j,"ADD_DATA_URI_TAGS",Pe,{transform:Be,base:Pe}),rt=Ps(j,"FORBID_CONTENTS",ms,{transform:Be}),ce=Ps(j,"FORBID_TAGS",jt({}),{transform:Be}),ke=Ps(j,"FORBID_ATTR",jt({}),{transform:Be}),Dt=dt(j,"USE_PROFILES")?j.USE_PROFILES&&typeof j.USE_PROFILES=="object"?jt(j.USE_PROFILES):j.USE_PROFILES:!1,te=j.ALLOW_ARIA_ATTR!==!1,xe=j.ALLOW_DATA_ATTR!==!1,me=j.ALLOW_UNKNOWN_PROTOCOLS||!1,at=j.ALLOW_SELF_CLOSE_IN_ATTR!==!1,De=j.SAFE_FOR_TEMPLATES||!1,st=j.SAFE_FOR_XML!==!1,Qe=j.WHOLE_DOCUMENT||!1,nt=j.RETURN_DOM||!1,it=j.RETURN_DOM_FRAGMENT||!1,Ut=j.RETURN_TRUSTED_TYPE||!1,It=j.FORCE_BODY||!1,Ht=j.SANITIZE_DOM!==!1,mt=j.SANITIZE_NAMED_PROPS||!1,yt=j.KEEP_CONTENT!==!1,fs=j.IN_PLACE||!1,he=Tx(j.ALLOWED_URI_REGEXP)?j.ALLOWED_URI_REGEXP:Bc,ze=typeof j.NAMESPACE=="string"?j.NAMESPACE:pe,$e=dt(j,"MATHML_TEXT_INTEGRATION_POINTS")&&j.MATHML_TEXT_INTEGRATION_POINTS&&typeof j.MATHML_TEXT_INTEGRATION_POINTS=="object"?jt(j.MATHML_TEXT_INTEGRATION_POINTS):_e({},Ie),Gt=dt(j,"HTML_INTEGRATION_POINTS")&&j.HTML_INTEGRATION_POINTS&&typeof j.HTML_INTEGRATION_POINTS=="object"?jt(j.HTML_INTEGRATION_POINTS):_e({},Zt);const L=dt(j,"CUSTOM_ELEMENT_HANDLING")&&j.CUSTOM_ELEMENT_HANDLING&&typeof j.CUSTOM_ELEMENT_HANDLING=="object"?jt(j.CUSTOM_ELEMENT_HANDLING):_n(null);if(H=_n(null),dt(L,"tagNameCheck")&&Os(L.tagNameCheck)&&(H.tagNameCheck=L.tagNameCheck),dt(L,"attributeNameCheck")&&Os(L.attributeNameCheck)&&(H.attributeNameCheck=L.attributeNameCheck),dt(L,"allowCustomizedBuiltInElements")&&typeof L.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=L.allowCustomizedBuiltInElements),gt(H),De&&(xe=!1),it&&(nt=!0),Dt&&(ve=_e({},Pc),ie=_n(null),Dt.html===!0&&(_e(ve,Dc),_e(ie,Rc)),Dt.svg===!0&&(_e(ve,Wa),_e(ie,Ga),_e(ie,so)),Dt.svgFilters===!0&&(_e(ve,Ua),_e(ie,Ga),_e(ie,so)),Dt.mathMl===!0&&(_e(ve,Ha),_e(ie,$c),_e(ie,so))),T.tagCheck=null,T.attributeCheck=null,dt(j,"ADD_TAGS")&&(typeof j.ADD_TAGS=="function"?T.tagCheck=j.ADD_TAGS:Ks(j.ADD_TAGS)&&(ve===R&&(ve=jt(ve)),_e(ve,j.ADD_TAGS,Be))),dt(j,"ADD_ATTR")&&(typeof j.ADD_ATTR=="function"?T.attributeCheck=j.ADD_ATTR:Ks(j.ADD_ATTR)&&(ie===ge&&(ie=jt(ie)),_e(ie,j.ADD_ATTR,Be))),dt(j,"ADD_URI_SAFE_ATTR")&&Ks(j.ADD_URI_SAFE_ATTR)&&_e(Le,j.ADD_URI_SAFE_ATTR,Be),dt(j,"FORBID_CONTENTS")&&Ks(j.FORBID_CONTENTS)&&(rt===ms&&(rt=jt(rt)),_e(rt,j.FORBID_CONTENTS,Be)),dt(j,"ADD_FORBID_CONTENTS")&&Ks(j.ADD_FORBID_CONTENTS)&&(rt===ms&&(rt=jt(rt)),_e(rt,j.ADD_FORBID_CONTENTS,Be)),yt&&(ve["#text"]=!0),Qe&&_e(ve,["html","head","body"]),ve.table&&(_e(ve,["tbody"]),delete ce.tbody),j.TRUSTED_TYPES_POLICY){if(typeof j.TRUSTED_TYPES_POLICY.createHTML!="function")throw sn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof j.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw sn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const V=v;v=j.TRUSTED_TYPES_POLICY;try{S=A("")}catch(le){throw v=V,le}}else j.TRUSTED_TYPES_POLICY===null?(v=void 0,S=""):(v===void 0&&(v=se()),v&&typeof S=="string"&&(S=A("")));pt&&pt(j),K=j},Jr=_e({},[...Wa,...Ua,...Ex]),Yn=_e({},[...Ha,...zx]),Pt=function(j,L,V){return L.namespaceURI===pe?j==="svg":L.namespaceURI===ue?j==="svg"&&(V==="annotation-xml"||$e[V]):!!Jr[j]},Pa=function(j,L,V){return L.namespaceURI===pe?j==="math":L.namespaceURI===be?j==="math"&&Gt[V]:!!Yn[j]},fp=function(j,L,V){return L.namespaceURI===be&&!Gt[V]||L.namespaceURI===ue&&!$e[V]?!1:!Yn[j]&&(St[j]||!Jr[j])},mp=function(j){let L=y(j);(!L||!L.tagName)&&(L={namespaceURI:ze,tagName:"template"});const V=rr(j.tagName),le=rr(L.tagName);return Ee[j.namespaceURI]?j.namespaceURI===be?Pt(V,L,le):j.namespaceURI===ue?Pa(V,L,le):j.namespaceURI===pe?fp(V,L,le):!!(Ct==="application/xhtml+xml"&&Ee[j.namespaceURI]):!1},Ds=function(j){Nn(t.removed,{element:j});try{y(j).removeChild(j)}catch{if(b(j),!y(j))throw sn("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Zr=function(j){Ra(j);const L=g(j);if(L){const le=[];jn(L,we=>{Nn(le,we)}),jn(le,we=>{try{b(we)}catch{}})}const V=w(j);if(V)for(let le=V.length-1;le>=0;--le){const we=V[le],je=we&&we.name;if(typeof je=="string")try{j.removeAttribute(je)}catch{}}},tn=function(j,L){try{Nn(t.removed,{attribute:L.getAttributeNode(j),from:L})}catch{Nn(t.removed,{attribute:null,from:L})}if(L.removeAttribute(j),j==="is")if(nt||it)try{Ds(L)}catch{}else try{L.setAttribute(j,"")}catch{}},hp=function(j){const L=w(j);if(L)for(let V=L.length-1;V>=0;--V){const le=L[V],we=le&&le.name;if(!(typeof we!="string"||ie[Be(we)]))try{j.removeAttribute(we)}catch{}}},Ra=function(j){const L=[j];for(;L.length>0;){const V=L.pop();(k?k(V):V.nodeType)===Rt.element&&hp(V);const we=g(V);if(we)for(let je=we.length-1;je>=0;--je)L.push(we[je])}},pp=function(j){if(!st)return;const L=[j];for(;L.length>0;){const V=L.pop(),le=k?k(V):V.nodeType;if(le===Rt.processingInstruction||le===Rt.comment&&ct(Wc,V.data)){try{b(V)}catch{}continue}if(le===Rt.element){const je=V,Ye=Be(E?E(V):V.nodeName);try{je.hasAttribute&&je.hasAttribute("patchsrc")&&je.removeAttribute("patchsrc"),je.hasAttribute&&je.hasAttribute("for")&&Ye!=="label"&&Ye!=="output"&&je.removeAttribute("for")}catch{}}const we=g(V);if(we)for(let je=we.length-1;je>=0;--je)L.push(we[je])}},wc=function(j){let L=null,V=null;if(It)j="<remove></remove>"+j;else{const je=Mc(j,/^[\r\n\t ]+/);V=je&&je[0]}Ct==="application/xhtml+xml"&&ze===pe&&(j='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+j+"</body></html>");const le=v?A(j):j;if(ze===pe)try{L=new h().parseFromString(le,Ct)}catch{}if(!L||!L.documentElement){L=ne.createDocument(ze,"template",null);try{L.documentElement.innerHTML=Re?S:le}catch{}}const we=L.body||L.documentElement;return j&&V&&we.insertBefore(s.createTextNode(V),we.childNodes[0]||null),ze===pe?F.call(L,Qe?"html":"body")[0]:Qe?L.documentElement:we},yc=function(j){return C.call(j.ownerDocument||j,j,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Qr=function(j){return j=Kn(j,Q," "),j=Kn(j,re," "),j=Kn(j,oe," "),j},$a=function(j){var L;j.normalize();const V=C.call(j.ownerDocument||j,j,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let le=V.nextNode();for(;le;)le.data=Qr(le.data),le=V.nextNode();const we=(L=j.querySelectorAll)===null||L===void 0?void 0:L.call(j,"template");we&&jn(we,je=>{vn(je.content)&&$a(je.content)})},eo=function(j){const L=E?E(j):null;
2return typeof L!="string"||Be(L)!=="form"?!1:typeof j.nodeName!="string"||typeof j.textContent!="string"||typeof j.removeChild!="function"||j.attributes!==w(j)||typeof j.removeAttribute!="function"||typeof j.setAttribute!="function"||typeof j.namespaceURI!="string"||typeof j.insertBefore!="function"||typeof j.hasChildNodes!="function"||j.nodeType!==k(j)||j.childNodes!==g(j)},vn=function(j){if(!k||typeof j!="object"||j===null)return!1;try{return k(j)===Rt.documentFragment}catch{return!1}},Vn=function(j){if(!k||typeof j!="object"||j===null)return!1;try{return typeof k(j)=="number"}catch{return!1}};function hs(J,j,L){J.length!==0&&jn(J,V=>{V.call(t,j,L,K)})}const gp=function(j,L){return!!(st&&j.hasChildNodes()&&!Vn(j.firstElementChild)&&ct(Fc,j.textContent)&&ct(Fc,j.innerHTML)||st&&j.namespaceURI===pe&&L==="style"&&Vn(j.firstElementChild)||j.nodeType===Rt.processingInstruction||st&&j.nodeType===Rt.comment&&ct(Wc,j.data))},xp=function(j,L){if(!ce[L]&&Nc(L)&&(H.tagNameCheck instanceof RegExp&&ct(H.tagNameCheck,L)||H.tagNameCheck instanceof Function&&H.tagNameCheck(L)))return!1;if(yt&&!rt[L]){const V=y(j),le=g(j);if(le&&V){const we=le.length;for(let je=we-1;je>=0;--je){const Ye=fs?le[je]:m(le[je],!0);V.insertBefore(Ye,x(j))}}}return Ds(j),!0},vc=function(j,L){if(hs(Z.beforeSanitizeElements,j,null),j!==L&&y(j)===null)return!0;if(eo(j))return Ds(j),!0;const V=Be(E?E(j):j.nodeName);if(hs(Z.uponSanitizeElement,j,{tagName:V,allowedTags:ve}),j!==L&&y(j)===null)return!0;if(gp(j,V))return Ds(j),!0;if(ce[V]||!(T.tagCheck instanceof Function&&T.tagCheck(V))&&!ve[V]){const we=xp(j,V);return we===!1&&hs(Z.afterSanitizeElements,j,null),we}if((k?k(j):j.nodeType)===Rt.element&&!mp(j)||(V==="noscript"||V==="noembed"||V==="noframes")&&ct(Bx,j.innerHTML))return Ds(j),!0;if(De&&j.nodeType===Rt.text){const we=Qr(j.textContent);j.textContent!==we&&(Nn(t.removed,{element:j.cloneNode()}),j.textContent=we)}return hs(Z.afterSanitizeElements,j,null),!1},jc=function(j,L,V){if(ke[L]||st&&L==="patchsrc"||st&&L==="for"&&j!=="label"&&j!=="output"||Ht&&(L==="id"||L==="name")&&(V in s||V in Ae))return!1;const le=ie[L]||T.attributeCheck instanceof Function&&T.attributeCheck(L,j);if(!(xe&&ct(Y,L))){if(!(te&&ct(O,L))){if(le){if(!Le[L]){if(!ct(he,Kn(V,W,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&j!=="script"&&Lc(V,"data:")===0&&Is[j])){if(!(me&&!ct(_,Kn(V,W,"")))){if(V)return!1}}}}}else if(!(Nc(j)&&(H.tagNameCheck instanceof RegExp&&ct(H.tagNameCheck,j)||H.tagNameCheck instanceof Function&&H.tagNameCheck(j))&&(H.attributeNameCheck instanceof RegExp&&ct(H.attributeNameCheck,L)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(L,j))||L==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&ct(H.tagNameCheck,V)||H.tagNameCheck instanceof Function&&H.tagNameCheck(V))))return!1}}return!0},bp=_e({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Nc=function(j){return!bp[rr(j)]&&ct(de,j)},wp=function(j,L,V,le){if(v&&typeof u=="object"&&typeof u.getAttributeType=="function"&&!V)switch(u.getAttributeType(j,L)){case"TrustedHTML":return A(le);case"TrustedScriptURL":return U(le)}return le},yp=function(j,L,V,le){try{V?j.setAttributeNS(V,L,le):j.setAttribute(L,le),eo(j)?Ds(j):Ac(t.removed)}catch{tn(L,j)}},kc=function(j){hs(Z.beforeSanitizeAttributes,j,null);const L=j.attributes;if(!L||eo(j))return;const V={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ie,forceKeepAttr:void 0};let le=L.length;const we=Be(j.nodeName);for(;le--;){const je=L[le],Ye=je.name,bt=je.namespaceURI,Qt=je.value,_t=Be(Ye),es=Qt;let vt=Ye==="value"?es:jx(es);if(V.attrName=_t,V.attrValue=vt,V.keepAttr=!0,V.forceKeepAttr=void 0,hs(Z.uponSanitizeAttribute,j,V),vt=V.attrValue,mt&&(_t==="id"||_t==="name")&&Lc(vt,Ot)!==0&&(tn(Ye,j),vt=Ot+vt),st&&ct(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,vt)){tn(Ye,j);continue}if(_t==="attributename"&&Mc(vt,"href")){tn(Ye,j);continue}if(!V.forceKeepAttr){if(!V.keepAttr){tn(Ye,j);continue}if(!at&&ct(Fx,vt)){tn(Ye,j);continue}if(De&&(vt=Qr(vt)),!jc(we,_t,vt)){tn(Ye,j);continue}vt=wp(we,_t,bt,vt),vt!==es&&yp(j,Ye,bt,vt)}}hs(Z.afterSanitizeAttributes,j,null)},to=function(j){let L=null;const V=yc(j);for(hs(Z.beforeSanitizeShadowDOM,j,null);L=V.nextNode();)if(hs(Z.uponSanitizeShadowNode,L,null),vc(L,j),kc(L),vn(L.content)&&to(L.content),(k?k(L):L.nodeType)===Rt.element){const we=N(L);vn(we)&&(Ba(we),to(we))}hs(Z.afterSanitizeShadowDOM,j,null)},Ba=function(j){const L=[{node:j,shadow:null}];for(;L.length>0;){const V=L.pop();if(V.shadow){to(V.shadow);continue}const le=V.node,je=(k?k(le):le.nodeType)===Rt.element,Ye=g(le);if(Ye)for(let bt=Ye.length-1;bt>=0;--bt)L.push({node:Ye[bt],shadow:null});if(je){const bt=E?E(le):null;if(typeof bt=="string"&&Be(bt)==="template"){const Qt=le.content;vn(Qt)&&L.push({node:Qt,shadow:null})}}if(je){const bt=N(le);vn(bt)&&L.push({node:null,shadow:bt},{node:bt,shadow:null})}}};return t.sanitize=function(J){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,V=null,le=null,we=null;if(Re=!J,Re&&(J="<!-->"),typeof J!="string"&&!Vn(J)&&(J=_x(J),typeof J!="string"))throw sn("dirty is not a string, aborting");if(!t.isSupported)return J;Xe?(ve=Je,ie=xt):Gn(j),(Z.uponSanitizeElement.length>0||Z.uponSanitizeAttribute.length>0)&&(ve=jt(ve)),Z.uponSanitizeAttribute.length>0&&(ie=jt(ie)),t.removed=[];const je=fs&&typeof J!="string"&&Vn(J);if(je){pp(J);const _t=E?E(J):J.nodeName;if(typeof _t=="string"){const es=Be(_t);if(!ve[es]||ce[es])throw Zr(J),sn("root node is forbidden and cannot be sanitized in-place")}if(eo(J))throw Zr(J),sn("root node is clobbered and cannot be sanitized in-place");try{Ba(J)}catch(es){throw Zr(J),es}}else if(Vn(J))L=wc("<!---->"),V=L.ownerDocument.importNode(J,!0),V.nodeType===Rt.element&&V.nodeName==="BODY"||V.nodeName==="HTML"?L=V:L.appendChild(V),Ba(V);else{if(!nt&&!De&&!Qe&&J.indexOf("<")===-1)return v&&Ut?A(J):J;if(L=wc(J),!L)return nt?null:Ut?S:""}L&&It&&Ds(L.firstChild);const Ye=je?J:L,bt=yc(Ye);try{for(;le=bt.nextNode();)vc(le,Ye),kc(le),vn(le.content)&&to(le.content)}catch(_t){throw je&&(Zr(J),jn(t.removed,es=>{es.element&&Ra(es.element)})),_t}if(je)return jn(t.removed,_t=>{_t.element&&Ra(_t.element)}),De&&$a(J),J;if(nt){if(De&&$a(L),it)for(we=I.call(L.ownerDocument);L.firstChild;)we.appendChild(L.firstChild);else we=L;return(ie.shadowroot||ie.shadowrootmode)&&(we=ae.call(r,we,!0)),we}let Qt=Qe?L.outerHTML:L.innerHTML;return Qe&&ve["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&ct(Rx,L.ownerDocument.doctype.name)&&(Qt="<!DOCTYPE "+L.ownerDocument.doctype.name+`> 3`+Qt),De&&(Qt=Qr(Qt)),v&&Ut?A(Qt):Qt},t.setConfig=function(){let J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gn(J),Xe=!0,Je=ve,xt=ie},t.clearConfig=function(){K=null,Xe=!1,Je=null,xt=null,v=z,S=""},t.isValidAttribute=function(J,j,L){K||Gn({});const V=Be(J),le=Be(j);return jc(V,le,L)},t.addHook=function(J,j){typeof j=="function"&&dt(Z,J)&&Nn(Z[J],j)},t.removeHook=function(J,j){if(dt(Z,J)){if(j!==void 0){const L=yx(Z[J],j);return L===-1?void 0:vx(Z[J],L,1)[0]}return Ac(Z[J])}},t.removeHooks=function(J){dt(Z,J)&&(Z[J]=[])},t.removeAllHooks=function(){Z=Uc()},t}var yf=wf();const Hx=/(?:youtube\.com\/(?:watch\?(?:[^&\s>]*&)*v=|embed\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,Gx=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?(?:[^\s<]*&)*v=|embed\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})\S*/gi,Yx=new RegExp(String.raw`https?:\/\/(?:www\.|m\.)?facebook\.com\/(?:reel\/\d+|watch\/\?[^\s"'<]+|[^/\s"'<]+\/videos\/\d+)\/[^\s"'<]*`,"gi"),Vx=new RegExp(String.raw`https?:\/\/(?:www\.|m\.)?facebook\.com\/[^\s"'<]+\/posts\/[^\s"'<]+`,"gi"),Kx=/(?:x\.com|twitter\.com)\/[^/?#\s"'<>]+\/status\/(\d+)/i,qx=new RegExp(String.raw`https?:\/\/(?:www\.)?(?:x\.com|twitter\.com)\/[^/\s"'<]+\/status\/(\d+)\S*`,"gi"),Xx=/<blockquote\b[^>]*\btwitter-tweet\b[^>]*>[\s\S]*?<\/blockquote>/gi,Jx=/<script\b[^>]*\bsrc=["']https?:\/\/platform\.(?:x|twitter)\.com\/widgets\.js["'][^>]*>\s*<\/script>/gi;function _l(e){const t=String(e).match(Hx);return(t==null?void 0:t[1])??null}function Na(e){const t=String(e).match(Kx);return(t==null?void 0:t[1])??null}function vf(e){const t=String(e).trim();if(!t)return null;const s=Na(t);if(!s)return null;
3try{const r=new URL(t,"https://x.com"),o=r.hostname.toLowerCase().replace(/^www\./,"");if(o!=="x.com"&&o!=="twitter.com")return null;const a=r.pathname.match(/^\/([^/]+)\/status\/\d+/);return`https://x.com/${(a==null?void 0:a[1])??"i"}/status/${s}`}catch{return`https://x.com/i/status/${s}`}}function jf(e){for(const t of Sf(e)){const s=vf(t);if(s)return s}return null}function ka(e){const t=String(e).trim();if(!t)return null;try{const s=new URL(t,"https://www.facebook.com");if(!s.hostname.replace(/^m\./,"www.").endsWith("facebook.com"))return null;if(s.pathname.startsWith("/reel/"))return`https://www.facebook.com${s.pathname.replace(/\/$/,"")}/`;if(s.pathname==="/watch"&&s.searchParams.get("v")||s.pathname.match(/\/videos\/(\d+)/))return s.toString();if(s.pathname.includes("/plugins/video.php")){const a=s.searchParams.get("href");if(a)return ka(a)}}catch{return null}return null}function $r(e){const t=String(e).trim();if(!t)return null;try{const s=new URL(t,"https://www.facebook.com");if(!s.hostname.replace(/^m\./,"www.").endsWith("facebook.com"))return null;if(s.pathname.startsWith("/plugins/post.php")){const o=s.searchParams.get("href");if(o)return $r(o)}if(s.pathname.includes("/posts/")||s.pathname==="/permalink.php"||s.pathname.includes("/photo.php")||s.pathname.includes("/story.php"))return s.toString().replace(/^http:/i,"https:")}catch{return null}return null}function Nf(e){if(!e)return!1;try{const t=new URL(e,"https://example.com"),s=t.hostname.toLowerCase().replace(/^m\./,"www.");if(s==="www.youtube-nocookie.com"||s==="youtube-nocookie.com"||s==="www.youtube.com"||s==="youtube.com")return t.pathname.startsWith("/embed/")||t.pathname.startsWith("/watch");if(s==="www.facebook.com"||s==="facebook.com"){if(t.pathname.startsWith("/plugins/video.php")){const r=t.searchParams.get("href");return r&&ka(r)!==null}if(t.pathname.startsWith("/plugins/post.php")){const r=t.searchParams.get("href");return r&&$r(r)!==null}}if(s==="platform.x.com"||s==="platform.twitter.com"){const r=t.searchParams.get("id");return t.pathname==="/embed/Tweet.html"&&/^\d+$/.test(r??"")}}catch{return!1}return!1}function Tl(e){return`<div class="article-video-embed"><iframe src="https://www.youtube-nocookie.com/embed/${e}?rel=0" title="Film YouTube" loading="lazy" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="true"></iframe></div>`}function kf(e){const t=ka(e);return t?`<div class="article-video-embed"><iframe src="${`https://www.facebook.com/plugins/video.php?height=314&href=${encodeURIComponent(t)}&show_text=false&width=560&t=0`}" width="560" height="314" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe></div>`:""}function Zx(e){const t=$r(e);return t?`<div class="article-facebook-post-embed"><iframe src="${`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(t)}&show_text=true&width=500`}" width="500" height="672" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share" title="Wpis Facebook"></iframe></div>`:""}function El(e){const t=/^\d+$/.test(String(e??""))?String(e):Na(e);return t?`<div class="article-x-tweet-embed"><iframe src="${`https://platform.x.com/embed/Tweet.html?id=${t}&dnt=true`}" title="Post X (Twitter)" loading="lazy" allowfullscreen="true" frameborder="0" scrolling="no"></iframe></div>`:""}function zl(e){const t=jf(e);return t?El(Na(t)):null}function Sa(e){return String(e).replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"')}function Sf(e){const t=Sa(e),s=[];for(const r of t.matchAll(/href=["']([^"']+)["']/gi))s.push(r[1]);for(const r of t.matchAll(/https?:\/\/[^\s"'<>]+/gi))s.push(r[0]);return s}function Hc(e){const t=Sa(e),s=t.match(/<iframe[\s\S]*?<\/iframe>/i);if(s){let o=s[0];const a=o.match(/\ssrc=["']<a[^>]*href=["']([^"']+)["']/i);a&&(o=o.replace(/\ssrc=["'][^"']*["']/i,` src="${a[1]}"`));const i=Al(o);if(i)return i}const r=zl(t);if(r)return r;for(const o of Sf(e)){const a=an(o);if(a)return a}return null}function Al(e){const t=e.match(/\ssrc=["']([^"']+)["']/i);if(!t)return null;const s=t[1],r=_l(s);if(r)return Tl(r);if(s.includes("facebook.com/plugins/video.php")){const o=s.match(/[?&]href=([^&"']+)/i);if(o){const a=kf(decodeURIComponent(o[1]));if(a)return a}}if(s.includes("facebook.com/plugins/post.php")){const o=s.match(/[?&]href=([^&"']+)/i);if(o&&$r(decodeURIComponent(o[1]))){const a=/<\/iframe>\s*$/i.test(e)?e.trim():e.trim().replace(/\/?>\s*$/i,"></iframe>");return e.includes('class="article-facebook-post-embed"')?e:`<div class="article-facebook-post-embed">${a}</div>`}}if(s.includes("platform.x.com/embed/Tweet.html")||s.includes("platform.twitter.com/embed/Tweet.html")){const o=s.match(/[?&]id=(\d+)/i);if(o)return El(o[1])}if(Nf(s)){const o=e.replace(/^<iframe/i,"<iframe").replace(/\s*\/?>$/,"></iframe>");return e.includes('class="article-video-embed"')?e:`<div class="article-video-embed">${o}</div>`}return null}function an(e){const t=_l(e);
3if(t)return Tl(t);const s=ka(e);if(s)return kf(s);const r=$r(e);if(r)return Zx(r);const o=vf(e);return o?El(Na(o)):null}function Qx(e){const t=String(e??"");if(typeof Buffer<"u")return Buffer.from(t,"utf8").toString("base64url");const s=new TextEncoder().encode(t);let r="";for(const o of s)r+=String.fromCharCode(o);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Cf(e){const t=String(e??"");if(!t)return"";if(typeof Buffer<"u")return Buffer.from(t,"base64url").toString("utf8");const s=t.replace(/-/g,"+").replace(/_/g,"/"),r=s.length%4?"=".repeat(4-s.length%4):"",o=atob(s+r),a=Uint8Array.from(o,i=>i.charCodeAt(0));return new TextDecoder().decode(a)}function Ml(e){const t=String(e??"").trim();if(!t)return"";if(/<blockquote[\s>]/i.test(t)&&/twitter-tweet/i.test(t)){const r=zl(t);if(r)return r}if(/<iframe[\s>]/i.test(t)){const r=t.match(/<iframe[\s\S]*?<\/iframe>/i);if(r){const o=Al(r[0]);if(o)return o}return Tf(t)}const s=/^https?:\/\//i.test(t)?t:`https://${t}`;return an(s)||""}function eb(e){var i,l;if(!e)return"";const t=((i=e.querySelector)==null?void 0:i.call(e,"iframe"))??null;if(!t)return((l=e.innerHTML)==null?void 0:l.trim())||"";const s=t.getAttribute("src")||"",r=_l(s);if(r)return`https://www.youtube.com/watch?v=${r}`;const o=s.match(/[?&]id=(\d+)/i);if(o&&s.includes("/embed/Tweet.html"))return`https://x.com/i/status/${o[1]}`;const a=s.match(/[?&]href=([^&"']+)/i);return a&&s.includes("facebook.com/plugins/post.php")?t.outerHTML:a?decodeURIComponent(a[1]):t.outerHTML}const _f=/<div\b(?=[^>]*\bdata-media-embed\b)(?=[^>]*\bdata-source=["']([^"']+)["'])[^>]*>\s*<\/div>/gi;function tb(e){return e?e.replace(_f,(t,s)=>Ml(Cf(s))||""):""}function sb(e,t){for(const s of[e,t]){if(!s)continue;const o=Sa(String(s)).match(/<iframe[\s\S]*?<\/iframe>/i);if(o)return o[0]}return null}function nb(e,t){for(const s of[e,t]){if(!s)continue;const o=Sa(String(s)).match(/<blockquote\b[^>]*\btwitter-tweet\b[^>]*>[\s\S]*?<\/blockquote>/i);if(o)return o[0]}return null}function rb(e,t){return sb(e,t)??nb(e,t)}function yo(e){const t=String(e??"").trim();if(!t)return null;const s=t.match(/<iframe[\s\S]*?<\/iframe>/i);if(s){const a=s[0];return Ml(a)?a:null}const r=t.match(/<blockquote\b[^>]*\btwitter-tweet\b[^>]*>[\s\S]*?<\/blockquote>/i);if(r){const a=jf(r[0]);return a||null}const o=/^https?:\/\//i.test(t)?t:`https://${t}`;return an(o)?o:null}function Tf(e){if(!e)return"";let t=tb(e);t=t.replace(/<p>\s*<iframe[\s\S]*?<\/iframe>\s*<\/p>/gi,o=>Hc(o)??""),t=t.replace(/<iframe[\s\S]*?<\/iframe>/gi,o=>Hc(o)??"");const s=new Map;let r=0;t=t.replace(/<div class="article-video-embed">[\s\S]*?<\/div>/gi,o=>{const a=`__EMBED_PROTECT_${r++}__`;return s.set(a,o),a}),t=t.replace(/<div class="article-facebook-post-embed">[\s\S]*?<\/div>/gi,o=>{const a=`__EMBED_PROTECT_${r++}__`;return s.set(a,o),a}),t=t.replace(/<div class="article-x-tweet-embed">[\s\S]*?<\/div>/gi,o=>{const a=`__EMBED_PROTECT_${r++}__`;return s.set(a,o),a}),t=t.replace(Jx,""),t=t.replace(Xx,o=>zl(o)??o),t=t.replace(_f,o=>{const a=`__EMBED_PROTECT_${r++}__`;return s.set(a,o),a}),t=t.replace(/<iframe[\s\S]*?<\/iframe>/gi,o=>{const a=Al(o),i=`__EMBED_PROTECT_${r++}__`;return s.set(i,a??""),i}),t=t.replace(/<a\s+[^>]*href=["']([^"']+)["'][^>]*>[\s\S]*?<\/a>/gi,(o,a)=>an(a)??o),t=t.replace(Gx,(o,a)=>Tl(a)),t=t.replace(Yx,o=>an(o)??o),t=t.replace(Vx,o=>an(o)??o),t=t.replace(qx,o=>an(o)??o);for(const[o,a]of s)t=t.replace(o,a);return t}const ob=new Set(["m.in"]),ab=/^(m|np|itd|itp|tj|tzn|ok|ul|al|dr|prof|mgr|inż|vs|it)\.in$/i;function ib(e){let t=String(e??"").trim().toLowerCase();return t?(t=t.replace(/^https?:\/\//,""),t=t.replace(/^www\./,""),t.split(/[/?#:]/)[0].replace(/\.$/,"")):""}function Ef(e){const t=ib(e);return!(!t||ob.has(t)||ab.test(t))}function lb(e){return e?e.replace(/<a\b([^>]*?)href=["']([^"']+)["']([^>]*?)>([\s\S]*?)<\/a>/gi,(t,s,r,o,a)=>Ef(r)?t:a):""}const cb={ADD_TAGS:["iframe"],ADD_ATTR:["allow","allowfullscreen","loading","frameborder","scrolling","style","width","height"]};let Gc=!1;function db(){Gc||typeof window>"u"||(yf.addHook("uponSanitizeElement",(e,t)=>{if(t.tagName!=="iframe")return;const s=e.getAttribute("src")||"";Nf(s)||e.remove()}),Gc=!0)}function ub(e){return db(),yf.sanitize(e,cb)}function Ll(e,t){if(!e)return"";const s=fb(e,t),r=/<\s*(p|div|h[1-6]|blockquote|iframe|ul|ol|li|br|figure)\b/i.test(s);let o=s;return r||(o=s.replace(/\n\n/g,"</p><p>").replace(/## (.*)/g,"<h2>$1</h2>").replace(/> (.*)/g,"<blockquote>$1</blockquote>"),o.startsWith("<")||(o=`<p>${o}</p>`)),ub(lb(Tf(o)))}function no(e){return e.replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/\s+/g," ").trim().toLowerCase()}function fb(e,t){if(!(e!=null&&e.trim())||!(t!=null&&t.trim()))return e;const s=no(t);if(s.length<8)return e;const r=e.match(/^\s*(<p[^>]*>[\s\S]*?<\/p>)/i);if(r){const a=no(r[1]);if(a===s||a.startsWith(s)||s.startsWith(a))return e.slice(r[0].length).trimStart()}if(no(e.slice(0,Math.max(t.length*2,120))).startsWith(s)){const a=e.split(/\n\n+/);if(a.length>1&&no(a[0])===s)return a.slice(1).join(` 4 5`).trimStart()}return e}const mb=4e3,Js=()=>{const e=Dr(),t=Ls();return f.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),f.useEffect(()=>{const s=window.setTimeout(()=>t("/",{replace:!0}),mb);return()=>window.clearTimeout(s)},[t]),n.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:n.jsxs("div",{className:"text-center px-6",children:[n.jsx("h1",{className:"mb-4 text-4xl font-bold text-foreground",children:"404"}),n.jsx("p",{className:"mb-2 text-xl text-news-muted",children:"Ups! Nie znaleziono strony"}),n.jsx("p",{className:"mb-6 text-sm text-news-dim",children:"Za chwilÄ przekierujemy CiÄ na stronÄ gÅównÄ â¦"}),n.jsx("a",{href:"/",className:"text-sm text-news-red underline hover:text-news-red/90",children:"WrÃ³Ä na stronÄ gÅównÄ "})]})})},hb={AktualnoÅci:"bg-news-red text-white",Ważne:"bg-orange-700 text-white",BezpieczeÅstwo:"bg-orange-700 text-white",Porty:"bg-news-red text-white",Stocznie:"bg-red-800 text-white","Porty i Stocznie":"bg-news-red text-white",Inne:"bg-gray-600 text-white",Årodowisko:"bg-green-700 text-white",Historia:"bg-news-gold text-black",Extra:"bg-purple-600 text-white",Edukacja:"bg-blue-600 text-white","Technologie i Edukacja":"bg-blue-600 text-white",Technologie:"bg-blue-600 text-white",Å»egluga:"bg-cyan-700 text-white",Offshore:"bg-cyan-600 text-white","Polska Morska T
5V":"bg-indigo-600 text-white",Ministerstwo:"bg-slate-600 text-white",Turystyka:"bg-green-700 text-white","Turystyka i Årodowisko":"bg-green-700 text-white","Klaster Morski":"bg-teal-600 text-white","Forum Ekspertów":"bg-violet-600 text-white","Akcje Polski Morskiej":"bg-rose-600 text-white","Kongres Morski":"bg-amber-700 text-white","ArtykuÅ Sponsorowany":"bg-yellow-600 text-black"};function zf(e){return hb[e]??"bg-news-red text-white"}const Af={"Porty i Stocznie":["Porty","Stocznie"],"Technologie i Edukacja":["Technologie","Edukacja"],Offshore:["Offshore"],Historia:["Historia"],BezpieczeÅstwo:["BezpieczeÅstwo"],"Turystyka i Årodowisko":["Turystyka","Årodowisko"]},Bi=Object.keys(Af),Fi=6;function pb(e){return Fi}const Wi={"Porty i Stocznie":"AktualnoÅci z polskich portów morskich, terminali, infrastruktury nabrzeżnej i inwestycji portowych.","Technologie i Edukacja":"Innowacje, technologie morskie, edukacja i rozwój kompetencji w branży morskiej.",Offshore:"Farmy wiatrowe, morska energetyka, projekty offshore na BaÅtyku i w regionie.",Historia:"Dzieje polskiego morza, tradycje żeglarskie i morskie dziedzictwo.",BezpieczeÅstwo:"BezpieczeÅstwo morskie, energetyczne, Marynarka Wojenna oraz kwestie obrony na BaÅtyku.","Turystyka i Årodowisko":"Turystyka morska, ochrona Årodowiska, ekologia i zrównoważony rozwój akwenów."};function Ui(e,t){if(!t)return!0;const s=Af[t];return s?s.includes(e):e===t}const ln={items:Bi.map((e,t)=>({id:`nav-${t+1}`,label:e,category:e,visible:!0}))};function gb(e,t){const s=e.items.filter(o=>o.visible&&o.category.trim());return(s.length>0?s:ln.items).map(o=>({label:o.label.trim()||o.category,category:o.category}))}const Mf="pm_nav_menu_v1";function ro(){if(typeof sessionStorage>"u")return null;try{const e=sessionStorage.getItem(Mf);if(!e)return null;const t=JSON.parse(e);if(Array.isArray(t==null?void 0:t.items)&&t.items.length>0)return t}catch{}return null}function oo(e){if(!(typeof sessionStorage>"u"))try{sessionStorage.setItem(Mf,JSON.stringify(e))}catch{}}const Hi={enabled:!0,items:[]};function xb(e){return e?{enabled:e.enabled??!0,items:(e.items??[]).map(t=>({id:t.id||crypto.randomUUID(),text:t.text??"",url:t.url??null,active:t.active??!0}))}:Hi}function bb(e){return e.enabled?e.items.filter(t=>t.active&&t.text.trim()):[]}const wb={podcast:!0,videos:!0,news_ticker:!0,hero_banner:!0,trending_topics:!0,shorts:!0,article_views:!0},Yc={podcast:"Podcast",videos:"Filmy",news_ticker:"Pasek wiadomoÅci",hero_banner:"Baner pod wyróżnionym artykuÅem",trending_topics:"Trendy (sidebar)",shorts:"YouTube Shorts (aplikacja mobilna)",article_views:"Liczba odsÅon (strona artykuÅu)"};function Vc(e){return{...wb,...e}}function cn(e,t){return e[t]}const Lf="pm_section_visibility_v1";function Kc(){if(typeof sessionStorage>"u")return null;try{const e=sessionStorage.getItem(Lf);if(!e)return null;const t=JSON.parse(e);if(t&&typeof t=="object")return t}catch{}return null}function qc(e){if(!(typeof sessionStorage>"u"))try{sessionStorage.setItem(Lf,JSON.stringify(e))}catch{}}const If=92,Il={hero_banner:{defaultWidth:1200,srcset:[640,960,1200,1600,1920],sizes:"(max-width: 1024px) 100vw, 960px"},feed_between:{defaultWidth:1200,srcset:[640,960,1200,1600,1920],sizes:"(max-width: 1024px) 100vw, 960px"},sidebar:{defaultWidth:640,srcset:[320,480,640,800],sizes:"320px"},article_top:{defaultWidth:960,srcset:[480,720,960,1200],sizes:"(max-width: 768px) 100vw, 672px"},article_bottom:{defaultWidth:960,srcset:[480,720,960,1200],sizes:"(max-width: 768px) 100vw, 672px"},article_inline:{defaultWidth:960,srcset:[480,720,960,1200],sizes:"(max-width: 768px) 100vw, 672px"},mobile_header:{defaultWidth:960,srcset:[480,640,960,1280],sizes:"100vw"}},yb={thumb:128,card:480,hero:960,slide:720,full:1200},vb={thumb:[64,128],card:[320,480,640,800],hero:[640,960,1200],slide:[480,720,960],full:[800,1200,1600]},Xc=new Set(["polskamorska.pl","polska-morska.pl","217.154.232.209","www.polskamorska.pl"]);function Ca(e){if(!e)return"";if(e.startsWith("/wp-content/uploads/")||e.startsWith("/uploads/"))return e;try{const t=new URL(e),s=t.hostname.replace(/^www\./,"");if((Xc.has(s)||Xc.has(t.hostname))&&(t.pathname.startsWith("/wp-content/uploads/")||t.pathname.startsWith("/uploads/")))return t.pathname}catch{}return e}function _a(e){const t=Ca(e);return t.startsWith("/wp-content/uploads/")||t.startsWith("/uploads/")}function Br(e,t,s=80){const r=Ca(e);return _a(r)?`/api/img?${new URLSearchParams({url:r,w:String(t),q:String(s)}).toString()}`:e}function jb(e,t){return Br(e,yb[t])}function Nb(e,t){return _a(e)?vb[t].map(s=>`${Br(e,s)} ${s}w`).join(", "):""}function kb(e){switch(e){case"thumb":return"64px";
5case"card":return"(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 400px";case"hero":return"(max-width: 1024px) 100vw, 960px";case"slide":return"100vw";case"full":return"(max-width: 768px) 100vw, 672px";default:return"100vw"}}function Jc(e,t){const s=Il[t];return Br(e,s.defaultWidth,If)}function Zc(e,t){return _a(e)?Il[t].srcset.map(r=>`${Br(e,r,If)} ${r}w`).join(", "):""}function Qc(e){return Il[e].sizes}function Sb(e){return e!=null&&e.trim()?/placehold\.co/i.test(e)||/Brak\+zdj/i.test(e):!0}const Of={title:"Polska Morska â portal morski",description:"AktualnoÅci z polskiego morza: porty, stocznie, żegluga, offshore, bezpieczeÅstwo morskie i turystyka.",author:"Polska Morska",og_type:"website",og_title:"Polska Morska â portal morski",og_description:"AktualnoÅci z polskiego morza: porty, stocznie, żegluga, offshore, bezpieczeÅstwo morskie i turystyka.",og_site_name:"Polska Morska",og_image:null,twitter_card:"summary_large_image",twitter_title:"Polska Morska â portal morski",twitter_description:"AktualnoÅci z polskiego morza: porty, stocznie, żegluga, offshore, bezpieczeÅstwo morskie i turystyka."},ed="pm-json-ld",td="pm-canonical",Cb=1200,_b=630;function Tb(e){return{...Of,...e}}function vs(){return typeof window<"u"?window.location.origin:""}function rs(e,t=vs()){return e?/^https?:\/\//i.test(e)?e:`${t.replace(/\/$/,"")}${e.startsWith("/")?e:`/${e}`}`:""}function Ol(e,t=vs()){if(!e)return"";const s=Ca(e);return s?/^https?:\/\//i.test(s)?s:`${t.replace(/\/$/,"")}${s.startsWith("/")?s:`/${s}`}`:""}function sd(e){return e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function Ya(e,t=160){const s=e.trim();return s.length<=t?s:`${s.slice(0,t-1).trimEnd()}â¦`}function Va(e,t){const s=e.trim();return s?s.includes(t)?s:`${s} â ${t}`:t}function ao(e,t=vs()){return{title:e.title,description:e.description,author:e.author,og_type:e.og_type,og_title:e.og_title,og_description:e.og_description,og_site_name:e.og_site_name,og_image:e.og_image,twitter_card:e.twitter_card,twitter_title:e.twitter_title,twitter_description:e.twitter_description,canonical:rs("/",t),jsonLd:Eb(e,t)}}
5function Eb(e,t=vs()){const s=rs("/",t);return[{"@context":"https://schema.org","@type":"Organization",name:e.og_site_name,url:s,...e.og_image?{logo:Ol(e.og_image,t)}:{}},{"@context":"https://schema.org","@type":"WebSite",name:e.og_site_name,url:s,description:e.description,inLanguage:"pl-PL"}]}function zb(e){const t={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:e.siteName,item:rs("/",vs())},{"@type":"ListItem",position:2,name:e.title,item:e.url}]},s={"@context":"https://schema.org","@type":"NewsArticle",headline:e.title,description:e.description,mainEntityOfPage:{"@type":"WebPage","@id":e.url},inLanguage:"pl-PL",isAccessibleForFree:!0,publisher:{"@type":"Organization",name:e.siteName}};return e.image&&(s.image=[Ol(e.image)]),e.publishedAt&&(s.datePublished=e.publishedAt),e.updatedAt&&(s.dateModified=e.updatedAt),e.authorName&&(s.author={"@type":"Person",name:e.authorName}),[s,t]}function Ab(e){return[{"@context":"https://schema.org","@type":"CollectionPage",name:e.name,description:e.description,url:e.url,isPartOf:{"@type":"WebSite",name:e.siteName,url:rs("/",vs())},inLanguage:"pl-PL"},{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:e.siteName,item:rs("/",vs())},{"@type":"ListItem",position:2,name:e.name,item:e.url}]}]}function Mb(e){return[{"@context":"https://schema.org","@type":"WebPage",name:e.title,url:e.url,isPartOf:{"@type":"WebSite",name:e.siteName,url:rs("/",vs())},inLanguage:"pl-PL"},{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:e.siteName,item:rs("/",vs())},{"@type":"ListItem",position:2,name:e.title,item:e.url}]}]}function ht(e,t,s){let r=document.head.querySelector(`meta[${e}="${t}"]`);r||(r=document.createElement("meta"),r.setAttribute(e,t),document.head.appendChild(r)),r.content=s}function Rs(e,t){var s;(s=document.head.querySelector(`meta[${e}="${t}"]`))==null||s.remove()}function Lb(e){let t=document.getElementById(td);t||(t=document.createElement("link"),t.id=td,t.rel="canonical",document.head.appendChild(t)),t.href=e}function Ib(e){let t=document.getElementById(ed);if(!e){t==null||t.remove();return}t||(t=document.createElement("script"),t.id=ed,t.type="application/ld+json",document.head.appendChild(t)),t.textContent=JSON.stringify(e)}function Ob(e,t=vs()){document.title=e.title,ht("name","description",e.description),ht("name","author",e.author),ht("property","og:type",e.og_type),ht("property","og:title",e.og_title),ht("property","og:description",e.og_description),ht("property","og:site_name",e.og_site_name),ht("property","og:url",e.canonical),ht("name","twitter:card",e.twitter_card),ht("name","twitter:title",e.twitter_title),ht("name","twitter:description",e.twitter_description);const s=Ol(e.og_image,t);s?(ht("property","og:image",s),ht("property","og:image:width",String(Cb)),ht("property","og:image:height",String(_b)),ht("property","og:image:alt",e.og_title),s.startsWith("https://")?ht("property","og:image:secure_url",s):Rs("property","og:image:secure_url"),ht("name","twitter:image",s)):(Rs("property","og:image"),Rs("property","og:image:width"),Rs("property","og:image:height"),Rs("property","og:image:alt"),Rs("property","og:image:secure_url"),Rs("name","twitter:image")),Lb(e.canonical),e.noindex?ht("name","robots","noindex, nofollow"):Rs("name","robots"),Ib(e.jsonLd??null)}const Df={name:"Polska Morska",tagline:"Portal Informacyjny",email:"[email protected]",logo_url:null,mobile_logo_url:null},Pf="pm_general_v1";
5function nd(e){return typeof e!="string"?null:e.trim()||null}function Rf(e){return{...Df,...e,logo_url:nd(e==null?void 0:e.logo_url)??null,mobile_logo_url:nd(e==null?void 0:e.mobile_logo_url)??null}}function Db(){if(typeof localStorage>"u")return null;try{const e=localStorage.getItem(Pf);if(!e)return null;const t=JSON.parse(e);return!t||typeof t!="object"?null:Rf(t)}catch{return null}}function Pb(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Pf,JSON.stringify(e))}catch{}}const rd={display_ads:!0,native_ads:!0,sponsored_articles:!1,premium_subscription:!0},$f=f.createContext(null);function Rb({children:e}){const[t,s]=f.useState(()=>Db()??Df),[r,o]=f.useState(rd),[a,i]=f.useState(()=>ro()),[l,c]=f.useState(()=>ro()!=null),[d,h]=f.useState(Hi),[u,p]=f.useState(()=>Vc(Kc())),[m,b]=f.useState(()=>Kc()!=null),[x,g]=f.useState(Of),[y,N]=f.useState(!0),w=f.useCallback(A=>{s(A),Pb(A)},[]),k=f.useCallback(async()=>{var A,U,se,P,ne,C;N(!0);try{const I=await $.getSettings(),F=(A=I.find(O=>O.key==="general"))==null?void 0:A.value,ae=(U=I.find(O=>O.key==="monetization"))==null?void 0:U.value,Z=(se=I.find(O=>O.key==="nav_menu"))==null?void 0:se.value,Q=(P=I.find(O=>O.key==="news_ticker"))==null?void 0:P.value,re=(ne=I.find(O=>O.key==="section_visibility"))==null?void 0:ne.value,oe=(C=I.find(O=>O.key==="seo"))==null?void 0:C.value;if(F&&w(Rf(F)),ae&&o({...rd,...ae}),Z!=null&&Z.items){const O={items:Z.items};i(O),oo(O)}else ro()||(i(ln),oo(ln));c(!0),h(Q?xb(Q):Hi);const Y=Vc(re);p(Y),qc(Y),b(!0),g(Tb(oe))}catch{ro()||(i(ln),oo(ln)),c(!0),b(!0)}N(!1)},[w]);f.useEffect(()=>{k()},[k]);const E=f.useCallback(async A=>{try{return await $.saveSetting("general",A),w(A),null}catch(U){return U instanceof Error?U:new Error("BÅÄ
d zapisu")}},[w]),v=f.useCallback(async A=>{try{return await $.saveSetting("monetization",A),o(A),null}catch(U){return U instanceof Error?U:new Error("BÅÄ
d zapisu")}},[]),S=f.useCallback(async A=>{try{return await $.saveSetting("nav_menu",A),i(A),oo(A),c(!0),null}catch(U){return U instanceof Error?U:new Error("BÅÄ
d zapisu")}},[]),z=f.useCallback(async A=>{try{return await $.saveSetting("news_ticker",A),h(A),null}catch(U){return U instanceof Error?U:new Error("BÅÄ
d zapisu")}},[]),B=f.useCallback(async A=>{try{return await $.saveSetting("section_visibility",A),p(A),qc(A),b(!0),null}catch(U){return U instanceof Error?U:new Error("BÅÄ
d zapisu")}},[]),M=f.useCallback(async A=>{try{return await $.saveSetting("seo",A),g(A),null}catch(U){return U instanceof Error?U:new Error("BÅÄ
d zapisu")}},[]),D=f.useMemo(()=>({general:t,monetization:r,navMenu:a,navMenuReady:l,newsTicker:d,sectionVisibility:u,sectionVisibilityReady:m,seo:x,loading:y,saveGeneral:E,saveMonetization:v,saveNavMenu:S,saveNewsTicker:z,saveSectionVisibility:B,saveSeo:M,reload:k}),[t,r,a,l,d,u,m,x,y,E,v,S,z,B,M,k]);return n.jsx($f.Provider,{value:D,children:e})}function us(){const e=f.useContext($f);if(!e)throw new Error("usePortalSettings must be used within PortalSettingsProvider");return e}const $b="#000000",Bb={light:"#fafafa",dark:"#000000"};function Bf(){return typeof window>"u"?!1:window.matchMedia("(max-width: 767px)").matches}function Ff(e){document.querySelectorAll('meta[name="theme-color"]').forEach(s=>s.remove());const t=document.createElement("meta");t.setAttribute("name","theme-color"),t.setAttribute("content",e),document.head.appendChild(t)}function Wf(){const e=document.documentElement;e.classList.add("mobile-ui"),e.style.colorScheme="dark",Ff($b)}function Fb(e){const t=document.documentElement;t.classList.remove("mobile-ui"),t.style.colorScheme=e==="dark"?"dark":"light",Ff(Bb[e])}function Wb(e){if(Bf()){Wf();return}Fb(e)}const Uf=f.createContext(void 0),Hf="nexus-theme";function Ub(){if(typeof window>"u")return"light";const e=window.localStorage.getItem(Hf);return e==="light"||e==="dark"?e:"light"}function od(e){const t=document.documentElement;Bf()?t.classList.add("mobile-ui","dark"):(t.classList.remove("mobile-ui"),t.classList.toggle("dark",e==="dark")),Wb(e)}function Hb({children:e}){const[t,s]=f.useState(Ub);f.useEffect(()=>{window.localStorage.setItem(Hf,t),od(t)},[t]),f.useEffect(()=>{const a=window.matchMedia("(max-width: 767px)"),i=()=>od(t);
5return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[t]);const r=a=>s(a),o=()=>s(a=>a==="dark"?"light":"dark");return n.jsx(Uf.Provider,{value:{theme:t,setTheme:r,toggleTheme:o},children:e})}function Gf(){const e=f.useContext(Uf);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ad(e,t,s="light"){return t==="mobile"||s==="dark"?e.mobile_logo_url??e.logo_url??null:e.logo_url??e.mobile_logo_url??null}function Gb(){const[e,t]=f.useState(()=>typeof window<"u"&&window.innerWidth<768);return f.useEffect(()=>{const s=window.matchMedia("(max-width: 767px)"),r=()=>t(s.matches);return r(),s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[]),e}function id({src:e,alt:t,className:s,height:r,priority:o,visible:a}){return n.jsx("img",{src:e,alt:a?t:"","aria-hidden":a?void 0:!0,className:`${s} col-start-1 row-start-1 ${a?"":"invisible"}`,height:r,decoding:"sync",...o?{fetchPriority:"high"}:{}})}function js({className:e="h-7 w-auto",height:t=28,priority:s=!1,variant:r}){const{general:o}=us(),{theme:a}=Gf(),i=Gb(),l=r??(i?"mobile":"desktop"),c=ad(o,l,"light"),d=ad(o,l,"dark"),h=a==="dark"?d:c;if(f.useEffect(()=>{for(const p of new Set([c,d].filter(Boolean))){const m=new Image;m.decoding="sync",m.src=p}},[c,d]),!c&&!d)return null;const u=o.name||"Polska Morska";return!c||!d||c===d?n.jsx("img",{src:h??c??d??"",alt:u,className:e,height:t,decoding:"sync",...s?{fetchPriority:"high"}:{}}):n.jsxs("span",{className:"inline-grid items-center justify-items-start",children:[n.jsx(id,{src:c,alt:u,className:e,height:t,priority:s&&a!=="dark",visible:a!=="dark"}),n.jsx(id,{src:d,alt:u,className:e,height:t,priority:s&&a==="dark",visible:a==="dark"})]})}function zo({className:e=""}){const{theme:t,toggleTheme:s}=Gf(),r=t==="dark";return n.jsx("button",{type:"button",onClick:s,"aria-label":r?"WÅÄ
cz jasny motyw":"WÅÄ
cz ciemny motyw",title:r?"Jasny motyw":"Ciemny motyw",className:`inline-flex items-center justify-center w-9 h-9 rounded-lg border border-border bg-news-surface-2 text-foreground hover:text-news-red hover:border-news-red transition-colors ${e}`,children:r?n.jsx(ng,{size:16}):n.jsx(rg,{size:16})})}function Dl(e,t=80){return String(e??"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/Å/g,"l").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,t)}const Yb=new Set(["admin","mostek","login","reset-password","artykul","kategoria","api",...uf]);function Vb(e){return Dl(e)}function Kb(e){return/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)&&!Yb.has(e)}function vo(e){return`/${e}`}function qb(){return n.jsxs("div",{className:"space-y-3 text-[11px] leading-relaxed text-news-dim lowercase",children:[n.jsx("p",{children:"poz. 1189 w krajowym rejestrze dzienników i czasopism, ISSN 3072-0192"}),n.jsx("p",{children:"zamieszczone na stronach internetowych portalu polska-morska.pl vel polskamorska.pl materiaÅy sygnowane skrótem âPAPâ objÄte sÄ
ochronÄ
polskiego i miÄdzynarodowego prawa wÅasnoÅci intelektualnej. jakiekolwiek wykorzystywanie tych materiaÅów, w tym w celu eksploracji tekstów i danych, jest zabronione."})]})}function Rn(){const{pages:e}=cx({footer:!0});return n.jsxs("footer",{className:"border-t border-border mt-12 py-8 px-4 lg:px-6",children:[n.jsxs("div",{className:"max-w-[1440px] mx-auto flex flex-col md:flex-row items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx(js,{className:"h-8 w-auto",height:32}),n.jsx("p",{className:"text-xs text-news-muted mt-2",children:"© 2026 polskamorska.pl"})]}),n.jsxs("div",{className:"flex items-center gap-6 text-sm text-news-muted flex-wrap justify-center",children:[e.map(t=>n.jsx("a",{href:vo(t.slug),className:"hover:text-foreground transition-colors",children:t.title},t.id)),n.jsx("a",{href:"mailto:[email protected]",className:"hover:text-foreground transition-colors",children:"Reklama"})]})]}),n.jsx("div",{className:"max-w-[1440px] mx-auto mt-6 pt-6 border-t border-border/60",children:n.jsx(qb,{})})]})}function Xb({slug:e}){const{page:t,loading:s,notFound:r}=dx(e);return s?n.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[n.jsxs("header",{className:"border-b border-border px-6 py-3 flex items-center justify-between",children:[n.jsxs(En,{to:"/",className:"flex items-center gap-2 text-news-muted hover:text-foreground text-sm",children:[n.jsx(yr,{size:18}),"Strona gÅówna"]}),n.jsx(js,{className:"h-7 w-auto",height:28}),n.jsx(zo,{})]}),n.jsx("div",{className:"flex-1 flex items-center justify-center text-news-muted",children:n.jsx(fe,{size:28,className:"animate-spin"})})]}):r||!t?n.jsx(Js,{}):n.jsxs("div",{className:"min-h-screen bg-background",children:[n.jsx("header",{className:"sticky top-0 z-50 bg-background/95 backdrop-blur-md border-b border-border",children:n.jsxs("div",{className:"max-w-[1440px] mx-auto px-4 lg:px-6 py-3 flex items-center justify-between gap-4",children:[n.jsxs(En,{to:"/",className:"flex items-center gap-2 text-news-muted hover:text-foreground transition-colors text-sm font-medium",children:[n.jsx(yr,{size:18}),"Strona gÅówna"]}),n.jsx(En,{to:"/",children:n.jsx(js,{className:"h-8 w-auto",height:32})}),n.jsx(zo,{})]})}),n.jsxs("main",{className:"max-w-3xl mx-auto px-4 lg:px-6 py-10",children:[n.jsxs("nav",{className:"text-sm text-news-muted mb-6",children:[n.jsx(En,{to:"/",className:"hover:text-news-red transition-colors",children:"Strona gÅówna"}),n.jsx("span",{className:"mx-2",children:"/"}),n.jsx("span",{className:"text-foreground",children:t.title})]}),n.jsx("h1",{className:"font-serif text-3xl md:text-4xl font-bold text-foreground mb-8",children:t.title}),n.jsx("div",{className:"article-body",dangerouslySetInnerHTML:{__html:Ll(t.content)}}),n.jsxs("p",{className:"text-xs text-news-dim mt-12 pt-6 border-t border-border",children:["Ostatnia aktualizacja:"," ",new Date(t.updated_at).toLocaleDateString("pl-PL",{day:"numeric",month:"long",year:"numeric"})]})]}),n.jsx(Rn,{})]})}function wn(e=!0,t=!1){const[s,r]=f.useState([]),[o,a]=f.useState([]),[i,l]=f.useState(!0),[c,d]=f.useState(null),h=f.useCallback(async()=>
5{l(!0),d(null);try{const u=await $.getCategories({navOnly:t?!1:e});r(u);const p=t?u.map(m=>m.name):u.filter(m=>m.is_nav||m.source==="app").map(m=>m.name);a([...new Set(p)].sort((m,b)=>m.localeCompare(b,"pl")))}catch(u){d(u instanceof Error?u.message:"BÅÄ
d kategorii"),r([]),a([])}finally{l(!1)}},[e,t]);return f.useEffect(()=>{h()},[h]),{categories:s,names:o,loading:i,error:c,refetch:h}}const Fr=["Porty","Stocznie","Technologie","Edukacja","Offshore","Historia","BezpieczeÅstwo","Turystyka","Årodowisko","Å»egluga","AktualnoÅci"];function Yf(e){return Sl(e)}function Vf(e){return nx(e)}function jo(e,t=[]){const s=mf(e);return s||(t.find(r=>Yf(r)===e)??null)}function Kf(){const{names:e,loading:t}=wn(),{navMenu:s,navMenuReady:r,loading:o}=us(),a=e.length?e:Fr,i=f.useMemo(()=>!r||!s?[]:gb(s),[s,r,a]),l=f.useMemo(()=>i.map(c=>c.category),[i]);return{items:i,categoryNames:l,loading:t||o||!r,isConfigured:!!(s!=null&&s.items.some(c=>c.visible&&c.category.trim()))}}function Jb(e){const t=new Date(e),s=Date.now()-t.getTime(),r=Math.floor(s/6e4);if(r<60)return`${r||1} min temu`;const o=Math.floor(r/60);return o<24?`${o}h temu`:t.toLocaleDateString("pl-PL",{day:"numeric",month:"short",year:"numeric"})}function Zb(e){const[t,s]=f.useState({top:0,height:typeof window<"u"?window.innerHeight:0});return f.useEffect(()=>{var o,a;if(!e||typeof window>"u")return;const r=()=>{const i=window.visualViewport;if(!i){s({top:0,height:window.innerHeight});return}s({top:i.offsetTop,height:i.height})};return r(),(o=window.visualViewport)==null||o.addEventListener("resize",r),(a=window.visualViewport)==null||a.addEventListener("scroll",r),()=>{var i,l;(i=window.visualViewport)==null||i.removeEventListener("resize",r),(l=window.visualViewport)==null||l.removeEventListener("scroll",r)}},[e]),t}function Qb({articleId:e,articleTitle:t,commentCount:s=0,open:r,onOpenChange:o}){const[a,i]=f.useState([]),[l,c]=f.useState(!1),[d,h]=f.useState(""),[u,p]=f.useState(!1),m=Zb(r);f.useEffect(()=>{if(!r)return;const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x}},[r]),f.useEffect(()=>{!r||!e||(c(!0),$.getArticleComments(e).then(i).catch(()=>i([])).finally(()=>c(!1)))},[r,e]);const b=async()=>{const x=d.trim();if(!(!x||u)){p(!0);try{await $.createComment({article_id:e,content:x}),h("");const g=await $.getArticleComments(e);i(g)}catch{}finally{p(!1)}}};return r?Xs.createPortal(n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-[199] bg-black/60","aria-hidden":!0,onClick:()=>o(!1)}),n.jsxs("div",{className:"fixed left-0 right-0 z-[200] flex flex-col bg-background shadow-2xl",role:"dialog","aria-modal":"true","aria-labelledby":"comments-sheet-title",style:{top:m.top,height:m.height,maxHeight:m.height},children:[n.jsx("header",{className:"flex-shrink-0 border-b border-border bg-background px-5 py-4",style:{paddingTop:"max(1rem, env(safe-area-inset-top))"},children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("h2",{id:"comments-sheet-title",className:"flex items-center gap-2 font-serif text-lg font-bold text-foreground",children:[n.jsx(Pr,{size:18,className:"text-news-red shrink-0"}),"Komentarze (",a.length||s,")"]}),n.jsx("p",{className:"text-xs text-news-muted mt-1 line-clamp-2",children:t})]}),n.jsx("button",{type:"button",onClick:()=>o(!1),"aria-label":"Zamknij komentarze",className:"p-2 rounded-lg text-news-muted hover:text-foreground hover:bg-news-surface-2 transition-colors shrink-0",children:n.jsx(He,{size:20})})]})}),n.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto overscroll-contain px-5 py-4 custom-scrollbar",children:l?n.jsx("div",{className:"flex items-center justify-center py-12 text-news-muted",children:n.jsx(fe,{size:24,className:"animate-spin"})}):a.length===0?n.jsx("p",{className:"text-sm text-news-muted text-center py-8",children:"Brak komentarzy. BÄ
dź pierwszy!"}):n.jsx("div",{className:"space-y-3",children:a.map(x=>n.jsxs("div",{className:"bg-news-surface-2 rounded-lg p-3",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5 gap-2",children:[n.jsx("span",{className:"text-sm font-semibold text-foreground",children:x.author_name}),n.jsx("span",{className:"text-xs text-news-muted shrink-0",children:Jb(x.created_at)})]}),n.jsx("p",{className:"text-sm text-news-muted leading-relaxed",children:x.content}),x.likes>0&&n.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-news-dim",children:[n.jsx(On,{size:12})," ",x.likes]})]},x.id))})}),n.jsxs("div",{className:"flex-shrink-0 border-t border-border px-5 py-4 bg-background",style:{paddingBottom:"max(1rem, env(safe-area-inset-bottom))"},children:[n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:"text",value:d,onChange:x=>h(x.target.value),onKeyDown:x=>x.key==="Enter"&&b(),placeholder:"Dodaj komentarz...",disabled:u,className:"flex-1 min-w-0 bg-news-surface-2 border border-border rounded-lg px-4 py-3 text-base text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red transition-colors"}),n.jsx("button",{type:"button",onClick:b,disabled:u||!d.trim(),className:"px-4 py-3 bg-news-red text-white rounded-lg text-sm font-semibold disabled:opacity-50 shrink-0",children:"WyÅlij"})]}),n.jsx("p",{className:"text-xs text-news-dim mt-2",children:"Komentarz wymaga moderacji przed publikacjÄ
."})]})]})]}),document.body):null}function qf(e){var t,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(s=qf(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function Xf(){for(var e,t,s=0,r="",o=arguments.length;s<o;s++)(e=arguments[s])&&(t=qf(e))&&(r&&(r+=" "),r+=t);return r}const Pl="-",ew=e=>{const t=sw(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(Pl);return l[0]===""&&l.length!==1&&l.shift(),Jf(l,t)||tw(i)},getConflictingClassGroupIds:(i,l)=>{const c=s[i]||[];
vendor: 4,376 bytes, line 5
5return l&&r[i]?[...c,...r[i]]:c}}},Jf=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const s=e[0],r=t.nextPart.get(s),o=r?Jf(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const a=e.join(Pl);return(i=t.validators.find(({validator:l})=>l(a)))==null?void 0:i.classGroupId},ld=/^\[(.+)\]$/,tw=e=>{if(ld.test(e)){const t=ld.exec(e)[1],s=t==null?void 0:t.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},sw=e=>{const{theme:t,prefix:s}=e,r={nextPart:new Map,validators:[]};return rw(Object.entries(e.classGroups),s).forEach(([a,i])=>{Gi(i,r,a,t)}),r},Gi=(e,t,s,r)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:cd(t,o);a.classGroupId=s;return}if(typeof o=="function"){if(nw(o)){Gi(o(r),t,s,r);return}t.validators.push({validator:o,classGroupId:s});return}Object.entries(o).forEach(([a,i])=>{Gi(i,cd(t,a),s,r)})})},cd=(e,t)=>{let s=e;return t.split(Pl).forEach(r=>{s.nextPart.has(r)||s.nextPart.set(r,{nextPart:new Map,validators:[]}),s=s.nextPart.get(r)}),s},nw=e=>e.isThemeGetter,rw=(e,t)=>t?e.map(([s,r])=>{const o=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([i,l])=>[t+i,l])):a);return[s,o]}):e,ow=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,r=new Map;const o=(a,i)=>{s.set(a,i),t++,t>e&&(t=0,r=s,s=new Map)};return{get(a){let i=s.get(a);if(i!==void 0)return i;if((i=r.get(a))!==void 0)return o(a,i),i},set(a,i){s.has(a)?s.set(a,i):o(a,i)}}},Zf="!",aw=e=>{const{separator:t,experimentalParseClassName:s}=e,r=t.length===1,o=t[0],a=t.length,i=l=>{const c=[];let d=0,h=0,u;for(let g=0;g<l.length;g++){let y=l[g];if(d===0){if(y===o&&(r||l.slice(g,g+a)===t)){c.push(l.slice(h,g)),h=g+a;continue}if(y==="/"){u=g;continue}}y==="["?d++:y==="]"&&d--}const p=c.length===0?l:l.substring(h),m=p.startsWith(Zf),b=m?p.substring(1):p,x=u&&u>h?u-h:void 0;return{modifiers:c,hasImportantModifier:m,baseClassName:b,maybePostfixModifierPosition:x}};return s?l=>s({className:l,parseClassName:i}):i},iw=e=>{if(e.length<=1)return e;const t=[];let s=[];return e.forEach(r=>{r[0]==="["?(t.push(...s.sort(),r),s=[]):s.push(r)}),t.push(...s.sort()),t},lw=e=>({cache:ow(e.cacheSize),parseClassName:aw(e),...ew(e)}),cw=/\s+/,dw=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:o}=t,a=[],i=e.trim().split(cw);let l="";for(let c=i.length-1;c>=0;c-=1){const d=i[c],{modifiers:h,hasImportantModifier:u,baseClassName:p,maybePostfixModifierPosition:m}=s(d);let b=!!m,x=r(b?p.substring(0,m):p);if(!x){if(!b){l=d+(l.length>0?" "+l:l);continue}if(x=r(p),!x){l=d+(l.length>0?" "+l:l);continue}b=!1}const g=iw(h).join(":"),y=u?g+Zf:g,N=y+x;if(a.includes(N))continue;a.push(N);const w=o(x,b);for(let k=0;k<w.length;++k){const E=w[k];a.push(y+E)}l=d+(l.length>0?" "+l:l)}return l};function uw(){let e=0,t,s,r="";for(;e<arguments.length;)(t=arguments[e++])&&(s=Qf(t))&&(r&&(r+=" "),r+=s);return r}const Qf=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=Qf(e[r]))&&(s&&(s+=" "),s+=t);return s};function fw(e,...t){let s,r,o,a=i;function i(c){const d=t.reduce((h,u)=>u(h),e());return s=lw(d),r=s.cache.get,o=s.cache.set,a=l,l(c)}function l(c){const d=r(c);if(d)return d;const h=dw(c,s);return o(c,h),h}return function(){return a(uw.apply(null,arguments))}}const Fe=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},em=/^\[(?:([a-z-]+):)?(.+)\]$/i,mw=/^\d+\/\d+$/,hw=new Set(["px","full","screen"]),pw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gw=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,xw=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,bw=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ww=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ss=e=>zn(e)||hw.has(e)||mw.test(e),$s=e=>Fn(e,"length",_w),zn=e=>!!e&&!Number.isNaN(Number(e)),Ka=e=>Fn(e,"number",zn),Xn=e=>!!e&&Number.isInteger(Number(e)),yw=e=>e.endsWith("%")&&zn(e.slice(0,-1)),Ne=e=>em.test(e),Bs=e=>pw.test(e),vw=new Set(["length","size","percentage"]),jw=e=>Fn(e,vw,tm),Nw=e=>Fn(e,"position",tm),kw=new Set(["image","url"]),Sw=e=>Fn(e,kw,Ew),Cw=e=>Fn(e,"",Tw),Jn=()=>!0,Fn=(e,t,s)=>{const r=em.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):s(r[2]):!1},_w=e=>gw.test(e)&&!xw.test(e),tm=()=>!1,Tw=e=>bw.test(e),Ew=e=>ww.test(e),zw=()=>
vendor: 7,599 bytes, line 5
5{const e=Fe("colors"),t=Fe("spacing"),s=Fe("blur"),r=Fe("brightness"),o=Fe("borderColor"),a=Fe("borderRadius"),i=Fe("borderSpacing"),l=Fe("borderWidth"),c=Fe("contrast"),d=Fe("grayscale"),h=Fe("hueRotate"),u=Fe("invert"),p=Fe("gap"),m=Fe("gradientColorStops"),b=Fe("gradientColorStopPositions"),x=Fe("inset"),g=Fe("margin"),y=Fe("opacity"),N=Fe("padding"),w=Fe("saturate"),k=Fe("scale"),E=Fe("sepia"),v=Fe("skew"),S=Fe("space"),z=Fe("translate"),B=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",Ne,t],A=()=>[Ne,t],U=()=>["",Ss,$s],se=()=>["auto",zn,Ne],P=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ne=()=>["solid","dashed","dotted","double","none"],C=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",Ne],ae=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Z=()=>[zn,Ne];return{cacheSize:500,separator:":",theme:{colors:[Jn],spacing:[Ss,$s],blur:["none","",Bs,Ne],brightness:Z(),borderColor:[e],borderRadius:["none","","full",Bs,Ne],borderSpacing:A(),borderWidth:U(),contrast:Z(),grayscale:F(),hueRotate:Z(),invert:F(),gap:A(),gradientColorStops:[e],gradientColorStopPositions:[yw,$s],inset:D(),margin:D(),opacity:Z(),padding:A(),saturate:Z(),scale:Z(),sepia:F(),skew:Z(),space:A(),translate:A()},classGroups:{aspect:[{aspect:["auto","square","video",Ne]}],container:["container"],columns:[{columns:[Bs]}],"break-after":[{"break-after":ae()}],"break-before":[{"break-before":ae()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...P(),Ne]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Xn,Ne]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ne]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Xn,Ne]}],"grid-cols":[{"grid-cols":[Jn]}],"col-start-end":[{col:["auto",{span:["full",Xn,Ne]},Ne]}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":[Jn]}],"row-start-end":[{row:["auto",{span:[Xn,Ne]},Ne]}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ne]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ne]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...I()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...I(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...I(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ne,t]}],"min-w":[{"min-w":[Ne,t,"min","max","fit"]}],"max-w":[{"max-w":[Ne,t,"none","full","min","max","fit","prose",{screen:[Bs]},Bs]}],h:[{h:[Ne,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ne,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ne,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ne,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Bs,$s]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ka]}],"font-family":[{font:[Jn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ne]}],"line-clamp":[{"line-clamp":["none",zn,Ka]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ss,Ne]}],"list-image":[{"list-image":["none",Ne]}],"list-style-type":[{list:["none","disc","decimal",Ne]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ss,$s]}],"underline-offset":[{"underline-offset":["auto",Ss,Ne]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...P(),Nw]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",jw]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Sw]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}
5],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...ne(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}
vendor: 4,469 bytes, line 5
5],"divide-style":[{divide:ne()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...ne()]}],"outline-offset":[{"outline-offset":[Ss,Ne]}],"outline-w":[{outline:[Ss,$s]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Ss,$s]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Bs,Cw]}],"shadow-color":[{shadow:[Jn]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...C(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":C()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Bs,Ne]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[u]}],saturate:[{saturate:[w]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ne]}],duration:[{duration:Z()}],ease:[{ease:["linear","in","out","in-out",Ne]}],delay:[{delay:Z()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ne]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Xn,Ne]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[v]}],"skew-y":[{"skew-y":[v]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ne]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ne]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ne]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ss,$s,Ka]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","
5none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Aw=fw(zw);function Ue(...e){return Aw(Xf(e))}function Mw({alt:e,className:t,compact:s=!1}){return n.jsxs("div",{role:"img","aria-label":e||"Brak zdjÄcia",className:Ue("flex flex-col items-center justify-center gap-2 bg-news-surface-3 text-news-dim border border-border/60",t),children:[n.jsx(og,{size:s?18:28,strokeWidth:1.5,className:"opacity-70","aria-hidden":!0}),!s&&n.jsx("span",{className:"text-xs font-medium tracking-wide",children:"Brak zdjÄcia"})]})}function Qs({src:e,alt:t,variant:s,className:r,width:o,height:a,priority:i=!1}){const[l,c]=f.useState(!1);if(Sb(e)||l)return n.jsx(Mw,{alt:t,className:r,compact:s==="thumb"});const h=jb(e,s),u=Nb(e,s);return n.jsx("img",{src:h,srcSet:u||void 0,sizes:u?kb(s):void 0,alt:t,className:Ue("bg-news-surface-3",r),width:o,height:a,loading:i?"eager":"lazy",decoding:"async",onError:()=>c(!0),...i?{fetchPriority:"high"}:{}})}const sm="liked:",nm="view:";function Ao(e){try{return localStorage.getItem(`${sm}${e}`)==="1"}catch{return!1}}function rm(e){try{localStorage.setItem(`${sm}${e}`,"1")}catch{}}function om(e){try{return sessionStorage.getItem(`${nm}${e}`)==="1"}catch{return!1}}function ir(e){try{sessionStorage.setItem(`${nm}${e}`,"1")}catch{}}var Lw=e=>{switch(e){case"success":return Dw;case"info":return Rw;case"warning":return Pw;case"error":return $w;default:return null}},Iw=Array(12).fill(0),Ow=({visible:e,className:t})=>X.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},X.createElement("div",{className:"sonner-spinner"},Iw.map((s,r)=>X.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Dw=X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},X.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Pw=X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
5currentColor",height:"20",width:"20"},X.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Rw=X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},X.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),$w=X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},X.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Bw=X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},X.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),X.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Fw=()=>{let[e,t]=X.useState(document.hidden);return X.useEffect(()=>{let s=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),e},Yi=1,Ww=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:s,...r}=e,o=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Yi++,a=this.toasts.find(l=>l.id===o),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...e,id:o,title:s}),{...l,...e,id:o,dismissible:i,title:s}):l):this.addToast({title:s,...r,dismissible:i,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(s=>s({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>
5this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let s;t.loading!==void 0&&(s=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),o=s!==void 0,a,i=r.then(async c=>{if(a=["resolve",c],X.isValidElement(c))o=!1,this.create({id:s,type:"default",message:c});else if(Hw(c)&&!c.ok){o=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,h=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:s,type:"error",message:d,description:h})}else if(t.success!==void 0){o=!1;let d=typeof t.success=="function"?await t.success(c):t.success,h=typeof t.description=="function"?await t.description(c):t.description;this.create({id:s,type:"success",message:d,description:h})}}).catch(async c=>{if(a=["reject",c],t.error!==void 0){o=!1;let d=typeof t.error=="function"?await t.error(c):t.error,h=typeof t.description=="function"?await t.description(c):t.description;this.create({id:s,type:"error",message:d,description:h})}}).finally(()=>{var c;o&&(this.dismiss(s),s=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>i.then(()=>a[0]==="reject"?d(a[1]):c(a[1])).catch(d));return typeof s!="string"&&typeof s!="number"?{unwrap:l}:Object.assign(s,{unwrap:l})},this.custom=(e,t)=>{let s=(t==null?void 0:t.id)||Yi++;return this.create({jsx:e(s),id:s,...t}),s},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Tt=new Ww,Uw=(e,t)=>{let s=(t==null?void 0:t.id)||Yi++;return Tt.addToast({title:e,...t,id:s}),s},Hw=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Gw=Uw,Yw=()=>Tt.toasts,Vw=()=>Tt.getActiveToasts(),G=Object.assign(Gw,{success:Tt.success,info:Tt.info,warning:Tt.warning,error:Tt.error,custom:Tt.custom,message:Tt.message,promise:Tt.promise,dismiss:Tt.dismiss,loading:Tt.loading},{getHistory:Yw,getToasts:Vw});function Kw(e,{insertAt:t}={}){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Kw(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
5left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
5:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
5--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} 6`);function io(e){return e.label!==void 0}var qw=3,Xw="32px",Jw="16px",dd=4e3,Zw=356,Qw=14,ey=20,ty=200;function ts(...e){return e.filter(Boolean).join(" ")}function sy(e){let[t,s]=e.split("-"),r=[];return t&&r.push(t),s&&r.push(s),r}var ny=e=>{var t,s,r,o,a,i,l,c,d,h,u;let{invert:p,toast:m,unstyled:b,interacting:x,setHeights:g,visibleToasts:y,heights:N,index:w,toasts:k,expanded:E,removeToast:v,defaultRichColors:S,closeButton:z,style:B,cancelButtonStyle:M,actionButtonStyle:D,className:A="",descriptionClassName:U="",duration:se,position:P,gap:ne,loadingIcon:C,expandByDefault:I,classNames:F,icons:ae,closeButtonAriaLabel:Z="Close toast",pauseWhenPageIsHidden:
6Q}=e,[re,oe]=X.useState(null),[Y,O]=X.useState(null),[_,W]=X.useState(!1),[de,he]=X.useState(!1),[ve,R]=X.useState(!1),[ie,ge]=X.useState(!1),[H,ce]=X.useState(!1),[ke,T]=X.useState(0),[te,xe]=X.useState(0),me=X.useRef(m.duration||se||dd),at=X.useRef(null),De=X.useRef(null),st=w===0,Qe=w+1<=y,Xe=m.type,Je=m.dismissible!==!1,xt=m.className||"",It=m.descriptionClassName||"",nt=X.useMemo(()=>N.findIndex(ue=>ue.toastId===m.id)||0,[N,m.id]),it=X.useMemo(()=>{var ue;return(ue=m.closeButton)!=null?ue:z},[m.closeButton,z]),Ut=X.useMemo(()=>m.duration||se||dd,[m.duration,se]),Ht=X.useRef(0),mt=X.useRef(0),Ot=X.useRef(0),yt=X.useRef(null),[fs,Dt]=P.split("-"),rt=X.useMemo(()=>N.reduce((ue,be,pe)=>pe>=nt?ue:ue+be.height,0),[N,nt]),ms=Fw(),Is=m.invert||p,Pe=Xe==="loading";mt.current=X.useMemo(()=>nt*ne+rt,[nt,rt]),X.useEffect(()=>{me.current=Ut},[Ut]),X.useEffect(()=>{W(!0)},[]),X.useEffect(()=>{let ue=De.current;if(ue){let be=ue.getBoundingClientRect().height;return xe(be),g(pe=>[{toastId:m.id,height:be,position:m.position},...pe]),()=>g(pe=>pe.filter(ze=>ze.toastId!==m.id))}},[g,m.id]),X.useLayoutEffect(()=>{if(!_)return;let ue=De.current,be=ue.style.height;ue.style.height="auto";let pe=ue.getBoundingClientRect().height;ue.style.height=be,xe(pe),g(ze=>ze.find(Re=>Re.toastId===m.id)?ze.map(Re=>Re.toastId===m.id?{...Re,height:pe}:Re):[{toastId:m.id,height:pe,position:m.position},...ze])},[_,m.title,m.description,g,m.id]);let Le=X.useCallback(()=>{he(!0),T(mt.current),g(ue=>ue.filter(be=>be.toastId!==m.id)),setTimeout(()=>{v(m)},ty)},[m,v,g,mt]);X.useEffect(()=>{if(m.promise&&Xe==="loading"||m.duration===1/0||m.type==="loading")return;let ue;return E||x||Q&&ms?(()=>{if(Ot.current<Ht.current){let be=new Date().getTime()-Ht.current;me.current=me.current-be}Ot.current=new Date().getTime()})():me.current!==1/0&&(Ht.current=new Date().getTime(),ue=setTimeout(()=>{var be;(be=m.onAutoClose)==null||be.call(m,m),Le()},me.current)),()=>clearTimeout(ue)},[E,x,m,Xe,Q,ms,Le]),X.useEffect(()=>{m.delete&&Le()},[Le,m.delete]);function et(){var ue,be,pe;return ae!=null&&ae.loading?X.createElement("div",{className:ts(F==null?void 0:F.loader,(ue=m==null?void 0:m.classNames)==null?void 0:ue.loader,"sonner-loader"),"data-visible":Xe==="loading"},ae.loading):C?X.createElement("div",{className:ts(F==null?void 0:F.loader,(be=m==null?void 0:m.classNames)==null?void 0:be.loader,"sonner-loader"),"data-visible":Xe==="loading"},C):X.createElement(Ow,{className:ts(F==null?void 0:F.loader,(pe=m==null?void 0:m.classNames)==null?void 0:pe.loader),visible:Xe==="loading"})}return X.createElement("li",{tabIndex:0,ref:De,className:ts(A,xt,F==null?void 0:F.toast,(t=m==null?void 0:m.classNames)==null?void 0:t.toast,F==null?void 0:F.default,F==null?void 0:F[Xe],(s=m==null?void 0:m.classNames)==null?void 0:s[Xe]),"data-sonner-toast":"","data-rich-colors":(r=m.richColors)!=null?r:S,"data-styled":!(m.jsx||m.unstyled||b),"data-mounted":_,"data-promise":!!m.promise,"data-swiped":H,"data-removed":de,"data-visible":Qe,"data-y-position":fs,"data-x-position":Dt,"data-index":w,"data-front":st,"data-swiping":ve,"data-dismissible":Je,"data-type":Xe,"data-invert":Is,"data-swipe-out":ie,"data-swipe-direction":Y,"data-expanded":!!(E||I&&_),style:{"--index":w,"--toasts-before":w,"--z-index":k.length-w,"--offset":`${de?ke:mt.current}px`,"--initial-height":I?"auto":`${te}px`,...B,...m.style},onDragEnd:()=>{R(!1),oe(null),yt.current=null},onPointerDown:ue=>{Pe||!Je||(at.current=new Date,T(mt.current),ue.target.setPointerCapture(ue.pointerId),ue.target.tagName!=="BUTTON"&&(R(!0),yt.current={x:ue.clientX,y:ue.clientY}))},onPointerUp:()=>{var ue,be,pe,ze;if(ie||!Je)return;yt.current=null;let Re=Number(((ue=De.current)==null?void 0:ue.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ee=Number(((be=De.current)==null?void 0:be.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ge=new Date().getTime()-((pe=at.current)==null?void 0:pe.getTime()),Ie=re==="x"?Re:Ee,$e=Math.abs(Ie)/Ge;if(Math.abs(Ie)>=ey||$e>.11){T(mt.current),(ze=m.onDismiss)==null||ze.call(m,m),O(re==="x"?Re>0?"right":"left":Ee>0?"down":"up"),Le(),ge(!0),ce(!1);return}R(!1),oe(null)},onPointerMove:ue=>{var be,pe,ze,Re;if(!yt.current||!Je||((be=window.getSelection())==null?void 0:be.toString().length)>0)return;let Ee=ue.clientY-yt.current.y,Ge=ue.clientX-yt.current.x,Ie=(pe=e.swipeDirections)!=null?pe
6:sy(P);!re&&(Math.abs(Ge)>1||Math.abs(Ee)>1)&&oe(Math.abs(Ge)>Math.abs(Ee)?"x":"y");let $e={x:0,y:0};re==="y"?(Ie.includes("top")||Ie.includes("bottom"))&&(Ie.includes("top")&&Ee<0||Ie.includes("bottom")&&Ee>0)&&($e.y=Ee):re==="x"&&(Ie.includes("left")||Ie.includes("right"))&&(Ie.includes("left")&&Ge<0||Ie.includes("right")&&Ge>0)&&($e.x=Ge),(Math.abs($e.x)>0||Math.abs($e.y)>0)&&ce(!0),(ze=De.current)==null||ze.style.setProperty("--swipe-amount-x",`${$e.x}px`),(Re=De.current)==null||Re.style.setProperty("--swipe-amount-y",`${$e.y}px`)}},it&&!m.jsx?X.createElement("button",{"aria-label":Z,"data-disabled":Pe,"data-close-button":!0,onClick:Pe||!Je?()=>{}:()=>{var ue;Le(),(ue=m.onDismiss)==null||ue.call(m,m)},className:ts(F==null?void 0:F.closeButton,(o=m==null?void 0:m.classNames)==null?void 0:o.closeButton)},(a=ae==null?void 0:ae.close)!=null?a:Bw):null,m.jsx||f.isValidElement(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:X.createElement(X.Fragment,null,Xe||m.icon||m.promise?X.createElement("div",{"data-icon":"",className:ts(F==null?void 0:F.icon,(i=m==null?void 0:m.classNames)==null?void 0:i.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||et():null,m.type!=="loading"?m.
6icon||(ae==null?void 0:ae[Xe])||Lw(Xe):null):null,X.createElement("div",{"data-content":"",className:ts(F==null?void 0:F.content,(l=m==null?void 0:m.classNames)==null?void 0:l.content)},X.createElement("div",{"data-title":"",className:ts(F==null?void 0:F.title,(c=m==null?void 0:m.classNames)==null?void 0:c.title)},typeof m.title=="function"?m.title():m.title),m.description?X.createElement("div",{"data-description":"",className:ts(U,It,F==null?void 0:F.description,(d=m==null?void 0:m.classNames)==null?void 0:d.description)},typeof m.description=="function"?m.description():m.description):null),f.isValidElement(m.cancel)?m.cancel:m.cancel&&io(m.cancel)?X.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||M,onClick:ue=>{var be,pe;io(m.cancel)&&Je&&((pe=(be=m.cancel).onClick)==null||pe.call(be,ue),Le())},className:ts(F==null?void 0:F.cancelButton,(h=m==null?void 0:m.classNames)==null?void 0:h.cancelButton)},m.cancel.label):null,f.isValidElement(m.action)?m.action:m.action&&io(m.action)?X.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||D,onClick:ue=>{var be,pe;io(m.action)&&((pe=(be=m.action).onClick)==null||pe.call(be,ue),!ue.defaultPrevented&&Le())},className:ts(F==null?void 0:F.actionButton,(u=m==null?void 0:m.classNames)==null?void 0:u.actionButton)},m.action.label):null))};function ud(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function ry(e,t){let s={};return[e,t].forEach((r,o)=>{let a=o===1,i=a?"--mobile-offset":"--offset",l=a?Jw:Xw;function c(d){["top","right","bottom","left"].forEach(h=>{s[`${i}-${h}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?s[`${i}-${d}`]=l:s[`${i}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):c(l)}),s}var oy=f.forwardRef(function(e,t){let{invert:s,position:r="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:i,className:l,offset:c,mobileOffset:d,theme:h="light",richColors:u,duration:p,style:m,visibleToasts:b=qw,toastOptions:x,dir:g=ud(),gap:y=Qw,loadingIcon:N,icons:w,containerAriaLabel:k="Notifications",pauseWhenPageIsHidden:E}=e,[v,S]=X.useState([]),z=X.useMemo(()=>Array.from(new Set([r].concat(v.filter(Q=>Q.position).map(Q=>Q.position)))),[v,r]),[B,M]=X.useState([]),[D,A]=X.useState(!1),[U,se]=X.useState(!1),[P,ne]=X.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),C=X.useRef(null),I=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=X.useRef(null),ae=X.useRef(!1),Z=X.useCallback(Q=>{S(re=>{var oe;return(oe=re.find(Y=>Y.id===Q.id))!=null&&oe.delete||Tt.dismiss(Q.id),re.filter(({id:Y})=>Y!==Q.id)})},[]);return X.useEffect(()=>Tt.subscribe(Q=>{if(Q.dismiss){S(re=>re.map(oe=>oe.id===Q.id?{...oe,delete:!0}:oe));return}setTimeout(()=>{vp.flushSync(()=>{S(re=>{let oe=re.findIndex(Y=>Y.id===Q.id);return oe!==-1?[...re.slice(0,oe),{...re[oe],...Q},...re.slice(oe+1)]:[Q,...re]})})})}),[]),X.useEffect(()=>{if(h!=="system"){ne(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ne("dark"):ne("light")),typeof window>"u")return;let Q=window.matchMedia("(prefers-color-scheme: dark)");try{Q.addEventListener("change",({matches:re})=>{ne(re?"dark":"light")})}catch{Q.addListener(({matches:oe})=>{try{ne(oe?"dark":"light")}catch(Y){console.error(Y)}})}},[h]),X.useEffect(()=>{v.length<=1&&A(!1)},[v]),X.useEffect(()=>{let Q=re=>{var oe,Y;o.every(O=>re[O]||re.code===O)&&(A(!0),(oe=C.current)==null||oe.focus()),re.code==="Escape"&&(document.activeElement===C.current||(Y=C.current)!=null&&Y.contains(document.activeElement))&&A(!1)};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[o]),X.useEffect(()=>{if(C.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,ae.current=!1)}},[C.current]),X.createElement("section",{ref:t,"aria-label":`${k} ${I}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},z.map((Q,re)=>{var oe;let[Y,O]=Q.split("-");return v.length?X.createElement("ol",{key:Q,dir:g==="auto"?ud():g,tabIndex:-1,ref:C,className:l,"data-sonner-toaster":!0,"data-theme":P,"data-y-position":Y,"data-lifted":D&&v.length>1&&!a,"data-x-position":O,style:{"--front-toast-height":`${((oe=B[0])==null?void 0:oe.height)||0}px`,"--width":`${Zw}px`,"--gap":`${y}px`,...m,...ry(c,d)},onBlur:_=>{ae.current&&!_.currentTarget.contains(_.relatedTarget)&&(ae.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:_=>{_.target instanceof HTMLElement&&_.target.dataset.dismissible==="false"||ae.current||(ae.current=!0,F.current=_.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{U||A(!1)},onDragEnd:()=>A(!1),onPointerDown:_=>{_.target instanceof HTMLElement&&_.target.dataset.dismissible==="false"||se(!0)},onPointerUp:()=>se(!1)},v.filter(_=>!_.position&&re===0||_.position===Q).map((_,W)=>{var de,he;return X.createElement(ny,{key:_.id,icons:w,index:W,toast:_,defaultRichColors:u,duration:(de=x==null?void 0:x.duration)!=null?de:p,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:s,visibleToasts:b,closeButton:(he=x==null?void 0:x.closeButton)!=null?he:i,interacting:U,position:Q,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,removeToast:Z,toasts:v.filter(ve=>ve.position==_.position),heights:B.filter(ve=>ve.position==_.position),setHeights:M,expandByDefault:a,gap:y,loadingIcon:N,expanded:D,pauseWhenPageIsHidden:E,swipeDirections:e.swipeDirections})})):null}))});function fd(e){return String(e).padStart(2,"0")}function am(e){const t=e?new Date(e):new Date,s=Number.isNaN(t.getTime())?new Date:t;return{year:String(s.getFullYear()),month:fd(s.getMonth()+1),day:fd(s.getDate())}}function pn(e){var i;const t=(i=e.slug)==null?void 0:i.trim();if(!t)return"/";const s=e.published_at??e.publishedAt??e.created_at??null,{year:r,month:o,day:a}=am(s);return`/${r}/${o}/${a}/${t}`}function ay(e,t,s){return/^\d{4}$/.test(e)&&/^\d{2}$/.test(t)&&/^\d{2}$/.test(s)}function Cr(e){return pn({slug:e.slug,published_at:e.published_at,created_at:e.created_at})}function im(e,t){var r;const s=(r=t.slug)==null?void 0:r.trim();return!s||!e||s===e?null:pn(t)}function iy(e){return`${window.location.origin}${pn(e)}`}async function ly(e){var t;if((t=navigator.clipboard)!=null&&t.writeText&&window.isSecureContext)try{return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select(),s.setSelectionRange(0,e.length);const r=document.execCommand("copy");return document.body.removeChild(s),r}catch{return!1}}async function lm(e){const t=iy(e);if(typeof navigator.share=="function")try{await navigator.share({title:e.title,url:t,text:e.title});return}catch(r){if(r instanceof Error&&r.name==="AbortError")return}if(await ly(t)){G.success("Link skopiowany do schowka");return}G.error("Skopiuj link rÄcznie",{description:t,duration:8e3})}function cy({article:e,isActive:t,priority:s=!1,onReadMore:r}){const[o,a]=f.useState(()=>Ao(e.id)),[i,l]=f.useState(!1),[c,d]=f.useState(e.likes),[h,u]=f.useState(!1);f.useEffect(()=>{a(Ao(e.id)),d(e.likes)},[e.id,e.likes]),f.useEffect(()=>{if(!t||om(e.id))return;let y=!1;return $.recordArticleView(e.id).then(N=>{y||(ir(e.id),d(N.likes))}).catch(()=>{ir(e.id)}),()=>{y=!0}},[e.id,t]);const p=async y=>{if(y.stopPropagation(),!o){a(!0),d(N=>N+1),rm(e.id);try{const N=await $.likeArticle(e.id);d(N.likes)}catch{a(!1),d(e.likes)}}},m=y=>{y.stopPropagation(),l(!i)},b=y=>{y.stopPropagation(),u(!0)},x=async y=>{y.stopPropagation();const N=e.slug??e.id;await lm({slug:N,publishedAt:e.publishedAt,title:e.title})},g=y=>y>=1e3?`${(y/1e3).toFixed(1)}k`:y.toString();return n.jsxs("div",{className:"snap-item relative w-full overflow-hidden",children:[n.jsx(Qs,{src:e.image,alt:e.title,variant:"slide",className:"absolute inset-0 w-full h-full object-cover",width:720,height:1280,priority:s}),n.jsx("div",{className:"absolute inset-x-0 top-0 h-32 pointer-events-none",style:{background:"var(--gradient-header)"}}),n.jsx("div",{className:"absolute inset-x-0 bottom-0 h-4/5 pointer-events-none",style:{background:"var(--gradient-slide)"}}
6),n.jsxs("div",{className:"absolute right-4 bottom-36 flex flex-col items-center gap-5 z-20",children:[n.jsxs("button",{onClick:p,disabled:o,className:"flex flex-col items-center gap-1 group",children:[n.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center backdrop-blur-md transition-all duration-200 ${o?"bg-news-red":"bg-black/40 group-active:scale-90"}`,children:n.jsx(On,{size:22,className:`transition-all ${o?"text-white fill-white scale-110":"text-white"}`})}),n.jsx("span",{className:"text-xs text-white font-semibold",children:g(c)})]}),n.jsxs("button",{onClick:b,className:"flex flex-col items-center gap-1 group",children:[n.jsx("div",{className:"w-12 h-12 rounded-full bg-black/40 backdrop-blur-md flex items-center justify-center group-active:scale-90 transition-transform",children:n.jsx(Pr,{size:22,className:"text-white"})}),n.jsx("span",{className:"text-xs text-white font-semibold",children:g(e.comments)})]}),n.jsxs("button",{onClick:m,className:"flex flex-col items-center gap-1 group",children:[n.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center backdrop-blur-md transition-all ${i?"bg-news-gold":"bg-black/40"}`,children:n.jsx(ag,{size:22,className:`transition-all ${i?"text-black fill-black":"text-white"}`})}),n.jsx("span",{className:"text-xs text-white font-semibold",children:"Zapisz"})]}),n.jsxs("button",{onClick:x,className:"flex flex-col items-center gap-1 group",children:[n.jsx("div",{className:"w-12 h-12 rounded-full bg-black/40 backdrop-blur-md flex items-center justify-center group-active:scale-90 transition-transform",children:n.jsx(Qu,{size:22,className:"text-white"})}),n.jsx("span",{className:"text-xs text-white font-semibold",children:"UdostÄpnij"})]})]}),n.jsx(Qb,{articleId:e.id,articleTitle:e.title,commentCount:e.comments,open:h,onOpenChange:u}),n.jsxs("div",{className:"absolute bottom-0 left-0 right-16 p-5 pb-8 z-10",children:[n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:`category-badge px-2.5 py-1 rounded-sm ${zf(e.category)}`,children:e.category}),e.sponsored&&n.jsx("span",{className:"ml-2 category-badge px-2 py-1 rounded-sm border border-news-muted text-news-muted",children:"Sponsorowane"}),e.featured&&n.jsx("span",{className:"ml-2 category-badge px-2 py-1 rounded-sm bg-news-gold text-black font-bold",children:"Wyróżniony"}),e.important&&n.jsx("span",{className:"ml-2 category-badge px-2 py-1 rounded-sm bg-orange-700 text-white font-bold",children:"Ważne"})]}),n.jsx("h2",{className:"font-serif text-xl font-bold leading-tight text-white mb-2 line-clamp-3",children:e.title}),n.jsx("p",{className:"text-sm text-white/80 leading-relaxed line-clamp-2 mb-4",children:e.excerpt}),n.jsx("div",{className:"flex items-center gap-2 mb-4",children:n.jsxs("span",{className:"text-xs text-white/60",children:[e.readTime," min czytania"]})}),n.jsxs("button",{onClick:()=>r(e),className:"flex items-center gap-2 bg-white/10 backdrop-blur-md border border-white/20 text-white px-4 py-2.5 rounded-lg font-semibold text-sm hover:bg-white/20 active:scale-95 transition-all",children:[n.jsx(ef,{size:16}),"Czytaj wiÄcej"]})]})]})}const dy={name:"Redakcja Polska Morska",avatar:"https://api.dicebear.com/7.x/avataaars/svg?seed=polskamorska",bio:"",role:"Redaktor"};function Mo(e){return e?new Date(e).toLocaleDateString("pl-PL",{day:"numeric",month:"short",year:"numeric"}):""}function Wr(e){const t=e.author?{name:e.author.name,avatar:e.author.avatar,bio:e.author.bio,role:e.author.role}:dy;return{id:e.id,title:e.title,excerpt:e.excerpt??"",content:e.content??"",image:Ca(e.image_url)||"",category:e.category,author:t,publishedAt:e.published_at??e.created_at,readTime:e.read_time??3,likes:e.likes,views:e.views??0,comments:e.comments_count,featured:e.featured,important:e.important??!1,sponsored:e.sponsored,tags:e.tags??[],slug:e.slug,status:e.status}}function md(e){return Math.max(e,1)}function hd(e,t){if(!e.length||e.length===1)return 0;const s=e.reduce((o,a)=>o+md(a.priority),0);let r=(t%s+s)%s;for(let o=0;o<e.length;o++){const a=md(e[o].priority);if(r<a)return o;r-=a}return e.length-1}async function cm(e){var s;if((s=navigator.clipboard)!=null&&s.writeText){await navigator.clipboard.writeText(e);return}const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{if(!document.execCommand("copy"))throw new Error("Kopiowanie niedostÄpne w tej przeglÄ
darce")}finally{document.body.removeChild(t)}}function uy(e){return e==="mobile_header"?"mobile":e}const qa="[email protected]",fy=1e4;function dm(e){return`pm-ad-idx-${e}`}function my(e,t){if(t<=0)return 0;try{const s=sessionStorage.getItem(dm(e)),r=s?parseInt(s,10):0;return Number.isFinite(r)?(r%t+t)%t:0}catch{return 0}}function pd(e,t){try{sessionStorage.setItem(dm(e),String(t))}catch{}}function hy({open:e,onClose:t}){const[s,r]=f.useState(!1);if(!e)return null;const o=async()=>{try{await cm(qa),r(!0),G.success("Skopiowano adres e-mail"),setTimeout(()=>r(!1),2e3)}catch{G.error("Nie udaÅo siÄ skopiowaÄ adresu")}};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-[100] bg-black/50",onClick:t,"aria-hidden":!0}),n.jsxs("div",{role:"dialog","aria-labelledby":"ad-contact-title",className:"fixed left-1/2 top-1/2 z-[101] w-[min(calc(100%-2rem),18rem)] -translate-x-1/2 -translate-y-1/2 bg-news-surface border border-border rounded-xl shadow-xl p-4",children:[n.jsx("button",{type:"button",onClick:t,className:"absolute top-3 right-3 text-news-muted hover:text-foreground transition-colors","aria-label":"Zamknij",children:n.jsx(He,{size:16})}),n.jsx("p",{id:"ad-contact-title",className:"text-xs font-semibold text-news-muted uppercase tracking-wider mb-1",children:"Kontakt reklamowy"}),n.jsx("p",{className:"text-sm text-foreground mb-3 pr-6",children:"Napisz do nas w sprawie reklamy"}),n.jsxs("div",{className:"flex items-center gap-2 bg-news-surface-2 border border-border rounded-lg p-2.5",children:[n.jsx("a",{href:`mailto:${qa}`,className:"flex-1 min-w-0 text-sm font-medium text-news-red hover:underline truncate",children:qa}),n.jsx("button",{type:"button",onClick:o,className:"flex-shrink-0 p-1.5 rounded-md bg-news-surface-3 text-news-muted hover:text-foreground transition-colors",title:"Kopiuj adres",children:s?n.jsx(xn,{size:15,className:"text-green-500"}):n.jsx(vr,{size:15})})]})]})]})}function lo({compact:e=!1,className:t=""}){const[s,r]=f.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`block bg-news-surface-2 border border-dashed border-news-red/30 rounded-lg text-center hover:border-news-red transition-colors ${e?"p-3 sm:p-4":"p-6"} ${t}`,children:[n.jsx("div",{className:`bg-news-red/10 rounded-full flex items-center justify-center mx-auto ${e?"w-8 h-8 mb-2":"w-12 h-12 mb-3"}`,children:n.jsx(fn,{size:e?15:20,className:"text-news-red"})}),n.jsx("h3",{className:`font-serif font-bold text-foreground ${e?"text-sm mb-0.5":"mb-1"}`,children:"Miejsce na TwojÄ
reklamÄ"}),n.jsx("p",{className:`text-news-muted ${e?"text-[11px] leading-snug mb-2":"text-xs mb-4"}`,children:"Dotrzyj do tysiÄcy czytelników branży morskiej"}),n.jsx("button",{type:"button",onClick:()=>r(!0),className:`inline-block bg-news-red text-white font-semibold rounded-lg hover:bg-news-red-bright transition-colors ${e?"py-1.5 px-3 text-xs":"py-2 px-6 text-sm"}`,children:"Skontaktuj siÄ z nami"})]}),n.jsx(hy,{open:s,onClose:()=>r(!1)})]})}function um(e){switch(e){case"mobile_header":return"max-h-[90px]";case"hero_banner":return"h-24 md:h-32";case"sidebar":return"h-48";case"article_inline":return"h-32 md:h-40";default:return"h-20 md:h-24"}}function gd({ad:e,placement:t,fill:s=!1,imageUrl:r}){const o=s?"h-full":um(t),a=t==="sidebar",i=t==="mobile_header",l=r??e.image_url;return l&&i?n.jsxs("div",{className:"relative inline-block max-w-full leading-none",children:[n.jsx("span",{className:"absolute top-0.5 left-0.5 z-10 uppercase tracking-wider bg-black/55 text-white rounded text-[6px] px-1 py-px leading-none",children:"Reklama"}),n.jsx("img",{src:Jc(l,t),srcSet:Zc(l,t)||void 0,sizes:Qc(t),alt:e.title,className:"block max-h-[90px] w-auto max-w-full h-auto",loading:"lazy",decoding:"async"})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"absolute top-1.5 left-1.5 z-10 uppercase tracking-wider bg-black/55 text-white rounded text-[8px] px-1 py-0.5 leading-none",children:"Reklama"}),l?n.jsx("div",{className:`relative w-full ${o}`,children:n.jsx("img",{src:Jc(l,t),srcSet:Zc(l,t)||void 0,sizes:Qc(t),alt:e.title,className:"w-full h-full object-cover group-hover:scale-[1.02] transition-transform duration-500",loading:"lazy",decoding:"async"})}):n.jsxs("div",{className:`${o} px-4 flex items-center gap-3 ${a?"justify-center":""}`,children:[n.jsx(fn,{size:a?20:18,className:"text-news-red flex-shrink-0"}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsx("p",{className:"font-bold text-foreground line-clamp-2 text-sm",children:e.title}),e.description&&n.jsx("p",{className:"text-xs text-news-muted line-clamp-2 mt-0.5",children:e.description})]})]})]})}function py({placement:e}){if(e==="mobile_header")return n.jsx(lo,{compact:!0,className:"max-h-[90px] !p-2"});if(e==="hero_banner")return n.jsx(lo,{compact:!0,className:"w-full"});if(e==="feed_between")return n.jsx(lo,{});const t=e.startsWith("article_");return n.jsx(lo,{compact:!0,className:t?"my-6":""})}function Zs({placement:e,className:t="",showFallback:s=!0,scrollIndex:r}){const[o,a]=f.useState([]),[i,l]=f.useState(0),[c,d]=f.useState(!0),h=e
6==="mobile_header"&&r!==void 0,u=f.useRef(null);if(f.useEffect(()=>{let g=!1;return(async()=>{try{const y=await $.getActiveAds(uy(e));if(g)return;a(y),y.length&&l(my(e,y.length))}catch{g||a([])}finally{g||d(!1)}})(),()=>{g=!0}},[e]),f.useEffect(()=>{if(h||o.length<=1)return;const g=window.setInterval(()=>{l(y=>{const N=(y+1)%o.length;return pd(e,N),N})},fy);return()=>window.clearInterval(g)},[o.length,e,h]),f.useEffect(()=>{if(!o.length)return;if(h){if(r===u.current)return;u.current=r??null;const y=o[hd(o,r??0)];if(!y)return;$.recordAdImpression(y.id).catch(()=>{});return}const g=o[i];g&&(pd(e,(i+1)%o.length),$.recordAdImpression(g.id).catch(()=>{}))},[o,i,e,h,r]),c)return null;if(!o.length)return s?n.jsx(py,{placement:e}):null;const p=h?hd(o,r??0):i,m=o[p]??o[0],b=m.mobile_image_url,x=e==="mobile_header"?"flex w-full justify-center overflow-hidden group relative px-2":e==="hero_banner"||e==="feed_between"?"block w-full bg-news-surface-2 border border-border rounded-lg overflow-hidden hover:border-news-red transition-colors group relative":e==="sidebar"?"block bg-news-surface-2 border border-border rounded-lg overflow-hidden hover:border-news-red transition-colors group relative":"block bg-news-surface-2 border border-border rounded-lg overflow-hidden hover:border-news-red transition-colors group relative my-6";return n.jsx("a",{href:m.target_url,target:"_blank",rel:"sponsored noopener noreferrer",className:`${x} ${t}`.trim(),children:o.length>1?n.jsx("div",{className:e==="mobile_header"?"relative w-full max-h-[90px] flex justify-center grid [&>*]:col-start-1 [&>*]:row-start-1":`relative w-full ${um(e)}`,children:o.map((g,y)=>n.jsx("div",{className:`transition-opacity duration-700 ease-in-out ${e==="mobile_header"?y===p?"opacity-100 z-10":"opacity-0 z-0 pointer-events-none":`absolute inset-0 ${y===p?"opacity-100 z-10":"opacity-0 z-0 pointer-events-none"}`}`,"aria-hidden":y!==p,children:n.jsx(gd,{ad:g,placement:e,fill:!0,imageUrl:e==="mobile_header"?g.mobile_image_url:void 0})},g.id))}):n.jsx(gd,{ad:m,placement:e,imageUrl:e==="mobile_header"?b:void 0})})}function fm({gallery:e}){var d,h;const t=((d=e.items)==null?void 0:d.filter(u=>u.url))??[],[s,r]=f.useState(null);if(t.length===0)return null;const o=u=>r(u),a=()=>r(null),i=()=>{s!==null&&r((s-1+t.length)%t.length)},l=()=>{s!==null&&r((s+1)%t.length)},c=s!==null?t[s]:null;return n.jsxs("section",{className:"article-gallery my-8 pt-6 border-t border-border",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(ws,{size:18,className:"text-news-red"}),n.jsx("h2",{className:"font-serif text-lg font-bold text-foreground",children:((h=e.title)==null?void 0:h.trim())||"Galeria zdjÄÄ"})]}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-3",children:t.map((u,p)=>n.jsxs("button",{type:"button",onClick:()=>o(p),className:"group relative aspect-[4/3] overflow-hidden rounded-lg bg-news-surface-3 border border-border focus:outline-none focus-visible:ring-2 focus-visible:ring-news-red",children:[n.jsx(Qs,{src:u.url,alt:u.caption||e.title||"ZdjÄcie z galerii",variant:"card",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105",width:400,height:300}),u.caption&&n.jsx("span",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 to-transparent px-2 py-2 text-left text-[11px] text-white line-clamp-2",children:u.caption})]},u.id))}),c&&s!==null&&n.jsxs("div",{className:"fixed inset-0 z-[100] bg-black/90 flex items-center justify-center p-4",onClick:a,role:"dialog","aria-modal":!0,"aria-label":"PodglÄ
d zdjÄcia",children:[n.jsx("button",{type:"button",onClick:a,className:"absolute top-4 right-4 p-2 rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors","aria-label":"Zamknij",children:n.jsx(He,{size:22})}),t.length>1&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),i()},className:"absolute left-3 sm:left-6 p-2 rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors","aria-label":"Poprzednie zdjÄcie",children:n.jsx(xl,{size:24})}),n.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),l()},className:"absolute right-3 sm:right-6 p-2 rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors","aria-label":"NastÄpne zdjÄcie",children:n.jsx(As,{size:24})})]}),n.jsxs("div",{className:"max-w-5xl w-full max-h-[85vh] flex flex-col items-center",onClick:u=>u.stopPropagation(),children:[n.jsx("img",{src:c.url,alt:c.caption||"",className:"max-h-[75vh] w-auto max-w-full object-contain rounded-lg"}),c.caption&&n.jsx("p",{className:"mt-3 text-sm text-white/90 text-center max-w-2xl",children:c.caption}),t.length>1&&n.jsxs("p",{className:"mt-2 text-xs text-white/60",children:[s+1," / ",t.length]})]})]})]})}function xd({galleries:e}){const t=e.filter(s=>{var r;return(r=s.items)==null?void 0:r.some(o=>o.url)});return t.length?n.jsx("div",{className:"space-y-2",children:t.map(s=>n.jsx(fm,{gallery:s},s.id))}):null}const Lo={after_content:"Pod treÅciÄ
artykuÅu",before_content:"Nad treÅciÄ
artykuÅu",inline:"W treÅci (shortcode)"},An="after_content";function co(e){return`[gallery id="${e}"]`}const mm=/\[gallery\s+id=["']([^"']+)["']\s*\]/gi;function hm(e){const t=new Set;for(const s of String(e).matchAll(mm))t.add(s[1]);return[...t]}function pm(e,t){return t?hm(e).includes(t):!1}function bd(e){return String(e).replace(mm,"")}const gy=/(\[gallery\s+id=["'][^"']+["']\s*\])/gi;function wd(e,t){return e.filter(s=>{var r;return(s.placement??"after_content")===t&&((r=s.items)==null?void 0:r.some(o=>o.url))})}function xy(e,t){return e.find(s=>
6{var r;return s.id===t&&((r=s.items)==null?void 0:r.some(o=>o.url))})}function by(e,t){const s=bd(e);if(hm(e).length===0)return s?[{type:"html",html:s}]:[];const o=e.split(gy),a=[],i=new Set;for(const l of o){const c=l.match(/^\[gallery\s+id=["']([^"']+)["']\s*\]$/i);if(c){const h=c[1];if(i.has(h))continue;const u=xy(t,h);u&&(i.add(h),a.push({type:"gallery",gallery:u}));continue}const d=bd(l);d.trim()&&a.push({type:"html",html:d})}return a}function wy({html:e,galleries:t,formatHtml:s}){const r=by(e,t);return r.length===0?null:n.jsx(n.Fragment,{children:r.map((o,a)=>o.type==="gallery"?n.jsx(fm,{gallery:o.gallery},`${o.gallery.id}-${a}`):n.jsx("div",{className:"article-body",dangerouslySetInnerHTML:{__html:s(o.html)}},`html-${a}`))})}function yy(e,t){const s=Math.abs(e);if(s===1)return t[0];const r=s%100,o=s%10;return o>=2&&o<=4&&(r<12||r>14)?t[1]:t[2]}function yd(e){return`${e.toLocaleString("pl-PL")} ${yy(e,["odsÅona","odsÅony","odsÅon"])}`}function No({to:e="/",...t}){return n.jsx(En,{to:e,...t})}function vy(e){const t=new Date(e),s=Date.now()-t.getTime(),r=Math.floor(s/6e4);if(r<60)return`${r||1} min temu`;const o=Math.floor(r/60);return o<24?`${o}h temu`:t.toLocaleDateString("pl-PL",{day:"numeric",month:"short",year:"numeric"})}function gm({article:e,onBack:t,isMobile:s,popularArticles:r,onSelectArticle:o}){var re,oe,Y;const{sectionVisibility:a,sectionVisibilityReady:i}=us(),l=i&&cn(a,"article_views"),c=f.useRef(null),[d,h]=f.useState(()=>Ao(e.id)),[u,p]=f.useState(e.likes),[m,b]=f.useState(e.views??0),[x,g]=f.useState([]),[y,N]=f.useState(!0),[w,k]=f.useState(""),[E,v]=f.useState(!1),[S,z]=f.useState(e.content),[B,M]=f.useState(!((re=e.content)!=null&&re.trim())),[D,A]=f.useState([]),[U,se]=f.useState(!0),[P,ne]=f.useState([]),C=f.useRef(null);f.useEffect(()=>{var W;if(z(e.content),(W=e.content)!=null&&W.trim()){M(!1);return}let O=!1;return M(!0),(e.slug?$.getArticleBySlug(e.slug):$.getArticle(e.id)).then(de=>{O||z(de.content??"")}).catch(()=>{O||z("")}).finally(()=>{O||M(!1)}),()=>{O=!0}},[e.id,e.slug,e.content]),f.useEffect(()=>{var O;h(Ao(e.id)),p(e.likes),b(e.views??0),k(""),window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0,(O=c.current)==null||O.scrollTo(0,0)},[e.id,e.slug,e.likes,e.views]),f.useEffect(()=>{if(om(e.id))return;if(e.status&&e.status!=="published"){ir(e.id);return}let O=!1;return $.recordArticleView(e.id).then(_=>{O||(ir(e.id),b(_.views),p(_.likes))}).catch(()=>{ir(e.id)}),()=>{O=!0}},[e.id,e.status]),f.useEffect(()=>{N(!0),$.getArticleComments(e.id).then(g).catch(()=>g([])).finally(()=>N(!1))},[e.id]),f.useEffect(()=>{let O=!1;return se(!0),A([]),$.getRelatedArticles(e.id,{category:e.category,limit:6}).then(_=>{O||A(_.map(W=>({...Wr(W),slug:W.slug})))}).catch(()=>{O||A([])}).finally(()=>{O||se(!1)}),()=>{O=!0}},[e.id,e.category]),f.useEffect(()=>{let O=!1;return $.getGalleries(e.id).then(_=>{O||ne(_)}).catch(()=>{O||ne([])}),()=>{O=!0}},[e.id]);const I=async()=>{const O=w.trim();if(!(!O||E)){v(!0);try{await $.createComment({article_id:e.id,content:O}),k(""),G.success("Komentarz wysÅany â pojawi siÄ po moderacji")}catch{}finally{v(!1)}}},F=async()=>{if(!d){h(!0),p(O=>O+1),rm(e.id);try{const O=await $.likeArticle(e.id);p(O.likes),b(O.views)}catch{h(!1),p(e.likes)}}},ae=()=>{lm({slug:e.slug,publishedAt:e.publishedAt,title:e.title})},Z=e.status&&e.status!=="published",Q=e.status==="scheduled"?"PodglÄ
d redakcyjny â artykuÅ zaplanowany (niewidoczny publicznie)":"PodglÄ
d redakcyjny â szkic (niewidoczny publicznie)";return n.jsxs("div",{ref:c,className:"bg-background min-h-screen overflow-x-clip overflow-y-auto custom-scrollbar",children:[n.jsxs("header",{className:"sticky top-0 z-50 bg-background/95 backdrop-blur-md border-b border-border",children:[Z&&n.jsxs("div",{className:"article-preview-banner flex items-center justify-center gap-2 px-4 py-2.5 text-center text-sm font-semibold",role:"status",children:[n.jsx(At,{size:16,className:"flex-shrink-0 opacity-90","aria-hidden":!0}),n.jsx("span",{children:Q})]}),n.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[n.jsxs("button",{onClick:t,className:"flex items-center gap-2 text-news-muted hover:text-foreground transition-colors",children:[n.jsx(yr,{size:20}),n.jsx("span",{className:"text-sm font-medium",children:"WróÄ"})]}),n.jsx(No,{to:"/",className:"flex items-center",children:n.jsx(js,{className:"h-7 w-auto",height:28,variant:s?"mobile":"desktop"})}),n.jsx("div",{className:"flex items-center gap-3",children:n.jsx("button",{type:"button",onClick:ae,"aria-label":"UdostÄpnij artykuÅ",className:"text-news-muted hover:text-foreground transition-colors",children:n.jsx(Qu,{size:20})})})]})]}),n.jsxs("div",{className:"max-w-[1440px] mx-auto w-full min-w-0 px-4 lg:px-6 py-0 xl:grid xl:grid-cols-[minmax(0,1fr)_320px] xl:gap-8",children:[n.jsxs("article",{className:"max-w-2xl xl:max-w-none mx-auto xl:mx-0 w-full min-w-0 xl:pt-6",children:[n.jsx("div",{className:"relative aspect-[16/9] overflow-hidden rounded-lg",children:n.jsx(Qs,{src:e.image,alt:e.title,variant:"full",className:"w-full h-full object-cover",width:1200,height:675,priority:!0})}),n.jsxs("div",{className:"px-5 lg:px-0 py-6",children:[n.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:`category-badge px-2.5 py-1 rounded-sm ${zf(e.category)}`,children:e.category}),e.featured&&n.jsx("span",{className:"category-badge px-2.5 py-1 rounded-sm bg-news-gold text-black font-bold",children:"Wyró
6żniony"}),e.important&&n.jsx("span",{className:"category-badge px-2.5 py-1 rounded-sm bg-orange-700 text-white font-bold",children:"Ważne"})]}),n.jsx("h1",{className:"font-serif text-2xl md:text-3xl font-bold leading-tight text-foreground mb-4",children:e.title}),((oe=e.excerpt)==null?void 0:oe.trim())&&n.jsx("p",{className:"article-lead text-lg md:text-xl font-bold text-foreground leading-relaxed mb-6",children:e.excerpt}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 pb-5 border-b border-border mb-6 text-xs text-news-muted",children:[n.jsxs("div",{className:"flex items-center gap-2 text-foreground",children:[n.jsx("div",{className:"w-7 h-7 rounded-full bg-news-surface-3 flex items-center justify-center",children:n.jsx(bl,{size:14,className:"text-news-muted"})}),n.jsx("span",{className:"text-sm font-semibold",children:((Y=e.author)==null?void 0:Y.name)??"Redakcja Polska Morska"})]}),n.jsx("span",{className:"text-news-dim",children:"·"}),n.jsx("span",{children:new Date(e.publishedAt).toLocaleDateString("pl-PL",{day:"numeric",month:"long",year:"numeric"})}),n.jsx("span",{className:"text-news-dim",children:"·"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Rr,{size:12}),n.jsxs("span",{children:[e.readTime," min czytania"]})]}),l&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-news-dim",children:"·"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(At,{size:12}),n.jsx("span",{children:yd(m)})]})]})]}),n.jsx(Zs,{placement:"article_top"}),B?n.jsxs("div",{className:"space-y-3 animate-pulse",children:[n.jsx("div",{className:"h-4 bg-news-surface-3 rounded w-full"}),n.jsx("div",{className:"h-4 bg-news-surface-3 rounded w-5/6"}),n.jsx("div",{className:"h-4 bg-news-surface-3 rounded w-full"}),n.jsx("div",{className:"h-4 bg-news-surface-3 rounded w-4/6"})]}):n.jsxs(n.Fragment,{children:[n.jsx(xd,{galleries:wd(P,"before_content")}),n.jsx(wy,{html:S,galleries:P,formatHtml:O=>Ll(O,e.excerpt)}),n.jsx(Zs,{placement:"article_inline",showFallback:!1}),n.jsx(xd,{galleries:wd(P,"after_content")})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 mt-8 pt-6 border-t border-border",children:[n.jsx(wa,{size:14,className:"text-news-muted mt-0.5"}),e.tags.map(O=>n.jsxs("span",{className:"text-xs bg-news-surface-2 text-news-muted px-3 py-1 rounded-full border border-border hover:border-news-red hover:text-news-red cursor-pointer transition-colors",children:["#",O]},O))]}),n.jsxs("div",{className:"flex items-center gap-4 mt-6 py-4 border-t border-border",children:[n.jsxs("button",{onClick:F,disabled:d,className:`flex items-center gap-2 px-4 py-2 rounded-lg transition-all ${d?"bg-news-red text-white":"bg-news-surface-2 text-news-muted hover:bg-news-surface-3"}`,children:[n.jsx(On,{size:16,className:d?"fill-white":""}),n.jsx("span",{className:"text-sm font-semibold",children:u.toLocaleString("pl-PL")})]}),n.jsxs("button",{type:"button",onClick:()=>{var O;return(O=C.current)==null?void 0:O.scrollIntoView({behavior:"smooth"})},className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-news-surface-2 text-news-muted hover:bg-news-surface-3 transition-colors",children:[n.jsx(Pr,{size:16}),n.jsx("span",{className:"text-sm font-semibold",children:x.length||e.comments})]})]}),n.jsx(Zs,{placement:"article_bottom"}),n.jsxs("div",{className:"mt-6",ref:C,children:[n.jsxs("h3",{className:"font-serif text-xl font-bold text-foreground mb-4",children:["Komentarze (",x.length||e.comments,")"]}),y?n.jsx("p",{className:"text-sm text-news-muted",children:"Åadowanie komentarzy..."}):x.length===0?n.jsx("p",{className:"text-sm text-news-muted mb-4",children:"Brak komentarzy. BÄ
dź pierwszy!"}):n.jsx("div",{className:"space-y-4",children:x.map(O=>n.jsxs("div",{className:"bg-news-surface-2 rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-sm font-semibold text-foreground",children:O.author_name}),n.jsx("span",{className:"text-xs text-news-muted",children:vy(O.created_at)})]}),n.jsx("p",{className:"text-sm text-news-muted",children:O.content}),O.likes>0&&n.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-news-dim",children:[n.jsx(On,{size:12})," ",O.likes]})]},O.id))}),n.jsxs("div",{className:"mt-4 flex gap-2",children:[n.jsx("input",{type:"text",value:w,onChange:O=>k(O.target.value),onKeyDown:O=>O.key==="Enter"&&I(),placeholder:"Dodaj komentarz...",disabled:E,className:"flex-1 bg-news-surface-2 border border-border rounded-lg px-4 py-3 text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red transition-colors"}),n.jsx("button",{onClick:I,disabled:E||!w.trim(),className:"px-4 py-3 bg-news-red text-white rounded-lg text-sm font-semibold disabled:opacity-50",children:"WyÅlij"})]}),n.jsx("p",{className:"text-xs text-news-dim mt-2",children:"Komentarz wymaga moderacji przed publikacjÄ
."})]}),n.jsxs("div",{className:"mt-8 pt-6 border-t border-border",children:[n.jsx("h3",{className:"font-serif text-xl font-bold text-foreground mb-4",children:"PowiÄ
zane artykuÅy"}),U?n.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((O,_)=>n.jsxs("div",{className:"flex gap-3 animate-pulse",children:[n.jsx("div",{className:"w-20 h-16 bg-news-surface-3 rounded-lg flex-shrink-0"}),n.jsxs("div",{className:"flex-1 space-y-2 py-1",children:[n.jsx("div",{className:"h-3 bg-news-surface-3 rounded w-16"}),n.jsx("div",{className:"h-4 bg-news-surface-3 rounded w-full"}),n.jsx("div",{className:"h-3 bg-news-surface-3 rounded w-20"})]})]},_))}):D.length===0?n.jsx("p",{className:"text-sm text-news-muted",children:"Brak innych artykuÅów w tej kategorii."}):n.jsx("div",{className:"space-y-4",children:D.map(O=>n.jsxs("button",{type:"button",onClick:()=>o==null?void 0:o(O),className:"w-full flex gap-3 group text-left hover:bg-news-surface-2 rounded-lg p-1 -mx-1 transition-colors",children:[n.jsx(Qs,{src:O.image,alt:O.title,variant:"thumb",className:"w-20 h-16 object-cover rounded-lg flex-shrink-0",width:80,height:64}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("span",{className:"text-xs text-news-red font-bold uppercase tracking-wide",children:O.category}),n.jsx("h4",{className:"text-sm font-semibold text-foreground line-clamp-2 group-hover:text-news-red transition-colors",children:O.title}),n.jsxs("span",{className:"text-xs text-news-muted",children:[O.readTime," min"]})]})]},O.id))})]})]})]}),!s&&n.jsx("aside",{className:"hidden xl:block py-6 min-w-0",children:n.jsxs("div",{className:"sticky top-20 space-y-6",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(jr,{size:16,className:"text-news-red"}),n.jsx("h3",{className:"font-serif text-lg font-bold text-foreground",children:"Popularne artykuÅy"})]}),r&&r.length>0?n.jsx("div",{className:"space-y-3",children:r.map((O,_)=>{const W=O.id===e.id||!!O.slug&&O.slug===e.slug;return n.jsxs("button",{type:"button",disabled:W,onClick:()=>{W||o==null||o(O)},className:`w-full text-left flex gap-3 group py-2 border-b border-border last:border-0 transition-colors ${W?"opacity-60 cursor-default":"hover:bg-news-surface-3/50 rounded-lg -mx-1 px-1"}`,children:[n.jsx("span",{className:`font-serif text-xl font-bold w-6 flex-shrink-0 ${W?"text-news-muted":"text-news-red"}`,children:_+1}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("span",{className:"text-[10px] text-news-red font-bold uppercase tracking-wide",children:O.category}),n.jsx("h4",{className:`text-sm font-semibold line-clamp-2 leading-snug ${W?"text-news-muted":"text-foreground group-hover:text-news-red transition-colors"}`,children:O.title}),n.jsxs("span",{className:"text-xs text-news-dim",children:[O.readTime," min",l&&n.jsxs(n.Fragment,{children:[" · ",yd(O.views??0)]}
6)," · ",O.likes.toLocaleString("pl-PL")," â¤"]})]})]},O.slug||O.id)})}):n.jsx("p",{className:"text-sm text-news-muted",children:"Brak artykuÅów do wyÅwietlenia."})]}),n.jsx(Zs,{placement:"sidebar"})]})})]}),n.jsx(Rn,{})]})}function jy({videoId:e,title:t,isActive:s,isAdjacent:r=!1}){const o=f.useRef(null),[a,i]=f.useState(!1),[l,c]=f.useState(!1),[d,h]=f.useState(!0);f.useEffect(()=>{(s||r)&&i(!0)},[s,r]),f.useEffect(()=>{c(!1),h(!0)},[e]),f.useEffect(()=>{var p;!s&&o.current&&((p=o.current.contentWindow)==null||p.postMessage(JSON.stringify({event:"command",func:"mute",args:[]}),"https://www.youtube-nocookie.com"),h(!0))},[s]);const u=()=>{var m,b;if(!o.current)return;const p=d?"unMute":"mute";(m=o.current.contentWindow)==null||m.postMessage(JSON.stringify({event:"command",func:p,args:[]}),"https://www.youtube-nocookie.com"),d&&((b=o.current.contentWindow)==null||b.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[100]}),"https://www.youtube-nocookie.com")),h(!d)};return n.jsxs("div",{className:"snap-item relative w-full overflow-hidden bg-black",children:[n.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[a&&n.jsx("iframe",{ref:o,src:`https://www.youtube-nocookie.com/embed/${e}?rel=0&autoplay=1&mute=1&controls=0&playsinline=1&loop=1&modestbranding=1&iv_load_policy=3&cc_load_policy=0&fs=0&enablejsapi=1&playlist=${e}`,title:t,loading:"eager",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,onLoad:()=>c(!0),className:`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 transition-opacity duration-300 ${s&&l?"opacity-100":"opacity-0"}`,style:{width:"max(100%, calc(100dvh * 9 / 16))",height:"max(100dvh, calc(100vw * 16 / 9))",pointerEvents:s?"auto":"none",border:0}},e),n.jsx("img",{src:`https://i.ytimg.com/vi/${e}/hqdefault.jpg`,alt:t,className:`absolute inset-0 w-full h-full object-cover transition-opacity duration-500 ${s&&l?"opacity-0":"opacity-80"}`,loading:"lazy"})]}),n.jsx("div",{className:"absolute inset-x-0 top-0 pointer-events-none",style:{height:"138px",background:"linear-gradient(to bottom, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 45%, transparent 100%)"}}),n.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 pointer-events-none",style:{background:"var(--gradient-slide)"}}),n.jsxs("div",{className:"absolute bottom-0 left-0 right-4 p-5 pb-8 z-10",children:[n.jsx("h2",{className:"font-serif text-lg font-bold leading-tight text-white mb-3 line-clamp-3",children:t}),n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsxs("a",{href:`https://www.youtube.com/watch?v=${e}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 bg-white/10 backdrop-blur-md border border-white/20 text-white px-4 py-2.5 rounded-lg font-semibold text-sm hover:bg-white/20 active:scale-95 transition-all",children:[n.jsx(Nr,{size:16}),"Otwórz w YouTube"]}),s&&n.jsx("button",{onClick:p=>{p.stopPropagation(),u()},className:"w-10 h-10 flex items-center justify-center rounded-lg bg-black/55 text-white/95 backdrop-blur-sm border border-white/35 hover:bg-black/75 active:scale-95 transition-all","aria-label":d?"WÅÄ
cz dźwiÄk":"WyÅÄ
cz dźwiÄk",children:d?n.jsx(ig,{size:17}):n.jsx(lg,{size:17})})]})]})]})}const Rl=6e4,$l=5*6e4;function xm(e){return["articles",{status:e.status??null,category:e.category??null,limit:e.limit??null,appOnly:e.appOnly??!1}]}function Ta(e={}){var i,l;const t={status:e.status,category:e.category,limit:e.limit,appOnly:e.appOnly},s=Nl({queryKey:xm(t),queryFn:({pageParam:c})=>$.getArticles({status:t.status,category:t.category,limit:t.limit,offset:c,appOnly:t.appOnly}),initialPageParam:0,getNextPageParam:c=>c.hasMore?c.offset+c.articles.length:void 0,staleTime:e.staffFresh?0:Rl,gcTime:e.staffFresh?6e4:$l}),r=f.useMemo(()=>{var c;return((c=s.data)==null?void 0:c.pages.flatMap(d=>d.articles))??[]},[s.data]),o=((l=(i=s.data)==null?void 0:i.pages[0])==null?void 0:l.total)??0,a=f.useCallback(()=>{s.hasNextPage&&!s.isFetchingNextPage&&s.fetchNextPage()},[s.hasNextPage,s.isFetchingNextPage,s.fetchNextPage]);return{articles:r,total:o,hasMore:s.hasNextPage??!1,loading:s.isLoading,loadingMore:s.isFetchingNextPage,isFetching:s.isFetching,error:s.error?s.error instanceof Error?s.error.message:"BÅÄ
d pobierania artykuÅów":null,refetch:s.refetch,loadM
6ore:a}}function Bl(){const e=ja();return f.useCallback(()=>e.invalidateQueries({queryKey:["articles"]}),[e])}function bm(){const[e,t]=f.useState([]),[s,r]=f.useState(!0);return f.useEffect(()=>{(async()=>{try{const o=await $.getShorts();t(o)}catch{t([])}r(!1)})()},[]),{shorts:e,loading:s}}function Te(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Wt(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Nt(e,t){const s=Te(e);return isNaN(t)?Wt(e,NaN):(t&&s.setDate(s.getDate()+t),s)}function as(e,t){const s=Te(e);if(isNaN(t))return Wt(e,NaN);if(!t)return s;const r=s.getDate(),o=Wt(e,s.getTime());o.setMonth(s.getMonth()+t+1,0);const a=o.getDate();return r>=a?o:(s.setFullYear(o.getFullYear(),o.getMonth(),r),s)}const Fl=6048e5,Ny=864e5;let ky={};function Ur(){return ky}function Ns(e,t){var l,c,d,h;const s=Ur(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??s.weekStartsOn??((h=(d=s.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??0,o=Te(e),a=o.getDay(),i=(a<r?7:0)+a-r;return o.setDate(o.getDate()-i),o.setHours(0,0,0,0),o}function gn(e){return Ns(e,{weekStartsOn:1})}function wm(e){const t=Te(e),s=t.getFullYear(),r=Wt(e,0);r.setFullYear(s+1,0,4),r.setHours(0,0,0,0);const o=gn(r),a=Wt(e,0);a.setFullYear(s,0,4),a.setHours(0,0,0,0);const i=gn(a);return t.getTime()>=o.getTime()?s+1:t.getTime()>=i.getTime()?s:s-1}function $n(e){const t=Te(e);return t.setHours(0,0,0,0),t}function Io(e){const t=Te(e),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+e-+s}function ys(e,t){const s=$n(e),r=$n(t),o=+s-Io(s),a=+r-Io(r);return Math.round((o-a)/Ny)}function Sy(e){const t=wm(e),s=Wt(e,0);return s.setFullYear(t,0,4),s.setHours(0,0,0,0),gn(s)}function Vi(e,t){const s=t*7;return Nt(e,s)}function Cy(e,t){return as(e,t*12)}function _y(e){let t;return e.forEach(function(s){const r=Te(s);(t===void 0||t<r||isNaN(Number(r)))&&(t=r)}),t||new Date(NaN)}function Ty(e){let t;return e.forEach(s=>{const r=Te(s);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}function zt(e,t){const s=$n(e),r=$n(t);return+s==+r}function Wl(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Ey(e){if(!Wl(e)&&typeof e!="number")return!1;const t=Te(e);return!isNaN(Number(t))}function _r(e,t){const s=Te(e),r=Te(t),o=s.getFullYear()-r.getFullYear(),a=s.getMonth()-r.getMonth();return o*12+a}function zy(e,t,s){const r=Ns(e,s),o=Ns(t,s),a=+r-Io(r),i=+o-Io(o);return Math.round((a-i)/Fl)}function Ul(e){const t=Te(e),s=t.getMonth();return t.setFullYear(t.getFullYear(),s+1,0),t.setHours(23,59,59,999),t}function Mt(e){const t=Te(e);return t.setDate(1),t.setHours(0,0,0,0),t}function ym(e){const t=Te(e),s=Wt(e,0);return s.setFullYear(t.getFullYear(),0,1),s.setHours(0,0,0,0),s}function Hl(e,t){var l,c,d,h;const s=Ur(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??s.weekStartsOn??((h=(d=s.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??0,o=Te(e),a=o.getDay(),i=(a<r?-7:0)+6-(a-r);return o.setDate(o.getDate()+i),o.setHours(23,59,59,999),o}function vm(e){return Hl(e,{weekStartsOn:1})}const Ay={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},My=(e,t,s)=>{let r;const o=Ay[e];
vendor: 6,109 bytes, line 6
6return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+r:r+" ago":r};function Xa(e){return(t={})=>{const s=t.width?String(t.width):e.defaultWidth;return e.formats[s]||e.formats[e.defaultWidth]}}const Ly={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Iy={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Oy={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Dy={date:Xa({formats:Ly,defaultWidth:"full"}),time:Xa({formats:Iy,defaultWidth:"full"}),dateTime:Xa({formats:Oy,defaultWidth:"full"})},Py={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ry=(e,t,s,r)=>Py[e];function Zn(e){return(t,s)=>{const r=s!=null&&s.context?String(s.context):"standalone";let o;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=s!=null&&s.width?String(s.width):i;o=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=s!=null&&s.width?String(s.width):e.defaultWidth;o=e.values[l]||e.values[i]}const a=e.argumentCallback?e.argumentCallback(t):t;return o[a]}}const $y={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},By={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Fy={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Wy={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Uy={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Hy={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Gy=(e,t)=>{const s=Number(e),r=s%100;if(r>20||r<10)switch(r%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},Yy={ordinalNumber:Gy,era:Zn({values:$y,defaultWidth:"wide"}),quarter:Zn({values:By,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Zn({values:Fy,defaultWidth:"wide"}),day:Zn({values:Wy,defaultWidth:"wide"}),dayPeriod:Zn({values:Uy,defaultWidth:"wide",formattingValues:Hy,defaultFormattingWidth:"wide"})};function Qn(e){return(t,s={})=>{const r=s.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;const i=a[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?Ky(l,u=>u.test(i)):Vy(l,u=>u.test(i));let d;d=e.valueCallback?e.valueCallback(c):c,d=s.valueCallback?s.valueCallback(d):d;const h=t.slice(i.length);return{value:d,rest:h}}}function Vy(e,t){for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t(e[s]))return s}function Ky(e,t){for(let s=0;s<e.length;s++)if(t(e[s]))return s}function qy(e){return(t,s={})=>{const r=t.match(e.matchPattern);if(!r)return null;const o=r[0],a=t.match(e.parsePattern);if(!a)return null;let i=e.valueCallback?e.valueCallback(a[0]):a[0];i=s.valueCallback?s.valueCallback(i):i;const l=t.slice(o.length);return{value:i,rest:l}}}const Xy=/^(\d+)(th|st|nd|rd)?/i,Jy=/\d+/i,Zy={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Qy={any:[/^b/i,/^(a|c)/i]},ev={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},tv={any:[/1/i,/2/i,/3/i,/4/i]},sv={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},nv={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},rv={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ov={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},av={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},iv={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},lv={ordinalNumber:qy({matchPattern:Xy,parsePattern:Jy,valueCallback:e=>parseInt(e,10)}),era:Qn({matchPatterns:Zy,defaultMatchWidth:"wide",parsePatterns:Qy,defaultParseWidth:"any"}),quarter:Qn({matchPatterns:ev,defaultMatchWidth:"wide",parsePatterns:tv,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Qn({matchPatterns:sv,defaultMatchWidth:"wide",parsePatterns:nv,defaultParseWidth:"any"}),day:Qn({matchPatterns:rv,defaultMatchWidth:"wide",parsePatterns:ov,defaultParseWidth:"any"}),dayPeriod:Qn({matchPatterns:av,defaultMatchWidth:"any",parsePatterns:iv,defaultParseWidth:"any"})},jm={code:"en-US",formatDistance:My,formatLong:Dy,formatRelative:Ry,localize:Yy,match:lv,o
vendor: 1,261 bytes, line 6
6ptions:{weekStartsOn:0,firstWeekContainsDate:1}};function cv(e){const t=Te(e);return ys(t,ym(t))+1}function Nm(e){const t=Te(e),s=+gn(t)-+Sy(t);return Math.round(s/Fl)+1}function km(e,t){var h,u,p,m;const s=Te(e),r=s.getFullYear(),o=Ur(),a=(t==null?void 0:t.firstWeekContainsDate)??((u=(h=t==null?void 0:t.locale)==null?void 0:h.options)==null?void 0:u.firstWeekContainsDate)??o.firstWeekContainsDate??((m=(p=o.locale)==null?void 0:p.options)==null?void 0:m.firstWeekContainsDate)??1,i=Wt(e,0);i.setFullYear(r+1,0,a),i.setHours(0,0,0,0);const l=Ns(i,t),c=Wt(e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);const d=Ns(c,t);return s.getTime()>=l.getTime()?r+1:s.getTime()>=d.getTime()?r:r-1}function dv(e,t){var l,c,d,h;const s=Ur(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??s.firstWeekContainsDate??((h=(d=s.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??1,o=km(e,t),a=Wt(e,0);return a.setFullYear(o,0,r),a.setHours(0,0,0,0),Ns(a,t)}function Sm(e,t){const s=Te(e),r=+Ns(s,t)-+dv(s,t);return Math.round(r/Fl)+1}function Me(e,t){const s=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return s+r}const Fs={y(e,t){const s=e.getFullYear(),r=s>
vendor: 5,403 bytes, line 6
60?s:1-s;return Me(t==="yy"?r%100:r,t.length)},M(e,t){const s=e.getMonth();return t==="M"?String(s+1):Me(s+1,2)},d(e,t){return Me(e.getDate(),t.length)},a(e,t){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(e,t){return Me(e.getHours()%12||12,t.length)},H(e,t){return Me(e.getHours(),t.length)},m(e,t){return Me(e.getMinutes(),t.length)},s(e,t){return Me(e.getSeconds(),t.length)},S(e,t){const s=t.length,r=e.getMilliseconds(),o=Math.trunc(r*Math.pow(10,s-3));return Me(o,t.length)}},kn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},vd={G:function(e,t,s){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(r,{width:"abbreviated"});case"GGGGG":return s.era(r,{width:"narrow"});case"GGGG":default:return s.era(r,{width:"wide"})}},y:function(e,t,s){if(t==="yo"){const r=e.getFullYear(),o=r>0?r:1-r;return s.ordinalNumber(o,{unit:"year"})}return Fs.y(e,t)},Y:function(e,t,s,r){const o=km(e,r),a=o>0?o:1-o;if(t==="YY"){const i=a%100;return Me(i,2)}return t==="Yo"?s.ordinalNumber(a,{unit:"year"}):Me(a,t.length)},R:function(e,t){const s=wm(e);return Me(s,t.length)},u:function(e,t){const s=e.getFullYear();return Me(s,t.length)},Q:function(e,t,s){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Me(r,2);case"Qo":return s.ordinalNumber(r,{unit:"quarter"});case"QQQ":return s.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,s){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Me(r,2);case"qo":return s.ordinalNumber(r,{unit:"quarter"});case"qqq":return s.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,s){const r=e.getMonth();switch(t){case"M":case"MM":return Fs.M(e,t);case"Mo":return s.ordinalNumber(r+1,{unit:"month"});case"MMM":return s.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,s){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Me(r+1,2);case"Lo":return s.ordinalNumber(r+1,{unit:"month"});case"LLL":return s.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,s,r){const o=Sm(e,r);return t==="wo"?s.ordinalNumber(o,{unit:"week"}):Me(o,t.length)},I:function(e,t,s){const r=Nm(e);return t==="Io"?s.ordinalNumber(r,{unit:"week"}):Me(r,t.length)},d:function(e,t,s){return t==="do"?s.ordinalNumber(e.getDate(),{unit:"date"}):Fs.d(e,t)},D:function(e,t,s){const r=cv(e);return t==="Do"?s.ordinalNumber(r,{unit:"dayOfYear"}):Me(r,t.length)},E:function(e,t,s){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(r,{width:"short",context:"formatting"});case"EEEE":default:return s.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,s,r){const o=e.getDay(),a=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return Me(a,2);case"eo":return s.ordinalNumber(a,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,s,r){const o=e.getDay(),a=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return Me(a,t.length);case"co":return s.ordinalNumber(a,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,s){const r=e.getDay(),o=r===0?7:r;switch(t){case"i":return String(o);case"ii":return Me(o,t.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(r,{width:"short",context:"formatting"});case"iiii":default:return s.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,s){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,s){const r=e.getHours();let o;switch(r===12?o=kn.noon:r===0?o=kn.midnight:o=r/12>
vendor: 2,142 bytes, line 6
6=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,s){const r=e.getHours();let o;switch(r>=17?o=kn.evening:r>=12?o=kn.afternoon:r>=4?o=kn.morning:o=kn.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,s){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),s.ordinalNumber(r,{unit:"hour"})}return Fs.h(e,t)},H:function(e,t,s){return t==="Ho"?s.ordinalNumber(e.getHours(),{unit:"hour"}):Fs.H(e,t)},K:function(e,t,s){const r=e.getHours()%12;return t==="Ko"?s.ordinalNumber(r,{unit:"hour"}):Me(r,t.length)},k:function(e,t,s){let r=e.getHours();return r===0&&(r=24),t==="ko"?s.ordinalNumber(r,{unit:"hour"}):Me(r,t.length)},m:function(e,t,s){return t==="mo"?s.ordinalNumber(e.getMinutes(),{unit:"minute"}):Fs.m(e,t)},s:function(e,t,s){return t==="so"?s.ordinalNumber(e.getSeconds(),{unit:"second"}):Fs.s(e,t)},S:function(e,t){return Fs.S(e,t)},X:function(e,t,s){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return Nd(r);case"XXXX":case"XX":return on(r);case"XXXXX":case"XXX":default:return on(r,":")}},x:function(e,t,s){const r=e.getTimezoneOffset();switch(t){case"x":return Nd(r);case"xxxx":case"xx":return on(r);case"xxxxx":case"xxx":default:return on(r,":")}},O:function(e,t,s){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+jd(r,":");case"OOOO":default:return"GMT"+on(r,":")}},z:function(e,t,s){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+jd(r,":");case"zzzz":default:return"GMT"+on(r,":")}},t:function(e,t,s){const r=Math.trunc(e.getTime()/1e3);return Me(r,t.length)},T:function(e,t,s){const r=e.getTime();return Me(r,t.length)}};
6function jd(e,t=""){const s=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),a=r%60;return a===0?s+String(o):s+String(o)+t+Me(a,2)}function Nd(e,t){return e%60===0?(e>0?"-":"+")+Me(Math.abs(e)/60,2):on(e,t)}function on(e,t=""){const s=e>0?"-":"+",r=Math.abs(e),o=Me(Math.trunc(r/60),2),a=Me(r%60,2);return s+o+t+a}const kd=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Cm=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},uv=(e,t)=>{const s=e.match(/(P+)(p+)?/)||[],r=s[1],o=s[2];if(!o)return kd(e,t);let a;switch(r){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",kd(r,t)).replace("{{time}}",Cm(o,t))},fv={p:Cm,P:uv},mv=/^D+$/,hv=/^Y+$/,pv=["D","DD","YY","YYYY"];function gv(e){return mv.test(e)}function xv(e){return hv.test(e)}function bv(e,t,s){const r=wv(e,t,s);if(console.warn(r),pv.includes(e))throw new RangeError(r)}function wv(e,t,s){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const yv=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,vv=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,jv=/^'([^]*?)'?$/,Nv=/''/g,kv=/[a-zA-Z]/;function os(e,t,s){var h,u,p,m,b,x,g,y;const r=Ur(),o=(s==null?void 0:s.locale)??r.locale??jm,a=(s==null?void 0:s.firstWeekContainsDate)??((u=(h=s==null?void 0:s.locale)==null?void 0:h.options)==null?void 0:u.firstWeekContainsDate)??r.firstWeekContainsDate??((m=(p=r.locale)==null?void 0:p.options)==null?void 0:m.firstWeekContainsDate)??1,i=(s==null?void 0:s.weekStartsOn)??((x=(b=s==null?void 0:s.locale)==null?void 0:b.options)==null?void 0:x.weekStartsOn)??r.weekStartsOn??((y=(g=r.locale)==null?void 0:g.options)==null?void 0:y.weekStartsOn)??0,l=Te(e);if(!Ey(l))throw new RangeError("Invalid time value");let c=t.match(vv).map(N=>{const w=N[0];if(w==="p"||w==="P"){const k=fv[w];return k(N,o.formatLong)}return N}).join("").match(yv).map(N=>{if(N==="''")return{isToken:!1,value:"'"};const w=N[0];if(w==="'")return{isToken:!1,value:Sv(N)};if(vd[w])return{isToken:!0,value:N};if(w.match(kv))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return{isToken:!1,value:N}});o.localize.preprocessor&&(c=o.localize.preprocessor(l,c));const d={firstWeekContainsDate:a,weekStartsOn:i,locale:o};return c.map(N=>{if(!N.isToken)return N.value;const w=N.value;(!(s!=null&&s.useAdditionalWeekYearTokens)&&xv(w)||!(s!=null&&s.useAdditionalDayOfYearTokens)&&gv(w))&&bv(w,t,String(e));const k=vd[w[0]];return k(l,w,o.localize,d)}).join("")}function Sv(e){const t=e.match(jv);return t?t[1].replace(Nv,"'"):e}function Cv(e){const t=Te(e),s=t.getFullYear(),r=t.getMonth(),o=Wt(e,0);return o.setFullYear(s,r+1,0),o.setHours(0,0,0,0),o.getDate()}function _v(e){return Math.trunc(+Te(e)/1e3)}function Tv(e){const t=Te(e),s=t.getMonth();return t.setFullYear(t.getFullYear(),s+1,0),t.setHours(0,0,0,0),t}function Ev(e,t){return zy(Tv(e),Mt(e),t)+1}function Ki(e,t){const s=Te(e),r=Te(t);return s.getTime()>r.getTime()}function _m(e,t){const s=Te(e),r=Te(t);return+s<+r}function Gl(e,t){const s=Te(e),r=Te(t);return s.getFullYear()===r.getFullYear()&&s.getMonth()===r.getMonth()}function zv(e,t){const s=Te(e),r=Te(t);return s.getFullYear()===r.getFullYear()}function Ja(e,t){return Nt(e,-t)}function Za(e,t){const s=Te(e),r=s.getFullYear(),o=s.getDate(),a=Wt(e,0);a.setFullYear(r,t,15),a.setHours(0,0,0,0);const i=Cv(a);return s.setMonth(t,Math.min(o,i)),s}function Sd(e,t){const s=Te(e);return isNaN(+s)?Wt(e,NaN):(s.setFullYear(t),s)}var ye=function(){return ye=Object.assign||function(t){for(var s,r=1,o=arguments.length;r<o;r++){s=arguments[r];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(t[a]=s[a])}return t},ye.apply(this,arguments)};function Av(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(s[r[o]]=e[r[o]]);return s}
6function Tm(e,t,s){for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function Hr(e){return e.mode==="multiple"}function Gr(e){return e.mode==="range"}function Ea(e){return e.mode==="single"}var Mv={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function Lv(e,t){return os(e,"LLLL y",t)}function Iv(e,t){return os(e,"d",t)}function Ov(e,t){return os(e,"LLLL",t)}function Dv(e){return"".concat(e)}function Pv(e,t){return os(e,"cccccc",t)}function Rv(e,t){return os(e,"yyyy",t)}var $v=Object.freeze({__proto__:null,formatCaption:Lv,formatDay:Iv,formatMonthCaption:Ov,formatWeekNumber:Dv,formatWeekdayName:Pv,formatYearCaption:Rv}),Bv=function(e,t,s){return os(e,"do MMMM (EEEE)",s)},Fv=function(){return"Month: "},Wv=function(){return"Go to next month"},Uv=function(){return"Go to previous month"},Hv=function(e,t){return os(e,"cccc",t)},Gv=function(e){return"Week n. ".concat(e)},Yv=function(){return"Year: "},Vv=Object.freeze({__proto__:null,labelDay:Bv,labelMonthDropdown:Fv,labelNext:Wv,labelPrevious:Uv,labelWeekNumber:Gv,labelWeekday:Hv,labelYearDropdown:Yv});function Kv(){var e="buttons",t=Mv,s=jm,r={},o={},a=1,i={},l=new Date;return{captionLayout:e,classNames:t,formatters:$v,labels:Vv,locale:s,modifiersClassNames:r,modifiers:o,numberOfMonths:a,styles:i,today:l,mode:"default"}}function qv(e){var t=e.fromYear,s=e.toYear,r=e.fromMonth,o=e.toMonth,a=e.fromDate,i=e.toDate;return r?a=Mt(r):t&&(a=new Date(t,0,1)),o?i=Ul(o):s&&(i=new Date(s,11,31)),{fromDate:a?$n(a):void 0,toDate:i?$n(i):void 0}}var Em=f.createContext(void 0);function Xv(e){var t,s=e.initialProps,r=Kv(),o=qv(s),a=o.fromDate,i=o.toDate,l=(t=s.captionLayout)!==null&&t!==void 0?t:r.captionLayout;l!=="buttons"&&(!a||!i)&&(l="buttons");var c;(Ea(s)||Hr(s)||Gr(s))&&(c=s.onSelect);var d=ye(ye(ye({},r),s),{captionLayout:l,classNames:ye(ye({},r.classNames),s.classNames),components:ye({},s.components),formatters:ye(ye({},r.formatters),s.formatters),fromDate:a,labels:ye(ye({},r.labels),s.labels),mode:s.mode||r.mode,modifiers:ye(ye({},r.modifiers),s.modifiers),modifiersClassNames:ye(ye({},r.modifiersClassNames),s.modifiersClassNames),onSelect:c,styles:ye(ye({},r.styles),s.styles),toDate:i});return n.jsx(Em.Provider,{value:d,children:e.children})}function Oe(){var e=f.useContext(Em);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function zm(e){var t=Oe(),s=t.locale,r=t.classNames,o=t.styles,a=t.formatters.formatCaption;return n.jsx("div",{className:r.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:a(e.displayMonth,{locale:s})})}function Jv(e){return n.jsx("svg",ye({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:n.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.7
678175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Am(e){var t,s,r=e.onChange,o=e.value,a=e.children,i=e.caption,l=e.className,c=e.style,d=Oe(),h=(s=(t=d.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&s!==void 0?s:Jv;return n.jsxs("div",{className:l,style:c,children:[n.jsx("span",{className:d.classNames.vhidden,children:e["aria-label"]}),n.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:d.classNames.dropdown,style:d.styles.dropdown,value:o,onChange:r,children:a}),n.jsxs("div",{className:d.classNames.caption_label,style:d.styles.caption_label,"aria-hidden":"true",children:[i,n.jsx(h,{className:d.classNames.dropdown_icon,style:d.styles.dropdown_icon})]})]})}function Zv(e){var t,s=Oe(),r=s.fromDate,o=s.toDate,a=s.styles,i=s.locale,l=s.formatters.formatMonthCaption,c=s.classNames,d=s.components,h=s.labels.labelMonthDropdown;if(!r)return n.jsx(n.Fragment,{});if(!o)return n.jsx(n.Fragment,{});var u=[];if(zv(r,o))for(var p=Mt(r),m=r.getMonth();m<=o.getMonth();m++)u.push(Za(p,m));else for(var p=Mt(new Date),m=0;m<=11;m++)u.push(Za(p,m));var b=function(g){var y=Number(g.target.value),N=Za(Mt(e.displayMonth),y);e.onChange(N)},x=(t=d==null?void 0:d.Dropdown)!==null&&t!==void 0?t:Am;return n.jsx(x,{name:"months","aria-label":h(),className:c.dropdown_month,style:a.dropdown_month,onChange:b,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:i}),children:u.map(function(g){return n.jsx("option",{value:g.getMonth(),children:l(g,{locale:i})},g.getMonth())})})}function Qv(e){var t,s=e.displayMonth,r=Oe(),o=r.fromDate,a=r.toDate,i=r.locale,l=r.styles,c=r.classNames,d=r.components,h=r.formatters.formatYearCaption,u=r.labels.labelYearDropdown,p=[];if(!o)return n.jsx(n.Fragment,{});if(!a)return n.jsx(n.Fragment,{});for(var m=o.getFullYear(),b=a.getFullYear(),x=m;x<=b;x++)p.push(Sd(ym(new Date),x));var g=function(N){var w=Sd(Mt(s),Number(N.target.value));e.onChange(w)},y=(t=d==null?void 0:d.Dropdown)!==null&&t!==void 0?t:Am;return n.jsx(y,{name:"years","aria-label":u(),className:c.dropdown_year,style:l.dropdown_year,onChange:g,value:s.getFullYear(),caption:h(s,{locale:i}),children:p.map(function(N){return n.jsx("option",{value:N.getFullYear(),children:h(N,{locale:i})},N.getFullYear())})})}function e0(e,t){var s=f.useState(e),r=s[0],o=s[1],a=t===void 0?r:t;return[a,o]}function t0(e){var t=e.month,s=e.defaultMonth,r=e.today,o=t||s||r||new Date,a=e.toDate,i=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(a&&_r(a,o)<0){var d=-1*(c-1);o=as(a,d)}return i&&_r(o,i)<0&&(o=i),Mt(o)}function s0(){var e=Oe(),t=t0(e),s=e0(t,e.month),r=s[0],o=s[1],a=function(i){var l;if(!e.disableNavigation){var c=Mt(i);o(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[r,a]}function n0(e,t){for(var s=t.reverseMonths,r=t.numberOfMonths,o=Mt(e),a=Mt(as(o,r)),i=_r(a,o),l=[],c=0;c<i;c++){var d=as(o,c);l.push(d)}return s&&(l=l.reverse()),l}function r0(e,t){if(!t.disableNavigation){var s=t.toDate,r=t.pagedNavigation,o=t.numberOfMonths,a=o===void 0?1:o,i=r?a:1,l=Mt(e);if(!s)return as(l,i);var c=_r(s,e);if(!(c<a))return as(l,i)}}function o0(e,t){if(!t.disableNavigation){var s=t.fromDate,r=t.pagedNavigation,o=t.numberOfMonths,a=o===void 0?1:o,i=r?a:1,l=Mt(e);if(!s)return as(l,-i);var c=_r(l,s);if(!(c<=0))return as(l,-i)}}var Mm=f.createContext(void 0);function a0(e){var t=Oe(),s=s0(),r=s[0],o=s[1],a=n0(r,t),i=r0(r,t),l=o0(r,t),c=function(u){return a.some(function(p){return Gl
6(u,p)})},d=function(u,p){c(u)||(p&&_m(u,p)?o(as(u,1+t.numberOfMonths*-1)):o(u))},h={currentMonth:r,displayMonths:a,goToMonth:o,goToDate:d,previousMonth:l,nextMonth:i,isDateDisplayed:c};return n.jsx(Mm.Provider,{value:h,children:e.children})}function Yr(){var e=f.useContext(Mm);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Cd(e){var t,s=Oe(),r=s.classNames,o=s.styles,a=s.components,i=Yr().goToMonth,l=function(h){i(as(h,e.displayIndex?-e.displayIndex:0))},c=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:zm,d=n.jsx(c,{id:e.id,displayMonth:e.displayMonth});return n.jsxs("div",{className:r.caption_dropdowns,style:o.caption_dropdowns,children:[n.jsx("div",{className:r.vhidden,children:d}),n.jsx(Zv,{onChange:l,displayMonth:e.displayMonth}),n.jsx(Qv,{onChange:l,displayMonth:e.displayMonth})]})}function i0(e){return n.jsx("svg",ye({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:n.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function l0(e){return n.jsx("svg",ye({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:n.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Oo=f.forwardRef(function(e,t){var s=Oe(),r=s.classNames,o=s.styles,a=[r.button_reset,r.button];e.className&&a.push(e.className);var i=a.join(" "),l=ye(ye({},o.button_reset),o.button);return e.style&&Object.assign(l,e.style),n.jsx("button",ye({},e,{ref:t,type:"button",className:i,style:l}))});function c0(e){var t,s,r=Oe(),o=r.dir,a=r.locale,i=r.classNames,l=r.styles,c=r.labels,d=c.labelPrevious,h=c.labelNext,u=r.components;if(!e.nextMonth&&!e.previousMonth)return n.jsx(n.Fragment,{});var p=d(e.previousMonth,{locale:a}),m=[i.nav_button,i.nav_button_previous].join(" "),b=h(e.nextMonth,{locale:a}),x=[i.nav_button,i.nav_button_next].join(" "),g=(t=u==null?void 0:u.IconRight)!==null&&t!==void 0?t:l0,y=(s=u==null?void 0:u.IconLeft)!==null&&s!==void 0?s:i0;return n.jsxs("div",{className:i.nav,style:l.nav,children:[!e.hidePrevious&&n.jsx(Oo,{name:"previous-month","aria-label":p,className:m,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?n.jsx(g,{className:i.nav_icon,style:l.nav_icon}):n.jsx(y,{className:i.nav_icon,style:l.nav_icon})}),!e.hideNext&&n.jsx(Oo,{name:"next-month","aria-label":b,className:x,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?n.jsx(y,{className:i.nav_icon,style:l.nav_icon}):n.jsx(g,{className:i.nav_icon,style:l.nav_icon})})]})}function _d(e){var t=Oe().numberOfMonths,s=Yr(),r=s.previousMonth,o=s.nextMonth,a=s.goToMonth,i=s.displayMonths,l=i.findIndex(function(b){return Gl(e.displayMonth,b)}),c=l===0,d=l===i.length-1,h=t>1&&(c||!d),u=t>1&&(d||!c),p=function(){r&&a(r)},m=function(){o&&a(o)};return n.jsx(c0,{displayMonth:e.displayMonth,hideNext:h,hidePrevious:u,nextMonth:o,previousMonth:r,onPreviousClick:p,onNextClick:m})}function d0(e){var t,s=Oe(),r=s.classNames,o=s.disableNavigation,a=s.styles,i=s.captionLayout,l=s.components,c=(t=l==null?void 0:l.CaptionLabel)!==null&&t!==void 0?t:zm,d;return o?d=n.jsx(c,{id:e.id,displayMonth:e.displayMonth}):i==="dropdown"?d=n.jsx(Cd,{displayMonth:e.displayMonth,id:e.id}):i==="dropdown-buttons"?d=n.jsxs(n.Fragment,{children:[n.jsx(Cd,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),n.jsx(_d,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):d=n.jsxs(n.Fragment,{children:[n.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),n.jsx(_d,{displayMonth:e.displayMonth,id:e.id})]}),n.jsx("div",{className:r.caption,style:a.caption,children:d})}function u0(e){var t=Oe(),s=t.footer,r=t.styles,o=t.classNames.tfoot;return s?n.jsx("tfoot",{className:o,style:r.tfoot,children:n.jsx("tr",{children:n.jsx("td",{colSpan:8,children:s})})}):n.jsx(n.Fragment,{})}function f0(e,t,s){for(var r=s?gn(new Date):Ns(new Date,{locale:e,weekStartsOn:t}),o=[],a=0;a<7;a++){var i=Nt(r,a);o.push(i)}return o}function m0(){var e=Oe(),t=e.classNames,s=e.styles,r=e.showWeekNumber,o=e.locale,a=e.weekStartsOn,i=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,d=f0(o,a,i);return n.jsxs("tr",{style:s.head_row,className:t.head_row,children:[r&&n.jsx("td",{style:s.head_cell,className:t.head_cell}),d.map(function(h,u){return n.jsx("th",{scope:"col",className:t.head_cell,style:s.head_cell,"aria-label":c(h,{locale:o}),children:l(h,{locale:o})},u)})]})}function h0(){var e,t=Oe(),s=t.classNames,r=t.styles,o=t.components,a=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:m0;return n.jsx("thead",{style:r.head,className:s.head,children:n.jsx(a,{})})}function p0(e){var t=Oe(),s=t.locale,r=t.formatters.formatDay;return n.jsx(n.Fragment,{children:r(e.date,{locale:s})})}var Yl=f.createContext(void 0);function g0(e){if(!Hr(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return n.jsx(Yl.Provider,{value:t,children:e.children})}return n.jsx(x0,{initialProps:e.initialProps,children:e.children})}function x0(e){var t=e.initialProps,s=e.children,r=t.selected,o=t.min,a=t.max,i=function(d,h,u){var p,m;(p=t.onDayClick)===null||p===void 0||p.call(t,d,h,u);var b=!!(h.selected&&o&&(r==null?void 0:r.length)===o);if(!b){var x=!!(!h.selected&&a&&(r==null?void 0:r.length)===a);if(!x){var g=r?Tm([],r):[];if(h.selected){var y=g.findIndex(function(N){return zt(d,N)});g.splice(y,1)}else g.push(d);(m=t.onSelect)===null||m===void 0||m.call(t,g,d,h,u)}}},l={disabled:[]};r&&l.disabled.push(function(d){var h=a&&r.length>a-1,u=r.some(function(p){return zt(p,d)});return!!(h&&!u)});var c={selected:r,onDayClick:i,modifiers:l};return n.jsx(Yl.Provider,{value:c,children:s})}function Vl(){var e=f.useContext(Yl);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function b0(e,t){var s=t||{},r=s.from,o=s.to;return r&&o?zt(o,e)&&zt(r,e)?void 0:zt(o,e)?{from:o,to:void 0}:zt(r,e)?void 0:Ki(r,e)?{from:e,to:o}:{from:r,to:e}:o?Ki(e,o)?{from:o,to:e}:{from:e,to:o}:r?_m(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var Kl=f.createContext(void 0);function w0(e){if(!Gr(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return n.jsx(Kl.Provider,{value:t,children:e.children})}return n.jsx(y0,{initialProps:e.initialProps,children:e.children})}function y0(e){var t=e.initialProps,s=e.children,r=t.selected,o=r||{},a=o.from,i=o.to,l=t.min,c=t.max,d=function(m,b,x){var g,y;(g=t.onDayClick)===null||g===void 0||g.call(t,m,b,x);var N=b0(m,r);(y=t.onSelect)===null||y===void 0||y.call(t,N,m,b,x)},h={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(h.range_start=[a],i?(h.range_end=[i],zt(a,i)||(h.range_middle=[{after:a,before:i}])):h.range_end=[a]):i&&(h.range_start=[i],h.range_end=[i]),l&&(a&&!i&&h.disabled.push({after:Ja(a,l-1),before:Nt(a,l-1)}),a&&i&&h.disabled.push({after:a,before:Nt(a,l-1)}),!a&&i&&h.disabled.push({after:Ja(i,l-1),before:Nt(i,l-1)})),c){if(a&&!i&&(h.disabled.push({before:Nt(a,-c+1)}),h.disabled.push({after:Nt(a,c-1)})),a&&i){var u=ys(i,a)+1,p=c-u;h.disabled.push({before:Ja(a,p)}),h.disabled.push({after:Nt(i,p)})}!a&&i&&(h.disabled.push({before:Nt(i,-c+1)}),h.disabled.push({after:Nt(i,c-1)}))}return n.jsx(Kl.Provider,{value:{selected:r,onDayClick:d,modifiers:h},children:s})}function ql(){var e=f.useContext(Kl);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function ko(e){return Array.isArray(e)?Tm([],e):e!==void 0?[e]:[]}function v0(e){var t={};return Object.entries(e).forEach(function(s){var r=s[0],o=s[1];t[r]=ko(o)}),t}var is;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(is||(is={}));var j0=is.Selected,Cs=is.Disabled,N0=is.Hidden,k0=is.Today,Qa=is.RangeEnd,ei=is.RangeMiddle,ti=is.RangeStart,S0=is.Outside;function C0(e,t,s){var r,o=(r={},r[j0]=ko(e.selected),r[Cs]=ko(e.disabled),r[N0]=ko(e.hidden),r[k0]=[e.today],r[Qa]=[],r[ei]=[],r[ti]=[],r[S0]=[],r);return e.fromDate&&o[Cs].push({before:e.fromDate}),e.toDate&&o[Cs].push({after:e.toDate}
6),Hr(e)?o[Cs]=o[Cs].concat(t.modifiers[Cs]):Gr(e)&&(o[Cs]=o[Cs].concat(s.modifiers[Cs]),o[ti]=s.modifiers[ti],o[ei]=s.modifiers[ei],o[Qa]=s.modifiers[Qa]),o}var Lm=f.createContext(void 0);function _0(e){var t=Oe(),s=Vl(),r=ql(),o=C0(t,s,r),a=v0(t.modifiers),i=ye(ye({},o),a);return n.jsx(Lm.Provider,{value:i,children:e.children})}function Im(){var e=f.useContext(Lm);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function T0(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function E0(e){return!!(e&&typeof e=="object"&&"from"in e)}function z0(e){return!!(e&&typeof e=="object"&&"after"in e)}function A0(e){return!!(e&&typeof e=="object"&&"before"in e)}function M0(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function L0(e,t){var s,r=t.from,o=t.to;if(r&&o){var a=ys(o,r)<0;a&&(s=[o,r],r=s[0],o=s[1]);var i=ys(e,r)>=0&&ys(o,e)>=0;return i}return o?zt(o,e):r?zt(r,e):!1}function I0(e){return Wl(e)}function O0(e){return Array.isArray(e)&&e.every(Wl)}function D0(e,t){return t.some(function(s){if(typeof s=="boolean")return s;if(I0(s))return zt(e,s);if(O0(s))return s.includes(e);if(E0(s))return L0(e,s);if(M0(s))return s.dayOfWeek.includes(e.getDay());if(T0(s)){var r=ys(s.before,e),o=ys(s.after,e),a=r>0,i=o<0,l=Ki(s.before,s.after);return l?i&&a:a||i}return z0(s)?ys(e,s.after)>0:A0(s)?ys(s.before,e)>0:typeof s=="function"?s(e):!1})}function Xl(e,t,s){var r=Object.keys(t).reduce(function(a,i){var l=t[i];return D0(e,l)&&a.push(i),a},[]),o={};return r.forEach(function(a){return o[a]=!0}),s&&!Gl(e,s)&&(o.outside=!0),o}function P0(e,t){for(var s=Mt(e[0]),r=Ul(e[e.length-1]),o,a,i=s;i<=r;){var l=Xl(i,t),c=!l.disabled&&!l.hidden;if(!c){i=Nt(i,1);continue}if(l.selected)return i;l.today&&!a&&(a=i),o||(o=i),i=Nt(i,1)}return a||o}var R0=365;function Om(e,t){var s=t.moveBy,r=t.direction,o=t.context,a=t.modifiers,i=t.retry,l=i===void 0?{count:0,lastFocused:e}:i,c=o.weekStartsOn,d=o.fromDate,h=o.toDate,u=o.locale,p={day:Nt,week:Vi,month:as,year:Cy,startOfWeek:function(g){return o.ISOWeek?gn(g):Ns(g,{locale:u,weekStartsOn:c})},endOfWeek:function(g){return o.ISOWeek?vm(g):Hl(g,{locale:u,weekStartsOn:c})}},m=p[s](e,r==="after"?1:-1);r==="before"&&d?m=_y([d,m]):r==="after"&&h&&(m=Ty([h,m]));var b=!0;if(a){var x=Xl(m,a);b=!x.disabled&&!x.hidden}return b?m:l.count>R0?l.lastFocused:Om(m,{moveBy:s,direction:r,context:o,modifiers:a,retry:ye(ye({},l),{count:l.count+1})})}var Dm=f.createContext(void 0);function $0(e){var t=Yr(),s=Im(),r=f.useState(),o=r[0],a=r[1],i=f.useState(),l=i[0],c=i[1],d=P0(t.displayMonths,s),h=o??(l&&t.isDateDisplayed(l))?l:d,u=function(){c(o),a(void 0)},p=function(g){a(g)},m=Oe(),b=function(g,y){if(o){var N=Om(o,{moveBy:g,direction:y,context:m,modifiers:s});zt(o,N)||(t.goToDate(N,o),p(N))}},x={focusedDay:o,focusTarget:h,blur:u,focus:p,focusDayAfter:function(){return b("day","after")},focusDayBefore:function(){return b("day","before")},focusWeekAfter:function(){return b("week","after")},focusWeekBefore:function(){return b("week","before")},focusMonthBefore:function(){return b("month","before")},focusMonthAfter:function(){return b("month","after")},focusYearBefore:function(){return b("year","before")},focusYearAfter:function(){return b("year","after")},focusStartOfWeek:function(){return b("startOfWeek","before")},focusEndOfWeek:function(){return b("endOfWeek","after")}};return n.jsx(Dm.Provider,{value:x,children:e.children})}function Jl(){var e=f.useContext(Dm);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function B0(e,t){var s=Im(),r=Xl(e,s,t);return r}var Zl=f.createContext(void 0);function F0(e){if(!Ea(e.initialProps)){var t={selected:void 0};return n.jsx(Zl.Provider,{value:t,children:e.children})}return n.jsx(W0,{initialProps:e.initialProps,children:e.children})}function W0(e){var t=e.initialProps,s=e.children,r=function(a,i,l){var c,d,h;if((c=t.onDayClick)===null||c===void 0||c.call(t,a,i,l),i.selected&&!t.required){(d=t.onSelect)===null||d===void 0||d.call(t,void 0,a,i,l);return}(h=t.onSelect)===null||h===void 0||h.call(t,a,a,i,l)}
6,o={selected:t.selected,onDayClick:r};return n.jsx(Zl.Provider,{value:o,children:s})}function Pm(){var e=f.useContext(Zl);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function U0(e,t){var s=Oe(),r=Pm(),o=Vl(),a=ql(),i=Jl(),l=i.focusDayAfter,c=i.focusDayBefore,d=i.focusWeekAfter,h=i.focusWeekBefore,u=i.blur,p=i.focus,m=i.focusMonthBefore,b=i.focusMonthAfter,x=i.focusYearBefore,g=i.focusYearAfter,y=i.focusStartOfWeek,N=i.focusEndOfWeek,w=function(C){var I,F,ae,Z;Ea(s)?(I=r.onDayClick)===null||I===void 0||I.call(r,e,t,C):Hr(s)?(F=o.onDayClick)===null||F===void 0||F.call(o,e,t,C):Gr(s)?(ae=a.onDayClick)===null||ae===void 0||ae.call(a,e,t,C):(Z=s.onDayClick)===null||Z===void 0||Z.call(s,e,t,C)},k=function(C){var I;p(e),(I=s.onDayFocus)===null||I===void 0||I.call(s,e,t,C)},E=function(C){var I;u(),(I=s.onDayBlur)===null||I===void 0||I.call(s,e,t,C)},v=function(C){var I;(I=s.onDayMouseEnter)===null||I===void 0||I.call(s,e,t,C)},S=function(C){var I;(I=s.onDayMouseLeave)===null||I===void 0||I.call(s,e,t,C)},z=function(C){var I;(I=s.onDayPointerEnter)===null||I===void 0||I.call(s,e,t,C)},B=function(C){var I;(I=s.onDayPointerLeave)===null||I===void 0||I.call(s,e,t,C)},M=function(C){var I;(I=s.onDayTouchCancel)===null||I===void 0||I.call(s,e,t,C)},D=function(C){var I;(I=s.onDayTouchEnd)===null||I===void 0||I.call(s,e,t,C)},A=function(C){var I;(I=s.onDayTouchMove)===null||I===void 0||I.call(s,e,t,C)},U=function(C){var I;(I=s.onDayTouchStart)===null||I===void 0||I.call(s,e,t,C)},se=function(C){var I;(I=s.onDayKeyUp)===null||I===void 0||I.call(s,e,t,C)},P=function(C){var I;switch(C.key){case"ArrowLeft":C.preventDefault(),C.stopPropagation(),s.dir==="rtl"?l():c();break;case"ArrowRight":C.preventDefault(),C.stopPropagation(),s.dir==="rtl"?c():l();break;case"ArrowDown":C.preventDefault(),C.stopPropagation(),d();break;case"ArrowUp":C.preventDefault(),C.stopPropagation(),h();break;case"PageUp":C.preventDefault(),C.stopPropagation(),C.shiftKey?x():m();break;case"PageDown":C.preventDefault(),C.stopPropagation(),C.shiftKey?g():b();break;case"Home":C.preventDefault(),C.stopPropagation(),y();break;case"End":C.preventDefault(),C.stopPropagation(),N();break}(I=s.onDayKeyDown)===null||I===void 0||I.call(s,e,t,C)},ne={onClick:w,onFocus:k,onBlur:E,onKeyDown:P,onKeyUp:se,onMouseEnter:v,onMouseLeave:S,onPointerEnter:z,onPointerLeave:B,onTouchCancel:M,onTouchEnd:D,onTouchMove:A,onTouchStart:U};return ne}function H0(){var e=Oe(),t=Pm(),s=Vl(),r=ql(),o=Ea(e)?t.selected:Hr(e)?s.selected:Gr(e)?r.selected:void 0;return o}function G0(e){return Object.values(is).includes(e)}function Y0(e,t){var s=[e.classNames.day];return Object.keys(t).forEach(function(r){var o=e.modifiersClassNames[r];if(o)s.push(o);else if(G0(r)){var a=e.classNames["day_".concat(r)];a&&s.push(a)}}),s}function V0(e,t){var s=ye({},e.styles.day);return Object.keys(t).forEach(function(r){var o;s=ye(ye({},s),(o=e.modifiersStyles)===null||o===void 0?void 0:o[r])}),s}function K0(e,t,s){var r,o,a,i=Oe(),l=Jl(),c=B0(e,t),d=U0(e,c),h=H0(),u=!!(i.onDayClick||i.mode!=="default");f.useEffect(function(){var v;c.outside||l.focusedDay&&u&&zt(l.focusedDay,e)&&((v=s.current)===null||v===void 0||v.focus())},[l.focusedDay,e,s,u,c.outside]);var p=Y0(i,c).join(" "),m=V0(i,c),b=!!(c.outside&&!i.showOutsideDays||c.hidden),x=(a=(o=i.components)===null||o===void 0?void 0:o.DayContent)!==null&&a!==void 0?a:p0,g=n.jsx(x,{date:e,displayMonth:t,activeModifiers:c}),y={style:m,className:p,children:g,role:"gridcell"},N=l.focusTarget&&zt(l.focusTarget,e)&&!c.outside,w=l.focusedDay&&zt(l.focusedDay,e),k=ye(ye(ye({},y),(r={disabled:c.disabled,role:"gridcell"},r["aria-selected"]=c.selected,r.tabIndex=w||N?0:-1,r)),d),E={isButton:u,isHidden:b,activeModifiers:c,selectedDays:h,buttonProps:k,divProps:y};return E}function q0(e){var t=f.useRef(null),s=K0(e.date,e.displayMonth,t);return s.isHidden?n.jsx("div",{role:"gridcell"}):s.isButton?n.jsx(Oo,ye({name:"day",ref:t},s.buttonProps)):n.jsx("div",ye({},s.divProps))}function X0(e){var t=e.number,s=e.dates,r=Oe(),o=r.onWeekNumberClick,a=r.styles,i=r.classNames,l=r.locale,c=r.labels.labelWeekNumber,d=r.formatters.formatWeekNumber,h=d(Number(t),{locale:l});if(!o)return n.jsx("span",{className:i.weeknumber,style:a.weeknumber,children:h});var u=c(Number(t),{locale:l}),p=function(m){o(t,s,m)};return n.jsx(Oo,{name:"week-number","aria-label":u,className:i.weeknumber,style:a.weeknumber,onClick:p,children:h})}function J0(e){var t,s,r=Oe(),o=r.styles,a=r.classNames,i=r.showWeekNumber,l=r.components,c=(t=l==null?void 0:l.Day)!==null&&t!==void 0?t:q0,d=(s=l==null?void 0:l.WeekNumber)!==null&&s!==void 0?s:X0,h;return i&&(h=n.jsx("td",{className:a.cell,style:o.cell,children:n.jsx(d,{number:e.weekNumber,dates:e.dates})})),n.jsxs("tr",{className:a.row,style:o.row,children:[h,e.dates.map(function(u){return n.jsx("td",{className:a.cell,style:o.cell,role:"presentation",children:n.jsx(c,{displayMonth:e.displayMonth,date:u})},_v(u))})]})}function Td(e,t,s){for(var r=s!=null&&s.ISOWeek?vm(t):Hl(t,s),o=s!=null&&s.ISOWeek?gn(e):Ns(e,s),a=ys(r,o),i=[],l=0;l<=a;l++)i.push(Nt(o,l));var c=i.reduce(function(d,h){var u=s!=null&&s.ISOWeek?Nm(h):Sm(h,s),p=d.find(function(m){return m.weekNumber===u});return p?(p.dates.push(h),d):(d.push({weekNumber:u,dates:[h]}),d)},[]);return c}function Z0(e,t){var s=Td(Mt(e),Ul(e),t);if(t!=null&&t.useFixedWeeks){var r=Ev(e,t);if(r<6){var o=s[s.length-1],a=o.dates[o.dates.length-1],i=Vi(a,6-r),l=Td(Vi(a,1
6),i,t);s.push.apply(s,l)}}return s}function Q0(e){var t,s,r,o=Oe(),a=o.locale,i=o.classNames,l=o.styles,c=o.hideHead,d=o.fixedWeeks,h=o.components,u=o.weekStartsOn,p=o.firstWeekContainsDate,m=o.ISOWeek,b=Z0(e.displayMonth,{useFixedWeeks:!!d,ISOWeek:m,locale:a,weekStartsOn:u,firstWeekContainsDate:p}),x=(t=h==null?void 0:h.Head)!==null&&t!==void 0?t:h0,g=(s=h==null?void 0:h.Row)!==null&&s!==void 0?s:J0,y=(r=h==null?void 0:h.Footer)!==null&&r!==void 0?r:u0;return n.jsxs("table",{id:e.id,className:i.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&n.jsx(x,{}),n.jsx("tbody",{className:i.tbody,style:l.tbody,children:b.map(function(N){return n.jsx(g,{displayMonth:e.displayMonth,dates:N.dates,weekNumber:N.weekNumber},N.weekNumber)})}),n.jsx(y,{displayMonth:e.displayMonth})]})}function ej(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var tj=ej()?f.useLayoutEffect:f.useEffect,si=!1,sj=0;function Ed(){return"react-day-picker-".concat(++sj)}function nj(e){var t,s=e??(si?Ed():null),r=f.useState(s),o=r[0],a=r[1];return tj(function(){o===null&&a(Ed())},[]),f.useEffect(function(){si===!1&&(si=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function rj(e){var t,s,r=Oe(),o=r.dir,a=r.classNames,i=r.styles,l=r.components,c=Yr().displayMonths,d=nj(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),h=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,u=[a.month],p=i.month,m=e.displayIndex===0,b=e.displayIndex===c.length-1,x=!m&&!b;o==="rtl"&&(t=[m,b],b=t[0],m=t[1]),m&&(u.push(a.caption_start),p=ye(ye({},p),i.caption_start)),b&&(u.push(a.caption_end),p=ye(ye({},p),i.caption_end)),x&&(u.push(a.caption_between),p=ye(ye({},p),i.caption_between));var g=(s=l==null?void 0:l.Caption)!==null&&s!==void 0?s:d0;return n.jsxs("div",{className:u.join(" "),style:p,children:[n.jsx(g,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),n.jsx(Q0,{id:h,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function oj(e){var t=Oe(),s=t.classNames,r=t.styles;return n.jsx("div",{className:s.months,style:r.months,children:e.children})}function aj(e){var t,s,r=e.initialProps,o=Oe(),a=Jl(),i=Yr(),l=f.useState(!1),c=l[0],d=l[1];f.useEffect(function(){o.initialFocus&&a.focusTarget&&(c||(a.focus(a.focusTarget),d(!0)))},[o.initialFocus,c,a.focus,a.focusTarget,a]);var h=[o.classNames.root,o.className];o.numberOfMonths>1&&h.push(o.classNames.multiple_months),o.showWeekNumber&&h.push(o.classNames.with_weeknumber);var u=ye(ye({},o.styles.root),o.style),p=Object.keys(r).filter(function(b){return b.startsWith("data-")}).reduce(function(b,x){var g;return ye(ye({},b),(g={},g[x]=r[x],g))},{}),m=(s=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&s!==void 0?s:oj;return n.jsx("div",ye({className:h.join(" "),style:u,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},p,{children:n.jsx(m,{children:i.displayMonths.map(function(b,x){return n.jsx(rj,{displayIndex:x,displayMonth:b},x)})})}))}function ij(e){var t=e.children,s=Av(e,["children"]);return n.jsx(Xv,{initialProps:s,children:n.jsx(a0,{children:n.jsx(F0,{initialProps:s,children:n.jsx(g0,{initialProps:s,children:n.jsx(w0,{initialProps:s,children:n.jsx(_0,{children:n.jsx($0,{children:t})})})})})})})}function lj(e){return n.jsx(ij,ye({},e,{children:n.jsx(aj,{initialProps:e})}))}const zd=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ad=Xf,Rm=(e,t)=>s=>{var r;if((t==null?void 0:t.variants)==null)return Ad(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:o,defaultVariants:a}=t,i=Object.keys(o).map(d=>{const h=s==null?void 0:s[d],u=a==null?void 0:a[d];if(h===null)return null;const p=zd(h)||zd(u);return o[d][p]}),l=s&&Object.entries(s).reduce((d,h)=>{let[u,p]=h;return p===void 0||(d[u]=p),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,h)=>{let{class:u,className:p,...m}=h;return Object.entries(m).every(b=>{let[x,g]=b;return Array.isArray(g)?g.includes({...a,...l}[x]):{...a,...l}[x]===g})?[...d,u,p]:d},[]);return Ad(e,i,c,s==null?void 0:s.class,s==null?void 0:s.className)},Tr=Rm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),cj=f.forwardRef(({className:e,variant:t,size:s,asChild:r=!1,...o},a)=>{const i=r?qp:"button";return n.jsx(i,{className:Ue(Tr({variant:t,size:s,className:e})),ref:a,...o})});cj.displayName="Button";function $m({className:e,classNames:t,showOutsideDays:s=!0,...r}){return n.jsx(lj,{showOutsideDays:s,className:Ue("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
6ace-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:Ue(Tr({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:Ue(Tr({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({...o})=>n.jsx(xl,{className:"h-4 w-4"}),IconRight:({...o})=>n.jsx(As,{className:"h-4 w-4"})},...r})}$m.displayName="Calendar";const dj=Jp,uj=Zp,Bm=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...r},o)=>n.jsx(Xp,{children:n.jsx($u,{ref:o,align:t,sideOffset:s,className:Ue("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Bm.displayName=$u.displayName;function qi(e){var o;const t=new URLSearchParams,s=(o=e.q)==null?void 0:o.trim();s&&t.set("q",s),e.from&&t.set("from",e.from),e.to&&t.set("to",e.to);const r=t.toString();return r?`/szukaj?${r}`:"/szukaj"}function fj(e){const t=new URLSearchParams(e);return{q:t.get("q")??void 0,from:t.get("from")??void 0,to:t.get("to")??void 0}}function Md(e){const t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${s}-${r}`}function uo(e){if(!e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return;const[t,s,r]=e.split("-").map(Number),o=new Date(t,s-1,r);return Number.isNaN(o.getTime())?void 0:o}function Fm({initialQ:e="",initialFrom:t,initialTo:s,onSubmit:r,compact:o=!1,autoFocus:a=!1,className:i}){const[l,c]=f.useState(e),[d,h]=f.useState(()=>uo(t)),[u,p]=f.useState(()=>uo(s)),[m,b]=f.useState(!1),x=f.useRef(null);f.useEffect(()=>{c(e),h(uo(t)),p(uo(s))},[e,t,s]),f.useEffect(()=>{if(!a)return;const k=x.current;k&&(k.focus({preventScroll:!0}),requestAnimationFrame(()=>{k.scrollIntoView({block:"nearest",inline:"nearest"})}))},[a]);const g=!!(d||u),y=d&&u?`${os(d,"dd.MM.yyyy")} â ${os(u,"dd.MM.yyyy")}`:d?`od ${os(d,"dd.MM.yyyy")}`:u?`do ${os(u,"dd.MM.yyyy")}`:"Zakres dat",N=()=>{h(void 0),p(void 0)},w=k=>{k==null||k.preventDefault(),r({q:l.trim(),from:d?Md(d):void 0,to:u?Md(u):void 0})};return o?n.jsx("form",{onSubmit:w,className:Ue("flex items-center",i),children:n.jsxs("div",{className:"flex items-center bg-news-surface-2 border border-border rounded-lg overflow-hidden focus-within:border-news-red transition-colors",children:[n.jsx(Ms,{size:16,className:"ml-3 text-news-muted flex-shrink-0"}),n.jsx("input",{ref:x,type:"search",placeholder:"Szukaj artykuÅów...",value:l,onChange:k=>c(k.target.value),className:"w-28 md:w-36 xl:w-52 bg-transparent text-sm text-foreground placeholder:text-news-dim focus:outline-none px-2 py-2"}),n.jsx("button",{type:"submit",className:"px-3 py-2 text-xs font-semibold text-news-red hover:bg-news-surface-3 transition-colors",children:"Szukaj"})]})}):n.jsxs("form",{onSubmit:w,className:Ue("space-y-3",i),children:[n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Ms,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-news-muted"}),n.jsx("input",{ref:x,type:"search",placeholder:"Szukaj po tytule, treÅci, kategorii, autorze, tagachâ¦",value:l,onCh
6ange:k=>c(k.target.value),className:"w-full pl-10 pr-4 py-3 bg-news-surface-2 border border-border rounded-lg text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red transition-colors"})]}),n.jsx("button",{type:"submit",className:"px-6 py-3 rounded-lg bg-news-red text-white text-sm font-semibold hover:bg-news-red/90 transition-colors",children:"Szukaj"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs(dj,{open:m,onOpenChange:b,children:[n.jsx(uj,{asChild:!0,children:n.jsxs("button",{type:"button",className:Ue("inline-flex items-center gap-2 px-3 py-2 rounded-lg border text-sm transition-colors",g?"border-news-red/50 bg-news-red/5 text-foreground":"border-border bg-news-surface-2 text-news-muted hover:text-foreground"),children:[n.jsx(cg,{size:15}),y]})}),n.jsxs(Bm,{className:"w-auto p-0 z-[100]",align:"start",children:[n.jsx($m,{mode:"range",selected:{from:d,to:u},onSelect:k=>{h(k==null?void 0:k.from),p(k==null?void 0:k.to)},numberOfMonths:1,disabled:k=>k>new Date,initialFocus:!0}),n.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border p-3",children:[n.jsx("button",{type:"button",onClick:N,className:"text-xs text-news-muted hover:text-foreground transition-colors",children:"WyczyÅÄ daty"}),n.jsx("button",{type:"button",onClick:()=>b(!1),className:"text-xs font-semibold text-news-red hover:underline",children:"Gotowe"})]})]})]}),g&&n.jsxs("button",{type:"button",onClick:N,className:"inline-flex items-center gap-1 px-2 py-1.5 text-xs text-news-muted hover:text-foreground transition-colors",children:[n.jsx(He,{size:14}),"UsuÅ filtr dat"]})]}),n.jsx("p",{className:"text-xs text-news-dim",children:"Wpisz min. 2 znaki lub wybierz zakres dat. Możesz ÅÄ
czyÄ oba filtry."})]})}function mj(e){var t;return["articles-search",{q:((t=e.q)==null?void 0:t.trim())||null,from:e.from||null,to:e.to||null,limit:e.limit??24}]}function Wm(e){var s;return(((s=e.q)==null?void 0:s.trim())??"").length>=2||!!e.from||!!e.to}function hj(e){var l,c;const t=Wm(e),s=e.limit??24,r=Nl({queryKey:mj(e),queryFn:({pageParam:d})=>{var h;return $.searchArticles({q:((h=e.q)==null?void 0:h.trim())||void 0,from:e.from||void 0,to:e.to||void 0,limit:s,offset:d})},initialPageParam:0,getNextPageParam:d=>d.hasMore?d.offset+d.articles.length:void 0,enabled:t,staleTime:3e4}),o=f.useMemo(()=>{var d;return((d=r.data)==null?void 0:d.pages.flatMap(h=>h.articles))??[]},[r.data]),a=((c=(l=r.data)==null?void 0:l.pages[0])==null?void 0:c.total)??0,i=f.useCallback(()=>{r.hasNextPage&&!r.isFetchingNextPage&&r.fetchNextPage()},[r.hasNextPage,r.isFetchingNextPage,r.fetchNextPage]);return{articles:o,total:a,hasMore:r.hasNextPage??!1,loading:r.isLoading,loadingMore:r.isFetchingNextPage,error:r.error?r.error instanceof Error?r.error.message:"BÅÄ
d wyszukiwania":null,loadMore:i,active:t}}function pj({article:e,onSelect:t,compact:s=!1}){return s?n.jsxs("button",{type:"button",onClick:t,className:"w-full flex gap-3 py-3 px-1 text-left border-b border-border last:border-0 hover:bg-news-surface-2 rounded-lg transition-colors",children:[n.jsx(Qs,{src:e.image,alt:e.title,variant:"thumb",className:"w-20 h-16 object-cover rounded flex-shrink-0",width:80,height:64}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("span",{className:"text-[10px] font-bold text-news-red uppercase tracking-wide",children:e.category}),n.jsx("h3",{className:"text-sm font-semibold text-foreground line-clamp-2 leading-snug mt-0.5",children:e.title}),n.jsxs("div",{className:"flex items-center gap-2 mt-1 text-[11px] text-news-dim",children:[e.publishedAt&&n.jsx("span",{children:Mo(e.publishedAt)}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[e.readTime," min"]})]})]}),n.jsx(As,{size:16,className:"text-news-dim flex-shrink-0 self-center"})]}):n.jsxs("article",{onClick:t,className:"group cursor-pointer bg-news-surface-2 border border-border rounded-lg overflow-hidden hover:border-news-red transition-all duration-200 hover:shadow-lg hover:shadow-news-red/5",children:[n.jsxs("div",{className:"relative aspect-[16/10] overflow-hidden",children:[n.jsx(Qs,{src:e.image,alt:e.title,variant:"card",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",width:400,height:250}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 via-trans
6parent to-transparent"}),n.jsx("span",{className:"absolute top-3 left-3 text-xs font-bold text-white bg-news-red px-2 py-0.5 rounded-sm uppercase tracking-wide",children:e.category})]}),n.jsxs("div",{className:"p-4",children:[n.jsx("h3",{className:"font-serif font-bold text-foreground group-hover:text-news-red transition-colors mb-2 text-base leading-tight line-clamp-3",children:e.title}),e.excerpt&&n.jsx("p",{className:"text-sm text-news-muted line-clamp-2 mb-3 leading-relaxed",children:e.excerpt}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-xs text-news-dim",children:[e.publishedAt&&n.jsx("span",{children:Mo(e.publishedAt)}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Rr,{size:11}),e.readTime," min"]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(On,{size:11}),e.likes>999?`${(e.likes/1e3).toFixed(1)}k`:e.likes]})]})]})]})}function gj(e){var s;const t=[];return(s=e.q)!=null&&s.trim()&&t.push(`â${e.q.trim()}â`),e.from&&e.to?t.push(`od ${e.from} do ${e.to}`):e.from?t.push(`od ${e.from}`):e.to&&t.push(`do ${e.to}`),t}function Um({filters:e,onSearch:t,onArticleSelect:s,autoFocus:r=!1,compactResults:o=!1,showIntro:a=!0}){const i=Wm(e),{articles:l,total:c,loading:d,loadingMore:h,hasMore:u,loadMore:p,error:m}=hj({q:e.q,from:e.from,to:e.to,limit:24}),b=l.map(g=>({...Wr(g),slug:g.slug})),x=gj(e);return n.jsxs("div",{className:"flex flex-col min-h-0",children:[n.jsxs("div",{className:a?"mb-6":"mb-4",children:[a&&n.jsxs(n.Fragment,{children:[n.jsx("h2",{className:"font-serif text-xl font-bold text-foreground mb-1",children:"Wyszukiwarka artykuÅów"}),n.jsx("p",{className:"text-sm text-news-muted mb-4",children:"Przeszukaj wszystkie opublikowane artykuÅy."})]}),n.jsx(Fm,{initialQ:e.q,initialFrom:e.from,initialTo:e.to,onSubmit:t,autoFocus:r})]}),!i&&n.jsx("div",{className:"py-12 text-center text-news-muted border border-dashed border-border rounded-lg",children:n.jsx("p",{className:"text-sm",children:"Wpisz frazÄ lub wybierz zakres dat."})}),i&&d&&n.jsxs("div",{className:"flex items-center justify-center py-16 text-news-muted gap-2",children:[n.jsx(fe,{size:22,className:"animate-spin"}),"Wyszukiwanieâ¦"]}),i&&m&&n.jsx("div",{className:"py-10 text-center text-red-500 border border-red-500/30 rounded-lg text-sm",children:m}),i&&!d&&!m&&n.jsxs("div",{className:"space-y-4 min-h-0 flex-1 flex flex-col",children:[n.jsxs("p",{className:"text-sm text-news-muted flex-shrink-0",children:[c===0?"Brak wyników":`${c} ${c===1?"wynik":c<5?"wyniki":"wyników"}`,x.length>0&&n.jsxs("span",{className:"text-news-dim",children:[" · ",x.join(" · ")]})]}),b.length===0?n.jsxs("div",{className:"py-12 text-center text-news-muted border border-dashed border-border rounded-lg",children:[n.jsx("p",{className:"mb-1 text-sm",children:"Nie znaleziono artykuÅów."}),n.jsx("p",{className:"text-xs text-news-dim",children:"Spróbuj innej frazy lub szerszego zakresu dat."})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:o?"flex-1 min-h-0 overflow-y-auto -mx-1 px-1":"grid grid-cols-1 sm:grid-cols-2 gap-4",children:b.map(g=>n.jsx(pj,{article:g,compact:o,onSelect:()=>s(g)},g.id))}),u&&n.jsx("div",{className:"flex justify-center pt-2 flex-shrink-0",children:n.jsx("button",{type:"button",onClick:p,disabled:h,className:"inline-flex items-center gap-2 px-5 py-2 rounded-lg bg-news-surface-2 border border-border text-sm font-semibold text-foreground hover:border-news-red hover:text-news-red transition-colors disabled:opacity-50",children:h?n.jsxs(n.Fragment,{children:[n.jsx(fe,{size:16,className:"animate-spin"}),"Åadowanieâ¦"]}):n.jsxs(n.Fragment,{children:["Pokaż wiÄcej",n.jsx(As,{size:16})]})})})]})]})]})}function xj({open:e,onOpenChange:t,onArticleSelect:s}){const[r,o]=f.useState({}),[a,i]=f.useState(!1);return f.useEffect(()=>{if(!e){o({}),i(!1);return}const l=document.body.style.overflow;document.body.style.overflow="hidden";const c=window.setTimeout(()=>i(!0),400);return()=>{window.clearTimeout(c),document.body.style.overflow=l}},[e]),e?Xs.createPortal(n.jsxs("div",{className:"fixed inset-0 z-[200] flex flex-col bg-background",role:"dialog","aria-modal":"true","aria-labelledby":"mobile-search-title",children:[n.jsx("header",{className:"flex-shrink-0 border-b border-border bg-background",style:{paddingTop:"max(0.75rem, env(safe-area-inset-top))"},children:n.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[n.jsx("h2",{id:"mobile-search-title",className:"font-serif text-lg font-bold text-foreground",children:"Szukaj"}),n.jsx("button",{type:"button",onClick:()=>t(!1),"aria-label":"Zamknij wyszukiwanie",className:"p-2 rounded-lg text-news-muted hover:text-foreground hover:bg-news-surface-2 transition-colors",children:n.jsx(He,{size:20})})]})}),n.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto overscroll-contain px-4 py-4",style:{paddingBottom:"max(1rem, env(safe-area-inset-bottom))"},children:n.jsx(Um,{filters:r,onSearch:l=>o(l),onArticleSelect:l=>{s({id:l.id,slug:l.slug,publishedAt:l.publishedAt}),t(!1)},autoFocus:a,compactResults:!0,showIntro:!1})})]}),document.body):null}function bj({feedIndex:e}){return n.jsx(Zs,{placement:"mobile_header",scrollIndex:e})}function wj(e,t,s){const r=[];let o=0;return e.forEach((a,i)=>{r.push({kind:"article",article:a}),s&&(i+1)%3===0&&t.length>0&&(r.push({kind:"short",video:t[o%t.length]}),o++)}),r}function Ld(e){return Wr(e)}function yj({categorySlug:e,articleSlug:t}={}){const s=Ls(),{items:r,categoryNames:o}=Kf(),{categories:a}=wn(!1),i=a.map(Y=>Y.name),l=o.length?o:Fr,c=i.length?i:l,d=f.useRef(null),[h,u]=f.useState(0),[p,m]=f.useState(!1),[b,x]=f.useState(null),[g,y]=f.useState(!1),[N,w]=f.useState(!1),k=e&&jo(e,c),[E,v]=f.useState(k);f.useEffect(()=>{Wf()},[]);const S=Y=>{v(Y),s(Y?Vf(Y):"/")},z=Y=>{x(Y),s(pn({slug:Y.slug??Y.id,publishedAt:Y.publishedAt}))},B=()=>{x(null),s(e?`/${e}`:"/")},M=!!e,D=e?jo(e,c):null,{articles:A,loading:U,hasMore:se,loadMore:P,loadingMore:ne}=Ta(M&&D?{status:"published",category:D,limit:24}:{status:"published",limit:30}),{shorts:C}=bm(),{sectionVisibility:I}
6=us(),F=f.useMemo(()=>A.map(Y=>({...Ld(Y),slug:Y.slug})),[A]),ae=f.useMemo(()=>A.map(Y=>Y.slug).join("\0"),[A]);f.useEffect(()=>{const Y=e?jo(e,c):null;v(Y)},[e,c]),f.useEffect(()=>{if(!t){b&&x(null),y(!1),w(!1);return}const Y=F.find(_=>_.slug===t||_.id===t);if(Y){y(!1),w(!1),(!b||b.id!==Y.id)&&x(Y);return}if((b==null?void 0:b.slug)===t){y(!1),w(!1);return}let O=!1;return y(!0),w(!1),$.getArticleBySlug(t).then(_=>{if(!O){const W=im(t,_);if(W){s(W,{replace:!0});return}x({...Ld(_),slug:_.slug,status:_.status}),w(!1)}}).catch(()=>{O||(x(null),w(!0))}).finally(()=>{O||y(!1)}),()=>{O=!0}},[t,ae,b==null?void 0:b.slug]);const Z=M&&D?F:E?F.filter(Y=>Ui(Y.category,E)):F,Q=C.map(Y=>({id:Y.video_id,title:Y.title})),re=wj(Z,Q,cn(I,"shorts"));if(f.useEffect(()=>{const Y=d.current;if(!Y)return;const O=()=>{const _=Y.scrollTop,W=Y.clientHeight,de=Math.round(_/W);u(de)};return Y.addEventListener("scroll",O,{passive:!0}),()=>Y.removeEventListener("scroll",O)},[U]),f.useEffect(()=>{d.current&&(d.current.scrollTop=0,u(0))},[E]),f.useEffect(()=>{se&&!ne&&re.length>0&&h>=re.length-2&&P()},[h,re.length,se,ne,P]),t&&g)return n.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:n.jsx(fe,{size:24,className:"animate-spin text-news-muted"})});if(t&&N)return n.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[n.jsx("div",{className:"flex-1 flex items-center justify-center px-6 text-center",children:n.jsxs("div",{children:[n.jsx("h1",{className:"font-serif text-3xl font-bold mb-2",children:"404"}),n.jsx("p",{className:"text-news-muted mb-4",children:"Nie znaleziono artykuÅu."}),n.jsx("a",{href:"/",className:"text-news-red font-semibold",children:"Strona gÅówna"})]})}),n.jsx(Rn,{})]});const oe=!!b;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:oe?"hidden":"relative w-full",style:oe?void 0:{height:"100dvh"},"aria-hidden":oe||void 0,children:[n.jsxs("div",{className:"absolute top-0 left-0 right-0 z-30 flex flex-col items-center",style:{paddingTop:"env(safe-area-inset-top)"},children:[n.jsxs("div",{className:"flex items-center gap-2 py-2.5",children:[n.jsx(js,{className:"h-7 w-auto drop-shadow-lg",height:28,priority:!0,variant:"mobile"}),n.jsx("button",{type:"button",onClick:()=>m(!0),"aria-label":"Szukaj artykuÅów",className:"ml-1 p-2 rounded-full bg-black/40 text-white hover:bg-black/60 transition-colors",children:n.jsx(Ms,{size:18})})]}),n.jsxs("div",{className:"flex items-center gap-2 px-4 pb-2 overflow-x-auto w-full",style:{scrollbarWidth:"none"},children:[n.jsx("button",{onClick:()=>S(null),className:`flex-shrink-0 text-xs font-semibold px-3 py-1 rounded-full border transition-all ${E===null?"bg-white text-black border-white":"bg-black/55 text-white/95 border-white/35 backdrop-blur-sm"}`,children:"Wszystkie"}),r.map(Y=>n.jsx("button",{onClick:()=>S(Y.category===E?null:Y.category),className:`flex-shrink-0 text-xs font-semibold px-3 py-1 rounded-full border transition-all ${E===Y.category?"bg-white text-black border-white":"bg-black/55 text-white/95 border-white/35 backdrop-blur-sm"}`,children:Y.label},`${Y.category}-${Y.label}`))]}),n.jsx(bj,{feedIndex:h})]}),U?n.jsx("div",{className:"w-full h-full flex items-center justify-center bg-black",children:n.jsxs("div",{className:"flex flex-col items-center gap-3 text-white/60",children:[n.jsx(fe,{size:28,className:"animate-spin"}),n.jsx("span",{className:"text-sm",children:"Åadowanie artykuÅów..."})]})}):n.jsxs("div",{ref:d,className:"snap-container w-full h-full",children:[re.map((Y,O)=>Y.kind==="article"?n.jsx(cy,{article:Y.article,isActive:O===h,priority:O===0,onReadMore:z},`a-${Y.article.id}`):n.jsx(jy,{videoId:Y.video.id,title:Y.video.title,isActive:O===h,isAdjacent:O===h-1||O===h+1},`s-${Y.video.id}-${O}`)),re.length===0&&n.jsx("div",{className:"snap-item flex items-center justify-center bg-black",children:n.jsx("p",{className:"text-white/60 text-sm",children:"Brak artykuÅów w tej kategorii"})})]}),n.jsx(xj,{open:p,onOpenChange:m,onArticleSelect:Y=>s(pn({slug:Y.slug??Y.id,publishedAt:Y.publishedAt}))})]}),oe&&b&&n.jsx(gm,{article:b,onBack:B,isMobile:!0,onSelectArticle:Y=>z(Y)})]})}function vj(e){const t=Kg({queries:Bi.map(r=>({queryKey:xm({status:"published",category:r,limit:Fi}),queryFn:()=>$.getArticles({status:"published",category:r,limit:Fi,offset:0}),enabled:e,staleTime:Rl,gcTime:$l}))});return{articlesByCategory:f.useMemo(()=>{const r=new Map;return Bi.forEach((o,a)=>{var i,l;r.set(o,((l=(i=t[a])==null?void 0:i.data)==null?void 0:l.articles)??[])}),r},[t]),loading:e&&t.some(r=>r.isLoading)}}function jj(e=6){return va({queryKey:["articles","popular",e],queryFn:async()=>(await $.getPopularArticles(e)).map(s=>Wr(s)),staleTime:Rl,gcTime:$l})}function Nj(){const[e,t]=f.useState([]),[s,r]=f.useState(!0);return f.useEffect(()=>{(async()=>{try{const o=await $.getTrendingTopics();t(o.map(a=>a.label))}catch{t([])}r(!1)})()},[]),{topics:e,loading:s}}const kj="https://www.buzzsprout.com/2443255.js?container_id=buzzsprout-large-player&player=large";function Sj(){const e=f.useRef(null);return f.useEffect(()=>{const t=e.current;if(!t)return;const s=document.createElement("script");return s.type="text/javascript",s.charset="utf-8",s.src=kj,s.async=!0,document.body.appendChild(s),()=>{t.innerHTML="",s.remove()}},[]),n.jsxs("section",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden p-5",children:[n.jsx("h2",{className:"text-center text-foreground font-serif font-bold text-lg mb-6",children:"Podcast Polska Morska"}),n.jsx("div",{id:"buzzsprout-large-player",ref:e,className:"w-full [&_iframe]:w-full [&_iframe]:max-w-none"})]})}const Id=6,Cj=450,_j=25,Tj=392,Er=130,Od=Math.round(Er*16/9),Hm=12,Dd=Er*3+Hm*2;function Ej({videoId:e,title:t,isActive:s,onSelect:r}){return n.jsx("button",{type:"button",onClick:r,"aria-label":t,"aria-current":s?"true":void 0,className:`group cursor-pointer rounded-lg overflow-hidden border transition-colors shrink-0 ${s?"border-news-red ring-2 ring-ne
6ws-red/40":"border-border hover:border-news-red/60"}`,style:{width:Er,height:Od},children:n.jsxs("div",{className:"relative w-full h-full bg-black overflow-hidden",children:[n.jsx("img",{src:`https://i.ytimg.com/vi/${e}/hqdefault.jpg`,alt:"",loading:"lazy",width:Er,height:Od,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500 pointer-events-none"}),n.jsx("div",{className:"absolute inset-0 bg-black/25 group-hover:bg-black/10 transition-colors flex items-center justify-center pointer-events-none",children:n.jsx("div",{className:"w-9 h-9 rounded-full bg-news-red/90 flex items-center justify-center",children:n.jsx(dg,{size:12,className:"text-white fill-white ml-0.5"})})})]})})}function zj(){var k;const{shorts:e,loading:t}=bm(),[s,r]=f.useState(null),[o,a]=f.useState(!1),i=f.useRef(!1),l=f.useRef(null),c=s??((k=e[0])==null?void 0:k.video_id)??null,d=e.findIndex(E=>E.video_id===c),h=d>=0?e[d]:e[0],u=f.useCallback(()=>{r(E=>{var S;const v=e.findIndex(z=>{var B;return z.video_id===(E??((B=e[0])==null?void 0:B.video_id))});return v>0?e[v-1].video_id:E??((S=e[0])==null?void 0:S.video_id)??null})},[e]),p=f.useCallback(()=>{r(E=>{var S;const v=e.findIndex(z=>{var B;return z.video_id===(E??((B=e[0])==null?void 0:B.video_id))});return v>=0&&v<e.length-1?e[v+1].video_id:E??((S=e[0])==null?void 0:S.video_id)??null})},[e]),m=f.useRef(u),b=f.useRef(p);m.current=u,b.current=p,f.useEffect(()=>{if(e.length<=1)return;const E={passive:!1,capture:!0},v=S=>{const z=l.current;if(!z)return;const B=z.getBoundingClientRect();S.clientX>=B.left&&S.clientX<=B.right&&S.clientY>=B.top&&S.clientY<=B.bottom&&(i.current||Math.abs(S.deltaY)<_j||(S.preventDefault(),S.stopPropagation(),S.deltaY>0?b.current():m.current(),i.current=!0,window.setTimeout(()=>{i.current=!1},Cj)))};return window.addEventListener("wheel",v,E),()=>window.removeEventListener("wheel",v,E)},[e.length]);const x=s!==null,g=d>0,y=d>=0&&d<e.length-1,N=o?e:e.slice(0,Id),w=e.length>Id;return t?n.jsxs("section",{className:"bg-news-surface-2 border border-border rounded-lg p-8 flex items-center justify-center gap-2 text-news-muted",children:[n.jsx(fe,{size:18,className:"animate-spin"}),n.jsx("span",{className:"text-sm",children:"Åadowanie shortówâ¦"})]}):e.length===0?n.jsxs("section",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border bg-gradient-to-r from-news-red/10 to-transparent",children:[n.jsx("div",{className:"w-9 h-9 rounded-full bg-news-red flex items-center justify-center",children:n.jsx(Nr,{size:16,className:"text-white"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h2",{className:"font-serif font-bold text-foreground text-lg leading-none",children:"Shortsy PM YouTube"}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"Krótkie reportaże w formacie pionowym"})]})]}),n.jsxs("div",{className:"px-5 py-8 text-center text-sm text-news-muted",children:["Brak shortów do wyÅwietlenia."," ",n.jsx("a",{href:"https://www.youtube.com/@polskamorska1036/shorts",target:"_blank",rel:"noreferrer",className:"text-news-red font-semibold hover:underline",children:"Zobacz na YouTube"})]})]}):n.jsxs("section",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border bg-gradient-to-r from-news-red/10 to-transparent",children:[n.jsx("div",{className:"w-9 h-9 rounded-full bg-news-red flex items-center justify-center",children:n.jsx(Nr,{size:16,className:"text-white"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h2",{className:"font-serif font-bold text-foreground text-lg leading-none",children:"Shortsy PM YouTube"}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"Krótkie reportaże z polskich portów, stoczni i uczelni morskich"})]}),n.jsx("a",{href:"https://www.youtube.com/@polskamorska1036/shorts",target:"_blank",rel:"noreferrer",className:"hidden sm:inline-flex text-xs font-semibold text-news-red hover:underline",children:"Wszystkie shorty â"})]}),n.jsxs("div",{className:"p-4 lg:p-5 flex flex-col xl:flex-row xl:items-start xl:justify-start gap-5 xl:gap-4",children:[n.jsxs("div",{className:"order-2 xl:order-1 shrink-0 mx-auto xl:mx-0 max-w-full",style:{width:Dd,maxWidth:"100%"},children:[n.jsx("div",{className:"grid shrink-0",style:{width:Dd,maxWidth:"100%",gridTemplateColumns:`repeat(3, ${Er}px)`,gap:Hm},children:N.map(E=>n.jsx(Ej,{videoId:E.video_id,title:E.title,isActive:E.video_id===c,onSelect:()=>r(E.video_id)},E.id))}),w&&n.jsx("div",{className:"flex justify-center pt-4",children:n.jsxs("button",{type:"button",onClick:()=>a(E=>!E),className:"inline-flex items-center gap-1.5 px-5 py-2.5 rounded-lg bg-news-surface-3 border border-border text-sm font-semibold text-foreground hover:border-news-red hover:text-news-red transition-colors",children:[o?"Pokaż mniej":"Pokaż wiÄcej",n.jsx(Mi,{size:14,className:`transition-transform ${o?"rotate-180":""}`})]})})]}),n.jsxs("div",{className:"shrink-0 order-1 xl:order-2 mx-auto xl:mx-0 xl:sticky xl:top-24 xl:self-start z-10 max-w-full",children:[n.jsxs("div",{className:"flex items-center gap-2 max-w-full",children:[n.jsx("div",{ref:l,className:"relative bg-black rounded-lg overflow-hidden shadow-lg shrink-0 w-full max-w-[392px] aspect-[9/16] xl:aspect-auto xl:w-[392px] xl:h-[697px]",children:c&&n.jsx("iframe",{src:`https://www.youtube-nocookie.com/embed/${c}?rel=0&autoplay=${x?1:0}&mute=0&controls=1&playsinline=1&modestbranding=1&iv_load_policy=3`,t
6itle:(h==null?void 0:h.title)??"YouTube Short",loading:"lazy",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,className:"absolute inset-0 h-full w-full border-0"},c)}),e.length>1&&n.jsxs("div",{className:"flex flex-col gap-2 shrink-0 self-center",children:[n.jsx("button",{type:"button",onClick:u,disabled:!g,"aria-label":"Poprzedni short",className:"w-10 h-10 rounded-lg bg-black text-white flex items-center justify-center hover:bg-neutral-800 transition-colors disabled:opacity-30 disabled:pointer-events-none",children:n.jsx(ef,{size:20})}),n.jsx("button",{type:"button",onClick:p,disabled:!y,"aria-label":"NastÄpny short",className:"w-10 h-10 rounded-lg bg-black text-white flex items-center justify-center hover:bg-neutral-800 transition-colors disabled:opacity-30 disabled:pointer-events-none",children:n.jsx(Mi,{size:20})})]})]}),n.jsxs("div",{className:"mt-3 h-[3.75rem]",style:{width:Tj,maxWidth:"100%"},children:[h&&n.jsx("p",{className:"text-sm font-semibold text-foreground line-clamp-2 leading-snug",children:h.title}),e.length>1&&d>=0&&n.jsxs("p",{className:"mt-1 text-xs text-news-muted",children:[d+1," / ",e.length]})]})]})]})]})}function Aj(){return n.jsx(Zs,{placement:"hero_banner"})}function Mj(){const{newsTicker:e,sectionVisibility:t,loading:s}=us(),r=s?[]:bb(e);if(!cn(t,"news_ticker")||r.length===0)return null;const o=(a="")=>r.map((i,l)=>{var c;return n.jsxs("span",{children:[l>0&&" â ",(c=i.url)!=null&&c.trim()?n.jsx("a",{href:i.url.trim(),className:"hover:underline",children:i.text.trim()}):i.text.trim()]},`${i.id}${a}`)});return n.jsx("div",{className:"ticker-bar bg-news-red overflow-hidden cursor-default",children:n.jsx("div",{className:"flex items-center",children:n.jsx("div",{className:"overflow-hidden flex-1 py-1.5",children:n.jsxs("div",{className:"ticker-animation whitespace-nowrap text-white text-xs font-medium",children:[o()," â ",o("-dup")]})})})})}function Lj({featured:e,important:t,className:s=""}){return!e&&!t?null:n.jsxs("div",{className:`absolute top-3 right-3 flex flex-col gap-1 items-end z-[1] ${s}`,children:[e&&n.jsx("span",{className:"bg-news-gold text-black text-xs font-bold px-2 py-0.5 rounded-sm shadow-sm",children:"WYRÃÅ»NIONY"}),t&&n.jsx("span",{className:"bg-orange-700 text-white text-xs font-bold px-2 py-0.5 rounded-sm shadow-sm",children:"WAÅ»NE"})]})}const Ij=[{id:"facebook",label:"Facebook",href:"https://www.facebook.com/PolskaMorskaPL"},{id:"instagram",label:"Instagram",href:"https://www.instagram.com/polskamorska/"},{id:"tiktok",label:"TikTok",href:"https://www.tiktok.com/@polskamorska.pl"}];function Oj({className:e}){return n.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:e,"aria-hidden":!0,children:n.jsx("path",{d:"M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-2.88 2.5 2.89 2.89 0 0 1-2.89-2.89 2.89 2.89 0 0 1 2.89-2.89c.28 0 .54.04.79.1V9.01a6.27 6.27 0 0 0-.79-.05 6.34 6.34 0 0 0-6.34 6.34 6.34 6.34 0 0 0 6.34 6.34 6.34 6.34 0 0 0 6.33-6.34V8.69a8.18 8.18 0 0 0 4.77 1.52V6.76a4.85 4.85 0 0 1-1-.07z"})})}const Dj={facebook:ug,instagram:fg,tiktok:Oj};function Pj(){return n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("div",{className:"w-1 h-5 bg-news-red rounded"}),n.jsx("h3",{className:"font-serif font-bold text-foreground",children:"Social media"})]}),n.jsx("div",{className:"space-y-1",children:Ij.map(e=>{const t=Dj[e.id];return n.jsxs("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 py-2.5 px-2 rounded-lg hover:bg-news-surface-3 transition-colors group",children:[n.jsx("span",{className:"w-9 h-9 rounded-lg bg-news-surface-3 border border-border flex items-center justify-center text-news-muted group-hover:text-news-red group-hover:border-news-red/40 transition-colors",children:n.jsx(t,{className:"h-4 w-4"})}),n.jsx("span",{className:"text-sm font-medium text-news-muted group-hover:text-foreground transition-colors",children:e.label})]},e.id)})})]})}function ni(e){return Wr(e)}function Sn({article:e,onSelect:t,featured:s=!1,priority:r=!1}){return n.jsxs("article",{onClick:()=>t(e),className:"group cursor-pointer bg-news-surface-2 border border-border rounded-lg overflow-hidden hover:border-news-red transition-all duration-200 hover:shadow-lg hover:shadow-news-red/5",children:[n.jsxs("div",{className:`relative overflow-hidden ${s?"aspect-[16/9]":"aspect-[4/3]"}`,children:[n.jsx(Qs,{src:e.image,alt:e.title,variant:s?"hero":"card",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",width:s?800:400,height:s?450:300,priority:r}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-trans
6parent to-transparent"}),n.jsx(Lj,{featured:e.featured,important:e.important})]}),n.jsxs("div",{className:s?"p-5 lg:p-6":"p-4",children:[n.jsx("h3",{className:`font-serif font-bold text-foreground group-hover:text-news-red transition-colors mb-2 ${s?"text-xl lg:text-3xl leading-tight lg:leading-snug":"text-base leading-tight"} line-clamp-3`,children:e.title}),s&&n.jsx("p",{className:"text-sm lg:text-base text-news-muted line-clamp-2 mb-3 leading-relaxed",children:e.excerpt}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-xs text-news-dim",children:[e.publishedAt&&n.jsx("span",{children:Mo(e.publishedAt)}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Rr,{size:11}),e.readTime," min"]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(On,{size:11}),e.likes>999?`${(e.likes/1e3).toFixed(1)}k`:e.likes]})]})]})]})}function Rj({article:e,onSelect:t}){return n.jsxs("div",{onClick:()=>t(e),className:"flex gap-3 group cursor-pointer py-3 border-b border-border last:border-0 hover:bg-news-surface-3 -mx-2 px-2 rounded transition-colors",children:[n.jsx(Qs,{src:e.image,alt:e.title,variant:"thumb",className:"w-16 h-14 object-cover rounded flex-shrink-0",width:64,height:56}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("span",{className:"text-xs font-bold text-news-red uppercase tracking-wide",children:e.category}),n.jsx("h4",{className:"text-sm font-semibold text-foreground line-clamp-2 group-hover:text-news-red transition-colors leading-snug",children:e.title}),n.jsxs("span",{className:"text-xs text-news-dim",children:[e.publishedAt&&n.jsxs(n.Fragment,{children:[Mo(e.publishedAt)," · "]}),e.readTime," min czytania"]})]}),n.jsx(As,{size:14,className:"text-news-dim flex-shrink-0 mt-1 group-hover:text-news-red transition-colors"})]})}function $j({categorySlug:e,articleSlug:t}={}){var he,ve;const s=Ls(),{items:r,categoryNames:o}=Kf(),{categories:a}=wn(!1),i=a.map(R=>R.name),l=o.length?o:Fr,c=i.length?i:l,[d,h]=f.useState(null),[u,p]=f.useState(!1),[m,b]=f.useState(!1),x=!!e,g=e?jo(e,c):null,y=x?g:null,N=((he=r[0])==null?void 0:he.category)??null,w=R=>{s(Vf(R))},k=R=>{const ie=R.slug??R.id;t!==ie&&(h(R),s(pn({slug:ie,publishedAt:R.publishedAt})))},E=()=>{h(null),s(e?`/${e}`:"/")},[v,S]=f.useState(!1),{articles:z,loading:B,total:M,hasMore:D,loadMore:A,loadingMore:U}=Ta(x&&g?{status:"published",category:g,limit:24}:{status:"published",limit:40}),{articlesByCategory:se}=vj(!x),{data:P=[]}=jj(6),ne=f.useMemo(()=>z.map(R=>({...ni(R),slug:R.slug})),[z]),C=f.useMemo(()=>z.map(R=>R.slug).join("\0"),[z]),{topics:I}=Nj(),{sectionVisibility:F}=us();f.useEffect(()=>{if(!t){d&&h(null),p(!1),b(!1);return}const R=ne.find(ge=>ge.slug===t||ge.id===t);if(R){p(!1),b(!1),(!d||d.id!==R.id)&&h(R);return}if((d==null?void 0:d.slug)===t){p(!1),b(!1);return}let ie=!1;return p(!0),b(!1),$.getArticleBySlug(t).then(ge=>{if(!ie){const H=im(t,ge);if(H){s(H,{replace:!0});return}h({...ni(ge),slug:ge.slug,status:ge.status}),b(!1)}}).catch(()=>{ie||(h(null),b(!0))}).finally(()=>{ie||p(!1)}),()=>{ie=!0}},[t,C,d==null?void 0:d.slug]);const ae=R=>{const ie=se.get(R);return ie&&ie.length>0?ie.map(ge=>({...ni(ge),slug:ge.slug})):ne.filter(ge=>Ui(ge.category,R)).slice(0,pb())},Z=N?ae(N):[],Q=x&&g?ne:Z,oe=ne.filter(R=>R.featured)[0]??ne[0],Y=ne.filter(R=>R.id!==(oe==null?void 0:oe.id)).slice(0,3),O=ne.filter(R=>R.id!==(oe==null?void 0:oe.id)&&!Y.some(ie=>ie.id===R.id)).slice(0,4),_=ne.filter(R=>!R.featured).slice(0,5),W=P.length>0?P:[...ne].sort((R,ie)=>(ie.views??0)-(R.views??0)||ie.likes-R.likes).slice(0,6);if(t&&u)return n.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:n.jsxs("div",{className:"flex items-center gap-2 text-news-muted",children:[n.jsx(fe,{size:20,className:"animate-spin"}),n.jsx("span",{className:"text-sm",children:"Åadowanie artykuÅu..."})]})});if(t&&m)return n.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[n.jsx("div",{className:"flex-1 flex items-center justify-center px-6",children:n.jsxs("div",{className:"text-center max-w-md",children:[n.jsx("h1",{className:"font-serif text-4xl font-bold text-foreground mb-3",children:"404"}),n.jsx("p",{className:"text-news-muted mb-6",children:"Nie znaleziono artykuÅu o podanym adresie."}),n.jsx(No,{to:"/",className:"text-news-red font-semibold hover:underline",children:"WrÃ³Ä na stronÄ gÅównÄ
"})]})}),n.jsx(Rn,{})]});const de=!!d;return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:de?"hidden":void 0,"aria-hidden":de||void 0,children:n.jsxs("div",{className:"min-h-screen bg-background overflow-x-clip",children:[n.jsxs("header",{className:"sticky top-0 z-50 bg-background/95 backdrop-blur-md border-b border-border",children:[n.jsx(Mj,{}),n.jsxs("div",{className:"max-w-[1440px] mx-auto w-full min-w-0 px-4 lg:px-6 py-3",children:[n.jsxs("div",{className:"flex items-center gap-3 lg:gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.jsx("button",{className:"lg:hidden",onClick:()=>S(!v),children:v?n.jsx(He,{size:22}):n.jsx(mg,{size:22})}),n.jsx(No,{to:"/",className:"flex items-center",children:n.jsx(js,{className:"h-8 xl:h-9 w-auto",height:36,priority:!0,variant:"desktop"})})]}),n.jsx("nav",{className:"hidden xl:flex flex-1 items-center justify-center gap-0.5 min-w-0",children:r.map(R=>n.jsx("button",{onClick:()=>w(R.category),className:`px-2.5 py-1.5 rounded text-sm font-medium whitespace-nowrap transition-all ${y===R.category?"bg-news-red text-white":"text-news-muted hover:text-foreground hover:bg-news-surface-2"}`,children:R.label},`${R.category}-${R.label}`))}),n.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 shrink-0 ml-auto xl:ml-0",children:[n.jsx("div",{className:"hidden sm:flex items-center",children:n.jsx(Fm,{compact:!0,onSubmit:R=>s(qi(R))})}),n.jsx(zo,{})]})]}),n.jsx("nav",{className:"hidden lg:flex xl:hidden items-stretch gap-1 w-full mt-2 pt-2 border-t border-border",children:r.map(R=>n.jsx("button",{onClick:()=>w(R.category),className:`flex-1 min-w-0 px-1 py-2 rounded text-xs font-medium text-center leading-tight truncate transition-all ${y===R.category?"bg-news-red text-white":"text-news-muted hover:text-foreground hover:bg-news-surface-2"}`,children:n.jsx("span",{className:"block truncate",title:R.label,children:R.label})},`${R.category}-${R.label}`))})]})]}),v&&n.jsx("div",{className:"lg:hidden bg-news-surface border-b border-border px-6 py-4",children:n.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(R=>n.jsx("button",{onClick:()=>{w(R.category),S(!1)},className:`px-3 py-1.5 rounded text-sm font-medium ${y===R.category?"bg-news-red text-white":"bg-news-surface-2 text-news-muted"}`,children:R.label},`${R.category}-${R.label}`))})}),n.jsx("main",{className:"max-w-[1440px] mx-auto w-full min-w-0 px-4 lg:px-6 py-6",children:B?n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((R,ie)=>n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden animate-pulse",children:[n.jsx("div",{className:"aspect-[4/3] bg-news-surface-3"}),n.jsxs("div",{className:"p-4 space-y-2",children:[n.jsx("div",{className:"h-4 bg-news-surface-3 rounded w-3/4"}),n.jsx("div",{className:"h-3 bg-news-surface-3 rounded w-1/2"})]})]},ie))}):x&&g?n.jsxs("div",{className:"space-y-6",children:[n.jsxs("nav",{className:"text-sm text-news-muted",children:[n.jsx(No,{to:"/",className:"hover:text-news-red transition-colors",children:"Strona gÅówna"}),n.jsx("span",{className:"mx-2",children:"/"}),n.jsx("span",{className:"text-foreground",children:g})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs font-semibold text-news-red uppercase tracking-widest mb-2",children:"Kategoria"}),n.jsx("h1",{className:"font-serif text-3xl md:text-4xl font-bold text-foreground mb-3",children:g}),Wi[g]&&n.jsx("p",{className:"text-news-muted max-w-3xl leading-relaxed",children:Wi[g]})]}),n.jsxs("p",{className:"text-sm text-news-dim",children:[M," ",M===1?"artykuÅ":"artykuÅów"]}),Q.length===0?n.jsx("div",{className:"py-16 text-center text-news-muted border border-dashed border-border rounded-lg",children:n.jsx("p",{children:"Brak artykuÅów w tej kategorii."})}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Q.map(R=>n.jsx(Sn,{article:R,onSelect:k},R.id))}),D&&n.jsx("div",{className:"flex justify-center pt-4",children:n.jsx("button",{type:"button",onClick:A,disabled:U,className:"px-6 py-2.5 rounded-lg bg-news-surface-2 border border-border text-sm font-semibold text-foreground hover:border-news-red hover:text-news-red transition-colors disabled:opacity-50",children:U?"Åadowanieâ¦":"ZaÅaduj wiÄcej"})})]})]}):n.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(0,1fr)_320px] gap-6",children:[n.jsxs("div",{className:"space-y-6 min-w-0",children:[oe&&n.jsx(Sn,{article:oe,onSelect:k,featured:!0,priority:!0}),cn(F,"hero_banner")&&n.jsx(Aj,{}),Y.length>0&&n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Y.map(R=>n.jsx(Sn,{article:R,onSelect:k},R.id))}),O.length>0&&n.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-4 gap-4",children:O.map(R=>n.jsx(Sn,{article:R,onSelect:k},R.id))}),cn(F,"videos")&&n.jsx(zj,{}),N&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:"w-1 h-6 bg-news-red rounded shrink-0"}),n.jsx("h2",{className:"font-serif text-xl font-bold text-foreground min-w-0 truncate",children:((ve=r.find(R=>R.category===N))==null?void 0:ve.label)??N}),n.jsx("div",{className:"flex-1 border-t border-border min-w-0"}),n.jsxs("button",{type:"button",onClick:()=>w(N),className:"text-xs font-semibold text-news-red hover:underline flex items-center gap-1",children:["Zobacz wiÄcej ",n.jsx(As,{size:12})]})]}),n.jsx(Zs,{placement:"feed_between"}),Z.length===0?n.jsx("div",{className:"py-16 text-center text-news-muted",children:n.jsx("p",{children:"Brak artykuÅów w tej kategorii."})}):n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Z.map(R=>n.jsx(Sn,{article:R,onSelect:k},R.id))})]}),r.filter(R=>R.category!==N).map(R=>{const ie=ae(R.category);if(ie.length===0)return null;const ge=R.category;return n.jsx(f.Fragment,{children:n.jsxs("section",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:"w-1 h-6 bg-news-red rounded shrink-0"}),n.jsx("h2",{className:"font-serif text-xl font-bold text-foreground min-w-0 truncate",children:R.label}),n.jsx("div",{className:"flex-1 border-t border-border min-w-0"}),n.jsxs("button",{onClick:()=>w(ge),className:"text-xs font-semibold text-news-red hover:underline flex items-center gap-1",children:["Zobacz wiÄcej ",n.jsx(As,{size:12})]})]}),n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:ie.map(H=>n.jsx(Sn,{article:H,onSelect:k}
6,H.id))})]})},R.category)}),cn(F,"podcast")&&n.jsx(Sj,{})]}),n.jsxs("aside",{className:"space-y-6 min-w-0 xl:max-w-[320px]",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("div",{className:"w-1 h-5 bg-news-red rounded"}),n.jsx("h3",{className:"font-serif font-bold text-foreground",children:"Ostatnio dodane"})]}),n.jsx("div",{children:_.map(R=>n.jsx(Rj,{article:R,onSelect:k},R.id))})]}),n.jsx(Zs,{placement:"sidebar"}),n.jsx(Pj,{}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4",children:[n.jsx("h3",{className:"font-serif font-bold text-foreground mb-3",children:"Kategorie"}),n.jsx("div",{className:"space-y-1",children:r.map(R=>{const ie=ne.filter(ge=>Ui(ge.category,R.category)).length;return n.jsxs("button",{onClick:()=>w(R.category),className:"w-full flex items-center justify-between py-2 px-2 rounded hover:bg-news-surface-3 transition-colors group",children:[n.jsx("span",{className:"text-sm text-news-muted group-hover:text-foreground transition-colors",children:R.label}),n.jsx("span",{className:"text-xs bg-news-surface-3 text-news-dim px-2 py-0.5 rounded-full",children:ie})]},`${R.category}-${R.label}`)})})]}),cn(F,"trending_topics")&&n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(jr,{size:16,className:"text-news-red"}),n.jsx("h3",{className:"font-serif font-bold text-foreground",children:"Trendy"})]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:I.map(R=>n.jsx("button",{type:"button",onClick:()=>s(qi({q:R.replace(/^#/,"").trim()})),className:"text-xs bg-news-surface-3 text-news-muted px-3 py-1.5 rounded-full border border-border cursor-pointer hover:border-news-red hover:text-news-red transition-colors",children:R},R))})]})]})]})}),n.jsx(Rn,{})]})}),de&&d&&n.jsx(gm,{article:d,onBack:E,popularArticles:W,onSelectArticle:R=>k(R)},d.id)]})}const Bj=()=>typeof window<"u"&&window.innerWidth<768;function Fj(){const[e,t]=f.useState(Bj),s=pl(),{year:r,month:o,day:a,articleSlug:i,categorySlug:l}=s,c=!!(r&&o&&a&&i),{categories:d,loading:h}=wn(!1),u=d.map(m=>m.name);if(f.useEffect(()=>{const m=window.matchMedia("(max-width: 767px)"),b=()=>t(m.matches);return b(),m.addEventListener("change",b),window.addEventListener("resize",b),()=>{m.removeEventListener("change",b),window.removeEventListener("resize",b)}},[]),c&&!ay(r,o,a))return n.jsx(Js,{});if(l&&!c&&!h&&!ff(l,u))return n.jsx(Xb,{slug:l});const p=e?n.jsx(yj,{categorySlug:l,articleSlug:i}):n.jsx($j,{categorySlug:l,articleSlug:i});return n.jsxs(n.Fragment,{children:[p,n.jsx(jp,{})]})}function Wj(){const{categorySlug:e}=pl();return e?n.jsx(Lu,{to:`/${e}`,replace:!0}):n.jsx(Js,{})}function Pd(e,t){return ex(e,t)}const Do="pm_edit",Uj=80,Hj=75;function Po(e){if(!(e!=null&&e.trim()))return"";if(e.startsWith("/")){const t=e.indexOf("?");if(t===-1)return e;const s=new URLSearchParams(e.slice(t+1));s.delete(Do);const r=s.toString();return r?`${e.slice(0,t)}?${r}`:e.slice(0,t)}try{const t=new URL(e);return t.searchParams.delete(Do),t.toString()}catch{return e}}function Rd(e){return e.startsWith("/uploads/")||e.startsWith("/wp-content/uploads/")}function Xi(e,t){const s=Po(e);if(!s)return"";let r=s;if(s.startsWith("http://")||s.startsWith("https://"))try{const i=new URL(s);if(!Rd(i.pathname))return s;r=`${i.pathname}${i.search}`}catch{return s}else if(!Rd(s.split("?")[0]??""))return s;const o=t!=null&&t!==""?String(t):String(Date.now()),a=r.includes("?")?"&":"?";return`${r}${a}${Do}=${encodeURIComponent(o)}`}function Gj(e,t,s){if(s!=null&&s.trim())return Xi(s,t);const r=Po(e);if(!r)return"";if(!_a(r))return Xi(e,t);const o=Br(r,Uj,Hj),a=t!=null&&t!==""?String(t):"";if(!a)return o;const i=o.includes("?")?"&":"?";return`${o}${i}${Do}=${encodeURIComponent(a)}`}function Bt({src:e,thumbSrc:t,cacheKey:s,variant:r="preview",loading:o,onError:a,...i}){const[l,c]=f.useState(!1),d=r==="thumb"&&!l,h=d?Gj(e,s,t):Xi(e,s);return h?n.jsx("img",{...i,src:h,loading:o??(r==="thumb"?"lazy":"eager"),decoding:"async",onError:u=>{if(d){c(!0);return}a==null||a(u)}}):null}function Yj(e){return typeof e=="object"?e.key:e}function Vj(e,t){const s=e.length;
6return new Proxy(e,{get(r,o,a){if(typeof o=="string"){const i=o.charCodeAt(0);if(i>=48&&i<=57){const l=+o;if(Number.isInteger(l)&&l>=0&&l<s){let c=r[l];if(typeof c!="object"){const d=t[l*2];c=r[l]={index:l,key:c,start:d,size:t[l*2+1],end:d+t[l*2+1],lane:0}}return c}}if(o==="length")return s}return Reflect.get(r,o,a)}})}function Cn(e,t,s){let r=s.initialDeps??[],o,a=!0;function i(){const l=e();return(l.length!==r.length||l.some((d,h)=>r[h]!==d))&&(r=l,o=t(...l),s!=null&&s.onChange&&!(a&&s.skipInitialOnChange)&&s.onChange(o),a=!1),o}return i.updateDeps=l=>{r=l},i}function $d(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Bd=(e,t)=>Math.abs(e-t)<1.01,Kj=(e,t,s)=>{let r;return Object.assign(function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),s)},{cancel:()=>{e.clearTimeout(r)}})};let er;const ri=()=>{if(er!==void 0)return er;if(typeof navigator>"u")return er=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return er=!0;const e=navigator.maxTouchPoints;return er=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Fd=e=>{const{offsetWidth:t,offsetHeight:s}=e;return{width:t,height:s}},qj=e=>e,Xj=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(r);for(let a=0;a<r;a++)o[a]=t+a;return o},Jj=(e,t)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:l,height:c}=i;t({width:Math.round(l),height:Math.round(c)})};if(o(Fd(s)),!r.ResizeObserver)return()=>{};const a=new r.ResizeObserver(i=>{const l=()=>{const c=i[0];if(c!=null&&c.borderBoxSize){const d=c.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Fd(s))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return a.observe(s,{box:"border-box"}),()=>{a.unobserve(s)}},Ro={passive:!0},Zj=typeof window>"u"?!0:"onscrollend"in window,Qj=(e,t,s)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const a=e.options.useScrollendEvent&&Zj;let i=0;const l=a?null:Kj(o,()=>t(s(r),!1),e.options.isScrollingResetDelay),c=u=>()=>{i=s(r),l==null||l(),t(i,u)},d=c(!0),h=c(!1);return r.addEventListener("scroll",d,Ro),a&&r.addEventListener("scrollend",h,Ro),()=>{r.removeEventListener("scroll",d),a&&r.removeEventListener("scrollend",h),l==null||l.cancel()}},eN=(e,t)=>Qj(e,t,s=>{const{horizontal:r,isRtl:o}=e.options;return r?s.scrollLeft*(o&&-1||1):s.scrollTop}),tN=(e,t,s)=>{if(s.options.useCachedMeasurements){const r=s.indexFromElement(e),o=s.options.getItemKey(r);return s.itemSizeCache.get(o)??s.options.estimateSize(r)}if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[s.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=s.indexFromElement(e),o=s.options.getItemKey(r),a=s.itemSizeCache.get(o);if(a!==void 0)return a}return e[s.options.horizontal?"offsetWidth":"offsetHeight"]},sN=(e,{adjustments:t=0,behavior:s},r)=>{var o,a;(a=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||a.call(o,{[r.options.horizontal?"left":"top"]:e+t,behavior:s})},nN=sN;function rN(e,t,s,r){if(t===0)return!1;const o=r(0),a=new Set;let i=0;for(;i<e;){const c=s(i);if(c===o)break;a.add(c),i++}const l=e-i;if(l===0||l>=t)return!1;for(let c=0;c<l;c++)if(r(c)!==s(i+c))return!1;for(let c=l;c<t;c++)if(a.has(r(c)))return!1;return!0}class oN{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var s,r,o;return((o=(r=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let s=null;const r=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(o=>{o.forEach(a=>{const i=()=>{const l=a.target,c=this.indexFromElement(l);
6if(!l.isConnected){this.observer.unobserve(l);for(const[d,h]of this.elementsCache)if(h===l){this.elementsCache.delete(d);break}return}this.isIndexInRange(c)&&this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),s=null},observe:o=>{var a;return(a=r())==null?void 0:a.observe(o,{box:"border-box"})},unobserve:o=>{var a;return(a=r())==null?void 0:a.unobserve(o)}}})(),this.range=null,this.setOptions=s=>{var r;const o={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:qj,rangeExtractor:Xj,onChange:()=>{},measureElement:tN,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const u in s){const p=s[u];p!==void 0&&(o[u]=p)}const a=this.options;let i=null,l=null,c=!1;if(a!==void 0&&a.enabled&&o.enabled&&o.anchorTo==="end"&&this.scrollElement!==null){const u=a.count,p=o.count,m=this.getMeasurements(),b=((r=this._singleLaneMeasurements)==null?void 0:r.items)??m,x=k=>Yj(b[k]),g=u>0?x(0):null,y=u>0?x(u-1):null;if(p!==u||u>0&&p>0&&(o.getItemKey(0)!==g||o.getItemKey(p-1)!==y)){c=!0;const k=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??m[0]:null;k&&(i=[k.key,this.getScrollOffset()-k.start]);const E=o.followOnAppend===!0?"auto":o.followOnAppend||null;E&&p>0&&this.isAtEnd(a.scrollEndThreshold)&&(u===0||o.getItemKey(p-1)!==y)&&(p>u||rN(u,p,x,o.getItemKey))&&(l=E)}}this.options=o,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,h=0;if(i&&this.scrollOffset!==null){const[u,p]=i,m=this.getMeasurements(),{count:b,getItemKey:x}=this.options;let g=0;for(;g<b&&x(g)!==u;)g++;if(g<b){const y=m[g];if(y){const N=Math.max(0,y.start+p);!l&&N!==this.scrollOffset&&(h=N-this.scrollOffset,this.scrollOffset=N,d=!0)}}}(d||l)&&(this.pendingScrollAnchor=[d?i[0]:null,d?i[1]:0,l,h])},this.notify=s=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,s)},this.maybeNotify=Cn(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),s=>{this.notify(s)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(s=>s()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var s,r;const o=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==o){if(this.cleanup(),!o){this.maybeNotify();return}if(this.scrollElement=o,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((s=this.scrollElement)==null?void 0:s.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,l)=>{if(l&&this._intendedScrollOffset===null&&i===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(i-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;const c=this.getScrollOffset();this.scrollDirection=l?c===i?this.scrollDirection:c<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=l,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,l=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},c=()=>{this._iosTouching=!1,!(!ri()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",l,Ro),i.addEventListener("touchend",c,Ro),this.unsubs.push(()=>{i.removeEventListener("touchstart",l),i.removeEventListener("touchend",c),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const a=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,a&&this.scrollElement&&this.options.enabled){const[i,l,c,d]=a;i!==null&&!c&&(ri()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?d!==0&&(this._iosDeferredAdjustment+=d):((r=this.scrollState)==null?void 0:r.behavior)==="smooth"&&!Bd(this.getScrollOffset()-d,this.scrollState.lastTargetOffset)||this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),c&&this.scrollToEnd({behavior:c})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;const{target:s,maxAtWrite:r}=this._clampedAdjustment,o=this.getMaxScrollOffset();o>r+.5&&(this._clampedAdjustment=s>o+.5?{target:s,maxAtWrite:o}:null,this._scrollToOffset(s,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>
6{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const s=this.getScrollOffset(),r=this.getMaxScrollOffset();if(s<0||s>r)return;if(this._iosDeferredAdjustment<0&&s>=r-1){this._iosDeferredAdjustment=0;return}const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(s,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Cn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(s,r,o,a,i,l,c,d)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:s,paddingStart:r,scrollMargin:o,getItemKey:a,enabled:i,lanes:l,laneAssignmentMode:c,gap:d}),{key:!1}),this.isIndexInRange=s=>s>=0&&s<this.options.count,this.getMeasurements=Cn(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:s,paddingStart:r,scrollMargin:o,getItemKey:a,enabled:i,lanes:l,laneAssignmentMode:c,gap:d},h)=>{var u;const p=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const N of this.laneAssignments.keys())N>=s&&this.laneAssignments.delete(N);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(N=>{this.itemSizeCache.set(N.key,N.size)}));const m=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===s&&(this.lanesSettling=!1),l===1){const N=s*2;let w=(u=this._singleLaneMeasurements)==null?void 0:u.flat;if(!w||w.length<N){const S=new Float64Array(N);w&&m>0&&S.set(w.subarray(0,m*2)),w=S}const k=m===0?new Array(s):this._singleLaneMeasurements.items.slice();let E;if(m===0)E=r+o;else{const S=m-1;E=w[S*2]+w[S*2+1]+d}for(let S=m;S<s;S++){const z=a(S);k[S]=z;const B=p.get(z),M=typeof B=="number"?B:this.options.estimateSize(S);w[S*2]=E,w[S*2+1]=M,E+=M+d}this._singleLaneMeasurements={flat:w,items:k};const v=Vj(k,w);return this.measurementsCache=v,v}const b=this.measurementsCache.slice(0,m),x=new Array(l).fill(void 0),g=new Float64Array(l);let y=0;for(let N=0;N<m;N++){const w=b[N];w&&(x[w.lane]===void 0&&y++,x[w.lane]=N,g[w.lane]=w.end)}for(let N=m;N<s;N++){const w=a(N),k=this.laneAssignments.get(N);let E,v;const S=c==="estimate"||p.has(w);if(k!==void 0&&this.options.lanes>1){E=k;const D=x[E],A=D!==void 0?b[D]:void 0;v=A?A.end+d:r+o}else if(y===l){let D=0,A=g[0],U=x[0];for(let se=1;se<l;se++){const P=g[se];(P<A||P===A&&x[se]<U)&&(D=se,A=P,U=x[se])}E=D,v=A+d,S&&this.laneAssignments.set(N,E)}else E=N%this.options.lanes,v=r+o,S&&this.laneAssignments.set(N,E);const z=p.get(w),B=typeof z=="number"?z:this.options.estimateSize(N),M=v+B;b[N]={index:N,start:v,size:B,end:M,key:w,lane:E},x[E]===void 0&&y++,x[E]=N,g[E]=M}return this.measurementsCache=b,b},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Cn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,r,o,a)=>s.length===0||r===0?(this.range=null,null):(this.range=iN(s,r,o,a,a===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}
6),this.getVirtualIndexes=Cn(()=>{let s=null,r=null;const o=this.calculateRange();return o&&(s=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,r]},(s,r,o,a,i)=>a===null||i===null?[]:s({startIndex:a,endIndex:i,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=s=>{const r=this.options.indexAttribute,o=s.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){const a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,o-a),l=Math.min(this.options.count-1,o+a);return s>=i&&s<=l}return!0},this.measureElement=s=>{if(!s){this.elementsCache.forEach((i,l)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(l))});return}const r=this.indexFromElement(s);if(!this.isIndexInRange(r))return;const o=this.options.getItemKey(r),a=this.elementsCache.get(o);a!==s&&(a&&this.observer.unobserve(a),this.observer.observe(s),this.elementsCache.set(o,s)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(s,void 0,this))},this.resizeItem=(s,r)=>{var o,a,i;if(!this.isIndexInRange(s))return;let l,c,d;const h=(o=this._singleLaneMeasurements)==null?void 0:o.flat;if(this.options.lanes===1&&h!=null)d=this.options.getItemKey(s),c=h[s*2],l=h[s*2+1];else{const m=this.measurementsCache[s];if(!m)return;d=m.key,c=m.start,l=m.size}const u=this.itemSizeCache.get(d)??l,p=r-u;if(p!==0){const m=this.options.anchorTo==="end"&&((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,b=m?this.getTotalSize():0,x=this.getScrollOffset()+this.scrollAdjustments,y=!this.itemSizeCache.has(d)?c<x:c+u<=x&&this.scrollDirection!=="backward",N=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[s]??{index:s,key:d,start:c,size:l,end:c+l,lane:0},p,this):y);(this.pendingMin===null||s<this.pendingMin)&&(this.pendingMin=s),this.itemSizeCache.set(d,r),this.itemSizeCacheVersion++;let w=!1;m?w=this.applyScrollAdjustment(this.getTotalSize()-b):N&&(w=this.applyScrollAdjustment(p)),this.notify(w),this._retryClampedAdjustment()}},this.getVirtualItems=Cn(()=>
6[this.getVirtualIndexes(),this.getMeasurements()],(s,r)=>{const o=[];for(let a=0,i=s.length;a<i;a++){const l=s[a],c=r[l];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{var r;const o=this.getMeasurements();if(o.length===0)return;const a=(r=this._singleLaneMeasurements)==null?void 0:r.flat,i=this.options.lanes===1&&a!=null,l=Gm(0,o.length-1,i?c=>a[c*2]:c=>$d(o[c]).start,s);return $d(o[l])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const s=this.scrollElement.document.documentElement;return this.options.horizontal?s.scrollWidth-this.scrollElement.innerWidth:s.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(s=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=s,this.getOffsetForAlignment=(s,r,o=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=s>=i+a?"end":"start"),r==="center"?s+=(o-a)/2:r==="end"&&(s-=a);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,s),0)},this.getOffsetForIndex=(s,r="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const o=this.getSize(),a=this.getScrollOffset(),i=this.measurementsCache[s];if(!i)return;if(r==="auto")if(i.end>=a+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];if(r==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,i.size),r]},this.scrollToOffset=(s,{align:r="start",behavior:o="auto"}={})=>{this._iosDeferredAdjustment=0;const a=this.getOffsetForAlignment(s,r),i=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:i,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:r="auto",behavior:o="auto"}={})=>{this._iosDeferredAdjustment=0,s=Math.max(0,Math.min(s,this.options.count-1));const a=this.getOffsetForIndex(s,r);if(!a)return;const[i,l]=a,c=this.now();this.scrollState={index:s,align:l,behavior:o,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+s,a=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:s="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:s});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:s})},this.getTotalSize=()=>{var s,r;const o=this.getMeasurements();let a;if(o.length===0)a=this.options.paddingStart;else if(this.options.lanes===1){const i=o.length-1,l=(s=this._singleLaneMeasurements)==null?void 0:s.flat;l!=null?a=l[i*2]+l[i*2+1]:a=((r=o[i])==null?void 0:r.end)??0}else{const i=Array(this.options.lanes).fill(null);let l=o.length-1;for(;l>=0&&i.some(c=>c===null);){const c=o[l];i[c.lane]===null&&(i[c.lane]=c.end),l--}a=Math.max(...i.filter(c=>c!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const s=[];if(this.itemSizeCache.size===0)return s;const r=this.getMeasurements();for(const o of r)o&&this.itemSizeCache.has(o.key)&&s.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return s},this._scrollToOffset=(s,{adjustments:r,behavior:o})=>{this._intendedScrollOffset=s+(r??0),this.options.scrollToFn(s,{behavior:o,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,s){if(t===0)return!1;if(ri()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=t,!1;{const r=this.getScrollOffset()+this.scrollAdjustments+t,o=this.scrollElement,a=o!==null&&("scrollHeight"in o||"document"in o)?this.getMaxScrollOffset():null;return this._clampedAdjustment=a!==null&&r>a+.5?{target:r,maxAtWrite:a}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:s}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,a=1,i=o!==this.scrollState.lastTargetOffset;
6if(!i&&Bd(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,i){const l=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),d=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=o,d||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:d?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Gm=(e,t,s,r)=>{for(;e<=t;){const o=(e+t)/2|0,a=s(o);if(a<r)e=o+1;else if(a>r)t=o-1;else return o}return e>0?e-1:0};function aN(e,t,s){let r=0;for(;r<=t;){const o=(r+t)/2|0,a=e[o*2];if(a<s)r=o+1;else if(a>s)t=o-1;else return o}return r>0?r-1:0}function iN(e,t,s,r,o){const a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&o!==null){const d=aN(o,a,s);let h=d;const u=s+t;for(;h<a&&o[h*2]+o[h*2+1]<u;)h++;return{startIndex:d,endIndex:h}}let l=Gm(0,a,d=>e[d].start,s),c=l;if(r===1)for(;c<a&&e[c].end<s+t;)c++;else if(r>1){const d=Array(r).fill(0);for(;c<a&&d.some(u=>u<s+t);){const u=e[c];d[u.lane]=u.end,c++}const h=Array(r).fill(s+t);for(;l>=0&&h.some(u=>u>=s);){const u=e[l];h[u.lane]=u.start,l--}l=Math.max(0,l-l%r),c=Math.min(a,c+(r-1-c%r))}return{startIndex:l,endIndex:c}}const oi=typeof document<"u"?f.useLayoutEffect:f.useEffect;function lN({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:s="transform",...r}){const o=f.useReducer(u=>u+1,0)[1],a=f.useRef({enabled:t,mode:s,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=s;const i=f.useRef(!1),l=u=>{const p=a.current;if(!p.enabled||!p.container)return;const m=u.getTotalSize();if(m!==p.lastSize){p.lastSize=m;const b=u.options.horizontal?"width":"height";p.container.style[b]=`${m}px`}},c=u=>{const p=a.current;if(!p.enabled||!p.container)return;l(u);const m=!!u.options.horizontal,b=p.mode==="transform",x=m?"left":"top",g=u.options.scrollMargin,y=u.getVirtualItems();for(const N of y){const w=N.start-g,k=u.elementsCache.get(N.key);k&&p.lastPositions.get(k)!==w&&(p.lastPositions.set(k,w),b?k.style.transform=m?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:k.style[x]=`${w}px`)}},d={...r,onChange:(u,p)=>{var m;const b=a.current;let x=!0;if(b.enabled){c(u);const g=u.range,y=b.prevRange;x=!y||y.isScrolling!==u.isScrolling||y.startIndex!==(g==null?void 0:g.startIndex)||y.endIndex!==(g==null?void 0:g.endIndex),x&&(b.prevRange=g?{startIndex:g.startIndex,endIndex:g.endIndex,isScrolling:u.isScrolling}:null)}x&&(e&&p&&!i.current?Xs.flushSync(o):o()),(m=r.onChange)==null||m.call(r,u,p)}},[h]=f.useState(()=>{const u=new oN(d),p=u.measureElement;return u.measureElement=m=>{i.current=!0;try{p(m)}finally{i.current=!1}},Object.assign(u,{containerRef:m=>{const b=a.current;if(b.container=m,b.lastSize=null,m&&b.enabled){const x=u.getTotalSize();b.lastSize=x;const g=u.options.horizontal?"width":"height";m.style[g]=`${x}px`}}})});return h.setOptions(d),oi(()=>h._didMount(),[]),oi(()=>(l(h),h._willUpdate())),oi(()=>{c(h)}),h}function Ym(e){return lN({observeElementRect:Jj,observeElementOffset:eN,scrollToFn:nN,...e})}const ai=6,cN=56;function Wd(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function za(e){return e.startsWith("image/")}function dN(){const[e,t]=f.useState(8);return f.useEffect(()=>{const s=()=>{const r=window.innerWidth;r<640?t(4):r<1024?t(6):r<1280?t(8):t(10)};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),e}function uN(e){const[t,s]=f.useState(0);return f.useEffect(()=>{const r=e.current;if(!r)return;const o=new ResizeObserver(([a])=>{s(a.contentRect.width)});return o.observe(r),s(r.clientWidth),()=>o.disconnect()},[e]),t}function fN(e,t,s,r,o){f.useEffect(()=>{const a=e.current,i=t.current;if(!a||!i||!s)return;const l=new IntersectionObserver(c=>{var d;(d=c[0])!=null&&d.isIntersecting&&!r&&o()},{root:a,rootMargin:"240px"});return l.observe(i),()=>l.disconnect()},[e,t,s,r,o])}function Vm({scrollRef:e,hasMore:t,loadingMore:s,loadMore:r}){const o=f.useRef(null);return fN(e,o,t,s,r),n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:o,className:"h-1","aria-hidden":!0}),s&&n.jsx("div",{className:"flex justify-center py-3 text-news-muted",children:n.jsx(fe,{size:18,className:"animate-spin"})})]})}function mN({item:e,size:t,selected:s,disabled:r,multiSelect:o,selectionMode:a,onItemClick:i}){const l=za(e.mime_type),c=o?s?"Odznacz":"Zaznacz":a?"Wybierz":e.original_name;return n.jsxs("button",{type:"button",onClick:()=>i(e),disabled:r,style:{width:t,height:t},className:`group relative rounded-md overflow-hidden border-2 transition-all ${s?"border-news-red ring-2 ring-ne
6ws-red/30":"border-transparent hover:border-news-red/50"} ${r?"opacity-40 cursor-not-allowed":"cursor-pointer"}`,children:[l?n.jsx(Bt,{variant:"thumb",src:e.url,thumbSrc:e.thumb_url,cacheKey:e.created_at,alt:e.alt_text||e.original_name,className:"w-full h-full object-cover"}):n.jsx("div",{className:"w-full h-full bg-news-surface-2 flex items-center justify-center",children:n.jsx(wl,{size:20,className:"text-news-dim"})}),o&&s&&n.jsx("span",{className:"absolute top-1 right-1 flex h-4 w-4 items-center justify-center rounded-full bg-news-red text-white shadow",children:n.jsx(xn,{size:10,strokeWidth:3})}),n.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-all flex items-end p-1 opacity-0 group-hover:opacity-100",children:n.jsx("p",{className:`text-white text-[10px] leading-tight line-clamp-2 ${a||o?"font-bold":"font-medium"}`,children:c})})]})}function hN({item:e,selected:t,disabled:s,multiSelect:r,onItemClick:o}){const a=za(e.mime_type);return n.jsxs("button",{type:"button",onClick:()=>o(e),disabled:s,className:`w-full grid grid-cols-[40px_minmax(0,1fr)] sm:grid-cols-[40px_minmax(0,1fr)_88px_120px_96px] gap-3 items-center px-3 py-2 rounded-lg text-left border transition-colors ${t?"border-news-red bg-news-red/5 ring-1 ring-news-red/20":"border-transparent hover:bg-news-surface-2"} ${s?"opacity-40 cursor-not-allowed":"cursor-pointer"}`,children:[n.jsxs("span",{className:"relative w-10 h-10 rounded overflow-hidden flex-shrink-0 bg-news-surface-2",children:[a?n.jsx(Bt,{variant:"thumb",src:e.url,thumbSrc:e.thumb_url,cacheKey:e.created_at,alt:e.alt_text||e.original_name,className:"w-full h-full object-cover"}):n.jsx("span",{className:"w-full h-full flex items-center justify-center",children:n.jsx(wl,{size:16,className:"text-news-dim"})}),r&&t&&n.jsx("span",{className:"absolute top-0.5 right-0.5 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-news-red text-white",children:n.jsx(xn,{size:8,strokeWidth:3})})]}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block text-sm font-medium text-foreground truncate",children:e.original_name}),(e.tags||[]).length>0&&n.jsx("span",{className:"mt-0.5 flex gap-1 flex-wrap",children:(e.tags||[]).slice(0,3).map(i=>n.jsx("span",{className:"text-[10px] bg-news-surface-3 text-news-muted px-1.5 py-0.5 rounded-full",children:i},i))}),n.jsxs("span",{className:"sm:hidden block text-xs text-news-dim mt-0.5",children:[Wd(e.size_bytes)," · ",new Date(e.created_at).toLocaleDateString("pl-PL")]})]}),n.jsx("span",{className:"hidden sm:block text-xs text-news-muted tabular-nums",children:Wd(e.size_bytes)}),n.jsx("span",{className:"hidden sm:block text-xs text-news-muted truncate",children:e.mime_type}),n.jsx("span",{className:"hidden sm:block text-xs text-news-muted",children:new Date(e.created_at).toLocaleDateString("pl-PL")})]})}function pN({viewMode:e}){return e==="list"?n.jsx("div",{className:"space-y-1",children:Array.from({length:8}).map((t,s)=>n.jsx("div",{className:"h-14 bg-news-surface-2 rounded-lg animate-pulse"},s))}):n.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10 gap-1.5",children:Array.from({length:20}).map((t,s)=>n.jsx("div",{className:"aspect-square bg-news-surface-2 rounded-md animate-pulse"},s))})}function gN({scrollRef:e,items:t,loadingMore:s,hasMore:r,loadMore:o,selectedId:a,selectedIds:i,selectionMode:l,multiSelect:c,onItemClick:d}){const h=dN(),u=uN(e),p=u>0?(u-(h-1)*ai)/h:72,m=p+ai,b=Math.ceil(t.length/h),x=Ym({count:b,getScrollElement:()=>e.current,estimateSize:()=>m,overscan:2}),g=y=>c?!!(i!=null&&i.has(y.id)):a===y.id;return n.jsxs("div",{className:"pb-2",children:[n.jsx("div",{style:{height:x.getTotalSize(),position:"relative",width:"100%"},children:x.getVirtualItems().map(y=>{const N=y.index*h,w=t.slice(N,N+h);return n.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:y.size,transform:`translateY(${y.start}px)`},children:n.jsx("div",{className:"flex",style:{gap:ai},children:w.map(k=>{const E=za(k.mime_type),v=g(k),S=!!(c&&!E);return n.jsx(mN,{item:k,size:p,selected:v,disabled:S,multiSelect:c,selectionMode:l,onItemClick:d},k.id)})})},y.key)})}),n.jsx(Vm,{scrollRef:e,hasMore:r,loadingMore:s,loadMore:o})]})}function xN({scrollRef:e,items:t,loadingMore:s,hasMore:r,loadMore:o,selectedId:a,selectedIds:i,multiSelect:l,onItemClick:c}){const d=Ym({count:t.length,getScrollElement:()=>e.current,estimateSize:()=>cN,overscan:8}),h=u=>l?!!(i!=null&&i.has(u.id)):a===u.id;return n.jsxs("div",{className:"pb-2",children:[n.jsxs("div",{className:"hidden sm:grid grid-cols-[40px_minmax(0,1fr)_88px_120px_96px] gap-3 px-3 py-1.5 text-[11px] uppercase tracking-wide text-news-dim",children:[n.jsx("span",{}),n.jsx("span",{children:"Nazwa"}),n.jsx("span",{children:"Rozmiar"}),n.jsx("span",{children:"Typ"}),n.jsx("span",{children:"Data"})]}),n.jsx("div",{style:{height:d.getTotalSize(),position:"relative"},children:d.getVirtualItems().map(u=>{const p=t[u.index],m=za(p.mime_type),b=h(p),x=!!(l&&!m);return n.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:u.size,transform:`translateY(${u.start}px)`},children:n.jsx(hN,{item:p,selected:b,disabled:x,multiSelect:l,onItemClick:c})},p.id)})}),n.jsx(Vm,{scrollRef:e,hasMore:r,loadingMore:s,loadMore:o})]})}function Km(e){const{viewMode:t,loading:s,items:r}=e;return s&&r.length===0?n.jsx(pN,{viewMode:t}):r.length===0?n.jsxs("div",{className:"border-2 border-dashed border-border rounded-lg p-16 text-center",children:[n.jsx("p",{className:"text-news-muted font-medium",children:"Brak plików"}),n.jsx("p",{className:"text-news-dim text-sm mt-1",children:'PrzeciÄ
gnij pliki tutaj lub kliknij âWgraj pliki"'})]}):t==="list"?n.jsx(xN,{...e}):n.jsx(gN,{...e})}const Ji=60,bN=3e4,wN=5*6e4;function yN(e){var t;return["media",{q:((t=e.q)==null?void 0:t.trim())||null,limit:e.limit??Ji}]}function qm(e={}){var i,l;const t={q:e.q,limit:e.limit??Ji},s=Nl({queryKey:yN(t),queryFn:({pageParam:c})=>{var d;return $.getMedia({q:((d=t.q)==null?void 0:d.trim())||void 0,limit:t.limit??Ji,offset:c})},initialPageParam:0,getNextPageParam:c=>c.hasMore?c.offset+c.items.length:void 0,staleTime:bN,gcTime:wN,enabled:e.enabled!==!1}),r=f.useMemo(()=>{var c;return((c=s.data)==null?void 0:c.pages.flatMap(d=>d.items))??[]},[s.data]),o=((l=(i=s.data)==null?void 0:i.pages[0])==null?void 0:l.total)??0,a=f.useCallback(()=>{s.hasNextPage&&!s.isFetchingNextPage&&s.fetchNextPage()},[s.hasNextPage,s.isFetchingNextPage,s.fetchNextPage]);return{items:r,total:o,hasMore:s.hasNextPage??!1,loading:s.isLoading,loadingMore:s.isFetchingNextPage,isFetching:s.isFetching,error:s.error?s.error instanceof Error?s.error.message:"BÅÄ
d pobierania mediów":null,refetch:s.refetch,loadM
6ore:a}}function vN(){const e=ja();return f.useCallback(()=>e.invalidateQueries({queryKey:["media"]}),[e])}const Xm="pm-admin-media-view";function jN(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function NN(){try{return localStorage.getItem(Xm)==="list"?"list":"gallery"}catch{return"gallery"}}function kN({value:e,onChange:t}){const s=(r,o,a)=>n.jsx("button",{type:"button",onClick:()=>t(r),title:o,"aria-label":o,"aria-pressed":e===r,className:`p-2 transition-colors ${e===r?"bg-news-red text-white":"text-news-muted hover:text-foreground hover:bg-news-surface-3"}`,children:n.jsx(a,{size:15})});return n.jsxs("div",{className:"flex items-center border border-border rounded-lg overflow-hidden flex-shrink-0",role:"group","aria-label":"Widok biblioteki",children:[s("gallery","Galeria kompaktowa",hg),s("list","Lista",tf)]})}function Zi({selectionMode:e=!1,multiSelect:t=!1,onSelect:s,onSelectMany:r}={}){const o=f.useRef(null),a=vN(),[i,l]=f.useState(""),[c,d]=f.useState(""),[h,u]=f.useState(null),[p,m]=f.useState(new Set),[b,x]=f.useState(!1),[g,y]=f.useState(!1),[N,w]=f.useState(!1),[k,E]=f.useState(!1),[v,S]=f.useState(0),[z,B]=f.useState(""),[M,D]=f.useState(""),[A,U]=f.useState(""),[se,P]=f.useState(NN),ne=f.useRef(null);f.useEffect(()=>{const T=window.setTimeout(()=>d(i),300);return()=>window.clearTimeout(T)},[i]);const{items:C,total:I,loading:F,loadingMore:ae,hasMore:Z,loadMore:Q}=qm({q:c}),re=T=>{P(T);try{localStorage.setItem(Xm,T)}catch{}},oe=async T=>{if(!(!T||T.length===0)){E(!0),S(0);for(let te=0;te<T.length;te++){const xe=T[te];try{await $.uploadMedia(xe)}catch(me){G.error(me instanceof Error?me.message:`Nie udaÅo siÄ wgraÄ: ${xe.name}`)}S(Math.round((te+1)/T.length*100))}E(!1),S(0),await a()}},Y=async T=>{confirm(`UsunÄ
Ä "${T.original_name}"?`)&&(await $.deleteMedia(T.id),u(null),await a())},O=async T=>{try{await cm(T),y(!0),setTimeout(()=>y(!1),2e3)}catch{G.error("Nie udaÅo siÄ skopiowaÄ adresu")}},_=async()=>{h&&(await $.updateMedia(h.id,{alt_text:z,caption:M}),u({...h,alt_text:z,caption:M}),await a())},W=async()=>{if(!h||!A.trim())return;const T=[...h.tags||[],A.trim()];await $.updateMedia(h.id,{tags:T}),u({...h,tags:T}),U(""),await a()},de=async T=>{if(!h)return;const te=h.tags.filter(xe=>xe!==T);await $.updateMedia(h.id,{tags:te}),u({...h,tags:te}),await a()},he=T=>{u(T),B(T.alt_text||""),D(T.caption||"")},ve=T=>{T.mime_type.startsWith("image/")&&m(te=>{const xe=new Set(te);return xe.has(T.id)?xe.delete(T.id):xe.add(T.id),xe})},R=T=>{t?ve(T):e&&s?s(T.url):he(T)},ie=async()=>{const T=C.filter(te=>p.has(te.id)&&te.mime_type.startsWith("image/")).map(te=>te.url);if(!(!T.length||!r)){x(!0);try{r(T),m(new Set)}finally{x(!1)}}},ge=n.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[n.jsxs("div",{className:"flex-1 relative",children:[n.jsx(Ms,{size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-news-dim"}),n.jsx("input",{value:i,onChange:T=>l(T.target.value),placeholder:"Szukaj pliku lub tagu...",className:"w-full pl-9 pr-4 py-2 bg-news-surface-2 border border-border rounded-lg text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red"})]}),n.jsx(kN,{value:se,onChange:re}),n.jsxs("button",{type:"button",onClick:()=>{var T;return(T=ne.current)==null?void 0:T.click()},className:"flex items-center gap-2 bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors flex-shrink-0",children:[n.jsx(Li,{size:15}),"Wgraj pliki"]}),n.jsx("input",{ref:ne,type:"file",multiple:!0,accept:"image/*,video/*",className:"hidden",onChange:T=>oe(T.target.files)})]}),H=k?n.jsxs("div",{className:"mb-4 bg-news-surface-2 border border-border rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-sm text-foreground",children:"Wgrywanie plików..."}),n.jsxs("span",{className:"text-sm font-bold text-news-red",children:[v,"%"]})]}),n.jsx("div",{className:"h-2 bg-news-surface-3 rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-news-red rounded-full transition-all",style:{width:`${v}%`}})})]}):null,ce=n.jsx(Km,{scrollRef:o,loading:F,items:C,viewMode:se,selectedId:h==null?void 0:h.id,selectedIds:p,selectionMode:e,multiSelect:t,onItemClick:R,hasMore:Z,loadingMore:ae,loadMore:Q}),ke=c.trim()?`${C.length} z ${I} plików`:`${I}
6 plików`;return n.jsx("div",{className:`flex min-h-0 ${t?"flex-1 flex-col":"h-full gap-6"}`,children:t?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[n.jsx("div",{className:"mb-4",children:ge}),n.jsxs("div",{ref:o,onDragOver:T=>{T.preventDefault(),w(!0)},onDragLeave:()=>w(!1),onDrop:T=>{T.preventDefault(),w(!1),oe(T.dataTransfer.files)},className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar rounded-lg ${N?"ring-2 ring-news-red bg-news-red/5":""}`,children:[H,ce]}),n.jsxs("p",{className:"text-xs text-news-dim flex-shrink-0 mt-2",children:[ke," · kliknij zdjÄcia, aby je zaznaczyÄ"]})]}),p.size>=1&&n.jsxs("div",{className:"flex items-center justify-between gap-3 pt-4 mt-2 border-t border-border flex-shrink-0 bg-news-surface",children:[n.jsxs("span",{className:"text-sm text-news-muted",children:["Zaznaczono: ",n.jsx("strong",{className:"text-foreground",children:p.size})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:()=>m(new Set),className:"px-3 py-2 text-sm text-news-muted hover:text-foreground transition-colors",children:"WyczyÅÄ"}),n.jsxs("button",{type:"button",onClick:ie,disabled:b,className:"flex items-center gap-2 bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50",children:[b?n.jsx(fe,{size:15,className:"animate-spin"}):null,p.size===1?"Wstaw zdjÄcie":`Wstaw ${p.size} zdjÄÄ`]})]})]})]}):n.jsxs("div",{className:"flex h-full gap-6 flex-1 min-h-0",children:[n.jsxs("div",{className:"flex-1 space-y-4 min-h-0 flex flex-col",children:[ge,n.jsxs("div",{ref:o,onDragOver:T=>{T.preventDefault(),w(!0)},onDragLeave:()=>w(!1),onDrop:T=>{T.preventDefault(),w(!1),oe(T.dataTransfer.files)},className:`relative flex-1 min-h-0 overflow-y-auto custom-scrollbar roun
6ded-lg transition-all ${N?"ring-2 ring-news-red bg-news-red/5":""}`,children:[H,ce]}),n.jsxs("p",{className:"text-xs text-news-dim flex-shrink-0",children:[ke," · PrzeciÄ
gnij pliki na siatkÄ, aby wgraÄ"]})]}),h&&n.jsx("div",{className:"w-72 flex-shrink-0 space-y-4",children:n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[h.mime_type.startsWith("image/")?n.jsx(Bt,{variant:"preview",src:h.url,cacheKey:h.created_at,alt:"",className:"w-full aspect-video object-cover"}):n.jsx("div",{className:"w-full aspect-video bg-news-surface-3 flex items-center justify-center",children:n.jsx(wl,{size:32,className:"text-news-dim"})}),n.jsxs("div",{className:"p-4 space-y-3",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("p",{className:"text-sm font-semibold text-foreground break-all",children:h.original_name}),n.jsx("button",{onClick:()=>u(null),className:"text-news-dim hover:text-foreground flex-shrink-0",children:n.jsx(He,{size:16})})]}),n.jsxs("div",{className:"text-xs text-news-muted space-y-1",children:[n.jsxs("p",{children:["Rozmiar: ",n.jsx("span",{className:"text-foreground",children:jN(h.size_bytes)})]}),n.jsxs("p",{children:["Typ: ",n.jsx("span",{className:"text-foreground",children:h.mime_type})]}),n.jsxs("p",{children:["Data:"," ",n.jsx("span",{className:"text-foreground",children:new Date(h.created_at).toLocaleDateString("pl-PL")})]})]}),n.jsxs("button",{onClick:()=>O(h.url),className:"w-full flex items-center justify-center gap-2 py-2 border border-border rounded-lg text-sm text-foreground hover:bg-news-surface-3 transition-colors",children:[g?n.jsx(xn,{size:14,className:"text-green-500"}):n.jsx(vr,{size:14}),g?"Skopiowano!":"Kopiuj URL"]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Tekst alternatywny (SEO)"}),n.jsx("input",{value:z,onChange:T=>B(T.target.value),placeholder:"Opis zdjÄcia...",className:"w-full bg-news-surface-3 border border-border rounded px-2 py-1.5 text-xs text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Podpis"}),n.jsx("textarea",{value:M,onChange:T=>D(T.target.value),rows:2,placeholder:"Podpis pod zdjÄciem...",className:"w-full bg-news-surface-3 border border-border rounded px-2 py-1.5 text-xs text-foreground focus:outline-none focus:border-news-red resize-none"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"text-xs text-news-muted mb-1.5 flex items-center gap-1 block",children:[n.jsx(wa,{size:11})," Tagi"]}),n.jsx("div",{className:"flex gap-1 mb-2 flex-wrap",children:(h.tags||[]).map(T=>n.jsxs("span",{className:"text-xs bg-news-surface-3 text-news-muted px-1.5 py-0.5 rounded-full flex items-center gap-1",children:[T,n.jsx("button",{onClick:()=>de(T),className:"hover:text-destructive",children:"Ã"})]},T))}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:A,onChange:T=>U(T.target.value),onKeyDown:T=>T.key==="Enter"&&W(),placeholder:"Dodaj tag...",className:"flex-1 bg-news-surface-3 border border-border rounded px-2 py-1 text-xs text-foreground focus:outline-none focus:border-news-red"}),n.jsx("button",{onClick:W,className:"px-2 py-1 bg-news-surface-3 border border-border rounded text-xs hover:bg-news-surface-2 transition-colors",children:"+"})]})]}),n.jsxs("div",{className:"flex gap-2 pt-1",children:[n.jsx("button",{onClick:_,className:"flex-1 py-2 bg-news-red text-white rounded-lg text-xs font-semibold hover:bg-news-red-bright transition-colors",children:"Zapisz"}),n.jsx("button",{onClick:()=>Y(h),className:"py-2 px-3 border border-destructive/30 text-destructive rounded-lg text-xs hover:bg-destructive/10 transition-colors",children:n.jsx(qe,{size:13})})]})]})]})})]})})}function Jm({open:e,onClose:t,onAdd:s}){const r=f.useRef(null),[o,a]=f.useState(new Set),[i,l]=f.useState(!1),[c,d]=f.useState(""),[h,u]=f.useState("");f.useEffect(()=>{e&&(a(new Set),d(""),u(""))},[e]),f.useEffect(()=>{const E=window.setTimeout(()=>u(c),300);return()=>window.clearTimeout(E)},[c]);const{items:p,total:m,loading:b,loadingMore:x,hasMore:g,loadMore:y}=qm({q:h,enabled:e});if(!e)return null;const N=o.size,w=E=>{E.mime_type.startsWith("image/")&&a(v=>{const S=new Set(v);return S.has(E.id)?S.delete(E.id):S.add(E.id),S})}
6,k=async()=>{const E=p.filter(v=>o.has(v.id)&&v.mime_type.startsWith("image/"));if(E.length){l(!0);try{await s(E),a(new Set)}finally{l(!1)}}};return n.jsx("div",{className:"fixed inset-0 bg-black/70 z-[60] flex items-center justify-center p-4",children:n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl w-full max-w-2xl max-h-[80vh] flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border flex-shrink-0",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Wybierz zdjÄcia z biblioteki"}),n.jsx("p",{className:"text-xs text-news-muted mt-0.5",children:"Kliknij zdjÄcia, aby je zaznaczyÄ"})]}),n.jsx("button",{type:"button",onClick:t,className:"text-news-muted hover:text-foreground",children:n.jsx(He,{size:20})})]}),n.jsx("div",{className:"px-4 pt-3 flex-shrink-0",children:n.jsxs("div",{className:"relative",children:[n.jsx(Ms,{size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-news-dim"}),n.jsx("input",{value:c,onChange:E=>d(E.target.value),placeholder:"Szukaj pliku lub tagu...",className:"w-full pl-9 pr-4 py-2 bg-news-surface-2 border border-border rounded-lg text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red"})]})}),n.jsx("div",{ref:r,className:"flex-1 overflow-auto p-4 custom-scrollbar min-h-0",children:p.length===0&&!b?n.jsx("p",{className:"text-center text-news-muted py-8",children:"Brak plików w bibliotece."}):n.jsx(Km,{scrollRef:r,items:p,viewMode:"gallery",loading:b,loadingMore:x,hasMore:g,loadMore:y,multiSelect:!0,selectedIds:o,onItemClick:w})}),n.jsx("p",{className:"px-4 pb-2 text-xs text-news-dim flex-shrink-0",children:h.trim()?`${p.length} z ${m} plików`:`${m} plików`}),N>=1&&n.jsxs("div",{className:"flex items-center justify-between gap-3 p-4 border-t border-border flex-shrink-0 bg-news-surface-2",children:[n.jsxs("span",{className:"text-sm text-news-muted",children:["Zaznaczono: ",n.jsx("strong",{className:"text-foreground",children:N})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:()=>a(new Set),className:"px-3 py-2 text-sm text-news-muted hover:text-foreground transition-colors",children:"WyczyÅÄ"}),n.jsxs("button",{type:"button",onClick:k,disabled:i,className:"flex items-center gap-2 bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50",children:[i?n.jsx(fe,{size:15,className:"animate-spin"}):null,N===1?"Dodaj zdjÄcie":`Dodaj ${N} zdjÄÄ`]})]})]})]})})}function SN(){const{articles:e}=Ta({limit:100}),[t,s]=f.useState([]),[r,o]=f.useState(!1),[a,i]=f.useState(null),[l,c]=f.useState(!1),[d,h]=f.useState(""),[u,p]=f.useState(""),[m,b]=f.useState(An),[x,g]=f.useState(null);f.useEffect(()=>{e.length&&!u&&p(e[0].id)},[e,u]);const y=f.useCallback(async()=>{o(!0);try{s(await $.getGalleries())}catch{s([])}o(!1)},[]);f.useEffect(()=>{y()},[y]);const N=async M=>{const A=(await $.getGalleries(M.article_id)).find(U=>U.id===M.id)||M;i(A)},w=async()=>{var D;if(!d.trim()||!u)return;const M=await $.createGallery({title:d,article_id:u,placement:m});if(h(""),y(),m==="inline"){const A=co(M.id);G.success("Galeria utworzona",{description:`Wklej shortcode w treÅci artykuÅu: ${A}`,duration:12e3}),(D=navigator.clipboard)==null||D.writeText(A)}else G.success("Galeria utworzona i przypisana do artykuÅu");i(M)},k=async M=>{confirm("UsunÄ
Ä galeriÄ?")&&(await $.deleteGallery(M),(a==null?void 0:a.id)===M&&i(null),y())},E=async M=>{var A;if(!a)return;let D=((A=a.items)==null?void 0:A.length)||0;for(const U of M)await $.addGalleryItem(a.id,{media_id:U.id,position:D}),D+=1;c(!1),N(a),G.success(M.length===1?"Dodano zdjÄcie do galerii":`Dodano ${M.length} zdjÄÄ do galerii`)},v=async M=>{await $.deleteGalleryItem(M.id),a&&N(a)},S=async(M,D)=>{g(M.id),await $.updateGalleryItem(M.id,{caption:D}),g(null),a&&N(a)},z=M=>{var A;const D=(A=e.find(U=>U.id===M))==null?void 0:A.title;return D?D.length>40?`${D.slice(0,40)}â¦`:D:M},B=async(M,D)=>{const A=await $.updateGallery(M.id,{placement:D});if((a==null?void 0:a.id)===M.id&&i({...a,placement:A.placement}),y(),D==="inline"){const U=co(M.id);G.info(`Shortcode: ${U}`,{duration:8e3})}};return n.jsxs("div",{className:"flex gap-6 h-full",children:[n.jsxs("div",{className:"w-72 flex-shrink-0 space-y-4",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4 space-y-3",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Nowa galeria"}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"TytuÅ"}),n.jsx("input",{value:d,onChange:M=>h(M.target.value),placeholder:"Np. Galeria ze szczytu NATO",className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"ArtykuÅ"}),n.jsx("select",{value:u,onChange:M=>p(M.target.value),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:e.map(M=>n.jsxs("option",{value:M.id,children:[M.title.slice(0,45),M.title.length>45?"â¦":""]},M.id))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Gdzie wyÅwietliÄ"}),n.jsx("select",{value:m,onChange:M=>b(M.target.value),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:Object.entries(Lo).map(([M,D])=>n.jsx("option",{value:M,children:D},M))})]}),n.jsxs("button",{onClick:w,className:"w-full flex items-center justify-center gap-2 bg-news-red text-white py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors",children:[n.jsx(Ft,{size:15}),"Utwórz galeriÄ"]})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[n.jsx("span",{className:"text-sm font-bold text-foreground",children:"Galerie"}),n.jsx("span",{className:"text-xs text-news-muted",children:t.length})]}),r?n.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(M=>n.jsx("div",{className:"h-12 bg-news-surface-3 rounded animate-pulse"},M))}):t.length===0?n.jsxs("div",{className:"p-6 text-center",children:[n.jsx(ws,{size:24,className:"text-news-dim mx-auto mb-2"}),n.jsx("p",{className:"text-xs text-news-muted",children:"Brak galer
6ii"})]}):t.map(M=>n.jsxs("button",{onClick:()=>N(M),className:`w-full flex items-center gap-3 px-4 py-3 border-b border-border last:border-0 text-left transition-colors hover:bg-news-surface-3 ${(a==null?void 0:a.id)===M.id?"bg-news-surface-3":""}`,children:[n.jsx(ws,{size:16,className:"text-news-dim flex-shrink-0"}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:M.title||"Bez tytuÅu"}),n.jsx("p",{className:"text-xs text-news-muted truncate",children:z(M.article_id)})]}),n.jsx(As,{size:14,className:"text-news-dim"})]},M.id))]})]}),a?n.jsxs("div",{className:"flex-1 space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-bold text-foreground",children:a.title||"Galeria bez tytuÅu"}),n.jsxs("p",{className:"text-xs text-news-muted",children:["ArtykuÅ: ",z(a.article_id)]}),n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[n.jsx("label",{className:"text-xs text-news-muted",children:"Pozycja:"}),n.jsx("select",{value:a.placement??An,onChange:M=>B(a,M.target.value),className:"bg-news-surface-3 border border-border rounded px-2 py-1 text-xs text-foreground focus:outline-none focus:border-news-red",children:Object.entries(Lo).map(([M,D])=>n.jsx("option",{value:M,children:D},M))}),(a.placement??An)==="inline"&&n.jsxs("button",{type:"button",onClick:()=>{var D;const M=co(a.id);(D=navigator.clipboard)==null||D.writeText(M),G.success("Skopiowano shortcode do schowka")},className:"inline-flex items-center gap-1 text-xs text-news-red hover:underline",children:[n.jsx(vr,{size:12}),co(a.id)]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-2 bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors",children:[n.jsx(Ft,{size:15}),"Dodaj zdjÄcia"]}),n.jsx("button",{onClick:()=>k(a.id),className:"p-2 border border-destructive/30 text-destructive rounded-lg hover:bg-destructive/10 transition-colors",children:n.jsx(qe,{size:15})})]})]}),!a.items||a.items.length===0?n.jsxs("div",{className:"border-2 border-dashed border-border rounded-lg p-16 text-center",children:[n.jsx(ws,{size:32,className:"text-news-dim mx-auto mb-3"}),n.jsx("p",{className:"text-news-muted font-medium",children:"Galeria jest pusta"})]}):n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:a.items.map(M=>n.jsxs("div",{className:"group relative bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"relative aspect-square",children:[n.jsx(Bt,{src:M.url,cacheKey:M.id,alt:"",className:"w-full h-full object-cover"}),n.jsx("button",{onClick:()=>v(M),className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 p-1.5 bg-destructive rounded transition-opacity",children:n.jsx(He,{size:14,className:"text-white"})})]}),n.jsx("div",{className:"p-2",children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("input",{defaultValue:M.caption||"",onBlur:D=>S(M,D.target.value),placeholder:"Podpis...",className:"flex-1 bg-news-surface-3 border border-border rounded px-2 py-1 text-xs text-foreground focus:outline-none focus:border-news-red"}),x===M.id&&n.jsx(xn,{size:12,className:"text-green-500 flex-shrink-0"})]})})]},M.id))})]}):n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsxs("div",{className:"text-center",children:[n.jsx(ws,{size:40,className:"text-news-dim mx-auto mb-3"}),n.jsx("p",{className:"text-news-muted font-medium",children:"Wybierz galeriÄ z listy"})]})}),n.jsx(Jm,{open:l,onClose:()=>c(!1),onAdd:E})]})}const CN=1,_N=1e6;let ii=0;function TN(){return ii=(ii+1)%Number.MAX_SAFE_INTEGER,ii.toString()}const li=new Map,Ud=e=>{if(li.has(e))return;const t=setTimeout(()=>{li.delete(e),lr({type:"REMOVE_TOAST",toastId:e})},_N);li.set(e,t)},EN=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,CN)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(s=>s.id===t.toast.id?{...s,...t.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=t;
6return s?Ud(s):e.toasts.forEach(r=>{Ud(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===s||s===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(s=>s.id!==t.toastId)}}},So=[];let Co={toasts:[]};function lr(e){Co=EN(Co,e),So.forEach(t=>{t(Co)})}function zN({...e}){const t=TN(),s=o=>lr({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>lr({type:"DISMISS_TOAST",toastId:t});return lr({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:s}}function Zm(){const[e,t]=f.useState(Co);return f.useEffect(()=>(So.push(t),()=>{const s=So.indexOf(t);s>-1&&So.splice(s,1)}),[e]),{...e,toast:zN,dismiss:s=>lr({type:"DISMISS_TOAST",toastId:s})}}const Qm=f.createContext({user:null,isStaff:!1,isEditor:!1,isAdmin:!1,loading:!0,signOut:async()=>{},refresh:async()=>{}}),Yt=!1;function AN({children:e}){const[t,s]=f.useState(null),[r,o]=f.useState(Yt),[a,i]=f.useState(Yt),[l,c]=f.useState(Yt),[d,h]=f.useState(!0),u=f.useCallback(async()=>{try{const{user:m,isStaff:b,isEditor:x,isAdmin:g}=await $.getMe();s(m),o(b||Yt),i(x||Yt),c(g||Yt)}catch(m){const b=m instanceof Error?m.message:"";if(/zbyt wiele|too many/i.test(b))return;s(null),o(Yt),i(Yt),c(Yt)}finally{h(!1)}},[]);f.useEffect(()=>{u()},[u]);const p=async()=>{await $.logout(),s(null),o(Yt),i(Yt),c(Yt)};return n.jsx(Qm.Provider,{value:{user:t,isStaff:r,isEditor:a,isAdmin:l,loading:d,signOut:p,refresh:u},children:e})}const yn=()=>f.useContext(Qm),Hs={admin:{label:"Admin",color:"bg-red-500/20 text-red-400 border-red-500/30",icon:xg},editor:{label:"Redaktor",color:"bg-blue-500/20 text-blue-400 border-blue-500/30",icon:bg},moderator:{label:"Moderator",color:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",icon:kr},user:{label:"Użytkownik",color:"bg-news-surface-3 text-news-muted border-border",icon:bl}},Hd={published:{label:"Opublikowany",color:"text-green-500",icon:Dn},draft:{label:"Szkic",color:"text-news-muted",icon:Xt},scheduled:{label:"Zaplanowany",color:"text-blue-400",icon:Rr}},Gd={display_name:"",email:"",password:"",role:"editor"};function ci({role:e}){const t=Hs[e],s=t.icon;return n.jsxs("span",{className:`inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full border ${t.color}`,children:[n.jsx(s,{size:10}),t.label]})}function MN({status:e}){const t=Hd[e]??Hd.draft,s=t.icon;return n.jsxs("span",{className:`inline-flex items-center gap-1 text-xs ${t.color}`,children:[n.jsx(s,{size:12}),t.label]})}function LN({count:e,onClick:t}){return e===0?n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-news-dim",children:[n.jsx(Xt,{size:12}),"0"]}):n.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1 text-xs text-news-red font-semibold hover:underline transition-colors",title:"Pokaż artykuÅy autora",children:[n.jsx(Xt,{size:12}),e]})}function IN(){const{toast:e}=Zm(),t=Ls(),s=Bl(),{user:r}=yn(),a=(r==null?void 0:r.role)==="admin"||!1,[i,l]=f.useState([]),[c,d]=f.useState(!1),[h,u]=f.useState(""),[p,m]=f.useState(null),[b,x]=f.useState(!1),[g,y]=f.useState(!1),[N,w]=f.useState(Gd),[k,E]=f.useState(!1),[v,S]=f.useState(!1),[z,B]=f.useState(""),[M,D]=f.useState(!1),[A,U]=f.useState(null),[se,P]=f.useState([]),[ne,C]=f.useState(!1),[I,F]=f.useState(0),[ae,Z]=f.useState(null),[Q,re]=f.useState(null),oe=f.useCallback(async()=>{d(!0);try{const T=await $.getUsers();l(T)}catch(T){e({title:"BÅÄ
d Åadowania",description:T instanceof Error?T.message:"Nie udaÅo siÄ pobraÄ użytkowników",variant:"destructive"})}finally{d(!1)}},[e]);f.useEffect(()=>{oe()},[oe]);const Y=(T,te)=>{const xe=me=>me.id===T?{...me,articles_count:Math.max(0,me.articles_count+te)}:me;l(me=>me.map(xe)),m(me=>(me==null?void 0:me.id)===T?xe(me):me),U(me=>(me==null?void 0:me.id)===T?xe(me):me)},O=async T=>{U(T),P([]),F(0),C(!0);try{const te=await $.getUserArticles(T.id,{limit:100});P(te.articles),F(te.total)}catch(te){e({title:"BÅÄ
d Åadowania artykuÅów",description:te instanceof Error?te.message:"Nie udaÅo siÄ pobraÄ listy artykuÅów",variant:"destructive"}),U(null)}finally{C(!1)}},_=()=>{U(null),P([]),re(null)},W=T=>{_(),t(ss("edit-article",T.id))},de=async T=>
6{if(!(T.read_only||T.status==="draft")){Z(T.id);try{const te=await $.getArticle(T.id);await $.updateArticle(T.id,{...te,status:"draft",published_at:null}),P(xe=>xe.map(me=>me.id===T.id?{...me,status:"draft"}:me)),await s(),e({title:"ArtykuÅ ukryty",description:"Status zmieniony na szkic."})}catch(te){e({title:"BÅÄ d",description:te instanceof Error?te.message:"Nie udaÅo siÄ ukryÄ artykuÅu",variant:"destructive"})}finally{Z(null)}}},he=async T=>{if(!T.read_only){Z(T.id);try{await $.deleteArticle(T.id),P(te=>te.filter(xe=>xe.id!==T.id)),F(te=>Math.max(0,te-1)),A&&Y(A.id,-1),await s(),e({title:"ArtykuÅ usuniÄty"})}catch(te){e({title:"BÅÄ d",description:te instanceof Error?te.message:"Nie udaÅo siÄ usunÄ Ä artykuÅu",variant:"destructive"})}finally{Z(null),re(null)}}},ve=T=>T?new Date(T).toLocaleDateString("pl-PL",{day:"2-digit",month:"short",year:"numeric"}):"â",R=async(T,te)=>{x(!0);try{const xe=await $.updateUserRole(T.id,te);l(me=>me.map(at=>at.id===xe.id?xe:at)),m(xe),e({title:"Rola zaktualizowana",description:`${xe.display_name} â ${Hs[te].label}`})}catch(xe){e({title:"BÅÄ d",description:xe instanceof Error?xe.message:"Nie udaÅo siÄ zmieniÄ roli",variant:"destructive"})}finally{x(!1)}},ie=async()=>{const T=["admin","editor","moderator"].includes(N.role);if(!N.display_name.trim()||!N.email.trim()||T&&!N.password.trim()){e({title:"UzupeÅnij wymagane pola",variant:"destructive"});return}E(!0);try{const te=await $.createUser({display_name:N.display_name.trim(),email:N.email.trim(),password:N.password,role:N.role});l(xe=>[te,...xe]),w(Gd),y(!1),e({title:"Użytkownik dodany",description:te.display_name})}catch(te){e({title:"BÅÄ d",description:te instanceof Error?te.message:"Nie udaÅo siÄ dodaÄ użytkownika",variant:"destructive"})}finally{E(!1)}},ge=async T=>{const te=T.display_name||T.email||"użytkownika",xe=T.articles_count>0?` 7 8Użytkownik ma ${T.articles_count} artykuÅów â zostanÄ przypisane do administratora.`:"";if(confirm(`UsunÄ Ä użytkownika â${te}"?${xe}`)){S(!0);try{const me=await $.deleteUser(T.id);l(De=>De.filter(st=>st.id!==T.id)),m(null);const at=me.reassigned>0?` · ${me.reassigned} artykuÅów â ${me.admin_name}`:"";e({title:"Użytkownik usuniÄty",description:`${te}${at}`})}catch(me){e({title:"BÅÄ d",description:me instanceof Error?me.message:"Nie udaÅo siÄ usunÄ Ä użytkownika",variant:"destructive"})}finally{S(!1)}}},H=async T=>{if(z.length<8){e({title:"HasÅo musi mieÄ co najmniej 8 znaków",variant:"destructive"});return}D(!0);try{await $.resetUserPassword(T.id,z),B(""),e({title:"HasÅo zresetowane",description:"Sesje użytkownika zostaÅy unieważnione."})}catch(te){e({title:"BÅÄ d",description:te instanceof Error?te.message:"Nie udaÅo siÄ zresetowaÄ hasÅa",variant:"destructive"})}finally{D(!1)}},ce=T=>!(!a||(r==null?void 0:r.id)===T.id||r!=null&&r.email&&T.email&&r.email.toLowerCase()===T.email.toLowerCase()),ke=i.filter(T=>T.display_name.toLowerCase().includes(h.toLowerCase())||(T.email||"").toLowerCase().includes(h.toLowerCase())||(T.login||"").toLowerCase().includes(h.toLowerCase()));return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4 text-sm text-news-muted",children:["ZarzÄ dzaj użytkownikami portalu â dodawaj konta, przypisuj role i usuwaj użytkowników dodanych rÄcznie. Autorzy zaimportowani z WordPress domyÅlnie majÄ rolÄ ",n.jsx("strong",{className:"text-foreground",children:"Redaktor"}),"."]}),g&&a&&n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4 space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Nowy użytkownik"}),n.jsx("button",{onClick:()=>y(!1),className:"text-news-muted hover:text-foreground",children:n.jsx(He,{size:18})})]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[n.jsx("input",{value:N.display_name,onChange:T=>w(te=>({...te,display_name:T.target.value})),placeholder:"ImiÄ i nazwisko *",className:"px-3 py-2 bg-news-surface border border-border rounded-lg text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red"}),n.jsx("input",{type:"email",value:N.email,onChange:T=>w(te=>({...te,email:T.target.value})),placeholder:"Email *",className:"px-3 py-2 bg-news-surface border border-border rounded-lg text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red"}),n.jsx("input",{type:"password",value:N.password,onChange:T=>w(te=>({...te,password:T.target.value})),placeholder:["admin","editor","moderator"].includes(N.role)?"HasÅo (min. 8 znaków) *":"HasÅo (opcjonalne)",className:"px-3 py-2 bg-news-surface border border-border rounded-lg text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red"}),n.jsx("select",{value:N.role,onChange:T=>w(te=>({...te,role:T.target.value})),className:"px-3 py-2 bg-news-surface border border-border rounded-lg text-sm text-foreground focus:outline-none focus:border-news-red",children:Object.keys(Hs).map(T=>n.jsx("option",{value:T,children:Hs[T].label},T))})]}),n.jsx("p",{className:"text-xs text-news-dim",children:"Role Admin, Redaktor i Moderator otrzymujÄ konto logowania. Rola Użytkownik to tylko profil autora."}),n.jsxs("button",{onClick:ie,disabled:k,className:"inline-flex items-center gap-2 px-4 py-2 bg-news-red text-white rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50",children:[k?n.jsx(fe,{size:14,className:"animate-spin"}):n.jsx(Ft,{size:14}),"Dodaj użytkownika"]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex-1 relative",children:[n.jsx(Ms,{size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-news-dim"}),n.jsx("input",{value:h,onChange:T=>u(T.target.value),placeholder:"Szukaj użytkownika...",className:"w-full pl-9 pr-4 py-2 bg-news-surface-2 border border-border rounded-lg text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red"})]}),a&&n.jsxs("button",{onClick:()=>y(T=>!T),className:"inline-flex items-center gap-1.5 px-3 py-2 bg-news-red text-white rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors",children:[n.jsx(Ft,{size:15}),"Dodaj"]}),n.jsx("button",{onClick:oe,className:"p-2 bg-news-surface-2 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors",children:n.jsx(yl,{size:16,className:c?"animate-spin":""})})]}),n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsx("span",{className:"text-xs text-news-muted",children:"Role:"}),Object.keys(Hs).map(T=>n.jsx(ci,{role:T},T)),n.jsxs("span",{className:"text-xs text-news-muted ml-auto",children:[ke.length," użytkowników"]})]}),n.jsx("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:n.jsxs("table",{className:"w-full",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"border-b border-border bg-news-surface-3",children:[n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider",children:"Użytkownik"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden sm:table-cell",children:"Rola"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden md:table-cell",children:"ArtykuÅy"}),n.jsx("th",{className:"px-4 py-3"})]})}),n.jsx("tbody",{children:c?Array.from({length:5}).map((T,te)=>n.jsxs("tr",{className:"border-b border-border",children:[n.jsx("td",{className:"px-4 py-3",children:n.jsx("div",{className:"h-8 bg-news-surface-3 rounded animate-pulse"})}),n.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:n.jsx("div",{className:"h-6 w-24 bg-news-surface-3 rounded animate-pulse"})}),n.jsx("td",{className:"px-4 py-3 hidden md:table-cell",children:n.jsx("div",{className:"h-4 w-20 bg-news-surface-3 rounded animate-pulse"})}),n.jsx("td",{className:"px-4 py-3"})]},te)):ke.length===0?n.jsx("tr",{children:n.jsxs("td",{colSpan:4,className:"px-4 py-12 text-center",children:[n.jsx(kr,{size:28,className:"text-news-dim mx-auto mb-2"}),n.jsx("p",{className:"text-news-muted",children:"Brak użytkowników"})]})}):ke.map(T=>n.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-news-surface-3 transition-colors",children:[n.jsx("td",{className:"px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-3",children:[T.avatar_url?n.jsx("img",{src:T.avatar_url,alt:"",className:"w-9 h-9 rounded-full object-cover flex-shrink-0"}):n.jsx("div",{className:"w-9 h-9 rounded-full bg-news-red flex items-center justify-center flex-shrink-0",children:n.jsx("span",{className:"text-white text-sm font-bold",children:(T.display_name||T.email||"?")[0].toUpperCase()})}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("p",{className:"text-sm font-medium text-foreground",children:T.display_name}),T.source==="manual"&&n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-news-surface-3 text-news-dim border border-border",children:"rÄczny"})]}),n.jsx("p",{className:"text-xs text-news-muted",children:T.email||T.login})]})]})}),n.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:n.jsx(ci,{role:T.role})}),n.jsx("td",{className:"px-4 py-3 hidden md:table-cell",children:n.jsx(LN,{count:T.articles_count,onClick:()=>O(T)})}),n.jsx("td",{className:"px-4 py-3",children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[ce(T)&&n.jsx("button",{onClick:()=>ge(T),disabled:v,className:"p-1.5 text-news-dim hover:text-red-400 transition-colors",title:"UsuÅ użytkownika",children:n.jsx(qe,{size:15})}),n.jsx("button",{onClick:()=>m(T),className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground hover:border-news-red transition-all",children:"ZarzÄ dzaj"})]})})]},T.id))})]})}),p&&n.jsx("div",{className:"fixed inset-0 bg-black/70 z-50 flex items-center justify-center p-4",children:n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl w-full max-w-md",children:[n.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-news-red flex items-center justify-center overflow-hidden",children:p.avatar_url?n.jsx("img",{src:p.avatar_url,alt:"",className:"w-full h-full object-cover"}):n.jsx("span",{className:"text-white font-bold",children:(p.display_name||"?")[0].toUpperCase()})}),n.jsxs("div",{children:[n.jsx("p",{className:"font-bold text-foreground",children:p.display_name}),n.jsx("p",{className:"text-xs text-news-muted",children:p.email})]})]}),n.jsx("button",{onClick:()=>m(null),className:"text-news-muted hover:text-foreground",children:n.jsx(He,{size:18})})]}),n.jsxs("div",{className:"p-5 space-y-3",children:[n.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Rola w panelu"}),a?["editor","moderator","admin","user"].map(T=>{const te=Hs[T],xe=te.icon,me=p.role===T;return n.jsxs("button",{disabled:b,onClick:()=>R(p,T),className:`w-full flex items-center justify-between p-3 border rounded-lg transition-all ${me?"border-news-red bg-news-red/10":"border-border bg-news-surface-2 hover:border-news-red/50"}`,children:[n.jsxs("div",{className:"flex items-center gap-3 text-left",children:[n.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center border ${te.color}`,children:n.jsx(xe,{size:14})}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-foreground",children:te.label}),n.jsxs("p",{className:"text-xs text-news-muted",children:[T==="editor"&&"Tworzenie i edycja artykuÅów",T==="moderator"&&"Moderacja komentarzy",T==="admin"&&"PeÅny dostÄp do panelu",T==="user"&&"Profil autora bez dostÄpu do panelu"]})]})]}),me?n.jsx(pg,{size:16,className:"text-green-500"}):n.jsx(gg,{size:16,className:"text-news-dim"})]},T)}):n.jsx("p",{className:"text-sm text-news-muted",children:"Tylko administrator może zmieniaÄ role."}),a&&p.has_login&&n.jsxs("div",{className:"pt-3 border-t border-border space-y-2",children:[n.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Reset hasÅa"}),n.jsx("input",{type:"password",value:z,onChange:T=>B(T.target.value),placeholder:"Nowe hasÅo (min. 8 znaków)",className:"w-full bg-news-surface-2 border border-border rounded-lg px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"}),n.jsx("button",{onClick:()=>H(p),disabled:M||z.length<8,className:"text-xs px-3 py-2 bg-news-surface-3 border border-border rounded-lg text-foreground hover:border-news-red transition-colors disabled:opacity-50",children:M?"Zapisywanieâ¦":"Ustaw nowe hasÅo"})]})]}),n.jsxs("div",{className:"p-5 border-t border-border flex items-center justify-between text-xs text-news-muted gap-3",children:[n.jsxs("button",{type:"button",onClick:()=>O(p),disabled:p.articles_count===0,className:"inline-flex items-center gap-1.5 hover:text-news-red transition-colors disabled:opacity-50 disabled:cursor-default disabled:hover:text-news-muted",children:[n.jsx(Xt,{size:12}),n.jsxs("span",{children:[p.articles_count," artykuÅów w bazie",p.articles_count>0&&" â pokaż listÄ"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[ce(p)&&n.jsxs("button",{onClick:()=>ge(p),disabled:v,className:"inline-flex items-center gap-1.5 px-3 py-2 text-red-400 border border-red-500/30 rounded-lg hover:bg-red-500/10 transition-colors disabled:opacity-50",children:[v?n.jsx(fe,{size:14,className:"animate-spin"}):n.jsx(qe,{size:14}),"UsuÅ"]}),n.jsxs("div",{className:"relative",children:[a?n.jsx("select",{value:p.role,onChange:T=>R(p,T.target.value),disabled:b,className:"appearance-none bg-news-surface-2 border border-border rounded-lg pl-3 pr-8 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:Object.keys(Hs).map(T=>n.jsx("option",{value:T,children:Hs[T].label},T))}):n.jsx(ci,{role:p.role}),a&&n.jsx(Mi,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-news-dim pointer-events-none"})]})]})]})]})}),A&&n.jsx("div",{className:"fixed inset-0 bg-black/70 z-[60] flex items-center justify-center p-4",children:n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl w-full max-w-3xl max-h-[85vh] flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border flex-shrink-0",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"ArtykuÅy autora"}),n.jsxs("p",{className:"text-xs text-news-muted mt-0.5",children:[A.display_name," · ",I," artykuÅów"]})]}),n.jsx("button",{onClick:_,className:"text-news-muted hover:text-foreground",children:n.jsx(He,{size:18})})]}),n.jsx("div",{className:"overflow-y-auto flex-1",children:ne?n.jsxs("div",{className:"flex items-center justify-center py-16 gap-2 text-news-muted",children:[n.jsx(fe,{size:18,className:"animate-spin"}),n.jsx("span",{className:"text-sm",children:"Åadowanie artykuÅów..."})]}):se.length===0?n.jsxs("div",{className:"py-16 text-center",children:[n.jsx(Xt,{size:28,className:"text-news-dim mx-auto mb-2"}),n.jsx("p",{className:"text-sm text-news-muted",children:"Brak artykuÅów przypisanych do tego autora"})]}):n.jsxs("table",{className:"w-full",children:[n.jsx("thead",{className:"sticky top-0 bg-news-surface-3 z-10",children:n.jsxs("tr",{className:"border-b border-border",children:[n.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-news-muted uppercase tracking-wider",children:"TytuÅ"}),n.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-news-muted uppercase tracking-wider hidden sm:table-cell",children:"Status"}),n.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-news-muted uppercase tracking-wider hidden md:table-cell",children:"Data"}),n.jsx("th",{className:"px-4 py-2.5 w-36"})]})}),n.jsx("tbody",{children:se.map(T=>n.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-news-surface-2 transition-colors",children:[n.jsx("td",{className:"px-
84 py-3",children:n.jsxs("div",{className:"min-w-0",children:[n.jsxs("a",{href:Cr(T),target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-foreground hover:text-news-red line-clamp-2 inline-flex items-start gap-1",children:[T.title,n.jsx(Ii,{size:11,className:"flex-shrink-0 mt-0.5 opacity-50"})]}),T.read_only&&n.jsx("span",{className:"text-[10px] text-news-dim mt-0.5 block",children:"WordPress (tylko odczyt)"})]})}),n.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:n.jsx(MN,{status:T.status})}),n.jsx("td",{className:"px-4 py-3 hidden md:table-cell",children:n.jsx("span",{className:"text-xs text-news-muted",children:ve(T.published_at??T.created_at)})}),n.jsx("td",{className:"px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-0.5 justify-end",children:[n.jsx("a",{href:Cr(T),target:"_blank",rel:"noopener noreferrer",title:"PodglÄ
d",className:"text-news-muted hover:text-foreground p-1.5 rounded transition-colors",children:n.jsx(At,{size:14})}),n.jsx("button",{type:"button",onClick:()=>W(T),title:T.read_only?"Tylko odczyt (WordPress)":"Edytuj",disabled:T.read_only,className:"text-news-muted hover:text-foreground p-1.5 rounded transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:n.jsx(ya,{size:14})}),n.jsx("button",{type:"button",onClick:()=>de(T),title:T.read_only?"NiedostÄpne (WordPress)":T.status==="draft"?"Już ukryty":"Ukryj (szkic)",disabled:T.read_only||T.status==="draft"||ae===T.id,className:"text-news-muted hover:text-foreground p-1.5 rounded transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:ae===T.id?n.jsx(fe,{size:14,className:"animate-spin"}):n.jsx(bn,{size:14})}),n.jsx("button",{type:"button",onClick:()=>re(T),title:"UsuÅ",disabled:T.read_only||ae===T.id,className:"text-news-muted hover:text-destructive p-1.5 rounded transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:n.jsx(qe,{size:14})})]})})]},T.id))})]})})]})}),Q&&n.jsx("div",{className:"fixed inset-0 z-[70] bg-black/70 flex items-center justify-center p-4",children:n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl max-w-md w-full p-6 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/10 flex items-center justify-center flex-shrink-0",children:n.jsx(qe,{size:18,className:"text-destructive"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"UsuÅ artykuÅ"}),n.jsx("p",{className:"text-xs text-news-muted mt-0.5",children:"Ta operacja jest nieodwracalna"})]})]}),n.jsxs("p",{className:"text-sm text-news-muted",children:["Czy na pewno chcesz usunÄ
Ä artykuÅ"," ",n.jsxs("strong",{className:"text-foreground",children:["â",Q.title,'"']}),"?"]}),n.jsxs("div",{className:"flex gap-3 justify-end",children:[n.jsx("button",{onClick:()=>re(null),className:"px-4 py-2 text-sm text-news-muted bg-news-surface-2 border border-border rounded-lg hover:text-foreground transition-colors",children:"Anuluj"}),n.jsxs("button",{onClick:()=>he(Q),disabled:!!ae,className:"px-4 py-2 text-sm text-white bg-destructive rounded-lg hover:bg-red-700 transition-colors disabled:opacity-50 flex items-center gap-2",children:[ae?n.jsx(fe,{size:14,className:"animate-spin"}):n.jsx(qe,{size:14}),"UsuÅ"]})]})]})})]})}const di={display:"Display",native:"Natywna",sponsored:"Sponsorowany",banner:"Banner"},ui={feed_between:"MiÄdzy artykuÅami (feed)",sidebar:"Sidebar",article_top:"Góra artykuÅu",article_bottom:"DóŠartykuÅu",article_inline:"W treÅci artykuÅu",hero_banner:"Baner pod wyróżnionym (desktop)"},fo={active:{label:"Aktywna",color:"text-green-400 bg-green-500/10 border-green-500/20"},paused:{label:"Wstrzymana",color:"text-yellow-400 bg-yellow-500/10 border-yellow-500/20"},scheduled:{label:"Zaplanowana",color:"text-blue-400 bg-blue-500/10 border-blue-500/20"},expired:{label:"WygasÅa",color:"text-news-muted bg-news-surface-3 border-border"}},Yd={title:"",description:"",image_url:"",mobile_image_url:"",show_on_mobile:!1,target_url:"",ad_type:"display",placement:"sidebar",status:"active",priority:0,budget_total:null,starts_at:null,ends_at:null};function ON(e,t){return e?`${(t/e*100).toFixed(2)}%`:"0%"}function DN(){const[e,t]=f.useState([]),[s,r]=f.useState(!1),[o,a]=f.useState(!1),[i,l]=f.useState(null),[c,d]=f.useState(Yd),[h,u]=f.useState(!1),[p,m]=f.useState(!1),[b,x]=f.useState(!1),[g,y]=f.useState(0),[N,w]=f.useState(0),[k,E]=f.useState("all"),v=f.useRef(null),S=f.useRef(null),z=f.useCallback(async()=>{r(!0);try{t(await $.getAds())}catch{t([])}r(!1)},[]);f.useEffect(()=>{z()},[z]);const B=()=>{d(Yd),l(null),a(!0)},M=_=>
8{d({title:_.title,description:_.description||"",image_url:_.image_url||"",mobile_image_url:_.mobile_image_url||"",show_on_mobile:_.show_on_mobile,target_url:_.target_url,ad_type:_.ad_type,placement:_.placement,status:_.status,priority:_.priority,budget_total:_.budget_total,starts_at:_.starts_at,ends_at:_.ends_at}),l(_),a(!0)},D=async()=>{if(!c.title||!c.target_url)return;if(c.show_on_mobile&&!c.mobile_image_url){G.error("Aby pokazaÄ reklamÄ na homescreen mobile, wgraj grafikÄ mobilnÄ
");return}if(!c.show_on_mobile&&!c.image_url){G.error("Wgraj grafikÄ desktop lub wÅÄ
cz emisjÄ na homescreen mobile");return}const _=!!(c.starts_at||c.ends_at);let W=c.status;c.show_on_mobile&&!_&&W!=="active"&&(W="active",G.info("Reklama mobile bez terminu odâdo: ustawiono status âAktywnaâ")),u(!0);const de={...c,status:W,description:c.description||null,image_url:c.image_url||null,mobile_image_url:c.mobile_image_url||null,show_on_mobile:c.show_on_mobile,budget_total:c.budget_total||null,starts_at:c.starts_at||null,ends_at:c.ends_at||null};try{i?await $.updateAd(i.id,de):await $.createAd(de),G.success(i?"Reklama zapisana":"Reklama utworzona"),a(!1),z()}catch(he){G.error(he instanceof Error?he.message:"Nie udaÅo siÄ zapisaÄ reklamy")}finally{u(!1)}},A=async _=>{const W=_.status==="active"?"paused":"active";await $.updateAd(_.id,{status:W}),z()},U=async _=>{confirm("UsunÄ
Ä reklamÄ?")&&(await $.deleteAd(_),z())},se=async _=>{if(!_.type.startsWith("image/")){G.error("Dozwolone sÄ
tylko pliki graficzne (JPEG, PNG, WebP, GIF)");return}m(!0);try{const W=await $.uploadMedia(_);d(de=>({...de,image_url:W.url})),y(de=>de+1),G.success("Grafika wgrana")}catch(W){G.error(W instanceof Error?W.message:"BÅÄ
d uploadu grafiki")}finally{m(!1),v.current&&(v.current.value="")}},P=_=>{var de;const W=(de=_.target.files)==null?void 0:de[0];W&&se(W)},ne=_=>{var de;_.preventDefault();const W=(de=_.dataTransfer.files)==null?void 0:de[0];W&&se(W)},C=()=>{d(_=>({..._,image_url:""})),v.current&&(v.current.value="")},I=async _=>{if(!_.type.startsWith("image/")){G.error("Dozwolone sÄ
tylko pliki graficzne (JPEG, PNG, WebP, GIF)");return}x(!0);try{const W=await $.uploadMedia(_);d(de=>({...de,mobile_image_url:W.url,show_on_mobile:!0})),w(de=>de+1),G.success("Grafika mobilna wgrana")}catch(W){G.error(W instanceof Error?W.message:"BÅÄ
d uploadu grafiki")}finally{x(!1),S.current&&(S.current.value="")}},F=_=>{var de;const W=(de=_.target.files)==null?void 0:de[0];W&&I(W)},ae=_=>{var de;_.preventDefault();const W=(de=_.dataTransfer.files)==null?void 0:de[0];W&&I(W)},Z=()=>{d(_=>({..._,mobile_image_url:"",show_on_mobile:!1})),S.current&&(S.current.value="")},Q=k==="all"?e:e.filter(_=>_.status===k),re=e.reduce((_,W)=>_+W.impressions,0),oe=e.reduce((_,W)=>_+W.clicks,0),Y=e.reduce((_,W)=>_+(W.budget_spent||0),0),O=e.filter(_=>_.status==="active").length;return n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[{label:"Aktywne reklamy",value:O.toString(),icon:fn,color:"text-green-400"},{label:"WyÅwietlenia",value:re.toLocaleString("pl-PL"),icon:sf,color:"text-blue-400"},{label:"KlikniÄcia",value:oe.toLocaleString("pl-PL"),icon:wg,color:"text-yellow-400"},{label:"Przychód",value:`${Y.toFixed(2)} zÅ`,icon:yg,color:"text-news-red"}].map(_=>{const W=_.icon;return n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(W,{size:16,className:_.color}),n.jsx("span",{className:"text-xs text-news-muted",children:_.label})]}),n.jsx("div",{className:"text-xl font-bold text-foreground",children:_.value})]},_.label)})}),n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsx("div",{className:"flex items-center gap-1 bg-news-surface-2 border border-border rounded-lg p-1",children:["all","active","paused","scheduled","expired"].map(_=>n.jsx("button",{onClick:()=>E(_),className:`text-xs px-3 py-1.5 rounded-md transition-all ${k===_?"bg-news-red text-white":"text-news-muted hover:text-foreground"}`,children:_==="all"?"Wszystkie":fo[_].label},_))}),n.jsx("div",{className:"flex-1"}),n.jsxs("button",{onClick:B,className:"flex items-center gap-2 bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors",children:[n.jsx(Ft,{size:15}),"Nowa reklama"]})]}),n.jsx("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:n.jsxs("table",{className:"w-full",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"border-b border-border bg-news-surface-3",children:[n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider",children:"Reklama"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden sm:table-cell",children:"Typ / Miejsce"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden md:table-cell",children:"Status"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden lg:table-cell",children:"CTR"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden lg:table-cell",children:"Budżet"}),n.jsx("th",{className:"px-4 py-3"})]})}),n.jsx("tbody",{children:s?Array.from({length:4}).map((_,W)=>n.jsxs("tr",{className:"border-b border-border",children:[n.jsx("td",{className:"px-4 py-3",children:n.jsx("div",{className:"h-10 bg-news-surface-3 rounded animate-pulse"})}),n.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:n.jsx("div",{className:"h-6 w-24 bg-news-surface-3 rounded animate-pulse"})}),n.jsx("td",{className:"px-4 py-3 hidden md:table-cell",children:n.jsx("div",{className:"h-5 w-20 bg-news-surface-3 rounded animate-pulse"})}),n.jsx("td",{colSpan:3})]},W)):Q.length===0?n.jsx("tr",{children:n.jsxs("td",{colSpan:6,className:"px-4 py-12 text-center",children:[n.jsx(fn,{size:28,className:"text-news-dim mx-auto mb-2"}),n.jsx("p",{className:"text-news-muted",children:"Brak reklam"}),n.jsx("button",{onClick:B,className:"mt-2 text-news-red text-sm hover:underline",children:"Dodaj pierwszÄ
reklamÄ"})]})}):Q.map(_=>{const W=fo[_.status];return n.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-news-surface-3 transition-colors",children:[n.jsx("td",{className:"px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-3",children:[_.image_url?n.jsx(Bt,{src:_.image_url,cacheKey:_.id,alt:"",className:"w-10 h-8 object-cover rounded flex-shrink-0"}):n.jsx("div",{className:"w-10 h-8 bg-news-surface-3 rounded flex items-center justify-center flex-shrink-0",children:n.jsx(fn,{size:14,className:"text-news-dim"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-sm font-medium text-foreground line-clamp-1",children:_.title}),_.show_on_mobile&&n.jsx("span",{className:"text-[10px] text-news-red font-semibold uppercase tracking-wide",children:"Mobile"}),n.jsx("p",{className:"text-xs text-news-muted truncate",children:_.target_url})]})]})}),n.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:n.jsxs("div",{children:[n.jsx("p",{className:"text-xs font-semibold text-news-red",children:di[_.ad_type]}),n.jsx("p",{className:"text-xs text-news-muted",children:ui[_.placement]})]})}),n.jsx("td",{className:"px-4 py-3 hidden md:table-cell",children:n.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full border ${W.color}`,children:W.label})}),n.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-bold text-foreground",children:ON(_.impressions,_.clicks)}),n.jsxs("p",{className:"text-xs text-news-muted",children:[_.clicks," / ",_.impressions]})]})}),n.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:_.budget_total?n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm text-foreground",children:[(_.budget_spent||0).toFixed(0)," / ",_.budget_total.toFixed(0)," zÅ"]}),n.jsx("div",{className:"h-1 bg-news-surface-3 rounded-full mt-1 overflow-hidden w-20",children:n.jsx("div",{className:"h-full bg-news-red rounded-full",style:{width:`${Math.min(100,(_.budget_spent||0)/_.budget_total*100)}%`}})})]}):n.jsx("span",{className:"text-xs text-news-muted",children:"â"})}),n.jsx("td",{className:"px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{onClick:()=>A(_),className:`p-1.5 rounded transition-colors ${_.status==="active"?"text-green-400 hover:text-yellow-400":"text-news-muted hover:text-green-400"}`,title:_.status==="active"?"Wstrzymaj":"Aktywuj",children:_.status==="active"?n.jsx(At,{size:15}):n.jsx(bn,{size:15})}),n.jsx("button",{onClick:()=>M(_),className:"text-news-muted hover:text-foreground p-1.5 rounded transition-colors",children:n.jsx(ya,{size:15})}),n.jsx("button",{onClick:()=>U(_.id),className:"text-news-muted hover:text-destructive p-1.5 rounded transition-colors",children:n.jsx(qe,{size:15})})]})})]},_.id)})})]})}),o&&n.jsx("div",{className:"fixed inset-0 bg-black/70 z-50 flex items-center justify-center p-4",children:n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl w-full max-w-lg max-h-[90vh] overflow-auto",children:[n.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border sticky top-0 bg-news-surface z-10",children:[n.jsx("h3",{className:"font-bold text-foreground",children:i?"Edytuj reklamÄ":"Nowa reklama"}),n.jsx("button",{onClick:()=>a(!1),className:"text-news-muted hover:text-foreground",children:n.jsx(He,{size:20})})]}),n.jsxs("div",{className:"p-5 space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"TytuÅ *"}),n.jsx("input",{value:c.title,onChange:_=>d(W=>({...W,title:_.target.value})),placeholder:"Np. Banner górny â Klient ABC",className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"URL docelowy *"}),n.jsx("input",{value:c.target_url,onChange:_=>d(W=>({...W,target_url:_.target.value})),placeholder:"https://...",className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"Grafika reklamy (desktop)"}),c.image_url?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"relative rounded-lg border border-border overflow-hidden bg-news-surface-2",children:[n.jsx(Bt,{src:c.image_url,cacheKey:g||(i==null?void 0:i.id),alt:"PodglÄ
d reklamy",className:"w-full max-h-40 object-contain"}),p&&n.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:n.jsx(fe,{size:24,className:"animate-spin text-white"})})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{type:"button",onClick:()=>{var _;return(_=v.current)==null?void 0:_.click()},disabled:p,className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors disabled:opacity-50",children:"ZmieÅ grafikÄ"}),n.jsx("button",{type:"button",onClick:C,disabled:p,className:"text-xs px-3 py-1.5 border border-destructive/30 text-destructive rounded-lg hover:bg-destructive/10 transition-colors disabled:opacity-50",children:"UsuÅ"})]})]}):n.jsxs("div",{onDragOver:_=>_.preventDefault(),onDrop:ne,onClick:()=>{var _;
8return!p&&((_=v.current)==null?void 0:_.click())},className:`border-2 border-dashed border-border rounded-lg p-6 text-center transition-colors ${p?"opacity-60 cursor-wait":"cursor-pointer hover:border-news-red group"}`,children:[p?n.jsx(fe,{size:24,className:"animate-spin text-news-red mx-auto mb-2"}):n.jsx(Li,{size:24,className:"text-news-dim mx-auto mb-2 group-hover:text-news-red transition-colors"}),n.jsx("p",{className:"text-sm font-medium text-news-muted group-hover:text-foreground transition-colors",children:p?"Wgrywanie...":"Kliknij lub przeciÄ
gnij grafikÄ"}),n.jsx("p",{className:"text-xs text-news-dim mt-1",children:"JPEG, PNG, WebP, GIF · max 20 MB"})]}),n.jsx("input",{ref:v,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",className:"hidden",onChange:P}),n.jsxs("div",{className:"mt-2",children:[n.jsx("label",{className:"text-xs text-news-dim mb-1 block",children:"lub wklej URL grafiki"}),n.jsx("input",{value:c.image_url||"",onChange:_=>d(W=>({...W,image_url:_.target.value})),placeholder:"https://...",className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 space-y-3 bg-news-surface-2/50",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"Baner homescreen (mobile)"}),n.jsxs("p",{className:"text-[11px] text-news-dim mb-2 leading-snug",children:["Baner pod menu kategorii na stronie gÅównej mobile. Wystarczy wgraÄ grafikÄ, zaznaczyÄ emisjÄ i ustawiÄ priorytet â ",n.jsx("strong",{className:"text-news-muted font-medium",children:"termin odâdo jest opcjonalny"}),". Wyższy priorytet = czÄÅciej przy scrollu (np. 10 vs 5 â ok. 2à wiÄcej wyÅwietleÅ reklamy z wyższym priorytetem)."]})]}),c.mobile_image_url?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"relative rounded-lg border border-border overflow-hidden",children:[n.jsx(Bt,{src:c.mobile_image_url,cacheKey:N||`${i==null?void 0:i.id}-mobile`,alt:"PodglÄ
d reklamy mobilnej",className:"w-full max-h-[90px] object-contain"}),b&&n.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:n.jsx(fe,{size:24,className:"animate-spin text-white"})})]}),n.jsxs("div",{className:"flex gap-2 flex-wrap",children:[n.jsx("button",{type:"button",onClick:()=>{var _;return(_=S.current)==null?void 0:_.click()},disabled:b,className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors disabled:opacity-50",children:"ZmieÅ grafikÄ"}),n.jsx("button",{type:"button",onClick:Z,disabled:b,className:"text-xs px-3 py-1.5 border border-destructive/30 text-destructive rounded-lg hover:bg-destructive/10 transition-colors disabled:opacity-50",children:"UsuÅ"})]})]}):n.jsxs("div",{onDragOver:_=>_.preventDefault(),onDrop:ae,onClick:()=>{var _;return!b&&((_=S.current)==null?void 0:_.click())},className:`border-2 border-dashed border-border rounded-lg p-4 text-center transition-colors ${b?"opacity-60 cursor-wait":"cursor-pointer hover:border-news-red group"}`,children:[b?n.jsx(fe,{size:20,className:"animate-spin text-news-red mx-auto mb-2"}):n.jsx(Li,{size:20,className:"text-news-dim mx-auto mb-2 group-hover:text-news-red transition-colors"}),n.jsx("p",{className:"text-xs font-medium text-news-muted group-hover:text-foreground transition-colors",children:b?"Wgrywanie...":"Wgraj baner mobilny"}),n.jsx("p",{className:"text-[11px] text-news-dim mt-1",children:"Szeroki format · max 90px wys. na stronie"})]}),n.jsx("input",{ref:S,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",className:"hidden",onChange:F}),n.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:c.show_on_mobile,disabled:!c.mobile_image_url,onChange:_=>d(W=>({...W,show_on_mobile:_.target.checked,status:_.target.checked&&!W.starts_at&&!W.ends_at?"active":W.status})),className:"mt-0.5 rounded border-border"}),n.jsxs("span",{className:"text-sm text-foreground",children:["Pokaż na homescreen mobile",!c.mobile_image_url&&n.jsx("span",{className:"block text-[11px] text-news-dim font-normal",children:"Najpierw wgraj grafikÄ mobilnÄ
"}),c.show_on_mobile&&!c.starts_at&&!c.ends_at&&n.jsx("span",{className:"block text-[11px] text-news-dim font-normal",children:"Bez terminu odâdo: ustaw status âAktywnaâ i wybierz priorytet poniżej"})]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"Opis (opcjonalny)"}),n.jsx("textarea",{value:c.description||"",onChange:_=>d(W=>({...W,description:_.target.value})),rows:2,placeholder:"Krótki opis reklamy natywnej...",className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red resize-none"})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"Typ"}
8),n.jsx("select",{value:c.ad_type,onChange:_=>d(W=>({...W,ad_type:_.target.value})),className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:Object.keys(di).map(_=>n.jsx("option",{value:_,children:di[_]},_))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"Status"}),n.jsx("select",{value:c.status,onChange:_=>d(W=>({...W,status:_.target.value})),className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:Object.keys(fo).map(_=>n.jsx("option",{value:_,children:fo[_].label},_))})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"Miejsce wyÅwietlania"}),n.jsx("select",{value:c.placement,onChange:_=>d(W=>({...W,placement:_.target.value})),className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:Object.keys(ui).map(_=>n.jsx("option",{value:_,children:ui[_]},_))}),n.jsx("p",{className:"text-[11px] text-news-dim mt-1.5 leading-snug",children:"Wiele aktywnych reklam w tym samym miejscu zmienia siÄ co 10 s na stronie oraz przy kolejnej wizycie."})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"Budżet caÅkowity (zÅ)"}),n.jsx("input",{type:"number",value:c.budget_total||"",onChange:_=>d(W=>({...W,budget_total:_.target.value?parseFloat(_.target.value):null})),placeholder:"np. 5000",className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:"Priorytet"}),n.jsx("input",{type:"number",value:c.priority,onChange:_=>d(W=>({...W,priority:parseInt(_.target.value,10)||0})),className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"}),c.show_on_mobile&&n.jsx("p",{className:"text-[11px] text-news-dim mt-1 leading-snug",children:"Im wyższy priorytet, tym czÄÅciej reklama pojawia siÄ przy scrollu feedu mobile."})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:["Start ",n.jsx("span",{className:"font-normal text-news-dim",children:"(opcjonalnie)"})]}),n.jsx("input",{type:"datetime-local",value:c.starts_at?c.starts_at.slice(0,16):"",onChange:_=>d(W=>({...W,starts_at:_.target.value?new Date(_.target.value).toISOString():null})),className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"text-xs font-semibold text-news-muted mb-1 block",children:["Koniec ",n.jsx("span",{className:"font-normal text-news-dim",children:"(opcjonalnie)"})]}),n.jsx("input",{type:"datetime-local",value:c.ends_at?c.ends_at.slice(0,16):"",onChange:_=>d(W=>({...W,ends_at:_.target.value?new Date(_.target.value).toISOString():null})),className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]})]})]}),n.jsxs("div",{className:"p-5 pt-0 flex gap-3",children:[n.jsx("button",{onClick:()=>a(!1),className:"flex-1 py-2.5 border border-border rounded-lg text-sm text-news-muted hover:text-foreground transition-colors",children:"Anuluj"}),n.jsxs("button",{onClick:D,disabled:h||!c.title||!c.target_url,className:"flex-1 flex items-center justify-center gap-2 py-2.5 bg-news-red text-white rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50",children:[h?n.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):n.jsx(xn,{size:15}),i?"Zapisz zmiany":"Utwórz reklamÄ"]})]})]})})]})}var $o=(e,t)=>{if(e==="slot")return 0;if(e instanceof Function)return e(t);const{children:s,...r}=t??{};if(e==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,s]}
vendor: 9,796 bytes, lines 8-33
8,PN=/^\s*>\s$/,RN=kt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return $o("blockquote",{...Ze(this.options.HTMLAttributes,e),children:$o("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const s=">",r=[];return e.content.forEach(o=>{const l=t.renderChildren([o]).split(` 9`).map(c=>c.trim()===""?s:`${s} ${c}`);r.push(l.join(` 10`))}),r.join(` 11${s} 12`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ln({find:PN,type:this.type})]}}),$N=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,BN=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,FN=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,WN=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,UN=Bn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return $o("strong",{...Ze(this.options.HTMLAttributes,e),children:$o("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[In({find:$N,type:this.type}),In({find:FN,type:this.type})]},addPasteRules(){return[hn({find:BN,type:this.type}),hn({find:WN,type:this.type})]}}),HN=/(^|[^`])`([^`]+)`(?!`)$/,GN=/(^|[^`])`([^`]+)`(?!`)/g,YN=Bn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Ze(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[In({find:HN,type:this.type})]},addPasteRules(){return[hn({find:GN,type:this.type})]}}),fi=4,VN=/^```([a-z]+)?[\s\n]$/,KN=/^~~~([a-z]+)?[\s\n]$/,qN=kt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:fi,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:s}=this.options;if(!s)return null;const a=[...((t=e.firstElementChild)==null?void 0:t.classList)||[]].filter(i=>i.startsWith(s)).map(i=>i.replace(s,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",Ze(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var s;return((s=e.raw)==null?void 0:s.startsWith("```"))===!1&&e.codeBlockStyle!=="indented"?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var s;let r="";const o=((s=e.attrs)==null?void 0:s.language)||"";return e.content?r=[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join(` 13`):r=`\`\`\`${o} 14 15\`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,s=t.pos===1;return!e||t.parent.type.name!==this.name?!1:s||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const s=(t=this.options.tabSize)!=null?t:fi,{state:r}=e,{selection:o}=r,{$from:a,empty:i}=o;if(a.parent.type!==this.type)return!1;const l=" ".repeat(s);return i?e.commands.insertContent(l):e.commands.command(({tr:c})=>{const{from:d,to:h}=o,m=r.doc.textBetween(d,h,` 16`,` 17`).split(` 18`).map(b=>l+b).join(` 19`);return c.replaceWith(d,h,r.schema.text(m)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const s=(t=this.options.tabSize)!=null?t:fi,{state:r}=e,{selection:o}=r,{$from:a,empty:i}=o;return a.parent.type!==this.type?!1:i?e.commands.command(({tr:l})=>{var c;const{pos:d}=a,h=a.start(),u=a.end(),m=r.doc.textBetween(h,u,` 20`,` 21`).split(` 22`);let b=0,x=0;const g=d-h;for(let v=0;v<m.length;v+=1){if(x+m[v].length>=g){b=v;break}x+=m[v].length+1}const N=((c=m[b].match(/^ */))==null?void 0:c[0])||"",w=Math.min(N.length,s);if(w===0)return!0;let k=h;for(let v=0;v<b;v+=1)k+=m[v].length+1;return l.delete(k,k+w),d-k<=w&&l.setSelection(un.create(l.doc,k)),!0}):e.commands.command(({tr:l})=>{const{from:c,to:d}=o,p=r.doc.textBetween(c,d,` 23`,` 24`).split(` 25`).map(m=>{var b;const x=((b=m.match(/^ */))==null?void 0:b[0])||"",g=Math.min(x.length,s);return m.slice(g)}).join(` 26`);return l.replaceWith(c,d,r.schema.text(p)),!0})},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:s}=t,{$from:r,empty:o}=s;if(!o||r.parent.type!==this.type)return!1;const a=r.parentOffset===r.parent.nodeSize-2,i=r.parent.textContent.endsWith(` 27 28`);return!a||!i?!1:e.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:s,doc:r}=t,{$from:o,empty:a}=s;if(!a||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const l=o.after();return l===void 0?!1:r.nodeAt(l)?e.commands.command(({tr:d})=>(d.setSelection(br.near(r.resolve(l))),!0)):e.commands.exitCode()}}},addInputRules(){return[zi({find:VN,type:this.type,getAttributes:e=>({language:e[1]})}),zi({find:KN,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Jt({key:new cs("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const s=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,a=o==null?void 0:o.mode;if(!s||!a)return!1;const{tr:i,schema:l}=e.state,c=l.text(s.replace(/\r\n?/g,` 29`));return i.replaceSelectionWith(this.type.create({language:a},c)),i.selection.$from.parent.type!==this.type&&i.setSelection(un.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),e.dispatch(i),!0}}})]}}),XN=kt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` 30 31`):""}),JN=kt.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Ze(this.options.HTMLAttributes,e)]},renderText(){return` 32`},renderMarkdown:()=>` 33`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:s,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:o,storedMarks:a}=s;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:l}=r.extensionManager,c=a||o.$to.parentOffset&&o.$from.marks();return t().insertContent({type:this.name}).command(({tr:d,dispatch:h})=>{if(h&&c&&i){const u=c.filter(p=>l.includes(p.type.name));d.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ZN=kt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Ze(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var s;const r=(s=e.attrs)!=null&&s.level?parseInt(e.attrs.level,10):1,o="#".repeat(r);return e.content?`${o} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>zi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}}
33)\\s$`),type:this.type,getAttributes:{level:e}}))}}),QN=kt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Ze(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!Np(t,t.schema.nodes[this.name]))return!1;const{selection:s}=t,{$to:r}=s,o=e();return Iu(s)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:a,tr:i,dispatch:l})=>{if(l){const{$to:c}=i.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?i.setSelection(un.create(i.doc,c.pos+1)):c.nodeAfter.isBlock?i.setSelection(gl.create(i.doc,c.pos)):i.setSelection(un.create(i.doc,c.pos));else{const h=a.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,u=h==null?void 0:h.create();u&&(i.insert(d,u),i.setSelection(un.create(i.doc,d+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Ou({find:/^(?:---|â-|___\s|\*\*\*\s)$/,type:this.t
vendor: 1,036 bytes, line 33
33ype})]}}),ek=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,tk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,sk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,nk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,rk=Bn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Ze(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[In({find:ek,type:this.t
33ype}),In({find:sk,type:this.type})]},addPasteRules(){return[hn({find:tk,type:this.type}),hn({find:nk,type:this.type})]}});const ok="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yac
33hts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",ak="ελ1Ï 2бг1ел3деÑи4еÑ2каÑолик6ом3мкд2он1Ñква6онлайн5Ñг3ÑÑÑ2Ñ2ÑайÑ3Ñб3ÑкÑ3Òаз3Õ°Õ¡Õµ3×שר××5×§××3Ø§Ø¨ÙØ¸Ø¨Ù5را٠ÙÙ5ÙØ§Ø±Ø¯Ù4Ø¨ØØ±ÙÙ5جزائر5Ø³Ø¹ÙØ¯ÙØ©6عÙÙØ§Ù5٠غرب5٠ارات5ÛØ±Ø§Ù5بارت2زار4ÙØªÙ3ھارت5تÙÙØ³4Ø³ÙØ¯Ø§Ù3Ø±ÙØ©5Ø´Ø¨ÙØ©4عراÙ2ب2٠اÙ4ÙÙØ³Ø·ÙÙ6ÙØ·Ø±3ÙØ§Ø«ÙÙÙÙ6ÙÙ 3٠صر2ÙÙØ³Ùا5ÙØ±ÙتاÙÙØ§7ÙØ¹4Ù٠راÙ5پاکستاÙ7ÚØ§Ø±Øª4à¤à¥à¤®3नà¥à¤3à¤à¤¾à¤°à¤¤0मà¥3à¥à¤¤5सà¤à¤à¤ न5বাà¦à¦²à¦¾5à¦à¦¾à¦°à¦¤2ৰত4à¨à¨¾à¨°à¨¤4àªàª¾àª°àª¤4à¬à¬¾à¬°à¬¤4à®à®¨à¯à®¤à®¿à®¯à®¾6லà®à¯à®à¯6à®à®¿à®à¯à®à®ªà¯à®ªà¯à®°à¯11à°à°¾à°°à°¤à±5à²à²¾à²°à²¤4à´à´¾à´°à´¤à´5à¶½à¶à¶à·4à¸à¸à¸¡3à¹à¸à¸¢3ລາວ3áá2ã¿ããª3ã¢ãã¾ã³4ã¯ã©ã¦ã4ã°ã¼ã°ã«4ã³ã 2ã¹ãã¢3ã»ã¼ã«3ãã¡ãã·ã§ã³6ãã¤ã³ã4ä¸ç2ä¸ä¿¡1å½1å1æç½3äºé©¬é3ä¼ä¸2ä½å±±2ä¿¡æ¯2å¥åº·2å «å¦2å ¬å¸1ç2å°æ¹¾1ç£2åå1åº1æ 2åé0大é åº5å¨çº¿2大æ¿2天主æ3娱ä¹2å®¶é»2广ä¸2å¾®å2æ å2æç±ä½ 3ææº2æè2æ¿å¡1åº2æ°å å¡2é»2æ¶å°2æ¸ç±2æºæ2淡马é¡3游æ2æ¾³é2ç¹ç2ç§»å¨2ç»ç»æºæ4ç½å1åº1ç«1ç»2èé2è°·æ2è´ç©2é販2éå¢2é»è¨çç§4é£å©æµ¦3é£å2é¤å 2馿 ¼éæ3港2ë·ë·1ì»´2ì¼ì±2íêµ2",Qi="numeric",el="ascii",tl="alpha",cr="asciinumeric",or="alphanumeric",sl="domain",eh="emoji",ik="scheme",lk="slashscheme",mi="whitespace";function ck(e,t){return e in t||(t[e]=[]),t[e]}function dn(e,t,s){t[Qi]&&(t[cr]=!0,t[or]=!0),t[el]&&(t[cr]=!0,t[tl]=!0),t[cr]&&(t[or]=!0),t[tl]&&(t[or]=!0),t[or]&&(t[sl]=!0),t[eh]&&(t[sl]=!0);for(const r in t){const o=ck(r,s);o.indexOf(e)<0&&o.push(e)}}function dk(e,t){const s={};for(const r in t)t[r].indexOf(e)>=0&&(s[r]=!0);return s}function Et(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Et.groups={};Et.prototype={accepts(){return!!this.t},go(e){const t=this,s=t.j[e];if(s)return s;for(let r=0;r<t.jr.length;r++){const o=t.jr[r][0],a=t.jr[r][1];if(a&&o.test(e))return a}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,s,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,s,r)},tr(e,t,s,r){r=r||Et.groups;let o;return t&&t.j?o=t:(o=new Et(t),s&&r&&dn(t,s,r)),this.jr.push([e,o]),o},ts(e,t,s,r){let o=this;const a=e.length;if(!a)return o;for(let i=0;i<a-1;i++)o=o.tt(e[i]);return o.tt(e[a-1],t,s,r)},tt(e,t,s,r){r=r||Et.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const a=t;let i,l=o.go(e);if(l?(i=new Et,Object.assign(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new Et,a){if(r)if(i.t&&typeof i.t=="string"){const c=Object.assign(dk(i.t,r),s);dn(a,c,r)}else s&&dn(a,s,r);i.t=a}return o.j[e]=i,i}};const Se=(e,t,s,r,o)=>e.ta(t,s,r,o),Ve=(e,t,s,r,o)=>e.tr(t,s,r,o),Vd=(e,t,s,r,o)=>e.ts(t,s,r,o),q=(e,t,s,r,o)=>e.tt(t,s,r,o),Es="WORD",nl="UWORD",th="ASCIINUMERICAL",sh="ALPHANUMERICAL",zr="LOCALHOST",rl="TLD",ol="UTLD",_o="SCHEME",Tn="SLASH_SCHEME",Ql="NUM",al="WS",ec="NL",dr="OPENBRACE",ur="CLOSEBRACE",Bo="OPENBRACKET",Fo="CLOSEBRACKET",Wo="OPENPAREN",Uo="CLOSEPAREN",Ho="OPENANGLEBRACKET",Go="CLOSEANGLEBRACKET",Yo="FULLWIDTHLEFTPAREN",Vo="FULLWIDTHRIGHTPAREN",Ko="LEFTCORNERBRACKET",qo="RIGHTCORNERBRACKET",Xo="LEFTWHITECORNERBRACKET",Jo="RIGHTWHITECORNERBRACKET",Zo="FULLWIDTHLESSTHAN",Qo="FULLWIDTHGREATERTHAN",ea="AMPERSAND",ta="APOSTROPHE",sa="ASTERISK",Gs="AT",na="BACKSLASH",ra="BACKTICK",oa="CARET",qs="COLON",tc="COMMA",aa="DOLLAR",gs="DOT",ia="EQUALS",sc="EXCLAMATION",Kt="HYPHEN",fr="PERCENT",la="PIPE",ca="PLUS",da="POUND",mr="QUERY",nc="QUOTE",nh="FULLWIDTHMIDDLEDOT",rc="SEMI",xs="SLASH",hr="TILDE",ua="UNDERSCORE",rh="EMOJI",fa="SYM";var oh=Object.freeze({__proto__:null,ALPHANUMERICAL:sh,AMPERSAND:ea,APOSTROPHE:ta,ASCIINUMERICAL:th,ASTERISK:sa,AT:Gs,BACKSLASH:na,BACKTICK:ra,CARET:oa,CLOSEANGLEBRACKET:Go,CLOSEBRACE:ur,CLOSEBRACKET:Fo,CLOSEPAREN:Uo,COLON:qs,COMMA:tc,DOLLAR:aa,DOT:gs,EMOJI:rh,EQUALS:ia,EXCLAMATION:sc,FULLWIDTHGREATERTHAN:Qo,FULLWIDTHLEFTPAREN:Yo,FULLWIDTHLESSTHAN:Zo,FULLWIDTHMIDDLEDOT:nh,FULLWIDTHRIGHTPAREN:Vo,HYPHEN:Kt,LEFTCORNERBRACKET:Ko,LEFTWHITECORNERBRACKET:Xo,LOCALHOST:zr,NL:ec,NUM:Ql,OPENANGLEBRACKET:Ho,OPENBRACE:dr,OPENBRACKET:Bo,OPENPAREN:Wo,PERCENT:fr,PIPE:la,PLUS:ca,POUND:da,QUERY:mr,QUOTE:nc,RIGHTCORNERBRACKET:qo,RIGHTWHITECORNERBRACKET:Jo,SCHEME:_o,SEMI:rc,SLASH:xs,SLASH_SCHEME:Tn,SYM:fa,TILDE:hr,TLD:rl,UNDERSCORE:ua,UTLD:ol,UWORD:nl,WORD:Es,WS:al});const _s=/[a-z]/,tr=new RegExp("\\p{L}","u"),hi=new RegExp("\\p{Emoji}","u"),Ts=/\d/,pi=/\s/,Kd="\r",gi=` 34`,uk="ï¸",fk="â",xi="";let mo=null,ho=null;function mk(e=[]){const t={};Et.groups=t;const s=new Et;mo==null&&(mo=qd(ok)),ho==null&&(ho=qd(ak)),q(s,"'",ta),q(s,"{",dr),q(s,"}",ur),q(s,"[",Bo),q(s,"]",Fo),q(s,"(",Wo),q(s,")",Uo),q(s,"<",Ho),q(s,">",Go),q(s,"ï¼",Yo),q(s,"ï¼",Vo),q(s,"ã",Ko),q(s,"ã",qo),q(s,"ã",Xo),q(s,"ã",Jo),q(s,"ï¼",Zo),q(s,"ï¼",Qo),q(s,"&",ea),q(s,"*",sa),q(s,"@",Gs),q(s,"`",ra),q(s,"^",oa),q(s,":",qs),q(s,",",tc),q(s,"$",aa),q(s,".",gs),q(s,"=",ia),q(s,"!",sc),q(s,"-",Kt),q(s,"%",fr),q(s,"|",la),q(s,"+",ca),q(s,"#",da),q(s,"?",mr),q(s,'"',nc),q(s,"/",xs),q(s,";",rc),q(s,"~",hr),q(s,"_",ua),q(s,"\\",na),q(s,"ã»",nh);const r=Ve(s,Ts,Ql,{[Qi]:!0});Ve(r,Ts,r);const o=Ve(r,_s,th,{[cr]:!0}),a=Ve(r,tr,sh,{[or]:!0}),i=Ve(s,_s,Es,{[el]:!0});Ve(i,Ts,o),Ve(i,_s,i),Ve(o,Ts,o),Ve(o,_s,o);const l=Ve(s,tr,nl,{[tl]:!0});Ve(l,_s),Ve(l,Ts,a),Ve(l,tr,l),Ve(a,Ts,a),Ve(a,_s),Ve(a,tr,a);const c=q(s,gi,ec,{[mi]:!0}),d=q(s,Kd,al,{[mi]:!0}),h=Ve(s,pi,al,{[mi]:!0});q(s,xi,h),q(d,gi,c),q(d,xi,h),Ve(d,pi,h),q(h,Kd),q(h,gi),Ve(h,pi,h),q(h,xi,h);
vendor: 10,544 bytes, lines 34-37
34const u=Ve(s,hi,rh,{[eh]:!0});q(u,"#"),Ve(u,hi,u),q(u,uk,u);const p=q(u,fk);q(p,"#"),Ve(p,hi,u);const m=[[_s,i],[Ts,o]],b=[[_s,null],[tr,l],[Ts,a]];for(let x=0;x<mo.length;x++)Ws(s,mo[x],rl,Es,m);for(let x=0;x<ho.length;x++)Ws(s,ho[x],ol,nl,b);dn(rl,{tld:!0,ascii:!0},t),dn(ol,{utld:!0,alpha:!0},t),Ws(s,"file",_o,Es,m),Ws(s,"mailto",_o,Es,m),Ws(s,"http",Tn,Es,m),Ws(s,"https",Tn,Es,m),Ws(s,"ftp",Tn,Es,m),Ws(s,"ftps",Tn,Es,m),dn(_o,{scheme:!0,ascii:!0},t),dn(Tn,{slashscheme:!0,ascii:!0},t),e=e.sort((x,g)=>x[0]>g[0]?1:-1);for(let x=0;x<e.length;x++){const g=e[x][0],N=e[x][1]?{[ik]:!0}:{[lk]:!0};g.indexOf("-")>=0?N[sl]=!0:_s.test(g)?Ts.test(g)?N[cr]=!0:N[el]=!0:N[Qi]=!0,Vd(s,g,g,N)}return Vd(s,"localhost",zr,{ascii:!0}),s.jd=new Et(fa),{start:s,tokens:Object.assign({groups:t},oh)}}function ah(e,t){const s=hk(t.replace(/[A-Z]/g,l=>l.toLowerCase())),r=s.length,o=[];let a=0,i=0;for(;i<r;){let l=e,c=null,d=0,h=null,u=-1,p=-1;for(;i<r&&(c=l.go(s[i]));)l=c,l.accepts()?(u=0,p=0,h=l):u>=0&&(u+=s[i].length,p++),d+=s[i].length,a+=s[i].length,i++;a-=u,i-=p,d-=u,o.push({t:h.t,v:t.slice(a-d,a),s:a-d,e:a})}return o}function hk(e){const t=[],s=e.length;let r=0;for(;r<s;){let o=e.charCodeAt(r),a,i=o<55296||o>56319||r+1===s||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(i),r+=i.length}return t}function Ws(e,t,s,r,o){let a;const i=t.length;for(let l=0;l<i-1;l++){const c=t[l];e.j[c]?a=e.j[c]:(a=new Et(r),a.jr=o.slice(),e.j[c]=a),e=a}return a=new Et(s),a.jr=o.slice(),e.j[t[i-1]]=a,a}function qd(e){const t=[],s=[];let r=0,o="0123456789";for(;r<e.length;){let a=0;for(;o.indexOf(e[r+a])>=0;)a++;if(a>0){t.push(s.join(""));for(let i=parseInt(e.substring(r,r+a),10);i>0;i--)s.pop();r+=a}else s.push(e[r]),r++}return t}const Ar={defaultProtocol:"http",events:null,format:Xd,formatHref:Xd,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function oc(e,t=null){let s=Object.assign({},Ar);e&&(s=Object.assign(s,e instanceof oc?e.o:e));const r=s.ignoreTags,o=[];for(let a=0;a<r.length;a++)o.push(r[a].toUpperCase());this.o=s,t&&(this.defaultRender=t),this.ignoreTags=o}oc.prototype={o:Ar,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,s){const r=t!=null;let o=this.o[e];return o&&(typeof o=="object"?(o=s.t in o?o[s.t]:Ar[e],typeof o=="function"&&r&&(o=o(t,s))):typeof o=="function"&&r&&(o=o(t,s.t,s)),o)},getObj(e,t,s){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,s.t,s)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function Xd(e){return e}function ih(e,t){this.t="token",this.v=e,this.tk=t}ih.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),s=e.get("truncate",t,this),r=e.get("format",t,this);return s&&r.length>s?r.substring(0,s)+"â¦":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Ar.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,s=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",s,this),o=e.get("tagName",s,t),a=this.toFormattedString(e),i={},l=e.get("className",s,t),c=e.get("target",s,t),d=e.get("rel",s,t),h=e.getObj("attributes",s,t),u=e.getObj("events",s,t);return i.href=r,l&&(i.class=l),c&&(i.target=c),d&&(i.rel=d),h&&Object.assign(i,h),{tagName:o,attributes:i,content:a,eventListeners:u}}};function Aa(e,t){class s extends ih{constructor(o,a){super(o,a),this.t=e}}for(const r in t)s.prototype[r]=t[r];return s.t=e,s}const Jd=Aa("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Zd=Aa("text"),pk=Aa("nl"),po=Aa("url",{isLink:!0,toHref(e=Ar.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==zr&&e[1].t===qs}}),Vt=e=>new Et(e);function gk({groups:e}){const t=e.domain.concat([ea,sa,Gs,na,ra,oa,aa,ia,Kt,Ql,fr,la,ca,da,xs,fa,hr,ua]),s=[ta,qs,tc,gs,sc,fr,mr,nc,rc,Ho,Go,dr,ur,Fo,Bo,Wo,Uo,Yo,Vo,Ko,qo,Xo,Jo,Zo,Qo],r=[ea,ta,sa,na,ra,oa,aa,ia,Kt,dr,ur,fr,la,ca,da,mr,xs,fa,hr,ua],o=Vt(),a=q(o,hr);Se(a,r,a),Se(a,e.domain,a);const i=Vt(),l=Vt(),c=Vt();Se(o,e.domain,i),Se(o,e.scheme,l),Se(o,e.slashscheme,c),Se(i,r,a),Se(i,e.domain,i);const d=q(i,Gs);q(a,Gs,d),q(l,Gs,d),q(c,Gs,d);const h=q(a,gs);Se(h,r,a),Se(h,e.domain,a);const u=Vt();Se(d,e.domain,u),Se(u,e.domain,u);const p=q(u,gs);Se(p,e.domain,u);const m=Vt(Jd);Se(p,e.tld,m),Se(p,e.utld,m),q(d,zr,m);const b=q(u,Kt);q(b,Kt,b),Se(b,e.domain,u),Se(m,e.domain,u),q(m,gs,p),q(m,Kt,b);const x=q(m,qs);Se(x,e.numeric,Jd);const g=q(i,Kt),y=q(i,gs);q(g,Kt,g),Se(g,e.domain,i),Se(y,r,a),Se(y,e.domain,i);const N=Vt(po);Se(y,e.tld,N),Se(y,e.utld,N),Se(N,e.domain,i),Se(N,r,a),q(N,gs,y),q(N,Kt,g),q(N,Gs,d);const w=q(N,qs),k=Vt(po);Se(w,e.numeric,k);const E=Vt(po),v=Vt();Se(E,t,E),Se(E,s,v),Se(v,t,E),Se(v,s,v),q(N,xs,E),q(k,xs,E);const S=q(l,qs),z=q(c,qs),B=q(z,xs),M=q(B,xs);Se(l,e.domain,i),q(l,gs,y),q(l,Kt,g),Se(c,e.domain,i),q(c,gs,y),q(c,Kt,g),Se(S,e.domain,E),q(S,xs,E),q(S,mr,E),Se(M,e.domain,E),Se(M,t,E),q(M,xs,E);const D=[[dr,ur],[Bo,Fo],[Wo,Uo],[Ho,Go],[Yo,Vo],[Ko,qo],[Xo,Jo],[Zo,Qo]];for(let A=0;A<D.length;A++){const[U,se]=D[A],P=q(E,U);q(v,U,P),q(P,se,E);const ne=Vt(po);Se(P,t,ne);const C=Vt();Se(P,s),Se(ne,t,ne),Se(ne,s,C),Se(C,t,ne),Se(C,s,C),q(ne,se,E),q(C,se,E)}return q(o,zr,N),q(o,ec,pk),{start:o,tokens:oh}}function xk(e,t,s){let r=s.length,o=0,a=[],i=[];for(;o<r;){let l=e,c=null,d=null,h=0,u=null,p=-1;for(;o<r&&!(c=l.go(s[o].t));)i.push(s[o++]);for(;o<r&&(d=c||l.go(s[o].t));)c=null,l=d,l.accepts()?(p=0,u=l):p>=0&&p++,o++,h++;if(p<0)o-=h,o<r&&(i.push(s[o]),o++);else{i.length>0&&(a.push(bi(Zd,t,i)),i=[]),o-=p,h-=p;const m=u.t,b=s.slice(o-h,o);a.push(bi(m,t,b))}}return i.length>0&&a.push(bi(Zd,t,i)),a}function bi(e,t,s){const r=s[0].s,o=s[s.length-1].e,a=t.slice(r,o);return new e(a,s)}const bk=typeof console<"u"&&console&&console.warn||(()=>{}),wk="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",We={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function yk(){return Et.groups={},We.scanner=null,We.parser=null,We.tokenQueue=[],We.pluginQueue=[],We.customSchemes=[],We.initialized=!1,We}function Qd(e,t=!1){if(We.initialized&&bk(`linkifyjs: already initialized - will not register custom scheme "${e}" ${wk}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format. 351. Must only contain digits, lowercase ASCII letters or "-" 362. Cannot start or end with "-" 373. "-" cannot repeat`);We.customSchemes.push([e,t])}function vk(){We.scanner=mk(We.customSchemes);for(let e=0;e<We.tokenQueue.length;e++)We.tokenQueue[e][1]({scanner:We.scanner});We.parser=gk(We.scanner.tokens);for(let e=0;e<We.pluginQueue.length;e++)We.pluginQueue[e][1]({scanner:We.scanner,parser:We.parser});return We.initialized=!0,We}function ac(e){return We.initialized||vk(),xk(We.parser.start,e,ah(We.scanner.start,e))}ac.scan=ah;function lh(e,t=null,s=null){if(t&&typeof t=="object"){if(s)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);s=t,t=null}const r=new oc(s),o=ac(e),a=[];for(let i=0;i<o.length;i++){const l=o[i];l.isLink&&(!t||l.t===t)&&r.check(l)&&a.push(l.toFormattedObject(r))}return a}var ic="[\0-  áá â-\u2029âã]",jk=new RegExp(ic),Nk=new RegExp(`${ic}$`),kk=new RegExp(ic,"g");function Sk(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function Ck(e){return new Jt({key:new cs("autolink"),appendTransaction:(t,s,r)=>{const o=t.some(d=>d.docChanged)&&!s.doc.eq(r.doc),a=t.some(d=>d.getMeta("preventAutolink"));if(!o||a)return;const{tr:i}=r,l=kp(s.doc,[...t]);if(Sp(l).forEach(({newRange:d})=>{const h=Cp(r.doc,d,m=>m.isTextblock);let u,p;if(h.length>1)u=h[0],p=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(h.length){const m=r.doc.textBetween(d.from,d.to," "," ");if(!Nk.test(m))return;u=h[0],p=r.doc.textBetween(u.pos,d.to,void 0," ")}if(u&&p){const m=p.split(jk).filter(Boolean);if(m.length<=0)return!1;const b=m[m.length-1],x=u.pos+p.lastIndexOf(b);if(!b)return!1;const g=ac(b).map(y=>y.toObject(e.defaultProtocol));if(!Sk(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:x+y.start+1,to:x+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>e.validate(y.value)).filter(y=>e.shouldAutoLink(y.value)).forEach(y=>{_p(y.from,y.to,r.doc).some(N=>N.mark.type===e.type)||i.addMark(y.from,y.to,e.type.create({href:y.href}))})}}),!!i.steps.length)return i}})}function _k(e){return new Jt({key:new cs("handleClickLink"),props:{handleClick:(t,s,r)=>{var o,a;if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{const c=r.target;if(!c)return!1;const d=e.editor.view.dom;i=c.closest("a"),i&&!d.contains(i)&&(i=null)}if(!i)return!1;let l=!1;if(e.enableClickSelection&&(l=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const c=Tp(t.state,e.type.name),d=(o=i.href)!=null?o:c.href,h=(a=i.target)!=null?a:c.target;d&&(window.open(d,h),l=!0)}return l}}})}function Tk(e){return new Jt({key:new cs("handlePasteLink"),props:{handlePaste:(t,s,r)=>{const{shouldAutoLink:o}=e,{state:a}=t,{selection:i}=a,{empty:l}=i;if(l)return!1;let c="";r.content.forEach(h=>{c+=h.textContent});const d=lh(c,{defaultProtocol:e.defaultProtocol}).find(h=>h.isLink&&h.value===c);return!c||!d||o!==void 0&&!o(d.value)?!1:e.editor.commands.setMark(e.type,{href:d.href})}}})}function nn(e,t){const s=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&s.push(o)}),!e||e.replace(kk,"").match(new RegExp(`^(?:(?:${s.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var ch=Bn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `val
37idate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){Qd(e);return}Qd(e.scheme,e.optionalSlashes)})},onDestroy(){yk()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!nn(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),s=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||s&&!e.includes("@"))return!0;const o=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(o)||!/\./.test(o))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:s=>!!nn(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!nn(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ze(this.options.HTMLAttributes,e),0]:["a",Ze(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var s,r,o,a;const i=(r=(s=e.attrs)==null?void 0:s.href)!=null?r:"",l=(a=(o=e.attrs)==null?void 0:o.title)!=null?a:"",c=t.renderChildren(e);return l?`[${c}](${i} "${l}")`:`[${c}](${i})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:s}=e;return this.options.isAllowedUri(s,{defaultValidate:r=>!!nn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:s}=e||{};return s&&!this.options.isAllowedUri(s,{defaultValidate:r=>!!nn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[hn({find:e=>{const t=[];if(e){const{protocols:s,defaultProtocol:r}=this.options,o=lh(e).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:i=>!!nn(i,s),protocols:s,defaultProtocol:r}));o.length&&o.forEach(a=>{this.options.shouldAutoLink(a.value)&&t.push({text:a.value,data:{href:a.href},index:a.start})})}return t}
vendor: 13,262 bytes, lines 37-47
37,type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:s}=this.options;return this.options.autolink&&e.push(Ck({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!nn(o,t),protocols:t,defaultProtocol:s}),shouldAutoLink:this.options.shouldAutoLink})),e.push(_k({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Tk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Ek=ch,zk=Object.defineProperty,Ak=(e,t)=>{for(var s in t)zk(e,s,{get:t[s],enumerable:!0})},Mk="listItem",eu="textStyle",tu=/^\s*([-+*])\s$/,dh=kt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",Ze(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>e.type!=="list"||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` 38`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Mk,this.editor.getAttributes(eu)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Ln({find:tu,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ln({find:tu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(eu),editor:this.editor})),[e]}}),uh=kt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Ze(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if(e.type!=="list_item")return[];let s=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(o=>o.type==="paragraph"))s=t.parseChildren(e.tokens);else{const o=e.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:t.parseInline(o.tokens)}],e.tokens.length>1){const i=e.tokens.slice(1),l=t.parseChildren(i);s.push(...l)}}else s=t.parseChildren(e.tokens)}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(e,t,s)=>Du(e,t,r=>{var o,a;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((a=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:a.start)||1)+r.index}. `:"- "},s),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Lk={};Ak(Lk,{findListItemPos:()=>Vr,getNextListDepth:()=>lc,handleBackspace:()=>il,handleDelete:()=>ll,hasListBefore:()=>fh,hasListItemAfter:()=>Ik,hasListItemBefore:()=>mh,listItemHasSubList:()=>hh,nextListIsDeeper:()=>ph,nextListIsHigher:()=>gh});var Vr=(e,t)=>{const{$from:s}=t.selection,r=Pu(e,t.schema);let o=null,a=s.depth,i=s.pos,l=null;for(;a>0&&l===null;)o=s.node(a),o.type===r?l=a:(a-=1,i-=1);return l===null?null:{$pos:t.doc.resolve(i),depth:l}},lc=(e,t)=>{const s=Vr(e,t);if(!s)return!1;const[,r]=zp(t,e,s.$pos.pos+4);return r},fh=(e,t,s)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),a=e.doc.resolve(o).node();return!(!a||!s.includes(a.type.name))},mh=(e,t)=>{var s;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return!(o.index()===0||((s=o.nodeBefore)==null?void 0:s.type.name)!==e)},hh=(e,t,s)=>{if(!s)return!1;const r=Pu(e,t.schema);let o=!1;return s.descendants(a=>{a.type===r&&(o=!0)}),o},il=(e,t,s)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Ai(e.state,t)&&fh(e.state,t,s)){const{$anchor:l}=e.state.selection,c=e.state.doc.resolve(l.before()-1),d=[];c.node().descendants((p,m)=>{p.type.name===t&&d.push({node:p,pos:m})});const h=d.at(-1);if(!h)return!1;const u=e.state.doc.resolve(c.start()+h.pos+1);return e.chain().cut({from:l.start()-1,to:l.end()+1},u.end()).joinForward().run()}if(!Ai(e.state,t)||!Ap(e.state))return!1;const r=Vr(t,e.state);if(!r)return!1;const a=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=hh(t,e.state,a);return mh(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},ph=(e,t)=>{const s=lc(e,t),r=Vr(e,t);return!r||!s?!1:s>r.depth},gh=(e,t)=>{const s=lc(e,t),r=Vr(e,t);return!r||!s?!1:s<r.depth},ll=(e,t)=>{if(!Ai(e.state,t)||!Mp(e.state,t))return!1;const{selection:s}=e.state,{$from:r,$to:o}=s;return!s.empty&&r.sameParent(o)?!1:ph(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():gh(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},Ik=(e,t)=>{var s;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((s=o.nodeAfter)==null?void 0:s.type.name)!==e)},xh=ds.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:s})=>{e.state.schema.nodes[s]!==void 0&&ll(e,s)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:s})=>{e.state.schema.nodes[s]!==void 0&&ll(e,s)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:s,wrapperNames:r})=>{e.state.schema.nodes[s]!==void 0&&il(e,s,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:s,wrapperNames:r})=>{e.state.schema.nodes[s]!==void 0&&il(e,s,r)&&(t=!0)}),t}}}}),su=/^(\s*)(\d+)\.\s+(.*)$/,Ok=/^\s/;function Dk(e){const t=[];let s=0,r=0;for(;s<e.length;){const o=e[s],a=o.match(su);if(!a)break;const[,i,l,c]=a,d=i.length;let h=c,u=s+1;const p=[o];for(;u<e.length;){const m=e[u];if(m.match(su))break;if(m.trim()==="")p.push(m),h+=` 39`,u+=1;else if(m.match(Ok))p.push(m),h+=` 40${m.slice(d+2)}`,u+=1;else break}t.push({indent:d,number:parseInt(l,10),content:h.trim(),raw:p.join(` 41`)}),r=u,s=u}return[t,r]}function bh(e,t,s){var r;const o=[];let a=0;for(;a<e.length;){const i=e[a];if(i.indent===t){const l=i.content.split(` 42`),c=((r=l[0])==null?void 0:r.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:s.inlineTokens(c)});const h=l.slice(1).join(` 43`).trim();if(h){const m=s.blockTokens(h);d.push(...m)}let u=a+1;const p=[];for(;u<e.length&&e[u].indent>t;)p.push(e[u]),u+=1;if(p.length>0){const m=Math.min(...p.map(x=>x.indent)),b=bh(p,m,s);d.push({type:"list",ordered:!0,start:p[0].number,items:b,raw:p.map(x=>x.raw).join(` 44`)})}o.push({type:"list_item",raw:i.raw,tokens:d}),a=u}else a+=1}return o}function Pk(e,t){return e.map(s=>{if(s.type!=="list_item")return t.parseChildren([s])[0];const r=[];return s.tokens&&s.tokens.length>0&&s.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...t.parseChildren([o]));else if(o.type==="text"&&o.tokens){const a=t.parseChildren([o]);r.push({type:"paragraph",content:a})}else{const a=t.parseChildren([o]);a.length>0&&r.push(...a)}}),{type:"listItem",content:r}})}var Rk="listItem",nu="textStyle",ru=/^(\d+)\.\s$/,wh=kt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...s}=e;return t===1?["ol",Ze(this.options.HTMLAttributes,s),0]:["ol",Ze(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if(e.type!=="list"||!e.ordered)return[];const s=e.start||1,r=e.items?Pk(e.items,t):[];return s!==1?{type:"orderedList",attrs:{start:s},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` 45`):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),s=t==null?void 0:t.index;return s!==void 0?s:-1},tokenize:(e,t,s)=>{var r;const o=e.split(` 46`),[a,i]=Dk(o);if(a.length===0)return;const l=bh(a,0,s);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=a[0])==null?void 0:r.number)||1,items:l,raw:o.slice(0,i).join(` 47`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Rk,this.editor.getAttributes(nu)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Ln({find:ru,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,s)=>s.childCount+s.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ln({find:ru,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(nu)}),joinPredicate:(t,s)=>s.childCount+s.attrs.start===+t[1],editor:this.editor})),[e]}}),$k=/^\s*(\[([( |x])?\])\s$/,Bk=kt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Ze(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const s=[];if(e.tokens&&e.tokens.length>0?s.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?s.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):s.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);s.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},s)},renderMarkdown:(e,t)=>{var s;const o=`- [${(s=e.attrs)!=null&&s.checked?"x":" "}] `;return Du(e,t,o)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:s,editor:r})=>{const o=document.createElement("li"),a=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=u=>{var p,m;l.ariaLabel=((m=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:m.call(p,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};d(e),a.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=u.target;r.isEditable&&typeof s=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const b=s();if(typeof b!="number")return!1;const x=m.doc.nodeAt(b);return m.setNodeMarkup(b,void 0,{...x==null?void 0:x.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,p])=>{o.setAttribute(u,p)}),o.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,a.append(l,i),o.append(a,c),Object.entries(t).forEach(([u,p])=>{o.setAttribute(u,p)});let h=new Set(Object.keys(t));return{dom:o,contentDOM:c,update:u=>{if(u.type!==this.type)return!1;o.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,d(u);const p=r.extensionManager.attributes,m=Ep(u,p),b=new Set(Object.keys(m)),x=this.options.HTMLAttributes;return h.forEach(g=>{b.has(g)||(g in x?o.setAttribute(g,x[g]):o.removeAttribute(g))}),Object.entries(m).forEach(([g,y])=>{y==null?g in x?o.setAttribute(g,x[g]):o.removeAttribute(g):o.setAttribute(g,y)}),h=b,!0}}}}
47,addInputRules(){return[Ln({find:$k,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),Fk=kt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Ze(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` 48`):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const s=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return s!==void 0?s:-1},tokenize(e,t,s){const r=a=>{const i=Sc(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:s.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:r},s);return i?[{type:"taskList",raw:i.raw,items:i.items}]:s.blockTokens(a)},o=Sc(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,i)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:s.inlineTokens(a.mainContent),nestedTokens:i}),customNestedParser:r},s);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ds.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(dh.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(uh.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(xh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(wh.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Bk.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Fk.configure(this.options.taskList)),e}});var ou=" ",Wk="Â ",Uk=kt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Ze(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const s=e.tokens||[];if(s.length===1&&s[0].type==="image")return t.parseChildren([s[0]]);const r=t.parseInline(s);return r.length===1&&r[0].type==="text"&&(r[0].text===ou||r[0].text===Wk)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t)=>{if(!e)return"";const s=Array.isArray(e.content)?e.content:[];return s.length===0?ou:t.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Hk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Gk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Yk=Bn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",Ze(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}}
vendor: 4,297 bytes, line 48
48,addInputRules(){return[In({find:Hk,type:this.type})]},addPasteRules(){return[hn({find:Gk,type:this.type})]}}),Vk=kt.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),Kk=Bn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",Ze(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,s){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!o)return;const a=o[2].trim();return{type:"underline",raw:o[0],text:a,tokens:s.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function qk(e={}){return new Jt({view(t){return new Xk(t,e)}})}class Xk{constructor(t,s){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=s.width)!==null&&r!==void 0?r:1,this.color=s.color===!1?void 0:s.color||"black",this.class=s.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let a=i=>{this[o](i)};return t.dom.addEventListener(o,a),{name:o,handler:a}})}destroy(){this.handlers.forEach(({name:t,handler:s})=>this.editorView.dom.removeEventListener(t,s))}update(t,s){this.cursorPos!=null&&s.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),s=!t.parent.inlineContent,r,o=this.editorView.dom,a=o.getBoundingClientRect(),i=a.width/o.offsetWidth,l=a.height/o.offsetHeight;if(s){let u=t.nodeBefore,p=t.nodeAfter;if(u||p){let m=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(m){let b=m.getBoundingClientRect(),x=u?b.bottom:b.top;u&&p&&(x=(x+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:b.left,right:b.right,top:x-g,bottom:x+g}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*i;r={left:u.left-p,right:u.left+p,top:u.top,bottom:u.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s);let d,h;if(!c||c==document.body&&getComputedStyle(c).position=="static")d=-pageXOffset,h=-pageYOffset;else{let u=c.getBoundingClientRect(),p=u.width/c.offsetWidth,m=u.height/c.offsetHeight;d=u.left-c.scrollLeft*p,h=u.top-c.scrollTop*m}this.element.style.left=(r.left-d)/i+"px",this.element.style.top=(r.top-h)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let s=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=s&&s.inside>=0&&this.editorView.state.doc.nodeAt(s.inside),o=r&&r.type.spec.disableDropCursor,a=typeof o=="function"?o(this.editorView,s,t):o;if(s&&!a){let i=s.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Lp(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class Ke extends br{constructor(t){super(t,t)}
vendor: 15,891 bytes, line 48
48map(t,s){let r=t.resolve(s.map(this.head));return Ke.valid(r)?new Ke(r):br.near(r)}content(){return Ru.empty}eq(t){return t instanceof Ke&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,s){if(typeof s.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ke(t.resolve(s.pos))}getBookmark(){return new cc(this.anchor)}static valid(t){let s=t.parent;if(s.isTextblock||!Jk(t)||!Zk(t))return!1;let r=s.type.spec.allowGapCursor;if(r!=null)return r;let o=s.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,s,r=!1){e:for(;;){if(!r&&Ke.valid(t))return t;let o=t.pos,a=null;for(let i=t.depth;;i--){let l=t.node(i);if(s>0?t.indexAfter(i)<l.childCount:t.index(i)>0){a=l.child(s>0?t.indexAfter(i):t.index(i)-1);break}else if(i==0)return null;o+=s;let c=t.doc.resolve(o);if(Ke.valid(c))return c}for(;;){let i=s>0?a.firstChild:a.lastChild;if(!i){if(a.isAtom&&!a.isText&&!gl.isSelectable(a)){t=t.doc.resolve(o+a.nodeSize*s),r=!1;continue e}break}a=i,o+=s;let l=t.doc.resolve(o);if(Ke.valid(l))return l}return null}}}Ke.prototype.visible=!1;Ke.findFrom=Ke.findGapCursorFrom;br.jsonID("gapcursor",Ke);class cc{constructor(t){this.pos=t}map(t){return new cc(t.map(this.pos))}resolve(t){let s=t.resolve(this.pos);return Ke.valid(s)?new Ke(s):br.near(s)}}function yh(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Jk(e){for(let t=e.depth;t>=0;t--){let s=e.index(t),r=e.node(t);if(s==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(s-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||yh(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Zk(e){for(let t=e.depth;t>=0;t--){let s=e.indexAfter(t),r=e.node(t);if(s==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(s);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||yh(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Qk(){return new Jt({props:{decorations:n1,createSelectionBetween(e,t,s){return t.pos==s.pos&&Ke.valid(s)?new Ke(s):null},handleClick:t1,handleKeyDown:e1,handleDOMEvents:{beforeinput:s1}}})}const e1=Ip({ArrowLeft:go("horiz",-1),ArrowRight:go("horiz",1),ArrowUp:go("vert",-1),ArrowDown:go("vert",1)});function go(e,t){const s=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,a){let i=r.selection,l=t>0?i.$to:i.$from,c=i.empty;if(i instanceof un){if(!a.endOfTextblock(s)||l.depth==0)return!1;c=!1,l=r.doc.resolve(t>0?l.after():l.before())}let d=Ke.findGapCursorFrom(l,t,c);return d?(o&&o(r.tr.setSelection(new Ke(d))),!0):!1}}function t1(e,t,s){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Ke.valid(r))return!1;let o=e.posAtCoords({left:s.clientX,top:s.clientY});return o&&o.inside>-1&&gl.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Ke(r))),!0)}function s1(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Ke))return!1;let{$from:s}=e.state.selection,r=s.parent.contentMatchAt(s.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=Cc.empty;for(let i=r.length-1;i>=0;i--)o=Cc.from(r[i].createAndFill(null,o));let a=e.state.tr.replace(s.pos,s.pos,new Ru(o,0,0));return a.setSelection(un.near(a.doc.resolve(s.pos+1))),e.dispatch(a),!1}function n1(e){if(!(e.selection instanceof Ke))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",wr.create(e.doc,[ba.widget(e.selection.head,t,{key:"gapcursor"})])}var ma=200,ft=function(){};ft.prototype.append=function(t){return t.length?(t=ft.from(t),!this.length&&t||t.length<ma&&this.leafAppend(t)||this.length<ma&&t.leafPrepend(this)||this.appendInner(t)):this};ft.prototype.prepend=function(t){return t.length?ft.from(t).append(this):this};ft.prototype.appendInner=function(t){return new r1(this,t)};ft.prototype.slice=function(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.length),t>=s?ft.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,s))};ft.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};ft.prototype.forEach=function(t,s,r){s===void 0&&(s=0),r===void 0&&(r=this.length),s<=r?this.forEachInner(t,s,r,0):this.forEachInvertedInner(t,s,r,0)};ft.prototype.map=function(t,s,r){s===void 0&&(s=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(a,i){return o.push(t(a,i))},s,r),o};ft.from=function(t){return t instanceof ft?t:t&&t.length?new vh(t):ft.empty};var vh=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var s={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,a){return o==0&&a==this.length?this:new t(this.values.slice(o,a))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,a,i,l){for(var c=a;c<i;c++)if(o(this.values[c],l+c)===!1)return!1},t.prototype.forEachInvertedInner=function(o,a,i,l){for(var c=a-1;c>=i;c--)if(o(this.values[c],l+c)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=ma)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=ma)return new t(o.flatten().concat(this.values))},s.length.get=function(){return this.values.length},s.depth.get=function(){return 0},Object.defineProperties(t.prototype,s),t}(ft);ft.empty=new vh([]);var r1=function(e){function t(s,r){e.call(this),this.left=s,this.right=r,this.length=s.length+r.length,this.depth=Math.max(s.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,a,i){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(a,l),i)===!1||a>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,a)-l,i+l)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,a,i){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(a,l)-l,i+l)===!1||a<l&&this.left.forEachInvertedInner(r,Math.min(o,l),a,i)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var a=this.left.length;return o<=a?this.left.slice(r,o):r>=a?this.right.slice(r-a,o-a):this.left.slice(r,a).append(this.right.slice(0,o-a))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(ft);const o1=500;class ns{constructor(t,s){this.items=t,this.eventCount=s}popEvent(t,s){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,a;s&&(o=this.remapping(r,this.items.length),a=o.maps.length);let i=t.tr,l,c,d=[],h=[];return this.items.forEach((u,p)=>{if(!u.step){o||(o=this.remapping(r,p+1),a=o.maps.length),a--,h.push(u);return}if(o){h.push(new bs(u.map));let m=u.step.map(o.slice(a)),b;m&&i.maybeStep(m).doc&&(b=i.mapping.maps[i.mapping.maps.length-1],d.push(new bs(b,void 0,void 0,d.length+h.length))),a--,b&&o.appendMap(b,a)}else i.maybeStep(u.step);if(u.selection)return l=o?u.selection.map(o.slice(a)):u.selection,c=new ns(this.items.slice(0,r).append(h.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:i,selection:l}}addTransform(t,s,r,o){let a=[],i=this.eventCount,l=this.items,c=!o&&l.length?l.get(l.length-1):null;for(let h=0;h<t.steps.length;h++){let u=t.steps[h].invert(t.docs[h]),p=new bs(t.mapping.maps[h],u,s),m;(m=c&&c.merge(p))&&(p=m,h?a.pop():l=l.slice(0,l.length-1)),a.push(p),s&&(i++,s=void 0),o||(c=p)}let d=i-r.depth;return d>i1&&(l=a1(l,d),i-=d),new ns(l.append(a),i)}remapping(t,s){let r=new Op;return this.items.forEach((o,a)=>{let i=o.mirrorOffset!=null&&a-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,i)},t,s),r}addMaps(t){return this.eventCount==0?this:new ns(this.items.append(t.map(s=>new bs(s))),this.eventCount)}rebased(t,s){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-s),a=t.mapping,i=t.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},o);let c=s;this.items.forEach(p=>{let m=a.getMirror(--c);if(m==null)return;i=Math.min(i,m);let b=a.maps[m];if(p.step){let x=t.steps[m].invert(t.docs[m]),g=p.selection&&p.selection.map(a.slice(c+1,m));g&&l++,r.push(new bs(b,x,g))}else r.push(new bs(b))},o);let d=[];for(let p=s;p<i;p++)d.push(new bs(a.maps[p]));let h=this.items.slice(0,o).append(d).append(r),u=new ns(h,l);return u.emptyItemCount()>o1&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let t=0;return this.items.forEach(s=>{s.step||t++}),t}compress(t=this.items.length){let s=this.remapping(0,t),r=s.maps.length,o=[],a=0;return this.items.forEach((i,l)=>{if(l>=t)o.push(i),i.selection&&a++;else if(i.step){let c=i.step.map(s.slice(r)),d=c&&c.getMap();if(r--,d&&s.appendMap(d,r),c){let h=i.selection&&i.selection.map(s.slice(r));h&&a++;let u=new bs(d.invert(),c,h),p,m=o.length-1;(p=o.length&&o[m].merge(u))?o[m]=p:o.push(u)}}else i.map&&r--},this.items.length,0),new ns(ft.from(o.reverse()),a)}}ns.empty=new ns(ft.empty,0);function a1(e,t){let s;return e.forEach((r,o)=>{if(r.selection&&t--==0)return s=o,!1}),e.slice(s)}class bs{constructor(t,s,r,o){this.map=t,this.step=s,this.selection=r,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let s=t.step.merge(this.step);if(s)return new bs(s.getMap().invert(),s,this.selection)}}}class Ys{constructor(t,s,r,o,a){this.done=t,this.undone=s,this.prevRanges=r,this.prevTime=o,this.prevComposition=a}}const i1=20;function l1(e,t,s,r){let o=s.getMeta(mn),a;if(o)return o.historyState;s.getMeta(u1)&&(e=new Ys(e.done,e.undone,null,0,-1));let i=s.getMeta("appendedTransaction");if(s.steps.length==0)return e;if(i&&i.getMeta(mn))return i.getMeta(mn).redo?new Ys(e.done.addTransform(s,void 0,r,To(t)),e.undone,au(s.mapping.maps),e.prevTime,e.prevComposition):new Ys(e.done,e.undone.addTransform(s,void 0,r,To(t)),null,e.prevTime,e.prevComposition);if(s.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=s.getMeta("composition"),c=e.prevTime==0||!i&&e.prevComposition!=l&&(e.prevTime<(s.time||0)-r.newGroupDelay||!c1(s,e.prevRanges)),d=i?wi(e.prevRanges,s.mapping):au(s.mapping.maps);return new Ys(e.done.addTransform(s,c?t.selection.getBookmark():void 0,r,To(t)),ns.empty,d,s.time,l??e.prevComposition)}else return(a=s.getMeta("rebased"))?new Ys(e.done.rebased(s,a),e.undone.rebased(s,a),wi(e.prevRanges,s.mapping),e.prevTime,e.prevComposition):new Ys(e.done.addMaps(s.mapping.maps),e.undone.addMaps(s.mapping.maps),wi(e.prevRanges,s.mapping),e.prevTime,e.prevComposition)}function c1(e,t){if(!t)return!1;if(!e.docChanged)return!0;let s=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let a=0;a<t.length;a+=2)r<=t[a+1]&&o>=t[a]&&(s=!0)}),s}function au(e){let t=[];for(let s=e.length-1;s>=0&&t.length==0;s--)e[s].forEach((r,o,a,i)=>t.push(a,i));return t}function wi(e,t){if(!e)return null;let s=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),a=t.map(e[r+1],-1);o<=a&&s.push(o,a)}return s}function d1(e,t,s){let r=To(t),o=mn.get(t).spec.config,a=(s?e.undone:e.done).popEvent(t,r);if(!a)return null;let i=a.selection.resolve(a.transform.doc),l=(s?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),o,r),c=new Ys(s?l:a.remaining,s?a.remaining:l,null,0,-1);return a.transform.setSelection(i).setMeta(mn,{redo:s,historyState:c})}let yi=!1,iu=null;function To(e){let t=e.plugins;if(iu!=t){yi=!1,iu=t;for(let s=0;s<t.length;s++)if(t[s].spec.historyPreserveItems){yi=!0;break}}return yi}const mn=new cs("history"),u1=new cs("closeHistory");function f1(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Jt({key:mn,state:{init(){return new Ys(ns.empty,ns.empty,null,0,-1)},apply(t,s,r){return l1(s,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,s){let r=s.inputType,o=r=="historyUndo"?Nh:r=="historyRedo"?kh:null;return!o||!t.editable?!1:(s.preventDefault(),o(t.state,t.dispatch))}}}})}function jh(e,t){return(s,r)=>{let o=mn.getState(s);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let a=d1(o,s,e);a&&r(t?a.scrollIntoView():a)}return!0}}const Nh=jh(!1,!0),kh=jh(!0,!0);ds.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=(e==null?void 0:e.node)||this.editor.state.doc;if(((e==null?void 0:e.mode)||this.options.mode)==="textSize"){const r=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(r)}return t.nodeSize},this.storage.words=e=>{const t=(e==null?void 0:e.node)||this.editor.state.doc,s=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(s)}},addProseMirrorPlugins(){let e=!1;return[new Jt({key:new cs("characterCount"),appendTransaction:(t,s,r)=>{if(e)return;const o=this.options.limit;if(o==null||o===0){e=!0;return}const a=this.storage.characters({node:r.doc});if(a>o){const i=a-o,l=0,c=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,c);return e=!0,d}e=!0},filterTransaction:(t,s)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:s.doc}),a=this.storage.characters({node:t.doc});if(a<=r||o>r&&a>r&&a<=o)return!0;if(o>r&&a>r&&a>o||!t.getMeta("paste"))return!1;const l=t.selection.$head.pos,c=a-r,d=l-c,h=l;return t.deleteRange(d,h),!(this.storage.characters({node:t.doc})>r)}})]}});var m1=ds.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[qk(this.options)]}});ds.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Jt({key:new cs("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:s,isFocused:r}=this.editor,{anchor:o}=t,a=[];if(!s||!r)return wr.create(e,[]);let i=0;this.options.mode==="deepest"&&e.descendants((c,d)=>{if(c.isText)return;if(!(o>=d&&o<=d+c.nodeSize-1))return!1;i+=1});let l=0;return e.descendants((c,d)=>{if(c.isText||!(o>=d&&o<=d+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";a.push(ba.node(d,d+c.nodeSize,{class:this.options.className}))}),wr.create(e,a)}}})]}});var h1=ds.create({name:"gapCursor",addProseMirrorPlugins(){return[Qk()]},extendNodeSchema(e){var t;const s={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=Dp(Pp(e,"allowGapCursor",s)))!=null?t:null}}}),lu="placeholder";function p1(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var g1=ds.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:lu,placeholder:"Write something â¦",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${p1(this.options.dataAttribute)}`:`data-${lu}`;return[new Jt({key:new cs("placeholder"),props:{decorations:({doc:t,selection:s})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=s,a=[];if(!r)return null;const i=this.editor.isEmpty;
48return t.descendants((l,c)=>{const d=o>=c&&o<=c+l.nodeSize,h=!l.isLeaf&&Rp(l);if((d||!this.options.showOnlyCurrent)&&h){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const p=ba.node(c,c+l.nodeSize,{class:u.join(" "),[e]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:d}):this.options.placeholder});a.push(p)}return this.options.includeChildren}),wr.create(t,a)}}})]}});ds.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Jt({key:new cs("selection"),props:{decorations(s){return s.selection.empty||e.isFocused||!e.isEditable||Iu(s.selection)||e.view.dragging?null:wr.create(s.doc,[ba.inline(s.selection.from,s.selection.to,{class:t.className})])}}})]}});function cu({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(t==null?void 0:t.type)===e}var x1=ds.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new cs(this.name),s=this.options.node||((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(s).includes(o.name));return[new Jt({key:t,appendTransaction:(o,a,i)=>{const{doc:l,tr:c,schema:d}=i,h=t.getState(i),u=l.content.size,p=d.nodes[s];if(h)return c.insert(u,p.create())},state:{init:(o,a)=>{const i=a.tr.doc.lastChild;return!cu({node:i,types:r})},apply:(o,a)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return a;const i=o.doc.lastChild;return!cu({node:i,types:r})}}})]}}),b1=ds.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Nh(e,t),redo:()=>({state:e,dispatch:t})=>kh(e,t)}},addProseMirrorPlugins(){return[f1(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Ñ":()=>this.editor.commands.undo(),"Shift-Mod-Ñ":()=>this.editor.commands.redo()}}}),w1=ds.create({name:"starterKit",addExtensions(){var e,t,s,r;const o=[];return this.options.bold!==!1&&o.push(UN.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(RN.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(dh.configure(this.options.bulletList)),this.options.code!==!1&&o.push(YN.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(qN.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(XN.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(m1.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(h1.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(JN.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(ZN.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(b1.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(QN.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(rk.configure(this.options.italic)),this.options.listItem!==!1&&o.push(uh.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(xh.configure((e=this.options)==null?void 0:e.listKeymap)),this.options.link!==!1&&o.push(ch.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&o.push(wh.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Uk.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(Yk.configure(this.options.strike)),this.options.text!==!1&&o.push(Vk.configure(this.options.text)),this.options.underline!==!1&&o.push(Kk.configure((s=this.options)==null?void 0:s.underline)),this.options.trailingNode!==!1&&o.push(x1.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),y1=w1,v1=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,j1=kt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",Ze(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,s,r,o,a,i;const l=(s=(t=e.attrs)==null?void 0:t.src)!=null?s:"",c=(o=(r=e.attrs)==null?void 0:r.alt)!=null?o:"",d=(i=(a=e.attrs)==null?void 0:a.title)!=null?i:"";return d?``:``}
48,addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:e,minWidth:t,minHeight:s,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:o,getPos:a,HTMLAttributes:i,editor:l})=>{const c=document.createElement("img");Object.entries(i).forEach(([u,p])=>{if(p!=null)switch(u){case"width":case"height":break;default:c.setAttribute(u,p);break}}),c.src=i.src;const d=new $p({element:c,editor:l,node:o,getPos:a,onResize:(u,p)=>{c.style.width=`${u}px`,c.style.height=`${p}px`},onCommit:(u,p)=>{const m=a();m!==void 0&&this.editor.chain().setNodeSelection(m).updateAttributes(this.name,{width:u,height:p}).run()},onUpdate:(u,p,m)=>u.type===o.type,options:{directions:e,min:{width:t,height:s},preserveAspectRatio:r===!0}}),h=d.dom;return h.style.visibility="hidden",h.style.pointerEvents="none",c.onload=()=>{h.style.visibility="",h.style.pointerEvents=""},d}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Ou({find:v1,type:this.t
48ype,getAttributes:e=>{const[,,t,s,r]=e;return{src:s,alt:t,title:r}}})]}}),N1=j1,k1=g1;function S1(e){const t=e.trim();return t.includes("youtube.com")||t.includes("youtu.be")?"YouTube":t.includes("facebook.com/plugins/post.php")||/facebook\.com\/[^\s"'<]+\/posts\//i.test(t)?"Wpis Facebook":t.includes("facebook.com")?"Facebook":t.includes("x.com")||t.includes("twitter.com")||/twitter-tweet/i.test(t)?"X (Twitter)":/<iframe/i.test(t)?"Osadzenie iframe":"Osadzenie mediów"}function C1({node:e,deleteNode:t,updateAttributes:s,selected:r}){const o=String(e.attrs.source??""),[a,i]=f.useState(!1),[l,c]=f.useState(o),d=f.useMemo(()=>Ml(o),[o]),h=f.useMemo(()=>S1(o),[o]),u=()=>{const p=yo(l);if(!p){G.error("NieobsÅugiwany link lub kod iframe.");return}s({source:p}),i(!1),G.success("Osadzenie zaktualizowane")};return n.jsxs(Fp,{as:"div",className:`media-embed-editor-block my-4 rounded-lg border bg-news-surface-2 overflow-hidden ${r?"border-news-red ring-1 ring-news-red/40":"border-border"}`,"data-media-embed-editor":"",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border bg-news-surface-3",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(nf,{size:14,className:"text-news-red flex-shrink-0"}),n.jsx("span",{className:"text-xs font-semibold text-foreground truncate",children:h})]}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[n.jsx("button",{type:"button",title:"Edytuj kod / link",onClick:()=>{c(o),i(p=>!p)},className:"p-1.5 rounded text-news-muted hover:text-foreground hover:bg-news-surface-2 transition-colors",children:n.jsx(vg,{size:14})}),n.jsx("button",{type:"button",title:"UsuÅ osadzenie",onClick:t,className:"p-1.5 rounded text-news-muted hover:text-destructive hover:bg-destructive/10 transition-colors",children:n.jsx(qe,{size:14})})]})]}),a?n.jsxs("div",{className:"p-3 space-y-2 border-b border-border",children:[n.jsx("label",{className:"text-[11px] text-news-muted block",children:"Link YouTube / Facebook / X lub kod osadzenia"}),n.jsx("textarea",{value:l,onChange:p=>c(p.target.value),rows:4,className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-xs text-foreground font-mono focus:outline-none focus:border-news-red resize-y"}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>i(!1),className:"inline-flex items-center gap-1 px-2.5 py-1.5 text-xs text-news-muted hover:text-foreground",children:[n.jsx(He,{size:12}),"Anuluj"]}),n.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-1 px-2.5 py-1.5 text-xs bg-news-red text-white rounded hover:bg-news-red-bright",children:[n.jsx(xn,{size:12}),"Zapisz"]})]})]}):n.jsx("div",{className:"px-3 py-2 border-b border-border max-h-24 overflow-auto",children:n.jsx("p",{className:"text-[11px] text-news-muted font-mono break-all whitespace-pre-wrap",children:o})}),n.jsx("div",{className:"media-embed-editor-preview p-3 [&_.article-video-embed]:my-0 [&_.article-facebook-post-embed]:my-0 [&_.article-x-tweet-embed]:my-0",dangerouslySetInnerHTML:{__html:d||'<p class="text-xs text-news-muted">Brak podglÄ
du</p>'}})]})}const _1=kt.create({name:"mediaEmbed",group:"block",atom:!0,selectable:!0,draggable:!0,addAttributes(){return{source:{default:"",parseHTML:e=>e.hasAttribute("data-source")?Cf(e.getAttribute("data-source")||""):eb(e),renderHTML:e=>
48e.source?{"data-source":Qx(e.source)}:{}}}},parseHTML(){return[{tag:"div[data-media-embed]"},{tag:"div.article-video-embed"},{tag:"div.article-facebook-post-embed"},{tag:"div.article-x-tweet-embed"}]},renderHTML({HTMLAttributes:e}){return["div",Ze(e,{"data-media-embed":"",class:"article-media-embed-marker"})]},addNodeView(){return Bp(C1)},addCommands(){return{insertMediaEmbed:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{source:e}})}}});function lt({onClick:e,active:t=!1,title:s,children:r}){return n.jsx("button",{type:"button",title:s,onClick:e,className:`p-1.5 rounded transition-colors ${t?"bg-news-red text-white":"text-news-muted hover:text-foreground hover:bg-news-surface-3"}`,children:r})}function sr(){return n.jsx("div",{className:"w-px h-5 bg-border mx-1 self-center flex-shrink-0"})}const T1=[y1.configure({link:!1}),Ek.configure({openOnClick:!1,autolink:!0,defaultProtocol:"https",shouldAutoLink:Ef,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),N1.configure({inline:!1,allowBase64:!0}),_1,k1.configure({placeholder:"Zacznij pisaÄ treÅÄ artykuÅu..."})];function Sh({content:e,onChange:t,onInsertImageClick:s,onInsertGalleryClick:r}){const[o,a]=f.useState(""),[i,l]=f.useState(!1),[c,d]=f.useState(""),[h,u]=f.useState(!1),p=Wp({extensions:T1,content:e,onUpdate:({editor:g})=>{t(g.getHTML())},editorProps:{attributes:{class:"prose prose-invert max-w-none min-h-[400px] p-4 focus:outline-none text-foreground"},handlePaste:(g,y)=>{var S,z;const N=((S=y.clipboardData)==null?void 0:S.getData("text/plain"))??"",w=((z=y.clipboardData)==null?void 0:z.getData("text/html"))??"";let k=yo(rb(N,w)??"")??(N.trim()?yo(N.trim()):null);if(!k)return!1;const E=g.state.schema.nodes.mediaEmbed;if(!E)return!1;y.preventDefault();const v=E.create({source:k});return g.dispatch(g.state.tr.replaceSelectionWith(v)),!0}}});if(f.useEffect(()=>{if(!p)return;const g=p.getHTML();e!==g&&p.commands.setContent(e,{emitUpdate:!1})},[p,e]),f.useEffect(()=>{const g=w=>{const k=w.detail.url;p&&k&&p.chain().focus().setImage({src:k}).run()},y=w=>{const k=w.detail.urls;if(!p||!(k!=null&&k.length))return;const E=k.map(v=>`<p><img src="${v.replace(/"/g,""")}" alt="" /></p>`).join("");p.chain().focus().insertContent(E).run()},N=w=>{const k=w.detail.text;p&&k&&p.chain().focus().insertContent(`<p>${k}</p>`).run()};return window.addEventListener("tiptap-insert-image",g),window.addEventListener("tiptap-insert-images",y),window.addEventListener("tiptap-insert-shortcode",N),()=>{window.removeEventListener("tiptap-insert-image",g),window.removeEventListener("tiptap-insert-images",y),window.removeEventListener("tiptap-insert-shortcode",N)}},[p]),!p)return null;const m=()=>{const g=o.trim();if(!g||!p)return;const y=/^https?:\/\//i.test(g)?g:`https://${g}`;p.isActive("link")?p.chain().focus().extendMarkRange("link").setLink({href:y}).run():p.state.selection.empty?p.chain().focus().insertContent(`<a href="${y}">${y}</a>`).run():p.chain().focus().setLink({href:y}).run(),a(""),l(!1)},b=()=>{if(p.isActive("link")){p.chain().focus().unsetLink().run(),l(!1);return}const g=p.getAttributes("link").href;a(g??""),l(y=>!y),u(!1)},x=()=>{const g=c.trim();if(!g||!p)return;const y=yo(g);if(!y){G.error("NieobsÅugiwany link. Wklej adres YouTube, Facebook, X (Twitter) lub kod osadzenia.");return}p.chain().focus().insertMediaEmbed(y).run(),d(""),u(!1)};return n.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-news-surface-2",children:[n.jsxs("div",{className:"border-b border-border bg-news-surface-3 p-2 flex flex-wrap items-center gap-0.5",children:[n.jsx(lt,{title:"Cofnij",onClick:()=>p.chain().focus().undo().run(),children:n.jsx(jg,{size:15})}),n.jsx(lt,{title:"Ponów",onClick:()=>p.chain().focus().redo().run(),children:n.jsx(Ng,{size:15})}),n.jsx(sr,{}),n.jsx(lt,{title:"NagÅówek 1",active:p.isActive("heading",{level:1}),onClick:()=>p.chain().focus().toggleHeading({level:1}).run(),children:n.jsx(kg,{size:15})}),n.jsx(lt,{title:"NagÅówek 2",active:p.isActive("heading",{level:2}),onClick:()=>p.chain().focus().toggleHeading({level:2}).run(),children:n.jsx(Sg,{size:15})}),n.jsx(lt,{title:"NagÅówek 3",active:p.isActive("heading",{level:3}),onClick:()=>p.chain().focus().toggleHeading({level:3}).run(),children:n.jsx(Cg,{size:15})}),n.jsx(sr,{}),n.jsx(lt,{title:"Pogrubienie",active:p.isActive("bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:n.jsx(_g,{size:15})}),n.jsx(lt,{title:"Kursywa",active:p.isActive("italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:n.jsx(Tg,{size:15})}),n.jsx(lt,{title:"PrzekreÅlenie",active:p.isActive("strike"),onClick:()=>p.chain().focus().toggleStrike().run(),children:n.jsx(Eg,{size:15})}),n.jsx(lt,{title:"Kod inline",active:p.isActive("code"),onClick:()=>p.chain().focus().toggleCode().run(),children:n.jsx(zg,{size:15})}),n.jsx(sr,{}),n.jsx(lt,{title:"Lista punktowana",active:p.isActive("bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:n.jsx(tf,{size:15})}),n.jsx(lt,{title:"Lista numerowana",active:p.isActive("orderedList"),onClick:()=>p.chain().focus().toggleOrderedList().run(),children:n.jsx(Ag,{size:15})}),n.jsx(lt,{title:"Cytat",active:p.isActive("blockquote"),onClick:()=>p.chain().focus().toggleBlockquote().run(),children:n.jsx(Mg,{size:15})}),n.jsx(lt,{title:"Linia pozioma",onClick:()=>p.chain().focus().setHorizontalRule().run(),children:n.jsx(Lg,{size:15})}),n.jsx(sr,{}),n.jsxs("div",{className:"relative",children:[n.jsx(lt,{title:"Dodaj link",active:p.isActive("link")||i,onClick:b,children:n.jsx(Ig,{size:15})}),i&&n.jsxs("div",{className:"absolute top-full left-0 mt-1 z-20 bg-news-surface border border-border rounded-lg shadow-lg p-2 flex gap-2 min-w-[240px]",children:[n.jsx("input",{autoFocus:!0,t
48ype:"url",placeholder:"https://...",value:o,onChange:g=>a(g.target.value),onKeyDown:g=>g.key==="Enter"&&m(),className:"flex-1 bg-news-surface-3 border border-border rounded px-2 py-1 text-xs text-foreground focus:outline-none focus:border-news-red"}),n.jsx("button",{type:"button",onClick:m,className:"bg-news-red text-white text-xs px-3 py-1 rounded hover:bg-news-red-bright transition-colors",children:"OK"})]})]}),n.jsxs("div",{className:"relative",children:[n.jsx(lt,{title:"Wstaw film, wpis lub post (YouTube / Facebook / X)",active:h,onClick:()=>{u(g=>!g),l(!1)},children:n.jsx(nf,{size:15})}),h&&n.jsxs("div",{className:"absolute top-full left-0 mt-1 z-20 bg-news-surface border border-border rounded-lg shadow-lg p-3 space-y-2 w-[min(420px,calc(100vw-2rem))]",children:[n.jsx("label",{className:"text-[11px] text-news-muted block",children:"Link YouTube / Facebook / X lub kod osadzenia (iframe / blockquote)"}),n.jsx("textarea",{autoFocus:!0,rows:4,placeholder:'https://x.com/user/status/123⦠lub <blockquote class="twitter-tweet">â¦</blockquote>',value:c,onChange:g=>d(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&x()},className:"w-full bg-news-surface-3 border border-border rounded px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:border-news-red resize-y"}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:()=>u(!1),className:"text-xs text-news-muted hover:text-foreground px-2 py-1",children:"Anuluj"}),n.jsx("button",{type:"button",onClick:x,className:"bg-news-red text-white text-xs px-3 py-1.5 rounded hover:bg-news-red-bright transition-colors",children:"Wstaw osadzenie"})]})]})]}),s&&n.jsx(lt,{title:"Wstaw obraz z biblioteki",onClick:s,children:n.jsx(Pn,{size:15})}),r&&n.jsx(lt,{title:"Galeria zdjÄÄ artykuÅu",onClick:r,children:n.jsx(ws,{size:15})}),n.jsx(sr,{}),n.jsx(lt,{title:"Akapit",active:p.isActive("paragraph"),onClick:()=>p.chain().focus().setParagraph().run(),children:n.jsx(Og,{size:15})})]}),n.jsx(Up,{editor:p}),n.jsx("style",{children:` 49 .tiptap p.is-editor-empty:first-child::before { 50 content: attr(data-placeholder); 51 float: left; 52 color: hsl(var(--news-dim)); 53 pointer-events: none; 54 height: 0; 55 } 56 .tiptap h1 { font-size: 1.75rem; font-weight: 800; margin: 1rem 0 0.5rem; font-family: var(--font-serif, serif); } 57 .tiptap h2 { font-size: 1.35rem; font-weight: 700; margin: 1rem 0 0.5rem; font-family: var(--font-serif, serif); } 58 .tiptap h3 { font-size: 1.1rem; font-weight: 700; margin: 0.75rem 0 0.4rem; } 59 .tiptap blockquote { border-left: 3px solid hsl(var(--news-red)); padding-left: 1rem; color: hsl(var(--muted-foreground)); font-style: italic; margin: 0.75rem 0; } 60 .tiptap ul { list-style: disc; padding-left: 1.5rem; } 61 .tiptap ol { list-style: decimal; padding-left: 1.5rem; } 62 .tiptap code { background: hsl(var(--muted)); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.875em; } 63 .tiptap hr { border: none; border-top: 1px solid hsl(var(--border)); margin: 1.5rem 0; } 64 .tiptap img { max-width: 100%; border-radius: 6px; margin: 0.75rem 0; } 65 .tiptap a { color: hsl(var(--news-red)); text-decoration: underline; } 66 .tiptap p { margin: 0.4rem 0; line-height: 1.7; } 67 .media-embed-editor-block { margin: 1rem 0; } 68 .media-embed-editor-preview .article-video-embed { 69 position: relative; 70 width: 100%; 71 aspect-ratio: 16 / 9; 72 border-radius: 0.375rem; 73 overflow: hidden; 74 background: hsl(var(--news-surface-3)); 75 } 76 .media-embed-editor-preview .article-video-embed iframe { 77 position: absolute; 78 inset: 0; 79 width: 100%; 80 height: 100%; 81 border: 0; 82 } 83 .media-embed-editor-preview .article-facebook-post-embed { 84 width: 100%; 85 max-width: 500px; 86 margin: 0 auto; 87 border-radius: 0.375rem; 88 overflow: hidden; 89 } 90 .media-embed-editor-preview .article-facebook-post-embed iframe { 91 display: block; 92 width: 100%; 93 min-height: 420px; 94 border: 0; 95 } 96 .media-embed-editor-preview .article-x-tweet-embed { 97 width: 100%; 98 max-width: 550px; 99 margin: 0 auto; 100 border-radius: 0.375rem; 101 overflow: hidden; 102 } 103 .media-embed-editor-preview .article-x-tweet-embed iframe { 104 display: block; 105 width: 100%; 106 min-height: 420px; 107 border: 0; 108 } 109 `})]})}function E1({open:e,onClose:t,ensureArticleId:s,onInsertShortcode:r,articleContent:o=""}){const[a,i]=f.useState(null),[l,c]=f.useState(!1),[d,h]=f.useState([]),[u,p]=f.useState(!1),[m,b]=f.useState(null),[x,g]=f.useState(!1),[y,N]=f.useState(""),[w,k]=f.useState(An),[E,v]=f.useState(!1),[S,z]=f.useState(null),B=f.useCallback(async C=>{p(!0);try{h(await $.getGalleries(C))}catch{h([])}p(!1)},[]),M=f.useCallback(async(C,I)=>{const F=await $.getGalleries(C),ae=F.find(Z=>Z.id===I)??null;b(ae),h(F)},[]);f.useEffect(()=>{if(!e){b(null),N(""),k(An),g(!1);return}let C=!1;return(async()=>{c(!0);const I=await s();if(!C){if(!I){G.error("Napisz tytuÅ lub treÅÄ artykuÅu, aby utworzyÄ szkic i dodaÄ galeriÄ"),t(),c(!1);return}i(I),await B(I),c(!1)}})(),()=>{C=!0}},[e,s,B,t]);const D=async()=>
109{if(!(!a||!y.trim())){v(!0);try{const C=await $.createGallery({title:y.trim(),article_id:a,placement:w});N(""),await B(a),b(C),w==="inline"?r(C.id)?G.success("Galeria utworzona â shortcode wstawiony w treÅÄ"):G.success("Galeria utworzona (shortcode już byÅ w treÅci)"):G.success("Galeria utworzona i przypisana do artykuÅu")}catch{G.error("Nie udaÅo siÄ utworzyÄ galerii")}v(!1)}},A=async C=>{confirm("UsunÄ
Ä galeriÄ?")&&(await $.deleteGallery(C),(m==null?void 0:m.id)===C&&b(null),a&&B(a))},U=async C=>{var F;if(!m||!a)return;let I=((F=m.items)==null?void 0:F.length)??0;for(const ae of C)await $.addGalleryItem(m.id,{media_id:ae.id,position:I}),I+=1;g(!1),await M(a,m.id),G.success(C.length===1?"Dodano zdjÄcie do galerii":`Dodano ${C.length} zdjÄÄ do galerii`)},se=async(C,I)=>{if(a){z(I);try{await $.deleteGalleryItem(I),await M(a,C),G.success("UsuniÄto zdjÄcie z galerii")}catch{G.error("Nie udaÅo siÄ usunÄ
Ä zdjÄcia")}z(null)}},P=C=>{r(C)&&G.success("Shortcode wstawiony w treÅÄ artykuÅu")},ne=C=>pm(o,C);return e?n.jsxs("div",{className:"fixed inset-0 bg-black/70 z-50 flex items-center justify-center p-4",children:[n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl w-full max-w-4xl max-h-[85vh] flex flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ws,{size:20,className:"text-news-red"}),n.jsx("h2",{className:"font-bold text-foreground",children:"Galerie tego artykuÅu"})]}),n.jsx("button",{type:"button",onClick:t,className:"text-news-muted hover:text-foreground transition-colors",children:n.jsx(He,{size:20})})]}),l?n.jsx("div",{className:"flex-1 flex items-center justify-center py-16",children:n.jsx(fe,{size:28,className:"animate-spin text-news-muted"})}):n.jsxs("div",{className:"flex-1 overflow-auto p-5 space-y-5",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4 space-y-3",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Nowa galeria"}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"TytuÅ"}),n.jsx("input",{value:y,onChange:C=>N(C.target.value),placeholder:"Np. Galeria ze szczytu NATO",className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Gdzie wyÅwietliÄ"}),n.jsx("select",{value:w,onChange:C=>k(C.target.value),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:Object.entries(Lo).map(([C,I])=>n.jsx("option",{value:C,children:I},C))})]})]}),n.jsxs("button",{type:"button",onClick:D,disabled:E||!y.trim(),className:"flex items-center justify-center gap-2 bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50",children:[E?n.jsx(fe,{size:15,className:"animate-spin"}):n.jsx(Ft,{size:15}),"Utwórz galeriÄ"]})]}),n.jsxs("div",{children:[n.jsxs("h3",{className:"text-sm font-bold text-foreground mb-2",children:["Galerie artykuÅu ",u?"":`(${d.length})`]}),u?n.jsx("div",{className:"space-y-2",children:[1,2].map(C=>n.jsx("div",{className:"h-14 bg-news-surface-2 rounded-lg animate-pulse"},C))}):d.length===0?n.jsx("p",{className:"text-sm text-news-muted py-4 text-center border border-dashed border-border rounded-lg",children:"Brak galerii â utwórz pierwszÄ
powyżej"}):n.jsx("div",{className:"space-y-2",children:d.map(C=>{var ae,Z;const I=C.placement??An,F=(m==null?void 0:m.id)===C.id;return n.jsxs("div",{className:`border rounded-lg overflow-hidden transition-colors ${F?"border-news-red bg-news-surface-2":"border-border bg-news-surface-2"}`,children:[n.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[n.jsxs("button",{type:"button",onClick:()=>b(F?null:C),className:"flex items-center gap-3 flex-1 min-w-0 text-left hover:opacity-80 transition-opacity",children:[n.jsx(ws,{size:16,className:"text-news-dim flex-shrink-0"}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:C.title||"Bez tytuÅu"}),n.jsxs("p",{className:"text-xs text-news-muted",children:[Lo[I]," · ",((ae=C.items)==null?void 0:ae.length)??0," zdjÄÄ"]})]})]}),I==="inline"&&(ne(C.id)?n.jsx("span",{className:"text-xs text-news-muted flex-shrink-0",children:"Już w treÅci"}):n.jsxs("button",{type:"button",onClick:()=>P(C.id),className:"text-xs text-news-red hover:underline flex items-center gap-1 flex-shrink-0",children:[n.jsx(vr,{size:12}),"Wstaw"]}))]}),F&&n.jsxs("div",{className:"px-4 pb-4 border-t border-border pt-3 space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsxs("button",{type:"button",onClick:()=>g(!0),className:"flex items-center gap-1.5 bg-news-red text-white px-3 py-1.5 rounded text-xs font-semibold hover:bg-news-red-bright transition-colors",children:[n.jsx(Ft,{size:13}),"Dodaj zdjÄcia"]}),I==="inline"&&!ne(C.id)&&n.jsxs("button",{type:"button",onClick:()=>P(C.id),className:"flex items-center gap-1.5 border border-border px-3 py-1.5 rounded text-xs text-foreground hover:bg-news-surface-3 transition-colors",children:[n.jsx(vr,{size:13}),"Wstaw shortcode"]}
109),I==="inline"&&ne(C.id)&&n.jsx("span",{className:"text-xs text-news-muted px-3 py-1.5",children:"Shortcode już w treÅci"}),n.jsxs("button",{type:"button",onClick:()=>A(C.id),className:"flex items-center gap-1.5 border border-destructive/30 text-destructive px-3 py-1.5 rounded text-xs hover:bg-destructive/10 transition-colors ml-auto",children:[n.jsx(qe,{size:13}),"UsuÅ"]})]}),(Z=C.items)!=null&&Z.length?n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-5 gap-2",children:C.items.map(Q=>n.jsxs("button",{type:"button",title:"Kliknij, aby usunÄ
Ä z galerii",disabled:S===Q.id,onClick:()=>se(C.id,Q.id),className:"group relative aspect-square rounded overflow-hidden border border-border hover:border-destructive/50 transition-colors disabled:opacity-50",children:[n.jsx(Bt,{src:Q.url,cacheKey:Q.id,alt:"",className:"w-full h-full object-cover"}),n.jsx("span",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/50 transition-colors flex items-center justify-center",children:S===Q.id?n.jsx(fe,{size:18,className:"text-white animate-spin"}):n.jsx(qe,{size:18,className:"text-white opacity-0 group-hover:opacity-100 transition-opacity"})})]},Q.id))}),n.jsx("p",{className:"text-[11px] text-news-muted leading-relaxed",children:"ZdjÄcia widoczne tutaj sÄ
już dodane do galerii i pojawiÄ
siÄ w artykule po zapisaniu wpisu."})]}):n.jsx("p",{className:"text-xs text-news-muted text-center py-6 border border-dashed border-border rounded-lg",children:"Galeria jest pusta â dodaj zdjÄcia z biblioteki"})]})]},C.id)})})]})]})]}),n.jsx(Jm,{open:x,onClose:()=>g(!1),onAdd:U})]}):null}const z1=[{category:"BezpieczeÅstwo",re:/\bnato\b|bezpiecze|marynark|wojsk|obron|granicy|straż granic|siÅy zbroj|rosyjsk|manewr|patrol|fregat|korwet|podwodn|sÅużb mundur|ministerstwo obrony/i},{category:"Offshore",re:/\boffshore\b|farma\s+wiatr|wiata|morska energ|\bmewa\b|orlen plaga|baltic power|\bowp\b/i},{category:"Stocznie",re:/\bstoczni|\bstocznia\b|remontow|\bokrÄt\b|budow[aÄ
]\s+statk|kontrakt\s+stocz/i},{category:"Porty",re:/\bport(?:u|ów|y|ach|em|om|ami|ie)?\b|\bterminal(?:u|i|ow|ami|ach|em|a|i)?\b|\bgazoport|\bnabrzeż|\bgdaÅsk|\bgdyni|\bszczecin|\bÅwinoujÅcie|\belblÄ
g|\bkoÅobrzeg|\bprom\b|\bkontenerow/i},{category:"Historia",re:/histori|rocznic|bitwa|muzeum|dziedzictw|tradycj|okrÄt\s+w\s+|legenda/i},{category:"Edukacja",re:/edukac|szkoÅ|uczelni|akademi|\bkurs\b|studen|naukow|konferencj nauk/i},{category:"Technologie",re:/technolog|innov|innowac|digital|automatyz|system\s+IT|sztuczn[aÄ
]\s+inteligenc/i},{category:"Turystyka",re:/turyst|wakacj|plaż|rejs tur|pasażer|\bferry\b|prom\s+pas|wycieczk/i},{category:"Årodowisko",re:/Årodowisk|ekolog|emisyj|klimat|morski\s+obszar|ochron[aÄ
]\s+przyro|zanieczyszcz/i}],A1=["BezpieczeÅstwo","Offshore","Stocznie","Porty","Historia","Edukacja","Technologie","Turystyka","Årodowisko"];function M1(e,t){const s=e.flags.includes("g")?e.flags:`${e.flags}g`,r=new RegExp(e.source,s);let o=0,a=r.exec(t);for(;a;)o+=1,a=r.exec(t);return o}function du(e,t="",s=""){const r=`${e??""} ${t??""} ${s??""}`.trim();if(r.length<8)return null;const o=new Map;for(const l of z1){const c=M1(l.re,r);c>0&&o.set(l.category,(o.get(l.category)??0)+c)}if(o.size===0)return null;let a=null,i=0;for(const l of A1){const c=o.get(l);c!=null&&c>i&&(i=c,a=l)}return a}function L1(e){return Dl(e)}function uu(e){if(!e)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()}function Us(e){return JSON.stringify(e)}function fu(e){const t=s=>{if(!s)return"";const r=new Date(s);if(Number.isNaN(r.getTime()))return"";const o=a=>String(a).padStart(2,"0");return`${r.getFullYear()}-${o(r.getMonth()+1)}-${o(r.getDate())}T${o(r.getHours())}:${o(r.getMinutes())}`};return{title:e.title,slug:e.slug,slugManual:!0,excerpt:e.excerpt??"",content:e.content??"",imageUrl:e.image_url??"",category:e.category,status:e.status??"draft",featured:e.featured,important:e.important??!1,sponsored:e.sponsored,tags:e.tags??[],scheduledAt:t(e.scheduled_at),publishedAt:t(e.published_at)||t(new Date().toISOString()),readTime:e.read_time??3}}function vi(e){const t=e.trim();return!t||t==="<p></p>"||t==="<p><br></p>"||t==="<p><br/></p>"}function I1({article:e,form:t,userId:s,onDraftCreated:r,onDirtyChange:o,enabled:a=!0}){const i=f.useRef(t);i.current=t;
109const l=f.useRef((e==null?void 0:e.id)??null),c=f.useRef(Us(e?fu(e):t)),d=f.useRef(!1),h=f.useRef(!!(e!=null&&e.id)),[u,p]=f.useState("idle"),[m,b]=f.useState(null);f.useEffect(()=>{e!=null&&e.id&&(l.current=e.id,h.current=!0,c.current=Us(fu(e)))},[e==null?void 0:e.id,e==null?void 0:e.updated_at]);const x=Us(t)!==c.current;f.useEffect(()=>{o==null||o(x)},[x,o]);const g=a&&!(e!=null&&e.read_only)&&(t.title.trim().length>0||!vi(t.content)),y=f.useCallback(v=>{const S=v.title.trim(),z=S||"Szkic bez tytuÅu",B=v.slug.trim()||L1(S)||`szkic-${Date.now().toString(36)}`,D=!l.current||v.status==="draft"?"draft":v.status,A=D==="published"&&v.publishedAt?uu(v.publishedAt):D==="published"?new Date().toISOString():null,U=D==="scheduled"&&v.scheduledAt?uu(v.scheduledAt):null;return{title:z,slug:B,excerpt:v.excerpt.trim()||null,content:vi(v.content)?"<p></p>":v.content,image_url:v.imageUrl||null,category:v.category,status:D,featured:v.featured,important:v.important,sponsored:v.sponsored,tags:v.tags,read_time:v.readTime,scheduled_at:U,published_at:A}},[]),N=f.useCallback(async()=>{const v=i.current,S=Us(v)!==c.current;if(!a||e!=null&&e.read_only||d.current||!S||!(v.title.trim().length>0||!vi(v.content)))return!1;d.current=!0,p("saving");try{const z=y(v);let B;return l.current?B=await $.updateArticle(l.current,z):(B=await $.createArticle({...z,author_id:s??null}),l.current=B.id,h.current||(h.current=!0,r==null||r(B))),c.current=Us(i.current),b(new Date),p("saved"),!0}catch{return p("error"),!1}finally{d.current=!1}},[e==null?void 0:e.read_only,y,a,r,s]);f.useEffect(()=>{if(!a||e!=null&&e.read_only)return;const v=window.setInterval(()=>{N()},6e4);return()=>window.clearInterval(v)},[a,e==null?void 0:e.read_only,N]),f.useEffect(()=>{if(!a||e!=null&&e.read_only||l.current||!g||!x)return;const v=window.setTimeout(()=>{N()},4e3);return()=>window.clearTimeout(v)},[g,a,e==null?void 0:e.read_only,x,t,N]),f.useEffect(()=>{const v=S=>{Us(i.current)!==c.current&&(S.preventDefault(),S.returnValue="")};return window.addEventListener("beforeunload",v),()=>window.removeEventListener("beforeunload",v)},[]);const w=f.useCallback(v=>{c.current=Us(v??i.current),o==null||o(!1),p("saved")},[o]),k=f.useCallback(()=>l.current,[]),E=f.useCallback(async(v=15e3)=>{const S=Date.now();for(;d.current;){if(Date.now()-S>v)throw new Error("Autosave trwa zbyt dÅugo â spróbuj ponownie za chwilÄ");await new Promise(z=>setTimeout(z,100))}},[]);return{isDirty:x,autoSaveState:u,lastAutoSavedAt:m,performAutosave:N,waitForAutosave:E,getArticleId:k,markSaved:w}}function O1(){return window.confirm("Masz niezapisane zmiany. Czy na pewno chcesz opuÅciÄ edytor? Niezapisana treÅÄ może zostaÄ utracona.")}function mu(e){return Dl(e)}function rn(e){if(!e)return"";const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const s=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${s(t.getMonth()+1)}-${s(t.getDate())}T${s(t.getHours())}:${s(t.getMinutes())}`}function nr(e){if(!e)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()}function hu({article:e,onSaved:t,onCancel:s,onDraftCreated:r,onDirtyChange:o}){const{user:a}=yn(),{names:i}=wn(!1,!0),l=i.length?i:Fr,c=!!e,[d,h]=f.useState((e==null?void 0:e.id)??null),[u,p]=f.useState((e==null?void 0:e.title)??""),[m,b]=f.useState((e==null?void 0:e.slug)??""),[x,g]=f.useState(c),[y,N]=f.useState((e==null?void 0:e.excerpt)??""),[w,k]=f.useState((e==null?void 0:e.content)??""),[E,v]=f.useState((e==null?void 0:e.image_url)??""),[S,z]=f.useState(0),[B,M]=f.useState((e==null?void 0:e.category)??""),[D,A]=f.useState((e==null?void 0:e.status)??"draft"),[U,se]=f.useState((e==null?void 0:e.featured)??!1),[P,ne]=f.useState((e==null?void 0:e.important)??!1),[C,I]=f.useState((e==null?void 0:e.sponsored)??!1),[F,ae]=f.useState((e==null?void 0:e.tags)??[]),[Z,Q]=f.useState(""),[re,oe]=f.useState(rn(e==null?void 0:e.scheduled_at)),[Y,O]=f.useState(rn(e==null?void 0:e.published_at)||rn(new Date().toISOString())),[_,W]=f.useState((e==null?void 0:e.read_time)??3),[de,he]=f.useState(!1),[ve,R]=f.useState(!1),[ie,ge]=f.useState(null),[H,ce]=f.useState(!1),[ke,T]=f.useState(!1),[te,xe]=f.useState(!1),[me,at]=f.useState(!1),[De,st]=f.useState(!1),[Qe,Xe]=f.useState(!1),[Je,xt]=f.useState(!!e),[It,nt]=f.useState(!1),it=f.useMemo(()=>({title:u,slug:m,slugManual:x,excerpt:y,content:w,imageUrl:E,category:B,status:D,featured:U,important:P,sponsored:C,tags:F,scheduledAt:re,publishedAt:Y,readTime:_}),[u,m,x,y,w,E,B,D,U,P,C,F,re,Y,_]),Ut=f.useCallback(K=>{h(K.id),r==null||r(K)},[r]),{isDirty:Ht,autoSaveState:mt,lastAutoSavedAt:Ot,markSaved:yt,performAutosave:fs,waitForAutosave:Dt,getArticleId:rt}=I1({article:e,form:it,userId:a==null?void 0:a.id,onDraftCreated:Ut,onDirtyChange:o,enabled:!(e!=null&&e.read_only)}),ms=f.useCallback(()=>{s==null||s()},[s]),Is=f.useCallback(async()=>{const K=d??(e==null?void 0:e.id)??rt()??null;return K||(await fs()?d??(e==null?void 0:e.id)??rt()??null:null)},[d,e==null?void 0:e.id,rt,fs]),Pe=f.useCallback(K=>
109pm(w,K)?(G.info("Ta galeria jest już w treÅci artykuÅu â nie dodano duplikatu"),!1):(window.dispatchEvent(new CustomEvent("tiptap-insert-shortcode",{detail:{text:`[gallery id="${K}"]`}})),!0),[w]);f.useEffect(()=>{e&&(p(e.title),b(e.slug),g(!0),N(e.excerpt??""),k(e.content??""),v(e.image_url??""),z(K=>K+1),M(e.category),xt(!0),nt(!1),A(e.status??"draft"),se(e.featured),ne(e.important??!1),I(e.sponsored),ae(e.tags??[]),oe(rn(e.scheduled_at)),O(rn(e.published_at)||rn(new Date().toISOString())),W(e.read_time??3))},[e==null?void 0:e.id]),f.useEffect(()=>{e!=null&&e.id&&h(e.id)},[e==null?void 0:e.id]);const Le=f.useCallback(()=>{const K=du(u,y,F.join(" "));if(K&&l.includes(K)){M(K),nt(!0),xt(!1);return}G.info("Nie rozpoznano kategorii â dopisz wiÄcej szczegóÅów w tytule lub leadzie.")},[u,y,F,l]);f.useEffect(()=>{if(Je||e||!u.trim()&&!y.trim())return;const K=setTimeout(()=>{const Ae=du(u,y,F.join(" "));Ae&&l.includes(Ae)&&(M(Ae),nt(!0))},500);return()=>clearTimeout(K)},[u,y,F,Je,e,l]);const et=K=>{p(K),x||b(mu(K))},ue=D==="scheduled"&&re?nr(re):Y?nr(Y):(e==null?void 0:e.published_at)??(e==null?void 0:e.created_at)??new Date().toISOString(),be=am(ue),pe=`/${be.year}/${be.month}/${be.day}/`,ze=rn(new Date().toISOString()),Re=()=>{const K=Z.trim().replace(/^#/,"");K&&!F.includes(K)&&ae(Ae=>[...Ae,K]),Q("")},Ee=K=>ae(Ae=>Ae.filter(Os=>Os!==K)),Ge=f.useCallback(K=>{v(Po(K)),z(Ae=>Ae+1)},[]),Ie=f.useCallback(async K=>{if(!K.type.startsWith("image/")){G.error("Dozwolone sÄ
tylko pliki graficzne");return}Xe(!0);try{const Ae=await $.uploadMedia(K);Ge(Ae.url),G.success("ZdjÄcie gÅówne wgrane")}catch(Ae){G.error(Ae instanceof Error?Ae.message:"Nie udaÅo siÄ wgraÄ zdjÄcia")}finally{Xe(!1)}},[Ge]),$e=K=>{K.preventDefault(),K.stopPropagation(),st(!0)},Zt=K=>{K.preventDefault();const Ae=K.relatedTarget;(!Ae||!K.currentTarget.contains(Ae))&&st(!1)},Gt=async K=>{if(K.preventDefault(),K.stopPropagation(),st(!1),Qe)return;const Ae=[...K.dataTransfer.files].find(Os=>Os.type.startsWith("image/"));if(!Ae){G.error("UpuÅÄ plik graficzny (JPG, PNG, WebPâ¦)");return}await Ie(Ae)},St=()=>{Qe||ce(!0)},Ct=async(K=!1)=>{if(!u.trim()){ge("TytuÅ jest wymagany");return}if(!w.trim()||w==="<p></p>"){ge("TreÅÄ artykuÅu jest wymagana");return}if(!B.trim()){ge("Wybierz kategoriÄ lub kliknij âSugeruj z tytuÅuâ");return}if(D==="scheduled"&&!K&&!re){ge("Ustaw datÄ publikacji dla zaplanowanego artykuÅu");return}const Ae=K?"published":D;if(Ae==="published"&&Y){const Pt=nr(Y);if(Pt&&new Date(Pt).getTime()>Date.now()){ge("Data publikacji nie może byÄ w przyszÅoÅci â użyj statusu âZaplanowanyâ.");return}}ge(null),he(!0);try{await Dt()}catch(Pt){ge(Pt instanceof Error?Pt.message:"Autosave blokuje zapis"),he(!1);return}const Os=m||mu(u),Gn=Ae==="published"?K&&D==="scheduled"?new Date().toISOString():Y?nr(Y):new Date().toISOString():null,Jr=Ae==="scheduled"&&re?nr(re):null,Yn={title:u.trim(),slug:Os,excerpt:y.trim()||null,content:w,image_url:E||null,category:B,status:Ae,featured:U,important:P,sponsored:C,tags:F,read_time:_,scheduled_at:Jr,published_at:Gn};try{const Pt=d??(e==null?void 0:e.id)??null;if(Pt){if(e!=null&&e.read_only){ge("ArtykuÅy WordPress sÄ
tylko do odczytu");return}await $.updateArticle(Pt,Yn)}else{const Pa=await $.createArticle({...Yn,author_id:(a==null?void 0:a.id)??null});h(Pa.id)}yt(it),R(!0),setTimeout(()=>R(!1),3e3),t==null||t()}catch(Pt){ge(Pt instanceof Error?Pt.message:"BÅÄ
d zapisu")}finally{he(!1)}},en=()=>at(!0),Da=D==="scheduled"?"Zapisz zaplanowanie":D==="published"?c?"Zapisz zmiany":"Opublikuj":c?"Zapisz zmiany":"Zapisz szkic",Be=D==="scheduled"?"Opublikuj teraz":"Opublikuj";return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"max-w-5xl space-y-0",children:[d&&!c&&n.jsxs("div",{className:"flex items-center gap-2 bg-green-500/10 border border-green-500/30 text-green-500 rounded-lg px-4 py-2.5 text-sm mb-4",children:[n.jsx(_c,{size:14}),"Szkic zapisany w tle â treÅÄ jest bezpieczna na serwerze"]}),c&&n.jsxs("div",{className:"flex items-center gap-2 bg-blue-500/10 border border-blue-500/30 text-blue-400 rounded-lg px-4 py-2.5 text-sm mb-4",children:[n.jsx(At,{size:14}),"Tryb edycji â modyfikujesz istniejÄ
cy artykuÅ",s&&n.jsx("button",{onClick:ms,className:"ml-auto text-blue-400 hover:text-foreground transition-colors",children:n.jsx(He,{size:14})})]}),ie&&n.jsxs("div",{className:"flex items-center gap-2 bg-destructive/10 border border-destructive/30 text-destructive rounded-lg px-4 py-3 text-sm mb-4",children:[n.jsx(Sr,{size:15}),ie]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_280px] gap-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-semibold text-foreground mb-1.5",children:"TytuÅ artykuÅu *"}),n.jsx("input",{type:"text",value:u,onChange:K=>et(K.target.value),placeholder:"Wpisz tytuÅ artykuÅu...",className:"w-full bg-news-surface-2 border border-border rounded-lg px-4 py-3 text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red transition-colors font-serif text-lg"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs text-news-muted mb-1",children:"Slug URL"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-xs text-news-dim shrink-0",children:pe}),n.jsx("input",{type:"text",value:m,onChange:K=>{b(K.target.value),g(!0)},placeholder:"slug-artykulu",className:"flex-1 bg-news-surface-2 border border-border rounded px-3 py-1.5 text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red transition-colors"})]})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-semibold text-foreground mb-1.5",children:["Lead / zajawka",n.jsx("span",{className:"ml-2 text-xs font-normal text-news-muted",children:"(wyÅwietlany pogrubiony nad treÅciÄ
)"})]}),n.jsx("textarea",{rows:2,value:y,onChange:K=>
109N(K.target.value),placeholder:"Krótki opis widoczny nad treÅciÄ
artykuÅu â nie trzeba go powtarzaÄ w tekÅcie...",className:"w-full bg-news-surface-2 border border-border rounded-lg px-4 py-3 text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red transition-colors resize-none text-sm"})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsx("label",{className:"block text-sm font-semibold text-foreground",children:"TreÅÄ artykuÅu *"}),n.jsxs("button",{type:"button",onClick:en,className:"flex items-center gap-1.5 text-xs text-news-muted hover:text-foreground bg-news-surface-2 border border-border rounded-lg px-3 py-1.5 transition-colors",children:[n.jsx(At,{size:13}),"PodglÄ
d"]})]}),n.jsx(Sh,{content:w,onChange:k,onInsertImageClick:()=>T(!0),onInsertGalleryClick:()=>xe(!0)})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4 space-y-3",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Publikacja"}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Status"}),n.jsxs("select",{value:D,onChange:K=>A(K.target.value),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:[n.jsx("option",{value:"draft",children:"Szkic"}),n.jsx("option",{value:"published",children:"Opublikowany"}),n.jsx("option",{value:"scheduled",children:"Zaplanowany"})]})]}),D==="scheduled"&&n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Data publikacji"}),n.jsx("input",{type:"datetime-local",value:re,onChange:K=>oe(K.target.value),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),(D==="published"||D==="draft")&&n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Data publikacji"}),n.jsx("input",{type:"datetime-local",value:Y,max:ze,onChange:K=>O(K.target.value),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"}),n.jsx("p",{className:"text-xs text-news-dim mt-1.5",children:"Możesz ustawiÄ datÄ wstecznÄ
â artykuÅ pojawi siÄ w archiwum i na liÅcie z wybranÄ
datÄ
."})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Czas czytania (min)"}),n.jsx("input",{type:"number",min:1,max:60,value:_,onChange:K=>W(Number(K.target.value)),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-xs text-news-muted",children:"Wyróżniony"}),n.jsx("button",{type:"button",onClick:()=>se(K=>!K),className:`w-10 h-5 rounded-full transition-colors relative ${U?"bg-news-red":"bg-news-surface-3 border border-border"}`,children:n.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full transition-transform shadow ${U?"translate-x-5":"translate-x-0.5"}`})})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-xs text-news-muted",children:"Ważne"}),n.jsx("button",{type:"button",onClick:()=>ne(K=>!K),className:`w-10 h-5 rounded-full transition-colors relative ${P?"bg-orange-700":"bg-news-surface-3 border border-border"}`,children:n.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full transition-transform shadow ${P?"translate-x-5":"translate-x-0.5"}`})})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-xs text-news-muted",children:"Sponsorowany"}),n.jsx("button",{type:"button",onClick:()=>I(K=>!K),className:`w-10 h-5 rounded-full transition-colors relative ${C?"bg-news-red":"bg-news-surface-3 border border-border"}`,children:n.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full transition-transform shadow ${C?"translate-x-5":"translate-x-0.5"}`})})]}),n.jsxs("div",{className:`grid gap-2 pt-1 ${D==="published"?"grid-cols-1":"grid-cols-2"}`,children:[n.jsx("button",{type:"button",onClick:()=>Ct(!1),disabled:de,className:`py-2 text-sm rounded-lg transition-colors font-semibold flex items-center justify-center gap-1.5 disabled:opacity-50 ${D==="published"?"text-white bg-news-red hover:bg-news-red-bright":"text-news-muted bg-news-surface-3 hover:text-foreground"}`,children:de?n.jsx(fe,{size:14,className:"animate-spin mx-auto"}):ve&&D==="published"?n.jsxs(n.Fragment,{children:[n.jsx(Dn,{size:14})," Zapisano!"]}):Da}),D!=="published"&&n.jsx("button",{type:"button",onClick:()=>Ct(!0),disabled:de,className:"py-2 text-sm text-white bg-news-red rounded-lg hover:bg-news-red-bright transition-colors font-semibold flex items-center justify-center gap-1.5 disabled:opacity-50",children:ve?n.jsxs(n.Fragment,{children:[n.jsx(Dn,{size:14})," Zapisano!"]}):de?n.jsx(fe,{size:14,className:"animate-spin"}):Be})]}),D==="scheduled"&&n.jsx("p",{className:"text-xs text-news-dim pt-1",children:"âZapisz zaplanowanieâ â publikacja automatyczna w wybranej dacie. âOpublikuj terazâ â natychmiast."}),D==="published"&&!c&&n.jsx("p",{className:"text-xs text-news-dim pt-1",children:"Ustaw datÄ publikacji (np. wstecznÄ
) i kliknij âOpublikujâ."}),D==="draft"&&n.jsx("p",{className:"text-xs text-news-dim pt-1",children:"âZapisz szkicâ â bez publikacji. âOpublikujâ â z datÄ
wybranÄ
powyżej (domyÅlnie: teraz)."}),n.jsx("div",{className:"border-t border-border pt-3 space-y-1",children:n.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-news-dim",children:[n.jsx(_c,{size:12,className:"shrink-0"}),mt==="saving"&&n.jsx("span",{children:"Zapisywanie w tleâ¦"}),mt==="error"&&n.jsx("span",{className:"text-destructive",children:"BÅÄ
d autosave â spróbuj zapisaÄ rÄcznie"}),mt==="saved"&&Ot&&!Ht&&n.jsxs("span",{children:["Zapisano automatycznie o"," ",Ot.toLocaleTimeString("pl-PL",{hour:"2-digit",minute:"2-digit"})]}),Ht&&mt!=="saving"&&n.jsx("span",{className:"text-orange-600",children:"Niezapisane zmiany (autosave co minutÄ)"}),!Ht&&mt==="idle"&&!Ot&&n.jsx("span",{children:"Autosave co minutÄ jako szkic"})]})})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4 space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Kategoria"}),n.jsx("button",{type:"button",onClick:Le,className:"text-xs text-news-muted hover:text-news-red transition-colors",children:"Sugeruj z tytuÅu"})]}),It&&!Je&&n.jsx("p",{className:"text-xs text-news-dim",children:"Dopasowano automatycznie z tytuÅu i leadu"}),!B&&n.jsx("p",{className:"text-xs text-news-dim",children:"Wybierz kategoriÄ rÄcznie lub użyj âSugeruj z tytuÅuâ"}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.map(K=>n.jsx("button",{type:"button",onClick:()=>{M(K),xt(!0),nt(!1)},className:`text-xs px-2.5 py-1 rounded-md transition-all ${B===K?"bg-news-red text-white":"bg-news-surface-3 text-news-muted hover:text-foreground"}`,children:K},K))})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4 space-y-3",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"ZdjÄcie gÅówne"}),E?n.jsxs("div",{className:`relative rounded-lg transition-all ${De?"ring-2 ring-ne
109ws-red ring-offset-2 ring-offset-news-surface-2":""}`,onDragOver:$e,onDragLeave:Zt,onDrop:Gt,children:[n.jsx("button",{type:"button",onClick:St,disabled:Qe,className:"block w-full rounded-lg overflow-hidden disabled:opacity-60",title:"ZmieÅ zdjÄcie",children:n.jsx(Bt,{src:E,cacheKey:S||(e==null?void 0:e.updated_at),alt:"Cover",className:"w-full aspect-video object-cover"})}),(De||Qe)&&n.jsx("div",{className:"absolute inset-0 rounded-lg bg-black/50 flex flex-col items-center justify-center gap-2 pointer-events-none",children:Qe?n.jsxs(n.Fragment,{children:[n.jsx(fe,{size:24,className:"animate-spin text-white"}),n.jsx("span",{className:"text-xs text-white font-medium",children:"Wgrywanieâ¦"})]}):n.jsx("span",{className:"text-xs text-white font-medium",children:"UpuÅÄ, aby zamieniÄ zdjÄcie"})}),n.jsx("button",{type:"button",onClick:()=>v(""),disabled:Qe,className:"absolute top-2 right-2 bg-black/60 text-white rounded-full p-1 hover:bg-black transition-colors disabled:opacity-50",title:"UsuÅ zdjÄcie",children:n.jsx(He,{size:12})})]}):n.jsx("div",{role:"button",tabIndex:0,onClick:St,onKeyDown:K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),St())},onDragOver:$e,onDragLeave:Zt,onDrop:Gt,className:`w-full border-2 border-dashed rounded-lg p-5 text-center transition-colors cursor-pointer ${De?"border-news-red bg-news-red/5":"border-border hover:border-news-red group"} ${Qe?"opacity-60 pointer-events-none":""}`,children:Qe?n.jsxs(n.Fragment,{children:[n.jsx(fe,{size:20,className:"text-news-red mx-auto mb-1 animate-spin"}),n.jsx("p",{className:"text-xs text-news-muted",children:"Wgrywanie zdjÄciaâ¦"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Pn,{size:20,className:"text-news-dim mx-auto mb-1 group-hover:text-news-red transition-colors"}),n.jsx("p",{className:"text-xs text-news-muted group-hover:text-foreground transition-colors",children:"UpuÅÄ zdjÄcie tutaj"}),n.jsx("p",{className:"text-xs text-news-dim mt-1",children:"lub kliknij, aby wybraÄ z biblioteki"})]})})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4 space-y-3",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Tagi"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:"text",value:Z,onChange:K=>Q(K.target.value),onKeyDown:K=>{K.key==="Enter"&&(K.preventDefault(),Re())},placeholder:"Dodaj tag...",className:"flex-1 bg-news-surface-3 border border-border rounded px-3 py-1.5 text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red"}),n.jsx("button",{type:"button",onClick:Re,className:"bg-news-surface-3 text-news-muted px-3 py-1.5 rounded hover:text-foreground border border-border text-sm transition-colors",children:"+"})]}),F.length>0&&n.jsx("div",{className:"flex flex-wrap gap-1.5",children:F.map(K=>n.jsxs("span",{className:"text-xs bg-news-surface-3 text-news-muted px-2 py-0.5 rounded-full flex items-center gap-1",children:["#",K,n.jsx("button",{type:"button",onClick:()=>Ee(K),className:"text-news-dim hover:text-destructive transition-colors",children:n.jsx(He,{size:10})})]},K))})]})]})]})]}),me&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-start justify-center p-4 overflow-auto",children:n.jsxs("div",{className:"bg-background border border-border rounded-xl w-full max-w-3xl my-4",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border sticky top-0 bg-background rounded-t-xl z-10",children:[n.jsxs("h2",{className:"font-bold text-foreground flex items-center gap-2",children:[n.jsx(At,{size:16,className:"text-news-red"})," PodglÄ
d artykuÅu"]}),n.jsx("button",{onClick:()=>at(!1),className:"text-news-muted hover:text-foreground transition-colors",children:n.jsx(He,{size:20})})]}),n.jsxs("div",{className:"p-6",children:[E&&n.jsx(Bt,{src:E,cacheKey:S||(e==null?void 0:e.updated_at),alt:"",className:"w-full aspect-video object-cover rounded-lg mb-6"}),n.jsx("span",{className:"text-xs font-bold text-news-red uppercase tracking-wider",children:B}),n.jsx("h1",{className:"font-serif text-3xl font-bold text-foreground mt-2 mb-3 leading-tight",children:u||"TytuÅ artykuÅu"}),y&&n.jsx("p",{className:"text-base lg:text-lg text-foreground font-bold mb-6 leading-relaxed",children:y}),n.jsx("div",{className:"article-body",dangerouslySetInnerHTML:{__html:Ll(w,y)}}),F.length>0&&n.jsx("div",{className:"flex flex-wrap gap-2 mt-8 pt-6 border-t border-border",children:F.map(K=>n.jsxs("span",{className:"text-xs bg-news-surface-2 text-news-muted px-3 py-1 rounded-full border border-border",children:["#",K]},K))})]})]})}),H&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-4",children:n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[n.jsx("h2",{className:"font-bold text-foreground",children:"Wybierz zdjÄcie gÅówne"}),n.jsx("button",{onClick:()=>ce(!1),className:"text-news-muted hover:text-foreground transition-colors",children:n.jsx(He,{size:20})})]}),n.jsx("div",{className:"flex-1 overflow-auto p-4",children:n.jsx(Zi,{selectionMode:!0,onSelect:K=>{Ge(K),ce(!1)}})})]})}),n.jsx(E1,{open:te,onClose:()=>xe(!1),ensureArticleId:Is,onInsertShortcode:Pe,articleContent:w}),ke&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-4",children:n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl w-full max-w-4xl max-h-[80vh] flex flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border flex-shrink-0",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"font-bold text-foreground",children:"Wstaw obraz do artykuÅu"}),n.jsx("p",{className:"text-xs text-news-muted mt-0.5",children:"Kliknij zdjÄcia, aby je zaznaczyÄ â możesz wybraÄ kilka naraz"})]}),n.jsx("button",{onClick:()=>T(!1),className:"text-news-muted hover:text-foreground transition-colors",children:n.jsx(He,{size:20})})]}),n.jsx("div",{className:"flex-1 flex flex-col min-h-0 p-4 pt-0",children:n.jsx(Zi,{selectionMode:!0,multiSelect:!0,onSelectMany:K=>{window.dispatchEvent(new CustomEvent("tiptap-insert-images",{detail:{urls:K.map(Ae=>Po(Ae))}})),T(!1)}})})]})})]})}const zs=30;function D1(e,t){return[...e].sort((s,r)=>{const o=new Date(s.published_at??s.created_at).getTime(),a=new Date(r.published_at??r.created_at).getTime();return t==="desc"?a-o:o-a})}async function P1(e){const{scope:t,status:s,showWp:r,search:o,userId:a,page:i}=e,l=(i-1)*zs,c=s==="all"?void 0:s;if(t==="mine"&&a){const d=await $.getUserArticles(a,{limit:zs,offset:l});let h=d.articles;if(c&&(h=h.filter(u=>u.status===c)),o.trim().length>=2){const u=o.trim().toLowerCase();h=h.filter(p=>{var m,b;return p.title.toLowerCase().includes(u)||p.slug.toLowerCase().includes(u)||(p.excerpt??"").toLowerCase().includes(u)||p.category.toLowerCase().includes(u)||(((b=(m=p.author)==null?void 0:m.name)==null?void 0:b.toLowerCase())??"").includes(u)})}return{...d,articles:h}}if(o.trim().length>=2){const d=await $.searchArticles({q:o.trim(),limit:zs,offset:l});let h=d.articles;return c&&(h=h.filter(u=>u.status===c)),r||(h=h.filter(u=>!u.read_only)),{...d,articles:h}}return $.getArticles({status:c,limit:zs,offset:l,appOnly:!r})}function R1(e){var c,d,h;const[t,s]=f.useState(e.search);f.useEffect(()=>{const u=window.setTimeout(()=>s(e.search),300);return()=>window.clearTimeout(u)},[e.search]);const r=f.useMemo(()=>["admin-articles",e.scope,e.status,e.showWp,e.sortOrder,e.userId??null,e.page,t],[e.scope,e.status,e.showWp,e.sortOrder,e.userId,e.page,t]),o=va({queryKey:r,queryFn:()=>P1({...e,search:t}),staleTime:0,placeholderData:u=>u}),a=f.useMemo(()=>{var u;return D1(((u=o.data)==null?void 0:u.articles)??[],e.sortOrder)},[(c=o.data)==null?void 0:c.articles,e.sortOrder]),i=((d=o.data)==null?void 0:d.total)??0,l=Math.max(1,Math.ceil(i/zs));return{articles:a,total:i,totalPages:l,hasMore:((h=o.data)==null?void 0:h.hasMore)??!1,loading:o.isLoading,isFetching:o.isFetching,error:o.error?o.error instanceof Error?o.error.message:"BÅÄ
d pobierania artykuÅów":null,refetch:o.refetch,debouncedSearch:t}}function $1(e){return e.status==="published"?Cr(e):`/artykul/${encodeURIComponent(e.slug)}`}const pu={published:{label:"Opublikowany",color:"text-green-500",icon:Dn},draft:{label:"Szkic",color:"text-news-muted",icon:Xt},scheduled:{label:"Zaplanowany",color:"text-blue-400",icon:Rr}};function B1({status:e}){const t=pu[e]??pu.draft,s=t.icon;return n.jsxs("div",{className:`flex items-center gap-1 ${t.color}`,children:[n.jsx(s,{size:13}),n.jsx("span",{className:"text-xs",children:t.label})]})}function F1({onNew:e,onEdit:t}){const{user:s}=yn(),[r,o]=f.useState("all"),[a,i]=f.useState("all"),[l,c]=f.useState("desc"),[d,h]=f.useState(""),[u,p]=f.useState(1),[m,b]=f.useState(null),[x,g]=f.useState(null),[y,N]=f.useState(!1),w=Bl(),{articles:k,total:E,totalPages:v,loading:S,isFetching:z,error:B,refetch:M,debouncedSearch:D}=R1({scope:a,status:r,showWp:y,search:d,sortOrder:l,userId:s==null?void 0:s.id,page:u}),A=()=>p(1),U=async P=>{if(!P.read_only){b(P.id);try{await $.deleteArticle(P.id),await w(),await M()}catch{}finally{b(null),g(null)}}},se=P=>P?new Date(P).toLocaleDateString("pl-PL",{day:"2-digit",month:"short",year:"numeric"}):"â";return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1 w-full",children:[n.jsx(Ms,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-news-dim"}),n.jsx("input",{type:"text",value:d,onChange:P=>{h(P.target.value),A()},placeholder:"Szukaj po tytule, slugu, leadzie, kategorii, autorze...",className:"w-full bg-news-surface-2 border border-border rounded-lg pl-8 pr-4 py-2 text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red transition-colors"})]}
109),n.jsxs("select",{value:l,onChange:P=>{c(P.target.value),A()},className:"bg-news-surface-2 border border-border rounded-lg px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:[n.jsx("option",{value:"desc",children:"Najnowsze"}),n.jsx("option",{value:"asc",children:"Najstarsze"})]}),n.jsxs("button",{onClick:e,className:"flex items-center gap-2 bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors flex-shrink-0",children:[n.jsx(rf,{size:16}),"Nowy artykuÅ"]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(of,{size:14,className:"text-news-muted"}),["all","mine"].map(P=>n.jsxs("button",{onClick:()=>{i(P),A()},className:`text-xs px-3 py-1.5 rounded-lg transition-colors font-medium flex items-center gap-1 ${a===P?"bg-news-red text-white":"bg-news-surface-2 text-news-muted hover:text-foreground border border-border"}`,children:[P==="mine"&&n.jsx(bl,{size:12}),{all:"Wszystkie",mine:"Moje"}[P]]},P)),n.jsx("span",{className:"text-news-dim px-1",children:"|"}),["all","published","draft","scheduled"].map(P=>n.jsx("button",{onClick:()=>{o(P),A()},className:`text-xs px-3 py-1.5 rounded-lg transition-colors font-medium ${r===P?"bg-news-surface-3 text-foreground border border-border":"bg-news-surface-2 text-news-muted hover:text-foreground border border-border"}`,children:{all:"Wszystkie statusy",published:"Opublikowane",draft:"Szkice",scheduled:"Zaplanowane"}[P]},P)),a==="all"&&n.jsx("button",{onClick:()=>{N(P=>!P),A()},className:"text-xs px-3 py-2 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors ml-auto",children:y?"Tylko aplikacja":"Pokaż WordPress"})]})]}),n.jsxs("p",{className:"text-xs text-news-muted",children:[E.toLocaleString("pl-PL")," artykuÅów ÅÄ
cznie",k.length>0&&E>zs?` · strona ${u} z ${v} (po ${zs})`:k.length>0?` · wyÅwietlono ${k.length}`:"",a==="mine"&&(s!=null&&s.display_name)?` · ${s.display_name}`:"",y&&a==="all"&&" · WordPress (tylko odczyt)",D.length>=2?" · wyszukiwanie w bazie":"",z&&!S?" · odÅwieżanieâ¦":""]}),n.jsx("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:S?n.jsxs("div",{className:"flex items-center justify-center py-16 gap-2 text-news-muted",children:[n.jsx(fe,{size:18,className:"animate-spin"}),n.jsx("span",{className:"text-sm",children:"Åadowanie artykuÅów..."})]}):B?n.jsxs("div",{className:"flex items-center justify-center py-16 gap-2 text-destructive",children:[n.jsx(Sr,{size:18}),n.jsx("span",{className:"text-sm",children:B})]}):k.length===0?n.jsxs("div",{className:"py-16 text-center",children:[n.jsx(Xt,{size:32,className:"text-news-dim mx-auto mb-2"}),n.jsx("p",{className:"text-news-muted text-sm",children:"Brak artykuÅów"}),n.jsx("button",{onClick:e,className:"mt-3 text-xs text-news-red hover:underline",children:"Utwórz pierwszy artykuÅ"})]}):n.jsxs("table",{className:"w-full",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"border-b border-border bg-news-surface-3",children:[n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider",children:"ArtykuÅ"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden sm:table-cell",children:"Kategoria"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden md:table-cell",children:"Status"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden lg:table-cell",children:"Data"}),n.jsx("th",{className:"text-left px-4 py-3 text-xs font-semibold text-news-muted uppercase tracking-wider hidden lg:table-cell",children:"â¥"}),n.jsx("th",{className:"px-4 py-3 w-32"})]})}),n.jsx("tbody",{children:k.map(P=>n.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-news-surface-3 transition-colors",children:[n.jsx("td",{className:"px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-3",children:[P.image_url?n.jsx(Bt,{variant:"thumb",src:P.image_url,cacheKey:P.updated_at,alt:"",className:"w-10 h-9 object-cover rounded flex-shrink-0"}):n.jsx("div",{className:"w-10 h-9 bg-news-surface-3 rounded flex-shrink-0 flex items-center justify-center",children:n.jsx(Xt,{size:14,className:"text-news-dim"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-sm font-medium text-foreground line-clamp-1",children:P.title}),n.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[P.featured&&n.jsx(Dg,{size:10,
109className:"text-news-gold fill-news-gold",title:"Wyróżniony"}),P.important&&n.jsx(Sr,{size:10,className:"text-orange-600",title:"Ważne"}),P.sponsored&&n.jsx("span",{className:"text-xs text-news-dim",children:"Spons."}),n.jsxs("span",{className:"text-xs text-news-dim",children:[P.read_time," min"]})]})]})]})}),n.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:n.jsx("span",{className:"text-xs text-news-red font-semibold",children:P.category})}),n.jsx("td",{className:"px-4 py-3 hidden md:table-cell",children:n.jsx(B1,{status:P.status})}),n.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:n.jsx("span",{className:"text-xs text-news-muted",children:se(P.published_at??P.created_at)})}),n.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:n.jsx("span",{className:"text-sm text-news-muted",children:P.likes.toLocaleString()})}),n.jsx("td",{className:"px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[n.jsx("a",{href:$1(P),target:"_blank",rel:"noopener noreferrer",title:P.status==="published"?"PodglÄ
d":"PodglÄ
d (wymaga zalogowania jako redaktor)",className:"text-news-muted hover:text-foreground p-1.5 rounded transition-colors",children:n.jsx(At,{size:15})}),n.jsx("button",{onClick:()=>t(P),title:P.read_only?"Tylko odczyt (WordPress)":"Edytuj",disabled:P.read_only,className:"text-news-muted hover:text-foreground p-1.5 rounded transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:n.jsx(ya,{size:15})}),n.jsx("button",{onClick:()=>g(P),title:"UsuÅ",disabled:P.read_only,className:"text-news-muted hover:text-destructive p-1.5 rounded transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:m===P.id?n.jsx(fe,{size:15,className:"animate-spin"}):n.jsx(qe,{size:15})})]})})]},P.id))})]})}),v>1&&!S&&!B&&n.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 pt-1",children:[n.jsxs("p",{className:"text-xs text-news-muted",children:[((u-1)*zs+1).toLocaleString("pl-PL"),"â",Math.min(u*zs,E).toLocaleString("pl-PL")," z ",E.toLocaleString("pl-PL")]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{type:"button",disabled:u<=1||z,onClick:()=>p(P=>Math.max(1,P-1)),className:"inline-flex items-center gap-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-news-surface-2 hover:bg-news-surface-3 disabled:opacity-40 disabled:cursor-not-allowed",children:[n.jsx(xl,{size:16}),"Poprzednia"]}),n.jsxs("span",{className:"text-sm text-news-muted tabular-nums px-2",children:[u," / ",v]}),n.jsxs("button",{type:"button",disabled:u>=v||z,onClick:()=>p(P=>Math.min(v,P+1)),className:"inline-flex items-center gap-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-news-surface-2 hover:bg-news-surface-3 disabled:opacity-40 disabled:cursor-not-allowed",children:["NastÄpna",n.jsx(As,{size:16})]})]})]}),x&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-4",children:n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl max-w-md w-full p-6 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/10 flex items-center justify-center flex-shrink-0",children:n.jsx(qe,{size:18,className:"text-destructive"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"UsuÅ artykuÅ"}),n.jsx("p",{className:"text-xs text-news-muted mt-0.5",children:"Ta operacja jest nieodwracalna"})]})]}),n.jsxs("p",{className:"text-sm text-news-muted",children:["Czy na pewno chcesz usunÄ
Ä artykuÅ ",n.jsxs("strong",{className:"text-foreground",children:["â",x.title,'"']}),"?"]}),n.jsxs("div",{className:"flex gap-3 justify-end",children:[n.jsx("button",{onClick:()=>g(null),className:"px-4 py-2 text-sm text-news-muted bg-news-surface-2 border border-border rounded-lg hover:text-foreground transition-colors",children:"Anuluj"}),n.jsxs("button",{onClick:()=>U(x),disabled:!!m,className:"px-4 py-2 text-sm text-white bg-destructive rounded-lg hover:bg-red-700 transition-colors disabled:opacity-50 flex items-center gap-2",children:[m?n.jsx(fe,{size:14,className:"animate-spin"}):n.jsx(qe,{size:14}),"UsuÅ"]})]})]})})]})}const W1=["all","pending","approved","rejected"];function U1(){const[e,t]=f.useState([]),[s,r]=f.useState(!0),[o,a]=f.useState(null),[i,l]=f.useState("pending"),[c,d]=f.useState(""),[h,u]=f.useState(null),p=async()=>{r(!0);try{const w=await $.getComments();t(w),a(null)}catch(w){a(w instanceof Error?w.message:"BÅÄ
d Åadowania")}finally{r(!1)}};f.useEffect(()=>{p()},[]);const m=async(w,k)=>{u(w);try{const E=await $.updateCommentStatus(w,k);t(v=>v.map(S=>S.id===w?E:S))}catch{}finally{u(null)}},b=async w=>{u(w);try{await $.deleteComment(w),t(k=>k.filter(E=>E.id!==w))}catch{}finally{u(null)}},x=e.filter(w=>{const k=i==="all"||w.status===i,E=c===""||w.content.toLowerCase().includes(c.toLowerCase())||w.author_name.toLowerCase().includes(c.toLowerCase());return k&&E}),g=e.filter(w=>w.status==="pending").length,y=w=>new Date(w).toLocaleDateString("pl-PL",{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"}),N={all:"Wszystkie",pending:"OczekujÄ
ce",approved:"Zatwierdzone",rejected:"Odrzucone"};return n.jsxs("div",{className:"space-y-4 max-w-5xl",children:[n.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"OczekujÄ
ce",count:e.filter(w=>w.status==="pending").length,color:"text-blue-400"},{label:"Zatwierdzone",count:e.filter(w=>w.status==="approved").length,color:"text-green-500"},{label:"Odrzucone",count:e.filter(w=>w.status==="rejected").length,color:"text-destructive"}].map(w=>n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4",children:[n.jsx("div",{className:`text-2xl font-bold ${w.color}
109`,children:w.count}),n.jsx("div",{className:"text-xs text-news-muted mt-1",children:w.label})]},w.label))}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Ms,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-news-dim"}),n.jsx("input",{type:"text",value:c,onChange:w=>d(w.target.value),placeholder:"Szukaj w komentarzach...",className:"w-full bg-news-surface-2 border border-border rounded-lg pl-8 pr-4 py-2 text-sm text-foreground placeholder:text-news-dim focus:outline-none focus:border-news-red transition-colors"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(of,{size:14,className:"text-news-muted flex-shrink-0"}),W1.map(w=>n.jsxs("button",{onClick:()=>l(w),className:`text-xs px-3 py-1.5 rounded-lg transition-colors font-medium flex-shrink-0 ${i===w?"bg-news-red text-white":"bg-news-surface-2 text-news-muted hover:text-foreground border border-border"}`,children:[N[w],w==="pending"&&g>0&&n.jsx("span",{className:"ml-1.5 bg-white/20 rounded-full px-1.5 py-0.5 text-[10px] font-bold",children:g})]},w))]})]}),n.jsx("div",{className:"space-y-3",children:s?n.jsxs("div",{className:"flex items-center justify-center py-12 gap-2 text-news-muted",children:[n.jsx(fe,{size:18,className:"animate-spin"}),n.jsx("span",{className:"text-sm",children:"Åadowanie komentarzy..."})]}):o?n.jsxs("div",{className:"flex items-center gap-2 text-destructive py-8 justify-center",children:[n.jsx(Sr,{size:16}),n.jsx("span",{className:"text-sm",children:o})]}):x.length===0?n.jsxs("div",{className:"py-12 text-center",children:[n.jsx(Pr,{size:32,className:"text-news-dim mx-auto mb-2"}),n.jsx("p",{className:"text-news-muted text-sm",children:"Brak komentarzy w tej kategorii"})]}):x.map(w=>n.jsx("div",{className:`bg-news-surface-2 border rounded-lg p-4 ${w.status==="pending"?"border-blue-500/30":w.status==="approved"?"border-green-500/20":"border-destructive/20"}`,children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("span",{className:"text-sm font-semibold text-foreground",children:w.author_name}),w.author_email&&n.jsx("span",{className:"text-xs text-news-dim",children:w.author_email}),n.jsx("span",{className:"text-xs text-news-dim ml-auto",children:y(w.created_at)})]}),n.jsx("p",{className:"text-sm text-news-muted leading-relaxed",children:w.content}),n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${w.status==="pending"?"bg-blue-500/10 text-blue-400":w.status==="approved"?"bg-green-500/10 text-green-500":"bg-destructive/10 text-destructive"}`,children:{pending:"Oczekuje",approved:"Zatwierdzone",rejected:"Odrzucone"}[w.status]??w.status}),n.jsxs("span",{className:"text-xs text-news-dim",children:["ArtykuÅ: ",w.article_id]})]})]}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[w.status!=="approved"&&n.jsx("button",{onClick:()=>m(w.id,"approved"),disabled:h===w.id,title:"Zatwierdź",className:"p-1.5 rounded-lg text-news-muted hover:text-green-500 hover:bg-green-500/10 transition-colors",children:h===w.id?n.jsx(fe,{size:16,className:"animate-spin"}):n.jsx(Dn,{size:16})}),w.status!=="rejected"&&n.jsx("button",{onClick:()=>m(w.id,"rejected"),disabled:h===w.id,title:"OdrzuÄ",className:"p-1.5 rounded-lg text-news-muted hover:text-destructive hover:bg-destructive/10 transition-colors",children:n.jsx(Pg,{size:16})}),n.jsx("button",{onClick:()=>b(w.id),disabled:h===w.id,title:"UsuÅ",className:"p-1.5 rounded-lg text-news-muted hover:text-destructive hover:bg-destructive/10 transition-colors",children:n.jsx(qe,{size:16})})]})]})},w.id))})]})}function H1(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return f.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Ma=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function dc(e){return"nodeType"in e}function Lt(e){var t,s;return e?Wn(e)?e:dc(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function uc(e){const{Document:t}=Lt(e);return e instanceof t}function Kr(e){return Wn(e)?!1:e instanceof Lt(e).HTMLElement}function Ch(e){return e instanceof Lt(e).SVGElement}function Un(e){return e?Wn(e)?e.document:dc(e)?uc(e)?e:Kr(e)||Ch(e)?e.ownerDocument:document:document:document}const ks=Ma?f.useLayoutEffect:f.useEffect;function fc(e){const t=f.useRef(e);return ks(()=>{t.current=e}),f.useCallback(function(){for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function G1(){const e=f.useRef(null),t=f.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),s=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Mr(e,t){t===void 0&&(t=[e]);const s=f.useRef(e);return ks(()=>{s.current!==e&&(s.current=e)},t),s}function qr(e,t){const s=f.useRef();return f.useMemo(()=>{const r=e(s.current);return s.current=r,r},[...t])}function ha(e){const t=fc(e),s=f.useRef(null),r=f.useCallback(o=>{o!==s.current&&(t==null||t(o,s.current)),s.current=o},[]);return[s,r]}function cl(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let ji={};function Xr(e,t){return f.useMemo(()=>
109{if(t)return t;const s=ji[e]==null?0:ji[e]+1;return ji[e]=s,e+"-"+s},[e,t])}function _h(e){return function(t){for(var s=arguments.length,r=new Array(s>1?s-1:0),o=1;o<s;o++)r[o-1]=arguments[o];return r.reduce((a,i)=>{const l=Object.entries(i);for(const[c,d]of l){const h=a[c];h!=null&&(a[c]=h+e*d)}return a},{...t})}}const Mn=_h(1),Lr=_h(-1);function Y1(e){return"clientX"in e&&"clientY"in e}function mc(e){if(!e)return!1;const{KeyboardEvent:t}=Lt(e.target);return t&&e instanceof t}function V1(e){if(!e)return!1;const{TouchEvent:t}=Lt(e.target);return t&&e instanceof t}function dl(e){if(V1(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return Y1(e)?{x:e.clientX,y:e.clientY}:null}const Ir=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[Ir.Translate.toString(e),Ir.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:r}=e;return t+" "+s+"ms "+r}}}),gu="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function K1(e){return e.matches(gu)?e:e.querySelector(gu)}const q1={display:"none"};function X1(e){let{id:t,value:s}=e;return X.createElement("div",{id:t,style:q1},s)}function J1(e){let{id:t,announcement:s,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return X.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},s)}function Z1(){const[e,t]=f.useState("");return{announce:f.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Th=f.createContext(null);function Q1(e){const t=f.useContext(Th);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function eS(){const[e]=f.useState(()=>new Set),t=f.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[f.useCallback(r=>{let{type:o,event:a}=r;e.forEach(i=>{var l;return(l=i[o])==null?void 0:l.call(i,a)})},[e]),t]}const tS={draggable:` 110 To pick up a draggable item, press the space bar. 111 While dragging, use the arrow keys to move the item. 112 Press space again to drop the item in its new position, or press escape to cancel. 113 `},sS={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was moved over droppable area "+s.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was dropped over droppable area "+s.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function nS(e){let{announcements:t=sS,container:s,hiddenTextDescribedById:r,screenReaderInstructions:o=tS}=e;const{announce:a,announcement:i}=Z1(),l=Xr("DndLiveRegion"),[c,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),Q1(f.useMemo(()=>({onDragStart(u){let{active:p}=u;a(t.onDragStart({active:p}))},onDragMove(u){let{active:p,over:m}=u;t.onDragMove&&a(t.onDragMove({active:p,over:m}))},onDragOver(u){let{active:p,over:m}=u;a(t.onDragOver({active:p,over:m}))},onDragEnd(u){let{active:p,over:m}=u;a(t.onDragEnd({active:p,over:m}))},onDragCancel(u){let{active:p,over:m}=u;a(t.onDragCancel({active:p,over:m}))}}),[a,t])),!c)return null;const h=X.createElement(X.Fragment,null,X.createElement(X1,{id:r,value:o.draggable}),X.createElement(J1,{id:l,announcement:i}));return s?Xs.createPortal(h,s):h}var ot;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ot||(ot={}));function pa(){}function xu(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function rS(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ls=Object.freeze({x:0,y:0});function Eh(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zh(e,t){let{data:{value:s}}=e,{data:{value:r}}=t;return s-r}function oS(e,t){let{data:{value:s}}=e,{data:{value:r}}=t;return r-s}
113function bu(e){let{left:t,top:s,height:r,width:o}=e;return[{x:t,y:s},{x:t+o,y:s},{x:t,y:s+r},{x:t+o,y:s+r}]}function Ah(e,t){if(!e||e.length===0)return null;const[s]=e;return s[t]}function wu(e,t,s){return t===void 0&&(t=e.left),s===void 0&&(s=e.top),{x:t+e.width*.5,y:s+e.height*.5}}const aS=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:r}=e;const o=wu(t,t.left,t.top),a=[];for(const i of r){const{id:l}=i,c=s.get(l);if(c){const d=Eh(wu(c),o);a.push({id:l,data:{droppableContainer:i,value:d}})}}return a.sort(zh)},iS=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:r}=e;const o=bu(t),a=[];for(const i of r){const{id:l}=i,c=s.get(l);if(c){const d=bu(c),h=o.reduce((p,m,b)=>p+Eh(d[b],m),0),u=Number((h/4).toFixed(4));a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort(zh)};function lS(e,t){const s=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=o-r,l=a-s;if(r<o&&s<a){const c=t.width*t.height,d=e.width*e.height,h=i*l,u=h/(c+d-h);return Number(u.toFixed(4))}return 0}const cS=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:r}=e;const o=[];for(const a of r){const{id:i}=a,l=s.get(i);if(l){const c=lS(l,t);c>0&&o.push({id:i,data:{droppableContainer:a,value:c}})}}return o.sort(oS)};function dS(e,t,s){return{...e,scaleX:t&&s?t.width/s.width:1,scaleY:t&&s?t.height/s.height:1}}function Mh(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ls}function uS(e){return function(s){for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...s})}}const fS=uS(1);function mS(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function hS(e,t,s){const r=mS(t);if(!r)return e;const{scaleX:o,scaleY:a,x:i,y:l}=r,c=e.left-i-(1-o)*parseFloat(s),d=e.top-l-(1-a)*parseFloat(s.slice(s.indexOf(" ")+1)),h=o?e.width/o:e.width,u=a?e.height/a:e.height;return{width:h,height:u,top:d,right:c+h,bottom:d+u,left:c}}const pS={ignoreTransform:!1};function Hn(e,t){t===void 0&&(t=pS);let s=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:h}=Lt(e).getComputedStyle(e);d&&(s=hS(s,d,h))}const{top:r,left:o,width:a,height:i,bottom:l,right:c}=s;return{top:r,left:o,width:a,height:i,bottom:l,right:c}}function yu(e){return Hn(e,{ignoreTransform:!0})}function gS(e){const t=e.innerWidth,s=e.innerHeight;return{top:0,left:0,right:t,bottom:s,width:t,height:s}}function xS(e,t){return t===void 0&&(t=Lt(e).getComputedStyle(e)),t.position==="fixed"}function bS(e,t){t===void 0&&(t=Lt(e).getComputedStyle(e));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?s.test(a):!1})}function La(e,t){const s=[];function r(o){if(t!=null&&s.length>=t||!o)return s;if(uc(o)&&o.scrollingElement!=null&&!s.includes(o.scrollingElement))return s.push(o.scrollingElement),s;if(!Kr(o)||Ch(o)||s.includes(o))return s;const a=Lt(e).getComputedStyle(o);return o!==e&&bS(o,a)&&s.push(o),xS(o,a)?s:r(o.parentNode)}return e?r(e):s}function Lh(e){const[t]=La(e,1);return t??null}function Ni(e){return!Ma||!e?null:Wn(e)?e:dc(e)?uc(e)||e===Un(e).scrollingElement?window:Kr(e)?e:null:null}function Ih(e){return Wn(e)?e.scrollX:e.scrollLeft}function Oh(e){return Wn(e)?e.scrollY:e.scrollTop}function ul(e){return{x:Ih(e),y:Oh(e)}}var ut;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ut||(ut={}));function Dh(e){return!Ma||!e?!1:e===document.scrollingElement}function Ph(e){const t={x:0,y:0},s=Dh(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-s.width,y:e.scrollHeight-s.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:a,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const wS={x:.2,y:.2};function yS(e,t,s,r,o){let{top:a,left:i,right:l,bottom:c}=s;r===void 0&&(r=10),o===void 0&&(o=wS);const{isTop:d,isBottom:h,isLeft:u,isRight:p}=Ph(e),m={x:0,y:0},b={x:0,y:0},x={height:t.height*o.y,width:t.width*o.x};
113return!d&&a<=t.top+x.height?(m.y=ut.Backward,b.y=r*Math.abs((t.top+x.height-a)/x.height)):!h&&c>=t.bottom-x.height&&(m.y=ut.Forward,b.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!p&&l>=t.right-x.width?(m.x=ut.Forward,b.x=r*Math.abs((t.right-x.width-l)/x.width)):!u&&i<=t.left+x.width&&(m.x=ut.Backward,b.x=r*Math.abs((t.left+x.width-i)/x.width)),{direction:m,speed:b}}function vS(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:s,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:s,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Rh(e){return e.reduce((t,s)=>Mn(t,ul(s)),ls)}function jS(e){return e.reduce((t,s)=>t+Ih(s),0)}function NS(e){return e.reduce((t,s)=>t+Oh(s),0)}function kS(e,t){if(t===void 0&&(t=Hn),!e)return;const{top:s,left:r,bottom:o,right:a}=t(e);Lh(e)&&(o<=0||a<=0||s>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const SS=[["x",["left","right"],jS],["y",["top","bottom"],NS]];class hc{constructor(t,s){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=La(s),o=Rh(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of SS)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=l(r),h=o[a]-d;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class pr{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...s)})},this.target=t}add(t,s,r){var o;(o=this.target)==null||o.addEventListener(t,s,r),this.listeners.push([t,s,r])}}function CS(e){const{EventTarget:t}=Lt(e);return e instanceof t?e:Un(e)}function ki(e,t){const s=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(s**2+r**2)>t:"x"in t&&"y"in t?s>t.x&&r>t.y:"x"in t?s>t.x:"y"in t?r>t.y:!1}var qt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(qt||(qt={}));function vu(e){e.preventDefault()}function _S(e){e.stopPropagation()}var Ce;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ce||(Ce={}));const $h={start:[Ce.Space,Ce.Enter],cancel:[Ce.Esc],end:[Ce.Space,Ce.Enter,Ce.Tab]},TS=(e,t)=>{let{currentCoordinates:s}=t;switch(e.code){case Ce.Right:return{...s,x:s.x+25};case Ce.Left:return{...s,x:s.x-25};case Ce.Down:return{...s,y:s.y+25};case Ce.Up:return{...s,y:s.y-25}}};class pc{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:s}}=t;this.props=t,this.listeners=new pr(Un(s)),this.windowListeners=new pr(Lt(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qt.Resize,this.handleCancel),this.windowListeners.add(qt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(qt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:s}=this.props,r=t.node.current;r&&kS(r),s(ls)}handleKeyDown(t){if(mc(t)){const{active:s,context:r,options:o}=this.props,{keyboardCodes:a=$h,coordinateGetter:i=TS,scrollBehavior:l="smooth"}=o,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,h=d?{x:d.left,y:d.top}:ls;this.referenceCoordinates||(this.referenceCoordinates=h);const u=i(t,{active:s,context:r.current,currentCoordinates:h});if(u){const p=Lr(u,h),m={x:0,y:0},{scrollableAncestors:b}=r.current;for(const x of b){const g=t.code,{isTop:y,isRight:N,isLeft:w,isBottom:k,maxScroll:E,minScroll:v}=Ph(x),S=vS(x),z={x:Math.min(g===Ce.Right?S.right-S.width/2:S.right,Math.max(g===Ce.Right?S.left:S.left+S.width/2,u.x)),y:Math.min(g===Ce.Down?S.bottom-S.height/2:S.bottom,Math.max(g===Ce.Down?S.top:S.top+S.height/2,u.y
113))},B=g===Ce.Right&&!N||g===Ce.Left&&!w,M=g===Ce.Down&&!k||g===Ce.Up&&!y;if(B&&z.x!==u.x){const D=x.scrollLeft+p.x,A=g===Ce.Right&&D<=E.x||g===Ce.Left&&D>=v.x;if(A&&!p.y){x.scrollTo({left:D,behavior:l});return}A?m.x=x.scrollLeft-D:m.x=g===Ce.Right?x.scrollLeft-E.x:x.scrollLeft-v.x,m.x&&x.scrollBy({left:-m.x,behavior:l});break}else if(M&&z.y!==u.y){const D=x.scrollTop+p.y,A=g===Ce.Down&&D<=E.y||g===Ce.Up&&D>=v.y;if(A&&!p.x){x.scrollTo({top:D,behavior:l});return}A?m.y=x.scrollTop-D:m.y=g===Ce.Down?x.scrollTop-E.y:x.scrollTop-v.y,m.y&&x.scrollBy({top:-m.y,behavior:l});break}}this.handleMove(t,Mn(Lr(u,this.referenceCoordinates),m))}}}handleMove(t,s){const{onMove:r}=this.props;t.preventDefault(),r(s)}handleEnd(t){const{onEnd:s}=this.props;t.preventDefault(),this.detach(),s()}handleCancel(t){const{onCancel:s}=this.props;t.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}pc.activators=[{eventName:"onKeyDown",handler:(e,t,s)=>{let{keyboardCodes:r=$h,onActivation:o}=t,{active:a}=s;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function ju(e){return!!(e&&"distance"in e)}function Nu(e){return!!(e&&"delay"in e)}class gc{constructor(t,s,r){var o;r===void 0&&(r=CS(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=s;const{event:a}=t,{target:i}=a;this.props=t,this.events=s,this.document=Un(i),this.documentListeners=new pr(this.document),this.listeners=new pr(r),this.windowListeners=new pr(Lt(i)),this.initialCoordinates=(o=dl(a))!=null?o:ls,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:s,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(qt.Resize,this.handleCancel),this.windowListeners.add(qt.DragStart,vu),this.windowListeners.add(qt.VisibilityChange,this.handleCancel),this.windowListeners.add(qt.ContextMenu,vu),this.documentListeners.add(qt.Keydown,this.handleKeydown),s){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Nu(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(ju(s)){this.handlePending(s);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,s){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:t}=this,{onStart:s}=this.props;t&&(this.activated=!0,this.documentListeners.add(qt.Click,_S,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qt.SelectionChange,this.removeTextSelection),s(t))}handleMove(t){var s;const{activated:r,initialCoordinates:o,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!o)return;const c=(s=dl(t))!=null?s:ls,d=Lr(o,c);if(!r&&l){if(ju(l)){if(l.tolerance!=null&&ki(d,l.tolerance))return this.handleCancel();if(ki(d,l.distance))return this.handleStart()}if(Nu(l)&&ki(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleCancel(){const{onAbort:t,onCancel:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleKeydown(t){t.code===Ce.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ES={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class xc extends gc{constructor(t){const{event:s}=t,r=Un(s.target);super(t,ES,r)}}xc.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:r}=t;return!s.isPrimary||s.button!==0?!1:(r==null||r({event:s}),!0)}}];const zS={move:{name:"mousemove"},end:{name:"mouseup"}};var fl;(function(e){e[e.RightClick=2]="RightClick"})(fl||(fl={}));class AS extends gc{constructor(t){super(t,zS,Un(t.event.target))}}AS.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:r}=t;return s.button===fl.RightClick?!1:(r==null||r({event:s}),!0)}}];const Si={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class MS extends gc{constructor(t){super(t,Si)}static setup(){return window.addEventListener(Si.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Si.move.name,t)};function t(){}}}MS.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:r}=t;const{touches:o}=s;return o.length>1?!1:(r==null||r({event:s}),!0)}}];var gr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(gr||(gr={}));var ga;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="Rever
113sedTreeOrder"})(ga||(ga={}));function LS(e){let{acceleration:t,activator:s=gr.Pointer,canScroll:r,draggingRect:o,enabled:a,interval:i=5,order:l=ga.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:h,delta:u,threshold:p}=e;const m=OS({delta:u,disabled:!a}),[b,x]=G1(),g=f.useRef({x:0,y:0}),y=f.useRef({x:0,y:0}),N=f.useMemo(()=>{switch(s){case gr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case gr.DraggableRect:return o}},[s,o,c]),w=f.useRef(null),k=f.useCallback(()=>{const v=w.current;if(!v)return;const S=g.current.x*y.current.x,z=g.current.y*y.current.y;v.scrollBy(S,z)},[]),E=f.useMemo(()=>l===ga.TreeOrder?[...d].reverse():d,[l,d]);f.useEffect(()=>{if(!a||!d.length||!N){x();return}for(const v of E){if((r==null?void 0:r(v))===!1)continue;const S=d.indexOf(v),z=h[S];if(!z)continue;const{direction:B,speed:M}=yS(v,z,N,t,p);for(const D of["x","y"])m[D][B[D]]||(M[D]=0,B[D]=0);if(M.x>0||M.y>0){x(),w.current=v,b(k,i),g.current=M,y.current=B;return}}g.current={x:0,y:0},y.current={x:0,y:0},x()},[t,k,r,x,a,i,JSON.stringify(N),JSON.stringify(m),b,d,E,h,JSON.stringify(p)])}const IS={x:{[ut.Backward]:!1,[ut.Forward]:!1},y:{[ut.Backward]:!1,[ut.Forward]:!1}};function OS(e){let{delta:t,disabled:s}=e;const r=cl(t);return qr(o=>{if(s||!r||!o)return IS;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ut.Backward]:o.x[ut.Backward]||a.x===-1,[ut.Forward]:o.x[ut.Forward]||a.x===1},y:{[ut.Backward]:o.y[ut.Backward]||a.y===-1,[ut.Forward]:o.y[ut.Forward]||a.y===1}}},[s,t,r])}function DS(e,t){const s=t!=null?e.get(t):void 0,r=s?s.node.current:null;return qr(o=>{var a;return t==null?null:(a=r??o)!=null?a:null},[r,t])}function PS(e,t){return f.useMemo(()=>e.reduce((s,r)=>{const{sensor:o}=r,a=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...s,...a]},[]),[e,t])}var Or;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Or||(Or={}));var ml;(function(e){e.Optimized="optimized"})(ml||(ml={}));const ku=new Map;function RS(e,t){let{dragging:s,dependencies:r,config:o}=t;const[a,i]=f.useState(null),{frequency:l,measure:c,strategy:d}=o,h=f.useRef(e),u=g(),p=Mr(u),m=f.useCallback(function(y){y===void 0&&(y=[]),!p.current&&i(N=>N===null?y:N.concat(y.filter(w=>!N.includes(w))))},[p]),b=f.useRef(null),x=qr(y=>{if(u&&!s)return ku;if(!y||y===ku||h.current!==e||a!=null){const N=new Map;for(let w of e){if(!w)continue;if(a&&a.length>0&&!a.includes(w.id)&&w.rect.current){N.set(w.id,w.rect.current);continue}const k=w.node.current,E=k?new hc(c(k),k):null;w.rect.current=E,E&&N.set(w.id,E)}return N}return y},[e,a,s,u,c]);return f.useEffect(()=>{h.current=e},[e]),f.useEffect(()=>{u||m()},[s,u]),f.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),f.useEffect(()=>{u||typeof l!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},l))},[l,u,m,...r]),{droppableRects:x,measureDroppableContainers:m,measuringScheduled:a!=null};function g(){switch(d){case Or.Always:return!1;case Or.BeforeDragging:return s;default:return!s}}}function Bh(e,t){return qr(s=>e?s||(typeof t=="function"?t(e):e):null,[t,e])}function $S(e,t){return Bh(e,t)}function BS(e){let{callback:t,disabled:s}=e;const r=fc(t),o=f.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,s]);return f.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Ia(e){let{callback:t,disabled:s}=e;const r=fc(t),o=f.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[s]);return f.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function FS(e){return new hc(Hn(e),e)}function Su(e,t,s){t===void 0&&(t=FS);const[r,o]=f.useState(null);function a(){o(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??s)!=null?d:null}const h=t(e);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const i=BS({callback(c){if(e)for(const d of c){const{type:h,target:u}=d;if(h==="childList"&&u instanceof HTMLElement&&u.contains(e)){a();break}}}}),l=Ia({callback:a});return ks(()=>{a(),e?(l==null||l.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),i==null||i.disconnect())},[e]),r}function WS(e){const t=Bh(e);return Mh(e,t)}const Cu=[];function US(e){const t=f.useRef(e),s=qr(r=>e?r&&r!==Cu&&e&&t.current&&e.parentNode===t.current.parentNode?r:La(e):Cu,[e]);return f.useEffect(()=>{t.current=e},[e]),s}function HS(e){const[t,s]=f.useState(null),r=f.useRef(e),o=f.useCallback(a=>{const i=Ni(a.target);i&&s(l=>l?(l.set(i,ul(i)),new Map(l)):null)},[]);return f.useEffect(()=>{const a=r.current;if(e!==a){i(a);const l=e.map(c=>{const d=Ni(c);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,ul(d)]):null}).filter(c=>c!=null);s(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(c=>{const d=Ni(c);d==null||d.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Mn(a,i),ls):Rh(e):ls,[e,t])}function _u(e,t){t===void 0&&(t=[]);const s=f.useRef(null);return f.useEffect(()=>{s.current=null},t),f.useEffect(()=>{const r=e!==ls;r&&!s.current&&(s.current=e),!r&&s.current&&(s.current=null)},[e]),s.current?Lr(e,s.current):ls}function GS(e){f.useEffect(()=>{if(!Ma)return;const t=e.map(s=>{let{sensor:r}=s;return r.setup==null?void 0:r.setup()});return()=>{for(const s of t)s==null||s()}},e.map(t=>{let{sensor:s}=t;return s}))}function YS(e,t){return f.useMemo(()=>e.reduce((s,r)=>{let{eventName:o,handler:a}=r;return s[o]=i=>{a(i,t)},s},{}),[e,t])}function Fh(e){return f.useMemo(()=>e?gS(e):null,[e])}const Tu=[];function VS(e,t){t===void 0&&(t=Hn);const[s]=e,r=Fh(s?Lt(s):null),[o,a]=f.useState(Tu);function i(){a(()=>e.length?e.map(c=>Dh(c)?r:new hc(t(c),c)):Tu)}const l=Ia({callback:i});return ks(()=>{l==null||l.disconnect(),i(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),o}function KS(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Kr(t)?t:e}function qS(e){let{measure:t}=e;const[s,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:h}of d)if(Kr(h)){r(u=>{const p=t(h);
113return u?{...u,width:p.width,height:p.height}:p});break}},[t]),a=Ia({callback:o}),i=f.useCallback(d=>{const h=KS(d);a==null||a.disconnect(),h&&(a==null||a.observe(h)),r(h?t(h):null)},[t,a]),[l,c]=ha(i);return f.useMemo(()=>({nodeRef:l,rect:s,setRef:c}),[s,l,c])}const XS=[{sensor:xc,options:{}},{sensor:pc,options:{}}],JS={current:{}},Eo={draggable:{measure:yu},droppable:{measure:yu,strategy:Or.WhileDragging,frequency:ml.Optimized},dragOverlay:{measure:Hn}};class xr extends Map{get(t){var s;return t!=null&&(s=super.get(t))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:s}=t;return!s})}getNodeFor(t){var s,r;return(s=(r=this.get(t))==null?void 0:r.node.current)!=null?s:void 0}}const ZS={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pa},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Eo,measureDroppableContainers:pa,windowRect:null,measuringScheduled:!1},QS={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pa,draggableNodes:new Map,over:null,measureDroppableContainers:pa},Oa=f.createContext(QS),Wh=f.createContext(ZS);function eC(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xr}}}function tC(e,t){switch(t.type){case ot.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ot.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ot.DragEnd:case ot.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ot.RegisterDroppable:{const{element:s}=t,{id:r}=s,o=new xr(e.droppable.containers);return o.set(r,s),{...e,droppable:{...e.droppable,containers:o}}}case ot.SetDroppableDisabled:{const{id:s,key:r,disabled:o}=t,a=e.droppable.containers.get(s);if(!a||r!==a.key)return e;const i=new xr(e.droppable.containers);return i.set(s,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case ot.UnregisterDroppable:{const{id:s,key:r}=t,o=e.droppable.containers.get(s);if(!o||r!==o.key)return e;const a=new xr(e.droppable.containers);return a.delete(s),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function sC(e){let{disabled:t}=e;const{active:s,activatorEvent:r,draggableNodes:o}=f.useContext(Oa),a=cl(r),i=cl(s==null?void 0:s.id);return f.useEffect(()=>{if(!t&&!r&&a&&i!=null){if(!mc(a)||document.activeElement===a.target)return;const l=o.get(i);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[c.current,d.current]){if(!h)continue;const u=K1(h);if(u){u.focus();break}}})}},[r,t,o,i,a]),null}function nC(e,t){let{transform:s,...r}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...r}),s):s}function rC(e){return f.useMemo(()=>({draggable:{...Eo.draggable,...e==null?void 0:e.draggable},droppable:{...Eo.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Eo.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function oC(e){let{activeNode:t,measure:s,initialRect:r,config:o=!0}=e;const a=f.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ks(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const h=s(d),u=Mh(h,r);if(i||(u.x=0),l||(u.y=0),a.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const p=Lh(d);p&&p.scrollBy({top:u.y,left:u.x})}},[t,i,l,r,s])}const Uh=f.createContext({...ls,scaleX:1,scaleY:1});var Vs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Vs||(Vs={}));const aC=f.memo(function(t){var s,r,o,a;let{id:i,accessibility:l,autoScroll:c=!0,children:d,sensors:h=XS,collisionDetection:u=cS,measuring:p,modifiers:m,...b}=t;
113const x=f.useReducer(tC,void 0,eC),[g,y]=x,[N,w]=eS(),[k,E]=f.useState(Vs.Uninitialized),v=k===Vs.Initialized,{draggable:{active:S,nodes:z,translate:B},droppable:{containers:M}}=g,D=S!=null?z.get(S):null,A=f.useRef({initial:null,translated:null}),U=f.useMemo(()=>{var Pe;return S!=null?{id:S,data:(Pe=D==null?void 0:D.data)!=null?Pe:JS,rect:A}:null},[S,D]),se=f.useRef(null),[P,ne]=f.useState(null),[C,I]=f.useState(null),F=Mr(b,Object.values(b)),ae=Xr("DndDescribedBy",i),Z=f.useMemo(()=>M.getEnabled(),[M]),Q=rC(p),{droppableRects:re,measureDroppableContainers:oe,measuringScheduled:Y}=RS(Z,{dragging:v,dependencies:[B.x,B.y],config:Q.droppable}),O=DS(z,S),_=f.useMemo(()=>C?dl(C):null,[C]),W=Is(),de=$S(O,Q.draggable.measure);oC({activeNode:S!=null?z.get(S):null,config:W.layoutShiftCompensation,initialRect:de,measure:Q.draggable.measure});const he=Su(O,Q.draggable.measure,de),ve=Su(O?O.parentElement:null),R=f.useRef({activatorEvent:null,active:null,activeNode:O,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:z,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=M.getNodeFor((s=R.current.over)==null?void 0:s.id),ge=qS({measure:Q.dragOverlay.measure}),H=(r=ge.nodeRef.current)!=null?r:O,ce=v?(o=ge.rect)!=null?o:he:null,ke=!!(ge.nodeRef.current&&ge.rect),T=WS(ke?null:he),te=Fh(H?Lt(H):null),xe=US(v?ie??O:null),me=VS(xe),at=nC(m,{transform:{x:B.x-T.x,y:B.y-T.y,scaleX:1,scaleY:1},activatorEvent:C,active:U,activeNodeRect:he,containerNodeRect:ve,draggingNodeRect:ce,over:R.current.over,overlayNodeRect:ge.rect,scrollableAncestors:xe,scrollableAncestorRects:me,windowRect:te}),De=_?Mn(_,B):null,st=HS(xe),Qe=_u(st),Xe=_u(st,[he]),Je=Mn(at,Qe),xt=ce?fS(ce,at):null,It=U&&xt?u({active:U,collisionRect:xt,droppableRects:re,droppableContainers:Z,pointerCoordinates:De}):null,nt=Ah(It,"id"),[it,Ut]=f.useState(null),Ht=ke?at:Mn(at,Xe),mt=dS(Ht,(a=it==null?void 0:it.rect)!=null?a:null,he),Ot=f.useRef(null),yt=f.useCallback((Pe,Le)=>{let{sensor:et,options:ue}=Le;if(se.current==null)return;const be=z.get(se.current);if(!be)return;const pe=Pe.nativeEvent,ze=new et({active:se.current,activeNode:be,event:pe,options:ue,context:R,onAbort(Ee){if(!z.get(Ee))return;const{onDragAbort:Ie}=F.current,$e={id:Ee};Ie==null||Ie($e),N({type:"onDragAbort",event:$e})},onPending(Ee,Ge,Ie,$e){if(!z.get(Ee))return;const{onDragPending:Gt}=F.current,St={id:Ee,constraint:Ge,initialCoordinates:Ie,offset:$e};Gt==null||Gt(St),N({type:"onDragPending",event:St})},onStart(Ee){const Ge=se.current;if(Ge==null)return;const Ie=z.get(Ge);if(!Ie)return;const{onDragStart:$e}=F.current,Zt={activatorEvent:pe,active:{id:Ge,data:Ie.data,rect:A}};Xs.unstable_batchedUpdates(()=>{$e==null||$e(Zt),E(Vs.Initializing),y({type:ot.DragStart,initialCoordinates:Ee,active:Ge}),N({type:"onDragStart",event:Zt}),ne(Ot.current),I(pe)})},onMove(Ee){y({type:ot.DragMove,coordinates:Ee})},onEnd:Re(ot.DragEnd),onCancel:Re(ot.DragCancel)});Ot.current=ze;function Re(Ee){return async function(){const{active:Ie,collisions:$e,over:Zt,scrollAdjustedTranslate:Gt}=R.current;let St=null;if(Ie&&Gt){const{cancelDrop:Ct}=F.current;St={activatorEvent:pe,active:Ie,collisions:$e,delta:Gt,over:Zt},Ee===ot.DragEnd&&typeof Ct=="function"&&await Promise.resolve(Ct(St))&&(Ee=ot.DragCancel)}se.current=null,Xs.unstable_batchedUpdates(()=>{y({type:Ee}),E(Vs.Uninitialized),Ut(null),ne(null),I(null),Ot.current=null;const Ct=Ee===ot.DragEnd?"onDragEnd":"onDragCancel";if(St){const en=F.current[Ct];en==null||en(St),N({type:Ct,event:St})}})}}},[z]),fs=f.useCallback((Pe,Le)=>(et,ue)=>{const be=et.nativeEvent,pe=z.get(ue);if(se.current!==null||!pe||be.dndKit||be.defaultPrevented)return;const ze={active:pe};Pe(et,Le.options,ze)===!0&&(be.dndKit={capturedBy:Le.sensor},se.current=ue,yt(et,Le))},[z,yt]),Dt=PS(h,fs);GS(h),ks(()=>{he&&k===Vs.Initializing&&E(Vs.Initialized)},[he,k]),f.useEffect(()=>{const{onDragMove:Pe}=F.current,{active:Le,activatorEvent:et,collisions:ue,over:be}=R.current;if(!Le||!et)return;const pe={active:Le,activatorEvent:et,collisions:ue,delta:{x:Je.x,y:Je.y},over:be};Xs.unstable_batchedUpdates(()=>{Pe==null||Pe(pe),N({type:"onDragMove",event:pe})})},[Je.x,Je.y]),f.useEffect(()=>{const{active:Pe,activatorEvent:Le,collisions:et,droppableContainers:ue,scrollAdjustedTranslate:be}=R.current;if(!Pe||se.current==null||!Le||!be)return;const{onDragOver:pe}
113=F.current,ze=ue.get(nt),Re=ze&&ze.rect.current?{id:ze.id,rect:ze.rect.current,data:ze.data,disabled:ze.disabled}:null,Ee={active:Pe,activatorEvent:Le,collisions:et,delta:{x:be.x,y:be.y},over:Re};Xs.unstable_batchedUpdates(()=>{Ut(Re),pe==null||pe(Ee),N({type:"onDragOver",event:Ee})})},[nt]),ks(()=>{R.current={activatorEvent:C,active:U,activeNode:O,collisionRect:xt,collisions:It,droppableRects:re,draggableNodes:z,draggingNode:H,draggingNodeRect:ce,droppableContainers:M,over:it,scrollableAncestors:xe,scrollAdjustedTranslate:Je},A.current={initial:ce,translated:xt}},[U,O,It,xt,z,H,ce,re,M,it,xe,Je]),LS({...W,delta:B,draggingRect:xt,pointerCoordinates:De,scrollableAncestors:xe,scrollableAncestorRects:me});const rt=f.useMemo(()=>({active:U,activeNode:O,activeNodeRect:he,activatorEvent:C,collisions:It,containerNodeRect:ve,dragOverlay:ge,draggableNodes:z,droppableContainers:M,droppableRects:re,over:it,measureDroppableContainers:oe,scrollableAncestors:xe,scrollableAncestorRects:me,measuringConfiguration:Q,measuringScheduled:Y,windowRect:te}),[U,O,he,C,It,ve,ge,z,M,re,it,oe,xe,me,Q,Y,te]),ms=f.useMemo(()=>({activatorEvent:C,activators:Dt,active:U,activeNodeRect:he,ariaDescribedById:{draggable:ae},dispatch:y,draggableNodes:z,over:it,measureDroppableContainers:oe}),[C,Dt,U,he,y,ae,z,it,oe]);return X.createElement(Th.Provider,{value:w},X.createElement(Oa.Provider,{value:ms},X.createElement(Wh.Provider,{value:rt},X.createElement(Uh.Provider,{value:mt},d)),X.createElement(sC,{disabled:(l==null?void 0:l.restoreFocus)===!1})),X.createElement(nS,{...l,hiddenTextDescribedById:ae}));function Is(){const Pe=(P==null?void 0:P.autoScrollEnabled)===!1,Le=typeof c=="object"?c.enabled===!1:c===!1,et=v&&!Pe&&!Le;return typeof c=="object"?{...c,enabled:et}:{enabled:et}}}),iC=f.createContext(null),Eu="button",lC="Draggable";function cC(e){let{id:t,data:s,disabled:r=!1,attributes:o}=e;const a=Xr(lC),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:h,draggableNodes:u,over:p}=f.useContext(Oa),{role:m=Eu,roleDescription:b="draggable",tabIndex:x=0}=o??{},g=(c==null?void 0:c.id)===t,y=f.useContext(g?Uh:iC),[N,w]=ha(),[k,E]=ha(),v=YS(i,t),S=Mr(s);ks(()=>(u.set(t,{id:t,key:a,node:N,activatorNode:k,data:S}
113),()=>{const B=u.get(t);B&&B.key===a&&u.delete(t)}),[u,t]);const z=f.useMemo(()=>({role:m,tabIndex:x,"aria-disabled":r,"aria-pressed":g&&m===Eu?!0:void 0,"aria-roledescription":b,"aria-describedby":h.draggable}),[r,m,x,g,b,h.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:z,isDragging:g,listeners:r?void 0:v,node:N,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:y}}function dC(){return f.useContext(Wh)}const uC="Droppable",fC={timeout:25};function mC(e){let{data:t,disabled:s=!1,id:r,resizeObserverConfig:o}=e;const a=Xr(uC),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=f.useContext(Oa),h=f.useRef({disabled:s}),u=f.useRef(!1),p=f.useRef(null),m=f.useRef(null),{disabled:b,updateMeasurementsFor:x,timeout:g}={...fC,...o},y=Mr(x??r),N=f.useCallback(()=>{if(!u.current){u.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),m.current=null},g)},[g]),w=Ia({callback:N,disabled:b||!i}),k=f.useCallback((z,B)=>{w&&(B&&(w.unobserve(B),u.current=!1),z&&w.observe(z))},[w]),[E,v]=ha(k),S=Mr(t);return f.useEffect(()=>{!w||!E.current||(w.disconnect(),u.current=!1,w.observe(E.current))},[E,w]),f.useEffect(()=>(l({type:ot.RegisterDroppable,element:{id:r,key:a,disabled:s,node:E,rect:p,data:S}}),()=>l({type:ot.UnregisterDroppable,key:a,id:r})),[r]),f.useEffect(()=>{s!==h.current.disabled&&(l({type:ot.SetDroppableDisabled,id:r,key:a,disabled:s}),h.current.disabled=s)},[r,a,s,l]),{active:i,rect:p,isOver:(c==null?void 0:c.id)===r,node:E,over:c,setNodeRef:v}}function bc(e,t,s){const r=e.slice();return r.splice(s<0?r.length+s:s,0,r.splice(t,1)[0]),r}function hC(e,t){return e.reduce((s,r,o)=>{const a=t.get(r);return a&&(s[o]=a),s},Array(e.length))}function xo(e){return e!==null&&e>=0}function pC(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}function gC(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Hh=e=>{let{rects:t,activeIndex:s,overIndex:r,index:o}=e;const a=bc(t,r,s),i=t[o],l=a[o];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},bo={scaleX:1,scaleY:1},xC=e=>{var t;let{activeIndex:s,activeNodeRect:r,index:o,rects:a,overIndex:i}=e;const l=(t=a[s])!=null?t:r;if(!l)return null;if(o===s){const d=a[i];return d?{x:0,y:s<i?d.top+d.height-(l.top+l.height):d.top-l.top,...bo}:null}const c=bC(a,o,s);return o>s&&o<=i?{x:0,y:-l.height-c,...bo}:o<s&&o>=i?{x:0,y:l.height+c,...bo}:{x:0,y:0,...bo}};function bC(e,t,s){const r=e[t],o=e[t-1],a=e[t+1];return r?s<t?o?r.top-(o.top+o.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const Gh="Sortable",Yh=X.createContext({activeIndex:-1,containerId:Gh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Hh,disabled:{draggable:!1,droppable:!1}});function wC(e){let{children:t,id:s,items:r,strategy:o=Hh,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=dC(),u=Xr(Gh,s),p=l.rect!==null,m=f.useMemo(()=>r.map(v=>typeof v=="object"&&"id"in v?v.id:v),[r]),b=i!=null,x=i?m.indexOf(i.id):-1,g=d?m.indexOf(d.id):-1,y=f.useRef(m),N=!pC(m,y.current),w=g!==-1&&x===-1||N,k=gC(a);ks(()=>{N&&b&&h(m)},[N,m,b,h]),f.useEffect(()=>{y.current=m},[m]);const E=f.useMemo(()=>({activeIndex:x,containerId:u,disabled:k,disableTransforms:w,items:m,overIndex:g,useDragOverlay:p,sortedRects:hC(m,c),strategy:o}),[x,u,k.draggable,k.droppable,w,m,g,c,p,o]);return X.createElement(Yh.Provider,{value:E},t)}const yC=e=>{let{id:t,items:s,activeIndex:r,overIndex:o}=e;return bc(s,r,o).indexOf(t)},vC=e=>{let{containerId:t,isSorting:s,wasDragging:r,index:o,items:a,newIndex:i,previousItems:l,previousContainerId:c,transition:d}=e;return!d||!r||l!==a&&o===i?!1:s?!0:i!==o&&t===c},jC={duration:200,easing:"ease"},Vh="transform",NC=Ir.Transition.toString({property:Vh,duration:0,easing:"linear"}),kC={roleDescription:"sortable"};function SC(e){let{disabled:t,index:s,node:r,rect:o}=e;const[a,i]=f.useState(null),l=f.useRef(s);return ks(()=>
113{if(!t&&s!==l.current&&r.current){const c=o.current;if(c){const d=Hn(r.current,{ignoreTransform:!0}),h={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(h.x||h.y)&&i(h)}}s!==l.current&&(l.current=s)},[t,s,r,o]),f.useEffect(()=>{a&&i(null)},[a]),a}function CC(e){let{animateLayoutChanges:t=vC,attributes:s,disabled:r,data:o,getNewIndex:a=yC,id:i,strategy:l,resizeObserverConfig:c,transition:d=jC}=e;const{items:h,containerId:u,activeIndex:p,disabled:m,disableTransforms:b,sortedRects:x,overIndex:g,useDragOverlay:y,strategy:N}=f.useContext(Yh),w=_C(r,m),k=h.indexOf(i),E=f.useMemo(()=>({sortable:{containerId:u,index:k,items:h},...o}),[u,o,k,h]),v=f.useMemo(()=>h.slice(h.indexOf(i)),[h,i]),{rect:S,node:z,isOver:B,setNodeRef:M}=mC({id:i,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:v,...c}}),{active:D,activatorEvent:A,activeNodeRect:U,attributes:se,setNodeRef:P,listeners:ne,isDragging:C,over:I,setActivatorNodeRef:F,transform:ae}=cC({id:i,data:E,attributes:{...kC,...s},disabled:w.draggable}),Z=H1(M,P),Q=!!D,re=Q&&!b&&xo(p)&&xo(g),oe=!y&&C,Y=oe&&re?ae:null,_=re?Y??(l??N)({rects:x,activeNodeRect:U,activeIndex:p,overIndex:g,index:k}):null,W=xo(p)&&xo(g)?a({id:i,items:h,activeIndex:p,overIndex:g}):k,de=D==null?void 0:D.id,he=f.useRef({activeId:de,items:h,newIndex:W,containerId:u}),ve=h!==he.current.items,R=t({active:D,containerId:u,isDragging:C,isSorting:Q,id:i,index:k,items:h,newIndex:he.current.newIndex,previousItems:he.current.items,previousContainerId:he.current.containerId,transition:d,wasDragging:he.current.activeId!=null}),ie=SC({disabled:!R,index:k,node:z,rect:S});return f.useEffect(()=>{Q&&he.current.newIndex!==W&&(he.current.newIndex=W),u!==he.current.containerId&&(he.current.containerId=u),h!==he.current.items&&(he.current.items=h)},[Q,W,u,h]),f.useEffect(()=>{if(de===he.current.activeId)return;if(de!=null&&he.current.activeId==null){he.current.activeId=de;return}const H=setTimeout(()=>{he.current.activeId=de},50);return()=>clearTimeout(H)},[de]),{active:D,activeIndex:p,attributes:se,data:E,rect:S,index:k,newIndex:W,items:h,isOver:B,isSorting:Q,isDragging:C,listeners:ne,node:z,overIndex:g,over:I,setNodeRef:Z,setActivatorNodeRef:F,setDroppableNodeRef:M,setDraggableNodeRef:P,transform:ie??_,transition:ge()};function ge(){if(ie||ve&&he.current.newIndex===k)return NC;if(!(oe&&!mc(A)||!d)&&(Q||R))return Ir.Transition.toString({...d,property:Vh})}}function _C(e,t){var s,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(s=e==null?void 0:e.draggable)!=null?s:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function xa(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const TC=[Ce.Down,Ce.Right,Ce.Up,Ce.Left],EC=(e,t)=>{let{context:{active:s,collisionRect:r,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:l}}=t;if(TC.includes(e.code)){if(e.preventDefault(),!s||!r)return;const c=[];a.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const p=o.get(u.id);if(p)switch(e.code){case Ce.Down:r.top<p.top&&c.push(u);break;case Ce.Up:r.top>p.top&&c.push(u);break;case Ce.Left:r.left>p.left&&c.push(u);break;case Ce.Right:r.left<p.left&&c.push(u);break}});const d=iS({active:s,collisionRect:r,droppableRects:o,droppableContainers:c,pointerCoordinates:null});let h=Ah(d,"id");if(h===(i==null?void 0:i.id)&&d.length>1&&(h=d[1].id),h!=null){const u=a.get(s.id),p=a.get(h),m=p?o.get(p.id):null,b=p==null?void 0:p.node.current;if(b&&m&&u&&p){const g=La(b).some((v,S)=>l[S]!==v),y=Kh(u,p),N=zC(u,p),w=g||!y?{x:0,y:0}:{x:N?r.width-m.width:0,y:N?r.height-m.height:0},k={x:m.left,y:m.top};return w.x&&w.y?k:Lr(k,w)}}}};function Kh(e,t){return!xa(e)||!xa(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function zC(e,t){return!xa(e)||!xa(t)||!Kh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function AC({short:e,reordering:t,onToggle:s,onRemove:r}){const{attributes:o,listeners:a,setNodeRef:i,transform:l,transition:c,isDragging:d}=CC({id:e.id,disabled:t}),h={transform:Ir.Transform.toString(l),transition:c};return n.jsxs("div",{ref:i,style:h,className:`flex items-center gap-3 px-4 py-3 border-b border-border last:border-0 transition-colors ${d?"opacity-50 bg-news-surface-3 z-10 relative shadow-md":"hover:bg-news-surface-3"}`,children:[n.jsx("button",{type:"button",...o,...a,disabled:t,className:"p-1.5 text-news-muted hover:text-foreground cursor-grab active:cursor-grabbing touch-none disabled:opacity-40",title:"PrzeciÄ
gnij, aby zmieniÄ kolejnoÅÄ","aria-label":"ZmieÅ kolejnoÅÄ",children:n.jsx(Rg,{size:16})}),n.jsx("img",{src:`https://i.ytimg.com/vi/${e.video_id}/default.jpg`,alt:"",className:"w-12 h-12 rounded object-cover flex-shrink-0 bg-news-surface-3 pointer-events-none select-none",draggable:!1}),n.jsxs("div",{className:"flex-1 min-w-0 select-none",children:[n.jsx("p",{className:"text-sm font-medium text-foreground line-clamp-1",children:e.title}),n.jsx("p",{className:"text-xs text-news-muted font-mono",children:e.video_id})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>s(e),className:"p-1.5 text-news-muted hover:text-foreground",title:e.active?"Ukryj":"Pokaż",children:e.active?n.jsx(At,{size:14}):n.jsx(bn,{size:14,className:"text-news-dim"})}),n.jsx("button",{type:"button",onClick:()=>r(e.id),className:"p-1.5 text-news-muted hover:text-destructive",title:"UsuÅ",children:n.jsx(qe,{size:14})})]})]})}function MC(){const[e,t]=f.useState([]),[s,r]=f.useState(!0),[o,a]=f.useState(""),[i,l]=f.useState(""),[c,d]=f.useState(!1),[h,u]=f.useState(!1),[p,m]=f.useState(!1),b=rS(xu(xc,{activationConstraint:{distance:6}}),xu(pc,{coordinateGetter:EC})),x=f.useCallback(async()=>{r(!0);try{t(await $.getShorts(!0))}catch(v){G.error(v instanceof Error?v.message:"BÅÄ
d Åadowania")}r(!1)},[]);f.useEffect(()=>{x()},[x]);const g=v=>{const S=v.match(/(?:shorts\/|watch\?v=|youtu\.be\/)([\w-]{6,})/);return S?S[1]:v.trim()},y=async()=>{const v=g(o);if(!v||!i.trim()){G.error("Podaj ID/link i tytuÅ");return}d(!0);try{await $.createShort({video_id:v,title:i.trim(),position:e.length,active:!0}),G.success("Dodano shorta"),a(""),l(""),x()}catch(S){G.error(S instanceof Error?S.message:"BÅÄ
d")}d(!1)},N=async v=>{try{await $.updateShort(v.id,{active:!v.active}),x()}catch(S){G.error(S instanceof Error?S.message:"BÅÄ
d")}},w=async v=>{if(confirm("UsunÄ
Ä tego shorta?"))try{await $.deleteShort(v),x()}catch(S){G.error(S instanceof Error?S.message:"BÅÄ
d")}},k=async v=>{const{active:S,over:z}=v;if(!z||S.id===z.id)return;const B=e.findIndex(U=>U.id===S.id),M=e.findIndex(U=>U.id===z.id);if(B<0||M<0)return;const D=e,A=bc(e,B,M);t(A),m(!0);try{const U=await $.reorderShorts(A.map(se=>se.id));t(U)}catch(U){t(D),G.error(U instanceof Error?U.message:"Nie udaÅo siÄ zmieniÄ kolejnoÅci")}finally{m(!1)}},E=async()=>{u(!0);try{const v=await $.syncShortsFromYouTube();v.added>0?(G.success(`Dodano ${v.added} nowych shorts (pominiÄto ${v.skipped} już w bazie)`),x()):G.info(`Brak nowych shorts â ${v.skipped} z ostatnich ${v.fetched} już jest w bazie`)}catch(v){G.error(v instanceof Error?v.message:"BÅÄ
d synchronizacji")}u(!1)};return n.jsxs("div",{className:"max-w-3xl space-y-6",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Dodaj YouTube Shorts"}),n.jsxs("p",{className:"text-xs text-news-muted mt-1",children:["Wklej link do shorta z YouTube lub samo ID (np. ",n.jsx("code",{children:"-Sqi1Txi8HI"}),")."]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_2fr_auto] gap-3",children:[n.jsx("input",{value:o,onChange:v=>a(v.target.value),placeholder:"Link lub ID",className:"bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"}),n.jsx("input",{value:i,onChange:v=>l(v.target.value),placeholder:"TytuÅ",className:"bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"}),n.jsxs("button",{type:"button",onClick:()=>
113void y(),disabled:c,className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50 flex items-center gap-2",children:[n.jsx(Ft,{size:14})," Dodaj"]})]})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between gap-3",children:[n.jsxs("h3",{className:"font-bold text-foreground flex items-center gap-2",children:[n.jsx(Nr,{size:16,className:"text-news-red"})," Lista shorts",p&&n.jsx(fe,{size:14,className:"animate-spin text-news-muted"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>void E(),disabled:h||p,className:"inline-flex items-center gap-1.5 text-xs font-semibold text-news-red border border-news-red/40 rounded px-2.5 py-1.5 hover:bg-news-red/10 transition-colors disabled:opacity-50",title:"Pobiera ostatnie 20 Shorts z kanaÅu @polskamorska1036 â dopisuje tylko nowe ID",children:[h?n.jsx(fe,{size:13,className:"animate-spin"}):n.jsx(yl,{size:13}),"Pobierz z kanaÅu"]}),n.jsxs("span",{className:"text-xs text-news-muted",children:[e.length," pozycji"]})]})]}),!s&&e.length>0&&n.jsx("p",{className:"px-4 py-2 text-xs text-news-muted border-b border-border",children:"ChwyÄ za ikonÄ â ¿ i przeciÄ
gnij wiersz, aby zmieniÄ kolejnoÅÄ."}),s?n.jsx("div",{className:"p-8 flex justify-center",children:n.jsx(fe,{size:20,className:"animate-spin text-news-muted"})}):e.length===0?n.jsx("div",{className:"p-6 text-center text-sm text-news-muted",children:"Brak shorts. Dodaj pierwszy powyżej."}):n.jsx(aC,{sensors:b,collisionDetection:aS,onDragEnd:v=>void k(v),children:n.jsx(wC,{items:e.map(v=>v.id),strategy:xC,children:e.map(v=>n.jsx(AC,{short:v,reordering:p,onToggle:N,onRemove:w},v.id))})})]})]})}function LC(){const[e,t]=f.useState([]),[s,r]=f.useState(!0),[o,a]=f.useState(""),i=async()=>{r(!0);try{t(await $.getTrendingTopics(!0))}catch(u){G.error(u instanceof Error?u.message:"BÅÄ
d Åadowania")}r(!1)};f.useEffect(()=>{i()},[]);const l=async()=>{let u=o.trim();if(u){u.startsWith("#")||(u="#"+u);try{await $.createTrendingTopic({label:u,position:e.length,active:!0}),G.success("Dodano temat"),a(""),i()}catch(p){G.error(p instanceof Error?p.message:"BÅÄ
d")}}},c=async u=>{try{await $.updateTrendingTopic(u.id,{active:!u.active}),i()}catch(p){G.error(p instanceof Error?p.message:"BÅÄ
d")}},d=async u=>{if(confirm("UsunÄ
Ä temat?"))try{await $.deleteTrendingTopic(u),i()}catch(p){G.error(p instanceof Error?p.message:"BÅÄ
d")}},h=async(u,p)=>{const m=u+p;m<0||m>=e.length||(await $.swapTrendingTopics(e[u].id,e[m].id),i())};return n.jsxs("div",{className:"max-w-xl space-y-6",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Dodaj trending topic"}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"Pokazywane w sidebarze na widoku desktopowym."})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsx("input",{value:o,onChange:u=>a(u.target.value),onKeyDown:u=>{u.key==="Enter"&&l()},placeholder:"#Tag (np. #Porty)",className:"flex-1 bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"}),n.jsxs("button",{onClick:l,className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors flex items-center gap-2",children:[n.jsx(Ft,{size:14})," Dodaj"]})]})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[n.jsxs("h3",{className:"font-bold text-foreground flex items-center gap-2",children:[n.jsx(jr,{size:16,className:"text-news-red"})," Lista"]}),n.jsxs("span",{className:"text-xs text-news-muted",children:[e.length," tematów"]})]}),s?n.jsx("div",{className:"p-8 flex justify-center",children:n.jsx(fe,{size:20,className:"animate-spin text-news-muted"})}):e.length===0?n.jsx("div",{className:"p-6 text-center text-sm text-news-muted",children:"Brak tematów."}):e.map((u,p)=>n.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border last:border-0 hover:bg-news-surface-3 transition-colors",children:[n.jsx("span",{className:"text-sm font-medium text-foreground flex-1",children:u.label}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{onClick:()=>h(p,-1),disabled:p===0,className:"p-1.5 text-news-muted hover:text-foreground disabled:opacity-30",children:n.jsx(vl,{size:14})}),n.jsx("button",{onClick:()=>h(p,1),disabled:p===e.length-1,className:"p-1.5 text-news-muted hover:text-foreground disabled:opacity-30",children:n.jsx(jl,{size:14})}),n.jsx("button",{onClick:()=>c(u),className:"p-1.5 text-news-muted hover:text-foreground",children:u.active?n.jsx(At,{size:14}):n.jsx(bn,{size:14,className:"text-news-dim"})}),n.jsx("button",{onClick:()=>d(u.id),className:"p-1.5 text-news-muted hover:text-destructive",children:n.jsx(qe,{size:14})})]})]},u.id))]})]})}function IC(){const[e,t]=f.useState([]),[s,r]=f.useState(!0),[o,a]=f.useState(""),[i,l]=f.useState(!1),c=async()=>{r(!0);try{t(await $.getCategories({navOnly:!1}))}catch(m){G.error(m instanceof Error?m.message:"BÅÄ
d Åadowania kategorii")}finally{r(!1)}};f.useEffect(()=>{c()},[]);const d=async()=>{const m=o.trim();if(m){l(!0);try{await $.createCategory({name:m}),G.success(`Dodano kategoriÄ â${m}"`),a(""),c()}catch(b){G.error(b instanceof Error?b.message:"Nie udaÅo siÄ dodaÄ kategorii")}finally{l(!1)}}},h=async m=>
113{if(!(!m.id||!m.editable)){if(m.article_count>0){G.error(`Kategoria â${m.name}" ma ${m.article_count} artykuÅów â najpierw przenieÅ je do innej kategorii.`);return}if(confirm(`UsunÄ
Ä kategoriÄ â${m.name}"?`))try{await $.deleteCategory(m.id),G.success("Kategoria usuniÄta"),c()}catch(b){G.error(b instanceof Error?b.message:"Nie udaÅo siÄ usunÄ
Ä")}}},u=e.filter(m=>m.source==="app"),p=e.filter(m=>m.source!=="app");return n.jsxs("div",{className:"max-w-2xl space-y-6",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Dodaj kategoriÄ"}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"WÅasne kategorie portalu â dostÄpne przy tworzeniu artykuÅów w aplikacji. Kategorie WordPress (import) sÄ
tylko do odczytu."})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsx("input",{value:o,onChange:m=>a(m.target.value),onKeyDown:m=>{m.key==="Enter"&&d()},placeholder:"Np. Logistyka, Offshore 2026â¦",className:"flex-1 bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"}),n.jsxs("button",{type:"button",onClick:d,disabled:i||!o.trim(),className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors flex items-center gap-2 disabled:opacity-50",children:[i?n.jsx(fe,{size:14,className:"animate-spin"}):n.jsx(Ft,{size:14}),"Dodaj"]})]})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[n.jsx("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:n.jsxs("h3",{className:"font-bold text-foreground flex items-center gap-2",children:[n.jsx(wa,{size:16,className:"text-news-red"}),"WÅasne kategorie (",u.length,")"]})}),s?n.jsx("div",{className:"p-8 flex justify-center",children:n.jsx(fe,{size:20,className:"animate-spin text-news-muted"})}):u.length===0?n.jsx("div",{className:"p-6 text-center text-sm text-news-muted",children:"Brak wÅasnych kategorii. Dodaj pierwszÄ
powyżej."}):u.map(m=>n.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border last:border-0 hover:bg-news-surface-3 transition-colors",children:[n.jsx("div",{className:"w-2 h-2 rounded-full bg-news-red shrink-0"}),n.jsx("span",{className:"text-sm font-medium text-foreground flex-1",children:m.name}),n.jsxs("span",{className:"text-xs text-news-muted",children:[m.article_count," artykuÅów"]}),n.jsx("button",{type:"button",onClick:()=>h(m),className:"p-1.5 text-news-muted hover:text-destructive transition-colors",title:"UsuÅ kategoriÄ",children:n.jsx(qe,{size:14})})]},m.id??m.name))]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"px-4 py-3 border-b border-border",children:[n.jsxs("h3",{className:"font-bold text-foreground flex items-center gap-2",children:[n.jsx(af,{size:15,className:"text-news-muted"}),"WordPress (",p.length,")"]}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"Synchronizowane z bazÄ
WordPress â edycja w WP lub przez import."})]}),s?null:p.length===0?n.jsx("div",{className:"p-6 text-center text-sm text-news-muted",children:"Brak kategorii WP z artykuÅami."}):p.map(m=>n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border last:border-0 hover:bg-news-surface-3 transition-colors",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${m.is_nav?"bg-news-red":"bg-news-dim"}`}),n.jsx("span",{className:"font-medium text-foreground",children:m.name}),m.is_nav&&n.jsx("span",{className:"text-[10px] uppercase tracking-wide text-news-red bg-news-red/10 px-1.5 py-0.5 rounded",children:"Menu"})]}),n.jsxs("span",{className:"text-xs text-news-muted",children:[m.article_count," artykuÅów"]})]},m.name))]})]})}const OC=eg,DC=Qp,qh=f.forwardRef(({className:e,...t},s)=>n.jsx(Bu,{className:Ue("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:s}));qh.displayName=Bu.displayName;const Xh=f.forwardRef(({className:e,...t},s)=>n.jsxs(DC,{children:[n.jsx(qh,{}),n.jsx(Fu,{ref:s,className:Ue("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
113nded-lg",e),...t})]}));Xh.displayName=Fu.displayName;const Jh=({className:e,...t})=>n.jsx("div",{className:Ue("flex flex-col space-y-2 text-center sm:text-left",e),...t});Jh.displayName="AlertDialogHeader";const Zh=({className:e,...t})=>n.jsx("div",{className:Ue("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Zh.displayName="AlertDialogFooter";const Qh=f.forwardRef(({className:e,...t},s)=>n.jsx(Wu,{ref:s,className:Ue("text-lg font-semibold",e),...t}));Qh.displayName=Wu.displayName;const ep=f.forwardRef(({className:e,...t},s)=>n.jsx(Uu,{ref:s,className:Ue("text-sm text-muted-foreground",e),...t}));ep.displayName=Uu.displayName;const tp=f.forwardRef(({className:e,...t},s)=>n.jsx(Hu,{ref:s,className:Ue(Tr(),e),...t}));tp.displayName=Hu.displayName;const sp=f.forwardRef(({className:e,...t},s)=>n.jsx(Gu,{ref:s,className:Ue(Tr({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));sp.displayName=Gu.displayName;function Ci(e){return new Date(e).toLocaleString("pl-PL",{dateStyle:"medium",timeStyle:"short"})}function PC(e){switch(e){case"starting":return"Uruchamianieâ¦";case"database":return"Przywracanie bazy danychâ¦";case"files":return"Przywracanie plikówâ¦";case"restart":return"Restart APIâ¦";case"done":return"ZakoÅczono";case"error":return"BÅÄ
d";default:return e??"â"}}function RC(){const[e,t]=f.useState(null),[s,r]=f.useState(!0),[o,a]=f.useState(!1),[i,l]=f.useState(null),[c,d]=f.useState(null),[h,u]=f.useState(""),[p,m]=f.useState(!1),b=f.useCallback(async()=>{try{const[w,k]=await Promise.all([$.getBackups(),$.getBackupRestoreStatus()]);t(w),l(k)}catch(w){G.error(w instanceof Error?w.message:"Nie udaÅo siÄ wczytaÄ kopii")}finally{r(!1)}},[]);f.useEffect(()=>{b()},[b]),f.useEffect(()=>{if(!(i!=null&&i.running))return;const w=setInterval(async()=>{try{const k=await $.getBackupRestoreStatus();l(k),k.running||(k.step==="done"?(G.success("Przywracanie zakoÅczone pomyÅlnie"),b()):k.error&&G.error(k.error))}catch{}},3e3);return()=>clearInterval(w)},[i==null?void 0:i.running,b]);const x=async()=>{a(!0);try{const w=await $.runBackup();t(w),G.success("Backup utworzony")}catch(w){G.error(w instanceof Error?w.message:"BÅÄ
d tworzenia kopii")}finally{a(!1)}},g=async()=>{if(c){m(!0);try{await $.restoreBackup(c.id,h),l({running:!0,backup_id:c.id,step:"starting"}),G.info("Przywracanie rozpoczÄte â może potrwaÄ kilka minut"),d(null),u("")}catch(w){G.error(w instanceof Error?w.message:"BÅÄ
d przywracania")}finally{m(!1)}}};if(s)return n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-sm",children:[n.jsx(fe,{size:16,className:"animate-spin"})," Åadowanie kopii zapasowychâ¦"]});const y=(e==null?void 0:e.backups)??[],N=o||(i==null?void 0:i.running);return n.jsxs("div",{className:"space-y-6 max-w-5xl",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"font-serif text-2xl font-bold text-foreground",children:"Kopie zapasowe"}),n.jsxs("p",{className:"text-sm text-news-muted mt-1",children:["Automatyczne kopie co 5 h · max ",(e==null?void 0:e.retention_days)??3," dni",(e==null?void 0:e.retention_max)!=null?` (do ${e.retention_max} kopii)`:" (do 15 kopii)"," · ","baza co 5 h, uploady + .env raz dziennie"]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>void b(),disabled:N,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg border border-border text-sm font-medium hover:bg-news-surface-3 disabled:opacity-50",children:[n.jsx(yl,{size:16})," OdÅwież"]}),n.jsxs("button",{type:"button",onClick:()=>void x(),disabled:N,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-news-red text-white text-sm font-medium hover:bg-news-red/90 disabled:opacity-50",children:[o?n.jsx(fe,{size:16,className:"animate-spin"}):n.jsx(Oi,{size:16}),"Utwórz kopiÄ teraz"]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-xs uppercase tracking-wide mb-2",children:[n.jsx($g,{size:14})," Liczba kopii"]}),n.jsx("div",{className:"text-2xl font-bold text-foreground",children:(e==null?void 0:e.count)??0})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-xs uppercase tracking-wide mb-2",children:[n.jsx(Bg,{size:14})," ÅÄ
czny rozmiar"]}),n.jsxs("div",{className:"text-2xl font-bold text-foreground",children:[((e==null?void 0:e.total_size_mb)??0).toLocaleStr
113ing("pl-PL")," MB"]})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-xs uppercase tracking-wide mb-2",children:[n.jsx(Oi,{size:14})," Ostatnia kopia"]}),n.jsx("div",{className:"text-sm font-semibold text-foreground",children:e!=null&&e.latest?Ci(e.latest.created_at):"â"})]})]}),(i==null?void 0:i.running)&&n.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg p-4 flex items-center gap-3",children:[n.jsx(fe,{size:18,className:"animate-spin text-amber-500 flex-shrink-0"}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm font-semibold text-foreground",children:["Trwa przywracanie kopii ",i.backup_id]}),n.jsx("p",{className:"text-xs text-news-muted mt-0.5",children:PC(i.step)})]})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg overflow-hidden",children:[n.jsx("div",{className:"px-4 py-3 border-b border-border",children:n.jsx("h2",{className:"font-semibold text-foreground",children:"DostÄpne kopie"})}),y.length===0?n.jsx("p",{className:"px-4 py-8 text-sm text-news-muted",children:"Brak kopii zapasowych na serwerze."}):n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"text-left text-news-muted border-b border-border",children:[n.jsx("th",{className:"px-4 py-3 font-medium",children:"Data"}),n.jsx("th",{className:"px-4 py-3 font-medium",children:"Identyfikator"}),n.jsx("th",{className:"px-4 py-3 font-medium",children:"Baza"}),n.jsx("th",{className:"px-4 py-3 font-medium",children:"Pliki"}),n.jsx("th",{className:"px-4 py-3 font-medium",children:"Razem"}),n.jsx("th",{className:"px-4 py-3 font-medium text-right",children:"Akcje"})]})}),n.jsx("tbody",{children:y.map(w=>n.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-news-surface-3/50",children:[n.jsx("td",{className:"px-4 py-3 text-foreground",children:Ci(w.created_at)}),n.jsx("td",{className:"px-4 py-3 font-mono text-xs text-news-muted",children:w.id}),n.jsxs("td",{className:"px-4 py-3 text-foreground",children:[w.database_mb," MB"]}),n.jsxs("td",{className:"px-4 py-3 text-foreground",children:[w.files_mb," MB"]}),n.jsxs("td",{className:"px-4 py-3 text-foreground font-medium",children:[w.total_mb," MB"]}),n.jsx("td",{className:"px-4 py-3 text-right",children:n.jsxs("button",{type:"button",disabled:N,onClick:()=>{d(w),u("")},className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-border text-xs font-medium hover:border-news-red hover:text-news-red disabled:opacity-50",children:[n.jsx(Fg,{size:14})," PrzywróÄ"]})})]},w.id))})]})})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-4 text-xs text-news-muted space-y-1",children:[n.jsxs("p",{children:[n.jsx("strong",{className:"text-foreground",children:"Co obejmuje kopia:"})," peÅny dump MySQL, katalog uploads/ oraz plik .env."]}),n.jsxs("p",{children:[n.jsx("strong",{className:"text-foreground",children:"Przywracanie nadpisuje"})," obecnÄ
bazÄ i pliki â operacja jest nieodwracalna bez innej kopii."]}),n.jsx("p",{children:"Kod aplikacji (server/, dist/) nie jest w backupie â odtwarza siÄ przez deploy z repozytorium."})]}),n.jsx(OC,{open:!!c,onOpenChange:w=>!w&&d(null),children:n.jsxs(Xh,{children:[n.jsxs(Jh,{children:[n.jsxs(Qh,{children:["PrzywróciÄ kopiÄ z ",c?Ci(c.created_at):"","?"]}),n.jsx(ep,{asChild:!0,children:n.jsxs("div",{className:"space-y-3 text-sm text-news-muted",children:[n.jsxs("p",{children:["Ta operacja ",n.jsx("strong",{className:"text-foreground",children:"nadpisze caÅÄ
bazÄ danych"})," oraz pliki uploads/ i .env stanem z kopii ",n.jsx("code",{className:"text-xs bg-news-surface-3 px-1 py-0.5 rounded",children:c==null?void 0:c.id}),"."]}),n.jsx("p",{children:"Aby potwierdziÄ, wpisz identyfikator kopii:"}),n.jsx("input",{type:"text",value:h,onChange:w=>u(w.target.value),placeholder:c==null?void 0:c.id,className:"w-full px-3 py-2 rounded-md border border-border bg-background text-foreground font-mono text-xs"})]})})]}),n.jsxs(Zh,{children:[n.jsx(sp,{disabled:p,children:"Anuluj"}),n.jsx(tp,{disabled:p||h!==(c==null?void 0:c.id),onClick:w=>{w.preventDefault(),g()},className:"bg-news-red hover:bg-news-red/90",children:p?n.jsx(fe,{size:16,className:"animate-spin"}):"PrzywrÃ³Ä kopiÄ"})]})]})})]})}function $C(){const{categories:e}=wn(!1),{navMenu:t,loading:s,saveNavMenu:r}=us(),[o,a]=f.useState((t==null?void 0:t.items)??ln.items),[i,l]=f.useState(!1),c=e.length?e.map(x=>x.name):Fr;f.useEffect(()=>{t!=null&&t.items&&a(t.items)},[t==null?void 0:t.items]);const d=(x,g)=>{a(y=>y.map(N=>N.id===x?{...N,...g}:N))},h=(x,g)=>{const y=x+g;y<0||y>=o.length||a(N=>{const w=[...N];return[w[x],w[y]]=[w[y],w[x]],w})},u=()=>{const x=c[0]??"Porty";a(g=>[...g,{id:crypto.randomUUID(),label:x,category:x,visible:!0}])},p=x=>{a(g=>g.filter(y=>y.id!==x))},m=()=>{a(ln.items.map(x=>({...x,id:crypto.randomUUID()})))},b=async()=>{const x={items:o.map(y=>({...y,label:y.label.trim()||y.category,category:y.category.trim()}))};l(!0);const g=await r(x);l(!1),g?G.error(g.message):G.success("Menu nawigacji zapisane")};return s?n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-sm",children:[n.jsx(fe,{size:16,className:"animate-spin"}),"Åadowanie menu..."]}):n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Menu nawigacji"}),n.jsxs("p",{className:"text-xs text-news-muted mt-1",children:["Ustal widocznoÅÄ i kolejnoÅÄ pozycji w górnym menu. ",n.jsx("strong",{className:"text-foreground",children:"Etykieta"})," to tekst w menu; ",n.jsx("strong",{className:"text-foreground",children:"Kategoria docelowa"}
113)," okreÅla, które artykuÅy siÄ pokażÄ
. Link budowany jest automatycznie jako ",n.jsx("code",{className:"text-[10px]",children:"/slug-kategorii"})," â np. kategoria âAktualnoÅciâ â ",n.jsx("code",{className:"text-[10px]",children:"/aktualnosci"}),". Kategoria musi istnieÄ w WordPressie i mieÄ przypisane artykuÅy."]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:m,className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors",children:"ZaÅaduj domyÅlne menu"}),n.jsxs("button",{type:"button",onClick:u,className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors flex items-center gap-1",children:[n.jsx(Ft,{size:14}),"Dodaj pozycjÄ"]})]}),o.length===0?n.jsx("p",{className:"text-sm text-news-muted py-4 text-center border border-dashed border-border rounded-lg",children:"Brak skonfigurowanych pozycji â wyÅwietlane sÄ
domyÅlne 6 kategorii menu."}):n.jsx("div",{className:"space-y-2",children:o.map((x,g)=>n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 p-3 bg-news-surface-3 border border-border rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[n.jsx("button",{type:"button",onClick:()=>d(x.id,{visible:!x.visible}),title:x.visible?"Ukryj w menu":"Pokaż w menu",className:`p-2 rounded-lg border transition-colors ${x.visible?"border-green-500/30 text-green-500 bg-green-500/10":"border-border text-news-dim"}`,children:x.visible?n.jsx(At,{size:16}):n.jsx(bn,{size:16})}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("button",{type:"button",onClick:()=>h(g,-1),disabled:g===0,className:"p-1 rounded text-news-dim hover:text-foreground disabled:opacity-30",children:n.jsx(vl,{size:14})}),n.jsx("button",{type:"button",onClick:()=>h(g,1),disabled:g===o.length-1,className:"p-1 rounded text-news-dim hover:text-foreground disabled:opacity-30",children:n.jsx(jl,{size:14})})]})]}),n.jsxs("div",{className:"flex-1 grid grid-cols-1 sm:grid-cols-2 gap-3 min-w-0",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-[11px] text-news-dim mb-1 block",children:"Etykieta w menu"}),n.jsx("input",{value:x.label,onChange:y=>d(x.id,{label:y.target.value}),placeholder:"np. Porty",className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-[11px] text-news-dim mb-1 block",children:"Kategoria docelowa"}),n.jsx("select",{value:x.category,onChange:y=>d(x.id,{category:y.target.value}),className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:c.map(y=>n.jsx("option",{value:y,children:y},y))})]})]}),n.jsx("button",{type:"button",onClick:()=>p(x.id),className:"p-2 rounded-lg text-news-dim hover:text-destructive hover:bg-destructive/10 transition-colors self-end sm:self-center",title:"UsuÅ pozycjÄ",children:n.jsx(qe,{size:16})})]},x.id))}),n.jsxs("button",{type:"button",onClick:b,disabled:i,className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50 flex items-center gap-2",children:[i&&n.jsx(fe,{size:14,className:"animate-spin"}),"Zapisz menu"]})]})}function BC(){const{newsTicker:e,loading:t,saveNewsTicker:s}=us(),[r,o]=f.useState(e.enabled),[a,i]=f.useState(e.items),[l,c]=f.useState(!1);f.useEffect(()=>{o(e.enabled),i(e.items)},[e.enabled,e.items]);const d=(b,x)=>{i(g=>g.map(y=>y.id===b?{...y,...x}:y))},h=(b,x)=>{const g=b+x;g<0||g>=a.length||i(y=>{const N=[...y];return[N[b],N[g]]=[N[g],N[b]],N})},u=()=>{i(b=>[...b,{id:crypto.randomUUID(),text:"",url:null,active:!0}])},p=b=>{i(x=>x.filter(g=>g.id!==b))},m=async()=>{const b={enabled:r,items:a.map(g=>{var y;return{...g,text:g.text.trim(),url:((y=g.url)==null?void 0:y.trim())||null}})};c(!0);const x=await s(b);c(!1),x?G.error(x.message):G.success("Pasek wiadomoÅci zapisany")};return t?n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-sm",children:[n.jsx(fe,{size:16,className:"animate-spin"}),"Åadowanie paska wiadomoÅci..."]}):n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{children:[n.jsxs("h3",{className:"font-bold text-foreground flex items-center gap-2",children:[n.jsx(Wg,{size:16,className:"text-news-red"}),"Pasek wiadomoÅci"]}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"Czerwony pasek przewijany u góry strony na widoku desktopowym. Każda pozycja może mieÄ opcjonalny link."})]}),n.jsx("button",{type:"button",onClick:()=>o(b=>!b),className:`w-10 h-5 rounded-full relative transition-colors flex-shrink-0 mt-1 ${r?"bg-news-red":"bg-news-surface-3"}`,title:r?"WyÅÄ
cz pasek":"WÅÄ
cz pasek",children:n.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full transition-transform shadow ${r?"translate-x-5":"translate-x-0.5"}`})})]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:n.jsxs("button",{type:"button",onClick:u,className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors flex items-center gap-1",children:[n.jsx(Ft,{size:14}),"Dodaj wiadomoÅÄ"]})}),a.length===0?n.jsx("p",{className:"text-sm text-news-muted py-4 text-center border border-dashed border-border rounded-lg",children:"Brak wiadomoÅci â pasek nie bÄdzie widoczny."}):n.jsx("div",{className:"space-y-2",children:a.map((b,x)=>n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start gap-3 p-3 bg-news-surface-3 border border-border rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[n.jsx("button",{type:"button",onClick:()=>d(b.id,{active:!b.active}),title:b.active?"Ukryj wiadomoÅÄ":"Pokaż wiadomoÅÄ",className:`p-2 rounded-lg border transition-colors ${b.active?"border-green-500/30 text-green-500 bg-green-500/10":"border-border text-news-dim"}`,children:b.active?n.jsx(At,{size:16}):n.jsx(bn,{size:16})}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("button",{type:"button",onClick:()=>h(x,-1),disabled:x===0,className:"p-1 rounded text-news-dim hover:text-foreground disabled:opacity-30",children:n.jsx(vl,{size:14})}),n.jsx("button",{type:"button",onClick:()=>h(x,1),disabled:x===a.length-1,className:"p-1 rounded text-news-dim hover:text-foreground disabled:opacity-30",children:n.jsx(jl,{size:14})})]})]}),n.jsxs("div",{className:"flex-1 grid grid-cols-1 sm:grid-cols-2 gap-3 min-w-0",children:[n.jsxs("div",{className:"sm:col-span-2",children:[n.jsx("label",{className:"text-[11px] text-news-dim mb-1 block",children:"TreÅÄ wiadomoÅci"}),n.jsx("input",{value:b.text,onChange:g=>d(b.id,{text:g.target.value}),placeholder:"np. Nowy terminal w Porcie GdaÅsk",className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{className:"sm:col-span-2",children:[n.jsx("label",{className:"text-[11px] text-news-dim mb-1 block",children:"Link (opcjonalnie)"}),n.jsx("input",{value:b.url??"",onChange:g=>d(b.id,{url:g.target.value}),placeholder:"https://... lub /2026/07/01/slug/",className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]})]}),n.jsx("button",{type:"button",onClick:()=>p(b.id),className:"p-2 rounded-lg text-news-dim hover:text-destructive hover:bg-destructive/10 transition-colors self-end sm:self-ce
113nter",title:"UsuÅ wiadomoÅÄ",children:n.jsx(qe,{size:16})})]},b.id))}),n.jsxs("button",{type:"button",onClick:m,disabled:l,className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50 flex items-center gap-2",children:[l&&n.jsx(fe,{size:14,className:"animate-spin"}),"Zapisz pasek wiadomoÅci"]})]})}const _i=()=>({title:"",slug:"",content:"",status:"draft",show_in_footer:!1,footer_order:0});function FC(){const[e,t]=f.useState([]),[s,r]=f.useState(!0),[o,a]=f.useState(!1),[i,l]=f.useState(null),[c,d]=f.useState(_i()),[h,u]=f.useState(!1),[p,m]=f.useState(null),b=ux(),x=ja(),g=async()=>{r(!0);try{const S=await $.getPages({all:!0});t(S)}catch(S){G.error(S instanceof Error?S.message:"BÅÄ
d Åadowania stron")}finally{r(!1)}};f.useEffect(()=>{g()},[]);const y=()=>{l("new"),d(_i()),u(!1)},N=S=>{l(S.id),d({...S}),u(!0)},w=()=>{l(null),d(_i())},k=S=>{d(z=>({...z,title:S,slug:h?z.slug:Vb(S)}))},E=async()=>{var M,D,A;const S=(M=c.title)==null?void 0:M.trim(),z=(D=c.slug)==null?void 0:D.trim().toLowerCase(),B=(A=c.content)==null?void 0:A.trim();if(!S){G.error("TytuÅ jest wymagany");return}if(!z||!Kb(z)){G.error("NieprawidÅowy slug (użyj maÅych liter, cyfr i myÅlników; unikaj slugów kategorii)");return}if(!B||B==="<p></p>"){G.error("TreÅÄ strony jest wymagana");return}a(!0);try{const U={title:S,slug:z,content:B,status:c.status,show_in_footer:!!c.show_in_footer,footer_order:Number(c.footer_order)||0};i==="new"?(await $.createPage(U),G.success("Strona utworzona")):i&&(await $.updatePage(i,U),G.success("Strona zapisana")),await b(),await x.invalidateQueries({queryKey:["page"]}),w(),await g()}catch(U){G.error(U instanceof Error?U.message:"BÅÄ
d zapisu")}finally{a(!1)}},v=async S=>{a(!0);try{await $.deletePage(S.id),G.success("Strona usuniÄta"),await b(),await x.invalidateQueries({queryKey:["page"]}),m(null),i===S.id&&w(),await g()}catch(z){G.error(z instanceof Error?z.message:"BÅÄ
d usuwania")}finally{a(!1)}};return s&&e.length===0?n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-sm",children:[n.jsx(fe,{size:16,className:"animate-spin"}),"Åadowanie stron..."]}):n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Strony tekstowe"}),n.jsxs("p",{className:"text-xs text-news-muted mt-1",children:["Regulamin, polityka prywatnoÅci i inne statyczne podstrony. Adres URL:"," ",n.jsxs("code",{className:"text-news-dim",children:["/","{slug}"]})," (np. /regulamin)."]})]}),!i&&n.jsxs("button",{type:"button",onClick:y,className:"flex items-center gap-1.5 text-sm px-3 py-2 bg-news-red text-white rounded-lg font-semibold hover:bg-news-red-bright transition-colors shrink-0",children:[n.jsx(Ft,{size:16}),"Nowa strona"]})]}),i&&n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-news-surface-3 space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h4",{className:"font-semibold text-foreground",children:i==="new"?"Nowa strona":"Edycja strony"}),n.jsx("button",{type:"button",onClick:w,className:"p-1.5 text-news-muted hover:text-foreground",children:n.jsx(He,{size:18})})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"TytuÅ"}),n.jsx("input",{value:c.title??"",onChange:S=>k(S.target.value),className:"w-full bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Slug (URL)"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm text-news-dim",children:"/"}),n.jsx("input",{value:c.slug??"",onChange:S=>{u(!0),d(z=>({...z,slug:S.target.value.toLowerCase()}))},className:"flex-1 bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red font-mono"})]})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Status"}),n.jsxs("select",{value:c.status??"draft",onChange:S=>d(z=>({...z,status:S.target.value})),className:"bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",children:[n.jsx("option",{value:"draft",children:"Szkic"}),n.jsx("option",{value:"published",children:"Opublikowana"})]})]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground cursor-pointer mt-5",children:[n.jsx("input",{type:"checkbox",checked:!!c.show_in_footer,onChange:S=>d(z=>
113({...z,show_in_footer:S.target.checked})),className:"rounded border-border"}),"Pokaż link w stopce"]}),c.show_in_footer&&n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"KolejnoÅÄ w stopce"}),n.jsx("input",{type:"number",min:0,value:c.footer_order??0,onChange:S=>d(z=>({...z,footer_order:Number(S.target.value)})),className:"w-20 bg-news-surface-2 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"TreÅÄ"}),n.jsx(Sh,{content:c.content??"",onChange:S=>d(z=>({...z,content:S}))})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsxs("button",{type:"button",onClick:E,disabled:o,className:"flex items-center gap-2 bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50",children:[o?n.jsx(fe,{size:14,className:"animate-spin"}):n.jsx(Ug,{size:14}),"Zapisz stronÄ"]}),c.slug&&c.status==="published"&&n.jsxs("a",{href:vo(c.slug),target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-4 py-2 border border-border rounded-lg text-sm text-news-muted hover:text-foreground transition-colors",children:[n.jsx(Ii,{size:14}),"PodglÄ
d"]})]})]}),e.length===0&&!i?n.jsx("p",{className:"text-sm text-news-muted py-6 text-center border border-dashed border-border rounded-lg",children:"Brak stron tekstowych. Dodaj regulamin, politykÄ prywatnoÅci lub inne podstrony."}):n.jsx("div",{className:"space-y-2",children:e.map(S=>n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 p-3 bg-news-surface-3 border border-border rounded-lg",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("span",{className:"font-medium text-foreground",children:S.title}),n.jsx("span",{className:`text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${S.status==="published"?"bg-green-500/10 text-green-500":"bg-news-surface-2 text-news-dim"}`,children:S.status==="published"?"Opublikowana":"Szkic"}),S.show_in_footer&&n.jsxs("span",{className:"text-[10px] text-news-dim flex items-center gap-0.5",children:[n.jsx(At,{size:10})," stopka"]})]}),n.jsx("p",{className:"text-xs text-news-muted font-mono mt-0.5",children:vo(S.slug)})]}),n.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[S.status==="published"&&n.jsx("a",{href:vo(S.slug),target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-lg text-news-dim hover:text-foreground hover:bg-news-surface-2 transition-colors",title:"PodglÄ
d",children:n.jsx(Ii,{size:16})}),n.jsx("button",{type:"button",onClick:()=>N(S),className:"p-2 rounded-lg text-news-dim hover:text-foreground hover:bg-news-surface-2 transition-colors",title:"Edytuj",children:n.jsx(ya,{size:16})}),n.jsx("button",{type:"button",onClick:()=>m(S),className:"p-2 rounded-lg text-news-dim hover:text-destructive hover:bg-destructive/10 transition-colors",title:"UsuÅ",children:n.jsx(qe,{size:16})})]})]},S.id))}),p&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",children:n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 max-w-md w-full space-y-4",children:[n.jsxs("p",{className:"text-sm text-foreground",children:["UsunÄ
Ä stronÄ ",n.jsxs("strong",{children:["â",p.title,'"']}),"?"]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{type:"button",onClick:()=>m(null),className:"px-4 py-2 text-sm border border-border rounded-lg text-news-muted hover:text-foreground",children:"Anuluj"}),n.jsx("button",{type:"button",onClick:()=>v(p),disabled:o,className:"px-4 py-2 text-sm bg-destructive text-white rounded-lg font-semibold disabled:opacity-50",children:"UsuÅ"})]})]})})]})}const WC=[{value:"summary_large_image",label:"Duży obraz (summary_large_image)"},{value:"summary",label:"Podsumowanie (summary)"},{value:"player",label:"Odtwarzacz (player)"},{value:"app",label:"Aplikacja (app)"}];function UC(){const{seo:e,loading:t,saveSeo:s}=us(),[r,o]=f.useState(e),[a,i]=f.useState(!1),[l,c]=f.useState(null),[d,h]=f.useState(null),[u,p]=f.useState(!1),m=f.useRef(null);f.useEffect(()=>{o(e)},[e]);const b=()=>{o(v=>({...v,og_title:v.title,og_description:v.description,og_site_name:v.author}))},x=()=>{o(v=>({...v,twitter_title:v.title,twitter_description:v.description}))},g=v=>{var z;const S=(z=v.target.files)==null?void 0:z[0];S&&(h(S),c(URL.createObjectURL(S)))},y=()=>{c(null),h(null),o(v=>({...v,og_image:null})),m.current&&(m.current.value="")},N=async()=>
113{if(d){p(!0);try{const v=await $.uploadMedia(d),S={...r,og_image:v.url},z=await s(S);if(p(!1),z)return G.error(z.message);o(S),h(null),c(null),G.success("Obraz OG zapisany")}catch(v){p(!1),G.error(v instanceof Error?v.message:"BÅÄ
d uploadu")}}},w=async()=>{i(!0);const v=await s(r);i(!1),v?G.error(v.message):G.success("Ustawienia SEO zapisane")};if(t)return n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-sm",children:[n.jsx(fe,{size:16,className:"animate-spin"}),"Åadowanie ustawieÅ SEO..."]});const k="w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red",E=l??r.og_image;return n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-6",children:[n.jsxs("div",{children:[n.jsxs("h3",{className:"font-bold text-foreground flex items-center gap-2",children:[n.jsx(Ms,{size:16,className:"text-news-red"}),"SEO i udostÄpnianie"]}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"Meta tagi portalu, domyÅlny obraz udostÄpniania oraz ustawienia Open Graph / Twitter. ArtykuÅy używajÄ
wÅasnego tytuÅu, opisu i miniatury â obraz OG jest fallbackiem."})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Podstawowe"}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"TytuÅ strony (<title>)"}),n.jsx("input",{value:r.title,onChange:v=>o({...r,title:v.target.value}),className:k})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Opis (meta description)"}),n.jsx("textarea",{value:r.description,onChange:v=>o({...r,description:v.target.value}),rows:3,className:`${k} resize-y min-h-[72px]`}),n.jsxs("p",{className:"text-[11px] text-news-dim mt-1",children:[r.description.length," znaków · zalecane 150â160"]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Autor (meta author)"}),n.jsx("input",{value:r.author,onChange:v=>o({...r,author:v.target.value}),className:k})]})]}),n.jsxs("div",{className:"space-y-4 pt-2 border-t border-border",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"DomyÅlny obraz udostÄpniania"}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"Używany na stronie gÅównej, kategoriach i gdy artykuÅ nie ma miniatury. Zalecany format 1200Ã630 px."})]}),E?n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"w-48 aspect-[1200/630] bg-news-surface-3 border border-border rounded-lg overflow-hidden flex-shrink-0",children:n.jsx(Bt,{src:E,cacheKey:r.og_image??l,alt:"PodglÄ
d OG",className:"w-full h-full object-cover"})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm text-foreground font-medium break-all",children:(d==null?void 0:d.name)??"Aktualny obraz OG"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{type:"button",onClick:()=>{var v;return(v=m.current)==null?void 0:v.click()},className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors",children:"ZmieÅ"}),n.jsxs("button",{type:"button",onClick:y,className:"text-xs px-3 py-1.5 border border-destructive/30 text-destructive rounded-lg hover:bg-destructive/10 transition-colors flex items-center gap-1",children:[n.jsx(qe,{size:12}),"UsuÅ"]})]})]})]}):n.jsxs("button",{type:"button",onClick:()=>{var v;return(v=m.current)==null?void 0:v.click()},className:"w-full border-2 border-dashed border-border rounded-lg p-6 text-center hover:border-news-red transition-colors group",children:[n.jsx(Pn,{size:24,className:"text-news-dim mx-auto mb-2 group-hover:text-news-red transition-colors"}),n.jsx("p",{className:"text-sm text-news-muted group-hover:text-foreground",children:"Kliknij, aby dodaÄ obraz OG"})]}),n.jsx("input",{ref:m,type:"file",accept:"image/*",className:"hidden",onChange:g}),d&&n.jsxs("button",{type:"button",onClick:N,disabled:u,className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50 flex items-center gap-2",children:[u&&n.jsx(fe,{size:14,className:"animate-spin"}),"Zapisz obraz OG"]})]}),n.jsxs("div",{className:"space-y-4 pt-2 border-t border-border",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Open Graph"}),n.jsx("button",{type:"button",onClick:b,className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors",children:"WypeÅnij z podstawowych"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Typ (og:type)"}
113),n.jsx("input",{value:r.og_type,onChange:v=>o({...r,og_type:v.target.value}),className:k})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"TytuÅ (og:title)"}),n.jsx("input",{value:r.og_title,onChange:v=>o({...r,og_title:v.target.value}),className:k})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Opis (og:description)"}),n.jsx("textarea",{value:r.og_description,onChange:v=>o({...r,og_description:v.target.value}),rows:3,className:`${k} resize-y min-h-[72px]`})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Nazwa witryny (og:site_name)"}),n.jsx("input",{value:r.og_site_name,onChange:v=>o({...r,og_site_name:v.target.value}),className:k})]})]}),n.jsxs("div",{className:"space-y-4 pt-2 border-t border-border",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Twitter / X"}),n.jsx("button",{type:"button",onClick:x,className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors",children:"WypeÅnij z podstawowych"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Typ karty (twitter:card)"}),n.jsx("select",{value:r.twitter_card,onChange:v=>o({...r,twitter_card:v.target.value}),className:k,children:WC.map(v=>n.jsx("option",{value:v.value,children:v.label},v.value))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"TytuÅ (twitter:title)"}),n.jsx("input",{value:r.twitter_title,onChange:v=>o({...r,twitter_title:v.target.value}),className:k})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Opis (twitter:description)"}),n.jsx("textarea",{value:r.twitter_description,onChange:v=>o({...r,twitter_description:v.target.value}),rows:3,className:`${k} resize-y min-h-[72px]`})]})]}),n.jsxs("button",{type:"button",onClick:w,disabled:a,className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50 flex items-center gap-2",children:[a&&n.jsx(fe,{size:14,className:"animate-spin"}),"Zapisz ustawienia SEO"]})]})}function wo({label:e,value:t,icon:s,trend:r}){const o=r!=null,a=o&&r>=0;return n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("div",{className:"w-10 h-10 bg-news-surface-3 rounded-lg flex items-center justify-center",children:n.jsx(s,{size:18,className:"text-news-red"})}),o&&n.jsxs("span",{className:`text-xs font-semibold ${a?"text-green-500":"text-red-500"}`,children:[a?"â":"â"," ",Math.abs(r),"%"]})]}),n.jsx("div",{className:"text-2xl font-bold text-foreground mb-1",children:t}),n.jsx("div",{className:"text-xs text-news-muted",children:e})]})}function zu({title:e,description:t,currentUrl:s,fallbackUrl:r,preview:o,file:a,uploading:i,inputRef:l,onFileChange:c,onDrop:d,onRemove:h,onUpload:u}){const p=o??s,m=p??r??null,b=!p&&!!r,x=!!o&&o.startsWith("blob:");return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold text-foreground",children:e}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:t})]}),n.jsx("div",{onDragOver:g=>g.preventDefault(),onDrop:d,onClick:()=>{var g;return!i&&((g=l.current)==null?void 0:g.click())},className:`border-2 border-dashed rounded-lg transition-colors group ${m?"border-border bg-news-surface-3/40 p-4":"border-border p-8 text-center hover:border-news-red cursor-pointer"} ${i?"opacity-60 cursor-wait":m?"cursor-pointer hover:border-news-red":""}`,children:m?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"relative rounded-lg border border-border overflow-hidden bg-news-surface-2 group-hover:bg-neutral-900 min-h-[5rem] flex items-center justify-center transition-colors duration-200",children:[x?n.jsx("img",{src:o,alt:`${e} podglÄ
d`,className:"max-w-full max-h-24 object-contain p-3"}):n.jsx(Bt,{src:m,alt:`${e} podglÄ
d`,className:"max-w-full max-h-24 object-contain p-3"}),i&&n.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:n.jsx(fe,{size:24,className:"animate-spin text-white"})})]}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-sm text-foreground font-medium truncate",children:(a==null?void 0:a.name)??(p?"Aktualne logo":"Logo z wersji desktop")}),n.jsx("p",{className:"text-xs text-news-muted",children:a?`${(a.size/1024).toFixed(1)} KB · nowy plik do zapisania`:b?"Brak osobnego logo mobile â na stronie używane jest logo desktop":"zapisane w bazie · kliknij obszar lub przeciÄ
gnij plik, aby zmieniÄ"})]}),p&&n.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[n.jsx("button",{type:"button",onClick:g=>{var y;g.stopPropagation(),(y=l.current)==null||y.click()},className:"text-xs px-3 py-1.5 bg-news-surface-3 border border-border rounded-lg text-news-muted hover:text-foreground transition-colors",children:"ZmieÅ"}),n.jsx("button",{type:"button",onClick:g=>{g.stopPropagation(),h()},className:"text-xs px-3 py-1.5 border border-destructive/30 text-destructive rounded-lg hover:bg-destructive/10 transition-colors",children:"UsuÅ"})]})]})]}):n.jsxs(n.Fragment,{children:[i?n.jsx(fe,{size:28,className:"animate-spin text-news-red mx-auto mb-2"}):n.jsx(Pn,{size:28,className:"text-news-dim mx-auto mb-2 group-hover:text-news-red transition-colors"}),n.jsx("p",{className:"text-sm font-medium text-news-muted group-hover:text-foreground transition-colors text-center",children:i?"Wgrywanie...":"Kliknij lub przeciÄ
gnij plik"}),n.jsx("p",{className:"text-xs text-news-dim mt-1 text-center",children:"PNG, SVG, JPG · max 2 MB"})]})}),n.jsx("input",{ref:l,type:"file",accept:"image/*",className:"hidden",onChange:c}),n.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[n.jsxs("button",{type:"button",onClick:u,disabled:!a||i,className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2",children:[i&&n.jsx(fe,{size:14,className:"animate-spin"})," Zapisz logo"]}),n.jsx("p",{className:"text-xs text-news-muted",children:a?"Nowy plik gotowy do zapisania":"Zmiany bÄdÄ
widoczne po zapisaniu"})]})]})}function HC(){const{isAdmin:e}=yn(),t=f.useRef(null),s=f.useRef(null),{general:r,monetization:o,sectionVisibility:a,loading:i,saveGeneral:l,saveMonetization:c,saveSectionVisibility:d}=us(),[h,u]=f.useState(null),[p,m]=f.useState(null),[b,x]=f.useState(!1),[g,y]=f.useState(null),[N,w]=f.useState(null),[k,E]=f.useState(!1),[v,S]=f.useState(!1),[z,B]=f.useState(r),[M,D]=f.useState(o),[A,U]=f.useState(a),[se,P]=f.useState(""),[ne,C]=f.useState(""),[I,F]=f.useState(""),[ae,Z]=f.useState(!1);f.useEffect(()=>{B(r)},[r]),f.useEffect(()=>{D(o)},[o]),f.useEffect(()=>{U(a)},[a]);const Q=H=>{var ke;const ce=(ke=H.target.files)==null?void 0:ke[0];ce&&(m(ce),u(URL.createObjectURL(ce)))},re=H=>{var ke;const ce=(ke=H.target.files)==null?void 0:ke[0];ce&&(w(ce),y(URL.createObjectURL(ce)))},oe=H=>{var ke;H.preventDefault();const ce=(ke=H.dataTransfer.files)==null?void 0:ke[0];!ce||!ce.type.startsWith("image/")||(m(ce),u(URL.createObjectURL(ce)))},Y=H=>{var ke;H.preventDefault();const ce=(ke=H.dataTransfer.files)==null?void 0:ke[0];!ce||!ce.type.startsWith("image/")||(w(ce),y(URL.createObjectURL(ce)))},O=async()=>
113{if(u(null),m(null),t.current&&(t.current.value=""),!z.logo_url)return;const H={...z,logo_url:null},ce=await l(H);if(ce)return G.error(ce.message);B(H),G.success("Logo desktop usuniÄte")},_=async()=>{if(y(null),w(null),s.current&&(s.current.value=""),!z.mobile_logo_url)return;const H={...z,mobile_logo_url:null},ce=await l(H);if(ce)return G.error(ce.message);B(H),G.success("Logo mobile usuniÄte")},W=async()=>{if(p){x(!0);try{const H=await $.uploadMedia(p),ce={...z,logo_url:H.url},ke=await l(ce);if(x(!1),ke)return G.error(ke.message);B(ce),m(null),u(null),G.success("Logo desktop zapisane")}catch(H){x(!1),G.error(H instanceof Error?H.message:"BÅÄ
d uploadu")}}},de=async()=>{if(N){E(!0);try{const H=await $.uploadMedia(N),ce={...z,mobile_logo_url:H.url},ke=await l(ce);if(E(!1),ke)return G.error(ke.message);B(ce),w(null),y(null),G.success("Logo mobile zapisane")}catch(H){E(!1),G.error(H instanceof Error?H.message:"BÅÄ
d uploadu")}}},he=async()=>{S(!0);const H=await l(z);S(!1),H?G.error(H.message):G.success("Ustawienia zapisane")},ve=async H=>{const ce={...M,[H]:!M[H]};D(ce);const ke=await c(ce);ke&&G.error(ke.message)},R=async H=>{const ce={...A,[H]:!A[H]};U(ce);const ke=await d(ce);ke&&G.error(ke.message)},ie=async()=>{if(ne.length<8){G.error("Nowe hasÅo musi mieÄ co najmniej 8 znaków");return}if(ne!==I){G.error("HasÅa nie sÄ
identyczne");return}Z(!0);try{await $.changePassword(se,ne),P(""),C(""),F(""),G.success("HasÅo zmienione. Inne sesje zostaÅy wylogowane.")}catch(H){G.error(H instanceof Error?H.message:"Nie udaÅo siÄ zmieniÄ hasÅa")}finally{Z(!1)}},ge={display_ads:"Reklamy display",native_ads:"Reklamy natywne",sponsored_articles:"ArtykuÅy sponsorowane",premium_subscription:"Subskrypcja Premium"};return i?n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-sm",children:[n.jsx(fe,{size:16,className:"animate-spin"})," Åadowanie ustawieÅ..."]}):n.jsxs("div",{className:"max-w-3xl space-y-6",children:[e&&n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Logo portalu"}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"Osobne logo dla wersji desktop (motyw jasny) i mobile / desktop w motywie ciemnym. Zalecany format: PNG lub SVG z przezroczystym tÅem."})]}),n.jsx(zu,{title:"Logo desktop",description:"WyÅwietlane w nagÅówku na dużych ekranach w motywie jasnym.",currentUrl:z.logo_url??r.logo_url,preview:h,file:p,uploading:b,inputRef:t,onFileChange:Q,onDrop:oe,onRemove:O,onUpload:W}),n.jsx("div",{className:"border-t border-border pt-6",children:n.jsx(zu,{title:"Logo mobile",description:"WyÅwietlane na mobile oraz na desktopie w motywie ciemnym. Gdy puste, używane jest logo desktop.",currentUrl:z.mobile_logo_url??r.mobile_logo_url,fallbackUrl:z.logo_url??r.logo_url,preview:g,file:N,uploading:k,inputRef:s,onFileChange:re,onDrop:Y,onRemove:_,onUpload:de})})]}),e&&n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Ustawienia portalu"}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Nazwa portalu"}),n.jsx("input",{value:z.name,onChange:H=>B({...z,name:H.target.value}),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Tagline"}),n.jsx("input",{value:z.tagline,onChange:H=>B({...z,tagline:H.target.value}),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Email redakcji"}),n.jsx("input",{value:z.email,onChange:H=>B({...z,email:H.target.value}),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("button",{onClick:he,disabled:v,className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50 flex items-center gap-2",children:[v&&n.jsx(fe,{size:14,className:"animate-spin"})," Zapisz zmiany"]})]}),e&&n.jsx($C,{}),n.jsx(BC,{}),e&&n.jsx(FC,{}),e&&n.jsx(UC,{}),e&&n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-foreground",children:"WidocznoÅÄ sekcji"}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"WÅÄ
cz lub wyÅÄ
cz wybrane elementy portalu. Zmiany sÄ
widoczne natychmiast po przeÅÄ
czeniu."})]}),Object.keys(Yc).map(H=>n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx("span",{className:"text-sm text-foreground",children:Yc[H]}),n.jsx("button",{onClick:()=>R(H),"aria-pressed":A[H],className:`w-10 h-5 rounded-full relative transition-colors flex-shrink-0 ${A[H]?"bg-news-red":"bg-news-surface-3"}`,children:n.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full transition-transform shadow ${A[H]?"translate-x-5":"translate-x-0.5"}`})})]},H))]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsx("h3",{className:"font-bold text-foreground",children:"BezpieczeÅstwo konta"}),n.jsx("p",{className:"text-xs text-news-muted",children:"Po zmianie hasÅa wszystkie inne aktywne sesje zostanÄ
unieważnione."}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Obecne hasÅo"}),n.jsx("input",{type:"password",value:se,onChange:H=>P(H.target.value),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Nowe hasÅo"}),n.jsx("input",{type:"password",value:ne,onChange:H=>C(H.target.value),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1 block",children:"Powtórz nowe hasÅo"}),n.jsx("input",{type:"password",value:I,onChange:H=>F(H.target.value),className:"w-full bg-news-surface-3 border border-border rounded px-3 py-2 text-sm text-foreground focus:outline-none focus:border-news-red"})]}),n.jsxs("button",{onClick:ie,disabled:ae||!se||!ne,className:"bg-news-red text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-news-red-bright transition-colors disabled:opacity-50 flex items-center gap-2",children:[ae&&n.jsx(fe,{size:14,className:"animate-spin"})," ZmieÅ hasÅo"]})]}),e&&n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5 space-y-4",children:[n.jsx("h3",{className:"font-bold text-foreground",children:"Monetyzacja"}),Object.keys(ge).map(H=>n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-foreground",children:ge[H]}),n.jsx("button",{onClick:()=>ve(H),className:`w-10 h-5 rounded-full relative transition-colors ${M[H]?"bg-news-red":"bg-news-surface-3"}`,children:n.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full transition-transform shadow ${M[H]?"translate-x-5":"translate-x-0.5"}`})})]},H))]})]})}function GC(){var P,ne;const{user:e,signOut:t,isAdmin:s,isEditor:r}=yn(),o=e==null?void 0:e.role,a=Ls(),i=Dr(),{view:l,articleId:c}=Di(i.pathname),[d,h]=f.useState(null),[u,p]=f.useState(!1),[m,b]=f.useState(!1),{articles:x,loading:g}=Ta({limit:5,status:"published"}),[y,N]=f.useState(null),[w,k]=f.useState(!1);f.useEffect(()=>{if(l!=="dashboard")return;let C=!1;return k(!0),$.getDashboardStats().then(I=>{C||N(I)}).catch(()=>{C||N(null)}).finally(()=>{C||k(!1)}),()=>{C=!0}},[l]),f.useEffect(()=>{if(l!=="edit-article"||!c){h(null);return}let C=!1;return p(!0),$.getArticle(c).then(I=>{C||h(I)}).catch(()=>{C||a(ss("articles"),{replace:!0})}).finally(()=>{C||p(!1)}),()=>{C=!0}},[l,c,a]);const E=l==="new-article"||l==="edit-article",v=()=>!E||!m?!0:O1(),S=(C,I)=>{E&&!(C===l&&(C!=="edit-article"||I===c))&&!v()||a(ss(C,I))},z=C=>{E&&C.replace(/\/$/,"")!==i.pathname.replace(/\/$/,"")&&!v()||a(C)};f.useEffect(()=>{const C=sx(i.pathname);if(!C)return;const I=Di(i.pathname),F=ss(I.view,I.articleId).replace(/\/$/,""),ae=i.pathname.replace(/\/$/,"");I.view==="dashboard"&&C!==""?a(ss("dashboard"),{replace:!0}):I.view!=="edit-article"&&ae!==F&&a(F,{replace:!0})},[i.pathname,a]),f.useEffect(()=>{!o||o==="user"||Pd(o,l)||a(lf(o),{replace:!0})},[o,l,a]);const B=[{label:"GÅówne",items:[{id:"dashboard",label:"Dashboard",icon:Hg},{id:"articles",label:"ArtykuÅy",icon:Xt},{id:"new-article",label:"Nowy artykuÅ",icon:rf},{id:"categories",label:"Kategorie",icon:wa},{id:"comments",label:"Komentarze",icon:Pr}]},{label:"Multimedia",items:[{id:"media",label:"Biblioteka mediów",icon:Pn},{id:"galleries",label:"Galerie",icon:ws},{id:"shorts",label:"YouTube Shorts",icon:Nr}]},{label:"ZarzÄ
dzanie",items:[{id:"users",label:"Użytkownicy & Role",icon:kr},...s?[{id:"ads",label:"Reklamy",icon:fn}]:[],{id:"topics",label:"Trending topics",icon:jr},...s?[{id:"backups",label:"Kopie zapasowe",icon:Oi}]:[],{id:"settings",label:"Ustawienia",icon:Gg}]}].map(C=>({...C,items:C.items.filter(I=>Pd(o,I.id))})).filter(C=>C.items.length>0),M=l==="edit-article"?"Edycja artykuÅu":((P=B.flatMap(C=>C.items).find(C=>C.id===l))==null?void 0:P.label)??"",D=Bl(),A=C=>{S("edit-article",C.id)},U=async()=>{await D(),b(!1),a(ss("articles"))},se=async C=>{b(!1),await D(),a(ss("edit-article",C.id),{replace:!0})};return n.jsxs("div",{className:"min-h-screen bg-background flex",children:[n.jsxs("aside",{className:"w-60 bg-news-surface border-r border-border flex flex-col flex-shrink-0",children:[n.jsxs("div",{className:"p-5 border-b border-border",children:[n.jsx(js,{className:"h-7 w-auto",height:28}),n.jsx("div",{className:"text-xs text-news-red font-bold mt-2",children:"Panel Admina"})]}),n.jsx("nav",{className:"flex-1 p-3 space-y-4 overflow-auto custom-scrollbar",children:B.map(C=>n.jsxs("div",{children:[n.jsx("p",{className:"text-xs font-semibold text-news-dim uppercase tracking-widest px-3 mb-1",children:C.label}),n.jsx("div",{className:"space-y-0.5",children:C.items.map(I=>n.jsxs(Hp,{to:ss(I.id),end:I.id==="dashboard",onClick:F=>{F.preventDefault(),z(ss(I.id))},className:()=>`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all ${tx(i.pathname,I.id)?"bg-news-red text-white":"text-news-muted hover:text-foreground hover:bg-news-surface-2"}`,children:[n.jsx(I.icon,{size:16}),I.label]},I.id))})]},C.label))}),n.jsxs("div",{className:"p-3 border-t border-border space-y-0.5",children:[n.jsxs("a",{href:"/",onClick:C=>{v()||C.preventDefault()},className:"flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm text-news-muted hover:text-foreground hover:bg-news-surface-2 transition-all",children:[n.jsx(Tc,{size:16}),"WrÃ³Ä do portalu"]}),n.jsxs("button",{onClick:t,className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm text-news-muted hover:text-destructive hover:bg-news-surface-2 transition-all",children:[n.jsx(Tc,{size:16}),"Wyloguj siÄ"]})]})]}),n.jsxs("main",{className:"flex-1 overflow-auto custom-scrollbar",children:[n.jsxs("header",{className:"bg-news-surface border-b border-border px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[n.jsx("h1",{className:"text-lg font-bold text-foreground",children:M}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-xs text-news-muted",children:e==null?void 0:e.email}),n.jsx("div",{className:"w-8 h-8 rounded-full bg-news-red flex items-center justify-center text-white text-sm font-bold",children:(((ne=e==null?void 0:e.email)==null?void 0:ne[0])??"A").toUpperCase()})]})]}),n.jsxs("div",{className:"p-6",children:[l==="dashboard"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsx(wo,{label:"Opublikowane artykuÅy",value:w?"â¦":String((y==null?void 0:y.published_count)??0),icon:Xt,trend:y==null?void 0:y.published_trend}),n.jsx(wo,{label:"Szkice",value:w?"â¦":String((y==null?void 0:y.draft_count)??0),icon:Xt}),n.jsx(wo,{label:"OdsÅony dzisiaj",value:w?"â¦":((y==null?void 0:y.views_today)??0).toLocaleStr
113ing("pl-PL"),icon:sf,trend:y==null?void 0:y.views_trend}),n.jsx(wo,{label:y&&y.trending_count>1?`Trendy (${y.trending_count} aktywne)`:"Trendy",value:w?"â¦":(y==null?void 0:y.trending_label)??"â",icon:jr})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5",children:[n.jsxs("h2",{className:"font-serif font-bold text-foreground mb-4 flex items-center justify-between",children:["Ostatnie artykuÅy",n.jsx("button",{onClick:()=>S("articles"),className:"text-xs text-news-red hover:underline",children:"Wszystkie"})]}),n.jsx("div",{className:"space-y-3",children:g?n.jsx("p",{className:"text-xs text-news-muted",children:"Åadowanie..."}):x.length===0?n.jsxs("p",{className:"text-xs text-news-muted",children:["Brak artykuÅów. ",n.jsx("button",{onClick:()=>S("new-article"),className:"text-news-red hover:underline",children:"Utwórz pierwszy"})]}):x.slice(0,5).map(C=>n.jsxs("div",{className:"flex items-center gap-3 group",children:[C.image_url?n.jsx("img",{src:C.image_url,alt:"",className:"w-10 h-10 rounded object-cover flex-shrink-0"}):n.jsx("div",{className:"w-10 h-10 rounded bg-news-surface-3 flex-shrink-0 flex items-center justify-center",children:n.jsx(Xt,{size:14,className:"text-news-dim"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:"text-sm font-medium text-foreground line-clamp-1",children:C.title}),n.jsx("p",{className:"text-xs text-news-muted",children:C.category})]}),n.jsx(Dn,{size:14,className:C.status==="published"?"text-green-500":"text-news-dim"})]},C.id))})]}),n.jsxs("div",{className:"bg-news-surface-2 border border-border rounded-lg p-5",children:[n.jsx("h2",{className:"font-serif font-bold text-foreground mb-4",children:"Statystyki kategorii"}),n.jsx("div",{className:"space-y-3",children:w?n.jsx("p",{className:"text-xs text-news-muted",children:"Åadowanie..."}):((y==null?void 0:y.category_stats)??[]).map(({name:C,count:I})=>{const F=(y==null?void 0:y.published_count)||1,ae=Math.round(I/F*100);return n.jsxs("div",{children:[n.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[n.jsx("span",{className:"text-news-muted",children:C}),n.jsxs("span",{className:"text-foreground font-medium",children:[I," art."]})]}),n.jsx("div",{className:"h-1.5 bg-news-surface-3 rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-news-red rounded-full transition-all",style:{width:`${ae}%`}})})]},C)})})]})]}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[{id:"media",label:"Biblioteka mediów",icon:Pn,desc:"Wgraj i zarzÄ
dzaj plikami"},{id:"galleries",label:"Galerie",icon:ws,desc:"Galerie zdjÄÄ do artykuÅów"},{id:"users",label:"Role użytkowników",icon:kr,desc:"ZarzÄ
dzaj uprawnieniami"},...s?[{id:"ads",label:"Reklamy",icon:fn,desc:"Kampanie i monetyzacja"}]:[]].map(C=>{const I=C.icon;return n.jsxs("button",{onClick:()=>S(C.id),className:"bg-news-surface-2 border border-border rounded-lg p-4 text-left hover:border-news-red transition-all group",children:[n.jsx(I,{size:20,className:"text-news-red mb-2"}),n.jsx("p",{className:"text-sm font-bold text-foreground",children:C.label}),n.jsx("p",{className:"text-xs text-news-muted mt-0.5",children:C.desc})]},C.id)})})]}),l==="articles"&&r&&n.jsx(F1,{onNew:()=>S("new-article"),onEdit:A}),l==="new-article"&&r&&n.jsx(hu,{onSaved:U,onCancel:()=>{v()&&(b(!1),a(ss("articles")))},onDraftCreated:se,onDirtyChange:b}),l==="edit-article"&&r&&(u?n.jsxs("div",{className:"flex items-center gap-2 text-news-muted text-sm",children:[n.jsx(fe,{size:16,className:"animate-spin"})," Åadowanie artykuÅu..."]}):d?n.jsx(hu,{article:d,onSaved:U,onCancel:()=>{v()&&(b(!1),a(ss("articles")))},onDraftCreated:se,onDirtyChange:b}):null),l==="categories"&&r&&n.jsx(IC,{}),l==="comments"&&n.jsx(U1,{}),l==="media"&&r&&n.jsx(Zi,{}),l==="galleries"&&r&&n.jsx(SN,{}),l==="users"&&s&&n.jsx(IN,{}),l==="ads"&&s&&n.jsx(DN,{}),l==="shorts"&&r&&n.jsx(MC,{}),l==="topics"&&r&&n.jsx(LC,{}),l==="backups"&&s&&n.jsx(RC,{}),l==="settings"&&s&&n.jsx(HC,{})]})]})]})}const Ti=()=>n.jsx(GC,{});function Ei({children:e}){const{user:t,isStaff:s,loading:r}=yn(),o=Ls(),a=!1;return f.useEffect(()=>{!r&&!t&&!a&&o(kl)},[r,t,o,a]),r?n.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 border-2 border-news-red border-t-transparent roun
113ded-full animate-spin"}),n.jsx("p",{className:"text-xs text-news-muted",children:"Sprawdzanie uprawnieÅâ¦"})]})}):!t&&!a?null:s?n.jsx(n.Fragment,{children:e}):n.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-6",children:n.jsxs("div",{className:"text-center space-y-4 max-w-sm",children:[n.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 border border-destructive/30 flex items-center justify-center mx-auto",children:n.jsx(kr,{size:28,className:"text-destructive"})}),n.jsx("h2",{className:"font-serif text-2xl font-bold text-foreground",children:"Brak dostÄpu"}),n.jsxs("p",{className:"text-sm text-news-muted",children:["Twoje konto (",t==null?void 0:t.email,") nie ma uprawnieÅ do panelu redakcyjnego. Skontaktuj siÄ z administratorem, jeÅli uważasz, że to bÅÄ
d."]}),n.jsx("a",{href:"/",className:"inline-block mt-2 px-5 py-2 bg-news-surface-2 border border-border rounded-lg text-sm text-news-muted hover:text-foreground transition-colors",children:"â WrÃ³Ä do portalu"})]})})}function YC(){const{articleSlug:e}=pl(),[t,s]=f.useState("loading");return f.useEffect(()=>{if(!e){s("notfound");return}let r=!1;return $.getArticleBySlug(e).then(o=>{r||s(Cr(o))}).catch(()=>{r||s("notfound")}),()=>{r=!0}},[e]),t==="loading"?n.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-background text-news-muted gap-2",children:[n.jsx(fe,{size:20,className:"animate-spin"}),n.jsx("span",{className:"text-sm",children:"Åadowanie artykuÅu..."})]}):t==="notfound"?n.jsx(Js,{}):n.jsx(Lu,{to:t,replace:!0})}function VC(){const e=Ls(),[t]=Gp(),s=fj(t.toString()),r=o=>{e(qi(o))};return n.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[n.jsx("header",{className:"sticky top-0 z-40 bg-news-surface/95 backdrop-blur border-b border-border",children:n.jsxs("div",{className:"max-w-[960px] mx-auto px-4 py-4 flex items-center justify-between gap-4",children:[n.jsx("a",{href:"/",className:"flex-shrink-0",children:n.jsx(js,{className:"h-8 w-auto",height:32})}),n.jsx(zo,{})]})}),n.jsx("main",{className:"flex-1 max-w-[960px] mx-auto w-full px-4 py-8",children:n.jsx(Um,{filters:s,onSearch:r,onArticleSelect:o=>e(pn({slug:o.slug??o.id,publishedAt:o.publishedAt})),autoFocus:!0})}),n.jsx(Rn,{})]})}function KC(){const e=Ls(),{refresh:t}=yn(),[s,r]=f.useState(""),[o,a]=f.useState(""),[i,l]=f.useState(!1),[c,d]=f.useState(!1),[h,u]=f.useState(""),p=async m=>{m.preventDefault(),u(""),d(!0);try{const b=await $.login(s,o);await t(),e(lf(b.user.role))}catch{u("NieprawidÅowy email lub hasÅo.")}finally{d(!1)}};return n.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-4",children:[n.jsx("a",{href:"/",className:"mb-8",children:n.jsx(js,{className:"h-10 w-auto",height:40})}),n.jsxs("div",{className:"w-full max-w-sm",children:[n.jsxs("div",{className:"bg-news-surface border border-border rounded-xl p-7 space-y-5",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-lg font-bold text-foreground",children:"Zaloguj siÄ"}),n.jsx("p",{className:"text-xs text-news-muted mt-1",children:"DostÄp do panelu redakcyjnego"})]}),h&&n.jsxs("div",{className:"flex items-start gap-2 p-3 bg-destructive/10 border border-destructive/30 rounded-lg",children:[n.jsx(Sr,{size:15,className:"text-destructive flex-shrink-0 mt-0.5"}),n.jsx("p",{className:"text-xs text-destructive",children:h})]}),n.jsxs("form",{onSubmit:p,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1.5 block",children:"Email"}),n.jsxs("div",{className:"relative",children:[n.jsx(Yg,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-news-dim"}),n.jsx("input",{type:"email",required:!0,value:s,onChange:m=>r(m.target.value),className:"w-full bg-news-surface-2 border border-border rounded-lg pl-9 pr-3 py-2.5 text-sm text-foreground focus:outline-none focus:border-news-red",placeholder:"[email protected]"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-news-muted mb-1.5 block",children:"HasÅo"}),n.jsxs("div",{className:"relative",children:[n.jsx(af,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-news-dim"}),n.jsx("input",{type:i?"text":"password",required:!0,value:o,onChange:m=>a(m.target.value),className:"w-full bg-news-surface-2 border border-border rounded-lg pl-9 pr-10 py-2.5 text-sm text-foreground focus:outline-none focus:border-news-red",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"}),n.jsx("button",{type:"button",onClick:()=>l(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-news-dim hover:text-foreground",children:i?n.jsx(bn,{size:14}):n.jsx(At,{size:14})})]})]}
113),n.jsx("button",{type:"submit",disabled:c,className:"w-full bg-news-red text-white font-semibold py-2.5 rounded-lg text-sm hover:bg-news-red-bright transition-colors disabled:opacity-50",children:c?"Logowanieâ¦":"Zaloguj siÄ"})]})]}),n.jsxs("a",{href:"/",className:"flex items-center justify-center gap-1.5 mt-5 text-xs text-news-muted hover:text-foreground transition-colors",children:[n.jsx(yr,{size:13}),"WrÃ³Ä do portalu"]})]})]})}function qC(){const e=Ls();return n.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-4",children:[n.jsx(js,{className:"h-10 w-auto mb-8",height:40}),n.jsxs("div",{className:"w-full max-w-sm bg-news-surface border border-border rounded-xl p-7 space-y-4 text-center",children:[n.jsx("h1",{className:"text-lg font-bold text-foreground",children:"Reset hasÅa"}),n.jsx("p",{className:"text-sm text-news-muted",children:"Skontaktuj siÄ z administratorem serwera, aby zresetowaÄ hasÅo do panelu."}),n.jsxs("button",{onClick:()=>e(kl),className:"inline-flex items-center gap-1.5 text-xs text-news-muted hover:text-foreground",children:[n.jsx(yr,{size:13}),"WrÃ³Ä do logowania"]})]})]})}const XC=tg,np=f.forwardRef(({className:e,...t},s)=>n.jsx(Yu,{ref:s,className:Ue("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));np.displayName=Yu.displayName;const JC=Rm("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),rp=f.forwardRef(({className:e,variant:t,...s},r)=>n.jsx(Vu,{ref:r,className:Ue(JC({variant:t}),e),...s}));rp.displayName=Vu.displayName;const ZC=f.forwardRef(({className:e,...t},s)=>n.jsx(Ku,{ref:s,className:Ue("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));ZC.displayName=Ku.displayName;const op=f.forwardRef(({className:e,...t},s)=>n.jsx(qu,{ref:s,className:Ue("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:n.jsx(He,{className:"h-4 w-4"})}));op.displayName=qu.displayName;const ap=f.forwardRef(({className:e,...t},s)=>n.jsx(Xu,{ref:s,className:Ue("text-sm font-semibold",e),...t}));ap.displayName=Xu.displayName;const ip=f.forwardRef(({className:e,...t},s)=>n.jsx(Ju,{ref:s,className:Ue("text-sm opacity-90",e),...t}));ip.displayName=Ju.displayName;function QC(){const{toasts:e}=Zm();return n.jsxs(XC,{children:[e.map(function({id:t,title:s,description:r,action:o,...a}){return n.jsxs(rp,{...a,children:[n.jsxs("div",{className:"grid gap-1",children:[s&&n.jsx(ap,{children:s}),r&&n.jsx(ip,{children:r})]}),o,n.jsx(op,{})]},t)}),n.jsx(np,{})]})}var Au=["light","dark"],e_="(prefers-color-scheme: dark)",t_=f.createContext(void 0),s_={setTheme:e=>{},themes:[]},n_=()=>{var e;return(e=f.useContext(t_))!=null?e:s_};f.memo(({forcedTheme:e,storageKey:t,attribute:s,enableSystem:r,enableColorScheme:o,defaultTheme:a,value:i,attrs:l,nonce:c})=>{let d=a==="system",h=s==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(b=>`'${b}'`).join(",")})`};`:`var d=document.documentElement,n='${s}',s='setAttribute';`,u=o?Au.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",p=(b,x=!1,g=!0)=>{let y=i?i[b]:b,N=x?b+"|| ''":`'${y}'`,w="";return o&&g&&!x&&Au.includes(b)&&(w+=`d.style.colorScheme = '${b}';`),s==="class"?x||y?w+=`c.add(${N})`:w+="null":y&&(w+=`d[s](n,${N})`),w},m=e?`!function(){${h}${p(e)}}()`:r?`!function(){try{${h}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${d})){var t='${e_}',m=window.matchMedia(t);if(m.media!==t||m.matches){${p("dark")}}else{${p("light")}}}else if(e){${i?`var x=${JSON.stringify(i)};`:""}${p(i?"x[e]":"e",!0)}}${d?"":"else{"+p(a,!1,!1)+"}"}${u}}catch(e){}}()`:`!function(){try{${h}var e=localStorage.getItem('${t}');if(e){${i?`var x=${JSON.stringify(i)};`:""}${p(i?"x[e]":"e",!0)}}else{${p(a,!1,!1)};}${u}}catch(t){}}();`;return f.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:m}})});const r_=({...e})=>{const{theme:t="system"}=n_();return n.jsx(oy,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},o_=sg,a_=f.forwardRef(({className:e,sideOffset:t=4,...s},r)=>
113n.jsx(Zu,{ref:r,sideOffset:t,className:Ue("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));a_.displayName=Zu.displayName;function i_(){const{pathname:e}=Dr();return f.useEffect(()=>{window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0},[e]),null}const lp="cookie_consent";function cp(){try{const e=localStorage.getItem(lp);return e==="accepted"||e==="declined"?e:null}catch{return null}}function l_(e){try{localStorage.setItem(lp,e)}catch{}}const c_="/polityka-prywatnosci",Mu="GTM-TCLVXZQT";let hl=!1;function dp(){if(hl||typeof window>"u")return;hl=!0,window.dataLayer=window.dataLayer||[],window.dataLayer.push({"gtm.start":new Date().getTime(),event:"gtm.js"});const e=document.createElement("script");e.async=!0,e.src=`https://www.googletagmanager.com/gtm.js?id=${Mu}`,document.head.appendChild(e);const t=document.createElement("noscript"),s=document.createElement("iframe");s.src=`https://www.googletagmanager.com/ns.html?id=${Mu}`,s.height="0",s.width="0",s.style.display="none",s.style.visibility="hidden",t.appendChild(s),document.body.prepend(t)}function up(e){hl&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"page_view",page_path:e,page_location:window.location.href,page_title:document.title}))}function d_(){const{pathname:e,search:t}=Dr();return f.useEffect(()=>{cp()==="accepted"&&(dp(),up(e+t))},[e,t]),null}function u_(){dp(),up(window.location.pathname+window.location.search)}function f_(){const[e,t]=f.useState(!1);f.useEffect(()=>{t(cp()===null)},[]);const s=r=>{l_(r),r==="accepted"&&u_(),t(!1)};return e?n.jsx("div",{className:"fixed bottom-4 right-4 z-[100] w-[min(100vw-2rem,320px)] pointer-events-auto",role:"dialog","aria-live":"polite","aria-label":"Informacja o plikach cookie",children:n.jsxs("div",{className:"relative bg-news-surface-2/95 backdrop-blur-md border border-border rounded-lg shadow-xl shadow-black/15 p-3.5",children:[n.jsxs("div",{className:"flex items-start gap-2.5 mb-3",children:[n.jsx("div",{className:"w-7 h-7 rounded-md bg-news-red/10 flex items-center justify-center flex-shrink-0",children:n.jsx(Vg,{size:14,className:"text-news-red"})}),n.jsx("p",{className:"text-xs text-news-muted leading-relaxed pr-5",children:"Ta strona wykorzystuje pliki cookie, aby poprawiÄ TwojÄ
wygodÄ. ZakÅadamy, że nie masz nic przeciwko, ale możesz zrezygnowaÄ, jeÅli chcesz."}),n.jsx("button",{type:"button",onClick:()=>s("declined"),"aria-label":"OdrzuÄ cookies",className:"absolute top-3 right-3 p-1 rounded text-news-dim hover:text-foreground transition-colors",children:n.jsx(He,{size:14})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(En,{to:c_,className:"text-xs font-medium text-news-red hover:underline px-1",children:"Czytaj wiÄcej"}),n.jsx("button",{type:"button",onClick:()=>s("accepted"),className:"ml-auto bg-news-red text-white text-xs font-semibold px-3 py-1.5 rounded-md hover:bg-news-red-bright transition-colors",children:"AkceptujÄ"})]})]})}):null}const m_=new Set(["admin","mostek","login","reset-password","artykul","kategoria","szukaj","api"]);function h_(e,t=[]){const s=e.match(/^\/(\d{4})\/(\d{2})\/(\d{2})\/([^/]+)\/?$/);if(s){const a=e.replace(/\/$/,"")||e;return{kind:"article",slug:s[4],canonicalPath:a}}const r=e.replace(/^\/+|\/+$/g,"");if(!r)return{kind:"home"};const o=r.split("/")[0];return m_.has(o)?{kind:"system"}:ff(o,t)?{kind:"category",slug:o,canonicalPath:`/${o}`}:r.includes("/")?{kind:"unknown"}:{kind:"page",slug:o,canonicalPath:`/${o}`}}function p_(){const e=Dr(),{seo:t,general:s,loading:r}=us(),{categories:o,loading:a}=wn(!1),i=o.map(u=>u.name),[l,c]=f.useState(null),[d,h]=f.useState(!0);return f.useEffect(()=>{let u=!1;
113const p=h_(e.pathname,i),m=t.og_site_name||s.name||"Polska Morska",b=rs("/").replace(/\/$/,"");async function x(){var g,y,N;if(!(r||a)){if(p.kind==="system"){u||(c({...ao(t,b),title:m,noindex:!0,jsonLd:void 0}),h(!1));return}if(p.kind==="home"||p.kind==="unknown"){h(!0);try{const w=await $.getSharePreviewArticle(),k=ao(t,b);w!=null&&w.image_url&&(k.og_image=w.image_url),u||c(k)}catch{u||c(ao(t,b))}finally{u||h(!1)}return}h(!0);try{if(p.kind==="article"){const w=await $.getArticleBySlug(p.slug),k=w.slug&&w.slug!==p.slug?Cr(w):p.canonicalPath,E=rs(k,b),v=Ya(((g=w.excerpt)==null?void 0:g.trim())||sd(w.content||"")),S=Va(w.title,m),z=w.image_url||t.og_image;u||c({title:S,description:v,author:((y=w.author)==null?void 0:y.name)||t.author,og_type:"article",og_title:w.title,og_description:v,og_site_name:m,og_image:z,twitter_card:t.twitter_card,twitter_title:w.title,twitter_description:v,canonical:E,jsonLd:zb({title:w.title,description:v,url:E,image:z,publishedAt:w.published_at,updatedAt:w.updated_at,authorName:((N=w.author)==null?void 0:N.name)??null,siteName:m})});return}if(p.kind==="category"){const w=mf(p.slug)||i.find(S=>Yf(S)===p.slug)||p.slug,k=Ya(Wi[w]||t.description),E=Va(w,m),v=rs(p.canonicalPath,b);u||c({title:E,description:k,author:t.author,og_type:"website",og_title:w,og_description:k,og_site_name:m,og_image:t.og_image,twitter_card:t.twitter_card,twitter_title:w,twitter_description:k,canonical:v,jsonLd:Ab({name:w,description:k,url:v,siteName:m})});return}if(p.kind==="page"){const w=await $.getPageBySlug(p.slug),k=Ya(sd(w.content)),E=Va(w.title,m),v=rs(p.canonicalPath,b);u||c({title:E,description:k,author:t.author,og_type:"website",og_title:w.title,og_description:k,og_site_name:m,og_image:t.og_image,twitter_card:t.twitter_card,twitter_title:w.title,twitter_description:k,canonical:v,jsonLd:Mb({title:w.title,url:v,siteName:m})})}}catch{u||c(ao(t,b))}finally{u||h(!1)}}}return x(),()=>{u=!0}},[e.pathname,t,s.name,r,a,i]),{meta:l,loading:r||d}}function g_(){const{meta:e,loading:t}=p_();return f.useEffect(()=>{t||!e||Ob(e)},[e,t]),null}const x_=new qg({defaultOptions:{queries:{staleTime:6e4,gcTime:5*6e4,refetchOnWindowFocus:!0,retry:1}}}),b_=()=>n.jsx(Xg,{client:x_,children:n.jsx(Hb,{children:n.jsx(Rb,{children:n.jsxs(o_,{children:[n.jsx(QC,{}),n.jsx(r_,{}),n.jsxs(Yp,{children:[n.jsx(g_,{}),n.jsx(i_,{}),n.jsx(d_,{}),n.jsx(f_,{}),n.jsx(AN,{children:n.jsxs(Vp,{children:[n.jsx(wt,{path:"/szukaj",element:n.jsx(VC,{})}),n.jsxs(wt,{element:n.jsx(Fj,{}),children:[n.jsx(wt,{index:!0,element:null}),n.jsx(wt,{path:":year/:month/:day/:articleSlug",element:null}),n.jsx(wt,{path:":categorySlug",element:null})]}),n.jsx(wt,{path:kl,element:n.jsx(KC,{})}),n.jsx(wt,{path:Jg,element:n.jsx(qC,{})}),n.jsx(wt,{path:"/login",element:n.jsx(Js,{})}),n.jsx(wt,{path:"/reset-password",element:n.jsx(Js,{})}),n.jsx(wt,{path:`${$t}/articles/:articleId/edit`,element:n.jsx(Ei,{children:n.jsx(Ti,{})})}),n.jsx(wt,{path:`${$t}/articles/new`,element:n.jsx(Ei,{children:n.jsx(Ti,{})})}),n.jsx(wt,{path:`${$t}/*`,element:n.jsx(Ei,{children:n.jsx(Ti,{})})}),n.jsx(wt,{path:"/admin/*",element:n.jsx(Js,{})}),n.jsx(wt,{path:"/artykul/:articleSlug",element:n.jsx(YC,{})}),n.jsx(wt,{path:"/kategoria/:categorySlug",element:n.jsx(Wj,{})}),n.jsx(wt,{path:"*",element:n.jsx(Js,{})})]})})]})]})})})});Kp(document.getElementById("root")).render(n.jsx(b_,{}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.