@yoast/ai-insights-client 1.4.118 → 1.4.119

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.
@@ -70,7 +70,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
70
70
  `}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
71
71
  `}),n}function zp(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Up(t,e){const n=Q7(t,e),r=n.one(t,void 0),i=N7(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
72
72
  `},i),s}function X7(t,e){return t&&"run"in t?async function(n,r){const i=Up(n,{file:r,...e});await t.run(i,r)}:function(n,r){return Up(n,{file:r,...t||e})}}function Hp(t){if(t)throw t}var _l,qp;function J7(){if(qp)return _l;qp=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},s=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!f)return!1;var p;for(p in u);return typeof p=="undefined"||t.call(u,p)},a=function(u,c){n&&c.name==="__proto__"?n(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},o=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(r)return r(u,c).value}else return;return u[c]};return _l=function l(){var u,c,f,p,h,y,m=arguments[0],v=1,g=arguments.length,A=!1;for(typeof m=="boolean"&&(A=m,m=arguments[1]||{},v=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});v<g;++v)if(u=arguments[v],u!=null)for(c in u)f=o(m,c),p=o(u,c),m!==p&&(A&&p&&(s(p)||(h=i(p)))?(h?(h=!1,y=f&&i(f)?f:[]):y=f&&s(f)?f:{},a(m,{name:c,newValue:l(A,y,p)})):typeof p!="undefined"&&a(m,{name:c,newValue:p}));return m},_l}var Z7=J7();const Dl=Oo(Z7);function nc(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function $7(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(l,...u){const c=t[++s];let f=-1;if(l){a(l);return}for(;++f<i.length;)(u[f]===null||u[f]===void 0)&&(u[f]=i[f]);i=u,c?e9(c,o)(...u):a(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function e9(t,e){let n;return r;function r(...a){const o=t.length>a.length;let l;o&&a.push(i);try{l=t.apply(this,a)}catch(u){const c=u;if(o&&n)throw c;return i(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(a,...o){n||(n=!0,e(a,...o))}function s(a){i(null,a)}}const wn={basename:t9,dirname:n9,extname:r9,join:i9,sep:"/"};function t9(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ba(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,o=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(t.codePointAt(i)===e.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function n9(t){if(ba(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function r9(t){ba(t);let e=t.length,n=-1,r=0,i=-1,s=0,a;for(;e--;){const o=t.codePointAt(e);if(o===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),o===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function i9(...t){let e=-1,n;for(;++e<t.length;)ba(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":s9(n)}function s9(t){ba(t);const e=t.codePointAt(0)===47;let n=a9(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function a9(t,e){let n="",r=0,i=-1,s=0,a=-1,o,l;for(;++a<=t.length;){if(a<t.length)o=t.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||s===1))if(i!==a-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s>-1?s++:s=-1}return n}function ba(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const o9={cwd:l9};function l9(){return"/"}function rc(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function u9(t){if(typeof t=="string")t=new URL(t);else if(!rc(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return c9(t)}function c9(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const Bl=["history","path","basename","stem","extname","dirname"];class zg{constructor(e){let n;e?rc(e)?n={path:e}:typeof e=="string"||d9(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":o9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Bl.length;){const s=Bl[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Bl.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?wn.basename(this.path):void 0}set basename(e){zl(e,"basename"),Fl(e,"basename"),this.path=wn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?wn.dirname(this.path):void 0}set dirname(e){Wp(this.basename,"dirname"),this.path=wn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?wn.extname(this.path):void 0}set extname(e){if(Fl(e,"extname"),Wp(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=wn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){rc(e)&&(e=u9(e)),zl(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?wn.basename(this.path,this.extname):void 0}set stem(e){zl(e,"stem"),Fl(e,"stem"),this.path=wn.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new pt(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Fl(t,e){if(t&&t.includes(wn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+wn.sep+"`")}function zl(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Wp(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function d9(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const f9=function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},h9={}.hasOwnProperty;class rd extends f9{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=$7()}copy(){const e=new rd;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Dl(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(ql("data",this.frozen),this.namespace[e]=n,this):h9.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ql("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Wa(e),r=this.parser||this.Parser;return Ul("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Ul("process",this.parser||this.Parser),Hl("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const o=Wa(e),l=r.parse(o);r.run(l,o,function(c,f,p){if(c||!f||!p)return u(c);const h=f,y=r.stringify(h,p);m9(y)?p.value=y:p.result=y,u(c,p)});function u(c,f){c||!f?a(c):s?s(f):n(void 0,f)}}}processSync(e){let n=!1,r;return this.freeze(),Ul("processSync",this.parser||this.Parser),Hl("processSync",this.compiler||this.Compiler),this.process(e,i),Gp("processSync","process",n),r;function i(s,a){n=!0,Hp(s),r=a}}run(e,n,r){Qp(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,o){const l=Wa(n);i.run(e,l,u);function u(c,f,p){const h=f||e;c?o(c):a?a(h):r(void 0,h,p)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),Gp("runSync","run",r),i;function s(a,o){Hp(a),i=o,r=!0}}stringify(e,n){this.freeze();const r=Wa(n),i=this.compiler||this.Compiler;return Hl("stringify",i),Qp(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(ql("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?o(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;l(c,f)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(i.settings=Dl(!0,i.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];s(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...c]);else if(c.length>0){let[h,...y]=c;const m=r[p][1];nc(m)&&nc(h)&&(h=Dl(!0,m,h)),r[p]=[u,h,...y]}}}}const p9=new rd().freeze();function Ul(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Hl(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function ql(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Qp(t){if(!nc(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Gp(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Wa(t){return y9(t)?t:new zg(t)}function y9(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function m9(t){return typeof t=="string"||g9(t)}function g9(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const v9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Yp=[],Vp={allowDangerousHtml:!0},b9=/^(https?|ircs?|mailto|xmpp)$/i,x9=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function w9(t){const e=A9(t),n=S9(t);return C9(e.runSync(e.parse(n),n),t)}function A9(t){const e=t.rehypePlugins||Yp,n=t.remarkPlugins||Yp,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Vp}:Vp;return p9().use(t7).use(n).use(X7,r).use(e)}function S9(t){const e=t.children||"",n=new zg;return typeof e=="string"&&(n.value=e),n}function C9(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,a=e.skipHtml,o=e.unwrapDisallowed,l=e.urlTransform||k9;for(const c of x9)Object.hasOwn(e,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+v9+c.id,void 0);return Fg(t,u),NE(t,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(c,f,p){if(c.type==="raw"&&p&&typeof f=="number")return a?p.children.splice(f,1):p.children[f]={type:"text",value:c.value},f;if(c.type==="element"){let h;for(h in Ll)if(Object.hasOwn(Ll,h)&&Object.hasOwn(c.properties,h)){const y=c.properties[h],m=Ll[h];(m===null||m.includes(c.tagName))&&(c.properties[h]=l(String(y||""),h,c))}}if(c.type==="element"){let h=n?!n.includes(c.tagName):s?s.includes(c.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(c,f,p)),h&&p&&typeof f=="number")return o&&c.children?p.children.splice(f,1,...c.children):p.children.splice(f,1),f}}}function k9(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||b9.test(t.slice(0,e))?t:""}function Wl(t,e){return P9(t)||O9(t,e)||E9(t,e)||j9()}function j9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
73
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E9(t,e){if(t){if(typeof t=="string")return Kp(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kp(t,e):void 0}}function Kp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function O9(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}function P9(t){if(Array.isArray(t))return t}var T9=function(e){var n=e.queryResult,r=F.useState(null),i=Wl(r,2),s=i[0],a=i[1],o=F.useState(null),l=Wl(o,2),u=l[0],c=l[1],f=F.useState(null),p=Wl(f,2),h=p[0],y=p[1],m=F.useRef(null),v=n.response||"No response available",g=F.useMemo(function(){return n.mentionedBrands||[]},[n.mentionedBrands]),A=n.citations||[],E=n.sentiments||[],j=u!==null?u:s,S=F.useMemo(function(){if(j===null)return v;var x=g.find(function(N){return N.id===j});return x?v.replaceAll(x.name,"**".concat(x.name,"**")):v},[v,j,g]),b=function(N){c(u===N?null:N)};F.useEffect(function(){if(m.current&&j!==null){var x=m.current.scrollHeight;(h===null||x>h)&&y(x)}},[j,S,h]);var w=Array.from(new Map(g.map(function(x){return[x.id,x]})).values());return d.jsx(C.Card,{className:"yst-mb-4",children:d.jsx(C.Card.Content,{className:"yst-p-4",children:d.jsxs("details",{className:"yst-group",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden",children:[d.jsxs("div",{className:"yst-flex-1",children:[d.jsx(C.Title,{size:"3",className:"yst-mb-2",children:n.query}),d.jsxs("div",{className:"yst-flex yst-gap-4 yst-text-sm yst-text-gray-600",children:[g.length>0&&d.jsxs("span",{children:[w.length," brand",w.length!==1?"s":""]}),A.length>0&&d.jsxs("span",{children:[A.length," citation",A.length!==1?"s":""]}),E.length>0&&d.jsxs("span",{children:[E.length," sentiment",E.length!==1?"s":""]})]})]}),d.jsx("div",{className:"yst-text-gray-500 group-open:yst-rotate-90 yst-transition-transform",children:"▶"})]}),d.jsxs("div",{className:"yst-mt-6 yst-flex yst-flex-col yst-gap-6",children:[d.jsxs("details",{className:"yst-border-t yst-pt-4",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden yst-font-semibold yst-mb-2",children:[d.jsx("span",{children:"AI Response"}),d.jsx("span",{className:"yst-text-gray-500",children:"▶"})]}),d.jsx("div",{className:"yst-mt-2",children:d.jsx("div",{className:"yst-rounded-lg yst-border yst-border-gray-300 yst-bg-gray-50 yst-p-4",children:d.jsx("div",{ref:m,className:"yst-text-sm yst-text-gray-700 [&_p]:yst-mb-4 [&_ul]:yst-list-disc [&_ul]:yst-ml-6 [&_ul]:yst-mb-4 [&_ol]:yst-list-decimal [&_ol]:yst-ml-6 [&_ol]:yst-mb-4 [&_li]:yst-mb-1 [&_h1]:yst-text-xl [&_h1]:yst-font-bold [&_h1]:yst-mb-2 [&_h2]:yst-text-lg [&_h2]:yst-font-bold [&_h2]:yst-mb-2 [&_h3]:yst-font-bold [&_h3]:yst-mb-2 [&_code]:yst-bg-white [&_code]:yst-px-1 [&_code]:yst-rounded [&_pre]:yst-bg-white [&_pre]:yst-p-3 [&_pre]:yst-rounded [&_pre]:yst-mb-4 [&_pre]:yst-overflow-x-auto [&_p:last-child]:yst-mb-0 [&_ul:last-child]:yst-mb-0 [&_ol:last-child]:yst-mb-0 [&_strong]:yst-bg-yellow-200 [&_strong]:yst-rounded [&_strong]:yst-px-1",style:h!==null?{height:"".concat(h,"px")}:void 0,children:d.jsx(w9,{children:S})})})})]}),g.length>0&&d.jsxs("details",{className:"yst-border-t yst-pt-4",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden yst-font-semibold yst-mb-2",children:[d.jsxs("span",{children:["Brands (",w.length,")"]}),d.jsx("span",{className:"yst-text-gray-500",children:"▶"})]}),d.jsxs("div",{className:"yst-mt-2 yst-space-y-4",children:[d.jsxs("div",{children:[d.jsx("p",{className:"yst-mb-2 yst-text-sm yst-font-medium",children:"Mentioned brands:"}),d.jsx("div",{className:"yst-flex yst-flex-wrap yst-gap-2",children:w.map(function(x){return d.jsx(C.Badge,{variant:x.isSelf?"info":"plain",className:"yst-cursor-pointer yst-transition-colors ".concat(j===x.id?"yst-ring-2 yst-ring-yellow-400":""),onMouseEnter:function(){return a(x.id)},onMouseLeave:function(){return a(null)},onClick:function(){return b(x.id)},children:x.name},x.id)})})]}),d.jsxs("div",{children:[d.jsx("p",{className:"yst-mb-2 yst-text-sm yst-font-medium",children:"Brand ranking:"}),d.jsx("ol",{className:"yst-list-decimal yst-list-inside yst-space-y-3",children:g.sort(function(x,N){return x.rank-N.rank}).map(function(x){return d.jsxs("li",{className:"yst-text-sm",children:[d.jsx(C.Badge,{variant:x.isSelf?"info":"plain",className:"yst-cursor-pointer yst-transition-colors ".concat(j===x.id?"yst-ring-2 yst-ring-yellow-400":""),onMouseEnter:function(){return a(x.id)},onMouseLeave:function(){return a(null)},onClick:function(){return b(x.id)},children:x.name}),d.jsxs("p",{className:"yst-ml-6 yst-mt-1 yst-text-sm yst-text-gray-600 yst-italic",children:['"',x.context,'"']})]},"".concat(x.id,"-").concat(x.rank))})})]})]})]}),A.length>0&&d.jsxs("details",{className:"yst-border-t yst-pt-4",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden yst-font-semibold yst-mb-2",children:[d.jsxs("span",{children:["Citations (",A.length,")"]}),d.jsx("span",{className:"yst-text-gray-500",children:"▶"})]}),d.jsx("div",{className:"yst-mt-2",children:d.jsxs(C.Table,{children:[d.jsx(C.Table.Head,{children:d.jsxs(C.Table.Row,{children:[d.jsx(C.Table.Header,{children:"Rank"}),d.jsx(C.Table.Header,{children:"Domain"}),d.jsx(C.Table.Header,{children:"URL"}),d.jsx(C.Table.Header,{children:"Associated brands"})]})}),d.jsx(C.Table.Body,{children:A.sort(function(x,N){return x.rank-N.rank}).map(function(x,N){return d.jsxs(C.Table.Row,{children:[d.jsxs(C.Table.Cell,{children:["#",x.rank]}),d.jsx(C.Table.Cell,{children:x.rootDomain}),d.jsx(C.Table.Cell,{children:d.jsx(C.Link,{href:x.url,target:"_blank",rel:"noopener noreferrer",children:x.url})}),d.jsx(C.Table.Cell,{children:x.associatedBrands.length>0?d.jsx("div",{className:"yst-flex yst-flex-wrap yst-gap-1",children:x.associatedBrands.map(function(_){return d.jsx(C.Badge,{variant:_.isSelf?"info":"plain",className:"yst-cursor-pointer yst-transition-colors ".concat(j===_.id?"yst-ring-2 yst-ring-yellow-400":""),onMouseEnter:function(){return a(_.id)},onMouseLeave:function(){return a(null)},onClick:function(){return b(_.id)},children:_.name},_.id)})}):d.jsx("span",{className:"yst-text-gray-500",children:"None"})})]},"".concat(x.url,"-").concat(N))})})]})})]}),E.length>0&&d.jsxs("details",{className:"yst-border-t yst-pt-4",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden yst-font-semibold yst-mb-2",children:[d.jsxs("span",{children:["Sentiment Analysis (",E.length,")"]}),d.jsx("span",{className:"yst-text-gray-500",children:"▶"})]}),d.jsx("div",{className:"yst-mt-2 yst-flex yst-flex-col yst-gap-4",children:E.map(function(x){return d.jsxs("div",{className:"yst-rounded-lg yst-border yst-border-gray-300 yst-p-4",children:[d.jsxs("div",{className:"yst-flex yst-items-center yst-gap-3 yst-mb-3",children:[d.jsxs("div",{className:"yst-flex yst-items-center yst-gap-2",children:[d.jsx("span",{className:"yst-text-sm yst-font-semibold",children:"Score:"}),d.jsx(C.Badge,{variant:x.score>.3?"success":x.score<-.3?"error":"plain",children:x.score.toFixed(2)})]}),d.jsxs("div",{className:"yst-flex yst-items-center yst-gap-2",children:[d.jsx("span",{className:"yst-text-sm yst-font-semibold",children:"Confidence:"}),d.jsxs(C.Badge,{variant:"plain",children:[(x.confidence*100).toFixed(0),"%"]})]})]}),x.brands.length>0&&d.jsxs("div",{className:"yst-mb-3",children:[d.jsx("span",{className:"yst-text-sm yst-font-semibold yst-mb-1 yst-block",children:"Brands:"}),d.jsx("div",{className:"yst-flex yst-flex-wrap yst-gap-1",children:x.brands.map(function(N){return d.jsx(C.Badge,{variant:N.isSelf?"info":"plain",className:"yst-cursor-pointer yst-transition-colors ".concat(j===N.id?"yst-ring-2 yst-ring-yellow-400":""),onMouseEnter:function(){return a(N.id)},onMouseLeave:function(){return a(null)},onClick:function(){return b(N.id)},children:N.name},N.id)})})]}),x.keywords.length>0&&d.jsxs("div",{children:[d.jsx("span",{className:"yst-text-sm yst-font-semibold yst-mb-1 yst-block",children:"Keywords:"}),d.jsx("div",{className:"yst-flex yst-flex-wrap yst-gap-2",children:x.keywords.map(function(N,_){return d.jsxs("div",{className:"yst-flex yst-items-center yst-gap-1 yst-rounded yst-bg-gray-100 yst-px-2 yst-py-1",children:[d.jsx("span",{className:"yst-text-sm",children:N.keyword}),d.jsx(C.Badge,{variant:N.isPositive?"success":N.isNegative?"error":"plain",children:N.sentiment.toFixed(2)})]},_)})})]})]},x.id)})})]})]})]})})})},I9=function(){var e=It(),n=e.brandId,r=e.analysisId,i=ht(),s=Bs(n,{query:{enabled:!!n,select:function(y){var m=y.data;return m}}}),a=s.data,o=s.isLoading,l=Fo(n,r,{query:{enabled:!!n&&!!r,select:function(y){var m=y.data;return m==null?void 0:m.analysis}}}),u=l.data,c=l.isLoading,f=o||c,p=u&&u.status===zn.completed;return f?d.jsx(Yi,{}):p?d.jsxs(C.Card,{children:[d.jsx(Yu,{title:"Scan details",children:d.jsx(C.Button,{variant:"secondary",onClick:function(){return i("/brands/".concat(n,"/analysis/").concat(r))},children:"Back to analysis results"})}),u.scans.map(function(h){return d.jsx(M9,{brandId:n,analysisId:r,scanId:h.id,provider:h.aiProvider?String(h.aiProvider):"Unknown",scanFinishedAt:h.finishedAt,brandName:a==null?void 0:a.name},h.id)})]}):d.jsxs(C.Card,{children:[d.jsx(Yu,{title:"Scan details"}),d.jsx(C.Card.Content,{children:d.jsx("p",{children:"No completed analysis found. Please run an analysis first."})})]})},M9=function(e){var n=e.brandId,r=e.analysisId,i=e.scanId,s=e.provider,a=e.scanFinishedAt,o=e.brandName,l=ax(n,r,i,{query:{enabled:!!n&&!!r&&!!i,select:function(h){var y=h.data;return y}}}),u=l.data,c=l.isLoading;if(c)return d.jsx(Yi,{});var f=(u==null?void 0:u.queryResults)||[];return f.length===0?null:d.jsx(C.Card,{className:"yst-mb-4",children:d.jsxs(C.Card.Content,{children:[d.jsxs("p",{className:"yst-mb-8",children:[o," - Scan performed on:"," ",d.jsx(C.Badge,{children:a?Br(new Date(a),"yyyy-MM-dd HH:mm:ss"):"In progress"})," ","- AI Platform:"," ",d.jsx(C.Badge,{className:"yst-bg-green-100 yst-text-green-800",children:s})]}),f.map(function(p){return d.jsx(T9,{queryResult:p},p.id)})]})},i)};const L9=Object.freeze(Object.defineProperty({__proto__:null,default:I9},Symbol.toStringTag,{value:"Module"}));var N9=function(){var e=It(),n=e.hostAppProps.basename,r=F.useCallback(function(a){if(!n||!a.startsWith(n))return a;var o=a.slice(n.length);return o||"/"},[n]),i=F.useCallback(function(a){if(!n)return a;var o=a.startsWith("/")?a:"/".concat(a);return"".concat(n).concat(o)},[n]),s=F.useCallback(function(a){return n?a.startsWith(n):a.startsWith("/")&&!a.startsWith("//")},[n]);return{basename:n||"",stripBasename:r,addBasename:i,isWithinBasename:s}};function Ql(t,e){return B9(t)||D9(t,e)||_9(t,e)||R9()}function R9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
73
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E9(t,e){if(t){if(typeof t=="string")return Kp(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kp(t,e):void 0}}function Kp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function O9(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}function P9(t){if(Array.isArray(t))return t}var T9=function(e){var n=e.queryResult,r=F.useState(null),i=Wl(r,2),s=i[0],a=i[1],o=F.useState(null),l=Wl(o,2),u=l[0],c=l[1],f=F.useState(null),p=Wl(f,2),h=p[0],y=p[1],m=F.useRef(null),v=n.response||"No response available",g=F.useMemo(function(){return n.mentionedBrands||[]},[n.mentionedBrands]),A=n.citations||[],E=n.sentiments||[],j=u!==null?u:s,S=F.useMemo(function(){if(j===null)return v;var x=g.find(function(N){return N.id===j});return x?v.replaceAll(x.name,"**".concat(x.name,"**")):v},[v,j,g]),b=function(N){c(u===N?null:N)};F.useEffect(function(){if(m.current&&j!==null){var x=m.current.scrollHeight;(h===null||x>h)&&y(x)}},[j,S,h]);var w=Array.from(new Map(g.map(function(x){return[x.id,x]})).values());return d.jsx(C.Card,{className:"yst-mb-4",children:d.jsx(C.Card.Content,{className:"yst-p-4",children:d.jsxs("details",{className:"yst-group",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden",children:[d.jsxs("div",{className:"yst-flex-1",children:[d.jsx(C.Title,{size:"3",className:"yst-mb-2",children:n.query}),d.jsxs("div",{className:"yst-flex yst-gap-4 yst-text-sm yst-text-gray-600",children:[g.length>0&&d.jsxs("span",{children:[w.length," brand",w.length!==1?"s":""]}),A.length>0&&d.jsxs("span",{children:[A.length," citation",A.length!==1?"s":""]}),E.length>0&&d.jsxs("span",{children:[E.length," sentiment",E.length!==1?"s":""]})]})]}),d.jsx("div",{className:"yst-text-gray-500 group-open:yst-rotate-90 yst-transition-transform",children:"▶"})]}),d.jsxs("div",{className:"yst-mt-6 yst-flex yst-flex-col yst-gap-6",children:[d.jsxs("details",{className:"yst-border-t yst-pt-4",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden yst-font-semibold yst-mb-2",children:[d.jsx("span",{children:"AI Response"}),d.jsx("span",{className:"yst-text-gray-500",children:"▶"})]}),d.jsx("div",{className:"yst-mt-2",children:d.jsx("div",{className:"yst-rounded-lg yst-border yst-border-gray-300 yst-bg-gray-50 yst-p-4",children:d.jsx("div",{ref:m,className:"yst-text-sm yst-text-gray-700 [&_p]:yst-mb-4 [&_ul]:yst-list-disc [&_ul]:yst-ml-6 [&_ul]:yst-mb-4 [&_ol]:yst-list-decimal [&_ol]:yst-ml-6 [&_ol]:yst-mb-4 [&_li]:yst-mb-1 [&_h1]:yst-text-xl [&_h1]:yst-font-bold [&_h1]:yst-mb-2 [&_h2]:yst-text-lg [&_h2]:yst-font-bold [&_h2]:yst-mb-2 [&_h3]:yst-font-bold [&_h3]:yst-mb-2 [&_code]:yst-bg-white [&_code]:yst-px-1 [&_code]:yst-rounded [&_pre]:yst-bg-white [&_pre]:yst-p-3 [&_pre]:yst-rounded [&_pre]:yst-mb-4 [&_pre]:yst-overflow-x-auto [&_p:last-child]:yst-mb-0 [&_ul:last-child]:yst-mb-0 [&_ol:last-child]:yst-mb-0 [&_strong]:yst-bg-yellow-200 [&_strong]:yst-rounded [&_strong]:yst-px-1",style:h!==null?{height:"".concat(h,"px")}:void 0,children:d.jsx(w9,{children:S})})})})]}),g.length>0&&d.jsxs("details",{className:"yst-border-t yst-pt-4",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden yst-font-semibold yst-mb-2",children:[d.jsxs("span",{children:["Brands (",w.length,")"]}),d.jsx("span",{className:"yst-text-gray-500",children:"▶"})]}),d.jsxs("div",{className:"yst-mt-2 yst-space-y-4",children:[d.jsxs("div",{children:[d.jsx("p",{className:"yst-mb-2 yst-text-sm yst-font-medium",children:"Mentioned brands:"}),d.jsx("div",{className:"yst-flex yst-flex-wrap yst-gap-2",children:w.map(function(x){return d.jsx(C.Badge,{variant:x.isSelf?"info":"plain",className:"yst-cursor-pointer yst-transition-colors ".concat(j===x.id?"yst-ring-2 yst-ring-yellow-400":""),onMouseEnter:function(){return a(x.id)},onMouseLeave:function(){return a(null)},onClick:function(){return b(x.id)},children:x.name},x.id)})})]}),d.jsxs("div",{children:[d.jsx("p",{className:"yst-mb-2 yst-text-sm yst-font-medium",children:"Brand ranking:"}),d.jsx("ol",{className:"yst-list-decimal yst-list-inside yst-space-y-3",children:g.sort(function(x,N){return x.rank-N.rank}).map(function(x){return d.jsxs("li",{className:"yst-text-sm",children:[d.jsx(C.Badge,{variant:x.isSelf?"info":"plain",className:"yst-cursor-pointer yst-transition-colors ".concat(j===x.id?"yst-ring-2 yst-ring-yellow-400":""),onMouseEnter:function(){return a(x.id)},onMouseLeave:function(){return a(null)},onClick:function(){return b(x.id)},children:x.name}),d.jsxs("p",{className:"yst-ml-6 yst-mt-1 yst-text-sm yst-text-gray-600 yst-italic",children:['"',x.context,'"']})]},"".concat(x.id,"-").concat(x.rank))})})]})]})]}),A.length>0&&d.jsxs("details",{className:"yst-border-t yst-pt-4",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden yst-font-semibold yst-mb-2",children:[d.jsxs("span",{children:["Citations (",A.length,")"]}),d.jsx("span",{className:"yst-text-gray-500",children:"▶"})]}),d.jsx("div",{className:"yst-mt-2",children:d.jsxs(C.Table,{children:[d.jsx(C.Table.Head,{children:d.jsxs(C.Table.Row,{children:[d.jsx(C.Table.Header,{children:"Rank"}),d.jsx(C.Table.Header,{children:"Domain"}),d.jsx(C.Table.Header,{children:"URL"}),d.jsx(C.Table.Header,{children:"Associated brands"})]})}),d.jsx(C.Table.Body,{children:A.sort(function(x,N){return x.rank-N.rank}).map(function(x,N){return d.jsxs(C.Table.Row,{children:[d.jsxs(C.Table.Cell,{children:["#",x.rank]}),d.jsx(C.Table.Cell,{children:x.rootDomain}),d.jsx(C.Table.Cell,{children:d.jsx(C.Link,{href:x.url,target:"_blank",rel:"noopener noreferrer",children:x.url})}),d.jsx(C.Table.Cell,{children:x.associatedBrands.length>0?d.jsx("div",{className:"yst-flex yst-flex-wrap yst-gap-1",children:x.associatedBrands.map(function(_){return d.jsx(C.Badge,{variant:_.isSelf?"info":"plain",className:"yst-cursor-pointer yst-transition-colors ".concat(j===_.id?"yst-ring-2 yst-ring-yellow-400":""),onMouseEnter:function(){return a(_.id)},onMouseLeave:function(){return a(null)},onClick:function(){return b(_.id)},children:_.name},_.id)})}):d.jsx("span",{className:"yst-text-gray-500",children:"None"})})]},"".concat(x.url,"-").concat(N))})})]})})]}),E.length>0&&d.jsxs("details",{className:"yst-border-t yst-pt-4",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden yst-font-semibold yst-mb-2",children:[d.jsxs("span",{children:["Sentiment Analysis (",E.length,")"]}),d.jsx("span",{className:"yst-text-gray-500",children:"▶"})]}),d.jsx("div",{className:"yst-mt-2 yst-flex yst-flex-col yst-gap-4",children:E.map(function(x){return d.jsxs("div",{className:"yst-rounded-lg yst-border yst-border-gray-300 yst-p-4",children:[d.jsxs("div",{className:"yst-flex yst-items-center yst-gap-3 yst-mb-3",children:[d.jsxs("div",{className:"yst-flex yst-items-center yst-gap-2",children:[d.jsx("span",{className:"yst-text-sm yst-font-semibold",children:"Score:"}),d.jsx(C.Badge,{variant:x.score>.3?"success":x.score<-.3?"error":"plain",children:x.score.toFixed(2)})]}),d.jsxs("div",{className:"yst-flex yst-items-center yst-gap-2",children:[d.jsx("span",{className:"yst-text-sm yst-font-semibold",children:"Confidence:"}),d.jsxs(C.Badge,{variant:"plain",children:[(x.confidence*100).toFixed(0),"%"]})]})]}),x.brands.length>0&&d.jsxs("div",{className:"yst-mb-3",children:[d.jsx("span",{className:"yst-text-sm yst-font-semibold yst-mb-1 yst-block",children:"Brands:"}),d.jsx("div",{className:"yst-flex yst-flex-wrap yst-gap-1",children:x.brands.map(function(N){return d.jsx(C.Badge,{variant:N.isSelf?"info":"plain",className:"yst-cursor-pointer yst-transition-colors ".concat(j===N.id?"yst-ring-2 yst-ring-yellow-400":""),onMouseEnter:function(){return a(N.id)},onMouseLeave:function(){return a(null)},onClick:function(){return b(N.id)},children:N.name},N.id)})})]}),x.keywords.length>0&&d.jsxs("div",{children:[d.jsx("span",{className:"yst-text-sm yst-font-semibold yst-mb-1 yst-block",children:"Keywords:"}),d.jsx("div",{className:"yst-flex yst-flex-wrap yst-gap-2",children:x.keywords.map(function(N,_){return d.jsxs("div",{className:"yst-flex yst-items-center yst-gap-1 yst-rounded yst-bg-gray-100 yst-px-2 yst-py-1",children:[d.jsx("span",{className:"yst-text-sm",children:N.keyword}),d.jsx(C.Badge,{variant:N.isPositive?"success":N.isNegative?"error":"plain",children:N.sentiment.toFixed(2)})]},_)})})]})]},x.id)})})]}),n.rawResponse&&d.jsxs("details",{className:"yst-border-t yst-pt-4",children:[d.jsxs("summary",{className:"yst-flex yst-items-center yst-justify-between yst-cursor-pointer yst-list-none [&::-webkit-details-marker]:yst-hidden yst-font-semibold yst-mb-2",children:[d.jsx("span",{children:"Raw Response"}),d.jsx("span",{className:"yst-text-gray-500",children:"▶"})]}),d.jsx("div",{className:"yst-mt-2",children:d.jsx("pre",{className:"yst-rounded-lg yst-border yst-border-gray-300 yst-bg-gray-50 yst-p-4 yst-text-xs yst-overflow-x-auto yst-max-h-96 yst-overflow-y-auto",children:JSON.stringify(n.rawResponse,null,2)})})]})]})]})})})},I9=function(){var e=It(),n=e.brandId,r=e.analysisId,i=ht(),s=Bs(n,{query:{enabled:!!n,select:function(y){var m=y.data;return m}}}),a=s.data,o=s.isLoading,l=Fo(n,r,{query:{enabled:!!n&&!!r,select:function(y){var m=y.data;return m==null?void 0:m.analysis}}}),u=l.data,c=l.isLoading,f=o||c,p=u&&u.status===zn.completed;return f?d.jsx(Yi,{}):p?d.jsxs(C.Card,{children:[d.jsx(Yu,{title:"Scan details",children:d.jsx(C.Button,{variant:"secondary",onClick:function(){return i("/brands/".concat(n,"/analysis/").concat(r))},children:"Back to analysis results"})}),u.scans.map(function(h){return d.jsx(M9,{brandId:n,analysisId:r,scanId:h.id,provider:h.aiProvider?String(h.aiProvider):"Unknown",scanFinishedAt:h.finishedAt,brandName:a==null?void 0:a.name},h.id)})]}):d.jsxs(C.Card,{children:[d.jsx(Yu,{title:"Scan details"}),d.jsx(C.Card.Content,{children:d.jsx("p",{children:"No completed analysis found. Please run an analysis first."})})]})},M9=function(e){var n=e.brandId,r=e.analysisId,i=e.scanId,s=e.provider,a=e.scanFinishedAt,o=e.brandName,l=ax(n,r,i,{query:{enabled:!!n&&!!r&&!!i,select:function(h){var y=h.data;return y}}}),u=l.data,c=l.isLoading;if(c)return d.jsx(Yi,{});var f=(u==null?void 0:u.queryResults)||[];return f.length===0?null:d.jsx(C.Card,{className:"yst-mb-4",children:d.jsxs(C.Card.Content,{children:[d.jsxs("p",{className:"yst-mb-8",children:[o," - Scan performed on:"," ",d.jsx(C.Badge,{children:a?Br(new Date(a),"yyyy-MM-dd HH:mm:ss"):"In progress"})," ","- AI Platform:"," ",d.jsx(C.Badge,{className:"yst-bg-green-100 yst-text-green-800",children:s})]}),f.map(function(p){return d.jsx(T9,{queryResult:p},p.id)})]})},i)};const L9=Object.freeze(Object.defineProperty({__proto__:null,default:I9},Symbol.toStringTag,{value:"Module"}));var N9=function(){var e=It(),n=e.hostAppProps.basename,r=F.useCallback(function(a){if(!n||!a.startsWith(n))return a;var o=a.slice(n.length);return o||"/"},[n]),i=F.useCallback(function(a){if(!n)return a;var o=a.startsWith("/")?a:"/".concat(a);return"".concat(n).concat(o)},[n]),s=F.useCallback(function(a){return n?a.startsWith(n):a.startsWith("/")&&!a.startsWith("//")},[n]);return{basename:n||"",stripBasename:r,addBasename:i,isWithinBasename:s}};function Ql(t,e){return B9(t)||D9(t,e)||_9(t,e)||R9()}function R9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
74
74
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _9(t,e){if(t){if(typeof t=="string")return Xp(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xp(t,e):void 0}}function Xp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function D9(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}function B9(t){if(Array.isArray(t))return t}var F9=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.shouldBlock,r=n===void 0?!0:n,i=e.onConfirmLeave,s=e.onCancelLeave,a=ht(),o=N9(),l=o.basename,u=o.stripBasename,c=F.useState(!1),f=Ql(c,2),p=f[0],h=f[1],y=F.useState(null),m=Ql(y,2),v=m[0],g=m[1],A=F.useState(!1),E=Ql(A,2),j=E[0],S=E[1],b=F.useRef(!1);F.useEffect(function(){if(!(!r||j)){var I=function(z){var L=z.target,P=L.closest("a");if(P){var D=P.getAttribute("href");if(D&&D.startsWith("/")&&!D.startsWith("//")){var B=window.location.pathname,V=u(D),W=u(B);V!==W&&(z.preventDefault(),z.stopPropagation(),g(V),h(!0))}}};return document.addEventListener("click",I,!0),function(){return document.removeEventListener("click",I,!0)}}},[r,u,j]),F.useEffect(function(){if(!(!r||j)){b.current=!1;var I=function(){if(!b.current){b.current=!0;return}g(-1),h(!0);var L=window.location.href;window.history.pushState({blockerActive:!0},"",L)};window.addEventListener("popstate",I);var T=setTimeout(function(){var z=window.location.href;window.history.pushState({blockerActive:!0},"",z),b.current=!0},50);return function(){var z;clearTimeout(T),window.removeEventListener("popstate",I),b.current&&(z=window.history.state)!==null&&z!==void 0&&z.blockerActive&&window.history.back()}}},[r,j]),F.useEffect(function(){if(r){var I=function(z){z.preventDefault(),z.returnValue=""};return window.addEventListener("beforeunload",I),function(){return window.removeEventListener("beforeunload",I)}}},[r]);var w=F.useCallback(function(I){if(typeof I=="number")a(I);else{var T=l&&I.startsWith(l)?u(I):I;a(T)}},[a,u,l]),x=F.useCallback(function(){v!==null&&(h(!1),S(!0),i==null||i(),setTimeout(function(){if(v===-1){var I;(I=window.history.state)!==null&&I!==void 0&&I.blockerActive?(window.history.back(),setTimeout(function(){window.history.back()},10)):window.history.back()}else w(v);g(null),setTimeout(function(){return S(!1)},100)},0))},[v,w,i]),N=F.useCallback(function(){h(!1),g(null),s==null||s()},[s]),_=F.useCallback(function(I){r?(g(I),h(!0)):w(I)},[r,w]);return{showModal:p,pendingNavigation:v,confirmLeave:x,cancelLeave:N,navigateAway:_}};function z9(t,e){return W9(t)||q9(t,e)||H9(t,e)||U9()}function U9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
75
75
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function H9(t,e){if(t){if(typeof t=="string")return Jp(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jp(t,e):void 0}}function Jp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function q9(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}function W9(t){if(Array.isArray(t))return t}var Q9=function(e){var n=e.isOpen,r=e.onClose,i=on(),s=jc(),a=F.useState(""),o=z9(a,2),l=o[0],u=o[1],c=Ux({mutation:{onSettled:function(){i.clear()},onSuccess:function(){r(),s("Successfully deleted all data.",{variant:"success"})},onError:function(){i.clear(),s("Failed to delete all data. Please try again later.",{variant:"error"})}}}),f=c.mutate,p=c.isPending;return F.useEffect(function(){n&&u("")},[n]),d.jsx(Wo,{isOpen:n,onClose:r,onConfirm:function(){f()},isLoading:p,disabled:l!=="DELETE ALL",title:"Delete all data?",description:d.jsxs(d.Fragment,{children:[d.jsx("p",{children:"This will permanently erase all brands, analysis results, and queries from your account."}),d.jsx("p",{children:"This action cannot be undone."}),d.jsx(C.TextField,{id:"delete-all-confirmation",label:"To confirm, please type DELETE ALL:",value:l,onChange:function(h){return u(h.target.value)}}),d.jsx("p",{children:d.jsx("em",{children:"This is to make sure you understand this action is permanent."})})]}),confirmText:"Yes, delete all data",cancelText:"No, go back"})};function ic(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n=typeof Symbol=="function"?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(h,y,m,v){var g=y&&y.prototype instanceof o?y:o,A=Object.create(g.prototype);return Ht(A,"_invoke",function(E,j,S){var b,w,x,N=0,_=S||[],I=!1,T={p:0,n:0,v:t,a:z,f:z.bind(t,4),d:function(P,D){return b=P,w=0,x=t,T.n=D,a}};function z(L,P){for(w=L,x=P,e=0;!I&&N&&!D&&e<_.length;e++){var D,B=_[e],V=T.p,W=B[2];L>3?(D=W===P)&&(x=B[(w=B[4])?5:(w=3,3)],B[4]=B[5]=t):B[0]<=V&&((D=L<2&&V<B[1])?(w=0,T.v=P,T.n=B[1]):V<W&&(D=L<3||B[0]>P||P>W)&&(B[4]=L,B[5]=P,T.n=W,w=0))}if(D||L>1)return a;throw I=!0,P}return function(L,P,D){if(N>1)throw TypeError("Generator is already running");for(I&&P===1&&z(P,D),w=P,x=D;(e=w<2?t:x)||!I;){b||(w?w<3?(w>1&&(T.n=-1),z(w,x)):T.n=x:T.v=x);try{if(N=2,b){if(w||(L="next"),e=b[L]){if(!(e=e.call(b,x)))throw TypeError("iterator result is not an object");if(!e.done)return e;x=e.value,w<2&&(w=0)}else w===1&&(e=b.return)&&e.call(b),w<2&&(x=TypeError("The iterator does not provide a '"+L+"' method"),w=1);b=t}else if((e=(I=T.n<0)?x:E.call(j,T))!==a)break}catch(B){b=t,w=1,x=B}finally{N=1}}return{value:e,done:I}}}(h,m,v),!0),A}var a={};function o(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Ht(e={},r,function(){return this}),e),f=u.prototype=o.prototype=Object.create(c);function p(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,u):(h.__proto__=u,Ht(h,i,"GeneratorFunction")),h.prototype=Object.create(f),h}return l.prototype=u,Ht(f,"constructor",u),Ht(u,"constructor",l),l.displayName="GeneratorFunction",Ht(u,i,"GeneratorFunction"),Ht(f),Ht(f,i,"Generator"),Ht(f,r,function(){return this}),Ht(f,"toString",function(){return"[object Generator]"}),(ic=function(){return{w:s,m:p}})()}function Ht(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(s){i=0}Ht=function(a,o,l,u){function c(f,p){Ht(a,f,function(h){return this._invoke(f,p,h)})}o?i?i(a,o,{value:l,enumerable:!u,configurable:!u,writable:!u}):a[o]=l:(c("next",0),c("throw",1),c("return",2))},Ht(t,e,n,r)}function Zp(t,e,n,r,i,s,a){try{var o=t[s](a),l=o.value}catch(u){return void n(u)}o.done?e(l):Promise.resolve(l).then(r,i)}function G9(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function a(l){Zp(s,r,i,a,o,"next",l)}function o(l){Zp(s,r,i,a,o,"throw",l)}a(void 0)})}}function Y9(t,e){return J9(t)||X9(t,e)||K9(t,e)||V9()}function V9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
76
76
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K9(t,e){if(t){if(typeof t=="string")return $p(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$p(t,e):void 0}}function $p(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function X9(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}function J9(t){if(Array.isArray(t))return t}var Z9=function(e){var n=e.isOpen,r=e.brandId,i=e.onClose,s=e.brandName,a=on(),o=jc(),l=F.useState(""),u=Y9(l,2),c=u[0],f=u[1],p=Ex({mutation:{onSuccess:function(){var m=G9(ic().m(function g(){return ic().w(function(A){for(;;)switch(A.n){case 0:return A.n=1,Promise.all([a.invalidateQueries({queryKey:jn()}),a.invalidateQueries({queryKey:Uo()})]);case 1:o("Brand deleted successfully",{variant:"success"}),i();case 2:return A.a(2)}},g)}));function v(){return m.apply(this,arguments)}return v}(),onError:function(v){var g=v instanceof Error?v.message:"Please try again later.";o("Failed to delete brand. ".concat(g),{variant:"error"})}}}),h=p.mutate,y=p.isPending;return F.useEffect(function(){n&&f("")},[n]),d.jsx(Wo,{isOpen:n,onClose:i,onConfirm:function(){if(!s){console.error("Brand name is required for deletion confirmation");return}h({brandId:r})},isLoading:y,disabled:c.toLowerCase()!==(s==null?void 0:s.toLowerCase()),title:"Delete brand?",description:d.jsxs(d.Fragment,{children:[d.jsx("p",{children:"This will permanently delete all data associated with this brand, including past analyses and query history."}),d.jsx("p",{children:"This action cannot be undone."}),d.jsx(C.TextField,{id:"delete-modal-brand-name-confirmation",label:"To confirm, please type your brand name ".concat(s,":"),value:c,onChange:function(m){return f(m.target.value)}}),d.jsx("p",{children:d.jsx("em",{children:"This is to make sure you understand this action is permanent."})})]}),confirmText:"Yes, delete brand",cancelText:"No, go back"})};function ta(t){"@babel/helpers - typeof";return ta=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ta(t)}function ks(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n=typeof Symbol=="function"?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(h,y,m,v){var g=y&&y.prototype instanceof o?y:o,A=Object.create(g.prototype);return qt(A,"_invoke",function(E,j,S){var b,w,x,N=0,_=S||[],I=!1,T={p:0,n:0,v:t,a:z,f:z.bind(t,4),d:function(P,D){return b=P,w=0,x=t,T.n=D,a}};function z(L,P){for(w=L,x=P,e=0;!I&&N&&!D&&e<_.length;e++){var D,B=_[e],V=T.p,W=B[2];L>3?(D=W===P)&&(x=B[(w=B[4])?5:(w=3,3)],B[4]=B[5]=t):B[0]<=V&&((D=L<2&&V<B[1])?(w=0,T.v=P,T.n=B[1]):V<W&&(D=L<3||B[0]>P||P>W)&&(B[4]=L,B[5]=P,T.n=W,w=0))}if(D||L>1)return a;throw I=!0,P}return function(L,P,D){if(N>1)throw TypeError("Generator is already running");for(I&&P===1&&z(P,D),w=P,x=D;(e=w<2?t:x)||!I;){b||(w?w<3?(w>1&&(T.n=-1),z(w,x)):T.n=x:T.v=x);try{if(N=2,b){if(w||(L="next"),e=b[L]){if(!(e=e.call(b,x)))throw TypeError("iterator result is not an object");if(!e.done)return e;x=e.value,w<2&&(w=0)}else w===1&&(e=b.return)&&e.call(b),w<2&&(x=TypeError("The iterator does not provide a '"+L+"' method"),w=1);b=t}else if((e=(I=T.n<0)?x:E.call(j,T))!==a)break}catch(B){b=t,w=1,x=B}finally{N=1}}return{value:e,done:I}}}(h,m,v),!0),A}var a={};function o(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(qt(e={},r,function(){return this}),e),f=u.prototype=o.prototype=Object.create(c);function p(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,u):(h.__proto__=u,qt(h,i,"GeneratorFunction")),h.prototype=Object.create(f),h}return l.prototype=u,qt(f,"constructor",u),qt(u,"constructor",l),l.displayName="GeneratorFunction",qt(u,i,"GeneratorFunction"),qt(f),qt(f,i,"Generator"),qt(f,r,function(){return this}),qt(f,"toString",function(){return"[object Generator]"}),(ks=function(){return{w:s,m:p}})()}function qt(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(s){i=0}qt=function(a,o,l,u){function c(f,p){qt(a,f,function(h){return this._invoke(f,p,h)})}o?i?i(a,o,{value:l,enumerable:!u,configurable:!u,writable:!u}):a[o]=l:(c("next",0),c("throw",1),c("return",2))},qt(t,e,n,r)}function ey(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ey(Object(n),!0).forEach(function(r){$9(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ey(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $9(t,e,n){return(e=eP(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eP(t){var e=tP(t,"string");return ta(e)=="symbol"?e:e+""}function tP(t,e){if(ta(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ta(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ty(t,e,n,r,i,s,a){try{var o=t[s](a),l=o.value}catch(u){return void n(u)}o.done?e(l):Promise.resolve(l).then(r,i)}function ny(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function a(l){ty(s,r,i,a,o,"next",l)}function o(l){ty(s,r,i,a,o,"throw",l)}a(void 0)})}}function nP(t,e){return aP(t)||sP(t,e)||iP(t,e)||rP()}function rP(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.