PageSourceSearch

https://www.ninjatools.ai/_next/static/chunks/194-35beb896042f35f8.js

js ninjatools.ai collected 2026-10-04 22:39:20 UTC 14,204 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[194],{62409:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(10015).Z)("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]])},90359:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(10015).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},63529:function(e){e.exports=function(e,t){let r;if("function"!=typeof e)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n=0;return function(...a){clearTimeout(r);let i=Date.now(),s=t-(i-n);s<=0?(n=i,e.apply(this,a)):r=setTimeout(()=>{n=Date.now(),e.apply(this,a)},s)}}},76663:function(e,t,r){"use strict";r.d(t,{GO:function(){return _},RJ:function(){return T}});var n,a,i,s,l,u,o,c,d,f,h=r(87028),g=r(88988),p=r(63529),E=r(30923),w=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},y=(e,t,r)=>(w(e,t,"read from private field"),r?r.call(e):t.get(e)),m=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},b=(e,t,r,n)=>(w(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);function k(e,t){return null!=t?p(e,t):e}var v=class{constructor(e=[]){m(this,n,void 0),m(this,a,"ready"),m(this,i,void 0),m(this,s,new Set),m(this,l,new Set),m(this,u,new Set),this.pushMessage=e=>{b(this,n,y(this,n).concat(e)),y(this,o).call(this)},this.popMessage=()=>{b(this,n,y(this,n).slice(0,-1)),y(this,o).call(this)},this.replaceMessage=(e,t)=>{b(this,n,[...y(this,n).slice(0,e),this.snapshot(t),...y(this,n).slice(e+1)]),y(this,o).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,t)=>{let r=t?k(e,t):e;return y(this,s).add(r),()=>{y(this,s).delete(r)}},this["~registerStatusCallback"]=e=>(y(this,l).add(e),()=>{y(this,l).delete(e)}),this["~registerErrorCallback"]=e=>(y(this,u).add(e),()=>{y(this,u).delete(e)}),m(this,o,()=>{y(this,s).forEach(e=>e())}),m(this,c,()=>{y(this,l).forEach(e=>e())}),m(this,d,()=>{y(this,u).forEach(e=>e())}),b(this,n,e)}get status(){return y(this,a)}set status(e){b(this,a,e),y(this,c).call(this)}get error(){return y(this,i)}set error(e){b(this,i,e),y(this,d).call(this)}get messages(){return y(this,n)}set messages(e){b(this,n,[...e]),y(this,o).call(this)}};n=new WeakMap,a=new WeakMap,i=new WeakMap,s=new WeakMap,l=new WeakMap,u=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap;var C=class extends g.Pu{constructor({messages:e,...t}){let r=new v(e);super({...t,state:r}),m(this,f,void 0),this["~registerMessagesCallback"]=(e,t)=>y(this,f)["~registerMessagesCallback"](e,t),this["~registerStatusCallback"]=e=>y(this,f)["~registerStatusCallback"](e),this["~registerErrorCallback"]=e=>y(this,f)["~registerErrorCallback"](e),b(this,f,r)}};function T({experimental_throttle:e,resume:t=!1,...r}={}){let n=(0,h.useRef)("chat"in r?r.chat:new C(r));("chat"in r&&r.chat!==n.current||"id"in r&&n.current.id!==r.id)&&(n.current="chat"in r?r.chat:new C(r));let a="id"in r?r.id:null,i=(0,h.useCallback)(t=>n.current["~registerMessagesCallback"](t,e),[e,a]),s=(0,h.useSyncExternalStore)(i,()=>n.current.messages,()=>n.current.messages),l=(0,h.useSyncExternalStore)(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),u=(0,h.useSyncExternalStore)(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),o=(0,h.useCallback)(e=>{"function"==typeof e&&(e=e(n.current.messages)),n.current.messages=e},[n]);return(0,h.useEffect)(()=>{t&&n.current.resumeStream()},[t,n]),{id:n.current.id,messages:s,setMessages:o,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:u,resumeStream:n.current.resumeStream,status:l,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput}}function _({api:e="/api/completion",id:t,initialCompletion:r="",initialInput:n="",credentials:a,headers:i,body:s,streamProtocol:l="data",fetch:u,onFinish:o,onError:c,experimental_throttle:d}={}){let f=(0,h.useId)(),p=t||f,{data:w,mutate:y}=(0,E.ZP)([e,p],null,{fallbackData:r}),{data:m=!1,mutate:b}=(0,E.ZP)([p,"loading"],null),[v,C]=(0,h.useState)(void 0),[T,_]=(0,h.useState)(null),S=(0,h.useRef)({credentials:a,headers:i,body:s});(0,h.useEffect)(()=>{S.current={credentials:a,headers:i,body:s}},[a,i,s]);let R=(0,h.useCallback)(async(t,r)=>(0,g.V6)({api:e,prompt:t,credentials:S.current.credentials,headers:{...S.current.headers,...null==r?void 0:r.headers},body:{...S.current.body,...null==r?void 0:r.body},streamProtocol:l,fetch:u,setCompletion:k(e=>
1y(e,!1),d),setLoading:b,setError:C,setAbortController:_,onFinish:o,onError:c}),[y,b,e,S,_,o,c,C,l,u,d]),O=(0,h.useCallback)(()=>{T&&(T.abort(),_(null))},[T]),V=(0,h.useCallback)(e=>{y(e,!1)},[y]),M=(0,h.useCallback)(async(e,t)=>R(e,t),[R]),[L,D]=(0,h.useState)(n),N=(0,h.useCallback)(e=>{var t;return null==(t=null==e?void 0:e.preventDefault)||t.call(e),L?M(L):void 0},[L,M]),W=(0,h.useCallback)(e=>{D(e.target.value)},[D]);return{completion:w,complete:M,error:v,setCompletion:V,stop:O,input:L,setInput:D,handleInputChange:W,handleSubmit:N,isLoading:m}}f=new WeakMap},30923:function(e,t,r){"use strict";let n;r.d(t,{ZP:function(){return ee},kY:function(){return B}});var a=r(87028),i=r(52433);let s=()=>{},l=s(),u=Object,o=e=>e===l,c=e=>"function"==typeof e,d=(e,t)=>({...e,...t}),f=e=>c(e.then),h=new WeakMap,g=0,p=e=>{let t,r;let n=typeof e,a=e&&e.constructor,i=a==Date;if(u(e)!==e||i||a==RegExp)t=i?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=h.get(e))return t;if(t=++g+"~",h.set(e,t),a==Array){for(r=0,t="@";r<e.length;r++)t+=p(e[r])+",";h.set(e,t)}if(a==u){t="#";let n=u.keys(e).sort();for(;!o(r=n.pop());)o(e[r])||(t+=r+":"+p(e[r])+",");h.set(e,t)}}return t},E=new WeakMap,w={},y={},m="undefined",b=typeof window!=m,k=typeof document!=m,v=()=>b&&typeof window.requestAnimationFrame!=m,C=(e,t)=>{let r=E.get(e);return[()=>!o(t)&&e.get(t)||w,n=>{if(!o(t)){let a=e.get(t);t in y||(y[t]=a),r[5](t,d(a,n),a||w)}},r[6],()=>!o(t)&&t in y?y[t]:!o(t)&&e.get(t)||w]},T=!0,[_,S]=b&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[s,s],R={initFocus:e=>(k&&document.addEventListener("visibilitychange",e),_("focus",e),()=>{k&&document.removeEventListener("visibilitychange",e),S("focus",e)}),initReconnect:e=>{let t=()=>{T=!0,e()},r=()=>{T=!1};return _("online",t),_("offline",r),()=>{S("online",t),S("offline",r)}}},O=!a.useId,V=!b||"Deno"in window,M=e=>v()?window.requestAnimationFrame(e):setTimeout(e,1),L=V?a.useEffect:a.useLayoutEffect,D="undefined"!=typeof navigator&&navigator.connection,N=!V&&D&&(["slow-2g","2g"].includes(D.effectiveType)||D.saveData),W=e=>{if(c(e))try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?p(e):"",t]},x=0,A=()=>++x;var P={ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:0,MUTATE_EVENT:2,RECONNECT_EVENT:1};async function I(...e){let[t,r,n,a]=e,i=d({populateCache:!0,throwOnError:!0},"boolean"==typeof a?{revalidate:a}:a||{}),s=i.populateCache,u=i.rollbackOnError,h=i.optimisticData,g=e=>"function"==typeof u?u(e):!1!==u,p=i.throwOnError;if(c(r)){let e=[];for(let n of t.keys())!/^\$(inf|sub)\$/.test(n)&&r(t.get(n)._k)&&e.push(n);return Promise.all(e.map(w))}return w(r);async function w(r){let a;let[u]=W(r);if(!u)return;let[d,w]=C(t,u),[y,m,b,k]=E.get(t),v=()=>{let e=y[u];return(c(i.revalidate)?i.revalidate(d().data,r):!1!==i.revalidate)&&(delete b[u],delete k[u],e&&e[0])?e[0](2).then(()=>d().data):d().data};if(e.length<3)return v();let T=n,_=A();m[u]=[_,0];let S=!o(h),R=d(),O=R.data,V=R._c,M=o(V)?O:V;if(S&&w({data:h=c(h)?h(M,O):h,_c:M}),c(T))try{T=T(M)}catch(e){a=e}if(T&&f(T)){if(T=await T.catch(e=>{a=e}),_!==m[u][0]){if(a)throw a;return T}a&&S&&g(a)&&(s=!0,w({data:M,_c:l}))}if(s&&!a&&(c(s)?w({data:s(T,M),error:l,_c:l}):w({data:T,error:l,_c:l})),m[u][1]=A(),Promise.resolve(v()).then(()=>{w({_c:l})}),a){if(p)throw a;return}return T}}let F=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},Z=(e,t)=>{if(!E.has(e)){let r=d(R,t),n={},a=I.bind(l,e),i=s,u={},o=(e,t)=>{let r=u[e]||[];return u[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},c=(t,r,n)=>{e.set(t,r);let a=u[t];if(a)for(let e of a)e(r,n)},f=()=>{if(!E.has(e)&&(E.set(e,[n,{},{},{},a,c,o]),!V)){let t=r.initFocus(setTimeout.bind(l,F.bind(l,n,0))),a=r.initReconnect(setTimeout.bind(l,F.bind(l,n,1)));i=()=>{t&&t(),a&&a(),E.delete(e)}}};return f(),[e,a,f,i]}return[e,E.get(e)[4]]},[U,q]=Z(new Map),$=d({onLoadingSlow:s,onSuccess:s,onError:s,onErrorRetry:(e,t,r,n,a)=>{let i=r.errorRetryCount,s=a.retryCount,l=~~((Math.random()+.5)*(1<<(s<8?s:8)))*r.errorRetryInterval;(o(i)||!(s>i))&&setTimeout(n,l,a)},onDiscarded:s,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:N?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:N?5e3:3e3,compare:(e,t)=>
1p(e)==p(t),isPaused:()=>!1,cache:U,mutate:q,fallback:{}},{isOnline:()=>T,isVisible:()=>{let e=k&&document.visibilityState;return o(e)||"hidden"!==e}}),j=(e,t)=>{let r=d(e,t);if(t){let{use:n,fallback:a}=e,{use:i,fallback:s}=t;n&&i&&(r.use=n.concat(i)),a&&s&&(r.fallback=d(a,s))}return r},J=(0,a.createContext)({}),z=b&&window.__SWR_DEVTOOLS_USE__,G=z?window.__SWR_DEVTOOLS_USE__:[],Y=e=>c(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],B=()=>d($,(0,a.useContext)(J)),H=G.concat(e=>(t,r,n)=>{let a=r&&((...e)=>{let[n]=W(t),[,,,a]=E.get(U);if(n.startsWith("$inf$"))return r(...e);let i=a[n];return o(i)?r(...e):(delete a[n],i)});return e(t,a,n)}),K=(e,t,r)=>{let n=t[e]||(t[e]=[]);return n.push(r),()=>{let e=n.indexOf(r);e>=0&&(n[e]=n[n.length-1],n.pop())}};z&&(window.__SWR_DEVTOOLS_REACT__=a);let Q=a.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;if("rejected"===e.status)throw e.reason;throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}),X={dedupe:!0};u.defineProperty(e=>{let{value:t}=e,r=(0,a.useContext)(J),n=c(t),i=(0,a.useMemo)(()=>n?t(r):t,[n,r,t]),s=(0,a.useMemo)(()=>n?i:j(r,i),[n,r,i]),u=i&&i.provider,o=(0,a.useRef)(l);u&&!o.current&&(o.current=Z(u(s.cache||U),i));let f=o.current;return f&&(s.cache=f[0],s.mutate=f[1]),L(()=>{if(f)return f[2]&&f[2](),f[3]},[]),(0,a.createElement)(J.Provider,d(e,{value:s}))},"defaultValue",{value:$});let ee=(n=(e,t,r)=>{let{cache:n,compare:s,suspense:u,fallbackData:f,revalidateOnMount:h,revalidateIfStale:g,refreshInterval:p,refreshWhenHidden:w,refreshWhenOffline:y,keepPreviousData:m}=r,[b,k,v,T]=E.get(n),[_,S]=W(e),R=(0,a.useRef)(!1),D=(0,a.useRef)(!1),N=(0,a.useRef)(_),x=(0,a.useRef)(t),F=(0,a.useRef)(r),Z=()=>F.current,U=()=>Z().isVisible()&&Z().isOnline(),[q,$,j,J]=C(n,_),z=(0,a.useRef)({}).current,G=o(f)?r.fallback[_]:f,Y=(e,t)=>{for(let r in z)if("data"===r){if(!s(e[r],t[r])&&(!o(e[r])||!s(es,t[r])))return!1}else if(t[r]!==e[r])return!1;return!0},B=(0,a.useMemo)(()=>{let e=!!_&&!!t&&(o(h)?!Z().isPaused()&&!u&&(!!o(g)||g):h),r=t=>{let r=d(t);return(delete r._k,e)?{isValidating:!0,isLoading:!0,...r}:r},n=q(),a=J(),i=r(n),s=n===a?i:r(a),l=i;return[()=>{let e=r(q());return Y(e,l)?(l.data=e.data,l.isLoading=e.isLoading,l.isValidating=e.isValidating,l.error=e.error,l):(l=e,e)},()=>s]},[n,_]),H=(0,i.useSyncExternalStore)((0,a.useCallback)(e=>j(_,(t,r)=>{Y(r,t)||e()}),[n,_]),B[0],B[1]),ee=!R.current,et=b[_]&&b[_].length>0,er=H.data,en=o(er)?G:er,ea=H.error,ei=(0,a.useRef)(en),es=m?o(er)?ei.current:er:en,el=(!et||!!o(ea))&&(ee&&!o(h)?h:!Z().isPaused()&&(u?!o(en)&&g:o(en)||g)),eu=!!(_&&t&&ee&&el),eo=o(H.isValidating)?eu:H.isValidating,ec=o(H.isLoading)?eu:H.isLoading,ed=(0,a.useCallback)(async e=>{let t,n;let a=x.current;if(!_||!a||D.current||Z().isPaused())return!1;let i=!0,u=e||{},d=!v[_]||!u.dedupe,f=()=>O?!D.current&&_===N.current&&R.current:_===N.current,h={isValidating:!1,isLoading:!1},g=()=>{$(h)},p=()=>{let e=v[_];e&&e[1]===n&&delete v[_]},E={isValidating:!0};o(q().data)&&(E.isLoading=!0);try{if(d&&($(E),r.loadingTimeout&&o(q().data)&&setTimeout(()=>{i&&f()&&Z().onLoadingSlow(_,r)},r.loadingTimeout),v[_]=[a(S),A()]),[t,n]=v[_],t=await t,d&&setTimeout(p,r.dedupingInterval),!v[_]||v[_][1]!==n)return d&&f()&&Z().onDiscarded(_),!1;h.error=l;let e=k[_];if(!o(e)&&(n<=e[0]||n<=e[1]||0===e[1]))return g(),d&&f()&&Z().onDiscarded(_),!1;let u=q().data;h.data=s(u,t)?u:t,d&&f()&&Z().onSuccess(t,_,r)}catch(r){p();let e=Z(),{shouldRetryOnError:t}=e;!e.isPaused()&&(h.error=r,d&&f()&&(e.onError(r,_,e),(!0===t||c(t)&&t(r))&&(!Z().revalidateOnFocus||!Z().revalidateOnReconnect||U())&&e.onErrorRetry(r,_,e,e=>{let t=b[_];t&&t[0]&&t[0](P.ERROR_REVALIDATE_EVENT,e)},{retryCount:(u.retryCount||0)+1,dedupe:!0})))}return i=!1,g(),!0},[_,n]),ef=(0,a.useCallback)((...e)=>I(n,N.current,...e),[]);if(L(()=>{x.current=t,F.current=r,o(er)||(ei.current=er)}),L(()=>{if(!_)return;let e=ed.bind(l,X),t=0,r=K(_,b,(r,n={})=>{if(r==P.FOCUS_EVENT){let r=Date.now();Z().revalidateOnFocus&&r>t&&U()&&(t=r+Z().focusThrottleInterval,e())}else if(r==P.RECONNECT_EVENT)Z().revalidateOnReconnect&&U()&&e();else if(r==P.MUTATE_EVENT)return ed();else if(r==P.ERROR_REVALIDATE_EVENT)return ed(n)});return D.current=!1,N.current=_,R.current=!0,$({_k:S}),el&&(o(en)||V?e():M(e)),()=>{D.current=!0,r()}},[_]),L(()=>{let e;function t(){let t=c(p)?p(q().data):p;t&&-1!==e&&(e=setTimeout(r,t))}function r(){!q().error&&(w||Z().isVisible())&&(y||Z().isOnline())?ed(X).then(t):t()}return t(),()=>{e&&(clearTimeout(e),e=-1)}},[p,w,y,_]),(0,a.useDebugValue)(es),u&&o(en)&&_){if(!O&&V)throw Error("Fallback data is required when using suspense in SSR.");x.current=t,F.current=r,D.current=!1;let e=T[_];if(o(e)||Q(ef(e)),o(ea)){let e=ed(X);o(es)||(e.status="fulfilled",e.value=!0),Q(e)}else throw ea}return{mutate:ef,get data(){return z.data=!0,es},get error(){return z.error=!0,ea},get isValidating(){return z.isValidating=!0,eo},get isLoading(){return z.isLoading=!0,ec}}},function(...e){let t=B(),[r,a,i]=Y(e),s=j(t,i),l=n,{use:u}=s,o=(u||[]).concat(H);for(let e=o.length;e--;)l=o[e](l);return l(r,a||s.fetcher||null,s)})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.