@kelet-ai/feedback-ui 1.1.4 → 1.2.0

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.
@@ -1,4 +1,4 @@
1
- (function(K,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],k):(K=typeof globalThis<"u"?globalThis:K||self,k(K["@kelet-ai/feedback-ui"]={},K.React))})(this,function(K,k){"use strict";function Pe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ce(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){var o=!1;try{o=this instanceof r}catch{}return o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return t[r]}})}),n}var te={exports:{}},X={};/**
1
+ (function(K,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],k):(K=typeof globalThis<"u"?globalThis:K||self,k(K["@kelet-ai/feedback-ui"]={},K.React))})(this,function(K,k){"use strict";function Ce(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Te(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){var o=!1;try{o=this instanceof r}catch{}return o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return t[r]}})}),n}var te={exports:{}},X={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var le;function Te(){if(le)return X;le=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,o,d){var f=null;if(d!==void 0&&(f=""+d),o.key!==void 0&&(f=""+o.key),"key"in o){d={};for(var l in o)l!=="key"&&(d[l]=o[l])}else d=o;return o=d.ref,{$$typeof:t,type:r,key:f,ref:o!==void 0?o:null,props:d}}return X.Fragment=e,X.jsx=n,X.jsxs=n,X}var Z={};/**
9
+ */var le;function Re(){if(le)return X;le=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,o,d){var f=null;if(d!==void 0&&(f=""+d),o.key!==void 0&&(f=""+o.key),"key"in o){d={};for(var l in o)l!=="key"&&(d[l]=o[l])}else d=o;return o=d.ref,{$$typeof:t,type:r,key:f,ref:o!==void 0?o:null,props:d}}return X.Fragment=e,X.jsx=n,X.jsxs=n,X}var Z={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,24 +14,24 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ue;function Re(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&function(){function t(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===s?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case E:return"Fragment";case D:return"Profiler";case _:return"StrictMode";case R:return"Suspense";case N:return"SuspenseList";case u:return"Activity"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case p:return"Portal";case T:return(a.displayName||"Context")+".Provider";case m:return(a._context.displayName||"Context")+".Consumer";case A:var O=a.render;return a=a.displayName,a||(a=O.displayName||O.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case F:return O=a.displayName||null,O!==null?O:t(a.type)||"Memo";case i:O=a._payload,a=a._init;try{return t(a(O))}catch{}}return null}function e(a){return""+a}function n(a){try{e(a);var O=!1}catch{O=!0}if(O){O=console;var j=O.error,I=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return j.call(O,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",I),e(a)}}function r(a){if(a===E)return"<>";if(typeof a=="object"&&a!==null&&a.$$typeof===i)return"<...>";try{var O=t(a);return O?"<"+O+">":"<...>"}catch{return"<...>"}}function o(){var a=v.A;return a===null?null:a.getOwner()}function d(){return Error("react-stack-top-frame")}function f(a){if(y.call(a,"key")){var O=Object.getOwnPropertyDescriptor(a,"key").get;if(O&&O.isReactWarning)return!1}return a.key!==void 0}function l(a,O){function j(){W||(W=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",O))}j.isReactWarning=!0,Object.defineProperty(a,"key",{get:j,configurable:!0})}function c(){var a=t(this.type);return S[a]||(S[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function h(a,O,j,I,Y,z,G,J){return j=z.ref,a={$$typeof:P,type:a,key:O,props:z,_owner:Y},(j!==void 0?j:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:c}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(a,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(a,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function b(a,O,j,I,Y,z,G,J){var L=O.children;if(L!==void 0)if(I)if(g(L)){for(I=0;I<L.length;I++)C(L[I]);Object.freeze&&Object.freeze(L)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else C(L);if(y.call(O,"key")){L=t(a);var H=Object.keys(O).filter(function(it){return it!=="key"});I=0<H.length?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}",oe[L+I]||(H=0<H.length?"{"+H.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var ue;function Oe(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&function(){function t(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===s?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case E:return"Fragment";case D:return"Profiler";case _:return"StrictMode";case R:return"Suspense";case S:return"SuspenseList";case u:return"Activity"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case p:return"Portal";case T:return(a.displayName||"Context")+".Provider";case m:return(a._context.displayName||"Context")+".Consumer";case A:var O=a.render;return a=a.displayName,a||(a=O.displayName||O.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case F:return O=a.displayName||null,O!==null?O:t(a.type)||"Memo";case i:O=a._payload,a=a._init;try{return t(a(O))}catch{}}return null}function e(a){return""+a}function n(a){try{e(a);var O=!1}catch{O=!0}if(O){O=console;var j=O.error,I=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return j.call(O,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",I),e(a)}}function r(a){if(a===E)return"<>";if(typeof a=="object"&&a!==null&&a.$$typeof===i)return"<...>";try{var O=t(a);return O?"<"+O+">":"<...>"}catch{return"<...>"}}function o(){var a=v.A;return a===null?null:a.getOwner()}function d(){return Error("react-stack-top-frame")}function f(a){if(y.call(a,"key")){var O=Object.getOwnPropertyDescriptor(a,"key").get;if(O&&O.isReactWarning)return!1}return a.key!==void 0}function l(a,O){function j(){W||(W=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",O))}j.isReactWarning=!0,Object.defineProperty(a,"key",{get:j,configurable:!0})}function c(){var a=t(this.type);return N[a]||(N[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function h(a,O,j,I,Y,z,G,J){return j=z.ref,a={$$typeof:P,type:a,key:O,props:z,_owner:Y},(j!==void 0?j:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:c}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(a,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(a,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function b(a,O,j,I,Y,z,G,J){var L=O.children;if(L!==void 0)if(I)if(g(L)){for(I=0;I<L.length;I++)C(L[I]);Object.freeze&&Object.freeze(L)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else C(L);if(y.call(O,"key")){L=t(a);var H=Object.keys(O).filter(function(st){return st!=="key"});I=0<H.length?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}",oe[L+I]||(H=0<H.length?"{"+H.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,I,L,H,L),oe[L+I]=!0)}if(L=null,j!==void 0&&(n(j),L=""+j),f(O)&&(n(O.key),L=""+O.key),"key"in O){j={};for(var ae in O)ae!=="key"&&(j[ae]=O[ae])}else j=O;return L&&l(j,typeof a=="function"?a.displayName||a.name||"Unknown":a),h(a,L,z,Y,o(),j,G,J)}function C(a){typeof a=="object"&&a!==null&&a.$$typeof===P&&a._store&&(a._store.validated=1)}var x=k,P=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),T=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),i=Symbol.for("react.lazy"),u=Symbol.for("react.activity"),s=Symbol.for("react.client.reference"),v=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,y=Object.prototype.hasOwnProperty,g=Array.isArray,w=console.createTask?console.createTask:function(){return null};x={react_stack_bottom_frame:function(a){return a()}};var W,S={},B=x.react_stack_bottom_frame.bind(x,d)(),V=w(r(d)),oe={};Z.Fragment=E,Z.jsx=function(a,O,j,I,Y){var z=1e4>v.recentlyCreatedOwnerStacks++;return b(a,O,j,!1,I,Y,z?Error("react-stack-top-frame"):B,z?w(r(a)):V)},Z.jsxs=function(a,O,j,I,Y){var z=1e4>v.recentlyCreatedOwnerStacks++;return b(a,O,j,!0,I,Y,z?Error("react-stack-top-frame"):B,z?w(r(a)):V)}}()),Z}var fe;function Oe(){return fe||(fe=1,process.env.NODE_ENV==="production"?te.exports=Te():te.exports=Re()),te.exports}var M=Oe();let Q=null,ce=!1;function _e(t){if(!t||!(t instanceof Element))return"unknown";const e=t;if(e.id)return`#${e.id}`;const n=e.getAttribute("data-feedback-id");if(n)return`[data-feedback-id="${n}"]`;const r=[];let o=e,d=0;const f=5;for(;o&&o!==document.body&&d<f;){let l=o.tagName.toLowerCase();if(o.classList.length>0){const h=Array.from(o.classList)[0];l+=`.${h}`}const c=o.parentElement;if(c){const h=Array.from(c.children),b=h.indexOf(o)+1;h.length>1&&(l+=`:nth-child(${b})`)}r.unshift(l),o=c,d++}return r.join(" > ")}function Ae(t){if(!t||!(t instanceof Element))return"";const e=t,n=e.getAttribute("aria-label");return n?n.substring(0,50):(e.textContent?.trim()||"").substring(0,50)}function De(t){const e={type:t.type,targetSelector:_e(t.target),targetText:Ae(t.target),timestamp:Date.now()};return t instanceof MouseEvent?e.coordinates={x:t.clientX,y:t.clientY}:t instanceof KeyboardEvent&&(e.key=t.key),e}function je(){if(ce||typeof window>"u")return;["click","keydown","submit","change"].forEach(e=>{window.addEventListener(e,n=>{Q=De(n)},{capture:!0,passive:!0})}),ce=!0}function Ne(){return Q?Date.now()-Q.timestamp>1e4?(Q=null,null):{...Q}:null}const q=k.createContext(null),Se="https://api.kelet.ai",Ie=()=>{const t=k.useContext(q);if(!t)throw new Error("useKelet must be used within a KeletProvider");return t},ie=()=>{const t=k.useContext(q);return t?t.feedback:(console.warn("No FeedbackHandler found: defaultFeedbackHandler is not possible since there's no KeletProvider wrapping this call, and handler not provided"),async()=>{})},Fe=({apiKey:t,project:e,baseUrl:n,children:r})=>{k.useEffect(()=>{je()},[]);const o=k.useContext(q),d=t||o?.api_key;if(!d)throw new Error("apiKey is required either directly or from a parent KeletProvider");let f=n||Se;f.endsWith("/api")&&(f=f.slice(0,-4)),f.endsWith("/")&&(f=f.slice(0,-1));const c={api_key:d,project:e,feedback:async h=>{const b=`${f}/api/projects/${e}/signal`,C=Ne(),x={...h.metadata??{},...C&&{$dom_event:C}},P={session_id:h.session_id,kind:h.kind,source:h.source,trigger_name:h.trigger_name,score:h.score,value:h.value,confidence:h.confidence,metadata:Object.keys(x).length>0?x:void 0,timestamp:h.timestamp||new Date().toISOString(),trace_id:h.trace_id},p=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify(P)});if(!p.ok)throw new Error(`Failed to submit feedback: ${p.statusText}`)}};return M.jsx(q.Provider,{value:c,children:r})},$=(t,e)=>{const n={...e};for(const r in e){const o=t[r],d=e[r];/^on[A-Z]/.test(r)?o&&d?n[r]=(...l)=>{d(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...d}:r==="className"?n[r]=[o,d].filter(Boolean).join(" "):n[r]=d!==void 0?d:o}return{...t,...n}},de=k.createContext(null),ee=()=>{const t=k.useContext(de);if(!t)throw new Error("VoteFeedback components must be used within VoteFeedback.Root");return t},Le={Root:({children:t,onFeedback:e,defaultText:n="",session_id:r,metadata:o,trigger_name:d,trace_id:f})=>{const l=typeof r=="function"?r():r,c=d||void 0,[h,b]=k.useState(!1),[C,x]=k.useState(n),[P,p]=k.useState(!1),[E,_]=k.useState(null),D=k.useRef(null),m=k.useRef(null),T=k.useId(),A=k.useId(),R=ie(),N=e||R;k.useEffect(()=>{b(!1),x(n),p(!1),_(null),setTimeout(()=>m.current?.focus(),0)},[l,n]);const F=k.useCallback(async()=>{_("upvote");const g={session_id:l,kind:"feedback",source:"human",trigger_name:c,score:1,...o&&{metadata:o},...f&&{trace_id:f}};try{p(!0),await N(g)}finally{p(!1)}},[N,l,o,c,f]),i=k.useCallback(async()=>{if(_("downvote"),N){const g={session_id:l,kind:"feedback",source:"human",trigger_name:c,score:0,...o&&{metadata:o},...f&&{trace_id:f}};try{p(!0),await N(g)}finally{p(!1)}}b(!0),setTimeout(()=>{D.current?.focus();const g=document.createElement("div");g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true"),g.className="sr-only",g.textContent="Feedback dialog opened. You can provide additional details about your downvote.",document.body.appendChild(g),setTimeout(()=>document.body.removeChild(g),1e3)},0)},[N,l,o,c,f]),u=k.useCallback(g=>{x(g.target.value)},[]),s=k.useCallback(async()=>{const g=C.trim().length>0;if(g){const w={session_id:l,kind:"feedback",source:"human",trigger_name:c,score:0,value:C,...o&&{metadata:o},...f&&{trace_id:f}};try{p(!0),await N(w)}finally{p(!1)}}if(b(!1),x(n),m.current?.focus(),g){const w=document.createElement("div");w.setAttribute("aria-live","polite"),w.className="sr-only",w.textContent="Feedback submitted successfully.",document.body.appendChild(w),setTimeout(()=>document.body.removeChild(w),1e3)}},[N,C,n,l,o,c,f]),v=k.useCallback(g=>{if(g.key==="Escape")b(!1),x(n),m.current?.focus();else if((g.metaKey||g.ctrlKey)&&g.key==="Enter")g.preventDefault(),s().then(w=>{});else if(g.key==="Tab"&&h){const w=document.getElementById(T);if(w){const W=w.querySelectorAll('button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'),S=W[0],B=W[W.length-1];g.shiftKey&&document.activeElement===S?(g.preventDefault(),B?.focus()):!g.shiftKey&&document.activeElement===B&&(g.preventDefault(),S?.focus())}}},[s,h,T,n]),y={onFeedback:N,showPopover:h,setShowPopover:b,feedbackText:C,setFeedbackText:x,isSubmitting:P,setIsSubmitting:p,vote:E,handleUpvote:F,handleDownvote:i,handleTextareaChange:u,handleSubmit:s,handleKeyDown:v,textareaRef:D,triggerRef:m,popoverId:T,triggerId:A,session_id:l,metadata:o,trigger_name:c,trace_id:f};return M.jsx(de.Provider,{value:y,children:t})},UpvoteButton:({asChild:t,children:e,onClick:n,...r})=>{const{handleUpvote:o,isSubmitting:d,vote:f}=ee(),l=k.useCallback(b=>{o(),n?.(b)},[o,n]),c={...r,onClick:l,disabled:d||r.disabled,"aria-label":r["aria-label"]||"Upvote feedback",type:"button"},h=f==="upvote";if(t){const b=typeof e=="function"?e({isSelected:h}):e;if(k.isValidElement(b))return k.cloneElement(b,$(c,b.props))}return M.jsx("button",{...c,children:typeof e=="function"?e({isSelected:h}):e})},DownvoteButton:({asChild:t,children:e,onClick:n,...r})=>{const{handleDownvote:o,showPopover:d,isSubmitting:f,popoverId:l,triggerId:c,triggerRef:h,vote:b}=ee(),C=k.useCallback(p=>{o(),n?.(p)},[o,n]),x={...r,ref:h,onClick:C,disabled:f||r.disabled,"aria-label":r["aria-label"]||"Downvote feedback","aria-expanded":d,"aria-controls":l,id:c,type:"button"},P=b==="downvote";if(t){const p=typeof e=="function"?e({isSelected:P}):e;if(k.isValidElement(p))return k.cloneElement(p,$(x,p.props));if(p)return p}return M.jsx("button",{...x,children:typeof e=="function"?e({isSelected:P}):e})},Popover:({asChild:t,children:e,...n})=>{const{showPopover:r,handleKeyDown:o,popoverId:d,triggerId:f}=ee();if(!r)return null;const l={...n,role:"dialog","aria-labelledby":f,"aria-modal":!0,"aria-describedby":`${d}-description`,id:d,onKeyDown:o,tabIndex:-1};return t&&k.isValidElement(e)?M.jsxs(M.Fragment,{children:[k.cloneElement(e,$(l,e.props)),M.jsx("div",{id:`${d}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"})]}):M.jsxs("div",{...l,children:[M.jsx("div",{id:`${d}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"}),e]})},Textarea:({asChild:t,value:e,onChange:n,...r})=>{const{feedbackText:o,handleTextareaChange:d,textareaRef:f,handleKeyDown:l,popoverId:c}=ee(),h={...r,ref:f,value:e!==void 0?e:o,onChange:n||d,onKeyDown:l,placeholder:r.placeholder||"What did we miss?","aria-label":r["aria-label"]||"Additional feedback","aria-describedby":`${c}-help`,rows:r.rows||3};return t&&k.isValidElement(r.children)?k.cloneElement(r.children,$(h,r.children.props)):M.jsx("textarea",{...h})},SubmitButton:({asChild:t,children:e,onClick:n,...r})=>{const{handleSubmit:o,isSubmitting:d,feedbackText:f}=ee(),l=k.useCallback(C=>{o(),n?.(C)},[o,n]),c=f.trim().length>0,h=c?"Submit feedback":"Close without feedback",b={...r,onClick:l,disabled:d||r.disabled,type:"button","aria-label":r["aria-label"]||h,"aria-describedby":c?void 0:"submit-help"};return t&&k.isValidElement(e)?M.jsxs(M.Fragment,{children:[k.cloneElement(e,$(b,e.props)),!c&&M.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]}):M.jsxs("button",{...b,children:[e,!c&&M.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]})}};var ne={exports:{}},Me=ne.exports,pe;function We(){return pe||(pe=1,function(t,e){(function(n,r){var o=r(n);t.exports=o})(Me,function(n){var r=["N","E","A","D"];function o(i,u){i.super_=u,i.prototype=Object.create(u.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}})}function d(i,u){Object.defineProperty(this,"kind",{value:i,enumerable:!0}),u&&u.length&&Object.defineProperty(this,"path",{value:u,enumerable:!0})}function f(i,u,s){f.super_.call(this,"E",i),Object.defineProperty(this,"lhs",{value:u,enumerable:!0}),Object.defineProperty(this,"rhs",{value:s,enumerable:!0})}o(f,d);function l(i,u){l.super_.call(this,"N",i),Object.defineProperty(this,"rhs",{value:u,enumerable:!0})}o(l,d);function c(i,u){c.super_.call(this,"D",i),Object.defineProperty(this,"lhs",{value:u,enumerable:!0})}o(c,d);function h(i,u,s){h.super_.call(this,"A",i),Object.defineProperty(this,"index",{value:u,enumerable:!0}),Object.defineProperty(this,"item",{value:s,enumerable:!0})}o(h,d);function b(i,u,s){var v=i.slice(u+1||i.length);return i.length=u<0?i.length+u:u,i.push.apply(i,v),i}function C(i){var u=typeof i;return u!=="object"?u:i===Math?"math":i===null?"null":Array.isArray(i)?"array":Object.prototype.toString.call(i)==="[object Date]"?"date":typeof i.toString=="function"&&/^\/.*\//.test(i.toString())?"regexp":"object"}function x(i){var u=0;if(i.length===0)return u;for(var s=0;s<i.length;s++){var v=i.charCodeAt(s);u=(u<<5)-u+v,u=u&u}return u}function P(i){var u=0,s=C(i);if(s==="array"){i.forEach(function(W){u+=P(W)});var v="[type: array, hash: "+u+"]";return u+x(v)}if(s==="object"){for(var y in i)if(i.hasOwnProperty(y)){var g="[ type: object, key: "+y+", value hash: "+P(i[y])+"]";u+=x(g)}return u}var w="[ type: "+s+" ; value: "+i+"]";return u+x(w)}function p(i,u,s,v,y,g,w,W){s=s||[],y=y||[],w=w||[];var S=y.slice(0);if(typeof g<"u"&&g!==null){if(v){if(typeof v=="function"&&v(S,g))return;if(typeof v=="object"){if(v.prefilter&&v.prefilter(S,g))return;if(v.normalize){var B=v.normalize(S,g,i,u);B&&(i=B[0],u=B[1])}}}S.push(g)}C(i)==="regexp"&&C(u)==="regexp"&&(i=i.toString(),u=u.toString());var V=typeof i,oe=typeof u,a,O,j,I,Y=V!=="undefined"||w&&w.length>0&&w[w.length-1].lhs&&Object.getOwnPropertyDescriptor(w[w.length-1].lhs,g),z=oe!=="undefined"||w&&w.length>0&&w[w.length-1].rhs&&Object.getOwnPropertyDescriptor(w[w.length-1].rhs,g);if(!Y&&z)s.push(new l(S,u));else if(!z&&Y)s.push(new c(S,i));else if(C(i)!==C(u))s.push(new f(S,i,u));else if(C(i)==="date"&&i-u!==0)s.push(new f(S,i,u));else if(V==="object"&&i!==null&&u!==null){for(a=w.length-1;a>-1;--a)if(w[a].lhs===i){I=!0;break}if(I)i!==u&&s.push(new f(S,i,u));else{if(w.push({lhs:i,rhs:u}),Array.isArray(i)){for(W&&(i.sort(function(L,H){return P(L)-P(H)}),u.sort(function(L,H){return P(L)-P(H)})),a=u.length-1,O=i.length-1;a>O;)s.push(new h(S,a,new l(void 0,u[a--])));for(;O>a;)s.push(new h(S,O,new c(void 0,i[O--])));for(;a>=0;--a)p(i[a],u[a],s,v,S,a,w,W)}else{var G=Object.keys(i),J=Object.keys(u);for(a=0;a<G.length;++a)j=G[a],I=J.indexOf(j),I>=0?(p(i[j],u[j],s,v,S,j,w,W),J[I]=null):p(i[j],void 0,s,v,S,j,w,W);for(a=0;a<J.length;++a)j=J[a],j&&p(void 0,u[j],s,v,S,j,w,W)}w.length=w.length-1}}else i!==u&&(V==="number"&&isNaN(i)&&isNaN(u)||s.push(new f(S,i,u)))}function E(i,u,s,v,y){var g=[];if(p(i,u,g,v,null,null,null,y),s)for(var w=0;w<g.length;++w)s(g[w]);return g}function _(i,u,s,v,y,g,w){return p(i,u,s,v,y,g,w,!0)}function D(i,u,s,v){var y=v?function(w){w&&v.push(w)}:void 0,g=E(i,u,y,s);return v||(g.length?g:void 0)}function m(i,u,s,v){var y=v?function(w){w&&v.push(w)}:void 0,g=E(i,u,y,s,!0);return v||(g.length?g:void 0)}function T(i,u,s){if(s.path&&s.path.length){var v=i[u],y,g=s.path.length-1;for(y=0;y<g;y++)v=v[s.path[y]];switch(s.kind){case"A":T(v[s.path[y]],s.index,s.item);break;case"D":delete v[s.path[y]];break;case"E":case"N":v[s.path[y]]=s.rhs;break}}else switch(s.kind){case"A":T(i[u],s.index,s.item);break;case"D":i=b(i,u);break;case"E":case"N":i[u]=s.rhs;break}return i}function A(i,u,s){if(typeof s>"u"&&u&&~r.indexOf(u.kind)&&(s=u),i&&s&&s.kind){for(var v=i,y=-1,g=s.path?s.path.length-1:0;++y<g;)typeof v[s.path[y]]>"u"&&(v[s.path[y]]=typeof s.path[y+1]<"u"&&typeof s.path[y+1]=="number"?[]:{}),v=v[s.path[y]];switch(s.kind){case"A":s.path&&typeof v[s.path[y]]>"u"&&(v[s.path[y]]=[]),T(s.path?v[s.path[y]]:v,s.index,s.item);break;case"D":delete v[s.path[y]];break;case"E":case"N":v[s.path[y]]=s.rhs;break}}}function R(i,u,s){if(s.path&&s.path.length){var v=i[u],y,g=s.path.length-1;for(y=0;y<g;y++)v=v[s.path[y]];switch(s.kind){case"A":R(v[s.path[y]],s.index,s.item);break;case"D":v[s.path[y]]=s.lhs;break;case"E":v[s.path[y]]=s.lhs;break;case"N":delete v[s.path[y]];break}}else switch(s.kind){case"A":R(i[u],s.index,s.item);break;case"D":i[u]=s.lhs;break;case"E":i[u]=s.lhs;break;case"N":i=b(i,u);break}return i}function N(i,u,s){if(i&&u&&s&&s.kind){var v=i,y,g;for(g=s.path.length-1,y=0;y<g;y++)typeof v[s.path[y]]>"u"&&(v[s.path[y]]={}),v=v[s.path[y]];switch(s.kind){case"A":R(v[s.path[y]],s.index,s.item);break;case"D":v[s.path[y]]=s.lhs;break;case"E":v[s.path[y]]=s.lhs;break;case"N":delete v[s.path[y]];break}}}function F(i,u,s){if(i&&u){var v=function(y){(!s||s(i,u,y))&&A(i,u,y)};E(i,u,v)}}return Object.defineProperties(D,{diff:{value:D,enumerable:!0},orderIndependentDiff:{value:m,enumerable:!0},observableDiff:{value:E,enumerable:!0},orderIndependentObservableDiff:{value:_,enumerable:!0},orderIndepHash:{value:P,enumerable:!0},applyDiff:{value:F,enumerable:!0},applyChange:{value:A,enumerable:!0},revertChange:{value:N,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),D.DeepDiff=D,n&&(n.DeepDiff=D),D})}(ne)),ne.exports}var he=We();class ze{diff(e,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const d=this.castInput(e,r),f=this.castInput(n,r),l=this.removeEmpty(this.tokenize(d,r)),c=this.removeEmpty(this.tokenize(f,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(e,n,r,o){var d;const f=m=>{if(m=this.postProcess(m,r),o){setTimeout(function(){o(m)},0);return}else return m},l=n.length,c=e.length;let h=1,b=l+c;r.maxEditLength!=null&&(b=Math.min(b,r.maxEditLength));const C=(d=r.timeout)!==null&&d!==void 0?d:1/0,x=Date.now()+C,P=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(P[0],n,e,0,r);if(P[0].oldPos+1>=c&&p+1>=l)return f(this.buildValues(P[0].lastComponent,n,e));let E=-1/0,_=1/0;const D=()=>{for(let m=Math.max(E,-h);m<=Math.min(_,h);m+=2){let T;const A=P[m-1],R=P[m+1];A&&(P[m-1]=void 0);let N=!1;if(R){const i=R.oldPos-m;N=R&&0<=i&&i<l}const F=A&&A.oldPos+1<c;if(!N&&!F){P[m]=void 0;continue}if(!F||N&&A.oldPos<R.oldPos?T=this.addToPath(R,!0,!1,0,r):T=this.addToPath(A,!1,!0,1,r),p=this.extractCommon(T,n,e,m,r),T.oldPos+1>=c&&p+1>=l)return f(this.buildValues(T.lastComponent,n,e))||!0;P[m]=T,T.oldPos+1>=c&&(_=Math.min(_,m-1)),p+1>=l&&(E=Math.max(E,m+1))}h++};if(o)(function m(){setTimeout(function(){if(h>b||Date.now()>x)return o(void 0);D()||m()},0)})();else for(;h<=b&&Date.now()<=x;){const m=D();if(m)return m}}addToPath(e,n,r,o,d){const f=e.lastComponent;return f&&!d.oneChangePerToken&&f.added===n&&f.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:f.count+1,added:n,removed:r,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:f}}}extractCommon(e,n,r,o,d){const f=n.length,l=r.length;let c=e.oldPos,h=c-o,b=0;for(;h+1<f&&c+1<l&&this.equals(r[c+1],n[h+1],d);)h++,c++,b++,d.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return b&&!d.oneChangePerToken&&(e.lastComponent={count:b,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=c,h}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const o=[];let d;for(;e;)o.push(e),d=e.previousComponent,delete e.previousComponent,e=d;o.reverse();const f=o.length;let l=0,c=0,h=0;for(;l<f;l++){const b=o[l];if(b.removed)b.value=this.join(r.slice(h,h+b.count)),h+=b.count;else{if(!b.added&&this.useLongestToken){let C=n.slice(c,c+b.count);C=C.map(function(x,P){const p=r[h+P];return p.length>x.length?p:x}),b.value=this.join(C)}else b.value=this.join(n.slice(c,c+b.count));c+=b.count,b.added||(h+=b.count)}}return o}}class Ke extends ze{constructor(){super(...arguments),this.tokenize=He}equals(e,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
22
+ <%s key={someKey} {...props} />`,I,L,H,L),oe[L+I]=!0)}if(L=null,j!==void 0&&(n(j),L=""+j),f(O)&&(n(O.key),L=""+O.key),"key"in O){j={};for(var ae in O)ae!=="key"&&(j[ae]=O[ae])}else j=O;return L&&l(j,typeof a=="function"?a.displayName||a.name||"Unknown":a),h(a,L,z,Y,o(),j,G,J)}function C(a){typeof a=="object"&&a!==null&&a.$$typeof===P&&a._store&&(a._store.validated=1)}var x=k,P=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),T=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),S=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),i=Symbol.for("react.lazy"),u=Symbol.for("react.activity"),s=Symbol.for("react.client.reference"),v=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,y=Object.prototype.hasOwnProperty,g=Array.isArray,w=console.createTask?console.createTask:function(){return null};x={react_stack_bottom_frame:function(a){return a()}};var W,N={},B=x.react_stack_bottom_frame.bind(x,d)(),V=w(r(d)),oe={};Z.Fragment=E,Z.jsx=function(a,O,j,I,Y){var z=1e4>v.recentlyCreatedOwnerStacks++;return b(a,O,j,!1,I,Y,z?Error("react-stack-top-frame"):B,z?w(r(a)):V)},Z.jsxs=function(a,O,j,I,Y){var z=1e4>v.recentlyCreatedOwnerStacks++;return b(a,O,j,!0,I,Y,z?Error("react-stack-top-frame"):B,z?w(r(a)):V)}}()),Z}var fe;function _e(){return fe||(fe=1,process.env.NODE_ENV==="production"?te.exports=Re():te.exports=Oe()),te.exports}var M=_e();let Q=null,ce=!1;function Ae(t){if(!t||!(t instanceof Element))return"unknown";const e=t;if(e.id)return`#${e.id}`;const n=e.getAttribute("data-feedback-id");if(n)return`[data-feedback-id="${n}"]`;const r=[];let o=e,d=0;const f=5;for(;o&&o!==document.body&&d<f;){let l=o.tagName.toLowerCase();if(o.classList.length>0){const h=Array.from(o.classList)[0];l+=`.${h}`}const c=o.parentElement;if(c){const h=Array.from(c.children),b=h.indexOf(o)+1;h.length>1&&(l+=`:nth-child(${b})`)}r.unshift(l),o=c,d++}return r.join(" > ")}function De(t){if(!t||!(t instanceof Element))return"";const e=t,n=e.getAttribute("aria-label");return n?n.substring(0,50):(e.textContent?.trim()||"").substring(0,50)}function je(t){const e={type:t.type,targetSelector:Ae(t.target),targetText:De(t.target),timestamp:Date.now()};return t instanceof MouseEvent?e.coordinates={x:t.clientX,y:t.clientY}:t instanceof KeyboardEvent&&(e.key=t.key),e}function Se(){if(ce||typeof window>"u")return;["click","keydown","submit","change"].forEach(e=>{window.addEventListener(e,n=>{Q=je(n)},{capture:!0,passive:!0})}),ce=!0}function Ne(){return Q?Date.now()-Q.timestamp>1e4?(Q=null,null):{...Q}:null}const q=k.createContext(null),Ie="https://api.kelet.ai",Fe=()=>{const t=k.useContext(q);if(!t)throw new Error("useKelet must be used within a KeletProvider");return t},de=()=>{const t=k.useContext(q);return t?t.feedback:(console.warn("No FeedbackHandler found: defaultFeedbackHandler is not possible since there's no KeletProvider wrapping this call, and handler not provided"),async()=>{})},ie=de,Le=({apiKey:t,project:e,baseUrl:n,children:r})=>{k.useEffect(()=>{Se()},[]);const o=k.useContext(q),d=t||o?.api_key;if(!d)throw new Error("apiKey is required either directly or from a parent KeletProvider");let f=n||Ie;f.endsWith("/api")&&(f=f.slice(0,-4)),f.endsWith("/")&&(f=f.slice(0,-1));const c={api_key:d,project:e,feedback:async h=>{const b=`${f}/api/projects/${e}/signal`,C=Ne(),x={...h.metadata??{},...C&&{$dom_event:C}},P={session_id:h.session_id,kind:h.kind,source:h.source,trigger_name:h.trigger_name,score:h.score,value:h.value,confidence:h.confidence,metadata:Object.keys(x).length>0?x:void 0,timestamp:h.timestamp||new Date().toISOString(),trace_id:h.trace_id},p=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify(P)});if(!p.ok)throw new Error(`Failed to submit feedback: ${p.statusText}`)}};return M.jsx(q.Provider,{value:c,children:r})},$=(t,e)=>{const n={...e};for(const r in e){const o=t[r],d=e[r];/^on[A-Z]/.test(r)?o&&d?n[r]=(...l)=>{d(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...d}:r==="className"?n[r]=[o,d].filter(Boolean).join(" "):n[r]=d!==void 0?d:o}return{...t,...n}},pe=k.createContext(null),ee=()=>{const t=k.useContext(pe);if(!t)throw new Error("VoteFeedback components must be used within VoteFeedback.Root");return t},Me={Root:({children:t,onFeedback:e,defaultText:n="",session_id:r,metadata:o,trigger_name:d,trace_id:f})=>{const l=typeof r=="function"?r():r,c=d||void 0,[h,b]=k.useState(!1),[C,x]=k.useState(n),[P,p]=k.useState(!1),[E,_]=k.useState(null),D=k.useRef(null),m=k.useRef(null),T=k.useId(),A=k.useId(),R=ie(),S=e||R;k.useEffect(()=>{b(!1),x(n),p(!1),_(null),setTimeout(()=>m.current?.focus(),0)},[l,n]);const F=k.useCallback(async()=>{_("upvote");const g={session_id:l,kind:"feedback",source:"human",trigger_name:c,score:1,...o&&{metadata:o},...f&&{trace_id:f}};try{p(!0),await S(g)}finally{p(!1)}},[S,l,o,c,f]),i=k.useCallback(async()=>{if(_("downvote"),S){const g={session_id:l,kind:"feedback",source:"human",trigger_name:c,score:0,...o&&{metadata:o},...f&&{trace_id:f}};try{p(!0),await S(g)}finally{p(!1)}}b(!0),setTimeout(()=>{D.current?.focus();const g=document.createElement("div");g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true"),g.className="sr-only",g.textContent="Feedback dialog opened. You can provide additional details about your downvote.",document.body.appendChild(g),setTimeout(()=>document.body.removeChild(g),1e3)},0)},[S,l,o,c,f]),u=k.useCallback(g=>{x(g.target.value)},[]),s=k.useCallback(async()=>{const g=C.trim().length>0;if(g){const w={session_id:l,kind:"feedback",source:"human",trigger_name:c,score:0,value:C,...o&&{metadata:o},...f&&{trace_id:f}};try{p(!0),await S(w)}finally{p(!1)}}if(b(!1),x(n),m.current?.focus(),g){const w=document.createElement("div");w.setAttribute("aria-live","polite"),w.className="sr-only",w.textContent="Feedback submitted successfully.",document.body.appendChild(w),setTimeout(()=>document.body.removeChild(w),1e3)}},[S,C,n,l,o,c,f]),v=k.useCallback(g=>{if(g.key==="Escape")b(!1),x(n),m.current?.focus();else if((g.metaKey||g.ctrlKey)&&g.key==="Enter")g.preventDefault(),s().then(w=>{});else if(g.key==="Tab"&&h){const w=document.getElementById(T);if(w){const W=w.querySelectorAll('button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'),N=W[0],B=W[W.length-1];g.shiftKey&&document.activeElement===N?(g.preventDefault(),B?.focus()):!g.shiftKey&&document.activeElement===B&&(g.preventDefault(),N?.focus())}}},[s,h,T,n]),y={onFeedback:S,showPopover:h,setShowPopover:b,feedbackText:C,setFeedbackText:x,isSubmitting:P,setIsSubmitting:p,vote:E,handleUpvote:F,handleDownvote:i,handleTextareaChange:u,handleSubmit:s,handleKeyDown:v,textareaRef:D,triggerRef:m,popoverId:T,triggerId:A,session_id:l,metadata:o,trigger_name:c,trace_id:f};return M.jsx(pe.Provider,{value:y,children:t})},UpvoteButton:({asChild:t,children:e,onClick:n,...r})=>{const{handleUpvote:o,isSubmitting:d,vote:f}=ee(),l=k.useCallback(b=>{o(),n?.(b)},[o,n]),c={...r,onClick:l,disabled:d||r.disabled,"aria-label":r["aria-label"]||"Upvote feedback",type:"button"},h=f==="upvote";if(t){const b=typeof e=="function"?e({isSelected:h}):e;if(k.isValidElement(b))return k.cloneElement(b,$(c,b.props))}return M.jsx("button",{...c,children:typeof e=="function"?e({isSelected:h}):e})},DownvoteButton:({asChild:t,children:e,onClick:n,...r})=>{const{handleDownvote:o,showPopover:d,isSubmitting:f,popoverId:l,triggerId:c,triggerRef:h,vote:b}=ee(),C=k.useCallback(p=>{o(),n?.(p)},[o,n]),x={...r,ref:h,onClick:C,disabled:f||r.disabled,"aria-label":r["aria-label"]||"Downvote feedback","aria-expanded":d,"aria-controls":l,id:c,type:"button"},P=b==="downvote";if(t){const p=typeof e=="function"?e({isSelected:P}):e;if(k.isValidElement(p))return k.cloneElement(p,$(x,p.props));if(p)return p}return M.jsx("button",{...x,children:typeof e=="function"?e({isSelected:P}):e})},Popover:({asChild:t,children:e,...n})=>{const{showPopover:r,handleKeyDown:o,popoverId:d,triggerId:f}=ee();if(!r)return null;const l={...n,role:"dialog","aria-labelledby":f,"aria-modal":!0,"aria-describedby":`${d}-description`,id:d,onKeyDown:o,tabIndex:-1};return t&&k.isValidElement(e)?M.jsxs(M.Fragment,{children:[k.cloneElement(e,$(l,e.props)),M.jsx("div",{id:`${d}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"})]}):M.jsxs("div",{...l,children:[M.jsx("div",{id:`${d}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"}),e]})},Textarea:({asChild:t,value:e,onChange:n,...r})=>{const{feedbackText:o,handleTextareaChange:d,textareaRef:f,handleKeyDown:l,popoverId:c}=ee(),h={...r,ref:f,value:e!==void 0?e:o,onChange:n||d,onKeyDown:l,placeholder:r.placeholder||"What did we miss?","aria-label":r["aria-label"]||"Additional feedback","aria-describedby":`${c}-help`,rows:r.rows||3};return t&&k.isValidElement(r.children)?k.cloneElement(r.children,$(h,r.children.props)):M.jsx("textarea",{...h})},SubmitButton:({asChild:t,children:e,onClick:n,...r})=>{const{handleSubmit:o,isSubmitting:d,feedbackText:f}=ee(),l=k.useCallback(C=>{o(),n?.(C)},[o,n]),c=f.trim().length>0,h=c?"Submit feedback":"Close without feedback",b={...r,onClick:l,disabled:d||r.disabled,type:"button","aria-label":r["aria-label"]||h,"aria-describedby":c?void 0:"submit-help"};return t&&k.isValidElement(e)?M.jsxs(M.Fragment,{children:[k.cloneElement(e,$(b,e.props)),!c&&M.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]}):M.jsxs("button",{...b,children:[e,!c&&M.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]})}};var ne={exports:{}},We=ne.exports,he;function Ke(){return he||(he=1,function(t,e){(function(n,r){var o=r(n);t.exports=o})(We,function(n){var r=["N","E","A","D"];function o(i,u){i.super_=u,i.prototype=Object.create(u.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}})}function d(i,u){Object.defineProperty(this,"kind",{value:i,enumerable:!0}),u&&u.length&&Object.defineProperty(this,"path",{value:u,enumerable:!0})}function f(i,u,s){f.super_.call(this,"E",i),Object.defineProperty(this,"lhs",{value:u,enumerable:!0}),Object.defineProperty(this,"rhs",{value:s,enumerable:!0})}o(f,d);function l(i,u){l.super_.call(this,"N",i),Object.defineProperty(this,"rhs",{value:u,enumerable:!0})}o(l,d);function c(i,u){c.super_.call(this,"D",i),Object.defineProperty(this,"lhs",{value:u,enumerable:!0})}o(c,d);function h(i,u,s){h.super_.call(this,"A",i),Object.defineProperty(this,"index",{value:u,enumerable:!0}),Object.defineProperty(this,"item",{value:s,enumerable:!0})}o(h,d);function b(i,u,s){var v=i.slice(u+1||i.length);return i.length=u<0?i.length+u:u,i.push.apply(i,v),i}function C(i){var u=typeof i;return u!=="object"?u:i===Math?"math":i===null?"null":Array.isArray(i)?"array":Object.prototype.toString.call(i)==="[object Date]"?"date":typeof i.toString=="function"&&/^\/.*\//.test(i.toString())?"regexp":"object"}function x(i){var u=0;if(i.length===0)return u;for(var s=0;s<i.length;s++){var v=i.charCodeAt(s);u=(u<<5)-u+v,u=u&u}return u}function P(i){var u=0,s=C(i);if(s==="array"){i.forEach(function(W){u+=P(W)});var v="[type: array, hash: "+u+"]";return u+x(v)}if(s==="object"){for(var y in i)if(i.hasOwnProperty(y)){var g="[ type: object, key: "+y+", value hash: "+P(i[y])+"]";u+=x(g)}return u}var w="[ type: "+s+" ; value: "+i+"]";return u+x(w)}function p(i,u,s,v,y,g,w,W){s=s||[],y=y||[],w=w||[];var N=y.slice(0);if(typeof g<"u"&&g!==null){if(v){if(typeof v=="function"&&v(N,g))return;if(typeof v=="object"){if(v.prefilter&&v.prefilter(N,g))return;if(v.normalize){var B=v.normalize(N,g,i,u);B&&(i=B[0],u=B[1])}}}N.push(g)}C(i)==="regexp"&&C(u)==="regexp"&&(i=i.toString(),u=u.toString());var V=typeof i,oe=typeof u,a,O,j,I,Y=V!=="undefined"||w&&w.length>0&&w[w.length-1].lhs&&Object.getOwnPropertyDescriptor(w[w.length-1].lhs,g),z=oe!=="undefined"||w&&w.length>0&&w[w.length-1].rhs&&Object.getOwnPropertyDescriptor(w[w.length-1].rhs,g);if(!Y&&z)s.push(new l(N,u));else if(!z&&Y)s.push(new c(N,i));else if(C(i)!==C(u))s.push(new f(N,i,u));else if(C(i)==="date"&&i-u!==0)s.push(new f(N,i,u));else if(V==="object"&&i!==null&&u!==null){for(a=w.length-1;a>-1;--a)if(w[a].lhs===i){I=!0;break}if(I)i!==u&&s.push(new f(N,i,u));else{if(w.push({lhs:i,rhs:u}),Array.isArray(i)){for(W&&(i.sort(function(L,H){return P(L)-P(H)}),u.sort(function(L,H){return P(L)-P(H)})),a=u.length-1,O=i.length-1;a>O;)s.push(new h(N,a,new l(void 0,u[a--])));for(;O>a;)s.push(new h(N,O,new c(void 0,i[O--])));for(;a>=0;--a)p(i[a],u[a],s,v,N,a,w,W)}else{var G=Object.keys(i),J=Object.keys(u);for(a=0;a<G.length;++a)j=G[a],I=J.indexOf(j),I>=0?(p(i[j],u[j],s,v,N,j,w,W),J[I]=null):p(i[j],void 0,s,v,N,j,w,W);for(a=0;a<J.length;++a)j=J[a],j&&p(void 0,u[j],s,v,N,j,w,W)}w.length=w.length-1}}else i!==u&&(V==="number"&&isNaN(i)&&isNaN(u)||s.push(new f(N,i,u)))}function E(i,u,s,v,y){var g=[];if(p(i,u,g,v,null,null,null,y),s)for(var w=0;w<g.length;++w)s(g[w]);return g}function _(i,u,s,v,y,g,w){return p(i,u,s,v,y,g,w,!0)}function D(i,u,s,v){var y=v?function(w){w&&v.push(w)}:void 0,g=E(i,u,y,s);return v||(g.length?g:void 0)}function m(i,u,s,v){var y=v?function(w){w&&v.push(w)}:void 0,g=E(i,u,y,s,!0);return v||(g.length?g:void 0)}function T(i,u,s){if(s.path&&s.path.length){var v=i[u],y,g=s.path.length-1;for(y=0;y<g;y++)v=v[s.path[y]];switch(s.kind){case"A":T(v[s.path[y]],s.index,s.item);break;case"D":delete v[s.path[y]];break;case"E":case"N":v[s.path[y]]=s.rhs;break}}else switch(s.kind){case"A":T(i[u],s.index,s.item);break;case"D":i=b(i,u);break;case"E":case"N":i[u]=s.rhs;break}return i}function A(i,u,s){if(typeof s>"u"&&u&&~r.indexOf(u.kind)&&(s=u),i&&s&&s.kind){for(var v=i,y=-1,g=s.path?s.path.length-1:0;++y<g;)typeof v[s.path[y]]>"u"&&(v[s.path[y]]=typeof s.path[y+1]<"u"&&typeof s.path[y+1]=="number"?[]:{}),v=v[s.path[y]];switch(s.kind){case"A":s.path&&typeof v[s.path[y]]>"u"&&(v[s.path[y]]=[]),T(s.path?v[s.path[y]]:v,s.index,s.item);break;case"D":delete v[s.path[y]];break;case"E":case"N":v[s.path[y]]=s.rhs;break}}}function R(i,u,s){if(s.path&&s.path.length){var v=i[u],y,g=s.path.length-1;for(y=0;y<g;y++)v=v[s.path[y]];switch(s.kind){case"A":R(v[s.path[y]],s.index,s.item);break;case"D":v[s.path[y]]=s.lhs;break;case"E":v[s.path[y]]=s.lhs;break;case"N":delete v[s.path[y]];break}}else switch(s.kind){case"A":R(i[u],s.index,s.item);break;case"D":i[u]=s.lhs;break;case"E":i[u]=s.lhs;break;case"N":i=b(i,u);break}return i}function S(i,u,s){if(i&&u&&s&&s.kind){var v=i,y,g;for(g=s.path.length-1,y=0;y<g;y++)typeof v[s.path[y]]>"u"&&(v[s.path[y]]={}),v=v[s.path[y]];switch(s.kind){case"A":R(v[s.path[y]],s.index,s.item);break;case"D":v[s.path[y]]=s.lhs;break;case"E":v[s.path[y]]=s.lhs;break;case"N":delete v[s.path[y]];break}}}function F(i,u,s){if(i&&u){var v=function(y){(!s||s(i,u,y))&&A(i,u,y)};E(i,u,v)}}return Object.defineProperties(D,{diff:{value:D,enumerable:!0},orderIndependentDiff:{value:m,enumerable:!0},observableDiff:{value:E,enumerable:!0},orderIndependentObservableDiff:{value:_,enumerable:!0},orderIndepHash:{value:P,enumerable:!0},applyDiff:{value:F,enumerable:!0},applyChange:{value:A,enumerable:!0},revertChange:{value:S,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),D.DeepDiff=D,n&&(n.DeepDiff=D),D})}(ne)),ne.exports}var me=Ke();class ze{diff(e,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const d=this.castInput(e,r),f=this.castInput(n,r),l=this.removeEmpty(this.tokenize(d,r)),c=this.removeEmpty(this.tokenize(f,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(e,n,r,o){var d;const f=m=>{if(m=this.postProcess(m,r),o){setTimeout(function(){o(m)},0);return}else return m},l=n.length,c=e.length;let h=1,b=l+c;r.maxEditLength!=null&&(b=Math.min(b,r.maxEditLength));const C=(d=r.timeout)!==null&&d!==void 0?d:1/0,x=Date.now()+C,P=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(P[0],n,e,0,r);if(P[0].oldPos+1>=c&&p+1>=l)return f(this.buildValues(P[0].lastComponent,n,e));let E=-1/0,_=1/0;const D=()=>{for(let m=Math.max(E,-h);m<=Math.min(_,h);m+=2){let T;const A=P[m-1],R=P[m+1];A&&(P[m-1]=void 0);let S=!1;if(R){const i=R.oldPos-m;S=R&&0<=i&&i<l}const F=A&&A.oldPos+1<c;if(!S&&!F){P[m]=void 0;continue}if(!F||S&&A.oldPos<R.oldPos?T=this.addToPath(R,!0,!1,0,r):T=this.addToPath(A,!1,!0,1,r),p=this.extractCommon(T,n,e,m,r),T.oldPos+1>=c&&p+1>=l)return f(this.buildValues(T.lastComponent,n,e))||!0;P[m]=T,T.oldPos+1>=c&&(_=Math.min(_,m-1)),p+1>=l&&(E=Math.max(E,m+1))}h++};if(o)(function m(){setTimeout(function(){if(h>b||Date.now()>x)return o(void 0);D()||m()},0)})();else for(;h<=b&&Date.now()<=x;){const m=D();if(m)return m}}addToPath(e,n,r,o,d){const f=e.lastComponent;return f&&!d.oneChangePerToken&&f.added===n&&f.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:f.count+1,added:n,removed:r,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:f}}}extractCommon(e,n,r,o,d){const f=n.length,l=r.length;let c=e.oldPos,h=c-o,b=0;for(;h+1<f&&c+1<l&&this.equals(r[c+1],n[h+1],d);)h++,c++,b++,d.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return b&&!d.oneChangePerToken&&(e.lastComponent={count:b,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=c,h}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const o=[];let d;for(;e;)o.push(e),d=e.previousComponent,delete e.previousComponent,e=d;o.reverse();const f=o.length;let l=0,c=0,h=0;for(;l<f;l++){const b=o[l];if(b.removed)b.value=this.join(r.slice(h,h+b.count)),h+=b.count;else{if(!b.added&&this.useLongestToken){let C=n.slice(c,c+b.count);C=C.map(function(x,P){const p=r[h+P];return p.length>x.length?p:x}),b.value=this.join(C)}else b.value=this.join(n.slice(c,c+b.count));c+=b.count,b.added||(h+=b.count)}}return o}}class Ye extends ze{constructor(){super(...arguments),this.tokenize=Ue}equals(e,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
23
23
  `))&&(e=e.trim()),(!r.newlineIsToken||!n.includes(`
24
24
  `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
25
25
  `)&&(e=e.slice(0,-1)),n.endsWith(`
26
- `)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const Ye=new Ke;function me(t,e,n){return Ye.diff(t,e,n)}function He(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
27
- `));const n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const d=r[o];o%2&&!e.newlineIsToken?n[n.length-1]+=d:n.push(d)}return n}function be(t,e,n,r,o,d,f){let l;f?typeof f=="function"?l={callback:f}:l=f:l={},typeof l.context>"u"&&(l.context=4);const c=l.context;if(l.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(l.callback){const{callback:b}=l;me(n,r,Object.assign(Object.assign({},l),{callback:C=>{const x=h(C);b(x)}}))}else return h(me(n,r,l));function h(b){if(!b)return;b.push({value:"",lines:[]});function C(m){return m.map(function(T){return" "+T})}const x=[];let P=0,p=0,E=[],_=1,D=1;for(let m=0;m<b.length;m++){const T=b[m],A=T.lines||Be(T.value);if(T.lines=A,T.added||T.removed){if(!P){const R=b[m-1];P=_,p=D,R&&(E=c>0?C(R.lines.slice(-c)):[],P-=E.length,p-=E.length)}for(const R of A)E.push((T.added?"+":"-")+R);T.added?D+=A.length:_+=A.length}else{if(P)if(A.length<=c*2&&m<b.length-2)for(const R of C(A))E.push(R);else{const R=Math.min(A.length,c);for(const F of C(A.slice(0,R)))E.push(F);const N={oldStart:P,oldLines:_-P+R,newStart:p,newLines:D-p+R,lines:E};x.push(N),P=0,p=0,E=[]}_+=A.length,D+=A.length}}for(const m of x)for(let T=0;T<m.lines.length;T++)m.lines[T].endsWith(`
26
+ `)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const He=new Ye;function be(t,e,n){return He.diff(t,e,n)}function Ue(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
27
+ `));const n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const d=r[o];o%2&&!e.newlineIsToken?n[n.length-1]+=d:n.push(d)}return n}function ve(t,e,n,r,o,d,f){let l;f?typeof f=="function"?l={callback:f}:l=f:l={},typeof l.context>"u"&&(l.context=4);const c=l.context;if(l.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(l.callback){const{callback:b}=l;be(n,r,Object.assign(Object.assign({},l),{callback:C=>{const x=h(C);b(x)}}))}else return h(be(n,r,l));function h(b){if(!b)return;b.push({value:"",lines:[]});function C(m){return m.map(function(T){return" "+T})}const x=[];let P=0,p=0,E=[],_=1,D=1;for(let m=0;m<b.length;m++){const T=b[m],A=T.lines||Je(T.value);if(T.lines=A,T.added||T.removed){if(!P){const R=b[m-1];P=_,p=D,R&&(E=c>0?C(R.lines.slice(-c)):[],P-=E.length,p-=E.length)}for(const R of A)E.push((T.added?"+":"-")+R);T.added?D+=A.length:_+=A.length}else{if(P)if(A.length<=c*2&&m<b.length-2)for(const R of C(A))E.push(R);else{const R=Math.min(A.length,c);for(const F of C(A.slice(0,R)))E.push(F);const S={oldStart:P,oldLines:_-P+R,newStart:p,newLines:D-p+R,lines:E};x.push(S),P=0,p=0,E=[]}_+=A.length,D+=A.length}}for(const m of x)for(let T=0;T<m.lines.length;T++)m.lines[T].endsWith(`
28
28
  `)?m.lines[T]=m.lines[T].slice(0,-1):(m.lines.splice(T+1,0,"\"),T++);return{oldFileName:t,newFileName:e,oldHeader:o,newHeader:d,hunks:x}}}function se(t){if(Array.isArray(t))return t.map(se).join(`
29
29
  `);const e=[];t.oldFileName==t.newFileName&&e.push("Index: "+t.oldFileName),e.push("==================================================================="),e.push("--- "+t.oldFileName+(typeof t.oldHeader>"u"?"":" "+t.oldHeader)),e.push("+++ "+t.newFileName+(typeof t.newHeader>"u"?"":" "+t.newHeader));for(let n=0;n<t.hunks.length;n++){const r=t.hunks[n];r.oldLines===0&&(r.oldStart-=1),r.newLines===0&&(r.newStart-=1),e.push("@@ -"+r.oldStart+","+r.oldLines+" +"+r.newStart+","+r.newLines+" @@");for(const o of r.lines)e.push(o)}return e.join(`
30
30
  `)+`
31
- `}function Ue(t,e,n,r,o,d,f){if(typeof f=="function"&&(f={callback:f}),f?.callback){const{callback:l}=f;be(t,e,n,r,o,d,Object.assign(Object.assign({},f),{callback:c=>{l(c?se(c):void 0)}}))}else{const l=be(t,e,n,r,o,d,f);return l?se(l):void 0}}function Be(t){const e=t.endsWith(`
31
+ `}function Be(t,e,n,r,o,d,f){if(typeof f=="function"&&(f={callback:f}),f?.callback){const{callback:l}=f;ve(t,e,n,r,o,d,Object.assign(Object.assign({},f),{callback:c=>{l(c?se(c):void 0)}}))}else{const l=ve(t,e,n,r,o,d,f);return l?se(l):void 0}}function Je(t){const e=t.endsWith(`
32
32
  `),n=t.split(`
33
33
  `).map(r=>r+`
34
- `);return e?n.pop():n.push(n.pop().slice(0,-1)),n}var re={exports:{}};const U=new Uint32Array(65536),Je=(t,e)=>{const n=t.length,r=e.length,o=1<<n-1;let d=-1,f=0,l=n,c=n;for(;c--;)U[t.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let h=U[e.charCodeAt(c)];const b=h|f;h|=(h&d)+d^d,f|=~(h|d),d&=h,f&o&&l++,d&o&&l--,f=f<<1|1,d=d<<1|~(b|f),f&=b}for(c=n;c--;)U[t.charCodeAt(c)]=0;return l},Ve=(t,e)=>{const n=e.length,r=t.length,o=[],d=[],f=Math.ceil(n/32),l=Math.ceil(r/32);for(let p=0;p<f;p++)d[p]=-1,o[p]=0;let c=0;for(;c<l-1;c++){let p=0,E=-1;const _=c*32,D=Math.min(32,r)+_;for(let m=_;m<D;m++)U[t.charCodeAt(m)]|=1<<m;for(let m=0;m<n;m++){const T=U[e.charCodeAt(m)],A=d[m/32|0]>>>m&1,R=o[m/32|0]>>>m&1,N=T|p,F=((T|R)&E)+E^E|T|R;let i=p|~(F|E),u=E&F;i>>>31^A&&(d[m/32|0]^=1<<m),u>>>31^R&&(o[m/32|0]^=1<<m),i=i<<1|A,u=u<<1|R,E=u|~(N|i),p=i&N}for(let m=_;m<D;m++)U[t.charCodeAt(m)]=0}let h=0,b=-1;const C=c*32,x=Math.min(32,r-C)+C;for(let p=C;p<x;p++)U[t.charCodeAt(p)]|=1<<p;let P=r;for(let p=0;p<n;p++){const E=U[e.charCodeAt(p)],_=d[p/32|0]>>>p&1,D=o[p/32|0]>>>p&1,m=E|h,T=((E|D)&b)+b^b|E|D;let A=h|~(T|b),R=b&T;P+=A>>>r-1&1,P-=R>>>r-1&1,A>>>31^_&&(d[p/32|0]^=1<<p),R>>>31^D&&(o[p/32|0]^=1<<p),A=A<<1|_,R=R<<1|D,b=R|~(m|A),h=A&m}for(let p=C;p<x;p++)U[t.charCodeAt(p)]=0;return P},ve=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?Je(t,e):Ve(t,e)},Ge=Ce(Object.freeze(Object.defineProperty({__proto__:null,closest:(t,e)=>{let n=1/0,r=0;for(let o=0;o<e.length;o++){const d=ve(t,e[o]);d<n&&(n=d,r=o)}return e[r]},distance:ve},Symbol.toStringTag,{value:"Module"})));var ye;function Xe(){return ye||(ye=1,function(t,e){(function(){var n;try{n=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var r=Ge,o=[],d=[],f={get:function(l,c,h){var b=h&&n&&h.useCollator;if(b){var C=l.length,x=c.length;if(C===0)return x;if(x===0)return C;var P,p,E,_,D;for(E=0;E<x;++E)o[E]=E,d[E]=c.charCodeAt(E);o[x]=x;var m;for(E=0;E<C;++E){for(p=E+1,_=0;_<x;++_)P=p,m=n.compare(l.charAt(E),String.fromCharCode(d[_]))===0,p=o[_]+(m?0:1),D=P+1,p>D&&(p=D),D=o[_+1]+1,p>D&&(p=D),o[_]=P;o[_]=p}return p}return r.distance(l,c)}};t!==null&&t.exports===e?t.exports=f:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=f:typeof window<"u"&&window!==null&&(window.Levenshtein=f)})()}(re,re.exports)),re.exports}var Ze=Xe();const Qe=Pe(Ze);function qe(t,e,n="git",r=1){switch(n){case"git":return ge(t,e,r);case"object":return $e(t,e);case"json":return et(t,e);default:return ge(t,e,r)}}function ge(t,e,n=1){const r=xe(t),o=xe(e),l=Ue("","",r,o,"","",{context:n}).split(`
34
+ `);return e?n.pop():n.push(n.pop().slice(0,-1)),n}var re={exports:{}};const U=new Uint32Array(65536),Ve=(t,e)=>{const n=t.length,r=e.length,o=1<<n-1;let d=-1,f=0,l=n,c=n;for(;c--;)U[t.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let h=U[e.charCodeAt(c)];const b=h|f;h|=(h&d)+d^d,f|=~(h|d),d&=h,f&o&&l++,d&o&&l--,f=f<<1|1,d=d<<1|~(b|f),f&=b}for(c=n;c--;)U[t.charCodeAt(c)]=0;return l},Ge=(t,e)=>{const n=e.length,r=t.length,o=[],d=[],f=Math.ceil(n/32),l=Math.ceil(r/32);for(let p=0;p<f;p++)d[p]=-1,o[p]=0;let c=0;for(;c<l-1;c++){let p=0,E=-1;const _=c*32,D=Math.min(32,r)+_;for(let m=_;m<D;m++)U[t.charCodeAt(m)]|=1<<m;for(let m=0;m<n;m++){const T=U[e.charCodeAt(m)],A=d[m/32|0]>>>m&1,R=o[m/32|0]>>>m&1,S=T|p,F=((T|R)&E)+E^E|T|R;let i=p|~(F|E),u=E&F;i>>>31^A&&(d[m/32|0]^=1<<m),u>>>31^R&&(o[m/32|0]^=1<<m),i=i<<1|A,u=u<<1|R,E=u|~(S|i),p=i&S}for(let m=_;m<D;m++)U[t.charCodeAt(m)]=0}let h=0,b=-1;const C=c*32,x=Math.min(32,r-C)+C;for(let p=C;p<x;p++)U[t.charCodeAt(p)]|=1<<p;let P=r;for(let p=0;p<n;p++){const E=U[e.charCodeAt(p)],_=d[p/32|0]>>>p&1,D=o[p/32|0]>>>p&1,m=E|h,T=((E|D)&b)+b^b|E|D;let A=h|~(T|b),R=b&T;P+=A>>>r-1&1,P-=R>>>r-1&1,A>>>31^_&&(d[p/32|0]^=1<<p),R>>>31^D&&(o[p/32|0]^=1<<p),A=A<<1|_,R=R<<1|D,b=R|~(m|A),h=A&m}for(let p=C;p<x;p++)U[t.charCodeAt(p)]=0;return P},ye=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?Ve(t,e):Ge(t,e)},Xe=Te(Object.freeze(Object.defineProperty({__proto__:null,closest:(t,e)=>{let n=1/0,r=0;for(let o=0;o<e.length;o++){const d=ye(t,e[o]);d<n&&(n=d,r=o)}return e[r]},distance:ye},Symbol.toStringTag,{value:"Module"})));var ge;function Ze(){return ge||(ge=1,function(t,e){(function(){var n;try{n=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var r=Xe,o=[],d=[],f={get:function(l,c,h){var b=h&&n&&h.useCollator;if(b){var C=l.length,x=c.length;if(C===0)return x;if(x===0)return C;var P,p,E,_,D;for(E=0;E<x;++E)o[E]=E,d[E]=c.charCodeAt(E);o[x]=x;var m;for(E=0;E<C;++E){for(p=E+1,_=0;_<x;++_)P=p,m=n.compare(l.charAt(E),String.fromCharCode(d[_]))===0,p=o[_]+(m?0:1),D=P+1,p>D&&(p=D),D=o[_+1]+1,p>D&&(p=D),o[_]=P;o[_]=p}return p}return r.distance(l,c)}};t!==null&&t.exports===e?t.exports=f:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=f:typeof window<"u"&&window!==null&&(window.Levenshtein=f)})()}(re,re.exports)),re.exports}var Qe=Ze();const qe=Ce(Qe);function $e(t,e,n="git",r=1){switch(n){case"git":return we(t,e,r);case"object":return et(t,e);case"json":return tt(t,e);default:return we(t,e,r)}}function we(t,e,n=1){const r=Pe(t),o=Pe(e),l=Be("","",r,o,"","",{context:n}).split(`
35
35
  `).filter(c=>!c||c==="\"||c.startsWith("@@")||c.startsWith("---")||c.startsWith("+++")||c.startsWith(" ")?!1:!!(c.startsWith("+")||c.startsWith("-")));for(;l.length&&l[0].trim()==="";)l.shift();for(;l.length&&l[l.length-1].trim()==="";)l.pop();return l.join(`
36
- `)}function $e(t,e){const n=he.diff(t,e)||[];return JSON.stringify(n,null,2)}function et(t,e){return JSON.stringify({before:t,after:e},null,2)}function tt(t,e){return typeof t=="string"&&typeof e=="string"?we(t,e):typeof t=="number"&&typeof e=="number"?ke(t,e):nt(t,e)}function we(t,e){if(t===e)return 0;if(t.length===0||e.length===0)return 1;const n=Qe.get(t,e),r=Math.max(t.length,e.length);return n/r}function ke(t,e){if(t===e)return 0;if(t===0)return 1;const n=Math.abs(e-t),r=Math.max(Math.abs(t),Math.abs(e));return Math.min(n/r,1)}function nt(t,e){if(t===e)return 0;const n=he.diff(t,e)||[];if(n.length===0)return 0;const r=Ee(t),o=Ee(e),d=Math.max(r,o);if(d===0)return 0;let f=0;for(const l of n)switch(l.kind){case"N":f+=1;break;case"D":f+=1;break;case"E":if(typeof l.lhs=="string"&&typeof l.rhs=="string"){const c=we(l.lhs,l.rhs);f+=c}else if(typeof l.lhs=="number"&&typeof l.rhs=="number"){const c=ke(l.lhs,l.rhs);f+=c}else f+=1;break;case"A":f+=.5;break}return Math.min(f/d,1)}function Ee(t){if(t==null)return 0;if(typeof t!="object")return 1;if(Array.isArray(t))return t.length;let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e+=1);return e}function xe(t){try{return JSON.stringify(t,(e,n)=>typeof n=="function"?"[Function]":n===void 0?"[undefined]":n===1/0?"[Infinity]":Number.isNaN(n)?"[NaN]":n,2)}catch{return String(t)}}function rt(t,e,n){const r=ie(),o=n?.onFeedback||r,d=n?.debounceMs??3e3,f=n?.diffType??"git",l=n?.compareWith,c=n?.default_trigger_name??"auto_state_change",h=n?.ignoreInitialNullish??!0,b=k.useRef(t),C=k.useRef(!0),x=k.useRef(t),P=k.useRef(t==null),p=k.useRef(t!=null),E=k.useRef(!(h&&t==null)),_=k.useRef(null),D=k.useRef(void 0),m=k.useCallback((A,R,N)=>{const F=tt(A,R),i=qe(A,R,f),u=typeof n?.score=="function"?n.score(A,R,F):n?.score??(F>.5?0:1),s=typeof e=="function"?e(R):e;o({session_id:s,kind:"edit",source:"human",trigger_name:N,score:u,value:i,confidence:F,metadata:n?.metadata})},[n,e,f,o]),T=k.useCallback(A=>{const R=A||c;if(_.current&&D.current&&D.current!==R){clearTimeout(_.current);const N=x.current;m(N,t,D.current),_.current=null}D.current=R},[t,c,m]);return k.useEffect(()=>{if(C.current){C.current=!1,b.current=t,(!h||t!=null)&&(x.current=t,E.current=!0);return}const A=b.current;if(!(l?l(A,t):JSON.stringify(A)===JSON.stringify(t))){const N=h&&P.current&&!p.current&&t!=null;if(t!=null&&(p.current=!0),N){x.current=t,E.current=!0,b.current=t;return}_.current&&clearTimeout(_.current),b.current=t,_.current=setTimeout(()=>{const F=x.current,i=t;E.current&&m(F,i,D.current||c),_.current=null},d)}return()=>{_.current&&clearTimeout(_.current)}},[t,e,n,o,f,d,l,c,h,m]),{notifyChange:T}}function ot(t,e,n){const[r,o]=k.useState(t),{notifyChange:d}=rt(r,e,n),f=k.useCallback((l,c)=>{d(c),o(h=>typeof l=="function"?l(h):l)},[d]);return[r,f]}K.KeletContext=q,K.KeletProvider=Fe,K.VoteFeedback=Le,K.useDefaultFeedbackHandler=ie,K.useFeedbackState=ot,K.useKelet=Ie,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});
36
+ `)}function et(t,e){const n=me.diff(t,e)||[];return JSON.stringify(n,null,2)}function tt(t,e){return JSON.stringify({before:t,after:e},null,2)}function nt(t,e){return typeof t=="string"&&typeof e=="string"?ke(t,e):typeof t=="number"&&typeof e=="number"?Ee(t,e):rt(t,e)}function ke(t,e){if(t===e)return 0;if(t.length===0||e.length===0)return 1;const n=qe.get(t,e),r=Math.max(t.length,e.length);return n/r}function Ee(t,e){if(t===e)return 0;if(t===0)return 1;const n=Math.abs(e-t),r=Math.max(Math.abs(t),Math.abs(e));return Math.min(n/r,1)}function rt(t,e){if(t===e)return 0;const n=me.diff(t,e)||[];if(n.length===0)return 0;const r=xe(t),o=xe(e),d=Math.max(r,o);if(d===0)return 0;let f=0;for(const l of n)switch(l.kind){case"N":f+=1;break;case"D":f+=1;break;case"E":if(typeof l.lhs=="string"&&typeof l.rhs=="string"){const c=ke(l.lhs,l.rhs);f+=c}else if(typeof l.lhs=="number"&&typeof l.rhs=="number"){const c=Ee(l.lhs,l.rhs);f+=c}else f+=1;break;case"A":f+=.5;break}return Math.min(f/d,1)}function xe(t){if(t==null)return 0;if(typeof t!="object")return 1;if(Array.isArray(t))return t.length;let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e+=1);return e}function Pe(t){try{return JSON.stringify(t,(e,n)=>typeof n=="function"?"[Function]":n===void 0?"[undefined]":n===1/0?"[Infinity]":Number.isNaN(n)?"[NaN]":n,2)}catch{return String(t)}}function ot(t,e,n){const r=ie(),o=n?.onFeedback||r,d=n?.debounceMs??3e3,f=n?.diffType??"git",l=n?.compareWith,c=n?.default_trigger_name??"auto_state_change",h=n?.ignoreInitialNullish??!0,b=k.useRef(t),C=k.useRef(!0),x=k.useRef(t),P=k.useRef(t==null),p=k.useRef(t!=null),E=k.useRef(!(h&&t==null)),_=k.useRef(null),D=k.useRef(void 0),m=k.useCallback((A,R,S)=>{const F=nt(A,R),i=$e(A,R,f),u=typeof n?.score=="function"?n.score(A,R,F):n?.score??(F>.5?0:1),s=typeof e=="function"?e(R):e;o({session_id:s,kind:"edit",source:"human",trigger_name:S,score:u,value:i,confidence:F,metadata:n?.metadata})},[n,e,f,o]),T=k.useCallback(A=>{const R=A||c;if(_.current&&D.current&&D.current!==R){clearTimeout(_.current);const S=x.current;m(S,t,D.current),_.current=null}D.current=R},[t,c,m]);return k.useEffect(()=>{if(C.current){C.current=!1,b.current=t,(!h||t!=null)&&(x.current=t,E.current=!0);return}const A=b.current;if(!(l?l(A,t):JSON.stringify(A)===JSON.stringify(t))){const S=h&&P.current&&!p.current&&t!=null;if(t!=null&&(p.current=!0),S){x.current=t,E.current=!0,b.current=t;return}_.current&&clearTimeout(_.current),b.current=t,_.current=setTimeout(()=>{const F=x.current,i=t;E.current&&m(F,i,D.current||c),_.current=null},d)}return()=>{_.current&&clearTimeout(_.current)}},[t,e,n,o,f,d,l,c,h,m]),{notifyChange:T}}function it(t,e,n){const[r,o]=k.useState(t),{notifyChange:d}=ot(r,e,n),f=k.useCallback((l,c)=>{d(c),o(h=>typeof l=="function"?l(h):l)},[d]);return[r,f]}K.KeletContext=q,K.KeletProvider=Le,K.VoteFeedback=Me,K.useDefaultFeedbackHandler=ie,K.useFeedbackState=it,K.useKelet=Fe,K.useKeletSignal=de,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});
37
37
  //# sourceMappingURL=feedback-ui.umd.min.js.map