1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[529],{38559:(t,e,s)=>{s.d(e,{$:()=>o,s:()=>n});var i=s(74268),r=s(69781),a=s(93049),n=class extends r.k{#t;#e;#s;constructor(t){super(),this.mutationId=t.mutationId,this.#e=t.mutationCache,this.#t=[],this.state=t.state||o(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#e.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(t){let e=()=>{this.#i({type:"continue"})};this.#s=(0,a.II)({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#i({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});let s="pending"===this.state.status,i=!this.#s.canStart();try{if(s)e();else{this.#i({type:"pending",variables:t,isPaused:i}),await this.#e.config.onMutate?.(t,this);let e=await this.options.onMutate?.(t);e!==this.state.context&&this.#i({type:"pending",context:e,variables:t,isPaused:i})}let r=await this.#s.start();return await this.#e.config.onSuccess?.(r,t,this.state.context,this),await this.options.onSuccess?.(r,t,this.state.context),await this.#e.config.onSettled?.(r,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(r,null,t,this.state.context),this.#i({type:"success",data:r}),r}catch(e){try{throw await this.#e.config.onError?.(e,t,this.state.context,this),await this.options.onError?.(e,t,this.state.context),await this.#e.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,e,t,this.state.context),e}finally{this.#i({type:"error",error:e})}}finally{this.#e.runNext(this)}}#i(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),i.jG.batch(()=>{this.#t.forEach(e=>{e.onMutationUpdate(t)}),this.#e.notify({mutation:this,type:"updated",action:t})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},41444:(t,e,s)=>{s.d(e,{v:()=>i});let i={log:function(){for(var t=arguments.length,e=Array(t),s=0;s<t;s++)e[s]=arguments[s]},info:function(){for(var t=arguments.length,e=Array(t),s=0;s<t;s++)e[s]=arguments[s]},debug:function(){for(var t=arguments.length,e=Array(t),s=0;s<t;s++)e[s]=arguments[s]},warn:function(){for(var t=arguments.length,e=Array(t),s=0;s<t;s++)e[s]=arguments[s];console.warn(...e)},error:function(){for(var t=arguments.length,e=Array(t),s=0;s<t;s++)e[s]=arguments[s];console.error(...e)}}},51181:(t,e,s)=>{s.d(e,{A:()=>u});var i=s(95155),r=s(12115),a=s(22163),n=s(41444),o=s(72569);function u(t){var e;let{spaceId:s}=t,[u,h]=(0,r.useState)(""),[c,l]=(0,r.useState)(!1),[d,p]=(0,r.useState)(null),{data:m={tags:[]},isLoading:g,error:y,refetch:f}=(0,a.PL)(s),b=Array.isArray(null==m?void 0:m.tags)?m.tags:Array.isArray(m)?m:[],v=async t=>{if(t.preventDefault(),u.trim()){l(!0),p(null);try{let t=await fetch("/api/cms/tags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:u,spaceId:s})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||"Failed to create tag: ".concat(t.statusText))}h(""),f(),n.v.log('Tag "'.concat(u,'" created successfully.'))}catch(t){n.v.error("Error creating tag:",t),p((0,o.u)(t)||"Failed to create tag.")}finally{l(!1)}}};return(0,i.jsxs)("div",{className:"space-y-8",children:[(0,i.jsxs)("div",{className:"p-6 bg-white dark:bg-gray-800 rounded-lg shadow-md",children:[(0,i.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"Create New Tag"}),(0,i.jsxs)("form",{onSubmit:v,className:"flex items-end space-x-3",children:[(0,i.jsxs)("div",{className:"flex-grow",children:[(0,i.jsx)("label",{htmlFor:"new-tag-name",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Tag Name"}),(0,i.jsx)("input",{type:"text",id:"new-tag-name",value:u,onChange:t=>h(t.target.value),placeholder:"e.g., Featured Post",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-700 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-900",required:!0,disabled:c})]}),(0,i.jsx)("button",{type:"submit",disabled:c||!u.trim(),className:"bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 roun
1ded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:c?"Creating...":"Create Tag"})]}),d&&(0,i.jsx)("p",{className:"text-red-600 mt-2 text-sm",children:d})]}),(0,i.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden",children:[(0,i.jsx)("h2",{className:"text-xl font-semibold p-6 border-b border-gray-200 dark:border-gray-700",children:"Existing Tags"}),g&&(0,i.jsx)("p",{className:"p-6 text-gray-500",children:"Loading tags..."}),y&&(0,i.jsxs)("p",{className:"p-6 text-red-600",children:["Error loading tags:"," ",null!=(e=y.message)?e:String(y)]}),!g&&!y&&0===b.length&&(0,i.jsx)("p",{className:"p-6 text-gray-500",children:"No tags created yet for this space."}),!g&&!y&&b.length>0&&(0,i.jsx)("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:b.map(t=>(0,i.jsxs)("li",{className:"px-6 py-4 flex justify-between items-center",children:[(0,i.jsx)("span",{className:"text-gray-900 dark:text-white",children:t.name}),(0,i.jsxs)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:["/",t.slug]})]},t.id))})]})]})}},72569:(t,e,s)=>{s.d(e,{u:()=>i});function i(t){if(t instanceof Error)return t.message;if("string"==typeof t)return t;if(void 0===t)return String(t);try{var e;return null!=(e=JSON.stringify(t))?e:String(t)}catch(e){return String(t)}}},80549:(t,e,s)=>{s.d(e,{n:()=>c});var i=s(12115),r=s(38559),a=s(74268),n=s(38445),o=s(34049),u=class extends n.Q{#r;#a=void 0;#n;#o;constructor(t,e){super(),this.#r=t,this.setOptions(e),this.bindMethods(),this.#u()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#r.defaultMutationOptions(t),(0,o.f8)(this.options,e)||this.#r.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),e?.mutationKey&&this.options.mutationKey&&(0,o.EN)(e.mutationKey)!==(0,o.EN)(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#u(),this.#h(t)}getCurrentResult(){return this.#a}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#u(),this.#h()}mutate(t,e){return this.#o=e,this.#n?.removeObserver(this),this.#n=this.#r.getMutationCache().build(this.#r,this.options),this.#n.addObserver(this),this.#n.execute(t)}#u(){let t=this.#n?.state??(0,r.$)();this.#a={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#h(t){a.jG.batch(()=>{if(this.#o&&this.hasListeners()){let e=this.#a.variables,s=this.#a.context;t?.type==="success"?(this.#o.onSuccess?.(t.data,e,s),this.#o.onSettled?.(t.data,null,e,s)):t?.type==="error"&&(this.#o.onError?.(t.error,e,s),this.#o.onSettled?.(void 0,t.error,e,s))}this.listeners.forEach(t=>{t(this.#a)})})}},h=s(99776);function c(t,e){let s=(0,h.jE)(e),[r]=i.useState(()=>new u(s,t));i.useEffect(()=>{r.setOptions(t)},[r,t]);let n=i.useSyncExternalStore(i.useCallback(t=>r.subscribe(a.jG.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),c=i.useCallback((t,e)=>{r.mutate(t,e).catch(o.lQ)},[r]);if(n.error&&(0,o.GU)(r.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:c,mutateAsync:n.mutate}}}}]);
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.