@kelet-ai/feedback-ui 0.4.0 → 0.4.1

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.
@@ -306,7 +306,7 @@ function Ie() {
306
306
  return pe || (pe = 1, process.env.NODE_ENV === "production" ? re.exports = je() : re.exports = Ne()), re.exports;
307
307
  }
308
308
  var F = Ie();
309
- const se = Ee(null), Fe = "https://api.kelet.ai/", pt = () => {
309
+ const se = Ee(null), Fe = "https://api.kelet.ai/api", pt = () => {
310
310
  const n = ae(se);
311
311
  if (!n)
312
312
  throw new Error("useKelet must be used within a KeletProvider");
@@ -19,7 +19,7 @@
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} />`,j,N,U,N),re[N+j]=!0)}if(N=null,_!==void 0&&(t(_),N=""+_),d(T)&&(t(T.key),N=""+T.key),"key"in T){_={};for(var se in T)se!=="key"&&(_[se]=T[se])}else _=T;return N&&f(_,typeof a=="function"?a.displayName||a.name||"Unknown":a),y(a,N,z,K,o(),_,G,J)}function S(a){typeof a=="object"&&a!==null&&a.$$typeof===k&&a._store&&(a._store.validated=1)}var w=P,k=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),b=Symbol.for("react.consumer"),E=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),i=Symbol.for("react.lazy"),l=Symbol.for("react.activity"),s=Symbol.for("react.client.reference"),c=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,v=Object.prototype.hasOwnProperty,A=Array.isArray,C=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(a){return a()}};var Y,I={},B=w.react_stack_bottom_frame.bind(w,u)(),V=C(r(u)),re={};Z.Fragment=g,Z.jsx=function(a,T,_,j,K){var z=1e4>c.recentlyCreatedOwnerStacks++;return m(a,T,_,!1,j,K,z?Error("react-stack-top-frame"):B,z?C(r(a)):V)},Z.jsxs=function(a,T,_,j,K){var z=1e4>c.recentlyCreatedOwnerStacks++;return m(a,T,_,!0,j,K,z?Error("react-stack-top-frame"):B,z?C(r(a)):V)}}()),Z}var ue;function Te(){return ue||(ue=1,process.env.NODE_ENV==="production"?ee.exports=xe():ee.exports=Ce()),ee.exports}var L=Te();const Q=P.createContext(null),Re="https://api.kelet.ai/",Oe=()=>{const n=P.useContext(Q);if(!n)throw new Error("useKelet must be used within a KeletProvider");return n},oe=()=>{const n=P.useContext(Q);return n?n.feedback:async()=>{}},De=({apiKey:n,project:e,children:t})=>{const r=P.useContext(Q),o=n||r?.api_key;if(!o)throw new Error("apiKey is required either directly or from a parent KeletProvider");const d={api_key:o,project:e,feedback:async f=>{const p=`${Re}/projects/${e}/feedback`,y={tx_id:f.tx_id,source:f.source||"EXPLICIT",vote:f.vote,explanation:f.explanation,correction:f.correction,selection:f.selection},m=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify(y)});if(!m.ok)throw new Error(`Failed to submit feedback: ${m.statusText}`)}};return L.jsx(Q.Provider,{value:d,children:t})},q=(n,e)=>{const t={...e};for(const r in e){const o=n[r],u=e[r];/^on[A-Z]/.test(r)?o&&u?t[r]=(...f)=>{u(...f),o(...f)}:o&&(t[r]=o):r==="style"?t[r]={...o,...u}:r==="className"?t[r]=[o,u].filter(Boolean).join(" "):t[r]=u!==void 0?u:o}return{...n,...t}},ce=P.createContext(null),$=()=>{const n=P.useContext(ce);if(!n)throw new Error("VoteFeedback components must be used within VoteFeedback.Root");return n},Se={Root:({children:n,onFeedback:e,defaultText:t="",tx_id:r,extra_metadata:o,trigger_name:u})=>{const d=typeof r=="function"?r():r,[f,p]=P.useState(!1),[y,m]=P.useState(t),[S,w]=P.useState(!1),[k,h]=P.useState(null),g=P.useRef(null),R=P.useRef(null),x=P.useId(),b=P.useId(),E=oe(),O=e||E,D=P.useCallback(async()=>{h("upvote");const c={tx_id:d,vote:"upvote",...o&&{extra_metadata:o},...u&&{trigger_name:u}};try{w(!0),await O(c)}finally{w(!1)}},[O,d,o,u]),F=P.useCallback(async()=>{if(h("downvote"),O){const c={tx_id:d,vote:"downvote",...o&&{extra_metadata:o},...u&&{trigger_name:u}};try{w(!0),await O(c)}finally{w(!1)}}p(!0),setTimeout(()=>{g.current?.focus();const c=document.createElement("div");c.setAttribute("aria-live","polite"),c.setAttribute("aria-atomic","true"),c.className="sr-only",c.textContent="Feedback dialog opened. You can provide additional details about your downvote.",document.body.appendChild(c),setTimeout(()=>document.body.removeChild(c),1e3)},0)},[O,d,o,u]),W=P.useCallback(c=>{m(c.target.value)},[]),i=P.useCallback(async()=>{const c=y.trim().length>0;if(c){const v={tx_id:d,vote:"downvote",explanation:y,...o&&{extra_metadata:o},...u&&{trigger_name:u}};try{w(!0),await O(v)}finally{w(!1)}}if(p(!1),m(t),R.current?.focus(),c){const v=document.createElement("div");v.setAttribute("aria-live","polite"),v.className="sr-only",v.textContent="Feedback submitted successfully.",document.body.appendChild(v),setTimeout(()=>document.body.removeChild(v),1e3)}},[O,y,t,d,o,u]),l=P.useCallback(c=>{if(c.key==="Escape")p(!1),m(t),R.current?.focus();else if((c.metaKey||c.ctrlKey)&&c.key==="Enter")c.preventDefault(),i().then(v=>{});else if(c.key==="Tab"&&f){const v=document.getElementById(x);if(v){const A=v.querySelectorAll('button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'),C=A[0],Y=A[A.length-1];c.shiftKey&&document.activeElement===C?(c.preventDefault(),Y?.focus()):!c.shiftKey&&document.activeElement===Y&&(c.preventDefault(),C?.focus())}}},[i,f,x,t]),s={onFeedback:O,showPopover:f,setShowPopover:p,feedbackText:y,setFeedbackText:m,isSubmitting:S,setIsSubmitting:w,vote:k,handleUpvote:D,handleDownvote:F,handleTextareaChange:W,handleSubmit:i,handleKeyDown:l,textareaRef:g,triggerRef:R,popoverId:x,triggerId:b,tx_id:d,extra_metadata:o,trigger_name:u};return L.jsx(ce.Provider,{value:s,children:n})},UpvoteButton:({asChild:n,children:e,onClick:t,...r})=>{const{handleUpvote:o,isSubmitting:u,vote:d}=$(),f=P.useCallback(m=>{o(),t?.(m)},[o,t]),p={...r,onClick:f,disabled:u||r.disabled,"aria-label":r["aria-label"]||"Upvote feedback",type:"button"},y=d==="upvote";if(n){const m=typeof e=="function"?e({isSelected:y}):e;if(P.isValidElement(m))return P.cloneElement(m,q(p,m.props))}return L.jsx("button",{...p,children:typeof e=="function"?e({isSelected:y}):e})},DownvoteButton:({asChild:n,children:e,onClick:t,...r})=>{const{handleDownvote:o,showPopover:u,isSubmitting:d,popoverId:f,triggerId:p,triggerRef:y,vote:m}=$(),S=P.useCallback(h=>{o(),t?.(h)},[o,t]),w={...r,ref:y,onClick:S,disabled:d||r.disabled,"aria-label":r["aria-label"]||"Downvote feedback","aria-expanded":u,"aria-controls":f,id:p,type:"button"},k=m==="downvote";if(n){const h=typeof e=="function"?e({isSelected:k}):e;if(P.isValidElement(h))return P.cloneElement(h,q(w,h.props));if(h)return h}return L.jsx("button",{...w,children:typeof e=="function"?e({isSelected:k}):e})},Popover:({asChild:n,children:e,...t})=>{const{showPopover:r,handleKeyDown:o,popoverId:u,triggerId:d}=$();if(!r)return null;const f={...t,role:"dialog","aria-labelledby":d,"aria-modal":!0,"aria-describedby":`${u}-description`,id:u,onKeyDown:o,tabIndex:-1};return n&&P.isValidElement(e)?L.jsxs(L.Fragment,{children:[P.cloneElement(e,q(f,e.props)),L.jsx("div",{id:`${u}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"})]}):L.jsxs("div",{...f,children:[L.jsx("div",{id:`${u}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"}),e]})},Textarea:({asChild:n,value:e,onChange:t,...r})=>{const{feedbackText:o,handleTextareaChange:u,textareaRef:d,handleKeyDown:f,popoverId:p}=$(),y={...r,ref:d,value:e!==void 0?e:o,onChange:t||u,onKeyDown:f,placeholder:r.placeholder||"What did we miss?","aria-label":r["aria-label"]||"Additional feedback","aria-describedby":`${p}-help`,rows:r.rows||3};return n&&P.isValidElement(r.children)?P.cloneElement(r.children,q(y,r.children.props)):L.jsx("textarea",{...y})},SubmitButton:({asChild:n,children:e,onClick:t,...r})=>{const{handleSubmit:o,isSubmitting:u,feedbackText:d}=$(),f=P.useCallback(S=>{o(),t?.(S)},[o,t]),p=d.trim().length>0,y=p?"Submit feedback":"Close without feedback",m={...r,onClick:f,disabled:u||r.disabled,type:"button","aria-label":r["aria-label"]||y,"aria-describedby":p?void 0:"submit-help"};return n&&P.isValidElement(e)?L.jsxs(L.Fragment,{children:[P.cloneElement(e,q(m,e.props)),!p&&L.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]}):L.jsxs("button",{...m,children:[e,!p&&L.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]})}};var te={exports:{}},Ae=te.exports,fe;function _e(){return fe||(fe=1,function(n,e){(function(t,r){var o=r(t);n.exports=o})(Ae,function(t){var r=["N","E","A","D"];function o(i,l){i.super_=l,i.prototype=Object.create(l.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}})}function u(i,l){Object.defineProperty(this,"kind",{value:i,enumerable:!0}),l&&l.length&&Object.defineProperty(this,"path",{value:l,enumerable:!0})}function d(i,l,s){d.super_.call(this,"E",i),Object.defineProperty(this,"lhs",{value:l,enumerable:!0}),Object.defineProperty(this,"rhs",{value:s,enumerable:!0})}o(d,u);function f(i,l){f.super_.call(this,"N",i),Object.defineProperty(this,"rhs",{value:l,enumerable:!0})}o(f,u);function p(i,l){p.super_.call(this,"D",i),Object.defineProperty(this,"lhs",{value:l,enumerable:!0})}o(p,u);function y(i,l,s){y.super_.call(this,"A",i),Object.defineProperty(this,"index",{value:l,enumerable:!0}),Object.defineProperty(this,"item",{value:s,enumerable:!0})}o(y,u);function m(i,l,s){var c=i.slice(l+1||i.length);return i.length=l<0?i.length+l:l,i.push.apply(i,c),i}function S(i){var l=typeof i;return l!=="object"?l: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 w(i){var l=0;if(i.length===0)return l;for(var s=0;s<i.length;s++){var c=i.charCodeAt(s);l=(l<<5)-l+c,l=l&l}return l}function k(i){var l=0,s=S(i);if(s==="array"){i.forEach(function(Y){l+=k(Y)});var c="[type: array, hash: "+l+"]";return l+w(c)}if(s==="object"){for(var v in i)if(i.hasOwnProperty(v)){var A="[ type: object, key: "+v+", value hash: "+k(i[v])+"]";l+=w(A)}return l}var C="[ type: "+s+" ; value: "+i+"]";return l+w(C)}function h(i,l,s,c,v,A,C,Y){s=s||[],v=v||[],C=C||[];var I=v.slice(0);if(typeof A<"u"&&A!==null){if(c){if(typeof c=="function"&&c(I,A))return;if(typeof c=="object"){if(c.prefilter&&c.prefilter(I,A))return;if(c.normalize){var B=c.normalize(I,A,i,l);B&&(i=B[0],l=B[1])}}}I.push(A)}S(i)==="regexp"&&S(l)==="regexp"&&(i=i.toString(),l=l.toString());var V=typeof i,re=typeof l,a,T,_,j,K=V!=="undefined"||C&&C.length>0&&C[C.length-1].lhs&&Object.getOwnPropertyDescriptor(C[C.length-1].lhs,A),z=re!=="undefined"||C&&C.length>0&&C[C.length-1].rhs&&Object.getOwnPropertyDescriptor(C[C.length-1].rhs,A);if(!K&&z)s.push(new f(I,l));else if(!z&&K)s.push(new p(I,i));else if(S(i)!==S(l))s.push(new d(I,i,l));else if(S(i)==="date"&&i-l!==0)s.push(new d(I,i,l));else if(V==="object"&&i!==null&&l!==null){for(a=C.length-1;a>-1;--a)if(C[a].lhs===i){j=!0;break}if(j)i!==l&&s.push(new d(I,i,l));else{if(C.push({lhs:i,rhs:l}),Array.isArray(i)){for(Y&&(i.sort(function(N,U){return k(N)-k(U)}),l.sort(function(N,U){return k(N)-k(U)})),a=l.length-1,T=i.length-1;a>T;)s.push(new y(I,a,new f(void 0,l[a--])));for(;T>a;)s.push(new y(I,T,new p(void 0,i[T--])));for(;a>=0;--a)h(i[a],l[a],s,c,I,a,C,Y)}else{var G=Object.keys(i),J=Object.keys(l);for(a=0;a<G.length;++a)_=G[a],j=J.indexOf(_),j>=0?(h(i[_],l[_],s,c,I,_,C,Y),J[j]=null):h(i[_],void 0,s,c,I,_,C,Y);for(a=0;a<J.length;++a)_=J[a],_&&h(void 0,l[_],s,c,I,_,C,Y)}C.length=C.length-1}}else i!==l&&(V==="number"&&isNaN(i)&&isNaN(l)||s.push(new d(I,i,l)))}function g(i,l,s,c,v){var A=[];if(h(i,l,A,c,null,null,null,v),s)for(var C=0;C<A.length;++C)s(A[C]);return A}function R(i,l,s,c,v,A,C){return h(i,l,s,c,v,A,C,!0)}function x(i,l,s,c){var v=c?function(C){C&&c.push(C)}:void 0,A=g(i,l,v,s);return c||(A.length?A:void 0)}function b(i,l,s,c){var v=c?function(C){C&&c.push(C)}:void 0,A=g(i,l,v,s,!0);return c||(A.length?A:void 0)}function E(i,l,s){if(s.path&&s.path.length){var c=i[l],v,A=s.path.length-1;for(v=0;v<A;v++)c=c[s.path[v]];switch(s.kind){case"A":E(c[s.path[v]],s.index,s.item);break;case"D":delete c[s.path[v]];break;case"E":case"N":c[s.path[v]]=s.rhs;break}}else switch(s.kind){case"A":E(i[l],s.index,s.item);break;case"D":i=m(i,l);break;case"E":case"N":i[l]=s.rhs;break}return i}function O(i,l,s){if(typeof s>"u"&&l&&~r.indexOf(l.kind)&&(s=l),i&&s&&s.kind){for(var c=i,v=-1,A=s.path?s.path.length-1:0;++v<A;)typeof c[s.path[v]]>"u"&&(c[s.path[v]]=typeof s.path[v+1]<"u"&&typeof s.path[v+1]=="number"?[]:{}),c=c[s.path[v]];switch(s.kind){case"A":s.path&&typeof c[s.path[v]]>"u"&&(c[s.path[v]]=[]),E(s.path?c[s.path[v]]:c,s.index,s.item);break;case"D":delete c[s.path[v]];break;case"E":case"N":c[s.path[v]]=s.rhs;break}}}function D(i,l,s){if(s.path&&s.path.length){var c=i[l],v,A=s.path.length-1;for(v=0;v<A;v++)c=c[s.path[v]];switch(s.kind){case"A":D(c[s.path[v]],s.index,s.item);break;case"D":c[s.path[v]]=s.lhs;break;case"E":c[s.path[v]]=s.lhs;break;case"N":delete c[s.path[v]];break}}else switch(s.kind){case"A":D(i[l],s.index,s.item);break;case"D":i[l]=s.lhs;break;case"E":i[l]=s.lhs;break;case"N":i=m(i,l);break}return i}function F(i,l,s){if(i&&l&&s&&s.kind){var c=i,v,A;for(A=s.path.length-1,v=0;v<A;v++)typeof c[s.path[v]]>"u"&&(c[s.path[v]]={}),c=c[s.path[v]];switch(s.kind){case"A":D(c[s.path[v]],s.index,s.item);break;case"D":c[s.path[v]]=s.lhs;break;case"E":c[s.path[v]]=s.lhs;break;case"N":delete c[s.path[v]];break}}}function W(i,l,s){if(i&&l){var c=function(v){(!s||s(i,l,v))&&O(i,l,v)};g(i,l,c)}}return Object.defineProperties(x,{diff:{value:x,enumerable:!0},orderIndependentDiff:{value:b,enumerable:!0},observableDiff:{value:g,enumerable:!0},orderIndependentObservableDiff:{value:R,enumerable:!0},orderIndepHash:{value:k,enumerable:!0},applyDiff:{value:W,enumerable:!0},applyChange:{value:O,enumerable:!0},revertChange:{value:F,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),x.DeepDiff=x,t&&(t.DeepDiff=x),x})}(te)),te.exports}var de=_e(),ne={exports:{}};const H=new Uint32Array(65536),je=(n,e)=>{const t=n.length,r=e.length,o=1<<t-1;let u=-1,d=0,f=t,p=t;for(;p--;)H[n.charCodeAt(p)]|=1<<p;for(p=0;p<r;p++){let y=H[e.charCodeAt(p)];const m=y|d;y|=(y&u)+u^u,d|=~(y|u),u&=y,d&o&&f++,u&o&&f--,d=d<<1|1,u=u<<1|~(m|d),d&=m}for(p=t;p--;)H[n.charCodeAt(p)]=0;return f},Ne=(n,e)=>{const t=e.length,r=n.length,o=[],u=[],d=Math.ceil(t/32),f=Math.ceil(r/32);for(let h=0;h<d;h++)u[h]=-1,o[h]=0;let p=0;for(;p<f-1;p++){let h=0,g=-1;const R=p*32,x=Math.min(32,r)+R;for(let b=R;b<x;b++)H[n.charCodeAt(b)]|=1<<b;for(let b=0;b<t;b++){const E=H[e.charCodeAt(b)],O=u[b/32|0]>>>b&1,D=o[b/32|0]>>>b&1,F=E|h,W=((E|D)&g)+g^g|E|D;let i=h|~(W|g),l=g&W;i>>>31^O&&(u[b/32|0]^=1<<b),l>>>31^D&&(o[b/32|0]^=1<<b),i=i<<1|O,l=l<<1|D,g=l|~(F|i),h=i&F}for(let b=R;b<x;b++)H[n.charCodeAt(b)]=0}let y=0,m=-1;const S=p*32,w=Math.min(32,r-S)+S;for(let h=S;h<w;h++)H[n.charCodeAt(h)]|=1<<h;let k=r;for(let h=0;h<t;h++){const g=H[e.charCodeAt(h)],R=u[h/32|0]>>>h&1,x=o[h/32|0]>>>h&1,b=g|y,E=((g|x)&m)+m^m|g|x;let O=y|~(E|m),D=m&E;k+=O>>>r-1&1,k-=D>>>r-1&1,O>>>31^R&&(u[h/32|0]^=1<<h),D>>>31^x&&(o[h/32|0]^=1<<h),O=O<<1|R,D=D<<1|x,m=D|~(b|O),y=O&b}for(let h=S;h<w;h++)H[n.charCodeAt(h)]=0;return k},pe=(n,e)=>{if(n.length<e.length){const t=e;e=n,n=t}return e.length===0?n.length:n.length<=32?je(n,e):Ne(n,e)},Ie=Pe(Object.freeze(Object.defineProperty({__proto__:null,closest:(n,e)=>{let t=1/0,r=0;for(let o=0;o<e.length;o++){const u=pe(n,e[o]);u<t&&(t=u,r=o)}return e[r]},distance:pe},Symbol.toStringTag,{value:"Module"})));var he;function Fe(){return he||(he=1,function(n,e){(function(){var t;try{t=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=Ie,o=[],u=[],d={get:function(f,p,y){var m=y&&t&&y.useCollator;if(m){var S=f.length,w=p.length;if(S===0)return w;if(w===0)return S;var k,h,g,R,x;for(g=0;g<w;++g)o[g]=g,u[g]=p.charCodeAt(g);o[w]=w;var b;for(g=0;g<S;++g){for(h=g+1,R=0;R<w;++R)k=h,b=t.compare(f.charAt(g),String.fromCharCode(u[R]))===0,h=o[R]+(b?0:1),x=k+1,h>x&&(h=x),x=o[R+1]+1,h>x&&(h=x),o[R]=k;o[R]=h}return h}return r.distance(f,p)}};n!==null&&n.exports===e?n.exports=d:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=d:typeof window<"u"&&window!==null&&(window.Levenshtein=d)})()}(ne,ne.exports)),ne.exports}var Le=Fe();const Me=Ee(Le);class We{diff(e,t,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const u=this.castInput(e,r),d=this.castInput(t,r),f=this.removeEmpty(this.tokenize(u,r)),p=this.removeEmpty(this.tokenize(d,r));return this.diffWithOptionsObj(f,p,r,o)}diffWithOptionsObj(e,t,r,o){var u;const d=b=>{if(b=this.postProcess(b,r),o){setTimeout(function(){o(b)},0);return}else return b},f=t.length,p=e.length;let y=1,m=f+p;r.maxEditLength!=null&&(m=Math.min(m,r.maxEditLength));const S=(u=r.timeout)!==null&&u!==void 0?u:1/0,w=Date.now()+S,k=[{oldPos:-1,lastComponent:void 0}];let h=this.extractCommon(k[0],t,e,0,r);if(k[0].oldPos+1>=p&&h+1>=f)return d(this.buildValues(k[0].lastComponent,t,e));let g=-1/0,R=1/0;const x=()=>{for(let b=Math.max(g,-y);b<=Math.min(R,y);b+=2){let E;const O=k[b-1],D=k[b+1];O&&(k[b-1]=void 0);let F=!1;if(D){const i=D.oldPos-b;F=D&&0<=i&&i<f}const W=O&&O.oldPos+1<p;if(!F&&!W){k[b]=void 0;continue}if(!W||F&&O.oldPos<D.oldPos?E=this.addToPath(D,!0,!1,0,r):E=this.addToPath(O,!1,!0,1,r),h=this.extractCommon(E,t,e,b,r),E.oldPos+1>=p&&h+1>=f)return d(this.buildValues(E.lastComponent,t,e))||!0;k[b]=E,E.oldPos+1>=p&&(R=Math.min(R,b-1)),h+1>=f&&(g=Math.max(g,b+1))}y++};if(o)(function b(){setTimeout(function(){if(y>m||Date.now()>w)return o(void 0);x()||b()},0)})();else for(;y<=m&&Date.now()<=w;){const b=x();if(b)return b}}addToPath(e,t,r,o,u){const d=e.lastComponent;return d&&!u.oneChangePerToken&&d.added===t&&d.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:d.count+1,added:t,removed:r,previousComponent:d.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:t,removed:r,previousComponent:d}}}extractCommon(e,t,r,o,u){const d=t.length,f=r.length;let p=e.oldPos,y=p-o,m=0;for(;y+1<d&&p+1<f&&this.equals(r[p+1],t[y+1],u);)y++,p++,m++,u.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return m&&!u.oneChangePerToken&&(e.lastComponent={count:m,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=p,y}equals(e,t,r){return r.comparator?r.comparator(e,t):e===t||!!r.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,r){const o=[];let u;for(;e;)o.push(e),u=e.previousComponent,delete e.previousComponent,e=u;o.reverse();const d=o.length;let f=0,p=0,y=0;for(;f<d;f++){const m=o[f];if(m.removed)m.value=this.join(r.slice(y,y+m.count)),y+=m.count;else{if(!m.added&&this.useLongestToken){let S=t.slice(p,p+m.count);S=S.map(function(w,k){const h=r[y+k];return h.length>w.length?h:w}),m.value=this.join(S)}else m.value=this.join(t.slice(p,p+m.count));p+=m.count,m.added||(y+=m.count)}}return o}}class Ye extends We{constructor(){super(...arguments),this.tokenize=Ke}equals(e,t,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
22
+ <%s key={someKey} {...props} />`,j,N,U,N),re[N+j]=!0)}if(N=null,_!==void 0&&(t(_),N=""+_),d(T)&&(t(T.key),N=""+T.key),"key"in T){_={};for(var se in T)se!=="key"&&(_[se]=T[se])}else _=T;return N&&f(_,typeof a=="function"?a.displayName||a.name||"Unknown":a),y(a,N,z,K,o(),_,G,J)}function S(a){typeof a=="object"&&a!==null&&a.$$typeof===k&&a._store&&(a._store.validated=1)}var w=P,k=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),b=Symbol.for("react.consumer"),E=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),i=Symbol.for("react.lazy"),l=Symbol.for("react.activity"),s=Symbol.for("react.client.reference"),c=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,v=Object.prototype.hasOwnProperty,A=Array.isArray,C=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(a){return a()}};var Y,I={},B=w.react_stack_bottom_frame.bind(w,u)(),V=C(r(u)),re={};Z.Fragment=g,Z.jsx=function(a,T,_,j,K){var z=1e4>c.recentlyCreatedOwnerStacks++;return m(a,T,_,!1,j,K,z?Error("react-stack-top-frame"):B,z?C(r(a)):V)},Z.jsxs=function(a,T,_,j,K){var z=1e4>c.recentlyCreatedOwnerStacks++;return m(a,T,_,!0,j,K,z?Error("react-stack-top-frame"):B,z?C(r(a)):V)}}()),Z}var ue;function Te(){return ue||(ue=1,process.env.NODE_ENV==="production"?ee.exports=xe():ee.exports=Ce()),ee.exports}var L=Te();const Q=P.createContext(null),Re="https://api.kelet.ai/api",Oe=()=>{const n=P.useContext(Q);if(!n)throw new Error("useKelet must be used within a KeletProvider");return n},oe=()=>{const n=P.useContext(Q);return n?n.feedback:async()=>{}},De=({apiKey:n,project:e,children:t})=>{const r=P.useContext(Q),o=n||r?.api_key;if(!o)throw new Error("apiKey is required either directly or from a parent KeletProvider");const d={api_key:o,project:e,feedback:async f=>{const p=`${Re}/projects/${e}/feedback`,y={tx_id:f.tx_id,source:f.source||"EXPLICIT",vote:f.vote,explanation:f.explanation,correction:f.correction,selection:f.selection},m=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify(y)});if(!m.ok)throw new Error(`Failed to submit feedback: ${m.statusText}`)}};return L.jsx(Q.Provider,{value:d,children:t})},q=(n,e)=>{const t={...e};for(const r in e){const o=n[r],u=e[r];/^on[A-Z]/.test(r)?o&&u?t[r]=(...f)=>{u(...f),o(...f)}:o&&(t[r]=o):r==="style"?t[r]={...o,...u}:r==="className"?t[r]=[o,u].filter(Boolean).join(" "):t[r]=u!==void 0?u:o}return{...n,...t}},ce=P.createContext(null),$=()=>{const n=P.useContext(ce);if(!n)throw new Error("VoteFeedback components must be used within VoteFeedback.Root");return n},Se={Root:({children:n,onFeedback:e,defaultText:t="",tx_id:r,extra_metadata:o,trigger_name:u})=>{const d=typeof r=="function"?r():r,[f,p]=P.useState(!1),[y,m]=P.useState(t),[S,w]=P.useState(!1),[k,h]=P.useState(null),g=P.useRef(null),R=P.useRef(null),x=P.useId(),b=P.useId(),E=oe(),O=e||E,D=P.useCallback(async()=>{h("upvote");const c={tx_id:d,vote:"upvote",...o&&{extra_metadata:o},...u&&{trigger_name:u}};try{w(!0),await O(c)}finally{w(!1)}},[O,d,o,u]),F=P.useCallback(async()=>{if(h("downvote"),O){const c={tx_id:d,vote:"downvote",...o&&{extra_metadata:o},...u&&{trigger_name:u}};try{w(!0),await O(c)}finally{w(!1)}}p(!0),setTimeout(()=>{g.current?.focus();const c=document.createElement("div");c.setAttribute("aria-live","polite"),c.setAttribute("aria-atomic","true"),c.className="sr-only",c.textContent="Feedback dialog opened. You can provide additional details about your downvote.",document.body.appendChild(c),setTimeout(()=>document.body.removeChild(c),1e3)},0)},[O,d,o,u]),W=P.useCallback(c=>{m(c.target.value)},[]),i=P.useCallback(async()=>{const c=y.trim().length>0;if(c){const v={tx_id:d,vote:"downvote",explanation:y,...o&&{extra_metadata:o},...u&&{trigger_name:u}};try{w(!0),await O(v)}finally{w(!1)}}if(p(!1),m(t),R.current?.focus(),c){const v=document.createElement("div");v.setAttribute("aria-live","polite"),v.className="sr-only",v.textContent="Feedback submitted successfully.",document.body.appendChild(v),setTimeout(()=>document.body.removeChild(v),1e3)}},[O,y,t,d,o,u]),l=P.useCallback(c=>{if(c.key==="Escape")p(!1),m(t),R.current?.focus();else if((c.metaKey||c.ctrlKey)&&c.key==="Enter")c.preventDefault(),i().then(v=>{});else if(c.key==="Tab"&&f){const v=document.getElementById(x);if(v){const A=v.querySelectorAll('button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'),C=A[0],Y=A[A.length-1];c.shiftKey&&document.activeElement===C?(c.preventDefault(),Y?.focus()):!c.shiftKey&&document.activeElement===Y&&(c.preventDefault(),C?.focus())}}},[i,f,x,t]),s={onFeedback:O,showPopover:f,setShowPopover:p,feedbackText:y,setFeedbackText:m,isSubmitting:S,setIsSubmitting:w,vote:k,handleUpvote:D,handleDownvote:F,handleTextareaChange:W,handleSubmit:i,handleKeyDown:l,textareaRef:g,triggerRef:R,popoverId:x,triggerId:b,tx_id:d,extra_metadata:o,trigger_name:u};return L.jsx(ce.Provider,{value:s,children:n})},UpvoteButton:({asChild:n,children:e,onClick:t,...r})=>{const{handleUpvote:o,isSubmitting:u,vote:d}=$(),f=P.useCallback(m=>{o(),t?.(m)},[o,t]),p={...r,onClick:f,disabled:u||r.disabled,"aria-label":r["aria-label"]||"Upvote feedback",type:"button"},y=d==="upvote";if(n){const m=typeof e=="function"?e({isSelected:y}):e;if(P.isValidElement(m))return P.cloneElement(m,q(p,m.props))}return L.jsx("button",{...p,children:typeof e=="function"?e({isSelected:y}):e})},DownvoteButton:({asChild:n,children:e,onClick:t,...r})=>{const{handleDownvote:o,showPopover:u,isSubmitting:d,popoverId:f,triggerId:p,triggerRef:y,vote:m}=$(),S=P.useCallback(h=>{o(),t?.(h)},[o,t]),w={...r,ref:y,onClick:S,disabled:d||r.disabled,"aria-label":r["aria-label"]||"Downvote feedback","aria-expanded":u,"aria-controls":f,id:p,type:"button"},k=m==="downvote";if(n){const h=typeof e=="function"?e({isSelected:k}):e;if(P.isValidElement(h))return P.cloneElement(h,q(w,h.props));if(h)return h}return L.jsx("button",{...w,children:typeof e=="function"?e({isSelected:k}):e})},Popover:({asChild:n,children:e,...t})=>{const{showPopover:r,handleKeyDown:o,popoverId:u,triggerId:d}=$();if(!r)return null;const f={...t,role:"dialog","aria-labelledby":d,"aria-modal":!0,"aria-describedby":`${u}-description`,id:u,onKeyDown:o,tabIndex:-1};return n&&P.isValidElement(e)?L.jsxs(L.Fragment,{children:[P.cloneElement(e,q(f,e.props)),L.jsx("div",{id:`${u}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"})]}):L.jsxs("div",{...f,children:[L.jsx("div",{id:`${u}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"}),e]})},Textarea:({asChild:n,value:e,onChange:t,...r})=>{const{feedbackText:o,handleTextareaChange:u,textareaRef:d,handleKeyDown:f,popoverId:p}=$(),y={...r,ref:d,value:e!==void 0?e:o,onChange:t||u,onKeyDown:f,placeholder:r.placeholder||"What did we miss?","aria-label":r["aria-label"]||"Additional feedback","aria-describedby":`${p}-help`,rows:r.rows||3};return n&&P.isValidElement(r.children)?P.cloneElement(r.children,q(y,r.children.props)):L.jsx("textarea",{...y})},SubmitButton:({asChild:n,children:e,onClick:t,...r})=>{const{handleSubmit:o,isSubmitting:u,feedbackText:d}=$(),f=P.useCallback(S=>{o(),t?.(S)},[o,t]),p=d.trim().length>0,y=p?"Submit feedback":"Close without feedback",m={...r,onClick:f,disabled:u||r.disabled,type:"button","aria-label":r["aria-label"]||y,"aria-describedby":p?void 0:"submit-help"};return n&&P.isValidElement(e)?L.jsxs(L.Fragment,{children:[P.cloneElement(e,q(m,e.props)),!p&&L.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]}):L.jsxs("button",{...m,children:[e,!p&&L.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]})}};var te={exports:{}},Ae=te.exports,fe;function _e(){return fe||(fe=1,function(n,e){(function(t,r){var o=r(t);n.exports=o})(Ae,function(t){var r=["N","E","A","D"];function o(i,l){i.super_=l,i.prototype=Object.create(l.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}})}function u(i,l){Object.defineProperty(this,"kind",{value:i,enumerable:!0}),l&&l.length&&Object.defineProperty(this,"path",{value:l,enumerable:!0})}function d(i,l,s){d.super_.call(this,"E",i),Object.defineProperty(this,"lhs",{value:l,enumerable:!0}),Object.defineProperty(this,"rhs",{value:s,enumerable:!0})}o(d,u);function f(i,l){f.super_.call(this,"N",i),Object.defineProperty(this,"rhs",{value:l,enumerable:!0})}o(f,u);function p(i,l){p.super_.call(this,"D",i),Object.defineProperty(this,"lhs",{value:l,enumerable:!0})}o(p,u);function y(i,l,s){y.super_.call(this,"A",i),Object.defineProperty(this,"index",{value:l,enumerable:!0}),Object.defineProperty(this,"item",{value:s,enumerable:!0})}o(y,u);function m(i,l,s){var c=i.slice(l+1||i.length);return i.length=l<0?i.length+l:l,i.push.apply(i,c),i}function S(i){var l=typeof i;return l!=="object"?l: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 w(i){var l=0;if(i.length===0)return l;for(var s=0;s<i.length;s++){var c=i.charCodeAt(s);l=(l<<5)-l+c,l=l&l}return l}function k(i){var l=0,s=S(i);if(s==="array"){i.forEach(function(Y){l+=k(Y)});var c="[type: array, hash: "+l+"]";return l+w(c)}if(s==="object"){for(var v in i)if(i.hasOwnProperty(v)){var A="[ type: object, key: "+v+", value hash: "+k(i[v])+"]";l+=w(A)}return l}var C="[ type: "+s+" ; value: "+i+"]";return l+w(C)}function h(i,l,s,c,v,A,C,Y){s=s||[],v=v||[],C=C||[];var I=v.slice(0);if(typeof A<"u"&&A!==null){if(c){if(typeof c=="function"&&c(I,A))return;if(typeof c=="object"){if(c.prefilter&&c.prefilter(I,A))return;if(c.normalize){var B=c.normalize(I,A,i,l);B&&(i=B[0],l=B[1])}}}I.push(A)}S(i)==="regexp"&&S(l)==="regexp"&&(i=i.toString(),l=l.toString());var V=typeof i,re=typeof l,a,T,_,j,K=V!=="undefined"||C&&C.length>0&&C[C.length-1].lhs&&Object.getOwnPropertyDescriptor(C[C.length-1].lhs,A),z=re!=="undefined"||C&&C.length>0&&C[C.length-1].rhs&&Object.getOwnPropertyDescriptor(C[C.length-1].rhs,A);if(!K&&z)s.push(new f(I,l));else if(!z&&K)s.push(new p(I,i));else if(S(i)!==S(l))s.push(new d(I,i,l));else if(S(i)==="date"&&i-l!==0)s.push(new d(I,i,l));else if(V==="object"&&i!==null&&l!==null){for(a=C.length-1;a>-1;--a)if(C[a].lhs===i){j=!0;break}if(j)i!==l&&s.push(new d(I,i,l));else{if(C.push({lhs:i,rhs:l}),Array.isArray(i)){for(Y&&(i.sort(function(N,U){return k(N)-k(U)}),l.sort(function(N,U){return k(N)-k(U)})),a=l.length-1,T=i.length-1;a>T;)s.push(new y(I,a,new f(void 0,l[a--])));for(;T>a;)s.push(new y(I,T,new p(void 0,i[T--])));for(;a>=0;--a)h(i[a],l[a],s,c,I,a,C,Y)}else{var G=Object.keys(i),J=Object.keys(l);for(a=0;a<G.length;++a)_=G[a],j=J.indexOf(_),j>=0?(h(i[_],l[_],s,c,I,_,C,Y),J[j]=null):h(i[_],void 0,s,c,I,_,C,Y);for(a=0;a<J.length;++a)_=J[a],_&&h(void 0,l[_],s,c,I,_,C,Y)}C.length=C.length-1}}else i!==l&&(V==="number"&&isNaN(i)&&isNaN(l)||s.push(new d(I,i,l)))}function g(i,l,s,c,v){var A=[];if(h(i,l,A,c,null,null,null,v),s)for(var C=0;C<A.length;++C)s(A[C]);return A}function R(i,l,s,c,v,A,C){return h(i,l,s,c,v,A,C,!0)}function x(i,l,s,c){var v=c?function(C){C&&c.push(C)}:void 0,A=g(i,l,v,s);return c||(A.length?A:void 0)}function b(i,l,s,c){var v=c?function(C){C&&c.push(C)}:void 0,A=g(i,l,v,s,!0);return c||(A.length?A:void 0)}function E(i,l,s){if(s.path&&s.path.length){var c=i[l],v,A=s.path.length-1;for(v=0;v<A;v++)c=c[s.path[v]];switch(s.kind){case"A":E(c[s.path[v]],s.index,s.item);break;case"D":delete c[s.path[v]];break;case"E":case"N":c[s.path[v]]=s.rhs;break}}else switch(s.kind){case"A":E(i[l],s.index,s.item);break;case"D":i=m(i,l);break;case"E":case"N":i[l]=s.rhs;break}return i}function O(i,l,s){if(typeof s>"u"&&l&&~r.indexOf(l.kind)&&(s=l),i&&s&&s.kind){for(var c=i,v=-1,A=s.path?s.path.length-1:0;++v<A;)typeof c[s.path[v]]>"u"&&(c[s.path[v]]=typeof s.path[v+1]<"u"&&typeof s.path[v+1]=="number"?[]:{}),c=c[s.path[v]];switch(s.kind){case"A":s.path&&typeof c[s.path[v]]>"u"&&(c[s.path[v]]=[]),E(s.path?c[s.path[v]]:c,s.index,s.item);break;case"D":delete c[s.path[v]];break;case"E":case"N":c[s.path[v]]=s.rhs;break}}}function D(i,l,s){if(s.path&&s.path.length){var c=i[l],v,A=s.path.length-1;for(v=0;v<A;v++)c=c[s.path[v]];switch(s.kind){case"A":D(c[s.path[v]],s.index,s.item);break;case"D":c[s.path[v]]=s.lhs;break;case"E":c[s.path[v]]=s.lhs;break;case"N":delete c[s.path[v]];break}}else switch(s.kind){case"A":D(i[l],s.index,s.item);break;case"D":i[l]=s.lhs;break;case"E":i[l]=s.lhs;break;case"N":i=m(i,l);break}return i}function F(i,l,s){if(i&&l&&s&&s.kind){var c=i,v,A;for(A=s.path.length-1,v=0;v<A;v++)typeof c[s.path[v]]>"u"&&(c[s.path[v]]={}),c=c[s.path[v]];switch(s.kind){case"A":D(c[s.path[v]],s.index,s.item);break;case"D":c[s.path[v]]=s.lhs;break;case"E":c[s.path[v]]=s.lhs;break;case"N":delete c[s.path[v]];break}}}function W(i,l,s){if(i&&l){var c=function(v){(!s||s(i,l,v))&&O(i,l,v)};g(i,l,c)}}return Object.defineProperties(x,{diff:{value:x,enumerable:!0},orderIndependentDiff:{value:b,enumerable:!0},observableDiff:{value:g,enumerable:!0},orderIndependentObservableDiff:{value:R,enumerable:!0},orderIndepHash:{value:k,enumerable:!0},applyDiff:{value:W,enumerable:!0},applyChange:{value:O,enumerable:!0},revertChange:{value:F,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),x.DeepDiff=x,t&&(t.DeepDiff=x),x})}(te)),te.exports}var de=_e(),ne={exports:{}};const H=new Uint32Array(65536),je=(n,e)=>{const t=n.length,r=e.length,o=1<<t-1;let u=-1,d=0,f=t,p=t;for(;p--;)H[n.charCodeAt(p)]|=1<<p;for(p=0;p<r;p++){let y=H[e.charCodeAt(p)];const m=y|d;y|=(y&u)+u^u,d|=~(y|u),u&=y,d&o&&f++,u&o&&f--,d=d<<1|1,u=u<<1|~(m|d),d&=m}for(p=t;p--;)H[n.charCodeAt(p)]=0;return f},Ne=(n,e)=>{const t=e.length,r=n.length,o=[],u=[],d=Math.ceil(t/32),f=Math.ceil(r/32);for(let h=0;h<d;h++)u[h]=-1,o[h]=0;let p=0;for(;p<f-1;p++){let h=0,g=-1;const R=p*32,x=Math.min(32,r)+R;for(let b=R;b<x;b++)H[n.charCodeAt(b)]|=1<<b;for(let b=0;b<t;b++){const E=H[e.charCodeAt(b)],O=u[b/32|0]>>>b&1,D=o[b/32|0]>>>b&1,F=E|h,W=((E|D)&g)+g^g|E|D;let i=h|~(W|g),l=g&W;i>>>31^O&&(u[b/32|0]^=1<<b),l>>>31^D&&(o[b/32|0]^=1<<b),i=i<<1|O,l=l<<1|D,g=l|~(F|i),h=i&F}for(let b=R;b<x;b++)H[n.charCodeAt(b)]=0}let y=0,m=-1;const S=p*32,w=Math.min(32,r-S)+S;for(let h=S;h<w;h++)H[n.charCodeAt(h)]|=1<<h;let k=r;for(let h=0;h<t;h++){const g=H[e.charCodeAt(h)],R=u[h/32|0]>>>h&1,x=o[h/32|0]>>>h&1,b=g|y,E=((g|x)&m)+m^m|g|x;let O=y|~(E|m),D=m&E;k+=O>>>r-1&1,k-=D>>>r-1&1,O>>>31^R&&(u[h/32|0]^=1<<h),D>>>31^x&&(o[h/32|0]^=1<<h),O=O<<1|R,D=D<<1|x,m=D|~(b|O),y=O&b}for(let h=S;h<w;h++)H[n.charCodeAt(h)]=0;return k},pe=(n,e)=>{if(n.length<e.length){const t=e;e=n,n=t}return e.length===0?n.length:n.length<=32?je(n,e):Ne(n,e)},Ie=Pe(Object.freeze(Object.defineProperty({__proto__:null,closest:(n,e)=>{let t=1/0,r=0;for(let o=0;o<e.length;o++){const u=pe(n,e[o]);u<t&&(t=u,r=o)}return e[r]},distance:pe},Symbol.toStringTag,{value:"Module"})));var he;function Fe(){return he||(he=1,function(n,e){(function(){var t;try{t=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=Ie,o=[],u=[],d={get:function(f,p,y){var m=y&&t&&y.useCollator;if(m){var S=f.length,w=p.length;if(S===0)return w;if(w===0)return S;var k,h,g,R,x;for(g=0;g<w;++g)o[g]=g,u[g]=p.charCodeAt(g);o[w]=w;var b;for(g=0;g<S;++g){for(h=g+1,R=0;R<w;++R)k=h,b=t.compare(f.charAt(g),String.fromCharCode(u[R]))===0,h=o[R]+(b?0:1),x=k+1,h>x&&(h=x),x=o[R+1]+1,h>x&&(h=x),o[R]=k;o[R]=h}return h}return r.distance(f,p)}};n!==null&&n.exports===e?n.exports=d:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=d:typeof window<"u"&&window!==null&&(window.Levenshtein=d)})()}(ne,ne.exports)),ne.exports}var Le=Fe();const Me=Ee(Le);class We{diff(e,t,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const u=this.castInput(e,r),d=this.castInput(t,r),f=this.removeEmpty(this.tokenize(u,r)),p=this.removeEmpty(this.tokenize(d,r));return this.diffWithOptionsObj(f,p,r,o)}diffWithOptionsObj(e,t,r,o){var u;const d=b=>{if(b=this.postProcess(b,r),o){setTimeout(function(){o(b)},0);return}else return b},f=t.length,p=e.length;let y=1,m=f+p;r.maxEditLength!=null&&(m=Math.min(m,r.maxEditLength));const S=(u=r.timeout)!==null&&u!==void 0?u:1/0,w=Date.now()+S,k=[{oldPos:-1,lastComponent:void 0}];let h=this.extractCommon(k[0],t,e,0,r);if(k[0].oldPos+1>=p&&h+1>=f)return d(this.buildValues(k[0].lastComponent,t,e));let g=-1/0,R=1/0;const x=()=>{for(let b=Math.max(g,-y);b<=Math.min(R,y);b+=2){let E;const O=k[b-1],D=k[b+1];O&&(k[b-1]=void 0);let F=!1;if(D){const i=D.oldPos-b;F=D&&0<=i&&i<f}const W=O&&O.oldPos+1<p;if(!F&&!W){k[b]=void 0;continue}if(!W||F&&O.oldPos<D.oldPos?E=this.addToPath(D,!0,!1,0,r):E=this.addToPath(O,!1,!0,1,r),h=this.extractCommon(E,t,e,b,r),E.oldPos+1>=p&&h+1>=f)return d(this.buildValues(E.lastComponent,t,e))||!0;k[b]=E,E.oldPos+1>=p&&(R=Math.min(R,b-1)),h+1>=f&&(g=Math.max(g,b+1))}y++};if(o)(function b(){setTimeout(function(){if(y>m||Date.now()>w)return o(void 0);x()||b()},0)})();else for(;y<=m&&Date.now()<=w;){const b=x();if(b)return b}}addToPath(e,t,r,o,u){const d=e.lastComponent;return d&&!u.oneChangePerToken&&d.added===t&&d.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:d.count+1,added:t,removed:r,previousComponent:d.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:t,removed:r,previousComponent:d}}}extractCommon(e,t,r,o,u){const d=t.length,f=r.length;let p=e.oldPos,y=p-o,m=0;for(;y+1<d&&p+1<f&&this.equals(r[p+1],t[y+1],u);)y++,p++,m++,u.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return m&&!u.oneChangePerToken&&(e.lastComponent={count:m,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=p,y}equals(e,t,r){return r.comparator?r.comparator(e,t):e===t||!!r.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,r){const o=[];let u;for(;e;)o.push(e),u=e.previousComponent,delete e.previousComponent,e=u;o.reverse();const d=o.length;let f=0,p=0,y=0;for(;f<d;f++){const m=o[f];if(m.removed)m.value=this.join(r.slice(y,y+m.count)),y+=m.count;else{if(!m.added&&this.useLongestToken){let S=t.slice(p,p+m.count);S=S.map(function(w,k){const h=r[y+k];return h.length>w.length?h:w}),m.value=this.join(S)}else m.value=this.join(t.slice(p,p+m.count));p+=m.count,m.added||(y+=m.count)}}return o}}class Ye extends We{constructor(){super(...arguments),this.tokenize=Ke}equals(e,t,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
23
23
  `))&&(e=e.trim()),(!r.newlineIsToken||!t.includes(`
24
24
  `))&&(t=t.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
25
25
  `)&&(e=e.slice(0,-1)),t.endsWith(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kelet-ai/feedback-ui",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/kelet-ai/feedback-ui.git"