1// source --> https://selina-furter.de/wp-content/plugins/ai-copilot/build/api/assistants/js/index.js?ver=b8026be4b2b543591b6f 2(()=>{"use strict";var s={d:(t,e)=>{for(var a in e)s.o(e,a)&&!s.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},o:(s,t)=>Object.prototype.hasOwnProperty.call(s,t),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},t={};s.r(t),s.d(t,{INITIAL_STATE:()=>o,QUADLAYERS_AICP_STORE_NAME:()=>I,STORE_NAME:()=>r,actions:()=>a,fetchRestApiAssistantFiles:()=>S,fetchRestApiAssistantVectorStores:()=>_,fetchRestApiAssistants:()=>u,fetchRestApiAssistantsSync:()=>y,reducer:()=>n,resolvers:()=>i,selectors:()=>e,useApiAssistant:()=>g});var e={};s.r(e),s.d(e,{getAssistants:()=>d});var a={};s.r(a),s.d(a,{createAssistant:()=>T,deleteAssistant:()=>b,editAssistant:()=>w,restoreAssistant:()=>R,setAssistants:()=>m,syncAssistants:()=>f});var i={};s.r(i),s.d(i,{getAssistants:()=>v});var n={};s.r(n),s.d(n,{default:()=>E});const c=window.wp.data,r="aicp/assistants/store",o={assistants:[]},d=s=>s.assistants,p=window.wp.i18n,h=window.wp.notices,A=window.aicp.helpers,{QUADLAYERS_AICP_API_ASSISTANTS_REST_ROUTES:l}=aicpApiAssistants,u=({method:s,data:t,assistant_id:e=null}={})=>{let a=l.assistants;return null!=e&&(a+=`?assistant_id=${Number(e)}`),(0,A.apiFetch)({path:a,method:s,data:t})},y=({method:s,data:t}={})=>(0,A.apiFetch)({path:l.assistants+"?sync=true",method:s,data:t}),S=({method:s,data:t,attachment_id:e=null}={})=>{const a=`${l.assistants_files}?attachment_id=${e}`;return(0,A.apiFetch)({path:a,method:s,data:t})},_=({method:s,data:t,attachment_id:e=null}={})=>{const a=`${l.assistants_vector_stores}?attachment_id=${e}`;return(0,A.apiFetch)({path:a,method:s,data:t})};function g(){const{createAssistant:s,editAssistant:t,restoreAssistant:e,deleteAssistant:a,syncAssistants:i,setAssistants:n}=(0,c.useDispatch)(r),{assistants:o,isResolvingAssistants:d,hasResolvedAssistants:p}=(0,c.useSelect)(s=>{const{isResolving:t,hasFinishedResolution:e,getAssistants:a}=s(r);let i=s("core/editor").getEditedPostAttribute("type");if(!i){const s=document.getElementById("post_type");s&&(i=s.value)}return{assistants:a()||[],isResolvingAssistants:t("getAssistants"),hasResolvedAssistants:e("getAssistants")}},[]);return{assistants:o,isResolvingAssistants:d,hasResolvedAssistants:p,hasAssistants:!(!p||!o?.length),createAssistant:s,editAssistant:t,restoreAssistant:e,deleteAssistant:a,syncAssistants:i,setAssistants:n}}const m=s=>({type:"SET_ASSISTANTS",payload:s}),T=s=>async({registry:t,dispatch:e,select:a})=>{const i=await u({method:"POST",data:s});if(i?.code||i?.message)return t.dispatch(h.store).createSuccessNotice((0,p.sprintf)("%s: %s",i.code,i.message),{type:"snackbar"}),!1;const n=a.getAssistants();return n.push(i),e.setAssistants([...n]),t.dispatch(h.store).createSuccessNotice((0,p.__)("The assistant has been created successfully.","ai-copilot"),{type:"snackbar"}),i},f=()=>async({registry:s,dispatch:t,select:e})=>{const a=await y({method:"GET"});return a?.code||a?.message?(s.dispatch(h.store).createSuccessNotice((0,p.sprintf)("%s: %s",a.code,a.message),{type:"snackbar"}),!1):(t.setAssistants([...a]),s.dispatch(h.store).createSuccessNotice((0,p.__)("The assistants have been synchronized successfully.","ai-copilot"),{type:"snackbar"}),a)},b=s=>async({registry:t,dispatch:e,select:a})=>{const i=a.getAssistants(),n=await u({method:"DELETE",data:{assistant_id:s}});if(n?.code||n?.message)return t.dispatch(h.store).createSuccessNotice((0,p.sprintf)("%s: %s",n.code,n.message),{type:"snackbar"}),!1;const c=i.filter(t=>parseInt(t.assistant_id)!==parseInt(s));return e.setAssistants([...c]),t.dispatch(h.store).createSuccessNotice((0,p.sprintf)((0,p.__)("The assistant %s has been deleted.","ai-copilot"),s),{type:"snackbar"}),!0},w=s=>async({registry:t,dispatch:e,select:a})=>{const i=await u({method:"PATCH",data:s});if(i?.code||i?.message)return t.dispatch(h.store).createSuccessNotice((0,p.sprintf)("%s: %s",i.code,i.message),{type:"snackbar"}),!1;const n=a.getAssistants();return e.setAssistants([...n.map(t=>
2t.assistant_id==s.assistant_id?i:t)]),t.dispatch(h.store).createSuccessNotice((0,p.__)("The assistant has been updated successfully.","ai-copilot"),{type:"snackbar"}),i},R=s=>async({registry:t,dispatch:e,select:a})=>{const i=await u({method:"POST",data:s});if(i?.code||i?.message)return t.dispatch(h.store).createSuccessNotice((0,p.sprintf)("%s: %s",i.code,i.message),{type:"snackbar"}),!1;const n=a.getAssistants();return e.setAssistants([...n.map(t=>t.assistant_id==s.assistant_id?i:t)]),t.dispatch(h.store).createSuccessNotice((0,p.__)("The assistant has been updated successfully.","ai-copilot"),{type:"snackbar"}),i},v=async()=>{try{const s=await u({method:"GET"});return m(s)}catch(s){console.error(s)}};function E(s=o,t){return"SET_ASSISTANTS"===t.type?{...s,assistants:t.payload}:s}const N=(0,c.createReduxStore)(r,{reducer:E,actions:a,selectors:e,resolvers:i});(0,c.register)((0,A.isVersionLessThan)(A.WP_VERSION,A.FIRST_WP_VERSION_WITH_THUNK_SUPPORT)?(0,A.applyThunkMiddleware)(N):N);const I=r;(window.aicp=window.aicp||{})["api-assistants"]=t})();
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.