(()=>{"use strict";var e={d:(r,d)=>{for(var i in d)e.o(d,i)&&!e.o(r,i)&&Object.defineProperty(r,i,{enumerable:!0,get:d[i]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{STORE_NAME:()=>z});var d={};e.r(d),e.d(d,{addModel:()=>y,addProvider:()=>m,setDefaultImageModel:()=>E,setDefaultProvider:()=>g,setDefaultVideoModel:()=>T,setProviders:()=>f,updateCapability:()=>M,updateModel:()=>D,updateParameter:()=>b});var i={};e.r(i),e.d(i,{getCapabilities:()=>j,getCapability:()=>C,getDefaultImageModel:()=>Y,getDefaultProvider:()=>N,getDefaultVideoModel:()=>q,getModel:()=>S,getModelIdentity:()=>w,getModelInputTypes:()=>L,getModelOutputTypes:()=>k,getParameter:()=>x,getParameters:()=>h,getProvider:()=>_,getProviderModels:()=>A,getProviders:()=>O,isCapabilityLocked:()=>F,isCapabilitySupported:()=>U,isModelLocked:()=>V,isModelSupported:()=>R,isParameterLocked:()=>G,isParameterSupported:()=>B});const t=window.wp.data,o="SET_PROVIDERS",a="ADD_PROVIDER",n="UPDATE_MODEL",u="ADD_MODEL",s="UPDATE_CAPABILITY",p="UPDATE_PARAMETER",l="SET_DEFAULT_PROVIDER",v="SET_DEFAULT_IMAGE_MODEL",c="SET_DEFAULT_VIDEO_MODEL";var P;const I=null!==(P=window?.tryAuraAiProviderModels)&&void 0!==P?P:{aiProviders:{},defaultProvider:"",defaultImageModel:"",defaultVideoModel:""};function f(e){return{type:o,providers:e}}function m(e,r={}){return{type:a,providerId:e,providerData:r}}function y(e,r,d){return{type:u,providerId:e,modelId:r,modelData:d}}function D(e,r,d){return{type:n,providerId:e,modelId:r,modelData:d}}function M(e,r,d,i){return{type:s,providerId:e,modelId:r,capabilityId:d,capabilityData:i}}function b(e,r,d,i){return{type:p,providerId:e,modelId:r,parameterId:d,parameterData:i}}function g(e){return{type:l,providerId:e}}function E(e){return{type:v,modelId:e}}function T(e){return{type:c,modelId:e}}function O(e){return Object.keys(e.aiProviders)}function _(e,r){return e.aiProviders[r]}function A(e,r,d){const i=e.aiProviders[r];if(!i||!d)return i;const t={};for(const[e,r]of Object.entries(i)){let i=!0;void 0!==d.supported&&r.supported!==d.supported&&(i=!1),i&&void 0!==d.locked&&r.locked!==d.locked&&(i=!1),i&&void 0!==d.identity&&r.identity!==d.identity&&(i=!1),i&&(t[e]=r)}return t}function S(e,r,d){return e.aiProviders[r]?.[d]}function w(e,r,d){return e.aiProviders[r]?.[d]?.identity}function L(e,r,d){return e.aiProviders[r]?.[d]?.inputTypes}function k(e,r,d){return e.aiProviders[r]?.[d]?.outputTypes}function R(e,r,d){return!!e.aiProviders[r]?.[d]?.supported}function V(e,r,d){return!!e.aiProviders[r]?.[d]?.locked}function j(e,r,d){return e.aiProviders[r]?.[d]?.capabilities}function C(e,r,d,i){return e.aiProviders[r]?.[d]?.capabilities?.[i]}function U(e,r,d,i){return!!e.aiProviders[r]?.[d]?.capabilities?.[i]?.supported}function F(e,r,d,i){return!!e.aiProviders[r]?.[d]?.capabilities?.[i]?.locked}function h(e,r,d){return e.aiProviders[r]?.[d]?.parameters}function x(e,r,d,i){return e.aiProviders[r]?.[d]?.parameters?.[i]}function B(e,r,d,i){return!!e.aiProviders[r]?.[d]?.parameters?.[i]?.supported}function G(e,r,d,i){return!!e.aiProviders[r]?.[d]?.parameters?.[i]?.locked}function N(e){return e.defaultProvider}function Y(e){return e.defaultImageModel}function q(e){return e.defaultVideoModel}const z="tryaura/ai-models",H=(0,t.createReduxStore)(z,{reducer:function(e=I,r){switch(r.type){case o:return r.providers;case a:return{...e,aiProviders:{...e.aiProviders,[r.providerId]:{...r.providerData,...e.aiProviders[r.providerId]||{}}}};case u:return{...e,aiProviders:{...e.aiProviders,[r.providerId]:{...e.aiProviders[r.providerId]||{},[r.modelId]:r.modelData}}};case n:return{...e,aiProviders:{...e.aiProviders,[r.providerId]:{...e.aiProviders[r.providerId]||{},[r.modelId]:{...e.aiProviders[r.providerId]?.[r.modelId]||{},...r.modelData}}}};case s:return{...e,aiProviders:{...e.aiProviders,[r.providerId]:{...e.aiProviders[r.providerId]||{},[r.modelId]:{...e.aiProviders[r.providerId]?.[r.modelId]||{},capabilities:{...e.aiProviders[r.providerId]?.[r.modelId]?.capabilities||{},[r.capabilityId]:{...e.aiProviders[r.providerId]?.[r.modelId]?.capabilities?.[r.capabilityId]||{},...r.capabilityData}}}}}};case p:return{...e,aiProviders:{...e.aiProviders,[r.providerId]:{...e.aiProviders[r.providerId]||{},[r.modelId]:{...e.aiProviders[r.providerId]?.[r.modelId]||{},parameters:{...e.aiProviders[r.providerId]?.[r.modelId]?.parameters||{},[r.parameterId]:{...e.aiProviders[r.providerId]?.[r.modelId]?.parameters?.[r.parameterId]||{},...r.parameterData}}}}}};case l:return{...e,defaultProvider:r.providerId};case v:return{...e,defaultImageModel:r.modelId};case c:return{...e,defaultVideoModel:r.modelId};default:return e}},actions:d,selectors:i});(0,t.register)(H),(window.tryaura=window.tryaura||{}).aiProvidersStore=r})();