strapi-plugin-navigation 3.0.12 → 3.0.13
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.
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const Ur=require("zod"),B=require("lodash"),R=require("lodash/fp"),$u=require("crypto"),Ou=require("child_process"),Iu=require("lodash/has"),Nu=require("lodash/mapValues"),Pu=require("lodash/snakeCase"),Lu=require("lodash/camelCase"),ku=require("lodash/mapKeys"),Du=require("os"),Mu=require("path"),ju=require("fs"),Hu=require("assert"),Bu=require("events"),Uu=require("buffer"),Gu=require("stream"),qu=require("util"),Ku=require("constants");require("node:stream");const Wu=require("@sindresorhus/slugify"),zu=require("pluralize"),se=e=>e&&e.__esModule?e:{default:e};function Yu(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const y=Yu(Ur),he=se(B),Fi=se($u),un=se(Ou),cn=se(Iu),na=se(Nu),$i=se(Pu),Qu=se(Lu),Vu=se(ku),Nn=se(Du),Ee=se(Mu),Ke=se(ju),ra=se(Hu),Xu=se(Bu),Zu=se(Uu),Pn=se(Gu),rt=se(qu),Ju=se(Ku),ec=se(Wu),Oi=se(zu),Gr=y.object({name:y.string().refine(e=>!e.includes(" "),{message:"No space allowed"}),label:y.string(),required:y.boolean().optional(),enabled:y.boolean().optional()}),tc=Gr.extend({type:y.literal("select"),multi:y.boolean(),options:y.array(y.string())}),nc=Gr.extend({type:y.enum(["boolean","string"]),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),rc=Gr.extend({type:y.literal("media"),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),ic=y.union([nc,rc,tc]),oc=y.union([y.literal("audience"),ic]),Pe=y.object({additionalFields:y.array(oc),allowedLevels:y.number(),contentTypes:y.array(y.string()),contentTypesNameFields:y.record(y.string(),y.array(y.string())),contentTypesPopulate:y.record(y.string(),y.array(y.string())),gql:y.object({navigationItemRelated:y.array(y.string())}),pathDefaultFields:y.record(y.string(),y.any()),cascadeMenuAttached:y.boolean(),preferCustomContentTypes:y.boolean(),isCacheEnabled:y.boolean().optional()}),ac=y.enum(["collectionType","singleType"]),sc=y.object({singularName:y.string(),pluralName:y.string(),displayName:y.string(),description:y.string().optional(),name:y.string().optional()}),ia=y.object({required:y.boolean().optional(),max:y.number().optional(),min:y.number().optional(),minLength:y.number().optional(),maxLength:y.number().optional(),private:y.boolean().optional(),configurable:y.boolean().optional(),default:y.any().optional()}),uc=y.enum(["string","text","richtext","blocks","email","password","date","time","datetime","timestamp","boolean","integer","biginteger","float","decimal","json","relation","media"]),cc=ia.extend({type:uc}),lc=ia.extend({type:y.literal("enumeration"),enum:y.string().array()}),fc=y.object({type:y.literal("component"),component:y.string(),repeatable:y.boolean().optional()}),pc=y.object({type:y.literal("dynamiczone"),components:y.string().array()}),dc=y.object({type:y.literal("uid")}),hc=y.object({type:y.literal("media"),allowedTypes:y.enum(["images","videos","audios","files"]).array(),required:y.boolean().optional()}),mc=y.enum(["oneToOne","oneToMany","manyToOne","manyToMany","morphToMany","manyToMorph"]),gc=y.object({type:y.literal("relation"),relation:mc,target:y.string(),mappedBy:y.string().optional(),inversedBy:y.string().optional()}),yc=y.record(y.string(),y.union([cc,lc,fc,pc,gc,hc,dc])),_r=y.object({kind:ac,collectionName:y.string(),info:sc,options:y.object({draftAndPublish:y.boolean().optional(),hidden:y.boolean().optional(),templateName:y.string().optional()}).optional(),attributes:yc,actions:y.record(y.string(),y.any()).optional(),lifecycles:y.record(y.string(),y.any()).optional(),uid:y.string(),apiName:y.string().optional(),associations:y.object({model:y.string(),alias:y.string()}).array().optional(),modelName:y.string().optional(),plugin:y.string().optional(),pluginOptions:y.record(y.string(),y.any()).optional(),isSingle:y.boolean().optional()});_r.pick({info:!0,kind:!0,attributes:!0,options:!0});const oa=y.object({id:y.number(),documentId:y.string(),name:y.string(),key:y.string()}),vc=y.enum(["INTERNAL","EXTERNAL","WRAPPER"]),qr=y.object({id:y.number(),documentId:y.string(),title:y.string(),type:vc,path:y.string().or(y.null()).optional(),slug:y.string().or(y.null()).optional(),externalPath:y.string().or(y.null()).optional(),uiRouterKey:y.string(),menuAttached:y.boolean(),order:y.number().int(),collapsed:y.boolean(),related:y.object({documentId:y.string().optional(),__type:y.string()}).catchall(y.unknown()).nullish(),additionalFields:y.record(y.string(),y.unknown()).or(y.null()).optional(),audience:y.array(oa).or(y.null()).optional(),autoSync:y.boolean().or(y.null()).optional()}),wc=qr.omit({related:!0}).pick({path:!0,type:!0,uiRouterKey:!0,title:!0,externalPath:!0}).extend({related:y.unknown()}),Pt=qr.extend({parent:y.lazy(()=>Pt.or(y.null())).optional(),items:y.lazy(()=>Pt.array()).optional(),master:y.lazy(()=>Qe(!1)).optional()}),Ii=y.array(Pt),Qe=e=>y.object({id:y.number(),documentId:y.string(),name:y.string(),slug:y.string(),locale:y.string(),visible:y.boolean(),items:e?y.array(Pt):Pt.array().optional()}),Ec=Qe(!1).omit({items:!0,id:!0,documentId:!0,slug:!0,locale:!0}).extend({documentId:y.string().optional(),id:y.undefined().optional()}),bc=qr.omit({id:!0,documentId:!0}).extend({id:y.number().optional(),documentId:y.string().optional(),items:y.lazy(()=>aa).or(y.null()).optional(),updated:y.boolean().optional(),removed:y.boolean().optional()}),aa=y.array(bc),xc=Qe(!1).extend({items:aa}).partial().required({id:!0,documentId:!0}),Sc=/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,_c=["beforeCreate","beforeCreateMany","afterCreate","afterCreateMany","beforeUpdate","beforeUpdateMany","afterUpdate","afterUpdateMany","beforeDelete","beforeDeleteMany","afterDelete","afterDeleteMany","beforeCount","afterCount","beforeFindOne","afterFindOne","beforeFindMany","afterFindMany"],Ac="$",sa=["api::","plugin::"],ua=["admin::","plugin::content-releases","plugin::i18n.locale","plugin::navigation","plugin::review-workflows","plugin::users-permissions","plugin::upload.folder"],Tc=["title","subject","name"],Ni={SINGLE:"singleType"},Pi=["title","type","path","externalPath","uiRouterKey","menuAttached","order","collapsed","related","parent","master","audience","additionalFields"],Cc=e=>e.filter(t=>t!=="audience"),ca=e=>{const t=Cc(e);if(t.length!==B.uniqBy(t,"name").length)throw new Error("All names of custom fields must be unique.");if(!B.isNil(B.find(t,n=>typeof n=="object"&&B.includes(Pi,n.name))))throw new Error(`Name of custom field cannot be one of: ${Pi.join(", ")}`)},la=(e,t)=>{if(e==null)throw t??new Error("Non-empty value expected, empty given")},Rc=(e="")=>{const t=a=>a.split("-").map(o=>B.capitalize(o)).join(""),[n,r,i]=Fc(e);return n==="api"?t(i):`${t(r)}${t(i)}`},Fc=(e="")=>e.split(Sc).filter(t=>t&&t.length>0),$c=(e,t)=>n=>[n,async r=>{await oe(t,"common").runLifeCycleHook({contentTypeName:e,hookName:n,event:r})}],fa=(e,t)=>Object.fromEntries(_c.map($c(e,t))),xe=({strapi:e})=>{const t=e.plugin("navigation");return{masterModel:t.contentType("navigation"),itemModel:t.contentType("navigation-item"),relatedModel:t.contentType("navigations-items-related"),audienceModel:t.contentType("audience")}};function oe({strapi:e},t){return e.plugin("navigation").service(t)}const Wt=e=>e==="*"?"*":typeof e=="string"?[e]:e===!1?[]:e===!0?"*":e,Oc=(e="")=>{const t=!!sa.find(r=>e.includes(r)),n=!ua.find(r=>e.includes(r)||e===r);return!!e&&t&&n},Li=(e="")=>B.last(e)==="s"?e.substr(0,e.length-1):e,pa=async({strapi:e,forceDefault:t=!1})=>{const n=e.store({type:"plugin",name:"navigation"}),r=await e.plugin("navigation").config,i=t?{}:{...Ar.default,...await n.get({key:"config"})??Ar.default};let a=B.isEmpty(i)?i:Pe.parse(i);const o=Ic(a,r);return a={additionalFields:o("additionalFields"),contentTypes:o("contentTypes"),contentTypesNameFields:o("contentTypesNameFields"),contentTypesPopulate:o("contentTypesPopulate"),allowedLevels:o("allowedLevels"),gql:o("gql"),pathDefaultFields:o("pathDefaultFields"),cascadeMenuAttached:o("cascadeMenuAttached"),preferCustomContentTypes:o("preferCustomContentTypes"),isCacheEnabled:o("isCacheEnabled")},Nc(a,{strapi:e}),ca(a.additionalFields),await n.set({key:"config",value:a}),a},Ic=(e,t)=>n=>{const r=e?.[n]??t(n);return la(r,new Error(`[Navigation] Config "${n}" is undefined`)),r},Nc=(e,{strapi:t})=>{const n=e.contentTypes.filter(i=>!t.contentTypes[i]);if(n.length===0)return;const r=n.map(Rc);e.contentTypes=e.contentTypes.filter(i=>!n.includes(i)),e.contentTypesNameFields=Object.fromEntries(Object.entries(e.contentTypesNameFields).filter(([i])=>!n.includes(i))),e.gql.navigationItemRelated=e.gql.navigationItemRelated.filter(i=>!r.includes(i))},Ar={default:{additionalFields:[],allowedLevels:2,contentTypes:[],contentTypesNameFields:{},contentTypesPopulate:{},gql:{navigationItemRelated:[]},i18nEnabled:!1,pathDefaultFields:{},pruneObsoleteI18nNavigations:!1,cascadeMenuAttached:!0,preferCustomContentTypes:!1,isCacheEnabled:!1}},Pc=B.once(e=>({find(t,n){const{audienceModel:{uid:r}}=xe(e);return e.strapi.query(r).findMany({where:t,limit:n}).then(oa.array().parse)}})),ln=(e,t)=>({findFirst(n,r,i={}){return e.strapi.documents(t).findFirst({populate:Wt(n),status:r,...i})},findById(n,r,i,a={}){return e.strapi.documents(t).findOne({documentId:n,populate:Wt(r),status:i,...a})},findManyById(n,r,i){return e.strapi.documents(t).findMany({where:{documentId:{$in:n}},populate:Wt(r),status:i})},findMany(n,r,i,a){return e.strapi.documents(t).findMany({where:n,populate:Wt(r),status:i,locale:a})},count(n,r){return e.strapi.documents(t).count({where:n,status:r})}}),Ne=B.once(e=>({async save({item:t,locale:n}){const{itemModel:r}=xe(e),{__type:i,documentId:a}=t?.related??{},o=i?ln(e,i):void 0,s=i&&o?a?await o.findById(a,void 0,void 0,{locale:n}):await o.findFirst(void 0,void 0,{locale:n}):void 0;if(typeof t.documentId=="string"){const{documentId:u,...f}=t;return e.strapi.documents(r.uid).update({documentId:t.documentId,data:{...f,related:s?{...s,__type:i}:void 0},locale:n})}else return e.strapi.documents(r.uid).create({data:{...t,related:s?{...s,__type:i}:void 0},locale:n})},find({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=xe(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(Tr)).then(Ii.parse).then(s=>s.map(fn))},count(t){const{itemModel:n}=xe(e);return e.strapi.query(n.uid).count({where:t})},remove(t){const{itemModel:n}=xe(e);return e.strapi.query(n.uid).delete({where:{documentId:t.documentId}})},removeForIds(t){const{itemModel:n}=xe(e);return e.strapi.query(n.uid).deleteMany({where:{documentId:t}})},findForMasterIds(t){const{itemModel:n}=xe(e);return e.strapi.query(n.uid).findMany({where:{$or:t.map(r=>({master:r}))},limit:Number.MAX_SAFE_INTEGER}).then(Ii.parse)}})),Lc=["id","publishedAt","createdAt","updatedAt","locale"],fn=({related:e,items:t=[],...n})=>({...n,items:t.map(fn),related:e?B.omit(e,Lc):void 0}),Tr=({related:e,...t})=>({...t,related:e?.[0]});class bt extends Error{constructor(t,n){super(t),this.additionalInfo=n,this.type="NavigationError"}}class tr extends bt{constructor(){super(...arguments),this.type="FillNavigationError"}}class kc extends bt{constructor(){super(...arguments),this.type="InvalidParamNavigationError"}}const ki=e=>e===!0?!0:Array.isArray(e)?e.includes("items"):!1,Ie=B.once(e=>({find({filters:t,locale:n,limit:r,orderBy:i,populate:a}){const{masterModel:o}=xe(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(Tr)}))).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(fn)}))).then(s=>Qe(ki(a)).array().parse(s))},findOne({locale:t,filters:n,populate:r}){const{masterModel:i}=xe(e);return e.strapi.documents(i.uid).findOne({documentId:n.documentId,locale:t,populate:r}).then(a=>a&&{...a,items:a.items?.map(Tr)}).then(a=>Qe(ki(r)).parse(a)).then(a=>({...a,items:a.items?.map(fn)}))},async save(t){const{masterModel:n}=xe(e),{documentId:r,locale:i,...a}=t;return r?e.strapi.documents(n.uid).update({locale:i,documentId:r,data:B.omit(a,["id","documentId"]),populate:["items"]}).then(Qe(!1).parse):e.strapi.documents(n.uid).create({locale:i,data:{...a,populate:["items"]}}).then(Qe(!1).parse)},remove(t){const{masterModel:n}=xe(e);if(!t.documentId&&!t.id)throw new bt("Some kind of id required. None given.");return e.strapi.query(n.uid).deleteMany({where:t})}})),Dc="Navigation",Mc="navigation",jc=async e=>{const t=oe(e,"common"),{defaultLocale:n,restLocale:r=[]}=await t.readLocale(),i=Ie(e),a=await i.find({limit:Number.MAX_SAFE_INTEGER,filters:{},locale:"*"});a.length===0&&a.push(await i.save({name:Dc,visible:!0,locale:n,slug:Mc}));const o=a.filter(({locale:s})=>s===n);for(const s of o)for(const u of r)!a.find(({locale:c,documentId:l})=>l===s.documentId&&u===c)&&await i.save({documentId:s.documentId,name:s.name,locale:u,visible:s.visible,slug:s.slug})},de={render:function(e){return`plugin::navigation.${e}`},navigation:{read:"read",update:"update",settings:"settings"}},Hc=async({strapi:e})=>{const t=[{section:"plugins",displayName:"Read",uid:de.navigation.read,pluginName:"navigation"},{section:"plugins",displayName:"Update",uid:de.navigation.update,pluginName:"navigation"},{section:"plugins",displayName:"Settings",uid:de.navigation.settings,pluginName:"navigation"}];await e.admin.services.permission.actionProvider.registerMany(t)},Bc=({nexus:e})=>e.objectType({name:"ContentTypes",definition(t){t.nonNull.string("uid"),t.nonNull.string("name"),t.nonNull.boolean("isSingle"),t.nonNull.string("collectionName"),t.nonNull.string("contentTypeName"),t.nonNull.string("label"),t.nonNull.string("relatedField"),t.nonNull.string("labelSingular"),t.nonNull.string("endpoint"),t.nonNull.boolean("available"),t.nonNull.boolean("visible")}}),Uc=({nexus:e,strapi:t})=>e.objectType({name:"ContentTypesNameFields",async definition(n){n.nonNull.list.nonNull.string("default");const i=await oe({strapi:t},"common").getPluginStore(),o=Pe.parse(await i.get({key:"config"})).contentTypesNameFields;Object.keys(o||{}).forEach(s=>n.nonNull.list.string(s))}}),Gc=({nexus:e})=>e.inputObjectType({name:"CreateNavigation",definition(t){t.nonNull.string("name"),t.nonNull.list.field("items",{type:"CreateNavigationItem"})}}),qc=({nexus:e})=>e.inputObjectType({name:"CreateNavigationItem",definition(t){t.nonNull.string("title"),t.nonNull.field("type",{type:"NavigationItemType"}),t.string("path"),t.string("externalPath"),t.nonNull.string("uiRouterKey"),t.nonNull.boolean("menuAttached"),t.nonNull.int("order"),t.string("parent"),t.string("master"),t.list.field("items",{type:"CreateNavigationItem"}),t.list.string("audience"),t.field("related",{type:"CreateNavigationRelated"})}}),Kc=({nexus:e})=>e.inputObjectType({name:"CreateNavigationRelated",definition(t){t.nonNull.string("ref"),t.nonNull.string("field"),t.nonNull.string("refId")}}),Wc=({nexus:e})=>e.objectType({name:"Navigation",definition(t){t.nonNull.string("id"),t.nonNull.string("documentId"),t.nonNull.string("name"),t.nonNull.string("slug"),t.nonNull.boolean("visible")}}),zc=({nexus:e})=>e.objectType({name:"NavigationConfig",definition(t){t.int("allowedLevels"),t.nonNull.list.string("additionalFields"),t.field("contentTypesNameFields",{type:"ContentTypesNameFields"}),t.list.field("contentTypes",{type:"ContentTypes"})}}),Yc=({nexus:e})=>e.objectType({name:"NavigationDetails",definition(t){t.nonNull.string("id"),t.nonNull.string("documentId"),t.nonNull.string("name"),t.nonNull.string("slug"),t.nonNull.boolean("visible"),t.nonNull.list.field("items",{type:"NavigationItem"})}}),Qc=({nexus:e,config:t})=>e.objectType({name:"NavigationItem",definition(n){n.nonNull.int("id"),n.nonNull.string("documentId"),n.nonNull.string("title"),n.nonNull.field("type",{type:"NavigationItemType"}),n.string("path"),n.string("externalPath"),n.nonNull.string("uiRouterKey"),n.nonNull.boolean("menuAttached"),n.nonNull.int("order"),n.field("parent",{type:"NavigationItem"}),n.string("master"),n.list.field("items",{type:"NavigationItem"}),n.field("related",{type:"NavigationItemRelated"}),t.additionalFields.find(r=>r==="audience")&&n.list.string("audience"),n.field("additionalFields",{type:"NavigationItemAdditionalFields"}),n.string("created_at"),n.string("updated_at"),n.string("created_by"),n.string("updated_by"),n.string("createdAt"),n.string("updatedAt"),n.string("createdBy"),n.string("updatedBy")}}),Vc=({nexus:e,config:t})=>e.objectType({name:"NavigationItemAdditionalFields",definition(n){t.additionalFields.forEach(r=>{if(r!=="audience"&&r.enabled)switch(r.type){case"media":n.field(r.name,{type:"UploadFile"});break;case"string":n.string(r.name);break;case"boolean":n.boolean(r.name);break;case"select":r.multi?n.list.string(r.name):n.string(r.name);break;default:throw new Error(`Type "${JSON.stringify(r.type)}" is unsupported by custom fields`)}})}}),Xc=({strapi:e,nexus:t,config:n})=>{const r=n.gql?.navigationItemRelated,i="NavigationItemRelated";return r?.length?t.unionType({name:i,definition(a){a.members(...r)},resolveType:a=>e.contentTypes[a.__type]?.globalId}):t.objectType({name:i,definition(a){a.int("id"),a.string("documentId"),a.string("title"),a.string("name")}})},Zc=({nexus:e})=>e.enumType({name:"NavigationItemType",members:["INTERNAL","EXTERNAL","WRAPPER"]}),Jc=({nexus:e})=>e.enumType({name:"NavigationRenderType",members:["FLAT","TREE"]}),el=[Vc,Xc,Qc,Jc,Wc,Yc,Uc,Bc,zc,Kc,qc,Gc,Zc],tl=e=>el.map(t=>t(e)),nl="I18NLocaleCode",rl=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:a}=t;return{args:{navigationIdOrSlug:n(i()),type:"NavigationRenderType",menuOnly:a(),path:i(),locale:t.arg({type:nl})},type:n(r("NavigationItem")),resolve(u,{navigationIdOrSlug:f,type:c,menuOnly:l,path:p,locale:d}){const h=Ur.z.string().parse(f);return oe({strapi:e},"client").render({idOrSlug:h,type:c,rootPath:p,locale:d,menuOnly:l,wrapRelated:!0})}}},il=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:a}=t;return{type:n(r("NavigationItem")),args:{documentId:n(i()),childUiKey:n(i()),type:"NavigationRenderType",menuOnly:a()},resolve(o,s){const{documentId:u,childUIKey:f,type:c,menuOnly:l}=s,p=Ur.z.string().parse(u);return oe({strapi:e},"client").renderChildren({idOrSlug:p,childUIKey:f,type:c,menuOnly:l,wrapRelated:!0})}}},ol=e=>{const t={renderNavigationChild:il,renderNavigation:rl};return e.nexus.extendType({type:"Query",definition(n){for(const[r,i]of Object.entries(t)){const a=i(e);n.field(r,a)}}})},al=()=>({"Query.renderNavigationChild":{auth:!1},"Query.renderNavigation":{auth:!1}}),sl=async({strapi:e})=>{const t=e.plugin("graphql").service("extension");t.shadowCRUD("plugin::navigation.audience").disable(),t.shadowCRUD("plugin::navigation.navigation").disable(),t.shadowCRUD("plugin::navigation.navigation-item").disable(),t.shadowCRUD("plugin::navigation.navigations-items-related").disable();const r=await oe({strapi:e},"common").getPluginStore(),i=Pe.parse(await r.get({key:"config"}));t.use(({strapi:a,nexus:o})=>{const s=tl({strapi:a,nexus:o,config:i}),u=ol({strapi:a,nexus:o}),f=al();return{types:[s,u],resolversConfig:f}})},ul=async({strapi:e})=>{!!e.plugin("graphql")&&await sl({strapi:e})},cl=async e=>{await pa(e),await jc(e),await Hc(e),await ul(e)},ll=({strapi:e})=>{},fl=({strapi:e})=>{},pl={collectionName:"audience",info:{singularName:"audience",pluralName:"audiences",displayName:"Audience",name:"audience"},options:{increments:!0,comment:"Audience"},attributes:{name:{type:"string",required:!0},key:{type:"uid",targetField:"name"}}},dl={schema:pl},hl=fa("navigation",{strapi}),ml={collectionName:"navigations",info:{singularName:"navigation",pluralName:"navigations",displayName:"Navigation",name:"navigation"},options:{comment:""},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1},i18n:{localized:!0}},attributes:{name:{type:"text",configurable:!1,required:!0},slug:{type:"uid",target:"name",configurable:!1,required:!0},visible:{type:"boolean",default:!1,configurable:!1},items:{type:"relation",relation:"oneToMany",target:"plugin::navigation.navigation-item",configurable:!1,mappedBy:"master"}}},gl={schema:ml,lifecycles:hl},yl=fa("navigation-item",{strapi}),vl={collectionName:"navigations_items",info:{singularName:"navigation-item",pluralName:"navigation-items",displayName:"Navigation Item",name:"navigation-item"},options:{increments:!0,timestamps:!0,comment:"Navigation Item"},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1},i18n:{localized:!1}},attributes:{title:{type:"text",configurable:!1,required:!0,pluginOptions:{i18n:{localized:!1}}},type:{type:"enumeration",enum:["INTERNAL","EXTERNAL","WRAPPER"],default:"INTERNAL",configurable:!1},path:{type:"text",targetField:"title",configurable:!1},externalPath:{type:"text",configurable:!1},uiRouterKey:{type:"string",configurable:!1},menuAttached:{type:"boolean",default:!1,configurable:!1},order:{type:"integer",default:0,configurable:!1},collapsed:{type:"boolean",default:!1,configurable:!1},autoSync:{type:"boolean",default:!0,configurable:!1},related:{type:"relation",relation:"morphToMany",required:!0,configurable:!1},parent:{type:"relation",relation:"oneToOne",target:"plugin::navigation.navigation-item",configurable:!1,default:null},master:{type:"relation",relation:"manyToOne",target:"plugin::navigation.navigation",configurable:!1,inversedBy:"items"},audience:{type:"relation",relation:"oneToMany",target:"plugin::navigation.audience"},additionalFields:{type:"json",require:!1,default:{}}}},wl={schema:vl,lifecycles:yl},El={audience:dl,navigation:gl,"navigation-item":wl},da=y.enum(["true","false"]),zt=y.string(),bl=y.object({locale:y.string().optional(),orderBy:y.string().optional(),orderDirection:y.enum(["DESC","ASC"]).optional()}),ha=y.enum(["FLAT","TREE","RFR"]),ma=y.union([y.boolean(),y.string(),y.string().array(),y.undefined()]),xl=y.object({type:ha.optional(),menu:da.optional(),path:y.string().optional(),locale:y.string().optional(),populate:ma.optional()}),Sl=y.object({type:ha.optional(),menu:da.optional(),locale:y.string().optional()}),_l=y.object({source:y.string().min(1),target:y.string().min(1),documentId:y.string().min(1)});function Al(e){return{getAdminService(){return oe(e,"admin")},getCommonService(){return oe(e,"common")},async get(){return await this.getAdminService().get({})},post(t){const{auditLog:n}=t;return this.getAdminService().post({payload:Ec.parse(t.request.body),auditLog:n})},put(t){const{params:{documentId:n},auditLog:r}=t,i=y.record(y.string(),y.unknown()).parse(t.request.body);return this.getAdminService().put({auditLog:r,payload:xc.parse({...i,documentId:n})})},async delete(t){const{auditLog:n,params:{documentId:r}}=t;return await this.getAdminService().delete({documentId:zt.parse(r),auditLog:n}),{}},config(){return this.getAdminService().config({viaSettingsPage:!1})},async updateConfig(t){return await this.getAdminService().updateConfig({config:Pe.parse(t.request.body)}),{}},async restoreConfig(){return await this.getAdminService().restoreConfig(),{}},settingsConfig(){return this.getAdminService().config({viaSettingsPage:!0})},async settingsRestart(){return await this.getAdminService().restart(),{}},getById(t){const{params:{documentId:n}}=t;return this.getAdminService().getById({documentId:zt.parse(n)})},getContentTypeItems(t){const{params:{model:n},query:r={}}=t;return this.getAdminService().getContentTypeItems({query:y.record(y.string(),y.unknown()).parse(r),uid:y.string().parse(n)})},async fillFromOtherLocale(t){const{params:n,auditLog:r}=t,{source:i,target:a,documentId:o}=_l.parse(n);return await this.getAdminService().fillFromOtherLocale({source:i,target:a,documentId:o,auditLog:r})},readNavigationItemFromLocale(t){const{params:{source:n,target:r},query:{path:i}}=t;return this.getAdminService().readNavigationItemFromLocale({path:y.string().parse(i),source:zt.parse(n),target:zt.parse(r)})},getSlug(t){const{query:{q:n}}=t;return this.getCommonService().getSlug({query:y.string().parse(n)}).then(r=>({slug:r}))},settingsLocale(){return this.getCommonService().readLocale()}}}const Tl=e=>{if(!(!e||e===!0||e==="*")&&typeof e!="object")return Array.isArray(e),e};function Cl(e){return{getService(){return oe(e,"client")},async readAll(t){try{const{query:n={}}=t,{locale:r,orderBy:i,orderDirection:a}=bl.parse(n);return await this.getService().readAll({locale:r,orderBy:i,orderDirection:a})}catch(n){if(n instanceof Error)return t.badRequest(n.message);throw n}},async render(t){const{params:n,query:r={}}=t,{type:i,menu:a,path:o,locale:s,populate:u}=xl.parse(r),f=y.string().parse(n.idOrSlug);return await this.getService().render({idOrSlug:f,type:i,menuOnly:a==="true",rootPath:o,locale:s,populate:Tl(ma.parse(u==="true"?!0:u==="false"?!1:Array.isArray(u)?u.map(c=>c==="true"?!0:c==="false"?!1:u):u))})},async renderChild(t){const{params:n,query:r={}}=t,{type:i,menu:a,locale:o}=Sl.parse(r),s=y.string().parse(n.documentId),u=y.string().parse(n.childUIKey);return await this.getService().renderChildren({idOrSlug:s,childUIKey:u,type:i,menuOnly:a==="true",locale:o})}}}const Rl={admin:Al,client:Cl},Fl={},$l={},Ol={type:"admin",routes:[{method:"GET",path:"/",handler:"admin.get",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("read")]}}]}},{method:"POST",path:"/",handler:"admin.post",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("update")]}}]}},{method:"GET",path:"/config",handler:"admin.config",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("read")]}}]}},{method:"PUT",path:"/config",handler:"admin.updateConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("settings")]}}]}},{method:"DELETE",path:"/config",handler:"admin.restoreConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("settings")]}}]}},{method:"GET",path:"/slug",handler:"admin.getSlug",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/:documentId",handler:"admin.getById",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("read")]}}]}},{method:"PUT",path:"/:documentId",handler:"admin.put",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("update")]}}]}},{method:"DELETE",path:"/:documentId",handler:"admin.delete",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("update")]}}]}},{method:"GET",path:"/content-type-items/:model",handler:"admin.getContentTypeItems",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/settings/locale",handler:"admin.settingsLocale",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/settings/config",handler:"admin.settingsConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("settings")]}}]}},{method:"GET",path:"/settings/restart",handler:"admin.settingsRestart",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("settings")]}}]}},{method:"PUT",path:"/i18n/copy/:documentId/:source/:target",handler:"admin.fillFromOtherLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("update")]}}]}},{method:"GET",path:"/i18n/item/read/:source/:target",handler:"admin.readNavigationItemFromLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("read")]}}]}}]},Il={type:"content-api",routes:[{method:"GET",path:"/render/:idOrSlug",handler:"client.render",config:{policies:[]}},{method:"GET",path:"/render/:idOrSlug/:childUIKey",handler:"client.renderChild",config:{policies:[]}},{method:"GET",path:"/",handler:"client.readAll",config:{policies:[]}}]},Nl={admin:Ol,"content-api":Il};function Pl(e,t){return he.default.has(process.env,e)?process.env[e]:t}function at(e){return process.env[e]??""}const Ll={int(e,t){return he.default.has(process.env,e)?parseInt(at(e),10):t},float(e,t){return he.default.has(process.env,e)?parseFloat(at(e)):t},bool(e,t){return he.default.has(process.env,e)?at(e)==="true":t},json(e,t){if(!he.default.has(process.env,e))return t;try{return JSON.parse(at(e))}catch(n){throw n instanceof Error?new Error(`Invalid json environment variable ${e}: ${n.message}`):n}},array(e,t){if(!he.default.has(process.env,e))return t;let n=at(e);return n.startsWith("[")&&n.endsWith("]")&&(n=n.substring(1,n.length-1)),n.split(",").map(r=>he.default.trim(he.default.trim(r," "),'"'))},date(e,t){return he.default.has(process.env,e)?new Date(at(e)):t},oneOf(e,t,n){if(!t)throw new Error("env.oneOf requires expectedValues");if(n&&!t.includes(n))throw new Error("env.oneOf requires defaultValue to be included in expectedValues");const r=kl(e,n);return t.includes(r)?r:n}},kl=Object.assign(Pl,Ll),Dl="id",Ml="documentId",jl={ID_ATTRIBUTE:Dl,DOC_ID_ATTRIBUTE:Ml},Hl=e=>R.union(strapi?.config?.get("api.responses.privateAttributes",[])??[],R.getOr([],"options.privateAttributes",e)),Bl=(e,t)=>e?.attributes?.[t]?.private===!0?!0:Hl(e).includes(t),ga=e=>e&&!["media","component","relation","dynamiczone"].includes(e.type),Ul=e=>e?.type==="media",ya=e=>e?.type==="relation",Gl=e=>!!e&&e.type==="dynamiczone",va=e=>!!e&&ya(e)&&e.relation?.startsWith?.("morphTo"),dt=async(e,t,n)=>{const{path:r={raw:null,attribute:null},schema:i,getModel:a}=t;let o=t.parent;const s=async(m,g,b)=>{const T={schema:a(b.__type),path:g,getModel:a,parent:o};return dt(m,T,b)},u=m=>async(g,b,S)=>dt(g,{schema:m,path:b,getModel:a,parent:o},S),f=async(m,g,b)=>{const A={schema:a("plugin::upload.file"),path:g,getModel:a,parent:o};return dt(m,A,b)},c=async(m,g,b,S)=>dt(m,{schema:b,path:g,getModel:a,parent:o},S),l=async(m,g,b)=>{const T={schema:a(b.__component),path:g,getModel:a,parent:o};return dt(m,T,b)};if(!R.isObject(n)||R.isNil(i))return n;const p=R.clone(n),d=ql({data:p}),h=Object.keys(p);for(let m=0;m<h.length;m+=1){const g=h[m],b=i.attributes[g],S={...r};S.raw=R.isNil(r.raw)?g:`${r.raw}.${g}`,R.isNil(b)||(S.attribute=R.isNil(r.attribute)?g:`${r.attribute}.${g}`);const T={data:p,schema:i,key:g,value:p[g],attribute:b,path:S,getModel:a,parent:o};await e(T,d);const A=p[g];if(!(R.isNil(A)||R.isNil(b))){if(o={schema:i,key:g,attribute:b,path:S},ya(b)){const F=b.relation.toLowerCase().startsWith("morph")?s:u(a(b.target));if(R.isArray(A)){const M=new Array(A.length);for(let x=0;x<A.length;x+=1)M[x]=await F(e,S,A[x]);p[g]=M}else p[g]=await F(e,S,A);continue}if(Ul(b)){if(R.isArray(A)){const C=new Array(A.length);for(let F=0;F<A.length;F+=1)C[F]=await f(e,S,A[F]);p[g]=C}else p[g]=await f(e,S,A);continue}if(b.type==="component"){const C=a(b.component);if(R.isArray(A)){const F=new Array(A.length);for(let M=0;M<A.length;M+=1)F[M]=await c(e,S,C,A[M]);p[g]=F}else p[g]=await c(e,S,C,A);continue}if(b.type==="dynamiczone"&&R.isArray(A)){const C=new Array(A.length);for(let F=0;F<A.length;F+=1)C[F]=await l(e,S,A[F]);p[g]=C;continue}}}return p},ql=({data:e})=>({remove(t){delete e[t]},set(t,n){e[t]=n}});var Kl=R.curry(dt),ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wl={exports:{}};(function(e,t){(function(n,r){e.exports=r(un.default,Fi.default)})(ve,function(n,r){return function(i){function a(s){if(o[s])return o[s].exports;var u=o[s]={exports:{},id:s,loaded:!1};return i[s].call(u.exports,u,u.exports,a),u.loaded=!0,u.exports}var o={};return a.m=i,a.c=o,a.p="",a(0)}([function(i,a,o){i.exports=o(34)},function(i,a,o){var s=o(29)("wks"),u=o(33),f=o(2).Symbol,c=typeof f=="function",l=i.exports=function(p){return s[p]||(s[p]=c&&f[p]||(c?f:u)("Symbol."+p))};l.store=s},function(i,a){var o=i.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=o)},function(i,a,o){var s=o(9);i.exports=function(u){if(!s(u))throw TypeError(u+" is not an object!");return u}},function(i,a,o){i.exports=!o(24)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(12),u=o(17);i.exports=o(4)?function(f,c,l){return s.f(f,c,u(1,l))}:function(f,c,l){return f[c]=l,f}},function(i,a){var o=i.exports={version:"2.4.0"};typeof __e=="number"&&(__e=o)},function(i,a,o){var s=o(14);i.exports=function(u,f,c){if(s(u),f===void 0)return u;switch(c){case 1:return function(l){return u.call(f,l)};case 2:return function(l,p){return u.call(f,l,p)};case 3:return function(l,p,d){return u.call(f,l,p,d)}}return function(){return u.apply(f,arguments)}}},function(i,a){var o={}.hasOwnProperty;i.exports=function(s,u){return o.call(s,u)}},function(i,a){i.exports=function(o){return typeof o=="object"?o!==null:typeof o=="function"}},function(i,a){i.exports={}},function(i,a){var o={}.toString;i.exports=function(s){return o.call(s).slice(8,-1)}},function(i,a,o){var s=o(3),u=o(26),f=o(32),c=Object.defineProperty;a.f=o(4)?Object.defineProperty:function(l,p,d){if(s(l),p=f(p,!0),s(d),u)try{return c(l,p,d)}catch{}if("get"in d||"set"in d)throw TypeError("Accessors not supported!");return"value"in d&&(l[p]=d.value),l}},function(i,a,o){var s=o(42),u=o(15);i.exports=function(f){return s(u(f))}},function(i,a){i.exports=function(o){if(typeof o!="function")throw TypeError(o+" is not a function!");return o}},function(i,a){i.exports=function(o){if(o==null)throw TypeError("Can't call method on "+o);return o}},function(i,a,o){var s=o(9),u=o(2).document,f=s(u)&&s(u.createElement);i.exports=function(c){return f?u.createElement(c):{}}},function(i,a){i.exports=function(o,s){return{enumerable:!(1&o),configurable:!(2&o),writable:!(4&o),value:s}}},function(i,a,o){var s=o(12).f,u=o(8),f=o(1)("toStringTag");i.exports=function(c,l,p){c&&!u(c=p?c:c.prototype,f)&&s(c,f,{configurable:!0,value:l})}},function(i,a,o){var s=o(29)("keys"),u=o(33);i.exports=function(f){return s[f]||(s[f]=u(f))}},function(i,a){var o=Math.ceil,s=Math.floor;i.exports=function(u){return isNaN(u=+u)?0:(u>0?s:o)(u)}},function(i,a,o){var s=o(11),u=o(1)("toStringTag"),f=s(function(){return arguments}())=="Arguments",c=function(l,p){try{return l[p]}catch{}};i.exports=function(l){var p,d,h;return l===void 0?"Undefined":l===null?"Null":typeof(d=c(p=Object(l),u))=="string"?d:f?s(p):(h=s(p))=="Object"&&typeof p.callee=="function"?"Arguments":h}},function(i,a){i.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(i,a,o){var s=o(2),u=o(6),f=o(7),c=o(5),l="prototype",p=function(d,h,m){var g,b,S,T=d&p.F,A=d&p.G,C=d&p.S,F=d&p.P,M=d&p.B,x=d&p.W,_=A?u:u[h]||(u[h]={}),I=_[l],w=A?s:C?s[h]:(s[h]||{})[l];A&&(m=h);for(g in m)b=!T&&w&&w[g]!==void 0,b&&g in _||(S=b?w[g]:m[g],_[g]=A&&typeof w[g]!="function"?m[g]:M&&b?f(S,s):x&&w[g]==S?function(L){var H=function(K,E,v){if(this instanceof L){switch(arguments.length){case 0:return new L;case 1:return new L(K);case 2:return new L(K,E)}return new L(K,E,v)}return L.apply(this,arguments)};return H[l]=L[l],H}(S):F&&typeof S=="function"?f(Function.call,S):S,F&&((_.virtual||(_.virtual={}))[g]=S,d&p.R&&I&&!I[g]&&c(I,g,S)))};p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128,i.exports=p},function(i,a){i.exports=function(o){try{return!!o()}catch{return!0}}},function(i,a,o){i.exports=o(2).document&&document.documentElement},function(i,a,o){i.exports=!o(4)&&!o(24)(function(){return Object.defineProperty(o(16)("div"),"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(28),u=o(23),f=o(57),c=o(5),l=o(8),p=o(10),d=o(45),h=o(18),m=o(52),g=o(1)("iterator"),b=!([].keys&&"next"in[].keys()),S="@@iterator",T="keys",A="values",C=function(){return this};i.exports=function(F,M,x,_,I,w,L){d(x,M,_);var H,K,E,v=function(D){if(!b&&D in W)return W[D];switch(D){case T:return function(){return new x(this,D)};case A:return function(){return new x(this,D)}}return function(){return new x(this,D)}},j=M+" Iterator",k=I==A,U=!1,W=F.prototype,Q=W[g]||W[S]||I&&W[I],ee=Q||v(I),Ce=I?k?v("entries"):ee:void 0,O=M=="Array"&&W.entries||Q;if(O&&(E=m(O.call(new F)),E!==Object.prototype&&(h(E,j,!0),s||l(E,g)||c(E,g,C))),k&&Q&&Q.name!==A&&(U=!0,ee=function(){return Q.call(this)}),s&&!L||!b&&!U&&W[g]||c(W,g,ee),p[M]=ee,p[j]=C,I)if(H={values:k?ee:v(A),keys:w?ee:v(T),entries:Ce},L)for(K in H)K in W||f(W,K,H[K]);else u(u.P+u.F*(b||U),M,H);return H}},function(i,a){i.exports=!0},function(i,a,o){var s=o(2),u="__core-js_shared__",f=s[u]||(s[u]={});i.exports=function(c){return f[c]||(f[c]={})}},function(i,a,o){var s,u,f,c=o(7),l=o(41),p=o(25),d=o(16),h=o(2),m=h.process,g=h.setImmediate,b=h.clearImmediate,S=h.MessageChannel,T=0,A={},C="onreadystatechange",F=function(){var x=+this;if(A.hasOwnProperty(x)){var _=A[x];delete A[x],_()}},M=function(x){F.call(x.data)};g&&b||(g=function(x){for(var _=[],I=1;arguments.length>I;)_.push(arguments[I++]);return A[++T]=function(){l(typeof x=="function"?x:Function(x),_)},s(T),T},b=function(x){delete A[x]},o(11)(m)=="process"?s=function(x){m.nextTick(c(F,x,1))}:S?(u=new S,f=u.port2,u.port1.onmessage=M,s=c(f.postMessage,f,1)):h.addEventListener&&typeof postMessage=="function"&&!h.importScripts?(s=function(x){h.postMessage(x+"","*")},h.addEventListener("message",M,!1)):s=C in d("script")?function(x){p.appendChild(d("script"))[C]=function(){p.removeChild(this),F.call(x)}}:function(x){setTimeout(c(F,x,1),0)}),i.exports={set:g,clear:b}},function(i,a,o){var s=o(20),u=Math.min;i.exports=function(f){return f>0?u(s(f),9007199254740991):0}},function(i,a,o){var s=o(9);i.exports=function(u,f){if(!s(u))return u;var c,l;if(f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u))||typeof(c=u.valueOf)=="function"&&!s(l=c.call(u))||!f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u)))return l;throw TypeError("Can't convert object to primitive value")}},function(i,a){var o=0,s=Math.random();i.exports=function(u){return"Symbol(".concat(u===void 0?"":u,")_",(++o+s).toString(36))}},function(i,a,o){function s(C){return C&&C.__esModule?C:{default:C}}function u(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function f(C){return(0,g.createHash)("sha256").update(C).digest("hex")}function c(C){switch(S){case"darwin":return C.split("IOPlatformUUID")[1].split(`
|
|
1
|
+
"use strict";const Ur=require("zod"),B=require("lodash"),R=require("lodash/fp"),$u=require("crypto"),Ou=require("child_process"),Iu=require("lodash/has"),Nu=require("lodash/mapValues"),Pu=require("lodash/snakeCase"),Lu=require("lodash/camelCase"),ku=require("lodash/mapKeys"),Du=require("os"),Mu=require("path"),ju=require("fs"),Hu=require("assert"),Bu=require("events"),Uu=require("buffer"),Gu=require("stream"),qu=require("util"),Ku=require("constants");require("node:stream");const Wu=require("@sindresorhus/slugify"),zu=require("pluralize"),se=e=>e&&e.__esModule?e:{default:e};function Yu(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const y=Yu(Ur),he=se(B),Fi=se($u),un=se(Ou),cn=se(Iu),na=se(Nu),$i=se(Pu),Qu=se(Lu),Vu=se(ku),Nn=se(Du),Ee=se(Mu),Ke=se(ju),ra=se(Hu),Xu=se(Bu),Zu=se(Uu),Pn=se(Gu),rt=se(qu),Ju=se(Ku),ec=se(Wu),Oi=se(zu),Gr=y.object({name:y.string().refine(e=>!e.includes(" "),{message:"No space allowed"}),label:y.string(),required:y.boolean().optional(),enabled:y.boolean().optional()}),tc=Gr.extend({type:y.literal("select"),multi:y.boolean(),options:y.array(y.string())}),nc=Gr.extend({type:y.enum(["boolean","string"]),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),rc=Gr.extend({type:y.literal("media"),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),ic=y.union([nc,rc,tc]),oc=y.union([y.literal("audience"),ic]),Pe=y.object({additionalFields:y.array(oc),allowedLevels:y.number(),contentTypes:y.array(y.string()),contentTypesNameFields:y.record(y.string(),y.array(y.string())),contentTypesPopulate:y.record(y.string(),y.array(y.string())),gql:y.object({navigationItemRelated:y.array(y.string())}),pathDefaultFields:y.record(y.string(),y.any()),cascadeMenuAttached:y.boolean(),preferCustomContentTypes:y.boolean(),isCacheEnabled:y.boolean().optional()}),ac=y.enum(["collectionType","singleType"]),sc=y.object({singularName:y.string(),pluralName:y.string(),displayName:y.string(),description:y.string().optional(),name:y.string().optional()}),ia=y.object({required:y.boolean().optional(),max:y.number().optional(),min:y.number().optional(),minLength:y.number().optional(),maxLength:y.number().optional(),private:y.boolean().optional(),configurable:y.boolean().optional(),default:y.any().optional()}),uc=y.enum(["string","text","richtext","blocks","email","password","date","time","datetime","timestamp","boolean","integer","biginteger","float","decimal","json","relation","media"]),cc=ia.extend({type:uc}),lc=ia.extend({type:y.literal("enumeration"),enum:y.string().array()}),fc=y.object({type:y.literal("component"),component:y.string(),repeatable:y.boolean().optional()}),pc=y.object({type:y.literal("dynamiczone"),components:y.string().array()}),dc=y.object({type:y.literal("uid")}),hc=y.object({type:y.literal("media"),allowedTypes:y.enum(["images","videos","audios","files"]).array(),required:y.boolean().optional()}),mc=y.enum(["oneToOne","oneToMany","manyToOne","manyToMany","morphToMany","manyToMorph"]),gc=y.object({type:y.literal("relation"),relation:mc,target:y.string(),mappedBy:y.string().optional(),inversedBy:y.string().optional()}),yc=y.record(y.string(),y.union([cc,lc,fc,pc,gc,hc,dc])),_r=y.object({kind:ac,collectionName:y.string(),info:sc,options:y.object({draftAndPublish:y.boolean().optional(),hidden:y.boolean().optional(),templateName:y.string().optional()}).optional(),attributes:yc,actions:y.record(y.string(),y.any()).optional(),lifecycles:y.record(y.string(),y.any()).optional(),uid:y.string(),apiName:y.string().optional(),associations:y.object({model:y.string(),alias:y.string()}).array().optional(),modelName:y.string().optional(),plugin:y.string().optional(),pluginOptions:y.record(y.string(),y.any()).optional(),isSingle:y.boolean().optional()});_r.pick({info:!0,kind:!0,attributes:!0,options:!0});const oa=y.object({id:y.number(),documentId:y.string(),name:y.string(),key:y.string()}),vc=y.enum(["INTERNAL","EXTERNAL","WRAPPER"]),qr=y.object({id:y.number(),documentId:y.string(),title:y.string(),type:vc,path:y.string().or(y.null()).optional(),slug:y.string().or(y.null()).optional(),externalPath:y.string().or(y.null()).optional(),uiRouterKey:y.string(),menuAttached:y.boolean(),order:y.number().int(),collapsed:y.boolean(),related:y.object({documentId:y.string().optional(),__type:y.string()}).catchall(y.unknown()).nullish(),additionalFields:y.record(y.string(),y.unknown()).or(y.null()).optional(),audience:y.array(oa).or(y.null()).optional(),autoSync:y.boolean().or(y.null()).optional()}),wc=qr.omit({related:!0}).pick({path:!0,type:!0,uiRouterKey:!0,title:!0,externalPath:!0}).extend({related:y.unknown()}),Pt=qr.extend({parent:y.lazy(()=>Pt.or(y.null())).optional(),items:y.lazy(()=>Pt.array()).optional(),master:y.lazy(()=>Qe(!1)).optional()}),Ii=y.array(Pt),Qe=e=>y.object({id:y.number(),documentId:y.string(),name:y.string(),slug:y.string(),locale:y.string(),visible:y.boolean(),items:e?y.array(Pt):Pt.array().optional()}),Ec=Qe(!1).omit({items:!0,id:!0,documentId:!0,slug:!0,locale:!0}).extend({documentId:y.string().optional(),id:y.undefined().optional()}),bc=qr.omit({id:!0,documentId:!0}).extend({id:y.number().optional(),documentId:y.string().optional(),items:y.lazy(()=>aa).or(y.null()).optional(),updated:y.boolean().optional(),removed:y.boolean().optional()}),aa=y.array(bc),xc=Qe(!1).extend({items:aa}).partial().required({id:!0,documentId:!0}),Sc=/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,_c=["beforeCreate","beforeCreateMany","afterCreate","afterCreateMany","beforeUpdate","beforeUpdateMany","afterUpdate","afterUpdateMany","beforeDelete","beforeDeleteMany","afterDelete","afterDeleteMany","beforeCount","afterCount","beforeFindOne","afterFindOne","beforeFindMany","afterFindMany"],Ac="$",sa=["api::","plugin::"],ua=["admin::","plugin::content-releases","plugin::i18n.locale","plugin::navigation","plugin::review-workflows","plugin::users-permissions","plugin::upload.folder"],Tc=["title","subject","name"],Ni={SINGLE:"singleType"},Pi=["title","type","path","externalPath","uiRouterKey","menuAttached","order","collapsed","related","parent","master","audience","additionalFields"],Cc=e=>e.filter(t=>t!=="audience"),ca=e=>{const t=Cc(e);if(t.length!==B.uniqBy(t,"name").length)throw new Error("All names of custom fields must be unique.");if(!B.isNil(B.find(t,n=>typeof n=="object"&&B.includes(Pi,n.name))))throw new Error(`Name of custom field cannot be one of: ${Pi.join(", ")}`)},la=(e,t)=>{if(e==null)throw t??new Error("Non-empty value expected, empty given")},Rc=(e="")=>{const t=a=>a.split("-").map(o=>B.capitalize(o)).join(""),[n,r,i]=Fc(e);return n==="api"?t(i):`${t(r)}${t(i)}`},Fc=(e="")=>e.split(Sc).filter(t=>t&&t.length>0),$c=(e,t)=>n=>[n,async r=>{await oe(t,"common").runLifeCycleHook({contentTypeName:e,hookName:n,event:r})}],fa=(e,t)=>Object.fromEntries(_c.map($c(e,t))),xe=({strapi:e})=>{const t=e.plugin("navigation");return{masterModel:t.contentType("navigation"),itemModel:t.contentType("navigation-item"),relatedModel:t.contentType("navigations-items-related"),audienceModel:t.contentType("audience")}};function oe({strapi:e},t){return e.plugin("navigation").service(t)}const Wt=e=>e==="*"?"*":typeof e=="string"?[e]:e===!1?[]:e===!0?"*":e,Oc=(e="")=>{const t=!!sa.find(r=>e.includes(r)),n=!ua.find(r=>e.includes(r)||e===r);return!!e&&t&&n},Li=(e="")=>B.last(e)==="s"?e.substr(0,e.length-1):e,pa=async({strapi:e,forceDefault:t=!1})=>{const n=e.store({type:"plugin",name:"navigation"}),r=await e.plugin("navigation").config,i=t?{}:{...Ar.default,...await n.get({key:"config"})??Ar.default};let a=B.isEmpty(i)?i:Pe.parse(i);const o=Ic(a,r);return a={additionalFields:o("additionalFields"),contentTypes:o("contentTypes"),contentTypesNameFields:o("contentTypesNameFields"),contentTypesPopulate:o("contentTypesPopulate"),allowedLevels:o("allowedLevels"),gql:o("gql"),pathDefaultFields:o("pathDefaultFields"),cascadeMenuAttached:o("cascadeMenuAttached"),preferCustomContentTypes:o("preferCustomContentTypes"),isCacheEnabled:o("isCacheEnabled")},Nc(a,{strapi:e}),ca(a.additionalFields),await n.set({key:"config",value:a}),a},Ic=(e,t)=>n=>{const r=e?.[n]??t(n);return la(r,new Error(`[Navigation] Config "${n}" is undefined`)),r},Nc=(e,{strapi:t})=>{const n=e.contentTypes.filter(i=>!t.contentTypes[i]);if(n.length===0)return;const r=n.map(Rc);e.contentTypes=e.contentTypes.filter(i=>!n.includes(i)),e.contentTypesNameFields=Object.fromEntries(Object.entries(e.contentTypesNameFields).filter(([i])=>!n.includes(i))),e.gql.navigationItemRelated=e.gql.navigationItemRelated.filter(i=>!r.includes(i))},Ar={default:{additionalFields:[],allowedLevels:2,contentTypes:[],contentTypesNameFields:{},contentTypesPopulate:{},gql:{navigationItemRelated:[]},i18nEnabled:!1,pathDefaultFields:{},pruneObsoleteI18nNavigations:!1,cascadeMenuAttached:!0,preferCustomContentTypes:!1,isCacheEnabled:!1}},Pc=B.once(e=>({find(t,n){const{audienceModel:{uid:r}}=xe(e);return e.strapi.query(r).findMany({where:t,limit:n}).then(oa.array().parse)}})),ln=(e,t)=>({findFirst(n,r,i={}){return e.strapi.documents(t).findFirst({populate:Wt(n),status:r,...i})},findById(n,r,i,a={}){return e.strapi.documents(t).findOne({documentId:n,populate:Wt(r),status:i,...a})},findManyById(n,r,i){return e.strapi.documents(t).findMany({where:{documentId:{$in:n}},populate:Wt(r),status:i})},findMany(n,r,i,a){return e.strapi.documents(t).findMany({where:n,populate:Wt(r),status:i,locale:a})},count(n,r){return e.strapi.documents(t).count({where:n,status:r})}}),Ne=B.once(e=>({async save({item:t,locale:n}){const{itemModel:r}=xe(e),{__type:i,documentId:a}=t?.related??{},o=i?ln(e,i):void 0,s=i&&o?a?await o.findById(a,void 0,void 0,{locale:n}):await o.findFirst(void 0,void 0,{locale:n}):void 0;if(typeof t.documentId=="string"){const{documentId:u,...f}=t;return e.strapi.documents(r.uid).update({documentId:t.documentId,data:{...f,related:s?{...s,__type:i}:void 0},locale:n})}else return e.strapi.documents(r.uid).create({data:{...t,related:s?{...s,__type:i}:void 0},locale:n})},find({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=xe(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(Tr)).then(Ii.parse).then(s=>s.map(fn))},count(t){const{itemModel:n}=xe(e);return e.strapi.query(n.uid).count({where:t})},remove(t){const{itemModel:n}=xe(e);return e.strapi.documents(n.uid).delete({documentId:t.documentId})},removeForIds(t){const{itemModel:n}=xe(e);return t.map(r=>e.strapi.documents(n.uid).delete({documentId:r}))},findForMasterIds(t){const{itemModel:n}=xe(e);return e.strapi.query(n.uid).findMany({where:{$or:t.map(r=>({master:r}))},limit:Number.MAX_SAFE_INTEGER}).then(Ii.parse)}})),Lc=["id","publishedAt","createdAt","updatedAt","locale"],fn=({related:e,items:t=[],...n})=>({...n,items:t.map(fn),related:e?B.omit(e,Lc):void 0}),Tr=({related:e,...t})=>({...t,related:e?.[0]});class bt extends Error{constructor(t,n){super(t),this.additionalInfo=n,this.type="NavigationError"}}class tr extends bt{constructor(){super(...arguments),this.type="FillNavigationError"}}class kc extends bt{constructor(){super(...arguments),this.type="InvalidParamNavigationError"}}const ki=e=>e===!0?!0:Array.isArray(e)?e.includes("items"):!1,Ie=B.once(e=>({find({filters:t,locale:n,limit:r,orderBy:i,populate:a}){const{masterModel:o}=xe(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(Tr)}))).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(fn)}))).then(s=>Qe(ki(a)).array().parse(s))},findOne({locale:t,filters:n,populate:r}){const{masterModel:i}=xe(e);return e.strapi.documents(i.uid).findOne({documentId:n.documentId,locale:t,populate:r}).then(a=>a&&{...a,items:a.items?.map(Tr)}).then(a=>Qe(ki(r)).parse(a)).then(a=>({...a,items:a.items?.map(fn)}))},async save(t){const{masterModel:n}=xe(e),{documentId:r,locale:i,...a}=t;return r?e.strapi.documents(n.uid).update({locale:i,documentId:r,data:B.omit(a,["id","documentId"]),populate:["items"]}).then(Qe(!1).parse):e.strapi.documents(n.uid).create({locale:i,data:{...a,populate:["items"]}}).then(Qe(!1).parse)},remove(t){const{masterModel:n}=xe(e);if(!t.documentId)throw new bt("Document id is required.");return e.strapi.documents(n.uid).delete({documentId:t.documentId})}})),Dc="Navigation",Mc="navigation",jc=async e=>{const t=oe(e,"common"),{defaultLocale:n,restLocale:r=[]}=await t.readLocale(),i=Ie(e),a=await i.find({limit:Number.MAX_SAFE_INTEGER,filters:{},locale:"*"});a.length===0&&a.push(await i.save({name:Dc,visible:!0,locale:n,slug:Mc}));const o=a.filter(({locale:s})=>s===n);for(const s of o)for(const u of r)!a.find(({locale:c,documentId:l})=>l===s.documentId&&u===c)&&await i.save({documentId:s.documentId,name:s.name,locale:u,visible:s.visible,slug:s.slug})},de={render:function(e){return`plugin::navigation.${e}`},navigation:{read:"read",update:"update",settings:"settings"}},Hc=async({strapi:e})=>{const t=[{section:"plugins",displayName:"Read",uid:de.navigation.read,pluginName:"navigation"},{section:"plugins",displayName:"Update",uid:de.navigation.update,pluginName:"navigation"},{section:"plugins",displayName:"Settings",uid:de.navigation.settings,pluginName:"navigation"}];await e.admin.services.permission.actionProvider.registerMany(t)},Bc=({nexus:e})=>e.objectType({name:"ContentTypes",definition(t){t.nonNull.string("uid"),t.nonNull.string("name"),t.nonNull.boolean("isSingle"),t.nonNull.string("collectionName"),t.nonNull.string("contentTypeName"),t.nonNull.string("label"),t.nonNull.string("relatedField"),t.nonNull.string("labelSingular"),t.nonNull.string("endpoint"),t.nonNull.boolean("available"),t.nonNull.boolean("visible")}}),Uc=({nexus:e,strapi:t})=>e.objectType({name:"ContentTypesNameFields",async definition(n){n.nonNull.list.nonNull.string("default");const i=await oe({strapi:t},"common").getPluginStore(),o=Pe.parse(await i.get({key:"config"})).contentTypesNameFields;Object.keys(o||{}).forEach(s=>n.nonNull.list.string(s))}}),Gc=({nexus:e})=>e.inputObjectType({name:"CreateNavigation",definition(t){t.nonNull.string("name"),t.nonNull.list.field("items",{type:"CreateNavigationItem"})}}),qc=({nexus:e})=>e.inputObjectType({name:"CreateNavigationItem",definition(t){t.nonNull.string("title"),t.nonNull.field("type",{type:"NavigationItemType"}),t.string("path"),t.string("externalPath"),t.nonNull.string("uiRouterKey"),t.nonNull.boolean("menuAttached"),t.nonNull.int("order"),t.string("parent"),t.string("master"),t.list.field("items",{type:"CreateNavigationItem"}),t.list.string("audience"),t.field("related",{type:"CreateNavigationRelated"})}}),Kc=({nexus:e})=>e.inputObjectType({name:"CreateNavigationRelated",definition(t){t.nonNull.string("ref"),t.nonNull.string("field"),t.nonNull.string("refId")}}),Wc=({nexus:e})=>e.objectType({name:"Navigation",definition(t){t.nonNull.string("id"),t.nonNull.string("documentId"),t.nonNull.string("name"),t.nonNull.string("slug"),t.nonNull.boolean("visible")}}),zc=({nexus:e})=>e.objectType({name:"NavigationConfig",definition(t){t.int("allowedLevels"),t.nonNull.list.string("additionalFields"),t.field("contentTypesNameFields",{type:"ContentTypesNameFields"}),t.list.field("contentTypes",{type:"ContentTypes"})}}),Yc=({nexus:e})=>e.objectType({name:"NavigationDetails",definition(t){t.nonNull.string("id"),t.nonNull.string("documentId"),t.nonNull.string("name"),t.nonNull.string("slug"),t.nonNull.boolean("visible"),t.nonNull.list.field("items",{type:"NavigationItem"})}}),Qc=({nexus:e,config:t})=>e.objectType({name:"NavigationItem",definition(n){n.nonNull.int("id"),n.nonNull.string("documentId"),n.nonNull.string("title"),n.nonNull.field("type",{type:"NavigationItemType"}),n.string("path"),n.string("externalPath"),n.nonNull.string("uiRouterKey"),n.nonNull.boolean("menuAttached"),n.nonNull.int("order"),n.field("parent",{type:"NavigationItem"}),n.string("master"),n.list.field("items",{type:"NavigationItem"}),n.field("related",{type:"NavigationItemRelated"}),t.additionalFields.find(r=>r==="audience")&&n.list.string("audience"),n.field("additionalFields",{type:"NavigationItemAdditionalFields"}),n.string("created_at"),n.string("updated_at"),n.string("created_by"),n.string("updated_by"),n.string("createdAt"),n.string("updatedAt"),n.string("createdBy"),n.string("updatedBy")}}),Vc=({nexus:e,config:t})=>e.objectType({name:"NavigationItemAdditionalFields",definition(n){t.additionalFields.forEach(r=>{if(r!=="audience"&&r.enabled)switch(r.type){case"media":n.field(r.name,{type:"UploadFile"});break;case"string":n.string(r.name);break;case"boolean":n.boolean(r.name);break;case"select":r.multi?n.list.string(r.name):n.string(r.name);break;default:throw new Error(`Type "${JSON.stringify(r.type)}" is unsupported by custom fields`)}})}}),Xc=({strapi:e,nexus:t,config:n})=>{const r=n.gql?.navigationItemRelated,i="NavigationItemRelated";return r?.length?t.unionType({name:i,definition(a){a.members(...r)},resolveType:a=>e.contentTypes[a.__type]?.globalId}):t.objectType({name:i,definition(a){a.int("id"),a.string("documentId"),a.string("title"),a.string("name")}})},Zc=({nexus:e})=>e.enumType({name:"NavigationItemType",members:["INTERNAL","EXTERNAL","WRAPPER"]}),Jc=({nexus:e})=>e.enumType({name:"NavigationRenderType",members:["FLAT","TREE"]}),el=[Vc,Xc,Qc,Jc,Wc,Yc,Uc,Bc,zc,Kc,qc,Gc,Zc],tl=e=>el.map(t=>t(e)),nl="I18NLocaleCode",rl=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:a}=t;return{args:{navigationIdOrSlug:n(i()),type:"NavigationRenderType",menuOnly:a(),path:i(),locale:t.arg({type:nl})},type:n(r("NavigationItem")),resolve(u,{navigationIdOrSlug:f,type:c,menuOnly:l,path:p,locale:d}){const h=Ur.z.string().parse(f);return oe({strapi:e},"client").render({idOrSlug:h,type:c,rootPath:p,locale:d,menuOnly:l,wrapRelated:!0})}}},il=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:a}=t;return{type:n(r("NavigationItem")),args:{documentId:n(i()),childUiKey:n(i()),type:"NavigationRenderType",menuOnly:a()},resolve(o,s){const{documentId:u,childUIKey:f,type:c,menuOnly:l}=s,p=Ur.z.string().parse(u);return oe({strapi:e},"client").renderChildren({idOrSlug:p,childUIKey:f,type:c,menuOnly:l,wrapRelated:!0})}}},ol=e=>{const t={renderNavigationChild:il,renderNavigation:rl};return e.nexus.extendType({type:"Query",definition(n){for(const[r,i]of Object.entries(t)){const a=i(e);n.field(r,a)}}})},al=()=>({"Query.renderNavigationChild":{auth:!1},"Query.renderNavigation":{auth:!1}}),sl=async({strapi:e})=>{const t=e.plugin("graphql").service("extension");t.shadowCRUD("plugin::navigation.audience").disable(),t.shadowCRUD("plugin::navigation.navigation").disable(),t.shadowCRUD("plugin::navigation.navigation-item").disable(),t.shadowCRUD("plugin::navigation.navigations-items-related").disable();const r=await oe({strapi:e},"common").getPluginStore(),i=Pe.parse(await r.get({key:"config"}));t.use(({strapi:a,nexus:o})=>{const s=tl({strapi:a,nexus:o,config:i}),u=ol({strapi:a,nexus:o}),f=al();return{types:[s,u],resolversConfig:f}})},ul=async({strapi:e})=>{!!e.plugin("graphql")&&await sl({strapi:e})},cl=async e=>{await pa(e),await jc(e),await Hc(e),await ul(e)},ll=({strapi:e})=>{},fl=({strapi:e})=>{},pl={collectionName:"audience",info:{singularName:"audience",pluralName:"audiences",displayName:"Audience",name:"audience"},options:{increments:!0,comment:"Audience"},attributes:{name:{type:"string",required:!0},key:{type:"uid",targetField:"name"}}},dl={schema:pl},hl=fa("navigation",{strapi}),ml={collectionName:"navigations",info:{singularName:"navigation",pluralName:"navigations",displayName:"Navigation",name:"navigation"},options:{comment:""},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1},i18n:{localized:!0}},attributes:{name:{type:"text",configurable:!1,required:!0},slug:{type:"uid",target:"name",configurable:!1,required:!0},visible:{type:"boolean",default:!1,configurable:!1},items:{type:"relation",relation:"oneToMany",target:"plugin::navigation.navigation-item",configurable:!1,mappedBy:"master"}}},gl={schema:ml,lifecycles:hl},yl=fa("navigation-item",{strapi}),vl={collectionName:"navigations_items",info:{singularName:"navigation-item",pluralName:"navigation-items",displayName:"Navigation Item",name:"navigation-item"},options:{increments:!0,timestamps:!0,comment:"Navigation Item"},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1},i18n:{localized:!1}},attributes:{title:{type:"text",configurable:!1,required:!0,pluginOptions:{i18n:{localized:!1}}},type:{type:"enumeration",enum:["INTERNAL","EXTERNAL","WRAPPER"],default:"INTERNAL",configurable:!1},path:{type:"text",targetField:"title",configurable:!1},externalPath:{type:"text",configurable:!1},uiRouterKey:{type:"string",configurable:!1},menuAttached:{type:"boolean",default:!1,configurable:!1},order:{type:"integer",default:0,configurable:!1},collapsed:{type:"boolean",default:!1,configurable:!1},autoSync:{type:"boolean",default:!0,configurable:!1},related:{type:"relation",relation:"morphToMany",required:!0,configurable:!1},parent:{type:"relation",relation:"oneToOne",target:"plugin::navigation.navigation-item",configurable:!1,default:null},master:{type:"relation",relation:"manyToOne",target:"plugin::navigation.navigation",configurable:!1,inversedBy:"items"},audience:{type:"relation",relation:"oneToMany",target:"plugin::navigation.audience"},additionalFields:{type:"json",require:!1,default:{}}}},wl={schema:vl,lifecycles:yl},El={audience:dl,navigation:gl,"navigation-item":wl},da=y.enum(["true","false"]),zt=y.string(),bl=y.object({locale:y.string().optional(),orderBy:y.string().optional(),orderDirection:y.enum(["DESC","ASC"]).optional()}),ha=y.enum(["FLAT","TREE","RFR"]),ma=y.union([y.boolean(),y.string(),y.string().array(),y.undefined()]),xl=y.object({type:ha.optional(),menu:da.optional(),path:y.string().optional(),locale:y.string().optional(),populate:ma.optional()}),Sl=y.object({type:ha.optional(),menu:da.optional(),locale:y.string().optional()}),_l=y.object({source:y.string().min(1),target:y.string().min(1),documentId:y.string().min(1)});function Al(e){return{getAdminService(){return oe(e,"admin")},getCommonService(){return oe(e,"common")},async get(){return await this.getAdminService().get({})},post(t){const{auditLog:n}=t;return this.getAdminService().post({payload:Ec.parse(t.request.body),auditLog:n})},put(t){const{params:{documentId:n},auditLog:r}=t,i=y.record(y.string(),y.unknown()).parse(t.request.body);return this.getAdminService().put({auditLog:r,payload:xc.parse({...i,documentId:n})})},async delete(t){const{auditLog:n,params:{documentId:r}}=t;return await this.getAdminService().delete({documentId:zt.parse(r),auditLog:n}),{}},config(){return this.getAdminService().config({viaSettingsPage:!1})},async updateConfig(t){return await this.getAdminService().updateConfig({config:Pe.parse(t.request.body)}),{}},async restoreConfig(){return await this.getAdminService().restoreConfig(),{}},settingsConfig(){return this.getAdminService().config({viaSettingsPage:!0})},async settingsRestart(){return await this.getAdminService().restart(),{}},getById(t){const{params:{documentId:n}}=t;return this.getAdminService().getById({documentId:zt.parse(n)})},getContentTypeItems(t){const{params:{model:n},query:r={}}=t;return this.getAdminService().getContentTypeItems({query:y.record(y.string(),y.unknown()).parse(r),uid:y.string().parse(n)})},async fillFromOtherLocale(t){const{params:n,auditLog:r}=t,{source:i,target:a,documentId:o}=_l.parse(n);return await this.getAdminService().fillFromOtherLocale({source:i,target:a,documentId:o,auditLog:r})},readNavigationItemFromLocale(t){const{params:{source:n,target:r},query:{path:i}}=t;return this.getAdminService().readNavigationItemFromLocale({path:y.string().parse(i),source:zt.parse(n),target:zt.parse(r)})},getSlug(t){const{query:{q:n}}=t;return this.getCommonService().getSlug({query:y.string().parse(n)}).then(r=>({slug:r}))},settingsLocale(){return this.getCommonService().readLocale()}}}const Tl=e=>{if(!(!e||e===!0||e==="*")&&typeof e!="object")return Array.isArray(e),e};function Cl(e){return{getService(){return oe(e,"client")},async readAll(t){try{const{query:n={}}=t,{locale:r,orderBy:i,orderDirection:a}=bl.parse(n);return await this.getService().readAll({locale:r,orderBy:i,orderDirection:a})}catch(n){if(n instanceof Error)return t.badRequest(n.message);throw n}},async render(t){const{params:n,query:r={}}=t,{type:i,menu:a,path:o,locale:s,populate:u}=xl.parse(r),f=y.string().parse(n.idOrSlug);return await this.getService().render({idOrSlug:f,type:i,menuOnly:a==="true",rootPath:o,locale:s,populate:Tl(ma.parse(u==="true"?!0:u==="false"?!1:Array.isArray(u)?u.map(c=>c==="true"?!0:c==="false"?!1:u):u))})},async renderChild(t){const{params:n,query:r={}}=t,{type:i,menu:a,locale:o}=Sl.parse(r),s=y.string().parse(n.documentId),u=y.string().parse(n.childUIKey);return await this.getService().renderChildren({idOrSlug:s,childUIKey:u,type:i,menuOnly:a==="true",locale:o})}}}const Rl={admin:Al,client:Cl},Fl={},$l={},Ol={type:"admin",routes:[{method:"GET",path:"/",handler:"admin.get",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("read")]}}]}},{method:"POST",path:"/",handler:"admin.post",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("update")]}}]}},{method:"GET",path:"/config",handler:"admin.config",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("read")]}}]}},{method:"PUT",path:"/config",handler:"admin.updateConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("settings")]}}]}},{method:"DELETE",path:"/config",handler:"admin.restoreConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("settings")]}}]}},{method:"GET",path:"/slug",handler:"admin.getSlug",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/:documentId",handler:"admin.getById",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("read")]}}]}},{method:"PUT",path:"/:documentId",handler:"admin.put",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("update")]}}]}},{method:"DELETE",path:"/:documentId",handler:"admin.delete",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("update")]}}]}},{method:"GET",path:"/content-type-items/:model",handler:"admin.getContentTypeItems",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/settings/locale",handler:"admin.settingsLocale",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/settings/config",handler:"admin.settingsConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("settings")]}}]}},{method:"GET",path:"/settings/restart",handler:"admin.settingsRestart",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("settings")]}}]}},{method:"PUT",path:"/i18n/copy/:documentId/:source/:target",handler:"admin.fillFromOtherLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("update")]}}]}},{method:"GET",path:"/i18n/item/read/:source/:target",handler:"admin.readNavigationItemFromLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[de.render("read")]}}]}}]},Il={type:"content-api",routes:[{method:"GET",path:"/render/:idOrSlug",handler:"client.render",config:{policies:[]}},{method:"GET",path:"/render/:idOrSlug/:childUIKey",handler:"client.renderChild",config:{policies:[]}},{method:"GET",path:"/",handler:"client.readAll",config:{policies:[]}}]},Nl={admin:Ol,"content-api":Il};function Pl(e,t){return he.default.has(process.env,e)?process.env[e]:t}function at(e){return process.env[e]??""}const Ll={int(e,t){return he.default.has(process.env,e)?parseInt(at(e),10):t},float(e,t){return he.default.has(process.env,e)?parseFloat(at(e)):t},bool(e,t){return he.default.has(process.env,e)?at(e)==="true":t},json(e,t){if(!he.default.has(process.env,e))return t;try{return JSON.parse(at(e))}catch(n){throw n instanceof Error?new Error(`Invalid json environment variable ${e}: ${n.message}`):n}},array(e,t){if(!he.default.has(process.env,e))return t;let n=at(e);return n.startsWith("[")&&n.endsWith("]")&&(n=n.substring(1,n.length-1)),n.split(",").map(r=>he.default.trim(he.default.trim(r," "),'"'))},date(e,t){return he.default.has(process.env,e)?new Date(at(e)):t},oneOf(e,t,n){if(!t)throw new Error("env.oneOf requires expectedValues");if(n&&!t.includes(n))throw new Error("env.oneOf requires defaultValue to be included in expectedValues");const r=kl(e,n);return t.includes(r)?r:n}},kl=Object.assign(Pl,Ll),Dl="id",Ml="documentId",jl={ID_ATTRIBUTE:Dl,DOC_ID_ATTRIBUTE:Ml},Hl=e=>R.union(strapi?.config?.get("api.responses.privateAttributes",[])??[],R.getOr([],"options.privateAttributes",e)),Bl=(e,t)=>e?.attributes?.[t]?.private===!0?!0:Hl(e).includes(t),ga=e=>e&&!["media","component","relation","dynamiczone"].includes(e.type),Ul=e=>e?.type==="media",ya=e=>e?.type==="relation",Gl=e=>!!e&&e.type==="dynamiczone",va=e=>!!e&&ya(e)&&e.relation?.startsWith?.("morphTo"),dt=async(e,t,n)=>{const{path:r={raw:null,attribute:null},schema:i,getModel:a}=t;let o=t.parent;const s=async(m,g,b)=>{const T={schema:a(b.__type),path:g,getModel:a,parent:o};return dt(m,T,b)},u=m=>async(g,b,S)=>dt(g,{schema:m,path:b,getModel:a,parent:o},S),f=async(m,g,b)=>{const A={schema:a("plugin::upload.file"),path:g,getModel:a,parent:o};return dt(m,A,b)},c=async(m,g,b,S)=>dt(m,{schema:b,path:g,getModel:a,parent:o},S),l=async(m,g,b)=>{const T={schema:a(b.__component),path:g,getModel:a,parent:o};return dt(m,T,b)};if(!R.isObject(n)||R.isNil(i))return n;const p=R.clone(n),d=ql({data:p}),h=Object.keys(p);for(let m=0;m<h.length;m+=1){const g=h[m],b=i.attributes[g],S={...r};S.raw=R.isNil(r.raw)?g:`${r.raw}.${g}`,R.isNil(b)||(S.attribute=R.isNil(r.attribute)?g:`${r.attribute}.${g}`);const T={data:p,schema:i,key:g,value:p[g],attribute:b,path:S,getModel:a,parent:o};await e(T,d);const A=p[g];if(!(R.isNil(A)||R.isNil(b))){if(o={schema:i,key:g,attribute:b,path:S},ya(b)){const F=b.relation.toLowerCase().startsWith("morph")?s:u(a(b.target));if(R.isArray(A)){const M=new Array(A.length);for(let x=0;x<A.length;x+=1)M[x]=await F(e,S,A[x]);p[g]=M}else p[g]=await F(e,S,A);continue}if(Ul(b)){if(R.isArray(A)){const C=new Array(A.length);for(let F=0;F<A.length;F+=1)C[F]=await f(e,S,A[F]);p[g]=C}else p[g]=await f(e,S,A);continue}if(b.type==="component"){const C=a(b.component);if(R.isArray(A)){const F=new Array(A.length);for(let M=0;M<A.length;M+=1)F[M]=await c(e,S,C,A[M]);p[g]=F}else p[g]=await c(e,S,C,A);continue}if(b.type==="dynamiczone"&&R.isArray(A)){const C=new Array(A.length);for(let F=0;F<A.length;F+=1)C[F]=await l(e,S,A[F]);p[g]=C;continue}}}return p},ql=({data:e})=>({remove(t){delete e[t]},set(t,n){e[t]=n}});var Kl=R.curry(dt),ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wl={exports:{}};(function(e,t){(function(n,r){e.exports=r(un.default,Fi.default)})(ve,function(n,r){return function(i){function a(s){if(o[s])return o[s].exports;var u=o[s]={exports:{},id:s,loaded:!1};return i[s].call(u.exports,u,u.exports,a),u.loaded=!0,u.exports}var o={};return a.m=i,a.c=o,a.p="",a(0)}([function(i,a,o){i.exports=o(34)},function(i,a,o){var s=o(29)("wks"),u=o(33),f=o(2).Symbol,c=typeof f=="function",l=i.exports=function(p){return s[p]||(s[p]=c&&f[p]||(c?f:u)("Symbol."+p))};l.store=s},function(i,a){var o=i.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=o)},function(i,a,o){var s=o(9);i.exports=function(u){if(!s(u))throw TypeError(u+" is not an object!");return u}},function(i,a,o){i.exports=!o(24)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(12),u=o(17);i.exports=o(4)?function(f,c,l){return s.f(f,c,u(1,l))}:function(f,c,l){return f[c]=l,f}},function(i,a){var o=i.exports={version:"2.4.0"};typeof __e=="number"&&(__e=o)},function(i,a,o){var s=o(14);i.exports=function(u,f,c){if(s(u),f===void 0)return u;switch(c){case 1:return function(l){return u.call(f,l)};case 2:return function(l,p){return u.call(f,l,p)};case 3:return function(l,p,d){return u.call(f,l,p,d)}}return function(){return u.apply(f,arguments)}}},function(i,a){var o={}.hasOwnProperty;i.exports=function(s,u){return o.call(s,u)}},function(i,a){i.exports=function(o){return typeof o=="object"?o!==null:typeof o=="function"}},function(i,a){i.exports={}},function(i,a){var o={}.toString;i.exports=function(s){return o.call(s).slice(8,-1)}},function(i,a,o){var s=o(3),u=o(26),f=o(32),c=Object.defineProperty;a.f=o(4)?Object.defineProperty:function(l,p,d){if(s(l),p=f(p,!0),s(d),u)try{return c(l,p,d)}catch{}if("get"in d||"set"in d)throw TypeError("Accessors not supported!");return"value"in d&&(l[p]=d.value),l}},function(i,a,o){var s=o(42),u=o(15);i.exports=function(f){return s(u(f))}},function(i,a){i.exports=function(o){if(typeof o!="function")throw TypeError(o+" is not a function!");return o}},function(i,a){i.exports=function(o){if(o==null)throw TypeError("Can't call method on "+o);return o}},function(i,a,o){var s=o(9),u=o(2).document,f=s(u)&&s(u.createElement);i.exports=function(c){return f?u.createElement(c):{}}},function(i,a){i.exports=function(o,s){return{enumerable:!(1&o),configurable:!(2&o),writable:!(4&o),value:s}}},function(i,a,o){var s=o(12).f,u=o(8),f=o(1)("toStringTag");i.exports=function(c,l,p){c&&!u(c=p?c:c.prototype,f)&&s(c,f,{configurable:!0,value:l})}},function(i,a,o){var s=o(29)("keys"),u=o(33);i.exports=function(f){return s[f]||(s[f]=u(f))}},function(i,a){var o=Math.ceil,s=Math.floor;i.exports=function(u){return isNaN(u=+u)?0:(u>0?s:o)(u)}},function(i,a,o){var s=o(11),u=o(1)("toStringTag"),f=s(function(){return arguments}())=="Arguments",c=function(l,p){try{return l[p]}catch{}};i.exports=function(l){var p,d,h;return l===void 0?"Undefined":l===null?"Null":typeof(d=c(p=Object(l),u))=="string"?d:f?s(p):(h=s(p))=="Object"&&typeof p.callee=="function"?"Arguments":h}},function(i,a){i.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(i,a,o){var s=o(2),u=o(6),f=o(7),c=o(5),l="prototype",p=function(d,h,m){var g,b,S,T=d&p.F,A=d&p.G,C=d&p.S,F=d&p.P,M=d&p.B,x=d&p.W,_=A?u:u[h]||(u[h]={}),I=_[l],w=A?s:C?s[h]:(s[h]||{})[l];A&&(m=h);for(g in m)b=!T&&w&&w[g]!==void 0,b&&g in _||(S=b?w[g]:m[g],_[g]=A&&typeof w[g]!="function"?m[g]:M&&b?f(S,s):x&&w[g]==S?function(L){var H=function(K,E,v){if(this instanceof L){switch(arguments.length){case 0:return new L;case 1:return new L(K);case 2:return new L(K,E)}return new L(K,E,v)}return L.apply(this,arguments)};return H[l]=L[l],H}(S):F&&typeof S=="function"?f(Function.call,S):S,F&&((_.virtual||(_.virtual={}))[g]=S,d&p.R&&I&&!I[g]&&c(I,g,S)))};p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128,i.exports=p},function(i,a){i.exports=function(o){try{return!!o()}catch{return!0}}},function(i,a,o){i.exports=o(2).document&&document.documentElement},function(i,a,o){i.exports=!o(4)&&!o(24)(function(){return Object.defineProperty(o(16)("div"),"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(28),u=o(23),f=o(57),c=o(5),l=o(8),p=o(10),d=o(45),h=o(18),m=o(52),g=o(1)("iterator"),b=!([].keys&&"next"in[].keys()),S="@@iterator",T="keys",A="values",C=function(){return this};i.exports=function(F,M,x,_,I,w,L){d(x,M,_);var H,K,E,v=function(D){if(!b&&D in W)return W[D];switch(D){case T:return function(){return new x(this,D)};case A:return function(){return new x(this,D)}}return function(){return new x(this,D)}},j=M+" Iterator",k=I==A,U=!1,W=F.prototype,Q=W[g]||W[S]||I&&W[I],ee=Q||v(I),Ce=I?k?v("entries"):ee:void 0,O=M=="Array"&&W.entries||Q;if(O&&(E=m(O.call(new F)),E!==Object.prototype&&(h(E,j,!0),s||l(E,g)||c(E,g,C))),k&&Q&&Q.name!==A&&(U=!0,ee=function(){return Q.call(this)}),s&&!L||!b&&!U&&W[g]||c(W,g,ee),p[M]=ee,p[j]=C,I)if(H={values:k?ee:v(A),keys:w?ee:v(T),entries:Ce},L)for(K in H)K in W||f(W,K,H[K]);else u(u.P+u.F*(b||U),M,H);return H}},function(i,a){i.exports=!0},function(i,a,o){var s=o(2),u="__core-js_shared__",f=s[u]||(s[u]={});i.exports=function(c){return f[c]||(f[c]={})}},function(i,a,o){var s,u,f,c=o(7),l=o(41),p=o(25),d=o(16),h=o(2),m=h.process,g=h.setImmediate,b=h.clearImmediate,S=h.MessageChannel,T=0,A={},C="onreadystatechange",F=function(){var x=+this;if(A.hasOwnProperty(x)){var _=A[x];delete A[x],_()}},M=function(x){F.call(x.data)};g&&b||(g=function(x){for(var _=[],I=1;arguments.length>I;)_.push(arguments[I++]);return A[++T]=function(){l(typeof x=="function"?x:Function(x),_)},s(T),T},b=function(x){delete A[x]},o(11)(m)=="process"?s=function(x){m.nextTick(c(F,x,1))}:S?(u=new S,f=u.port2,u.port1.onmessage=M,s=c(f.postMessage,f,1)):h.addEventListener&&typeof postMessage=="function"&&!h.importScripts?(s=function(x){h.postMessage(x+"","*")},h.addEventListener("message",M,!1)):s=C in d("script")?function(x){p.appendChild(d("script"))[C]=function(){p.removeChild(this),F.call(x)}}:function(x){setTimeout(c(F,x,1),0)}),i.exports={set:g,clear:b}},function(i,a,o){var s=o(20),u=Math.min;i.exports=function(f){return f>0?u(s(f),9007199254740991):0}},function(i,a,o){var s=o(9);i.exports=function(u,f){if(!s(u))return u;var c,l;if(f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u))||typeof(c=u.valueOf)=="function"&&!s(l=c.call(u))||!f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u)))return l;throw TypeError("Can't convert object to primitive value")}},function(i,a){var o=0,s=Math.random();i.exports=function(u){return"Symbol(".concat(u===void 0?"":u,")_",(++o+s).toString(36))}},function(i,a,o){function s(C){return C&&C.__esModule?C:{default:C}}function u(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function f(C){return(0,g.createHash)("sha256").update(C).digest("hex")}function c(C){switch(S){case"darwin":return C.split("IOPlatformUUID")[1].split(`
|
|
2
2
|
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return C.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return C.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return C.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function l(C){var F=c((0,m.execSync)(A[S]).toString());return C?F:f(F)}function p(C){return new h.default(function(F,M){return(0,m.exec)(A[S],{},function(x,_,I){if(x)return M(new Error("Error while obtaining machine id: "+x.stack));var w=c(_.toString());return F(C?w:f(w))})})}Object.defineProperty(a,"__esModule",{value:!0});var d=o(35),h=s(d);a.machineIdSync=l,a.machineId=p;var m=o(70),g=o(71),b=process,S=b.platform,T={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},A={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:T[u()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(i,a,o){i.exports={default:o(36),__esModule:!0}},function(i,a,o){o(66),o(68),o(69),o(67),i.exports=o(6).Promise},function(i,a){i.exports=function(){}},function(i,a){i.exports=function(o,s,u,f){if(!(o instanceof s)||f!==void 0&&f in o)throw TypeError(u+": incorrect invocation!");return o}},function(i,a,o){var s=o(13),u=o(31),f=o(62);i.exports=function(c){return function(l,p,d){var h,m=s(l),g=u(m.length),b=f(d,g);if(c&&p!=p){for(;g>b;)if(h=m[b++],h!=h)return!0}else for(;g>b;b++)if((c||b in m)&&m[b]===p)return c||b||0;return!c&&-1}}},function(i,m,o){var s=o(7),u=o(44),f=o(43),c=o(3),l=o(31),p=o(64),d={},h={},m=i.exports=function(g,b,S,T,A){var C,F,M,x,_=A?function(){return g}:p(g),I=s(S,T,b?2:1),w=0;if(typeof _!="function")throw TypeError(g+" is not iterable!");if(f(_)){for(C=l(g.length);C>w;w++)if(x=b?I(c(F=g[w])[0],F[1]):I(g[w]),x===d||x===h)return x}else for(M=_.call(g);!(F=M.next()).done;)if(x=u(M,I,F.value,b),x===d||x===h)return x};m.BREAK=d,m.RETURN=h},function(i,a){i.exports=function(o,s,u){var f=u===void 0;switch(s.length){case 0:return f?o():o.call(u);case 1:return f?o(s[0]):o.call(u,s[0]);case 2:return f?o(s[0],s[1]):o.call(u,s[0],s[1]);case 3:return f?o(s[0],s[1],s[2]):o.call(u,s[0],s[1],s[2]);case 4:return f?o(s[0],s[1],s[2],s[3]):o.call(u,s[0],s[1],s[2],s[3])}return o.apply(u,s)}},function(i,a,o){var s=o(11);i.exports=Object("z").propertyIsEnumerable(0)?Object:function(u){return s(u)=="String"?u.split(""):Object(u)}},function(i,a,o){var s=o(10),u=o(1)("iterator"),f=Array.prototype;i.exports=function(c){return c!==void 0&&(s.Array===c||f[u]===c)}},function(i,a,o){var s=o(3);i.exports=function(u,f,c,l){try{return l?f(s(c)[0],c[1]):f(c)}catch(d){var p=u.return;throw p!==void 0&&s(p.call(u)),d}}},function(i,a,o){var s=o(49),u=o(17),f=o(18),c={};o(5)(c,o(1)("iterator"),function(){return this}),i.exports=function(l,p,d){l.prototype=s(c,{next:u(1,d)}),f(l,p+" Iterator")}},function(i,a,o){var s=o(1)("iterator"),u=!1;try{var f=[7][s]();f.return=function(){u=!0},Array.from(f,function(){throw 2})}catch{}i.exports=function(c,l){if(!l&&!u)return!1;var p=!1;try{var d=[7],h=d[s]();h.next=function(){return{done:p=!0}},d[s]=function(){return h},c(d)}catch{}return p}},function(i,a){i.exports=function(o,s){return{value:s,done:!!o}}},function(i,a,o){var s=o(2),u=o(30).set,f=s.MutationObserver||s.WebKitMutationObserver,c=s.process,l=s.Promise,p=o(11)(c)=="process";i.exports=function(){var d,h,m,g=function(){var A,C;for(p&&(A=c.domain)&&A.exit();d;){C=d.fn,d=d.next;try{C()}catch(F){throw d?m():h=void 0,F}}h=void 0,A&&A.enter()};if(p)m=function(){c.nextTick(g)};else if(f){var b=!0,S=document.createTextNode("");new f(g).observe(S,{characterData:!0}),m=function(){S.data=b=!b}}else if(l&&l.resolve){var T=l.resolve();m=function(){T.then(g)}}else m=function(){u.call(s,g)};return function(A){var C={fn:A,next:void 0};h&&(h.next=C),d||(d=C,m()),h=C}}},function(i,a,o){var s=o(3),u=o(50),f=o(22),c=o(19)("IE_PROTO"),l=function(){},p="prototype",d=function(){var h,m=o(16)("iframe"),g=f.length,b=">";for(m.style.display="none",o(25).appendChild(m),m.src="javascript:",h=m.contentWindow.document,h.open(),h.write("<script>document.F=Object<\/script"+b),h.close(),d=h.F;g--;)delete d[p][f[g]];return d()};i.exports=Object.create||function(h,m){var g;return h!==null?(l[p]=s(h),g=new l,l[p]=null,g[c]=h):g=d(),m===void 0?g:u(g,m)}},function(i,a,o){var s=o(12),u=o(3),f=o(54);i.exports=o(4)?Object.defineProperties:function(c,l){u(c);for(var p,d=f(l),h=d.length,m=0;h>m;)s.f(c,p=d[m++],l[p]);return c}},function(i,a,o){var s=o(55),u=o(17),f=o(13),c=o(32),l=o(8),p=o(26),d=Object.getOwnPropertyDescriptor;a.f=o(4)?d:function(h,m){if(h=f(h),m=c(m,!0),p)try{return d(h,m)}catch{}if(l(h,m))return u(!s.f.call(h,m),h[m])}},function(i,a,o){var s=o(8),u=o(63),f=o(19)("IE_PROTO"),c=Object.prototype;i.exports=Object.getPrototypeOf||function(l){return l=u(l),s(l,f)?l[f]:typeof l.constructor=="function"&&l instanceof l.constructor?l.constructor.prototype:l instanceof Object?c:null}},function(i,a,o){var s=o(8),u=o(13),f=o(39)(!1),c=o(19)("IE_PROTO");i.exports=function(l,p){var d,h=u(l),m=0,g=[];for(d in h)d!=c&&s(h,d)&&g.push(d);for(;p.length>m;)s(h,d=p[m++])&&(~f(g,d)||g.push(d));return g}},function(i,a,o){var s=o(53),u=o(22);i.exports=Object.keys||function(f){return s(f,u)}},function(i,a){a.f={}.propertyIsEnumerable},function(i,a,o){var s=o(5);i.exports=function(u,f,c){for(var l in f)c&&u[l]?u[l]=f[l]:s(u,l,f[l]);return u}},function(i,a,o){i.exports=o(5)},function(i,a,o){var s=o(9),u=o(3),f=function(c,l){if(u(c),!s(l)&&l!==null)throw TypeError(l+": can't set as prototype!")};i.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(c,l,p){try{p=o(7)(Function.call,o(51).f(Object.prototype,"__proto__").set,2),p(c,[]),l=!(c instanceof Array)}catch{l=!0}return function(d,h){return f(d,h),l?d.__proto__=h:p(d,h),d}}({},!1):void 0),check:f}},function(i,a,o){var s=o(2),u=o(6),f=o(12),c=o(4),l=o(1)("species");i.exports=function(p){var d=typeof u[p]=="function"?u[p]:s[p];c&&d&&!d[l]&&f.f(d,l,{configurable:!0,get:function(){return this}})}},function(i,a,o){var s=o(3),u=o(14),f=o(1)("species");i.exports=function(c,l){var p,d=s(c).constructor;return d===void 0||(p=s(d)[f])==null?l:u(p)}},function(i,a,o){var s=o(20),u=o(15);i.exports=function(f){return function(c,l){var p,d,h=String(u(c)),m=s(l),g=h.length;return m<0||m>=g?f?"":void 0:(p=h.charCodeAt(m),p<55296||p>56319||m+1===g||(d=h.charCodeAt(m+1))<56320||d>57343?f?h.charAt(m):p:f?h.slice(m,m+2):(p-55296<<10)+(d-56320)+65536)}}},function(i,a,o){var s=o(20),u=Math.max,f=Math.min;i.exports=function(c,l){return c=s(c),c<0?u(c+l,0):f(c,l)}},function(i,a,o){var s=o(15);i.exports=function(u){return Object(s(u))}},function(i,a,o){var s=o(21),u=o(1)("iterator"),f=o(10);i.exports=o(6).getIteratorMethod=function(c){if(c!=null)return c[u]||c["@@iterator"]||f[s(c)]}},function(i,a,o){var s=o(37),u=o(47),f=o(10),c=o(13);i.exports=o(27)(Array,"Array",function(l,p){this._t=c(l),this._i=0,this._k=p},function(){var l=this._t,p=this._k,d=this._i++;return!l||d>=l.length?(this._t=void 0,u(1)):p=="keys"?u(0,d):p=="values"?u(0,l[d]):u(0,[d,l[d]])},"values"),f.Arguments=f.Array,s("keys"),s("values"),s("entries")},function(i,a){},function(i,a,o){var s,u,f,c=o(28),l=o(2),p=o(7),d=o(21),h=o(23),m=o(9),g=(o(3),o(14)),b=o(38),S=o(40),T=(o(58).set,o(60)),A=o(30).set,C=o(48)(),F="Promise",M=l.TypeError,_=l.process,x=l[F],_=l.process,I=d(_)=="process",w=function(){},L=!!function(){try{var O=x.resolve(1),D=(O.constructor={})[o(1)("species")]=function(N){N(w,w)};return(I||typeof PromiseRejectionEvent=="function")&&O.then(w)instanceof D}catch{}}(),H=function(O,D){return O===D||O===x&&D===f},K=function(O){var D;return!(!m(O)||typeof(D=O.then)!="function")&&D},E=function(O){return H(x,O)?new v(O):new u(O)},v=u=function(O){var D,N;this.promise=new O(function(Y,ue){if(D!==void 0||N!==void 0)throw M("Bad Promise constructor");D=Y,N=ue}),this.resolve=g(D),this.reject=g(N)},j=function(O){try{O()}catch(D){return{error:D}}},k=function(O,D){if(!O._n){O._n=!0;var N=O._c;C(function(){for(var Y=O._v,ue=O._s==1,P=0,z=function($){var q,V,re=ue?$.ok:$.fail,X=$.resolve,$e=$.reject,Me=$.domain;try{re?(ue||(O._h==2&&Q(O),O._h=1),re===!0?q=Y:(Me&&Me.enter(),q=re(Y),Me&&Me.exit()),q===$.promise?$e(M("Promise-chain cycle")):(V=K(q))?V.call(q,X,$e):X(q)):$e(Y)}catch(Fu){$e(Fu)}};N.length>P;)z(N[P++]);O._c=[],O._n=!1,D&&!O._h&&U(O)})}},U=function(O){A.call(l,function(){var D,N,Y,ue=O._v;if(W(O)&&(D=j(function(){I?_.emit("unhandledRejection",ue,O):(N=l.onunhandledrejection)?N({promise:O,reason:ue}):(Y=l.console)&&Y.error&&Y.error("Unhandled promise rejection",ue)}),O._h=I||W(O)?2:1),O._a=void 0,D)throw D.error})},W=function(O){if(O._h==1)return!1;for(var D,N=O._a||O._c,Y=0;N.length>Y;)if(D=N[Y++],D.fail||!W(D.promise))return!1;return!0},Q=function(O){A.call(l,function(){var D;I?_.emit("rejectionHandled",O):(D=l.onrejectionhandled)&&D({promise:O,reason:O._v})})},ee=function(O){var D=this;D._d||(D._d=!0,D=D._w||D,D._v=O,D._s=2,D._a||(D._a=D._c.slice()),k(D,!0))},Ce=function(O){var D,N=this;if(!N._d){N._d=!0,N=N._w||N;try{if(N===O)throw M("Promise can't be resolved itself");(D=K(O))?C(function(){var Y={_w:N,_d:!1};try{D.call(O,p(Ce,Y,1),p(ee,Y,1))}catch(ue){ee.call(Y,ue)}}):(N._v=O,N._s=1,k(N,!1))}catch(Y){ee.call({_w:N,_d:!1},Y)}}};L||(x=function(O){b(this,x,F,"_h"),g(O),s.call(this);try{O(p(Ce,this,1),p(ee,this,1))}catch(D){ee.call(this,D)}},s=function(O){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},s.prototype=o(56)(x.prototype,{then:function(O,D){var N=E(T(this,x));return N.ok=typeof O!="function"||O,N.fail=typeof D=="function"&&D,N.domain=I?_.domain:void 0,this._c.push(N),this._a&&this._a.push(N),this._s&&k(this,!1),N.promise},catch:function(O){return this.then(void 0,O)}}),v=function(){var O=new s;this.promise=O,this.resolve=p(Ce,O,1),this.reject=p(ee,O,1)}),h(h.G+h.W+h.F*!L,{Promise:x}),o(18)(x,F),o(59)(F),f=o(6)[F],h(h.S+h.F*!L,F,{reject:function(O){var D=E(this),N=D.reject;return N(O),D.promise}}),h(h.S+h.F*(c||!L),F,{resolve:function(O){if(O instanceof x&&H(O.constructor,this))return O;var D=E(this),N=D.resolve;return N(O),D.promise}}),h(h.S+h.F*!(L&&o(46)(function(O){x.all(O).catch(w)})),F,{all:function(O){var D=this,N=E(D),Y=N.resolve,ue=N.reject,P=j(function(){var z=[],$=0,q=1;S(O,!1,function(V){var re=$++,X=!1;z.push(void 0),q++,D.resolve(V).then(function($e){X||(X=!0,z[re]=$e,--q||Y(z))},ue)}),--q||Y(z)});return P&&ue(P.error),N.promise},race:function(O){var D=this,N=E(D),Y=N.reject,ue=j(function(){S(O,!1,function(P){D.resolve(P).then(N.resolve,Y)})});return ue&&Y(ue.error),N.promise}})},function(i,a,o){var s=o(61)(!0);o(27)(String,"String",function(u){this._t=String(u),this._i=0},function(){var u,f=this._t,c=this._i;return c>=f.length?{value:void 0,done:!0}:(u=s(f,c),this._i+=u.length,{value:u,done:!1})})},function(i,a,o){o(65);for(var s=o(2),u=o(5),f=o(10),c=o(1)("toStringTag"),l=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],p=0;p<5;p++){var d=l[p],h=s[d],m=h&&h.prototype;m&&!m[c]&&u(m,c,d),f[d]=f.Array}},function(i,a){i.exports=un.default},function(i,a){i.exports=Fi.default}])})})(Wl);var Cr;try{Cr=Map}catch{}var Rr;try{Rr=Set}catch{}function Ea(e,t,n){if(!e||typeof e!="object"||typeof e=="function")return e;if(e.nodeType&&"cloneNode"in e)return e.cloneNode(!0);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(Fr);if(Cr&&e instanceof Cr)return new Map(Array.from(e.entries()));if(Rr&&e instanceof Rr)return new Set(Array.from(e.values()));if(e instanceof Object){t.push(e);var r=Object.create(e);n.push(r);for(var i in e){var a=t.findIndex(function(o){return o===e[i]});r[i]=a>-1?n[a]:Ea(e[i],t,n)}return r}return e}function Fr(e){return Ea(e,[],[])}const zl=Object.prototype.toString,Yl=Error.prototype.toString,Ql=RegExp.prototype.toString,Vl=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Xl=/^Symbol\((.*)\)(.*)$/;function Zl(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Di(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const n=typeof e;if(n==="number")return Zl(e);if(n==="string")return t?`"${e}"`:e;if(n==="function")return"[Function "+(e.name||"anonymous")+"]";if(n==="symbol")return Vl.call(e).replace(Xl,"Symbol($1)");const r=zl.call(e).slice(8,-1);return r==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):r==="Error"||e instanceof Error?"["+Yl.call(e)+"]":r==="RegExp"?Ql.call(e):null}function xt(e,t){let n=Di(e,t);return n!==null?n:JSON.stringify(e,function(r,i){let a=Di(this[r],t);return a!==null?a:i},2)}let ze={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:r})=>{let i=r!=null&&r!==n,a=`${e} must be a \`${t}\` type, but the final value was: \`${xt(n,!0)}\``+(i?` (cast from the value \`${xt(r,!0)}\`).`:".");return n===null&&(a+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),a},defined:"${path} must be defined"},Re={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Jl={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},$r={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},ef={isValue:"${path} field must be ${value}"},Or={noUnknown:"${path} field has unspecified keys: ${unknown}"},tn={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must be have ${length} items"};const tf=Object.assign(Object.create(null),{mixed:ze,string:Re,number:Jl,date:$r,object:Or,array:tn,boolean:ef}),Ln=e=>e&&e.__isYupSchema__;class nf{constructor(t,n){if(this.refs=t,this.refs=t,typeof n=="function"){this.fn=n;return}if(!cn.default(n,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:i,otherwise:a}=n,o=typeof r=="function"?r:(...s)=>s.every(u=>u===r);this.fn=function(...s){let u=s.pop(),f=s.pop(),c=o(...s)?i:a;if(c)return typeof c=="function"?c(f):f.concat(c.resolve(u))}}resolve(t,n){let r=this.refs.map(a=>a.getValue(n?.value,n?.parent,n?.context)),i=this.fn.apply(t,r.concat(t,n));if(i===void 0||i===t)return t;if(!Ln(i))throw new TypeError("conditions must return a schema object");return i.resolve(n)}}function ba(e){return e==null?[]:[].concat(e)}function Ir(){return Ir=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ir.apply(this,arguments)}let rf=/\$\{\s*(\w+)\s*\}/g;class me extends Error{static formatError(t,n){const r=n.label||n.path||"this";return r!==n.path&&(n=Ir({},n,{path:r})),typeof t=="string"?t.replace(rf,(i,a)=>xt(n[a])):typeof t=="function"?t(n):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,n,r,i){super(),this.name="ValidationError",this.value=n,this.path=r,this.type=i,this.errors=[],this.inner=[],ba(t).forEach(a=>{me.isError(a)?(this.errors.push(...a.errors),this.inner=this.inner.concat(a.inner.length?a.inner:a)):this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,me)}}const of=e=>{let t=!1;return(...n)=>{t||(t=!0,e(...n))}};function pn(e,t){let{endEarly:n,tests:r,args:i,value:a,errors:o,sort:s,path:u}=e,f=of(t),c=r.length;const l=[];if(o=o||[],!c)return o.length?f(new me(o,a,u)):f(null,a);for(let p=0;p<r.length;p++){const d=r[p];d(i,function(m){if(m){if(!me.isError(m))return f(m,a);if(n)return m.value=a,f(m,a);l.push(m)}if(--c<=0){if(l.length&&(s&&l.sort(s),o.length&&l.push(...o),o=l),o.length){f(new me(o,a,u),a);return}f(null,a)}})}}function it(e){this._maxSize=e,this.clear()}it.prototype.clear=function(){this._size=0,this._values=Object.create(null)};it.prototype.get=function(e){return this._values[e]};it.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var af=/[^.^\]^[]+|(?=\[\]|\.\.)/g,xa=/^\d+$/,sf=/^\d/,uf=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,cf=/^\s*(['"]?)(.*?)(\1)\s*$/,Kr=512,Mi=new it(Kr),ji=new it(Kr),Hi=new it(Kr),kn={Cache:it,split:Nr,normalizePath:nr,setter:function(e){var t=nr(e);return ji.get(e)||ji.set(e,function(r,i){for(var a=0,o=t.length,s=r;a<o-1;){var u=t[a];if(u==="__proto__"||u==="constructor"||u==="prototype")return r;s=s[t[a++]]}s[t[a]]=i})},getter:function(e,t){var n=nr(e);return Hi.get(e)||Hi.set(e,function(i){for(var a=0,o=n.length;a<o;)if(i!=null||!t)i=i[n[a++]];else return;return i})},join:function(e){return e.reduce(function(t,n){return t+(Wr(n)||xa.test(n)?"["+n+"]":(t?".":"")+n)},"")},forEach:function(e,t,n){lf(Array.isArray(e)?e:Nr(e),t,n)}};function nr(e){return Mi.get(e)||Mi.set(e,Nr(e).map(function(t){return t.replace(cf,"$2")}))}function Nr(e){return e.match(af)||[""]}function lf(e,t,n){var r=e.length,i,a,o,s;for(a=0;a<r;a++)i=e[a],i&&(df(i)&&(i='"'+i+'"'),s=Wr(i),o=!s&&/^\d+$/.test(i),t.call(n,i,s,o,a,e))}function Wr(e){return typeof e=="string"&&e&&["'",'"'].indexOf(e.charAt(0))!==-1}function ff(e){return e.match(sf)&&!e.match(xa)}function pf(e){return uf.test(e)}function df(e){return!Wr(e)&&(ff(e)||pf(e))}const Yt={context:"$",value:"."};class et{constructor(t,n={}){if(typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Yt.context,this.isValue=this.key[0]===Yt.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Yt.context:this.isValue?Yt.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&kn.getter(this.path,!0),this.map=n.map}getValue(t,n,r){let i=this.isContext?r:this.isValue?t:n;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(t,n){return this.getValue(t,n?.parent,n?.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}et.prototype.__isYupRef=!0;function dn(){return dn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dn.apply(this,arguments)}function hf(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Qt(e){function t(n,r){let{value:i,path:a="",label:o,options:s,originalValue:u,sync:f}=n,c=hf(n,["value","path","label","options","originalValue","sync"]);const{name:l,test:p,params:d,message:h}=e;let{parent:m,context:g}=s;function b(F){return et.isRef(F)?F.getValue(i,m,g):F}function S(F={}){const M=na.default(dn({value:i,originalValue:u,label:o,path:F.path||a},d,F.params),b),x=new me(me.formatError(F.message||h,M),i,M.path,F.type||l);return x.params=M,x}let T=dn({path:a,parent:m,type:l,createError:S,resolve:b,options:s,originalValue:u},c);if(!f){try{Promise.resolve(p.call(T,i,T)).then(F=>{me.isError(F)?r(F):F?r(null,F):r(S())})}catch(F){r(F)}return}let A;try{var C;if(A=p.call(T,i,T),typeof((C=A)==null?void 0:C.then)=="function")throw new Error(`Validation test of type: "${T.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(F){r(F);return}me.isError(A)?r(A):A?r(null,A):r(S())}return t.OPTIONS=e,t}let mf=e=>e.substr(0,e.length-1).substr(1);function gf(e,t,n,r=n){let i,a,o;return t?(kn.forEach(t,(s,u,f)=>{let c=u?mf(s):s;if(e=e.resolve({context:r,parent:i,value:n}),e.innerType){let l=f?parseInt(c,10):0;if(n&&l>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${s}, in the path: ${t}. because there is no value at that index. `);i=n,n=n&&n[l],e=e.innerType}if(!f){if(!e.fields||!e.fields[c])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e._type}")`);i=n,n=n&&n[c],e=e.fields[c]}a=c,o=u?"["+s+"]":"."+s}),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}class hn{constructor(){this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const t=[];for(const n of this.list)t.push(n);for(const[,n]of this.refs)t.push(n.describe());return t}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}add(t){et.isRef(t)?this.refs.set(t.key,t):this.list.add(t)}delete(t){et.isRef(t)?this.refs.delete(t.key):this.list.delete(t)}has(t,n){if(this.list.has(t))return!0;let r,i=this.refs.values();for(;r=i.next(),!r.done;)if(n(r.value)===t)return!0;return!1}clone(){const t=new hn;return t.list=new Set(this.list),t.refs=new Map(this.refs),t}merge(t,n){const r=this.clone();return t.list.forEach(i=>r.add(i)),t.refs.forEach(i=>r.add(i)),n.list.forEach(i=>r.delete(i)),n.refs.forEach(i=>r.delete(i)),r}}function Ae(){return Ae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ae.apply(this,arguments)}class ge{constructor(t){this.deps=[],this.conditions=[],this._whitelist=new hn,this._blacklist=new hn,this.exclusiveTests=Object.create(null),this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ze.notType)}),this.type=t?.type||"mixed",this.spec=Ae({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},t?.spec)}get _type(){return this.type}_typeCheck(t){return!0}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeError=this._typeError,n._whitelistError=this._whitelistError,n._blacklistError=this._blacklistError,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.exclusiveTests=Ae({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=Fr(Ae({},this.spec,t)),n}label(t){var n=this.clone();return n.spec.label=t,n}meta(...t){if(t.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},t[0]),n}withMutation(t){let n=this._mutate;this._mutate=!0;let r=t(this);return this._mutate=n,r}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let n=this,r=t.clone();const i=Ae({},n.spec,r.spec);return r.spec=i,r._typeError||(r._typeError=n._typeError),r._whitelistError||(r._whitelistError=n._whitelistError),r._blacklistError||(r._blacklistError=n._blacklistError),r._whitelist=n._whitelist.merge(t._whitelist,t._blacklist),r._blacklist=n._blacklist.merge(t._blacklist,t._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(a=>{t.tests.forEach(o=>{a.test(o.OPTIONS)})}),r}isType(t){return this.spec.nullable&&t===null?!0:this._typeCheck(t)}resolve(t){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((i,a)=>a.resolve(i,t),n),n=n.resolve(t)}return n}cast(t,n={}){let r=this.resolve(Ae({value:t},n)),i=r._cast(t,n);if(t!==void 0&&n.assert!==!1&&r.isType(i)!==!0){let a=xt(t),o=xt(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r._type}".
|
|
3
3
|
|
|
4
4
|
attempted value: ${a}
|
package/dist/server/index.mjs
CHANGED
|
@@ -430,13 +430,11 @@ const Xt = (e) => e === "*" ? "*" : typeof e == "string" ? [e] : e === !1 ? [] :
|
|
|
430
430
|
},
|
|
431
431
|
remove(t) {
|
|
432
432
|
const { itemModel: n } = Ee(e);
|
|
433
|
-
return e.strapi.
|
|
433
|
+
return e.strapi.documents(n.uid).delete({ documentId: t.documentId });
|
|
434
434
|
},
|
|
435
435
|
removeForIds(t) {
|
|
436
436
|
const { itemModel: n } = Ee(e);
|
|
437
|
-
return e.strapi.
|
|
438
|
-
where: { documentId: t }
|
|
439
|
-
});
|
|
437
|
+
return t.map((r) => e.strapi.documents(n.uid).delete({ documentId: r }));
|
|
440
438
|
},
|
|
441
439
|
findForMasterIds(t) {
|
|
442
440
|
const { itemModel: n } = Ee(e);
|
|
@@ -513,9 +511,9 @@ const no = (e) => e === !0 ? !0 : Array.isArray(e) ? e.includes("items") : !1, I
|
|
|
513
511
|
},
|
|
514
512
|
remove(t) {
|
|
515
513
|
const { masterModel: n } = Ee(e);
|
|
516
|
-
if (!t.documentId
|
|
517
|
-
throw new Tt("
|
|
518
|
-
return e.strapi.
|
|
514
|
+
if (!t.documentId)
|
|
515
|
+
throw new Tt("Document id is required.");
|
|
516
|
+
return e.strapi.documents(n.uid).delete({ documentId: t.documentId });
|
|
519
517
|
}
|
|
520
518
|
})), ol = "Navigation", al = "navigation", sl = async (e) => {
|
|
521
519
|
const t = re(e, "common"), { defaultLocale: n, restLocale: r = [] } = await t.readLocale(), i = Ie(e), a = await i.find({
|
|
@@ -22,8 +22,12 @@ export declare const getNavigationItemRepository: (context: {
|
|
|
22
22
|
save({ item, locale }: SaveInput): Promise<import("@strapi/types/dist/modules/documents").AnyDocument | null>;
|
|
23
23
|
find({ filters, locale, limit, order, populate }: FindInput): Promise<NavigationItemDBSchema[]>;
|
|
24
24
|
count(where: any): Promise<number>;
|
|
25
|
-
remove(item: NavigationItemRemoveMinimal):
|
|
26
|
-
|
|
25
|
+
remove(item: NavigationItemRemoveMinimal): import("@strapi/types/dist/modules/documents/result/document-engine").Delete<any, {
|
|
26
|
+
readonly documentId: string;
|
|
27
|
+
}>;
|
|
28
|
+
removeForIds(ids: string[]): import("@strapi/types/dist/modules/documents/result/document-engine").Delete<any, {
|
|
29
|
+
readonly documentId: string;
|
|
30
|
+
}>[];
|
|
27
31
|
findForMasterIds(ids: number[]): Promise<NavigationItemDBSchema[]>;
|
|
28
32
|
};
|
|
29
33
|
export declare const removeSensitiveFields: ({ related, items, ...item }: NavigationItemDBSchema) => NavigationItemDBSchema;
|
|
@@ -47,6 +47,8 @@ export declare const getNavigationRepository: (context: {
|
|
|
47
47
|
visible: boolean;
|
|
48
48
|
items?: import("../schemas").NavigationItemDBSchema[] | undefined;
|
|
49
49
|
}>;
|
|
50
|
-
remove(navigation: Partial<Pick<NavigationDBSchema, '
|
|
50
|
+
remove(navigation: Partial<Pick<NavigationDBSchema, 'documentId'>>): import("@strapi/types/dist/modules/documents/result/document-engine").Delete<any, {
|
|
51
|
+
readonly documentId: string;
|
|
52
|
+
}>;
|
|
51
53
|
};
|
|
52
54
|
export {};
|