1import{V as Pr,p as Ar,B as x,a5 as ze,ab as Nr,ac as Dr,q as W,F as z,a9 as O,w as N,T as h,i as u,j as Mr,a7 as jr,an as Or,v as o,d as r,r as t,y as ee,ag as Y,_ as se,ah as V,D as a,c as e,x as k,H as me,o as b,l as K,ae as Ir,G as Ne,aa as ne,J as le,X as nt,a8 as lt,au as Br,t as Fr}from"../chunks/DZLj8Odg.js";import{S as Lr}from"../chunks/BqBNe5Y4.js";import{M as Oe}from"../chunks/s0uLvJJr.js";import{S as it}from"../chunks/nmef8hub.js";import{N as Rr}from"../chunks/CZipazcQ.js";import{p as qr,c as zr}from"../chunks/DTs4VoeO.js";import{u as Hr}from"../chunks/ohkXEA0n.js";import{R as Ht}from"../chunks/CzFNCgaC.js";var Jr=b('<div><!> <button class="ml-auto text-current opacity-50 hover:opacity-100"><!></button></div>'),Gr=b('<div class="mb-4 flex justify-end"><button class="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-brand rounded-lg hover:bg-brand-hover transition-colors"><!> Add Category</button></div>'),Ur=b('<div class="text-center py-12 text-gray-400"><!> <p>No categories yet. Create one to organize your tags.</p></div>'),Wr=b('<button class="inline-flex items-center gap-1 text-xs font-medium text-neutral-500 hover:text-brand transition-colors"><!> Edit</button>'),Yr=b('<button class="inline-flex items-center gap-1 text-xs font-medium text-neutral-500 hover:text-red-600 transition-colors"><!> Delete</button>'),Vr=b('<tr class="hover:bg-gray-50"><td class="px-4 py-3 text-sm text-gray-500"> </td><td class="px-4 py-3 text-center"><!></td><td class="px-4 py-3"><span class="text-sm font-semibold text-gray-900"> </span></td><td class="px-4 py-3"><span class="text-sm text-gray-500"> </span></td><td class="px-4 py-3 text-center"><span class="inline-flex items-center justify-center bg-brand-bg text-brand rounded-full px-2.5 py-0.5 text-xs font-bold"> </span></td><td class="px-4 py-3 text-center"><span class="inline-block w-5 h-5 rounded-full border border-neutral-300"></span></td><td class="px-4 py-3 text-right"><div class="flex items-center justify-end gap-1"><!> <!></div></td></tr>'),Kr=b('<div class="bg-white border border-neutral-300 rounded-lg overflow-hidden"><table class="w-full"><thead class="bg-gray-50 border-b border-neutral-300"><tr><th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Order</th><th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase">Icon</th><th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Name</th><th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Description</th><th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase">Tags</th><th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase">Color</th><th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase">Actions</th></tr></thead><tbody class="divide-y divide-gray-100"></tbody></table></div>'),Qr=b("<!> <!>",1),Xr=b('<div class="bg-white rounded-lg border border-neutral-300 p-4 mb-6"><div class="flex items-center justify-between gap-4"><div class="flex items-center gap-3 min-w-0"><!> <div class="min-w-0"><p class="text-sm font-medium text-gray-900">Product Tagging Model</p> <p class="text-xs text-gray-500 truncate"> </p></div></div> <a href="/admin/ai-settings#module-overrides" class="inline-flex items-center gap-1 text-sm text-brand hover:underline whitespace-nowrap">Change in System Settings <!></a></div></div> <div class="bg-white rounded-lg border border-neutral-300 p-6"><div class="flex items-center gap-3 mb-4"><!> <div><h2 class="text-lg font-semibold text-gray-900">AI Prompt Preview</h2> <p class="text-sm text-gray-500">This is the prompt sent to the AI when tagging product feedback</p></div></div> <div class="bg-gray-900 rounded-lg p-4 overflow-auto max-h-[600px]"><pre class="text-sm text-green-400 whitespace-pre-wrap font-mono"> </pre></div> <div class="mt-4 p-4 bg-brand-bg rounded-lg border border-brand-border"><h3 class="text-sm font-medium text-brand-dark mb-2 flex items-center gap-2"><!> How it works</h3> <ul class="text-xs text-brand space-y-1 list-disc list-inside"><li>The AI receives each product review with its 3 ratings (taste, quality, overall) and product name</li> <li> </li> <li>Each tag gets a sentiment (positive/negative/mixed/neutral) and confidence score</li> <li>The AI also generates a summary, action recommendation, severity, and priority</li> <li>Tags are validated against the database â invalid tag IDs are filtered out</li> <li>AI provider settings are shared with Location Reviews (configured in <a href="/admin/ai-settings" class="underline font-medium">System AI Settings</a>)</li></ul></div></div>',1),Zr=b('<div class="mb-4 flex justify-end gap-2"><button class="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700 transition-colors"><!> Add Tag</button></div>'),ea=b('<input type="text" class="px-2 py-1 text-sm font-semibold border border-brand-border rounded focus:outline-none focus:ring-2 focus:ring-purple-500 bg-white"/>'),ta=b('<span class="text-sm font-semibold text-purple-900"> </span>'),ra=b('<button class="p-1.5 rounded text-green-600 hover:bg-green-100" title="Save"><!></button> <button class="p-1.5 rounded text-gray-400 hover:bg-gray-100" title="Cancel"><!></button>',1),aa=b('<button class="inline-flex items-center gap-1 text-xs font-medium text-neutral-500 hover:text-brand transition-colors"><!> Edit</button> <button class="inline-flex items-center gap-1 text-xs font-medium text-neutral-500 hover:text-red-600 transition-colors"><!> Delete</button>',1),oa=b('<button class="inline-flex items-center gap-1 text-xs font-medium text-neutral-500 hover:text-brand transition-colors"><!> Edit</button>
1'),sa=b('<div class="flex items-center gap-4 px-4 py-3 hover:bg-gray-50"><span class="inline-flex items-center gap-2 rounded-full border px-3 py-1 text-sm font-medium"><span class="w-2 h-2 rounded-full"></span> </span> <span class="flex-1"></span> <div class="flex items-center gap-1"><!></div></div>'),na=b('<div class="divide-y divide-gray-100"></div>'),la=b('<div class="bg-white border border-neutral-300 rounded-lg overflow-hidden"><div class="flex items-center bg-gradient-to-r from-brand-bg to-brand-bg-hover"><button class="flex-1 px-4 py-3 flex items-center gap-3 hover:from-brand-bg-hover hover:to-brand-border transition-colors text-left"><!> <span class="inline-flex items-center justify-center bg-purple-600 text-white rounded-md px-2.5 py-0.5 text-sm font-bold min-w-[32px]"> </span> <!> <!></button> <div class="flex items-center gap-1 pr-3"><!></div></div> <!></div>'),ia=b('<div class="space-y-4"></div>'),da=b("<!> <!>",1),ca=b('<button class="rounded-md bg-white px-4 py-2 text-sm font-semibold text-gray-700 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">Cancel</button> <button class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover disabled:opacity-50"> </button>',1),ua=b('<button type="button"><!> </button>'),va=b('<button type="button"></button>'),ba=b('<div class="space-y-4"><div><label class="block text-sm font-medium text-gray-700 mb-1">Name *</label> <input type="text" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-brand focus:outline-none focus:ring-brand" placeholder="e.g., Quality & Freshness"/></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Description</label> <input type="text" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-brand focus:outline-none focus:ring-brand" placeholder="Tags related to product quality and freshness"/></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Icon</label> <div class="flex flex-wrap gap-2"></div></div> <div class="grid grid-cols-2 gap-4"><div><label class="block text-sm font-medium text-gray-700 mb-1">Sort Order</label> <input type="number" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-brand focus:outline-none focus:ring-brand"/></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Color</label> <div class="flex items-center gap-2"><input type="color" class="w-10 h-10 rounded cursor-pointer border border-neutral-300"/> <div class="flex flex-wrap gap-1"></div></div></div></div></div>'),ga=b('<button class="rounded-md bg-white px-4 py-2 text-sm font-semibold text-gray-700 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">Cancel</button> <button class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover disabled:opacity-50"> </button>',1),pa=b('<button type="button"><!> </button>'),ma=b('<button type="button"></button>'),fa=b('<div class="space-y-4"><div><label class="block text-sm font-medium text-gray-700 mb-1">Name *</label> <input type="text" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-brand focus:outline-none focus:ring-brand"/></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Description</label> <input type="text" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-brand focus:outline-none focus:ring-brand"/></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Icon</label> <div class="flex flex-wrap gap-2"></div></div> <div class="grid grid-cols-2 gap-4"><div><label class="block text-sm font-medium text-gray-700 mb-1">Sort Order</label> <input type="number" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-brand focus:outline-none focus:ring-brand"/></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Color</label> <div class="flex items-center gap-2"><input type="color" class="w-10 h-10 rounded cursor-pointer border border-neutral-300"/> <div class="flex flex-wrap gap-1"></div></div></div></div></div>'),xa=b('<button class="rounded-md bg-white px-4 py-2 text-sm font-semibold text-gray-700 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">Cancel</button> <button class="rounded-md bg-purple-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-bg0 disabled:opacity-50"> </button>',1),ha=b("<option> </option>"),ya=b('<div class="space-y-2"><!> <button type="button" class="text-sm text-brand hover:text-brand font-medium">+ Create new category</button></div>'),_a=b('<div class="space-y-2"><input type="text" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-purple-500 focus:outline-none focus:ring-purple-500" placeholder="Enter new category name"/> <button type="button" class="text-sm text-gray-600 hover:text-gray-700 font-medium">Back to existing</button></div>
1'),wa=b('<button type="button"></button>'),ka=b('<div class="space-y-4"><div><label class="block text-sm font-medium text-gray-700 mb-1">Category *</label> <!></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Tag Name *</label> <input type="text" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-purple-500 focus:outline-none focus:ring-purple-500" placeholder="e.g., Taste Issue"/></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Color</label> <div class="flex items-center gap-3"><input type="color" class="w-10 h-10 rounded cursor-pointer border border-neutral-300"/> <div class="flex flex-wrap gap-1.5"></div></div> <p class="text-xs text-gray-500 mt-2">Preview: <span class="inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium"><span class="w-2 h-2 rounded-full"></span> </span></p></div></div>'),$a=b('<button type="button" class="mr-auto inline-flex items-center gap-1 text-sm font-medium text-red-600 hover:text-red-700 transition-colors"><!> Delete</button>'),Ca=b('<!> <button class="rounded-md bg-white px-4 py-2 text-sm font-semibold text-gray-700 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">Cancel</button> <button class="rounded-md bg-purple-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-bg0 disabled:opacity-50"> </button>',1),Ta=b("<option> </option>"),Sa=b('<div class="space-y-2"><!> <button type="button" class="text-sm text-brand hover:text-brand font-medium">+ Create new category</button></div>'),Ea=b('<div class="space-y-2"><input type="text" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-purple-500 focus:outline-none focus:ring-purple-500" placeholder="Enter new category name"/> <button type="button" class="text-sm text-gray-600 hover:text-gray-700 font-medium">Back to existing</button></div>'),Pa=b('<button type="button"></button>'),Aa=b('<div class="space-y-4"><div><label class="block text-sm font-medium text-gray-700 mb-1">Category *</label> <!></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Tag Name *</label> <input type="text" class="block w-full rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-purple-500 focus:outline-none focus:ring-purple-500"/></div> <div><label class="block text-sm font-medium text-gray-700 mb-1">Color</label> <div class="flex items-center gap-3"><input type="color" class="w-10 h-10 rounded cursor-pointer border border-neutral-300"/> <div class="flex flex-wrap gap-1.5"></div></div> <p class="text-xs text-gray-500 mt-2">Preview: <span class="inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium"><span class="w-2 h-2 rounded-full"></span> </span></p></div></div>'),Na=b('<button class="rounded-md bg-white px-4 py-2 text-sm font-semibold text-gray-700 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">Cancel</button>'),Da=b("<option> </option>"),Ma=b('<div><label class="block text-sm font-medium text-gray-700 mb-1">Move tags to:</label> <!></div> <div class="flex flex-col gap-2"><button class="w-full rounded-md bg-purple-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-bg0 disabled:opacity-50"> </button> <button class="w-full rounded-md bg-red-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 disabled:opacity-50"> </button></div>',1),ja=b('<p class="text-sm text-red-600"> </p> <button class="w-full rounded-md bg-red-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 disabled:opacity-50"> </button>',1),Oa=b('<div class="space-y-4"><p class="text-sm text-gray-600">Category "<span class="font-semibold"> </span>" has <span class="font-semibold"> </span>.</p> <!></div>'),Ia=b('<div><div class="mb-6"><h1 class="text-2xl font-bold text-gray-900">Product Reviews Settings</h1> <p class="text-sm text-gray-500 mt-1">Manage tags and categories for product feedback classification</p></div> <!> <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6"><div class="bg-gradient-to-br from-brand-bg to-brand-bg-hover rounded-lg border border-brand-border p-4"><p class="text-sm font-medium text-brand">Total Tags</p> <p class="text-3xl font-bold text-purple-900 mt-1"> </p></div> <div class="bg-gradient-to-br from-brand-bg to-brand-bg-hover rounded-lg border border-brand-border p-4"><p class="text-sm font-medium text-brand">Categories</p> <p class="text-3xl font-bold text-brand-dark mt-1"> </p></div> <div class="bg-gradient-to-br from-green-50 to-green-100 rounded-lg border border-green-200 p-4"><p class="text-sm font-medium text-green-600">Uncategorized Tags</p> <p class="text-3xl font-bold text-green-900 mt-1"> </p></div></div> <div class="border-b border-neutral-300 mb-6"><nav class="flex gap-6"><button>
1<!> Tags <span class="ml-1 text-xs bg-gray-100 text-gray-600 rounded-full px-2 py-0.5"> </span></button> <button><!> Categories <span class="ml-1 text-xs bg-gray-100 text-gray-600 rounded-full px-2 py-0.5"> </span></button> <button><!> AI Agent</button></nav></div> <!> <!> <!></div> <!> <!> <!> <!> <!> <!>',1);function Ga(Jt,Gt){Ar(Gt,!0);const Ut=()=>lt(Hr,"$user",He),Wt=()=>lt(qr,"$permissionsLoaded",He),dt=()=>lt(zr,"$can",He),[He,Yt]=jr();let Je=x(""),Ce=x(ze([])),fe=x(ze([])),Te=x(ze([])),ct=x(!0),xe=x("tags"),ut=x(""),Ie=x(!1),Ge=x(!1),Se=x(null),Be=x(ze(new Set)),Q=x(""),ie=x(""),R=x("#6B7280"),de=x(!1),ce=x(""),$=x(!1),De=x(""),Ue=x("success"),he=x(null),ye=x(""),We=x(!1),ue=x(null),Pe=x(""),Fe=x(!1),Ye=x(!1),Ee=x(null),X=x(""),_e=x(""),we=x("heroicons:tag-20-solid"),re=x("#6B7280"),ke=x(0),vt=K(()=>{const s={};for(const n of e(Ce)){const l=n.category||"General";s[l]||(s[l]=[]),s[l].push(n)}return s});function Ve(s){const n=Ut()?.role;return n===Ht.SUPER_ADMIN||n===Ht.ADMIN?!0:Wt()&&dt()?dt()("settings",s):!1}const bt=K(()=>Ve("create")),gt=K(()=>Ve("edit")),pt=K(()=>Ve("delete"));let Ke=x(!1),mt=x("info"),ft=x(""),xt=x(""),ht=x("OK"),yt=x("Cancel"),Qe=x(null);function Vt(s,n,l,_=null,v="OK",y="Cancel"){a(mt,s,!0),a(ft,n,!0),a(xt,l,!0),a(ht,v,!0),a(yt,y,!0),a(Qe,_,!0),a(Ke,!0)}function Kt(){a(Ke,!1),a(Qe,null)}async function Qt(){try{const n=await(await fetch("/api/voc/product-feedback/tags")).json();n.success&&(a(Ce,n.tags,!0),a(fe,n.categories,!0))}catch(s){console.error("Failed to load tags:",s)}finally{a(ct,!1)}}async function Xt(){try{const n=await(await fetch("/api/voc/product-feedback/tags/categories")).json();n.success&&a(Te,n.categories,!0)}catch(s){console.error("Failed to load categories:",s)}}let Zt=K(()=>{const s={};for(const n of e(Te))s[n.name]=n.icon||"heroicons:tag-20-solid";return s});async function $e(){await Promise.all([Qt(),Xt()]);try{const n=await(await fetch("/api/voc/settings")).json();if(n.success&&n.data)for(const l of n.data)l.setting_key==="product_ai_provider"&&a(Je,l.setting_value||"",!0)}catch{}}Nr($e);function q(s,n){a(De,n,!0),a(Ue,s,!0),setTimeout(()=>a(De,""),5e3)}function er(){a(Q,""),a(ie,e(fe).length>0?e(fe)[0]:"",!0),a(R,"#6B7280"),a(de,!1),a(ce,""),a(Ie,!0)}function tr(s){a(Se,s,!0),a(Q,s.name,!0),a(ie,s.category,!0),a(R,s.color,!0),a(de,!1),a(ce,""),a(Ge,!0)}function ve(){a(Ie,!1),a(Ge,!1),a(We,!1),a(Se,null),a(he,null),a(ue,null)}function rr(s){const n=new Set(e(Be));n.has(s)?n.delete(s):n.add(s),a(Be,n,!0)}async function ar(){const s=e(de)?e(ce).trim():e(ie);if(!e(Q).trim()||!s){q("error","Name and category are required.");return}a($,!0);try{const l=await(await fetch("/api/voc/product-feedback/tags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e(Q).trim(),category:s,color:e(R)})})).json();if(!l.success)throw new Error(l.error);await $e(),ve(),q("success",`Tag "${e(Q)}" created.`)}catch(n){q("error",n.message)}finally{a($,!1)}}async function or(){if(!e(Se))return;const s=e(de)?e(ce).trim():e(ie);if(!e(Q).trim()||!s){q("error","Name and category are required.");return}a($,!0);try{const l=await(await fetch(`/api/voc/product-feedback/tags/${e(Se).id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e(Q).trim(),category:s,color:e(R)})})).json();if(!l.success)throw new Error(l.error);await $e(),ve(),q("success",`Tag "${e(Q)}" updated.`)}catch(n){q("error",n.message)}finally{a($,!1)}}function sr(s){Vt("danger","Delete Tag",`Delete tag "${s.name}"? This will remove all assignments for this tag.`,async()=>{try{const l=await(await fetch(`/api/voc/product-feedback/tags/${s.id}`,{method:"DELETE"})).json();if(!l.success)throw new Error(l.error);await $e(),q("success",`Tag "${s.name}" deleted.`)}catch(n){q("error",n.message)}},"Delete","Cancel")}function nr(s){a(he,s,!0),a(ye,s,!0)}function Xe(){a(he,null),a(ye,"")}async function _t(){if(!(!e(he)||!e(ye).trim())){if(e(ye).trim()===e(he)){Xe();return}a($,!0);try{const n=await(await fetch("/api/voc/product-feedback/tags/categories",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldName:e(he),newName:e(ye).trim()})})).json();if(!n.success)throw new Error(n.error);await $e(),q("success",`Category renamed to "${e(ye).trim()}" (${n.updated} tags updated).`),a(he,null)}catch(s){q("error",s.message)}finally{a($,!1)}}}function wt(s){a(ue,s,!0),a(Pe,e(fe).filter(n=>n!==s)[0]||"",!0),a(We,!0)}async function Ze(s){if(e(ue)){a($,!0);try{const l=await(await fetch("/api/voc/product-feedback/tags/categories",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:e(ue),reassignTo:s?"":e(Pe)})}
1)).json();if(!l.success)throw new Error(l.error);await $e(),ve(),s?q("success",`Category "${e(ue)}" and ${l.deleted} tags deleted.`):q("success",`Category "${e(ue)}" removed. ${l.reassigned} tags moved to "${e(Pe)}".`)}catch(n){q("error",n.message)}finally{a($,!1)}}}function lr(){a(X,""),a(_e,""),a(we,"heroicons:tag-20-solid"),a(re,"#6B7280"),a(ke,e(Te).length,!0),a(Fe,!0)}function ir(s){a(Ee,s,!0),a(X,s.name,!0),a(_e,s.description||"",!0),a(we,s.icon||"heroicons:tag-20-solid",!0),a(re,s.color||"#6B7280",!0),a(ke,s.sort_order,!0),a(Ye,!0)}function Ae(){a(Fe,!1),a(Ye,!1),a(Ee,null)}async function dr(){if(!e(X).trim()){q("error","Category name is required.");return}a($,!0);try{const n=await(await fetch("/api/voc/product-feedback/tags/categories",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e(X).trim(),description:e(_e).trim()||null,icon:e(we),color:e(re),sort_order:e(ke)})})).json();if(!n.success)throw new Error(n.error);await $e(),Ae(),q("success",`Category "${e(X)}" created.`)}catch(s){q("error",s.message)}finally{a($,!1)}}async function cr(){if(!e(Ee)||!e(X).trim()){q("error","Category name is required.");return}a($,!0);try{const n=await(await fetch("/api/voc/product-feedback/tags/categories",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e(Ee).id,oldName:e(Ee).name,newName:e(X).trim(),description:e(_e).trim()||null,icon:e(we),color:e(re),sort_order:e(ke)})})).json();if(!n.success)throw new Error(n.error);await $e(),Ae();const l=e(Ee).name!==e(X).trim();q("success",l?`Category renamed to "${e(X)}" (${n.tagsUpdated||0} tags updated).`:`Category "${e(X)}" updated.`)}catch(s){q("error",s.message)}finally{a($,!1)}}function ur(){const s=e(Ce).map((n,l)=>` ${l+1}. "${n.name}" (id: "${n.id}")`).join(` 2`);a(ut,`You are a product feedback analyst for Al Hatab Foods, a bakery and fresh food company in Saudi Arabia. You analyze customer product reviews and assign structured tags. 3 4AVAILABLE TAGS: 5${s||" (no tags configured)"} 6 7REVIEWS TO ANALYZE: 8[ 9 { "idx": 1, "product": "Whole Wheat Maamoul", "taste": 3, "quality": 4, "overall": 3, "feedback": "ÙØ³Ø¨Ø© Ø§ÙØ³Ùر عاÙÙÙ ÙØ±Ø¬Ù Ù ÙÙ٠تخÙÙÙ Ø§ÙØ³Ùر" } 10] 11 12... (analysis steps, rules, and JSON response format) 13 14Expected response: 15{ 16 "reviews": [ 17 { 18 "idx": 1, 19 "sentiment": "negative", 20 "primaryTagId": "uuid", 21 "tags": [{ "tagId": "uuid", "sentiment": "negative", "confidence": 0.92 }], 22 "severity": "medium", 23 "priority": "monitor", 24 "action": "Review sugar content in maamoul formulation", 25 "summary": "Customer complained about high sugar levels" 26 } 27 ] 28}`)}const kt=[{value:"heroicons:fire-20-solid",label:"Taste"},{value:"heroicons:cake-20-solid",label:"Bakery"},{value:"mdi:food-croissant",label:"Pastry"},{value:"mdi:bread-slice",label:"Bread"},{value:"mdi:coffee",label:"Drinks"},{value:"mdi:fruit-cherries",label:"Fresh"},{value:"heroicons:beaker-20-solid",label:"Ingredients"},{value:"heroicons:shield-check-20-solid",label:"Quality"},{value:"heroicons:shield-exclamation-20-solid",label:"Safety"},{value:"mdi:flask-outline",label:"Formula"},{value:"mdi:leaf",label:"Natural"},{value:"mdi:scale-balance",label:"Nutrition"},{value:"heroicons:cube-20-solid",label:"Packaging"},{value:"heroicons:archive-box-20-solid",label:"Box"},{value:"mdi:package-variant-closed",label:"Package"},{value:"heroicons:document-text-20-solid",label:"Label"},{value:"heroicons:building-storefront-20-solid",label:"Store"},{value:"heroicons:map-pin-20-solid",label:"Location"},{value:"heroicons:clock-20-solid",label:"Hours"},{value:"mdi:broom",label:"Clean"},{value:"mdi:parking",label:"Parking"},{value:"mdi:seat",label:"Seating"},{value:"heroicons:hand-thumb-up-20-solid",label:"Service"},{value:"heroicons:user-group-20-solid",label:"Staff"},{value:"heroicons:face-smile-20-solid",label:"Satisfaction"},{value:"heroicons:chat-bubble-left-right-20-solid",label:"Feedback"},{value:"heroicons:phone-20-solid",label:"Contact"},{value:"heroicons:truck-20-solid",label:"Delivery"},{value:"heroicons:shopping-cart-20-solid",label:"Order"},{value:"heroicons:device-phone-mobile-20-solid",label:"App"},{value:"heroicons:globe-alt-20-solid",label:"Online"},{value:"heroicons:banknotes-20-solid",label:"Pricing"},{value:"heroicons:receipt-percent-20-solid",label:"Discount"},{value:"heroicons:shopping-bag-20-solid",label:"Products"},{value:"heroicons:gift-20-solid",label:"Loyalty"},{value:"heroicons:star-20-solid",label:"Star"},{value:"heroicons:heart-20-solid",label:"Heart"},{value:"heroicons:light-bulb-20-solid",label:"Suggestion"},{value:"heroicons:exclamation-triangle-20-solid",label:"Warning"},{value:"heroicons:flag-20-solid",label:"Flag"},{value:"heroicons:tag-20-solid",label:"Tag"},{value:"heroicons:minus-circle-20-solid",label:"None"},{value:"heroicons:ellipsis-horizontal-circle-20-solid",label:"Other"}],Le=[{name:"Red",value:"#EF4444"},{name:"Orange",value:"#F97316"},{name:"Amber",value:"#F59E0B"},{name:"Yellow",value:"#EAB308"},{name:"Green",value:"#22C55E"},{name:"Emerald",value:"#10B981"},{name:"Blue",value:"#4E801F"},{name:"Purple",value:"#8B5CF6"},{name:"Pink",value:"#EC4899"},{name:"Gray",value:"#6B7280"}];var $t=Ia();Dr("1fxc4zi",s=>{Or(()=>{Ir.title="Product Reviews Settings | Admin"})});var et=W($t),Ct=o(r(et),2);{var vr=s=>{var n=Jr(),l=r(n);{let A=K(()=>e(Ue)==="success"?"heroicons:check-circle-20-solid":"heroicons:exclamation-circle-20-solid");O(l,{get icon(){return e(A)},width:"16",height:"16"})}var _=o(l),v=o(_),y=r(v);O(y,{icon:"heroicons:x-mark-20-solid",width:"14",height:"14"}),t(v),t(n),N(()=>{me(n,1,`mb-4 p-3 rounded-lg border ${e(Ue)==="success"?"bg-green-50 border-green-200 text-green-800":"bg-red-50 border-red-200 text-red-800"} text-sm flex items-center gap-2`),k(_,` ${e(De)??""} `)}),h("click",v,()=>a(De,"")),u(s,n)};z(Ct,s=>{e(De)&&s(vr)})}var tt=o(Ct,2),rt=r(tt),Tt=o(r(rt),2),br=r(Tt,!0);t(Tt),t(rt);var at=o(rt,2),St=o(r(at),2),gr=r(St,!0);t(St),t(at);var Et=o(at,2),Pt=o(r(Et),2),pr=r(Pt,!0);t(Pt),t(Et),t(tt);var ot=o(tt,2),At=r(ot),Me=r(At),Nt=r(Me);O(Nt,{icon:"heroicons:tag-20-solid",width:"16",height:"16",class:"inline mr-1"});var Dt=o(Nt,2),mr=r(Dt,!0);t(Dt),t(Me);var je=o(Me,2),Mt=r(je);O(Mt,{icon:"heroicons:folder-20-solid",width:"16",height:"16",class:"inline mr-1"});var jt=o(Mt,2),fr=r(jt,!0);t(jt),t(je);var Re=o(je,2),xr=r(Re);O(xr,{icon:"heroicons:document-text-20-solid",width:"16",height:"16",class:"inline mr-1"}),ee(),t(Re),t(At),t(ot);var Ot=o(ot,2);{var hr=s=>{var n=Qr(),l=W(n);{var _=g=>{var p=Gr(),m=r(p),C=r(m);O(C,{icon:"heroicons:plus-20-solid",width:"16",height:"16"}),ee(),t(m),t(p),h("click",m,lr),u(g,p)};z(l,g=>{e(bt)&&g(_)})}var v=o(l,2);{var y=g=>{var p=Ur(),m=r(p);O(m,{icon:"heroicons:folder-20-solid",width:"48",height:"48",class:"mx-auto mb-3 opacity-50"}),ee(2),t(p),u(g,p)},A=g=>{var p=Kr(),m=r(p),C=o(r(m));se(C,21,()=>e(Te),ne,(D,f)=>{var I=Vr(),M=r(I),E=r(M,!0);t(M);var S=o(M),w=r(S);{let L=K(()=>e(f).icon||"heroicons:tag-20-solid");O(w,{get icon(){return e(L)},width:"20",height:"20",class:"text-gray-600 inline"})}t(S);var c=o(S),i=r(c),d=r(i,!0);t(i),t(c);
28var T=o(c),B=r(T),ae=r(B,!0);t(B),t(T);var Z=o(T),be=r(Z),ge=r(be,!0);t(be),t(Z);var te=o(Z),G=r(te);t(te);var J=o(te),U=r(J),P=r(U);{var j=L=>{var H=Wr(),pe=r(H);O(pe,{icon:"heroicons:pencil-square-20-solid",width:"14",height:"14"}),ee(),t(H),h("click",H,()=>ir(e(f))),u(L,H)};z(P,L=>{e(gt)&&L(j)})}var F=o(P,2);{var oe=L=>{var H=Yr(),pe=r(H);O(pe,{icon:"heroicons:trash-20-solid",width:"14",height:"14"}),ee(),t(H),h("click",H,()=>wt(e(f).name)),u(L,H)};z(F,L=>{e(pt)&&L(oe)})}t(U),t(J),t(I),N(()=>{k(E,e(f).sort_order),k(d,e(f).name),k(ae,e(f).description||"â"),k(ge,e(f).tag_count),le(G,`background-color: ${e(f).color??""};`)}),u(D,I)}),t(C),t(m),t(p),u(g,p)};z(v,g=>{e(Te).length===0?g(y):g(A,-1)})}u(s,n)};z(Ot,s=>{e(xe)==="categories"&&s(hr)})}var It=o(Ot,2);{var yr=s=>{var n=Xr(),l=W(n),_=r(l),v=r(_),y=r(v);O(y,{icon:"heroicons:sparkles-20-solid",class:"text-brand flex-shrink-0",width:"20",height:"20"});var A=o(y,2),g=o(r(A),2),p=r(g,!0);t(g),t(A),t(v);var m=o(v,2),C=o(r(m));O(C,{icon:"heroicons:arrow-top-right-on-square-20-solid",width:"14",height:"14"}),t(m),t(_),t(l);var D=o(l,2),f=r(D),I=r(f);O(I,{icon:"heroicons:document-text-20-solid",class:"text-brand",width:"24",height:"24"}),ee(2),t(f);var M=o(f,2),E=r(M),S=r(E,!0);t(E),t(M);var w=o(M,2),c=r(w),i=r(c);O(i,{icon:"heroicons:information-circle-20-solid",width:"16",height:"16"}),ee(),t(c);var d=o(c,2),T=o(r(d),2),B=r(T);t(T),ee(8),t(d),t(w),t(D),N(()=>{k(p,e(Je)?`Override: ${e(Je)}`:"Using system default"),k(S,e(ut)),k(B,`It analyzes the feedback text and assigns up to 3 tags from the ${e(Ce).length??""} configured tags`)}),u(s,n)};z(It,s=>{e(xe)==="prompt"&&s(yr)})}var _r=o(It,2);{var wr=s=>{var n=da(),l=W(n);{var _=g=>{var p=Zr(),m=r(p),C=r(m);O(C,{icon:"heroicons:plus-20-solid",width:"16",height:"16"}),ee(),t(m),t(p),h("click",m,er),u(g,p)};z(l,g=>{e(bt)&&g(_)})}var v=o(l,2);{var y=g=>{Lr(g,{type:"list",rows:6})},A=g=>{var p=ia();se(p,21,()=>Object.entries(e(vt)).sort(([m],[C])=>m.localeCompare(C)),ne,(m,C)=>{var D=K(()=>Fr(e(C),2));let f=()=>e(D)[0],I=()=>e(D)[1];var M=la(),E=r(M),S=r(E),w=r(S);{let P=K(()=>e(Be).has(f())?"heroicons:chevron-right-20-solid":"heroicons:chevron-down-20-solid");O(w,{get icon(){return e(P)},width:"20",height:"20",class:"text-brand"})}var c=o(w,2),i=r(c,!0);t(c);var d=o(c,2);{let P=K(()=>e(Zt)[f()]||"heroicons:tag-20-solid");O(d,{get icon(){return e(P)},width:"18",height:"18",class:"text-brand"})}var T=o(d,2);{var B=P=>{var j=ea();Y(j),Br(j,!0),h("click",j,F=>F.stopPropagation()),h("keydown",j,F=>{F.key==="Enter"&&_t(),F.key==="Escape"&&Xe()}),V(j,()=>e(ye),F=>a(ye,F)),u(P,j)},ae=P=>{var j=ta(),F=r(j,!0);t(j),N(()=>k(F,f())),u(P,j)};z(T,P=>{e(he)===f()?P(B):P(ae,-1)})}t(S);var Z=o(S,2),be=r(Z);{var ge=P=>{var j=ra(),F=W(j),oe=r(F);O(oe,{icon:"heroicons:check-20-solid",width:"16",height:"16"}),t(F);var L=o(F,2),H=r(L);O(H,{icon:"heroicons:x-mark-20-solid",width:"16",height:"16"}),t(L),N(()=>F.disabled=e($)),h("click",F,_t),h("click",L,Xe),u(P,j)},te=P=>{var j=aa(),F=W(j),oe=r(F);O(oe,{icon:"heroicons:pencil-square-20-solid",width:"14",height:"14"}),ee(),t(F);var L=o(F,2),H=r(L);O(H,{icon:"heroicons:trash-20-solid",width:"14",height:"14"}),ee(),t(L),h("click",F,pe=>{pe.stopPropagation(),nr(f())}),h("click",L,pe=>{pe.stopPropagation(),wt(f())}),u(P,j)};z(be,P=>{e(he)===f()?P(ge):P(te,-1)})}t(Z),t(E);var G=o(E,2);{var J=P=>{var j=na();se(j,21,I,ne,(F,oe)=>{var L=sa(),H=r(L),pe=r(H),Cr=o(pe);t(H);var zt=o(H,4),Tr=r(zt);{var Sr=st=>{var qe=oa(),Er=r(qe);O(Er,{icon:"heroicons:pencil-square-20-solid",width:"14",height:"14"}),ee(),t(qe),h("click",qe,()=>tr(e(oe))),u(st,qe)};z(Tr,st=>{e(gt)&&st(Sr)})}t(zt),t(L),N(()=>{le(H,`background-color: ${e(oe).color??""}20; color: ${e(oe).color??""}; border-color: ${e(oe).color??""}40;`),le(pe,`background-color: ${e(oe).color??""};`),k(Cr,` ${e(oe).name??""}`)}),u(F,L)}),t(j),u(P,j)},U=K(()=>!e(Be).has(f()));z(G,P=>{e(U)&&P(J)})}t(M),N(()=>k(i,I().length)),h("click",S,()=>rr(f())),u(m,M)}),t(p),u(g,p)};z(v,g=>{e(ct)?g(y):g(A,-1)})}u(s,n)};z(_r,s=>{e(xe)==="tags"&&s(wr)})}t(et);var Bt=o(et,2);Oe(Bt,{title:"Add New Category",size:"md",get loading(){return e($)},onclose:Ae,get show(){return e(Fe)},set show(n){a(Fe,n,!0)},footer:n=>{var l=ca(),_=W(l),v=o(_,2),y=r(v,!0);t(v),N(()=>{v.disabled=e($),k(y,e($)?"Adding...":"Add Category")}),h("click",_,Ae),h("click",v,dr),u(n,l)},children:(n,l)=>{var _=ba(),v=r(_),y=o(r(v),2);Y(y),t(v);var A=o(v,2),g=o(r(A),2);Y(g),t(A);var p=o(A,2),m=o(r(p),2);se(m,21,()=>kt,ne,(w,c)=>{var i=ua(),d=r(i);O(d,{get icon(){return e(c).value},width:"16",height:"16"});var T=o(d);t(i),N(()=>{me(i,1,`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border-2 text-xs transition-all ${e(we)===e(c).value?"border-brand bg-brand-bg text-brand":"border-neutral-300 text-gray-500 hover:border-neutral-300"}`),Ne(i,"title",e(c).label),k(T,` ${e(c).label??""}`)}),h("click",i,()=>a(we,e(c).value,!0)),u(w,i)}),t(m),t(p);var C=o(p,2),D=r(C),f=o(r(D),2);Y(f),t(D);var I=o(D,2),M=o(r(I),2),E=r(M);Y(E);var S=o(E,2);se(S,21,()=>Le.slice(0,5),ne,(w,c)=>{var i=va();N(()=>{me(i,1,`w-5 h-5 rounded-full border ${e(re)===e(c).value?"border-gray-900 scale-110":"border-neutral-300"}`),le(i,`background-color: ${e(c).value??""};`),Ne(i,"title",e(c).name)}),h("click",i,()=>a(re,e(c).value,!0)),u(w,i)}),t(S),t(M),t(I),t(C),t(_),V(y,()=>e(X),w=>a(X,w)),V(g,()=>e(_e),w=>a(_e,w)),V(f,()=>e(ke),w=>a(ke,w)),V(E,()=>e(re),w=>a(re,w)),u(n,_)},$$slots:{footer:!0,default:!0}});var Ft=o(Bt,2);{const s=l=>{var _=ga(),v=W(_),y=o(v,2),A=r(y,!0);t(y),N(()=>{y.disabled=e($),k(A,e($)?"Saving...":"Save Changes")}
28),h("click",v,Ae),h("click",y,cr),u(l,_)};let n=K(()=>e(Ye)&&!!e(Ee));Oe(Ft,{get show(){return e(n)},title:"Edit Category",size:"md",get loading(){return e($)},onclose:Ae,footer:s,children:(l,_)=>{var v=fa(),y=r(v),A=o(r(y),2);Y(A),t(y);var g=o(y,2),p=o(r(g),2);Y(p),t(g);var m=o(g,2),C=o(r(m),2);se(C,21,()=>kt,ne,(c,i)=>{var d=pa(),T=r(d);O(T,{get icon(){return e(i).value},width:"16",height:"16"});var B=o(T);t(d),N(()=>{me(d,1,`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border-2 text-xs transition-all ${e(we)===e(i).value?"border-brand bg-brand-bg text-brand":"border-neutral-300 text-gray-500 hover:border-neutral-300"}`),Ne(d,"title",e(i).label),k(B,` ${e(i).label??""}`)}),h("click",d,()=>a(we,e(i).value,!0)),u(c,d)}),t(C),t(m);var D=o(m,2),f=r(D),I=o(r(f),2);Y(I),t(f);var M=o(f,2),E=o(r(M),2),S=r(E);Y(S);var w=o(S,2);se(w,21,()=>Le.slice(0,5),ne,(c,i)=>{var d=ma();N(()=>{me(d,1,`w-5 h-5 rounded-full border ${e(re)===e(i).value?"border-gray-900 scale-110":"border-neutral-300"}`),le(d,`background-color: ${e(i).value??""};`),Ne(d,"title",e(i).name)}),h("click",d,()=>a(re,e(i).value,!0)),u(c,d)}),t(w),t(E),t(M),t(D),t(v),V(A,()=>e(X),c=>a(X,c)),V(p,()=>e(_e),c=>a(_e,c)),V(I,()=>e(ke),c=>a(ke,c)),V(S,()=>e(re),c=>a(re,c)),u(l,v)},$$slots:{footer:!0,default:!0}})}var Lt=o(Ft,2);Oe(Lt,{title:"Add New Tag",size:"md",get loading(){return e($)},onclose:ve,get show(){return e(Ie)},set show(n){a(Ie,n,!0)},footer:n=>{var l=xa(),_=W(l),v=o(_,2),y=r(v,!0);t(v),N(()=>{v.disabled=e($),k(y,e($)?"Adding...":"Add Tag")}),h("click",_,ve),h("click",v,ar),u(n,l)},children:(n,l)=>{var _=ka(),v=r(_),y=o(r(v),2);{var A=c=>{var i=ya(),d=r(i);it(d,{class:"w-full",get value(){return e(ie)},set value(B){a(ie,B,!0)},children:(B,ae)=>{var Z=nt(),be=W(Z);se(be,17,()=>e(fe),ne,(ge,te)=>{var G=ha(),J=r(G,!0);t(G);var U={};N(()=>{k(J,e(te)),U!==(U=e(te))&&(G.value=(G.__value=e(te))??"")}),u(ge,G)}),u(B,Z)},$$slots:{default:!0}});var T=o(d,2);t(i),h("click",T,()=>{a(de,!0),a(ce,"")}),u(c,i)},g=c=>{var i=_a(),d=r(i);Y(d);var T=o(d,2);t(i),V(d,()=>e(ce),B=>a(ce,B)),h("click",T,()=>{a(de,!1),a(ie,e(fe)[0]||"",!0)}),u(c,i)};z(y,c=>{e(de)?c(g,-1):c(A)})}t(v);var p=o(v,2),m=o(r(p),2);Y(m),t(p);var C=o(p,2),D=o(r(C),2),f=r(D);Y(f);var I=o(f,2);se(I,21,()=>Le,ne,(c,i)=>{var d=wa();N(()=>{me(d,1,`w-6 h-6 rounded-full border-2 transition-all ${e(R)===e(i).value?"border-gray-900 scale-110":"border-neutral-300 hover:scale-105"}`),le(d,`background-color: ${e(i).value??""};`),Ne(d,"title",e(i).name)}),h("click",d,()=>a(R,e(i).value,!0)),u(c,d)}),t(I),t(D);var M=o(D,2),E=o(r(M)),S=r(E),w=o(S);t(E),t(M),t(C),t(_),N(()=>{le(E,`background-color: ${e(R)??""}20; color: ${e(R)??""}; border-color: ${e(R)??""}40;`),le(S,`background-color: ${e(R)??""};`),k(w,` ${(e(Q)||"Tag Preview")??""}`)}),V(m,()=>e(Q),c=>a(Q,c)),V(f,()=>e(R),c=>a(R,c)),u(n,_)},$$slots:{footer:!0,default:!0}});var Rt=o(Lt,2);{const s=l=>{var _=Ca(),v=W(_);{var y=m=>{var C=$a(),D=r(C);O(D,{icon:"heroicons:trash-20-solid",width:"14",height:"14"}),ee(),t(C),h("click",C,()=>{ve(),sr(e(Se))}),u(m,C)};z(v,m=>{e(pt)&&e(Se)&&m(y)})}var A=o(v,2),g=o(A,2),p=r(g,!0);t(g),N(()=>{g.disabled=e($),k(p,e($)?"Saving...":"Save Changes")}),h("click",A,ve),h("click",g,or),u(l,_)};let n=K(()=>e(Ge)&&!!e(Se));Oe(Rt,{get show(){return e(n)},title:"Edit Tag",size:"md",get loading(){return e($)},onclose:ve,footer:s,children:(l,_)=>{var v=Aa(),y=r(v),A=o(r(y),2);{var g=i=>{var d=Sa(),T=r(d);it(T,{class:"w-full",get value(){return e(ie)},set value(ae){a(ie,ae,!0)},children:(ae,Z)=>{var be=nt(),ge=W(be);se(ge,17,()=>e(fe),ne,(te,G)=>{var J=Ta(),U=r(J,!0);t(J);var P={};N(()=>{k(U,e(G)),P!==(P=e(G))&&(J.value=(J.__value=e(G))??"")}),u(te,J)}),u(ae,be)},$$slots:{default:!0}});var B=o(T,2);t(d),h("click",B,()=>{a(de,!0),a(ce,"")}),u(i,d)},p=i=>{var d=Ea(),T=r(d);Y(T);var B=o(T,2);t(d),V(T,()=>e(ce),ae=>a(ce,ae)),h("click",B,()=>{a(de,!1),a(ie,e(fe)[0]||"",!0)}),u(i,d)};z(A,i=>{e(de)?i(p,-1):i(g)})}t(y);var m=o(y,2),C=o(r(m),2);Y(C),t(m);var D=o(m,2),f=o(r(D),2),I=r(f);Y(I);var M=o(I,2);se(M,21,()=>Le,ne,(i,d)=>{var T=Pa();N(()=>{me(T,1,`w-6 h-6 rounded-full border-2 transition-all ${e(R)===e(d).value?"border-gray-900 scale-110":"border-neutral-300 hover:scale-105"}`),le(T,`background-color: ${e(d).value??""};`),Ne(T,"title",e(d).name)}),h("click",T,()=>a(R,e(d).value,!0)),u(i,T)}),t(M),t(f);var E=o(f,2),S=o(r(E)),w=r(S),c=o(w);t(S),t(E),t(D),t(v),N(()=>{le(S,`background-color: ${e(R)??""}20; color: ${e(R)??""}; border-color: ${e(R)??""}40;`),le(w,`background-color: ${e(R)??""};`),k(c,` ${(e(Q)||"Tag Preview")??""}`)}),V(C,()=>e(Q),i=>
28a(Q,i)),V(I,()=>e(R),i=>a(R,i)),u(l,v)},$$slots:{footer:!0,default:!0}})}var qt=o(Rt,2);{var kr=s=>{const n=K(()=>e(fe).filter(_=>_!==e(ue))),l=K(()=>e(vt)[e(ue)]?.length||0);Oe(s,{show:!0,title:"Delete Category",size:"sm",get loading(){return e($)},onclose:ve,footer:v=>{var y=Na();h("click",y,ve),u(v,y)},children:(v,y)=>{var A=Oa(),g=r(A),p=o(r(g)),m=r(p,!0);t(p);var C=o(p,2),D=r(C);t(C),ee(),t(g);var f=o(g,2);{var I=E=>{var S=Ma(),w=W(S),c=o(r(w),2);it(c,{class:"w-full",get value(){return e(Pe)},set value(Z){a(Pe,Z,!0)},children:(Z,be)=>{var ge=nt(),te=W(ge);se(te,17,()=>e(n),ne,(G,J)=>{var U=Da(),P=r(U,!0);t(U);var j={};N(()=>{k(P,e(J)),j!==(j=e(J))&&(U.value=(U.__value=e(J))??"")}),u(G,U)}),u(Z,ge)},$$slots:{default:!0}}),t(w);var i=o(w,2),d=r(i),T=r(d,!0);t(d);var B=o(d,2),ae=r(B,!0);t(B),t(i),N(()=>{d.disabled=e($),k(T,e($)?"Moving...":`Move ${e(l)} tag${e(l)!==1?"s":""} to "${e(Pe)}"`),B.disabled=e($),k(ae,e($)?"Deleting...":`Delete category and all ${e(l)} tag${e(l)!==1?"s":""}`)}),h("click",d,()=>Ze(!1)),h("click",B,()=>Ze(!0)),u(E,S)},M=E=>{var S=ja(),w=W(S),c=r(w);t(w);var i=o(w,2),d=r(i,!0);t(i),N(()=>{k(c,`This is the only category. Deleting it will delete all ${e(l)??""} tags.`),i.disabled=e($),k(d,e($)?"Deleting...":`Delete category and all ${e(l)} tag${e(l)!==1?"s":""}`)}),h("click",i,()=>Ze(!0)),u(E,S)};z(f,E=>{e(n).length>0?E(I):E(M,-1)})}t(A),N(()=>{k(m,e(ue)),k(D,`${e(l)??""} tag${e(l)!==1?"s":""}`)}),u(v,A)},$$slots:{footer:!0,default:!0}})};z(qt,s=>{e(We)&&e(ue)&&s(kr)})}var $r=o(qt,2);Rr($r,{get show(){return e(Ke)},get type(){return e(mt)},get title(){return e(ft)},get message(){return e(xt)},get confirmText(){return e(ht)},get cancelText(){return e(yt)},onClose:Kt,get onConfirm(){return e(Qe)}}),N(s=>{k(br,e(Ce).length),k(gr,e(Te).length),k(pr,s),me(Me,1,`pb-3 text-sm font-medium border-b-2 transition-colors ${e(xe)==="tags"?"border-brand text-brand":"border-transparent text-gray-500 hover:text-gray-700 hover:border-neutral-300"}`),k(mr,e(Ce).length),me(je,1,`pb-3 text-sm font-medium border-b-2 transition-colors ${e(xe)==="categories"?"border-brand text-brand":"border-transparent text-gray-500 hover:text-gray-700 hover:border-neutral-300"}`),k(fr,e(Te).length),me(Re,1,`pb-3 text-sm font-medium border-b-2 transition-colors ${e(xe)==="prompt"?"border-brand text-brand":"border-transparent text-gray-500 hover:text-gray-700 hover:border-neutral-300"}`)},[()=>e(Ce).filter(s=>!s.category||s.category==="General").length]),h("click",Me,()=>a(xe,"tags")),h("click",je,()=>a(xe,"categories")),h("click",Re,()=>{a(xe,"prompt"),ur()}),u(Jt,$t),Mr(),Yt()}Pr(["click","keydown"]);export{Ga as component};
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.