nnews-react 0.3.8 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -184,7 +184,7 @@ ${Ta(this.code(t,n))}
|
|
|
184
184
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[Wf]=this[Wf]={accessors:{}}).accessors,i=this.prototype;function s(a){const o=yi(a);r[o]||(JM(i,a),r[o]=!0)}return L.isArray(t)?t.forEach(s):s(t),this}};yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);L.reduceDescriptors(yt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});L.freezeMethods(yt);function sl(e,t){const n=this||ns,r=t||n,i=yt.from(r.headers);let s=r.data;return L.forEach(e,function(o){s=o.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Gm(e){return!!(e&&e.__CANCEL__)}function Xr(e,t,n){fe.call(this,e??"canceled",fe.ERR_CANCELED,t,n),this.name="CanceledError"}L.inherits(Xr,fe,{__CANCEL__:!0});function Km(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new fe("Request failed with status code "+n.status,[fe.ERR_BAD_REQUEST,fe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function QM(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function e2(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,a;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),u=r[s];a||(a=c),n[i]=l,r[i]=c;let d=s,h=0;for(;d!==i;)h+=n[d++],d=d%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-a<t)return;const f=u&&c-u;return f?Math.round(h*1e3/f):void 0}}function t2(e,t){let n=0,r=1e3/t,i,s;const a=(c,u=Date.now())=>{n=u,i=null,s&&(clearTimeout(s),s=null),e(...c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=r?a(c,u):(i=c,s||(s=setTimeout(()=>{s=null,a(i)},r-d)))},()=>i&&a(i)]}const sa=(e,t,n=3)=>{let r=0;const i=e2(50,250);return t2(s=>{const a=s.loaded,o=s.lengthComputable?s.total:void 0,l=a-r,c=i(l),u=a<=o;r=a;const d={loaded:a,total:o,progress:o?a/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&u?(o-a)/c:void 0,event:s,lengthComputable:o!=null,[t?"download":"upload"]:!0};e(d)},n)},Yf=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Zf=e=>(...t)=>L.asap(()=>e(...t)),n2=et.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,et.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(et.origin),et.navigator&&/(msie|trident)/i.test(et.navigator.userAgent)):()=>!0,r2=et.hasStandardBrowserEnv?{write(e,t,n,r,i,s,a){if(typeof document>"u")return;const o=[`${e}=${encodeURIComponent(t)}`];L.isNumber(n)&&o.push(`expires=${new Date(n).toUTCString()}`),L.isString(r)&&o.push(`path=${r}`),L.isString(i)&&o.push(`domain=${i}`),s===!0&&o.push("secure"),L.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function i2(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function s2(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Vm(e,t,n){let r=!i2(t);return e&&(r||n==!1)?s2(e,t):t}const Xf=e=>e instanceof yt?{...e}:e;function ar(e,t){t=t||{};const n={};function r(c,u,d,h){return L.isPlainObject(c)&&L.isPlainObject(u)?L.merge.call({caseless:h},c,u):L.isPlainObject(u)?L.merge({},u):L.isArray(u)?u.slice():u}function i(c,u,d,h){if(L.isUndefined(u)){if(!L.isUndefined(c))return r(void 0,c,d,h)}else return r(c,u,d,h)}function s(c,u){if(!L.isUndefined(u))return r(void 0,u)}function a(c,u){if(L.isUndefined(u)){if(!L.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function o(c,u,d){if(d in t)return r(c,u);if(d in e)return r(void 0,c)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(c,u,d)=>i(Xf(c),Xf(u),d,!0)};return L.forEach(Object.keys({...e,...t}),function(u){const d=l[u]||i,h=d(e[u],t[u],u);L.isUndefined(h)&&d!==o||(n[u]=h)}),n}const Wm=e=>{const t=ar({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:o}=t;if(t.headers=a=yt.from(a),t.url=jm(Vm(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),L.isFormData(n)){if(et.hasStandardBrowserEnv||et.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(L.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&a.set(u,d)})}}if(et.hasStandardBrowserEnv&&(r&&L.isFunction(r)&&(r=r(t)),r||r!==!1&&n2(t.url))){const l=i&&s&&r2.read(s);l&&a.set(i,l)}return t},a2=typeof XMLHttpRequest<"u",o2=a2&&function(e){return new Promise(function(n,r){const i=Wm(e);let s=i.data;const a=yt.from(i.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=i,u,d,h,f,p;function g(){f&&f(),p&&p(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function y(){if(!b)return;const _=yt.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),O={data:!o||o==="text"||o==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:_,config:e,request:b};Km(function(D){n(D),g()},function(D){r(D),g()},O),b=null}"onloadend"in b?b.onloadend=y:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(y)},b.onabort=function(){b&&(r(new fe("Request aborted",fe.ECONNABORTED,e,b)),b=null)},b.onerror=function(A){const O=A&&A.message?A.message:"Network Error",N=new fe(O,fe.ERR_NETWORK,e,b);N.event=A||null,r(N),b=null},b.ontimeout=function(){let A=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const O=i.transitional||zm;i.timeoutErrorMessage&&(A=i.timeoutErrorMessage),r(new fe(A,O.clarifyTimeoutError?fe.ETIMEDOUT:fe.ECONNABORTED,e,b)),b=null},s===void 0&&a.setContentType(null),"setRequestHeader"in b&&L.forEach(a.toJSON(),function(A,O){b.setRequestHeader(O,A)}),L.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),o&&o!=="json"&&(b.responseType=i.responseType),c&&([h,p]=sa(c,!0),b.addEventListener("progress",h)),l&&b.upload&&([d,f]=sa(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",f)),(i.cancelToken||i.signal)&&(u=_=>{b&&(r(!_||_.type?new Xr(null,e,b):_),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const w=QM(i.url);if(w&&et.protocols.indexOf(w)===-1){r(new fe("Unsupported protocol "+w+":",fe.ERR_BAD_REQUEST,e));return}b.send(s||null)})},l2=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const s=function(c){if(!i){i=!0,o();const u=c instanceof Error?c:this.reason;r.abort(u instanceof fe?u:new Xr(u instanceof Error?u.message:u))}};let a=t&&setTimeout(()=>{a=null,s(new fe(`timeout ${t} of ms exceeded`,fe.ETIMEDOUT))},t);const o=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>L.asap(o),l}},c2=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},u2=async function*(e,t){for await(const n of d2(e))yield*c2(n,t)},d2=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Jf=(e,t,n,r)=>{const i=u2(e,t);let s=0,a,o=l=>{a||(a=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await i.next();if(c){o(),l.close();return}let d=u.byteLength;if(n){let h=s+=d;n(h)}l.enqueue(new Uint8Array(u))}catch(c){throw o(c),c}},cancel(l){return o(l),i.return()}},{highWaterMark:2})},Qf=64*1024,{isFunction:Ls}=L,f2=(({Request:e,Response:t})=>({Request:e,Response:t}))(L.global),{ReadableStream:eh,TextEncoder:th}=L.global,nh=(e,...t)=>{try{return!!e(...t)}catch{return!1}},h2=e=>{e=L.merge.call({skipUndefined:!0},f2,e);const{fetch:t,Request:n,Response:r}=e,i=t?Ls(t):typeof fetch=="function",s=Ls(n),a=Ls(r);if(!i)return!1;const o=i&&Ls(eh),l=i&&(typeof th=="function"?(p=>g=>p.encode(g))(new th):async p=>new Uint8Array(await new n(p).arrayBuffer())),c=s&&o&&nh(()=>{let p=!1;const g=new n(et.origin,{body:new eh,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!g}),u=a&&o&&nh(()=>L.isReadableStream(new r("").body)),d={stream:u&&(p=>p.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(g,b)=>{let y=g&&g[p];if(y)return y.call(g);throw new fe(`Response type '${p}' is not supported`,fe.ERR_NOT_SUPPORT,b)})});const h=async p=>{if(p==null)return 0;if(L.isBlob(p))return p.size;if(L.isSpecCompliantForm(p))return(await new n(et.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(L.isArrayBufferView(p)||L.isArrayBuffer(p))return p.byteLength;if(L.isURLSearchParams(p)&&(p=p+""),L.isString(p))return(await l(p)).byteLength},f=async(p,g)=>{const b=L.toFiniteNumber(p.getContentLength());return b??h(g)};return async p=>{let{url:g,method:b,data:y,signal:w,cancelToken:_,timeout:A,onDownloadProgress:O,onUploadProgress:N,responseType:D,headers:q,withCredentials:H="same-origin",fetchOptions:C}=Wm(p),F=t||fetch;D=D?(D+"").toLowerCase():"text";let M=l2([w,_&&_.toAbortSignal()],A),V=null;const z=M&&M.unsubscribe&&(()=>{M.unsubscribe()});let Z;try{if(N&&c&&b!=="get"&&b!=="head"&&(Z=await f(q,y))!==0){let Y=new n(g,{method:"POST",body:y,duplex:"half"}),ae;if(L.isFormData(y)&&(ae=Y.headers.get("content-type"))&&q.setContentType(ae),Y.body){const[k,de]=Yf(Z,sa(Zf(N)));y=Jf(Y.body,Qf,k,de)}}L.isString(H)||(H=H?"include":"omit");const I=s&&"credentials"in n.prototype,U={...C,signal:M,method:b.toUpperCase(),headers:q.normalize().toJSON(),body:y,duplex:"half",credentials:I?H:void 0};V=s&&new n(g,U);let j=await(s?F(V,C):F(g,U));const W=u&&(D==="stream"||D==="response");if(u&&(O||W&&z)){const Y={};["status","statusText","headers"].forEach(re=>{Y[re]=j[re]});const ae=L.toFiniteNumber(j.headers.get("content-length")),[k,de]=O&&Yf(ae,sa(Zf(O),!0))||[];j=new r(Jf(j.body,Qf,k,()=>{de&&de(),z&&z()}),Y)}D=D||"text";let v=await d[L.findKey(d,D)||"text"](j,p);return!W&&z&&z(),await new Promise((Y,ae)=>{Km(Y,ae,{data:v,headers:yt.from(j.headers),status:j.status,statusText:j.statusText,config:p,request:V})})}catch(I){throw z&&z(),I&&I.name==="TypeError"&&/Load failed|fetch/i.test(I.message)?Object.assign(new fe("Network Error",fe.ERR_NETWORK,p,V),{cause:I.cause||I}):fe.from(I,I&&I.code,p,V)}}},p2=new Map,Ym=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,s=[r,i,n];let a=s.length,o=a,l,c,u=p2;for(;o--;)l=s[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:h2(t)),u=c;return c};Ym();const eu={http:IM,xhr:o2,fetch:{get:Ym}};L.forEach(eu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const rh=e=>`- ${e}`,g2=e=>L.isFunction(e)||e===null||e===!1;function m2(e,t){e=L.isArray(e)?e:[e];const{length:n}=e;let r,i;const s={};for(let a=0;a<n;a++){r=e[a];let o;if(i=r,!g2(r)&&(i=eu[(o=String(r)).toLowerCase()],i===void 0))throw new fe(`Unknown adapter '${o}'`);if(i&&(L.isFunction(i)||(i=i.get(t))))break;s[o||"#"+a]=i}if(!i){const a=Object.entries(s).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=n?a.length>1?`since :
|
|
185
185
|
`+a.map(rh).join(`
|
|
186
186
|
`):" "+rh(a[0]):"as no adapter specified";throw new fe("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i}const Zm={getAdapter:m2,adapters:eu};function al(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xr(null,e)}function ih(e){return al(e),e.headers=yt.from(e.headers),e.data=sl.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Zm.getAdapter(e.adapter||ns.adapter,e)(e).then(function(r){return al(e),r.data=sl.call(e,e.transformResponse,r),r.headers=yt.from(r.headers),r},function(r){return Gm(r)||(al(e),r&&r.response&&(r.response.data=sl.call(e,e.transformResponse,r.response),r.response.headers=yt.from(r.response.headers))),Promise.reject(r)})}const Xm="1.13.2",Pa={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Pa[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const sh={};Pa.transitional=function(t,n,r){function i(s,a){return"[Axios v"+Xm+"] Transitional option '"+s+"'"+a+(r?". "+r:"")}return(s,a,o)=>{if(t===!1)throw new fe(i(a," has been removed"+(n?" in "+n:"")),fe.ERR_DEPRECATED);return n&&!sh[a]&&(sh[a]=!0,console.warn(i(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,a,o):!0}};Pa.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function b2(e,t,n){if(typeof e!="object")throw new fe("options must be an object",fe.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],a=t[s];if(a){const o=e[s],l=o===void 0||a(o,s,e);if(l!==!0)throw new fe("option "+s+" must be "+l,fe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new fe("Unknown option "+s,fe.ERR_BAD_OPTION)}}const js={assertOptions:b2,validators:Pa},rn=js.validators;let er=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Vf,response:new Vf}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
187
|
-
`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ar(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&js.assertOptions(r,{silentJSONParsing:rn.transitional(rn.boolean),forcedJSONParsing:rn.transitional(rn.boolean),clarifyTimeoutError:rn.transitional(rn.boolean)},!1),i!=null&&(L.isFunction(i)?n.paramsSerializer={serialize:i}:js.assertOptions(i,{encode:rn.function,serialize:rn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),js.assertOptions(n,{baseUrl:rn.spelling("baseURL"),withXsrfToken:rn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&L.merge(s.common,s[n.method]);s&&L.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),n.headers=yt.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(l=l&&g.synchronous,o.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,h;if(!l){const p=[ih.bind(this),void 0];for(p.unshift(...o),p.push(...c),h=p.length,u=Promise.resolve(n);d<h;)u=u.then(p[d++],p[d++]);return u}h=o.length;let f=n;for(;d<h;){const p=o[d++],g=o[d++];try{f=p(f)}catch(b){g.call(this,b);break}}try{u=ih.call(this,f)}catch(p){return Promise.reject(p)}for(d=0,h=c.length;d<h;)u=u.then(c[d++],c[d++]);return u}getUri(t){t=ar(this.defaults,t);const n=Vm(t.baseURL,t.url,t.allowAbsoluteUrls);return jm(n,t.params,t.paramsSerializer)}};L.forEach(["delete","get","head","options"],function(t){er.prototype[t]=function(n,r){return this.request(ar(r||{},{method:t,url:n,data:(r||{}).data}))}});L.forEach(["post","put","patch"],function(t){function n(r){return function(s,a,o){return this.request(ar(o||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}er.prototype[t]=n(),er.prototype[t+"Form"]=n(!0)});let y2=class Jm{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(o=>{r.subscribe(o),s=o}).then(i);return a.cancel=function(){r.unsubscribe(s)},a},t(function(s,a,o){r.reason||(r.reason=new Xr(s,a,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Jm(function(i){t=i}),cancel:t}}};function x2(e){return function(n){return e.apply(null,n)}}function E2(e){return L.isObject(e)&&e.isAxiosError===!0}const ec={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ec).forEach(([e,t])=>{ec[t]=e});function Qm(e){const t=new er(e),n=Om(er.prototype.request,t);return L.extend(n,er.prototype,t,{allOwnKeys:!0}),L.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Qm(ar(e,i))},n}const Me=Qm(ns);Me.Axios=er;Me.CanceledError=Xr;Me.CancelToken=y2;Me.isCancel=Gm;Me.VERSION=Xm;Me.toFormData=Da;Me.AxiosError=fe;Me.Cancel=Me.CanceledError;Me.all=function(t){return Promise.all(t)};Me.spread=x2;Me.isAxiosError=E2;Me.mergeConfig=ar;Me.AxiosHeaders=yt;Me.formToJSON=e=>Hm(L.isHTMLForm(e)?new FormData(e):e);Me.getAdapter=Zm.getAdapter;Me.HttpStatusCode=ec;Me.default=Me;const{Axios:aP,AxiosError:oP,CanceledError:lP,isCancel:cP,CancelToken:uP,VERSION:dP,all:fP,Cancel:hP,isAxiosError:pP,spread:gP,toFormData:mP,AxiosHeaders:bP,HttpStatusCode:yP,formToJSON:xP,getAdapter:EP,mergeConfig:wP}=Me,ot={ARTICLES:"/article",ARTICLES_FILTER:"/article/filter",ARTICLE_BY_ID:e=>`/article/${e}`,IMAGE_UPLOAD:"/Image/uploadImage",INSERT_WITH_AI:"/article/insertWithAI",UPDATE_WITH_AI:"/article/updateWithAI"};class eb{constructor(t){this.client=t}async uploadImage(t){const n=new FormData;n.append("file",t),console.log("[ArticleAPI] uploadImage - Request:",{fileName:t.name,fileSize:t.size});const r=await this.client.post(ot.IMAGE_UPLOAD,n,{headers:{"Content-Type":"multipart/form-data"}});return console.log("[ArticleAPI] uploadImage - Response:",r.data),r.data}async listArticles(t,n=1,r=10){const i={page:n,pageSize:r};t&&(i.categoryId=t),console.log("[ArticleAPI] listArticles - Request:",{url:ot.ARTICLES,params:i});const s=await this.client.get(ot.ARTICLES,{params:i});return console.log("[ArticleAPI] listArticles - Response:",s.data),this.transformArticleDates(s.data)}async filterArticles(t,n,r=1,i=10){const s={page:r,pageSize:i};t&&t.length>0&&(s.roles=t.join(",")),n!==void 0&&(s.parentId=n);const a=await this.client.get(ot.ARTICLES_FILTER,{params:s});return this.transformArticleDates(a.data)}async getArticleById(t){const n=await this.client.get(ot.ARTICLE_BY_ID(t));return this.transformArticleDate(n.data)}async createArticle(t){console.log("[ArticleAPI] createArticle - Request:",{url:ot.ARTICLES,data:t});const n=await this.client.post(ot.ARTICLES,t);return console.log("[ArticleAPI] createArticle - Response:",n.data),this.transformArticleDate(n.data)}async updateArticle(t){console.log("[ArticleAPI] updateArticle - Request:",{url:ot.ARTICLES,data:t});const n=await this.client.put(ot.ARTICLES,t);return console.log("[ArticleAPI] updateArticle - Response:",n.data),this.transformArticleDate(n.data)}async deleteArticle(t){console.log("[ArticleAPI] deleteArticle - Request:",{id:t,url:ot.ARTICLE_BY_ID(t)}),await this.client.delete(ot.ARTICLE_BY_ID(t)),console.log("[ArticleAPI] deleteArticle - Success")}async createArticleWithAI(t){console.log("[ArticleAPI] createArticleWithAI - Request:",{url:ot.INSERT_WITH_AI,data:t});const n=await this.client.post(ot.INSERT_WITH_AI,t);return console.log("[ArticleAPI] createArticleWithAI - Response:",n.data),this.transformArticleDate(n.data)}async updateArticleWithAI(t){if(!t.articleId)throw new Error("articleId is required for updateWithAI");console.log("[ArticleAPI] updateArticleWithAI - Request:",{url:ot.UPDATE_WITH_AI,data:t});const n=await this.client.put(ot.UPDATE_WITH_AI,t);return console.log("[ArticleAPI] updateArticleWithAI - Response:",n.data),this.transformArticleDate(n.data)}transformArticleDate(t){return{...t,dateAt:t.dateAt?new Date(t.dateAt):void 0,createdAt:t.createdAt?new Date(t.createdAt):void 0,updatedAt:t.updatedAt?new Date(t.updatedAt):void 0,category:t.category?{...t.category,createdAt:t.category.createdAt?new Date(t.category.createdAt):void 0,updatedAt:t.category.updatedAt?new Date(t.category.updatedAt):void 0}:void 0}}transformArticleDates(t){return{...t,items:t.items.map(n=>this.transformArticleDate(n))}}}const sn={CATEGORIES:"/category",CATEGORIES_FILTER:"/category/filter",CATEGORY_BY_ID:e=>`/category/${e}`};class tb{constructor(t){this.client=t}async listCategories(){console.log("[CategoryAPI] listCategories - Request:",{url:sn.CATEGORIES});const t=await this.client.get(sn.CATEGORIES);return console.log("[CategoryAPI] listCategories - Response:",t.data),this.transformCategoryDates(t.data)}async filterCategories(t,n){const r={};t&&t.length>0&&(r.roles=t.join(",")),n!==void 0&&(r.parentId=n);const i=await this.client.get(sn.CATEGORIES_FILTER,{params:r});return this.transformCategoryDates(i.data)}async getCategoryById(t){const n=await this.client.get(sn.CATEGORY_BY_ID(t));return this.transformCategoryDate(n.data)}async createCategory(t){console.log("[CategoryAPI] createCategory - Request:",{url:sn.CATEGORIES,data:t});const n=await this.client.post(sn.CATEGORIES,t);return console.log("[CategoryAPI] createCategory - Response:",n.data),this.transformCategoryDate(n.data)}async updateCategory(t){console.log("[CategoryAPI] updateCategory - Request:",{url:sn.CATEGORIES,data:t});const n=await this.client.put(sn.CATEGORIES,t);return console.log("[CategoryAPI] updateCategory - Response:",n.data),this.transformCategoryDate(n.data)}async deleteCategory(t){console.log("[CategoryAPI] deleteCategory - Request:",{id:t,url:sn.CATEGORY_BY_ID(t)}),await this.client.delete(sn.CATEGORY_BY_ID(t)),console.log("[CategoryAPI] deleteCategory - Success")}transformCategoryDate(t){return{...t,createdAt:t.createdAt?new Date(t.createdAt):void 0,updatedAt:t.updatedAt?new Date(t.updatedAt):void 0}}transformCategoryDates(t){return t.map(n=>this.transformCategoryDate(n))}}const zt={TAGS:"/tag",TAG_BY_ID:e=>`/tag/${e}`,TAG_MERGE:(e,t)=>`/Tag/merge/${e}/${t}`};class nb{constructor(t){this.client=t}async listTags(){console.log("[TagAPI] listTags - Request:",{url:zt.TAGS});const t=await this.client.get(zt.TAGS);return console.log("[TagAPI] listTags - Response:",t.data),t.data}async getTagById(t){console.log("[TagAPI] getTagById - Request:",{id:t,url:zt.TAG_BY_ID(t)});const n=await this.client.get(zt.TAG_BY_ID(t));return console.log("[TagAPI] getTagById - Response:",n.data),n.data}async createTag(t){console.log("[TagAPI] createTag - Request:",{url:zt.TAGS,data:t});const n=await this.client.post(zt.TAGS,t);return console.log("[TagAPI] createTag - Response:",n.data),n.data}async updateTag(t){console.log("[TagAPI] updateTag - Request:",{url:zt.TAGS,data:t});const n=await this.client.put(zt.TAGS,t);return console.log("[TagAPI] updateTag - Response:",n.data),n.data}async deleteTag(t){console.log("[TagAPI] deleteTag - Request:",{id:t,url:zt.TAG_BY_ID(t)}),await this.client.delete(zt.TAG_BY_ID(t)),console.log("[TagAPI] deleteTag - Success")}async mergeTags(t,n){const r=zt.TAG_MERGE(t,n);console.log("[TagAPI] mergeTags - Request:",{url:r,sourceTagId:t,targetTagId:n}),await this.client.post(r),console.log("[TagAPI] mergeTags - Success")}}const rb=$.createContext(void 0);function w2({config:e,children:t}){const n=$.useMemo(()=>Eh(e.language,e.translations),[e.language,e.translations]),r=$.useRef(e.language);$.useEffect(()=>{e.language&&e.language!==r.current&&(n.changeLanguage(e.language),r.current=e.language)},[e.language,n]);const i=$.useRef(e);$.useEffect(()=>{var a;i.current=e,console.log("[NNews] Config updated:",{apiUrl:e.apiUrl,hasAuthHeader:!!((a=e.headers)!=null&&a.Authorization)})},[e]);const s=$.useMemo(()=>{const a=e.apiClient||Me.create({baseURL:e.apiUrl,headers:{"Content-Type":"application/json"}});a.interceptors.request.use(u=>{var h,f,p;const d=i.current.headers;return d&&Object.entries(d).forEach(([g,b])=>{b&&u.headers.set(g,b)}),console.log("[NNews] Request interceptor:",{method:(h=u.method)==null?void 0:h.toUpperCase(),url:`${u.baseURL||""}${u.url||""}`,headers:{Authorization:((f=u.headers)==null?void 0:f.Authorization)||"(not set)","Content-Type":((p=u.headers)==null?void 0:p["Content-Type"])||"(not set)"}}),u});const o=new eb(a),l=new tb(a),c=new nb(a);return{config:e,apiClient:a,articleApi:o,categoryApi:l,tagApi:c}},[e.apiUrl,e.apiClient]);return E.jsx(_y,{i18n:n,children:E.jsx(rb.Provider,{value:s,children:t})})}function Jr(){const e=$.useContext(rb);if(!e)throw new Error("useNNews must be used within a NNewsProvider");return e}function v2({article:e,categories:t=[],availableRoles:n,onFetchRoles:r,onSave:i,onCancel:s,loading:a=!1}){const{articleApi:o}=Jr(),{t:l}=Pt(),[c,u]=$.useState(""),[d,h]=$.useState(""),[f,p]=$.useState(""),[g,b]=$.useState(""),[y,w]=$.useState(!1),[_,A]=$.useState(qe.Draft),[O,N]=$.useState(null),[D,q]=$.useState(""),[H,C]=$.useState(""),[F,M]=$.useState(!0),[V,z]=$.useState(new Set),[Z,I]=$.useState([]),[U,j]=$.useState(!1),[W,v]=$.useState({});$.useEffect(()=>{var X;e&&(u(e.title),h(e.content),p(e.imageName||""),console.log("imageName:",e.imageName),e.imageName&&b(e.imageName),A(e.status),N(e.categoryId||null),q(e.dateAt?new Date(e.dateAt).toISOString().slice(0,16):""),C(((X=e.tags)==null?void 0:X.map(ye=>ye.title).join(", "))||""),e.roles&&e.roles.length>0?(M(!1),z(new Set(e.roles.map(ye=>ye.slug)))):(M(!0),z(new Set)))},[e]);const Y=n||Z;$.useEffect(()=>{if(n&&n.length>0||!r)return;let X=!1;return j(!0),r().then(ye=>{X||I(ye)}).catch(ye=>{console.warn("Failed to fetch roles:",ye)}).finally(()=>{X||j(!1)}),()=>{X=!0}},[n,r]);const ae=$.useCallback(X=>{M(X),X&&z(new Set)},[]),k=$.useCallback(X=>{z(ye=>{const Se=new Set(ye);return Se.has(X)?Se.delete(X):Se.add(X),Se})},[]),de=()=>{const X={};return c.trim()||(X.title=l("validation.titleRequired")),d.trim()||(X.content=l("validation.contentRequired")),v(X),Object.keys(X).length===0},re=async X=>{if(X.preventDefault(),!de())return;const ye=F?[]:Array.from(V),Se={title:c.trim(),content:d.trim(),imageName:f||void 0,status:_,categoryId:O||void 0,dateAt:D||void 0,tagList:H.trim()||void 0,roles:ye.length>0?ye:void 0};e?await i({articleId:e.articleId,...Se}):await i(Se)},_e=async X=>{var je;const ye=(je=X.target.files)==null?void 0:je[0];if(!ye)return;if(!ye.type.startsWith("image/")){v({...W,image:l("validation.imageFileType")});return}if(ye.size>5*1024*1024){v({...W,image:l("validation.imageSizeLimit")});return}v({...W,image:""});const Se=new FileReader;Se.onloadend=()=>{b(Se.result)},Se.readAsDataURL(ye);try{w(!0);const it=await o.uploadImage(ye);p(it),v({...W,image:""})}catch(it){console.error("Error uploading image:",it),v({...W,image:l("validation.imageUploadFailed")})}finally{w(!1)}},Ve=()=>{b(""),p("")};return E.jsxs("form",{onSubmit:re,className:"space-y-6",children:[E.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[E.jsxs("div",{className:"col-span-2 p-4",children:[E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"title",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("common.titleRequired")}),E.jsx("input",{id:"title",type:"text",value:c,onChange:X=>u(X.target.value),className:`w-full rounded-md border ${W.title?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500`,placeholder:l("articleEditor.enterTitle")}),W.title&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.title})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"dateAt",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.publicationDate")}),E.jsx("input",{id:"dateAt",type:"datetime-local",value:D,onChange:X=>q(X.target.value),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"category",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.category")}),E.jsxs("select",{id:"category",value:O||"",onChange:X=>N(X.target.value?Number(X.target.value):null),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[E.jsx("option",{value:"",children:l("common.noCategory")}),t.map(X=>E.jsx("option",{value:X.categoryId,children:X.title},X.categoryId))]})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"status",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.status")}),E.jsxs("select",{id:"status",value:_,onChange:X=>A(Number(X.target.value)),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[E.jsx("option",{value:qe.Draft,children:l("articleEditor.statusDraft")}),E.jsx("option",{value:qe.Published,children:l("articleEditor.statusPublished")}),E.jsx("option",{value:qe.Archived,children:l("articleEditor.statusArchived")}),E.jsx("option",{value:qe.Scheduled,children:l("articleEditor.statusScheduled")}),E.jsx("option",{value:qe.Review,children:l("articleEditor.statusReview")})]})]})]}),E.jsx("div",{className:"col-span-1",children:E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"image",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.featuredImage")}),g?E.jsxs("div",{className:"relative",children:[E.jsx("img",{src:g,alt:"Preview",className:"w-full h-[250px] object-cover rounded-md border border-gray-300 dark:border-gray-600",style:{height:"250px"}}),E.jsx("button",{type:"button",onClick:Ve,className:"absolute top-2 right-2 rounded-full bg-red-600 p-2 text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",disabled:y,style:{top:"2px",right:"2px"},children:E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:E.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})}),y&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 rounded-md",children:E.jsx("span",{className:"text-white text-sm",children:l("articleEditor.uploading")})})]}):E.jsx("div",{className:"flex items-center",children:E.jsx("input",{id:"image",type:"file",accept:"image/*",onChange:_e,disabled:y,className:"block w-full text-sm text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md cursor-pointer bg-white dark:bg-gray-900 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500"})}),W.image&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.image}),E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.imageHint")})]})})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.contentLabel")}),E.jsx(Cm,{value:d,onChange:h,placeholder:l("articleEditor.contentPlaceholder"),error:W.content}),W.content&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.content})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"tags",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.tags")}),E.jsx("input",{id:"tags",type:"text",value:H,onChange:X=>C(X.target.value),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:l("articleEditor.tagsPlaceholder")}),E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.tagsHint")})]}),E.jsxs("div",{className:"space-y-3",children:[E.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.visibility")}),E.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[E.jsx("input",{type:"checkbox",checked:F,onChange:X=>ae(X.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),E.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:l("articleEditor.visibleToAll")})]}),!F&&E.jsx("div",{className:"ml-6 space-y-2",children:U?E.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("articleEditor.loadingRoles")}):Y.length>0?E.jsxs("div",{className:"space-y-2",children:[E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.selectRolesHint")}),Y.map(X=>E.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[E.jsx("input",{type:"checkbox",checked:V.has(X.slug),onChange:()=>k(X.slug),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),E.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:X.name})]},X.slug))]}):E.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("articleEditor.noRolesAvailable")})})]}),E.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[E.jsx("button",{type:"button",onClick:s,disabled:a,className:"rounded-md border border-gray-300 dark:border-gray-600 px-6 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50",children:l("common.cancel")}),E.jsx("button",{type:"submit",disabled:a,className:"rounded-md bg-blue-600 px-6 py-2 text-white hover:bg-blue-700 disabled:opacity-50",children:l(a?"common.saving":e?"articleEditor.updateArticle":"articleEditor.createArticle")})]})]})}function _2({mode:e,articleId:t,isOpen:n,onSuccess:r,onClose:i}){const{articleApi:s}=Jr(),{t:a}=Pt(),[o,l]=$.useState(""),[c,u]=$.useState(!1),[d,h]=$.useState(!1),[f,p]=$.useState(null),[g,b]=$.useState(""),y=()=>o.trim()?o.trim().length<10?(p(a("validation.promptMinLength")),!1):o.length>2e3?(p(a("validation.promptMaxLength")),!1):!0:(p(a("validation.promptRequired")),!1),w=async()=>{if(y()){if(e==="update"&&!t){p(a("validation.articleIdRequired"));return}h(!0),p(null),b(a(e==="create"?"aiGenerator.creatingWithAI":"aiGenerator.updatingWithAI"));try{const N={...e==="update"&&t&&{articleId:t},prompt:o.trim(),generateImage:c};c&&b(a("aiGenerator.generatingContentImage"));let D;e==="create"?D=await s.createArticleWithAI(N):D=await s.updateArticleWithAI(N),b(""),r(D),l(""),u(!1),i()}catch(N){console.error("Error generating article with AI:",N),p(N.message||a("aiGenerator.generationFailed")),b("")}finally{h(!1)}}},_=()=>{d||(l(""),u(!1),p(null),i())},A=a(e==="create"?"aiGenerator.createPlaceholder":"aiGenerator.updatePlaceholder"),O=()=>{const N="w-full rounded-md border px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",D=f&&!o.trim()?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600";return`${N} ${D}`};return n?E.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto","aria-labelledby":"modal-title",role:"dialog","aria-modal":"true",children:E.jsxs("div",{className:"flex min-h-screen items-center justify-center p-4 text-center sm:p-0",children:[E.jsx("div",{className:"fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-75 dark:bg-opacity-75 transition-opacity",onClick:_}),E.jsxs("div",{className:"relative transform overflow-hidden rounded-lg bg-white dark:bg-gray-800 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-2xl",children:[E.jsxs("div",{className:"bg-white dark:bg-gray-800 px-6 pb-4 pt-5",children:[E.jsxs("div",{className:"flex items-start justify-between mb-4",children:[E.jsxs("div",{className:"flex items-start gap-3",children:[E.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900",children:E.jsx("svg",{className:"h-6 w-6 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),E.jsxs("div",{children:[E.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",id:"modal-title",children:a(e==="create"?"aiGenerator.createTitle":"aiGenerator.updateTitle")}),E.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:a(e==="create"?"aiGenerator.createDescription":"aiGenerator.updateDescription")})]})]}),E.jsxs("button",{type:"button",onClick:_,disabled:d,className:"rounded-md text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 disabled:opacity-50",children:[E.jsx("span",{className:"sr-only",children:a("common.close")}),E.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]})]}),E.jsxs("div",{className:"space-y-4",children:[E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"prompt",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:a("aiGenerator.descriptionLabel")}),E.jsx("textarea",{id:"prompt",value:o,onChange:N=>l(N.target.value),rows:6,disabled:d,className:O(),placeholder:A,minLength:10,maxLength:2e3}),E.jsxs("div",{className:"flex justify-between items-center",children:[E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a("aiGenerator.characterCount",{count:o.length})}),f&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})]})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[E.jsx("input",{type:"checkbox",checked:c,onChange:N=>u(N.target.checked),disabled:d,className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"}),E.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:a("aiGenerator.generateImage")})]}),E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-6",children:a("aiGenerator.generateImageHint")})]}),d&&g&&E.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-800 bg-yellow-50 dark:bg-yellow-900/20 p-4",children:E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsxs("svg",{className:"h-5 w-5 text-yellow-600 dark:text-yellow-400 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[E.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),E.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),E.jsxs("div",{children:[E.jsx("p",{className:"text-sm font-medium text-yellow-900 dark:text-yellow-100",children:g}),E.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:a("common.pleaseWait")})]})]})})]})]}),E.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 px-6 py-4 flex justify-end gap-3",children:[E.jsx("button",{type:"button",onClick:_,disabled:d,className:"rounded-md border border-gray-300 dark:border-gray-600 px-6 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:a("common.cancel")}),E.jsx("button",{type:"button",onClick:w,disabled:d||o.trim().length<10,className:"rounded-md bg-gradient-to-r from-blue-600 to-purple-600 px-6 py-2 text-white hover:from-blue-700 hover:to-purple-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:d?E.jsxs(E.Fragment,{children:[E.jsxs("svg",{className:"h-4 w-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[E.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),E.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),E.jsx("span",{children:a("aiGenerator.generating")})]}):E.jsxs(E.Fragment,{children:[E.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),E.jsx("span",{children:a(e==="create"?"aiGenerator.createWithAI":"aiGenerator.updateWithAI")})]})})]})]})]})}):null}function k2({value:e,onChange:t,placeholder:n,label:r,error:i,minHeight:s="400px"}){const{t:a}=Pt(),[o,l]=$.useState("edit"),c=n||a("markdownEditor.placeholder");return E.jsxs("div",{className:"space-y-2",children:[r&&E.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:r}),E.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-900",children:[E.jsxs("div",{className:"flex border-b border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",children:[E.jsx("button",{type:"button",onClick:()=>l("edit"),className:`flex-1 px-4 py-2 text-sm font-medium ${o==="edit"?"border-b-2 border-blue-600 bg-white dark:bg-gray-900 text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,children:a("markdownEditor.editTab")}),E.jsx("button",{type:"button",onClick:()=>l("preview"),className:`flex-1 px-4 py-2 text-sm font-medium ${o==="preview"?"border-b-2 border-blue-600 bg-white dark:bg-gray-900 text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,children:a("markdownEditor.previewTab")})]}),E.jsx("div",{style:{minHeight:s},children:o==="edit"?E.jsx("textarea",{value:e,onChange:u=>t(u.target.value),placeholder:c,className:"h-full w-full resize-none border-0 p-4 font-mono text-sm bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-0",style:{minHeight:s}}):E.jsx("div",{className:"prose dark:prose-invert max-w-none p-4 text-gray-900 dark:text-gray-100",children:e?E.jsx(sp,{remarkPlugins:[Dp],rehypePlugins:[yg],children:e}):E.jsx("div",{className:"text-gray-400 dark:text-gray-500",children:a("markdownEditor.nothingToPreview")})})})]}),i&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:i}),E.jsxs("div",{className:"rounded-md bg-gray-50 dark:bg-gray-800 p-3 text-xs text-gray-600 dark:text-gray-400",children:[E.jsx("p",{className:"font-medium",children:a("markdownEditor.syntaxHelp")}),E.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2",children:[E.jsxs("div",{children:[E.jsx("strong",{children:"# Heading 1"})," - ",a("markdownEditor.heading1")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"## Heading 2"})," - ",a("markdownEditor.heading2")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"**bold text**"})," - ",a("markdownEditor.bold")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"*italic text*"})," - ",a("markdownEditor.italic")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"[link](url)"})," - ",a("markdownEditor.link")]}),E.jsxs("div",{children:[E.jsx("strong",{children:""})," - ",a("markdownEditor.image")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"- item"})," - ",a("markdownEditor.bulletList")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"1. item"})," - ",a("markdownEditor.numberedList")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"`code`"})," - ",a("markdownEditor.inlineCode")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"```language```"})," - ",a("markdownEditor.codeBlock")]})]})]})]})}/**
|
|
187
|
+
`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ar(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&js.assertOptions(r,{silentJSONParsing:rn.transitional(rn.boolean),forcedJSONParsing:rn.transitional(rn.boolean),clarifyTimeoutError:rn.transitional(rn.boolean)},!1),i!=null&&(L.isFunction(i)?n.paramsSerializer={serialize:i}:js.assertOptions(i,{encode:rn.function,serialize:rn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),js.assertOptions(n,{baseUrl:rn.spelling("baseURL"),withXsrfToken:rn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&L.merge(s.common,s[n.method]);s&&L.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),n.headers=yt.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(l=l&&g.synchronous,o.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,h;if(!l){const p=[ih.bind(this),void 0];for(p.unshift(...o),p.push(...c),h=p.length,u=Promise.resolve(n);d<h;)u=u.then(p[d++],p[d++]);return u}h=o.length;let f=n;for(;d<h;){const p=o[d++],g=o[d++];try{f=p(f)}catch(b){g.call(this,b);break}}try{u=ih.call(this,f)}catch(p){return Promise.reject(p)}for(d=0,h=c.length;d<h;)u=u.then(c[d++],c[d++]);return u}getUri(t){t=ar(this.defaults,t);const n=Vm(t.baseURL,t.url,t.allowAbsoluteUrls);return jm(n,t.params,t.paramsSerializer)}};L.forEach(["delete","get","head","options"],function(t){er.prototype[t]=function(n,r){return this.request(ar(r||{},{method:t,url:n,data:(r||{}).data}))}});L.forEach(["post","put","patch"],function(t){function n(r){return function(s,a,o){return this.request(ar(o||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}er.prototype[t]=n(),er.prototype[t+"Form"]=n(!0)});let y2=class Jm{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(o=>{r.subscribe(o),s=o}).then(i);return a.cancel=function(){r.unsubscribe(s)},a},t(function(s,a,o){r.reason||(r.reason=new Xr(s,a,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Jm(function(i){t=i}),cancel:t}}};function x2(e){return function(n){return e.apply(null,n)}}function E2(e){return L.isObject(e)&&e.isAxiosError===!0}const ec={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ec).forEach(([e,t])=>{ec[t]=e});function Qm(e){const t=new er(e),n=Om(er.prototype.request,t);return L.extend(n,er.prototype,t,{allOwnKeys:!0}),L.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Qm(ar(e,i))},n}const Me=Qm(ns);Me.Axios=er;Me.CanceledError=Xr;Me.CancelToken=y2;Me.isCancel=Gm;Me.VERSION=Xm;Me.toFormData=Da;Me.AxiosError=fe;Me.Cancel=Me.CanceledError;Me.all=function(t){return Promise.all(t)};Me.spread=x2;Me.isAxiosError=E2;Me.mergeConfig=ar;Me.AxiosHeaders=yt;Me.formToJSON=e=>Hm(L.isHTMLForm(e)?new FormData(e):e);Me.getAdapter=Zm.getAdapter;Me.HttpStatusCode=ec;Me.default=Me;const{Axios:aP,AxiosError:oP,CanceledError:lP,isCancel:cP,CancelToken:uP,VERSION:dP,all:fP,Cancel:hP,isAxiosError:pP,spread:gP,toFormData:mP,AxiosHeaders:bP,HttpStatusCode:yP,formToJSON:xP,getAdapter:EP,mergeConfig:wP}=Me,ot={ARTICLES:"/article",ARTICLES_FILTER:"/article/filter",ARTICLE_BY_ID:e=>`/article/${e}`,IMAGE_UPLOAD:"/Image/uploadImage",INSERT_WITH_AI:"/article/insertWithAI",UPDATE_WITH_AI:"/article/updateWithAI"};class eb{constructor(t){this.client=t}async uploadImage(t){const n=new FormData;n.append("file",t),console.log("[ArticleAPI] uploadImage - Request:",{fileName:t.name,fileSize:t.size});const r=await this.client.post(ot.IMAGE_UPLOAD,n,{headers:{"Content-Type":"multipart/form-data"}});return console.log("[ArticleAPI] uploadImage - Response:",r.data),r.data}async listArticles(t,n=1,r=10){const i={page:n,pageSize:r};t&&(i.categoryId=t),console.log("[ArticleAPI] listArticles - Request:",{url:ot.ARTICLES,params:i});const s=await this.client.get(ot.ARTICLES,{params:i});return console.log("[ArticleAPI] listArticles - Response:",s.data),this.transformArticleDates(s.data)}async filterArticles(t,n,r=1,i=10){const s={page:r,pageSize:i};t&&t.length>0&&(s.roles=t.join(",")),n!==void 0&&(s.parentId=n);const a=await this.client.get(ot.ARTICLES_FILTER,{params:s});return this.transformArticleDates(a.data)}async getArticleById(t){const n=await this.client.get(ot.ARTICLE_BY_ID(t));return this.transformArticleDate(n.data)}async createArticle(t){console.log("[ArticleAPI] createArticle - Request:",{url:ot.ARTICLES,data:t});const n=await this.client.post(ot.ARTICLES,t);return console.log("[ArticleAPI] createArticle - Response:",n.data),this.transformArticleDate(n.data)}async updateArticle(t){console.log("[ArticleAPI] updateArticle - Request:",{url:ot.ARTICLES,data:t});const n=await this.client.put(ot.ARTICLES,t);return console.log("[ArticleAPI] updateArticle - Response:",n.data),this.transformArticleDate(n.data)}async deleteArticle(t){console.log("[ArticleAPI] deleteArticle - Request:",{id:t,url:ot.ARTICLE_BY_ID(t)}),await this.client.delete(ot.ARTICLE_BY_ID(t)),console.log("[ArticleAPI] deleteArticle - Success")}async createArticleWithAI(t){console.log("[ArticleAPI] createArticleWithAI - Request:",{url:ot.INSERT_WITH_AI,data:t});const n=await this.client.post(ot.INSERT_WITH_AI,t);return console.log("[ArticleAPI] createArticleWithAI - Response:",n.data),this.transformArticleDate(n.data)}async updateArticleWithAI(t){if(!t.articleId)throw new Error("articleId is required for updateWithAI");console.log("[ArticleAPI] updateArticleWithAI - Request:",{url:ot.UPDATE_WITH_AI,data:t});const n=await this.client.put(ot.UPDATE_WITH_AI,t);return console.log("[ArticleAPI] updateArticleWithAI - Response:",n.data),this.transformArticleDate(n.data)}transformArticleDate(t){return{...t,dateAt:t.dateAt?new Date(t.dateAt):void 0,createdAt:t.createdAt?new Date(t.createdAt):void 0,updatedAt:t.updatedAt?new Date(t.updatedAt):void 0,category:t.category?{...t.category,createdAt:t.category.createdAt?new Date(t.category.createdAt):void 0,updatedAt:t.category.updatedAt?new Date(t.category.updatedAt):void 0}:void 0}}transformArticleDates(t){return{...t,items:t.items.map(n=>this.transformArticleDate(n))}}}const sn={CATEGORIES:"/category",CATEGORIES_FILTER:"/category/filter",CATEGORY_BY_ID:e=>`/category/${e}`};class tb{constructor(t){this.client=t}async listCategories(){console.log("[CategoryAPI] listCategories - Request:",{url:sn.CATEGORIES});const t=await this.client.get(sn.CATEGORIES);return console.log("[CategoryAPI] listCategories - Response:",t.data),this.transformCategoryDates(t.data)}async filterCategories(t,n){const r={};t&&t.length>0&&(r.roles=t.join(",")),n!==void 0&&(r.parentId=n);const i=await this.client.get(sn.CATEGORIES_FILTER,{params:r});return this.transformCategoryDates(i.data)}async getCategoryById(t){const n=await this.client.get(sn.CATEGORY_BY_ID(t));return this.transformCategoryDate(n.data)}async createCategory(t){console.log("[CategoryAPI] createCategory - Request:",{url:sn.CATEGORIES,data:t});const n=await this.client.post(sn.CATEGORIES,t);return console.log("[CategoryAPI] createCategory - Response:",n.data),this.transformCategoryDate(n.data)}async updateCategory(t){console.log("[CategoryAPI] updateCategory - Request:",{url:sn.CATEGORIES,data:t});const n=await this.client.put(sn.CATEGORIES,t);return console.log("[CategoryAPI] updateCategory - Response:",n.data),this.transformCategoryDate(n.data)}async deleteCategory(t){console.log("[CategoryAPI] deleteCategory - Request:",{id:t,url:sn.CATEGORY_BY_ID(t)}),await this.client.delete(sn.CATEGORY_BY_ID(t)),console.log("[CategoryAPI] deleteCategory - Success")}transformCategoryDate(t){return{...t,createdAt:t.createdAt?new Date(t.createdAt):void 0,updatedAt:t.updatedAt?new Date(t.updatedAt):void 0}}transformCategoryDates(t){return t.map(n=>this.transformCategoryDate(n))}}const zt={TAGS:"/tag",TAG_BY_ID:e=>`/tag/${e}`,TAG_MERGE:(e,t)=>`/Tag/merge/${e}/${t}`};class nb{constructor(t){this.client=t}async listTags(){console.log("[TagAPI] listTags - Request:",{url:zt.TAGS});const t=await this.client.get(zt.TAGS);return console.log("[TagAPI] listTags - Response:",t.data),t.data}async getTagById(t){console.log("[TagAPI] getTagById - Request:",{id:t,url:zt.TAG_BY_ID(t)});const n=await this.client.get(zt.TAG_BY_ID(t));return console.log("[TagAPI] getTagById - Response:",n.data),n.data}async createTag(t){console.log("[TagAPI] createTag - Request:",{url:zt.TAGS,data:t});const n=await this.client.post(zt.TAGS,t);return console.log("[TagAPI] createTag - Response:",n.data),n.data}async updateTag(t){console.log("[TagAPI] updateTag - Request:",{url:zt.TAGS,data:t});const n=await this.client.put(zt.TAGS,t);return console.log("[TagAPI] updateTag - Response:",n.data),n.data}async deleteTag(t){console.log("[TagAPI] deleteTag - Request:",{id:t,url:zt.TAG_BY_ID(t)}),await this.client.delete(zt.TAG_BY_ID(t)),console.log("[TagAPI] deleteTag - Success")}async mergeTags(t,n){const r=zt.TAG_MERGE(t,n);console.log("[TagAPI] mergeTags - Request:",{url:r,sourceTagId:t,targetTagId:n}),await this.client.post(r),console.log("[TagAPI] mergeTags - Success")}}const rb=$.createContext(void 0);function w2({config:e,children:t}){const n=$.useMemo(()=>Eh(e.language,e.translations),[e.language,e.translations]),r=$.useRef(e.language);$.useEffect(()=>{e.language&&e.language!==r.current&&(n.changeLanguage(e.language),r.current=e.language)},[e.language,n]);const i=$.useRef(e);$.useEffect(()=>{var a;i.current=e,console.log("[NNews] Config updated:",{apiUrl:e.apiUrl,hasAuthHeader:!!((a=e.headers)!=null&&a.Authorization)})},[e]);const s=$.useMemo(()=>{const a=e.apiClient||Me.create({baseURL:e.apiUrl,headers:{"Content-Type":"application/json"}});a.interceptors.request.use(u=>{var h,f,p,g;const d=i.current;return d.headers&&Object.entries(d.headers).forEach(([b,y])=>{y&&u.headers.set(b,y)}),d.tenantId&&u.headers.set("X-Tenant-Id",d.tenantId),console.log("[NNews] Request interceptor:",{method:(h=u.method)==null?void 0:h.toUpperCase(),url:`${u.baseURL||""}${u.url||""}`,headers:{Authorization:((f=u.headers)==null?void 0:f.Authorization)||"(not set)","Content-Type":((p=u.headers)==null?void 0:p["Content-Type"])||"(not set)","X-Tenant-Id":((g=u.headers)==null?void 0:g["X-Tenant-Id"])||"(not set)"}}),u});const o=new eb(a),l=new tb(a),c=new nb(a);return{config:e,apiClient:a,articleApi:o,categoryApi:l,tagApi:c}},[e.apiUrl,e.apiClient,e.tenantId]);return E.jsx(_y,{i18n:n,children:E.jsx(rb.Provider,{value:s,children:t})})}function Jr(){const e=$.useContext(rb);if(!e)throw new Error("useNNews must be used within a NNewsProvider");return e}function v2({article:e,categories:t=[],availableRoles:n,onFetchRoles:r,onSave:i,onCancel:s,loading:a=!1}){const{articleApi:o}=Jr(),{t:l}=Pt(),[c,u]=$.useState(""),[d,h]=$.useState(""),[f,p]=$.useState(""),[g,b]=$.useState(""),[y,w]=$.useState(!1),[_,A]=$.useState(qe.Draft),[O,N]=$.useState(null),[D,q]=$.useState(""),[H,C]=$.useState(""),[F,M]=$.useState(!0),[V,z]=$.useState(new Set),[Z,I]=$.useState([]),[U,j]=$.useState(!1),[W,v]=$.useState({});$.useEffect(()=>{var X;e&&(u(e.title),h(e.content),p(e.imageName||""),console.log("imageName:",e.imageName),e.imageName&&b(e.imageName),A(e.status),N(e.categoryId||null),q(e.dateAt?new Date(e.dateAt).toISOString().slice(0,16):""),C(((X=e.tags)==null?void 0:X.map(ye=>ye.title).join(", "))||""),e.roles&&e.roles.length>0?(M(!1),z(new Set(e.roles.map(ye=>ye.slug)))):(M(!0),z(new Set)))},[e]);const Y=n||Z;$.useEffect(()=>{if(n&&n.length>0||!r)return;let X=!1;return j(!0),r().then(ye=>{X||I(ye)}).catch(ye=>{console.warn("Failed to fetch roles:",ye)}).finally(()=>{X||j(!1)}),()=>{X=!0}},[n,r]);const ae=$.useCallback(X=>{M(X),X&&z(new Set)},[]),k=$.useCallback(X=>{z(ye=>{const Se=new Set(ye);return Se.has(X)?Se.delete(X):Se.add(X),Se})},[]),de=()=>{const X={};return c.trim()||(X.title=l("validation.titleRequired")),d.trim()||(X.content=l("validation.contentRequired")),v(X),Object.keys(X).length===0},re=async X=>{if(X.preventDefault(),!de())return;const ye=F?[]:Array.from(V),Se={title:c.trim(),content:d.trim(),imageName:f||void 0,status:_,categoryId:O||void 0,dateAt:D||void 0,tagList:H.trim()||void 0,roles:ye.length>0?ye:void 0};e?await i({articleId:e.articleId,...Se}):await i(Se)},_e=async X=>{var je;const ye=(je=X.target.files)==null?void 0:je[0];if(!ye)return;if(!ye.type.startsWith("image/")){v({...W,image:l("validation.imageFileType")});return}if(ye.size>5*1024*1024){v({...W,image:l("validation.imageSizeLimit")});return}v({...W,image:""});const Se=new FileReader;Se.onloadend=()=>{b(Se.result)},Se.readAsDataURL(ye);try{w(!0);const it=await o.uploadImage(ye);p(it),v({...W,image:""})}catch(it){console.error("Error uploading image:",it),v({...W,image:l("validation.imageUploadFailed")})}finally{w(!1)}},Ve=()=>{b(""),p("")};return E.jsxs("form",{onSubmit:re,className:"space-y-6",children:[E.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[E.jsxs("div",{className:"col-span-2 p-4",children:[E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"title",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("common.titleRequired")}),E.jsx("input",{id:"title",type:"text",value:c,onChange:X=>u(X.target.value),className:`w-full rounded-md border ${W.title?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500`,placeholder:l("articleEditor.enterTitle")}),W.title&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.title})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"dateAt",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.publicationDate")}),E.jsx("input",{id:"dateAt",type:"datetime-local",value:D,onChange:X=>q(X.target.value),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"category",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.category")}),E.jsxs("select",{id:"category",value:O||"",onChange:X=>N(X.target.value?Number(X.target.value):null),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[E.jsx("option",{value:"",children:l("common.noCategory")}),t.map(X=>E.jsx("option",{value:X.categoryId,children:X.title},X.categoryId))]})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"status",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.status")}),E.jsxs("select",{id:"status",value:_,onChange:X=>A(Number(X.target.value)),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[E.jsx("option",{value:qe.Draft,children:l("articleEditor.statusDraft")}),E.jsx("option",{value:qe.Published,children:l("articleEditor.statusPublished")}),E.jsx("option",{value:qe.Archived,children:l("articleEditor.statusArchived")}),E.jsx("option",{value:qe.Scheduled,children:l("articleEditor.statusScheduled")}),E.jsx("option",{value:qe.Review,children:l("articleEditor.statusReview")})]})]})]}),E.jsx("div",{className:"col-span-1",children:E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"image",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.featuredImage")}),g?E.jsxs("div",{className:"relative",children:[E.jsx("img",{src:g,alt:"Preview",className:"w-full h-[250px] object-cover rounded-md border border-gray-300 dark:border-gray-600",style:{height:"250px"}}),E.jsx("button",{type:"button",onClick:Ve,className:"absolute top-2 right-2 rounded-full bg-red-600 p-2 text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",disabled:y,style:{top:"2px",right:"2px"},children:E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:E.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})}),y&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 rounded-md",children:E.jsx("span",{className:"text-white text-sm",children:l("articleEditor.uploading")})})]}):E.jsx("div",{className:"flex items-center",children:E.jsx("input",{id:"image",type:"file",accept:"image/*",onChange:_e,disabled:y,className:"block w-full text-sm text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md cursor-pointer bg-white dark:bg-gray-900 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500"})}),W.image&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.image}),E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.imageHint")})]})})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.contentLabel")}),E.jsx(Cm,{value:d,onChange:h,placeholder:l("articleEditor.contentPlaceholder"),error:W.content}),W.content&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.content})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"tags",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.tags")}),E.jsx("input",{id:"tags",type:"text",value:H,onChange:X=>C(X.target.value),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:l("articleEditor.tagsPlaceholder")}),E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.tagsHint")})]}),E.jsxs("div",{className:"space-y-3",children:[E.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.visibility")}),E.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[E.jsx("input",{type:"checkbox",checked:F,onChange:X=>ae(X.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),E.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:l("articleEditor.visibleToAll")})]}),!F&&E.jsx("div",{className:"ml-6 space-y-2",children:U?E.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("articleEditor.loadingRoles")}):Y.length>0?E.jsxs("div",{className:"space-y-2",children:[E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.selectRolesHint")}),Y.map(X=>E.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[E.jsx("input",{type:"checkbox",checked:V.has(X.slug),onChange:()=>k(X.slug),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),E.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:X.name})]},X.slug))]}):E.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("articleEditor.noRolesAvailable")})})]}),E.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[E.jsx("button",{type:"button",onClick:s,disabled:a,className:"rounded-md border border-gray-300 dark:border-gray-600 px-6 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50",children:l("common.cancel")}),E.jsx("button",{type:"submit",disabled:a,className:"rounded-md bg-blue-600 px-6 py-2 text-white hover:bg-blue-700 disabled:opacity-50",children:l(a?"common.saving":e?"articleEditor.updateArticle":"articleEditor.createArticle")})]})]})}function _2({mode:e,articleId:t,isOpen:n,onSuccess:r,onClose:i}){const{articleApi:s}=Jr(),{t:a}=Pt(),[o,l]=$.useState(""),[c,u]=$.useState(!1),[d,h]=$.useState(!1),[f,p]=$.useState(null),[g,b]=$.useState(""),y=()=>o.trim()?o.trim().length<10?(p(a("validation.promptMinLength")),!1):o.length>2e3?(p(a("validation.promptMaxLength")),!1):!0:(p(a("validation.promptRequired")),!1),w=async()=>{if(y()){if(e==="update"&&!t){p(a("validation.articleIdRequired"));return}h(!0),p(null),b(a(e==="create"?"aiGenerator.creatingWithAI":"aiGenerator.updatingWithAI"));try{const N={...e==="update"&&t&&{articleId:t},prompt:o.trim(),generateImage:c};c&&b(a("aiGenerator.generatingContentImage"));let D;e==="create"?D=await s.createArticleWithAI(N):D=await s.updateArticleWithAI(N),b(""),r(D),l(""),u(!1),i()}catch(N){console.error("Error generating article with AI:",N),p(N.message||a("aiGenerator.generationFailed")),b("")}finally{h(!1)}}},_=()=>{d||(l(""),u(!1),p(null),i())},A=a(e==="create"?"aiGenerator.createPlaceholder":"aiGenerator.updatePlaceholder"),O=()=>{const N="w-full rounded-md border px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",D=f&&!o.trim()?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600";return`${N} ${D}`};return n?E.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto","aria-labelledby":"modal-title",role:"dialog","aria-modal":"true",children:E.jsxs("div",{className:"flex min-h-screen items-center justify-center p-4 text-center sm:p-0",children:[E.jsx("div",{className:"fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-75 dark:bg-opacity-75 transition-opacity",onClick:_}),E.jsxs("div",{className:"relative transform overflow-hidden rounded-lg bg-white dark:bg-gray-800 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-2xl",children:[E.jsxs("div",{className:"bg-white dark:bg-gray-800 px-6 pb-4 pt-5",children:[E.jsxs("div",{className:"flex items-start justify-between mb-4",children:[E.jsxs("div",{className:"flex items-start gap-3",children:[E.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900",children:E.jsx("svg",{className:"h-6 w-6 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),E.jsxs("div",{children:[E.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",id:"modal-title",children:a(e==="create"?"aiGenerator.createTitle":"aiGenerator.updateTitle")}),E.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:a(e==="create"?"aiGenerator.createDescription":"aiGenerator.updateDescription")})]})]}),E.jsxs("button",{type:"button",onClick:_,disabled:d,className:"rounded-md text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 disabled:opacity-50",children:[E.jsx("span",{className:"sr-only",children:a("common.close")}),E.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]})]}),E.jsxs("div",{className:"space-y-4",children:[E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{htmlFor:"prompt",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:a("aiGenerator.descriptionLabel")}),E.jsx("textarea",{id:"prompt",value:o,onChange:N=>l(N.target.value),rows:6,disabled:d,className:O(),placeholder:A,minLength:10,maxLength:2e3}),E.jsxs("div",{className:"flex justify-between items-center",children:[E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a("aiGenerator.characterCount",{count:o.length})}),f&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})]})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[E.jsx("input",{type:"checkbox",checked:c,onChange:N=>u(N.target.checked),disabled:d,className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"}),E.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:a("aiGenerator.generateImage")})]}),E.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-6",children:a("aiGenerator.generateImageHint")})]}),d&&g&&E.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-800 bg-yellow-50 dark:bg-yellow-900/20 p-4",children:E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsxs("svg",{className:"h-5 w-5 text-yellow-600 dark:text-yellow-400 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[E.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),E.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),E.jsxs("div",{children:[E.jsx("p",{className:"text-sm font-medium text-yellow-900 dark:text-yellow-100",children:g}),E.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:a("common.pleaseWait")})]})]})})]})]}),E.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 px-6 py-4 flex justify-end gap-3",children:[E.jsx("button",{type:"button",onClick:_,disabled:d,className:"rounded-md border border-gray-300 dark:border-gray-600 px-6 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:a("common.cancel")}),E.jsx("button",{type:"button",onClick:w,disabled:d||o.trim().length<10,className:"rounded-md bg-gradient-to-r from-blue-600 to-purple-600 px-6 py-2 text-white hover:from-blue-700 hover:to-purple-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:d?E.jsxs(E.Fragment,{children:[E.jsxs("svg",{className:"h-4 w-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[E.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),E.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),E.jsx("span",{children:a("aiGenerator.generating")})]}):E.jsxs(E.Fragment,{children:[E.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),E.jsx("span",{children:a(e==="create"?"aiGenerator.createWithAI":"aiGenerator.updateWithAI")})]})})]})]})]})}):null}function k2({value:e,onChange:t,placeholder:n,label:r,error:i,minHeight:s="400px"}){const{t:a}=Pt(),[o,l]=$.useState("edit"),c=n||a("markdownEditor.placeholder");return E.jsxs("div",{className:"space-y-2",children:[r&&E.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:r}),E.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-900",children:[E.jsxs("div",{className:"flex border-b border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",children:[E.jsx("button",{type:"button",onClick:()=>l("edit"),className:`flex-1 px-4 py-2 text-sm font-medium ${o==="edit"?"border-b-2 border-blue-600 bg-white dark:bg-gray-900 text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,children:a("markdownEditor.editTab")}),E.jsx("button",{type:"button",onClick:()=>l("preview"),className:`flex-1 px-4 py-2 text-sm font-medium ${o==="preview"?"border-b-2 border-blue-600 bg-white dark:bg-gray-900 text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,children:a("markdownEditor.previewTab")})]}),E.jsx("div",{style:{minHeight:s},children:o==="edit"?E.jsx("textarea",{value:e,onChange:u=>t(u.target.value),placeholder:c,className:"h-full w-full resize-none border-0 p-4 font-mono text-sm bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-0",style:{minHeight:s}}):E.jsx("div",{className:"prose dark:prose-invert max-w-none p-4 text-gray-900 dark:text-gray-100",children:e?E.jsx(sp,{remarkPlugins:[Dp],rehypePlugins:[yg],children:e}):E.jsx("div",{className:"text-gray-400 dark:text-gray-500",children:a("markdownEditor.nothingToPreview")})})})]}),i&&E.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:i}),E.jsxs("div",{className:"rounded-md bg-gray-50 dark:bg-gray-800 p-3 text-xs text-gray-600 dark:text-gray-400",children:[E.jsx("p",{className:"font-medium",children:a("markdownEditor.syntaxHelp")}),E.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2",children:[E.jsxs("div",{children:[E.jsx("strong",{children:"# Heading 1"})," - ",a("markdownEditor.heading1")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"## Heading 2"})," - ",a("markdownEditor.heading2")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"**bold text**"})," - ",a("markdownEditor.bold")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"*italic text*"})," - ",a("markdownEditor.italic")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"[link](url)"})," - ",a("markdownEditor.link")]}),E.jsxs("div",{children:[E.jsx("strong",{children:""})," - ",a("markdownEditor.image")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"- item"})," - ",a("markdownEditor.bulletList")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"1. item"})," - ",a("markdownEditor.numberedList")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"`code`"})," - ",a("markdownEditor.inlineCode")]}),E.jsxs("div",{children:[E.jsx("strong",{children:"```language```"})," - ",a("markdownEditor.codeBlock")]})]})]})]})}/**
|
|
188
188
|
* @license lucide-react v0.462.0 - ISC
|
|
189
189
|
*
|
|
190
190
|
* This source code is licensed under the ISC license.
|