strapi-plugin-navigation 3.2.6-beta.1 → 3.2.6-beta.2

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.
@@ -1,4 +1,4 @@
1
- "use strict";const B=require("lodash"),Qr=require("zod"),C=require("lodash/fp"),qc=require("crypto"),Kc=require("child_process"),Wc=require("lodash/has"),zc=require("lodash/mapValues"),Yc=require("lodash/snakeCase"),Qc=require("lodash/camelCase"),Vc=require("lodash/mapKeys"),Xc=require("os"),Zc=require("path"),Jc=require("fs"),eu=require("assert"),tu=require("events"),nu=require("buffer"),ru=require("stream"),iu=require("util"),ou=require("constants");require("node:stream");const au=require("@sindresorhus/slugify"),su=require("zod/v4"),cu=require("pluralize"),ce=e=>e&&e.__esModule?e:{default:e};function fa(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 me=ce(B),y=fa(Qr),ki=ce(qc),ln=ce(Kc),fn=ce(Wc),pa=ce(zc),Di=ce(Yc),uu=ce(Qc),lu=ce(Vc),Ln=ce(Xc),Se=ce(Zc),We=ce(Jc),da=ce(eu),fu=ce(tu),pu=ce(nu),kn=ce(ru),it=ce(iu),du=ce(ou),hu=ce(au),W=fa(su),Mi=ce(cu),Vr=y.object({name:y.string({required_error:"requiredError"}).nonempty("requiredError").refine(e=>!e.includes(" "),{message:"noSpaceError"}),label:y.string({required_error:"requiredError"}).nonempty("requiredError"),description:y.string().optional(),placeholder:y.string().optional(),required:y.boolean().optional(),enabled:y.boolean().optional()}),mu=Vr.extend({type:y.literal("select"),multi:y.boolean(),options:y.array(y.string(),{required_error:"requiredError"}).min(1,{message:"requiredError"})}),gu=Vr.extend({type:y.enum(["boolean","string"]),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),yu=Vr.extend({type:y.literal("media"),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),ha=y.discriminatedUnion("type",[gu,yu,mu]),ma=y.union([y.literal("audience"),ha]),vu=y.object({additionalFields:y.array(ma),allowedLevels:y.number(),contentTypes:y.array(y.string()),defaultContentType:y.string().optional(),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()}),ga=y.object({id:y.number(),documentId:y.string(),name:y.string(),key:y.string()}),wu=y.enum(["INTERNAL","EXTERNAL","WRAPPER"]),Xr=y.object({id:y.number(),documentId:y.string(),title:y.string(),type:wu,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().optional(),additionalFields:y.record(y.string(),y.unknown()).or(y.null()).optional(),audience:y.array(ga).or(y.null()).optional(),autoSync:y.boolean().or(y.null()).optional()}),Eu=Xr.omit({related:!0}).pick({path:!0,type:!0,uiRouterKey:!0,title:!0,externalPath:!0}).extend({related:y.unknown().optional()}),Lt=Xr.extend({parent:y.lazy(()=>Lt.or(y.null())).optional(),items:y.lazy(()=>Lt.array()).optional(),master:y.lazy(()=>Ve(!1)).optional()}),ji=y.array(Lt),Ve=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(Lt):Lt.array().optional()}),bu=Ve(!1).omit({items:!0,id:!0,documentId:!0,slug:!0,locale:!0}).extend({documentId:y.string().optional(),id:y.undefined().optional()}),Su=Xr.omit({id:!0,documentId:!0}).extend({id:y.number().optional(),documentId:y.string().optional(),items:y.lazy(()=>ya).or(y.null()).optional(),updated:y.boolean().optional(),removed:y.boolean().optional()}),ya=y.array(Su),xu=Ve(!1).extend({items:ya}).partial().required({id:!0,documentId:!0}),_u=y.enum(["collectionType","singleType"]),Au=y.object({singularName:y.string(),pluralName:y.string(),displayName:y.string(),description:y.string().optional(),name:y.string().optional()}),va=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()}),Tu=y.enum(["string","text","richtext","blocks","email","password","date","time","datetime","timestamp","boolean","integer","biginteger","float","decimal","json","relation","media"]),Cu=va.extend({type:Tu}),Ru=va.extend({type:y.literal("enumeration"),enum:y.string().array()}),Fu=y.object({type:y.literal("component"),component:y.string(),repeatable:y.boolean().optional()}),$u=y.object({type:y.literal("dynamiczone"),components:y.string().array()}),Iu=y.object({type:y.literal("uid")}),Ou=y.object({type:y.literal("media"),allowedTypes:y.enum(["images","videos","audios","files"]).array(),required:y.boolean().optional()}),Nu=y.enum(["oneToOne","oneToMany","manyToOne","manyToMany","morphToMany","manyToMorph"]),Pu=y.object({type:y.literal("relation"),relation:Nu,target:y.string(),mappedBy:y.string().optional(),inversedBy:y.string().optional()}),Lu=y.record(y.string(),y.union([Cu,Ru,Fu,$u,Pu,Ou,Iu])),Tr=y.object({kind:_u,collectionName:y.string(),info:Au,options:y.object({draftAndPublish:y.boolean().optional(),hidden:y.boolean().optional(),templateName:y.string().optional()}).optional(),attributes:Lu,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()});Tr.pick({info:!0,kind:!0,attributes:!0,options:!0});const Mt=(e,t)=>n=>{t(n(e()))};let Cr=vu;const ku=Mt(()=>Cr,e=>{Cr=e});let Rr=ma;const Du=Mt(()=>Rr,e=>{Rr=e});let Fr=ha;const Mu=Mt(()=>Fr,e=>{Fr=e});let $r=bu;const ju=Mt(()=>$r,e=>{$r=e});let Ir=xu;const Hu=Mt(()=>Ir,e=>{Ir=e}),Fe={get configSchema(){return Cr},get navigationItemAdditionalField(){return Rr},get navigationItemCustomField(){return Fr},get createNavigationSchema(){return $r},get updateNavigationSchema(){return Ir}},Bu=/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,Uu=["beforeCreate","beforeCreateMany","afterCreate","afterCreateMany","beforeUpdate","beforeUpdateMany","afterUpdate","afterUpdateMany","beforeDelete","beforeDeleteMany","afterDelete","afterDeleteMany","beforeCount","afterCount","beforeFindOne","afterFindOne","beforeFindMany","afterFindMany"],Gu="$",wa=["api::","plugin::"],Ea=["admin::","plugin::content-releases","plugin::i18n.locale","plugin::navigation","plugin::review-workflows","plugin::users-permissions","plugin::upload.folder"],qu=["title","subject","name"],Hi={SINGLE:"singleType"},Bi=["title","type","path","externalPath","uiRouterKey","menuAttached","order","collapsed","related","parent","master","audience","additionalFields"],Ku=e=>e.filter(t=>t!=="audience"),ba=e=>{const t=Ku(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(Bi,n.name))))throw new Error(`Name of custom field cannot be one of: ${Bi.join(", ")}`)},Sa=(e,t)=>{if(e==null)throw t??new Error("Non-empty value expected, empty given")},Wu=(e="")=>{const t=a=>a.split("-").map(o=>B.capitalize(o)).join(""),[n,r,i]=zu(e);return n==="api"?t(i):`${t(r)}${t(i)}`},zu=(e="")=>e.split(Bu).filter(t=>t&&t.length>0),Yu=(e,t)=>n=>[n,async r=>{await re(t,"common").runLifeCycleHook({contentTypeName:e,hookName:n,event:r})}],xa=(e,t)=>Object.fromEntries(Uu.map(Yu(e,t))),we=({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 re({strapi:e},t){return e.plugin("navigation").service(t)}const Yt=e=>e==="*"?"*":typeof e=="string"?[e]:e===!1?[]:e===!0?"*":e,Qu=(e="")=>{const t=!!wa.find(r=>e.includes(r)),n=!Ea.find(r=>e.includes(r)||e===r);return!!e&&t&&n},Ui=(e="")=>B.last(e)==="s"?e.substr(0,e.length-1):e,Vu=B.once(e=>({find(t,n){const{audienceModel:{uid:r}}=we(e);return e.strapi.query(r).findMany({where:t,limit:n}).then(ga.array().parse)}})),pn=(e,t)=>({findFirst(n,r,i={}){return e.strapi.documents(t).findFirst({populate:Yt(n),status:r,...i})},findById(n,r,i,a={}){return e.strapi.documents(t).findOne({documentId:n,populate:Yt(r),status:i,...a})},findManyById(n,r,i){return e.strapi.documents(t).findMany({where:{documentId:{$in:n}},populate:Yt(r),status:i})},findMany(n,r,i,a){return e.strapi.documents(t).findMany({where:n,populate:Yt(r),status:i,locale:a})},count(n,r){return e.strapi.documents(t).count({where:n,status:r})}}),Le=B.once(e=>({async save({item:t,locale:n}){const{itemModel:r}=we(e),{__type:i,documentId:a}=t?.related??{},o=i?pn(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:c,...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}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(Or)).then(ji.parse).then(s=>s.map(dn))},findV4({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i})},count(t){const{itemModel:n}=we(e);return e.strapi.query(n.uid).count({where:t})},remove(t){const{itemModel:n}=we(e);return e.strapi.documents(n.uid).delete({documentId:t.documentId,populate:"*"})},removeForIds(t){const{itemModel:n}=we(e);return t.map(r=>e.strapi.documents(n.uid).delete({documentId:r,populate:"*"}))},findForMasterIds(t){const{itemModel:n}=we(e);return e.strapi.query(n.uid).findMany({where:{$or:t.map(r=>({master:r}))},limit:Number.MAX_SAFE_INTEGER}).then(ji.parse)}})),Xu=["id","publishedAt","createdAt","updatedAt","locale"],dn=({related:e,items:t=[],...n})=>({...n,items:t.map(dn),related:e?B.omit(e,Xu):void 0}),Or=({related:e,...t})=>({...t,related:e?.[0]});class St extends Error{constructor(t,n){super(t),this.additionalInfo=n,this.type="NavigationError"}}class rr extends St{constructor(){super(...arguments),this.type="FillNavigationError"}}class Zu extends St{constructor(){super(...arguments),this.type="InvalidParamNavigationError"}}const Gi=e=>e===!0?!0:Array.isArray(e)?e.includes("items"):!1,_e=B.once(e=>({find({filters:t,locale:n,limit:r,orderBy:i,populate:a}){const{masterModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(({items:c,...f})=>({...f,items:c?.map(Or)}))).then(s=>s.map(({items:c,...f})=>({...f,items:c?.map(dn)}))).then(s=>Ve(Gi(a)).array().parse(s))},findOne({locale:t,filters:n,populate:r}){const{masterModel:i}=we(e);return e.strapi.documents(i.uid).findOne({documentId:n.documentId,locale:t,populate:r}).then(a=>a&&{...a,items:a.items?.map(Or)}).then(a=>Ve(Gi(r)).parse(a)).then(a=>({...a,items:a.items?.map(dn)}))},async save(t){const{masterModel:n}=we(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(Ve(!1).parse):e.strapi.documents(n.uid).create({locale:i,data:{...a,populate:["items"]}}).then(Ve(!1).parse)},remove(t){const{masterModel:n}=we(e);if(!t.documentId)throw new St("Document id is required.");return e.strapi.documents(n.uid).delete({documentId:t.documentId,locale:t.locale})}})),Ju=async e=>{const t=await _e(e).find({locale:"*",limit:Number.MAX_SAFE_INTEGER}),n=e.strapi.plugin("i18n").service("locales").getDefaultLocale().code;await Promise.all(t.map(async r=>{t.find(({documentId:a,locale:o})=>a===r.documentId&&o===n)||await _e(e).remove({documentId:r.documentId,locale:r.locale})}))},_a=async({strapi:e,forceDefault:t=!1})=>{const n=e.store({type:"plugin",name:"navigation"}),r=await e.plugin("navigation").config,i=t?{}:{...Nr.default,...await n.get({key:"config"})??Nr.default};let a=B.isEmpty(i)?i:Fe.configSchema.parse(i);const o=el(a,r);return a={additionalFields:o("additionalFields"),contentTypes:o("contentTypes"),contentTypesNameFields:o("contentTypesNameFields"),contentTypesPopulate:o("contentTypesPopulate"),defaultContentType:o("defaultContentType"),allowedLevels:o("allowedLevels"),gql:o("gql"),pathDefaultFields:o("pathDefaultFields"),cascadeMenuAttached:o("cascadeMenuAttached"),preferCustomContentTypes:o("preferCustomContentTypes"),isCacheEnabled:o("isCacheEnabled")},tl(a,{strapi:e}),ba(a.additionalFields),await n.set({key:"config",value:a}),a},el=(e,t)=>n=>{const r=e?.[n]??t(n);return Sa(r,new Error(`[Navigation] Config "${n}" is undefined`)),r},tl=(e,{strapi:t})=>{const n=e.contentTypes.filter(i=>!t.contentTypes[i]);if(n.length===0)return;const r=n.map(Wu);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))},Nr={default:{additionalFields:[],allowedLevels:2,contentTypes:[],defaultContentType:"",contentTypesNameFields:{},contentTypesPopulate:{},gql:{navigationItemRelated:[]},pathDefaultFields:{},pruneObsoleteI18nNavigations:!1,cascadeMenuAttached:!0,preferCustomContentTypes:!1,isCacheEnabled:!1}},nl="Navigation",rl="navigation",il=async e=>{const t=re(e,"common"),{defaultLocale:n,restLocale:r=[]}=await t.readLocale(),i=_e(e),a=await i.find({limit:Number.MAX_SAFE_INTEGER,filters:{},locale:"*"});a.length===0&&a.push(await i.save({name:nl,visible:!0,locale:n,slug:rl}));const o=a.filter(({locale:s})=>s===n);for(const s of o)for(const c of r)!a.find(({locale:l,documentId:u})=>u===s.documentId&&c===l)&&await i.save({documentId:s.documentId,name:s.name,locale:c,visible:s.visible,slug:s.slug})},he={render:function(e){return`plugin::navigation.${e}`},navigation:{read:"read",update:"update",settings:"settings"}},ol=async({strapi:e})=>{const t=[{section:"plugins",displayName:"Read",uid:he.navigation.read,pluginName:"navigation"},{section:"plugins",displayName:"Update",uid:he.navigation.update,pluginName:"navigation"},{section:"plugins",displayName:"Settings",uid:he.navigation.settings,pluginName:"navigation"}];await e.admin.services.permission.actionProvider.registerMany(t)},al="I18NLocaleCode",sl=({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:al})},type:n(r("NavigationItem")),resolve(c,{navigationIdOrSlug:f,type:l,menuOnly:u,path:p,locale:d}){const h=Qr.z.string().parse(f);return re({strapi:e},"client").render({idOrSlug:h,type:l,rootPath:p,locale:d,menuOnly:u,wrapRelated:!0})}}},cl=({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:c,childUIKey:f,type:l,menuOnly:u}=s,p=Qr.z.string().parse(c);return re({strapi:e},"client").renderChildren({idOrSlug:p,childUIKey:f,type:l,menuOnly:u,wrapRelated:!0})}}},ul=e=>{const t={renderNavigationChild:cl,renderNavigation:sl};return e.nexus.extendType({type:"Query",definition(n){for(const[r,i]of Object.entries(t)){const a=i(e);n.field(r,a)}}})},ll=()=>({"Query.renderNavigationChild":{auth:!1},"Query.renderNavigation":{auth:!1}}),fl=({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")}}),pl=({nexus:e,strapi:t})=>e.objectType({name:"ContentTypesNameFields",async definition(n){n.nonNull.list.nonNull.string("default");const i=await re({strapi:t},"common").getPluginStore(),o=Fe.configSchema.parse(await i.get({key:"config"})).contentTypesNameFields;Object.keys(o||{}).forEach(s=>n.nonNull.list.string(s))}}),dl=({nexus:e})=>e.inputObjectType({name:"CreateNavigation",definition(t){t.nonNull.string("name"),t.nonNull.list.field("items",{type:"CreateNavigationItem"})}}),hl=({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"})}}),ml=({nexus:e})=>e.inputObjectType({name:"CreateNavigationRelated",definition(t){t.nonNull.string("ref"),t.nonNull.string("field"),t.nonNull.string("refId")}}),gl=({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")}}),yl=({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"})}}),vl=({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"})}}),wl=({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")}}),El=({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`)}})}}),bl=({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")}})},Sl=({nexus:e})=>e.enumType({name:"NavigationItemType",members:["INTERNAL","EXTERNAL","WRAPPER"]}),xl=({nexus:e})=>e.enumType({name:"NavigationRenderType",members:["FLAT","TREE"]}),_l=[El,bl,wl,xl,gl,vl,pl,fl,yl,ml,hl,dl,Sl],Al=e=>_l.map(t=>t(e)),Tl=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 re({strapi:e},"common").getPluginStore(),i=Fe.configSchema.parse(await r.get({key:"config"}));t.use(({strapi:a,nexus:o})=>{const s=Al({strapi:a,nexus:o,config:i}),c=ul({strapi:a,nexus:o}),f=ll();return{types:[s,c],resolversConfig:f}})},Cl=async({strapi:e})=>{!!e.plugin("graphql")&&await Tl({strapi:e})},Rl=async e=>{await Ju(e),await _a(e),await il(e),await ol(e),await Cl(e),await strapi.service("plugin::navigation.migrate").migrateRelatedIdToDocumentId(),strapi.db.lifecycles.subscribe({models:["plugin::i18n.locale"],async afterCreate(t){await re(e,"admin").refreshNavigationLocale(t.result?.code)}})},Fl=({strapi:e})=>{},$l=({strapi:e})=>{},Il={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"}}},Ol={schema:Il},Nl=xa("navigation",{strapi}),Pl={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"}}},Ll={schema:Pl,lifecycles:Nl},kl=xa("navigation-item",{strapi}),Dl={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:{}}}},Ml={schema:Dl,lifecycles:kl},jl={audience:Ol,navigation:Ll,"navigation-item":Ml},Aa=y.enum(["true","false"]),Qt=y.string(),Hl=y.object({locale:y.string().optional(),orderBy:y.string().optional(),orderDirection:y.enum(["DESC","ASC"]).optional()}),Ta=y.enum(["FLAT","TREE","RFR"]),Ca=y.enum(["draft","published"]),Ra=y.union([y.boolean(),y.string(),y.string().array(),y.undefined()]),Bl=y.object({type:Ta.optional(),menu:Aa.optional(),path:y.string().optional(),locale:y.string().optional(),populate:Ra.optional(),status:Ca.optional()}),Ul=y.object({type:Ta.optional(),menu:Aa.optional(),locale:y.string().optional(),status:Ca.optional()}),Gl=y.object({source:y.string().min(1),target:y.string().min(1),documentId:y.string().min(1)});function ql(e){return{getAdminService(){return re(e,"admin")},getCommonService(){return re(e,"common")},async get(){return await this.getAdminService().get({})},async post(t){const{auditLog:n}=t;try{return await this.getAdminService().post({payload:Fe.createNavigationSchema.parse(t.request.body),auditLog:n})}catch(r){const i=r instanceof Error?{name:r.name,message:r.message}:{};return t.internalServerError("Unable to create",{originalError:i})}},async put(t){const{params:{documentId:n},auditLog:r}=t,i=y.record(y.string(),y.unknown()).parse(t.request.body);try{return await this.getAdminService().put({auditLog:r,payload:Fe.updateNavigationSchema.parse({...i,documentId:n})})}catch(a){const o=a instanceof Error?{name:a.name,message:a.message}:{};return t.internalServerError("Unable to update",{originalError:o})}},async delete(t){const{auditLog:n,params:{documentId:r}}=t;return await this.getAdminService().delete({documentId:Qt.parse(r),auditLog:n}),{}},config(){return this.getAdminService().config({viaSettingsPage:!1})},async updateConfig(t){return await this.getAdminService().updateConfig({config:Fe.configSchema.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:Qt.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}=Gl.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:Qt.parse(n),target:Qt.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 Kl=e=>{if(!(!e||e===!0||e==="*")&&typeof e!="object")return Array.isArray(e),e};function Wl(e){return{getService(){return re(e,"client")},async readAll(t){try{const{query:n={}}=t,{locale:r,orderBy:i,orderDirection:a}=Hl.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:c,status:f="published"}=Bl.parse(r),l=y.string().parse(n.idOrSlug);return await this.getService().render({idOrSlug:l,type:i,menuOnly:a==="true",rootPath:o,locale:s,populate:Kl(Ra.parse(c==="true"?!0:c==="false"?!1:Array.isArray(c)?c.map(u=>u==="true"?!0:u==="false"?!1:c):c)),status:f})},async renderChild(t){const{params:n,query:r={}}=t,{type:i,menu:a,locale:o,status:s="published"}=Ul.parse(r),c=y.string().parse(n.idOrSlug),f=y.string().parse(n.childUIKey);return await this.getService().renderChildren({idOrSlug:c,childUIKey:f,type:i,menuOnly:a==="true",locale:o,status:s})}}}const zl={admin:ql,client:Wl},Yl={},Ql={},Vl={type:"admin",routes:[{method:"GET",path:"/",handler:"admin.get",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"POST",path:"/",handler:"admin.post",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/config",handler:"admin.config",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"PUT",path:"/config",handler:"admin.updateConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"DELETE",path:"/config",handler:"admin.restoreConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.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:[he.render("read")]}}]}},{method:"PUT",path:"/:documentId",handler:"admin.put",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"DELETE",path:"/:documentId",handler:"admin.delete",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.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:[he.render("settings")]}}]}},{method:"GET",path:"/settings/restart",handler:"admin.settingsRestart",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"PUT",path:"/i18n/copy/:documentId/:source/:target",handler:"admin.fillFromOtherLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/i18n/item/read/:source/:target",handler:"admin.readNavigationItemFromLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}}]},Xl={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:[]}}]},Zl={admin:Vl,"content-api":Xl};function Jl(e,t){return me.default.has(process.env,e)?process.env[e]:t}function st(e){return process.env[e]??""}const ef={int(e,t){return me.default.has(process.env,e)?parseInt(st(e),10):t},float(e,t){return me.default.has(process.env,e)?parseFloat(st(e)):t},bool(e,t){return me.default.has(process.env,e)?st(e)==="true":t},json(e,t){if(!me.default.has(process.env,e))return t;try{return JSON.parse(st(e))}catch(n){throw n instanceof Error?new Error(`Invalid json environment variable ${e}: ${n.message}`):n}},array(e,t){if(!me.default.has(process.env,e))return t;let n=st(e);return n.startsWith("[")&&n.endsWith("]")&&(n=n.substring(1,n.length-1)),n.split(",").map(r=>me.default.trim(me.default.trim(r," "),'"'))},date(e,t){return me.default.has(process.env,e)?new Date(st(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=tf(e,n);return t.includes(r)?r:n}},tf=Object.assign(Jl,ef),nf="id",rf="documentId",of={ID_ATTRIBUTE:nf,DOC_ID_ATTRIBUTE:rf},af=e=>C.union(strapi?.config?.get("api.responses.privateAttributes",[])??[],C.getOr([],"options.privateAttributes",e)),sf=(e,t)=>e?.attributes?.[t]?.private===!0?!0:af(e).includes(t),Fa=e=>e&&!["media","component","relation","dynamiczone"].includes(e.type),cf=e=>e?.type==="media",$a=e=>e?.type==="relation",uf=e=>!!e&&e.type==="dynamiczone",Ia=e=>!!e&&$a(e)&&e.relation?.startsWith?.("morphTo"),ht=async(e,t,n)=>{const{path:r={raw:null,attribute:null,rawWithIndices: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 ht(m,T,b)},c=m=>async(g,b,S)=>ht(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 ht(m,A,b)},l=async(m,g,b,S)=>ht(m,{schema:b,path:g,getModel:a,parent:o},S),u=async(m,g,b)=>{const T={schema:a(b.__component),path:g,getModel:a,parent:o};return ht(m,T,b)};if(!C.isObject(n)||C.isNil(i))return n;const p=C.clone(n),d=lf({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=C.isNil(r.raw)?g:`${r.raw}.${g}`,S.rawWithIndices=C.isNil(r.rawWithIndices)?g:`${r.rawWithIndices}.${g}`,C.isNil(b)||(S.attribute=C.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(!(C.isNil(A)||C.isNil(b))){if($a(b)){o={schema:i,key:g,attribute:b,path:S};const F=b.relation.toLowerCase().startsWith("morph")?s:c(a(b.target));if(C.isArray(A)){const D=new Array(A.length);for(let x=0;x<A.length;x+=1){const _={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${x}`:`${S.rawWithIndices}.${x}`};D[x]=await F(e,_,A[x])}p[g]=D}else p[g]=await F(e,S,A);continue}if(cf(b)){if(o={schema:i,key:g,attribute:b,path:S},C.isArray(A)){const R=new Array(A.length);for(let F=0;F<A.length;F+=1){const D={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${F}`:`${S.rawWithIndices}.${F}`};R[F]=await f(e,D,A[F])}p[g]=R}else p[g]=await f(e,S,A);continue}if(b.type==="component"){o={schema:i,key:g,attribute:b,path:S};const R=a(b.component);if(C.isArray(A)){const F=new Array(A.length);for(let D=0;D<A.length;D+=1){const x={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${D}`:`${S.rawWithIndices}.${D}`};F[D]=await l(e,x,R,A[D])}p[g]=F}else p[g]=await l(e,S,R,A);continue}if(b.type==="dynamiczone"&&C.isArray(A)){o={schema:i,key:g,attribute:b,path:S};const R=new Array(A.length);for(let F=0;F<A.length;F+=1){const D={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${F}`:`${S.rawWithIndices}.${F}`};R[F]=await u(e,D,A[F])}p[g]=R;continue}}}return p},lf=({data:e})=>({remove(t){delete e[t]},set(t,n){e[t]=n}});var ff=C.curry(ht),Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pf={exports:{}};(function(e,t){(function(n,r){e.exports=r(ln.default,ki.default)})(Ee,function(n,r){return(function(i){function a(s){if(o[s])return o[s].exports;var c=o[s]={exports:{},id:s,loaded:!1};return i[s].call(c.exports,c,c.exports,a),c.loaded=!0,c.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"),c=o(33),f=o(2).Symbol,l=typeof f=="function",u=i.exports=function(p){return s[p]||(s[p]=l&&f[p]||(l?f:c)("Symbol."+p))};u.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(c){if(!s(c))throw TypeError(c+" is not an object!");return c}},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),c=o(17);i.exports=o(4)?function(f,l,u){return s.f(f,l,c(1,u))}:function(f,l,u){return f[l]=u,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(c,f,l){if(s(c),f===void 0)return c;switch(l){case 1:return function(u){return c.call(f,u)};case 2:return function(u,p){return c.call(f,u,p)};case 3:return function(u,p,d){return c.call(f,u,p,d)}}return function(){return c.apply(f,arguments)}}},function(i,a){var o={}.hasOwnProperty;i.exports=function(s,c){return o.call(s,c)}},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),c=o(26),f=o(32),l=Object.defineProperty;a.f=o(4)?Object.defineProperty:function(u,p,d){if(s(u),p=f(p,!0),s(d),c)try{return l(u,p,d)}catch{}if("get"in d||"set"in d)throw TypeError("Accessors not supported!");return"value"in d&&(u[p]=d.value),u}},function(i,a,o){var s=o(42),c=o(15);i.exports=function(f){return s(c(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),c=o(2).document,f=s(c)&&s(c.createElement);i.exports=function(l){return f?c.createElement(l):{}}},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,c=o(8),f=o(1)("toStringTag");i.exports=function(l,u,p){l&&!c(l=p?l:l.prototype,f)&&s(l,f,{configurable:!0,value:u})}},function(i,a,o){var s=o(29)("keys"),c=o(33);i.exports=function(f){return s[f]||(s[f]=c(f))}},function(i,a){var o=Math.ceil,s=Math.floor;i.exports=function(c){return isNaN(c=+c)?0:(c>0?s:o)(c)}},function(i,a,o){var s=o(11),c=o(1)("toStringTag"),f=s((function(){return arguments})())=="Arguments",l=function(u,p){try{return u[p]}catch{}};i.exports=function(u){var p,d,h;return u===void 0?"Undefined":u===null?"Null":typeof(d=l(p=Object(u),c))=="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),c=o(6),f=o(7),l=o(5),u="prototype",p=function(d,h,m){var g,b,S,T=d&p.F,A=d&p.G,R=d&p.S,F=d&p.P,D=d&p.B,x=d&p.W,_=A?c:c[h]||(c[h]={}),N=_[u],v=A?s:R?s[h]:(s[h]||{})[u];A&&(m=h);for(g in m)b=!T&&v&&v[g]!==void 0,b&&g in _||(S=b?v[g]:m[g],_[g]=A&&typeof v[g]!="function"?m[g]:D&&b?f(S,s):x&&v[g]==S?(function(j){var H=function(K,w,E){if(this instanceof j){switch(arguments.length){case 0:return new j;case 1:return new j(K);case 2:return new j(K,w)}return new j(K,w,E)}return j.apply(this,arguments)};return H[u]=j[u],H})(S):F&&typeof S=="function"?f(Function.call,S):S,F&&((_.virtual||(_.virtual={}))[g]=S,d&p.R&&N&&!N[g]&&l(N,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),c=o(23),f=o(57),l=o(5),u=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",R=function(){return this};i.exports=function(F,D,x,_,N,v,j){d(x,D,_);var H,K,w,E=function(M){if(!b&&M in z)return z[M];switch(M){case T:return function(){return new x(this,M)};case A:return function(){return new x(this,M)}}return function(){return new x(this,M)}},$=D+" Iterator",k=N==A,U=!1,z=F.prototype,V=z[g]||z[S]||N&&z[N],ee=V||E(N),Ce=N?k?E("entries"):ee:void 0,I=D=="Array"&&z.entries||V;if(I&&(w=m(I.call(new F)),w!==Object.prototype&&(h(w,$,!0),s||u(w,g)||l(w,g,R))),k&&V&&V.name!==A&&(U=!0,ee=function(){return V.call(this)}),s&&!j||!b&&!U&&z[g]||l(z,g,ee),p[D]=ee,p[$]=R,N)if(H={values:k?ee:E(A),keys:v?ee:E(T),entries:Ce},j)for(K in H)K in z||f(z,K,H[K]);else c(c.P+c.F*(b||U),D,H);return H}},function(i,a){i.exports=!0},function(i,a,o){var s=o(2),c="__core-js_shared__",f=s[c]||(s[c]={});i.exports=function(l){return f[l]||(f[l]={})}},function(i,a,o){var s,c,f,l=o(7),u=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={},R="onreadystatechange",F=function(){var x=+this;if(A.hasOwnProperty(x)){var _=A[x];delete A[x],_()}},D=function(x){F.call(x.data)};g&&b||(g=function(x){for(var _=[],N=1;arguments.length>N;)_.push(arguments[N++]);return A[++T]=function(){u(typeof x=="function"?x:Function(x),_)},s(T),T},b=function(x){delete A[x]},o(11)(m)=="process"?s=function(x){m.nextTick(l(F,x,1))}:S?(c=new S,f=c.port2,c.port1.onmessage=D,s=l(f.postMessage,f,1)):h.addEventListener&&typeof postMessage=="function"&&!h.importScripts?(s=function(x){h.postMessage(x+"","*")},h.addEventListener("message",D,!1)):s=R in d("script")?function(x){p.appendChild(d("script"))[R]=function(){p.removeChild(this),F.call(x)}}:function(x){setTimeout(l(F,x,1),0)}),i.exports={set:g,clear:b}},function(i,a,o){var s=o(20),c=Math.min;i.exports=function(f){return f>0?c(s(f),9007199254740991):0}},function(i,a,o){var s=o(9);i.exports=function(c,f){if(!s(c))return c;var l,u;if(f&&typeof(l=c.toString)=="function"&&!s(u=l.call(c))||typeof(l=c.valueOf)=="function"&&!s(u=l.call(c))||!f&&typeof(l=c.toString)=="function"&&!s(u=l.call(c)))return u;throw TypeError("Can't convert object to primitive value")}},function(i,a){var o=0,s=Math.random();i.exports=function(c){return"Symbol(".concat(c===void 0?"":c,")_",(++o+s).toString(36))}},function(i,a,o){function s(R){return R&&R.__esModule?R:{default:R}}function c(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function f(R){return(0,g.createHash)("sha256").update(R).digest("hex")}function l(R){switch(S){case"darwin":return R.split("IOPlatformUUID")[1].split(`
1
+ "use strict";const B=require("lodash"),Qr=require("zod"),C=require("lodash/fp"),qc=require("crypto"),Kc=require("child_process"),Wc=require("lodash/has"),zc=require("lodash/mapValues"),Yc=require("lodash/snakeCase"),Qc=require("lodash/camelCase"),Vc=require("lodash/mapKeys"),Xc=require("os"),Zc=require("path"),Jc=require("fs"),eu=require("assert"),tu=require("events"),nu=require("buffer"),ru=require("stream"),iu=require("util"),ou=require("constants");require("node:stream");const au=require("@sindresorhus/slugify"),su=require("zod/v4"),cu=require("pluralize"),ce=e=>e&&e.__esModule?e:{default:e};function fa(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 me=ce(B),y=fa(Qr),ki=ce(qc),ln=ce(Kc),fn=ce(Wc),pa=ce(zc),Di=ce(Yc),uu=ce(Qc),lu=ce(Vc),Ln=ce(Xc),Se=ce(Zc),We=ce(Jc),da=ce(eu),fu=ce(tu),pu=ce(nu),kn=ce(ru),it=ce(iu),du=ce(ou),hu=ce(au),W=fa(su),Mi=ce(cu),Vr=y.object({name:y.string({required_error:"requiredError"}).nonempty("requiredError").refine(e=>!e.includes(" "),{message:"noSpaceError"}),label:y.string({required_error:"requiredError"}).nonempty("requiredError"),description:y.string().optional(),placeholder:y.string().optional(),required:y.boolean().optional(),enabled:y.boolean().optional()}),mu=Vr.extend({type:y.literal("select"),multi:y.boolean(),options:y.array(y.string(),{required_error:"requiredError"}).min(1,{message:"requiredError"})}),gu=Vr.extend({type:y.enum(["boolean","string"]),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),yu=Vr.extend({type:y.literal("media"),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),ha=y.discriminatedUnion("type",[gu,yu,mu]),ma=y.union([y.literal("audience"),ha]),vu=y.object({additionalFields:y.array(ma),allowedLevels:y.number(),contentTypes:y.array(y.string()),defaultContentType:y.string().optional(),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()}),ga=y.object({id:y.number(),documentId:y.string(),name:y.string(),key:y.string()}),wu=y.enum(["INTERNAL","EXTERNAL","WRAPPER"]),Xr=y.object({id:y.number(),documentId:y.string(),title:y.string(),type:wu,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().optional(),additionalFields:y.record(y.string(),y.unknown()).or(y.null()).optional(),audience:y.array(ga).or(y.null()).optional(),autoSync:y.boolean().or(y.null()).optional()}),Eu=Xr.omit({related:!0}).pick({path:!0,type:!0,uiRouterKey:!0,title:!0,externalPath:!0}).extend({related:y.unknown().optional()}),Lt=Xr.extend({parent:y.lazy(()=>Lt.or(y.null())).optional(),items:y.lazy(()=>Lt.array()).optional(),master:y.lazy(()=>Ve(!1)).optional()}),ji=y.array(Lt),Ve=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(Lt):Lt.array().optional()}),bu=Ve(!1).omit({items:!0,id:!0,documentId:!0,slug:!0,locale:!0}).extend({documentId:y.string().optional(),id:y.undefined().optional()}),Su=Xr.omit({id:!0,documentId:!0}).extend({id:y.number().optional(),documentId:y.string().optional(),items:y.lazy(()=>ya).or(y.null()).optional(),updated:y.boolean().optional(),removed:y.boolean().optional()}),ya=y.array(Su),xu=Ve(!1).extend({items:ya}).partial().required({id:!0,documentId:!0}),_u=y.enum(["collectionType","singleType"]),Au=y.object({singularName:y.string(),pluralName:y.string(),displayName:y.string(),description:y.string().optional(),name:y.string().optional()}),va=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()}),Tu=y.enum(["string","text","richtext","blocks","email","password","date","time","datetime","timestamp","boolean","integer","biginteger","float","decimal","json","relation","media"]),Cu=va.extend({type:Tu}),Ru=va.extend({type:y.literal("enumeration"),enum:y.string().array()}),Fu=y.object({type:y.literal("component"),component:y.string(),repeatable:y.boolean().optional()}),$u=y.object({type:y.literal("dynamiczone"),components:y.string().array()}),Iu=y.object({type:y.literal("uid")}),Ou=y.object({type:y.literal("media"),allowedTypes:y.enum(["images","videos","audios","files"]).array(),required:y.boolean().optional()}),Nu=y.enum(["oneToOne","oneToMany","manyToOne","manyToMany","morphToMany","manyToMorph"]),Pu=y.object({type:y.literal("relation"),relation:Nu,target:y.string(),mappedBy:y.string().optional(),inversedBy:y.string().optional()}),Lu=y.record(y.string(),y.union([Cu,Ru,Fu,$u,Pu,Ou,Iu])),Tr=y.object({kind:_u,collectionName:y.string(),info:Au,options:y.object({draftAndPublish:y.boolean().optional(),hidden:y.boolean().optional(),templateName:y.string().optional()}).optional(),attributes:Lu,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()});Tr.pick({info:!0,kind:!0,attributes:!0,options:!0});const Mt=(e,t)=>n=>{t(n(e()))};let Cr=vu;const ku=Mt(()=>Cr,e=>{Cr=e});let Rr=ma;const Du=Mt(()=>Rr,e=>{Rr=e});let Fr=ha;const Mu=Mt(()=>Fr,e=>{Fr=e});let $r=bu;const ju=Mt(()=>$r,e=>{$r=e});let Ir=xu;const Hu=Mt(()=>Ir,e=>{Ir=e}),Fe={get configSchema(){return Cr},get navigationItemAdditionalField(){return Rr},get navigationItemCustomField(){return Fr},get createNavigationSchema(){return $r},get updateNavigationSchema(){return Ir}},Bu=/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,Uu=["beforeCreate","beforeCreateMany","afterCreate","afterCreateMany","beforeUpdate","beforeUpdateMany","afterUpdate","afterUpdateMany","beforeDelete","beforeDeleteMany","afterDelete","afterDeleteMany","beforeCount","afterCount","beforeFindOne","afterFindOne","beforeFindMany","afterFindMany"],Gu="$",wa=["api::","plugin::"],Ea=["admin::","plugin::content-releases","plugin::i18n.locale","plugin::navigation","plugin::review-workflows","plugin::users-permissions","plugin::upload.folder"],qu=["title","subject","name"],Hi={SINGLE:"singleType"},Bi=["title","type","path","externalPath","uiRouterKey","menuAttached","order","collapsed","related","parent","master","audience","additionalFields"],Ku=e=>e.filter(t=>t!=="audience"),ba=e=>{const t=Ku(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(Bi,n.name))))throw new Error(`Name of custom field cannot be one of: ${Bi.join(", ")}`)},Sa=(e,t)=>{if(e==null)throw t??new Error("Non-empty value expected, empty given")},Wu=(e="")=>{const t=a=>a.split("-").map(o=>B.capitalize(o)).join(""),[n,r,i]=zu(e);return n==="api"?t(i):`${t(r)}${t(i)}`},zu=(e="")=>e.split(Bu).filter(t=>t&&t.length>0),Yu=(e,t)=>n=>[n,async r=>{await re(t,"common").runLifeCycleHook({contentTypeName:e,hookName:n,event:r})}],xa=(e,t)=>Object.fromEntries(Uu.map(Yu(e,t))),we=({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 re({strapi:e},t){return e.plugin("navigation").service(t)}const Yt=e=>e==="*"?"*":typeof e=="string"?[e]:e===!1?[]:e===!0?"*":e,Qu=(e="")=>{const t=!!wa.find(r=>e.includes(r)),n=!Ea.find(r=>e.includes(r)||e===r);return!!e&&t&&n},Ui=(e="")=>B.last(e)==="s"?e.substr(0,e.length-1):e,Vu=B.once(e=>({find(t,n){const{audienceModel:{uid:r}}=we(e);return e.strapi.query(r).findMany({where:t,limit:n}).then(ga.array().parse)}})),pn=(e,t)=>({findFirst(n,r,i={}){return e.strapi.documents(t).findFirst({populate:Yt(n),status:r,...i})},findById(n,r,i,a={}){return e.strapi.documents(t).findOne({documentId:n,populate:Yt(r),status:i,...a})},findManyById(n,r,i){return e.strapi.documents(t).findMany({where:{documentId:{$in:n}},populate:Yt(r),status:i})},findMany(n,r,i,a){return e.strapi.documents(t).findMany({where:n,populate:Yt(r),status:i,locale:a})},count(n,r){return e.strapi.documents(t).count({where:n,status:r})}}),Le=B.once(e=>({async save({item:t,locale:n}){const{itemModel:r}=we(e),{__type:i,documentId:a}=t?.related??{},o=i?pn(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:c,...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}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(Or)).then(ji.parse).then(s=>s.map(dn))},findV4({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i})},count(t){const{itemModel:n}=we(e);return e.strapi.query(n.uid).count({where:t})},remove(t){const{itemModel:n}=we(e);return e.strapi.documents(n.uid).delete({documentId:t.documentId,populate:"*"})},removeForIds(t){const{itemModel:n}=we(e);return t.map(r=>e.strapi.documents(n.uid).delete({documentId:r,populate:"*"}))},findForMasterIds(t){const{itemModel:n}=we(e);return e.strapi.query(n.uid).findMany({where:{$or:t.map(r=>({master:r}))},limit:Number.MAX_SAFE_INTEGER}).then(ji.parse)}})),Xu=["id","publishedAt","createdAt","updatedAt","locale"],dn=({related:e,items:t=[],...n})=>({...n,items:t.map(dn),related:e?B.omit(e,Xu):void 0}),Or=({related:e,...t})=>({...t,related:e?.[0]});class St extends Error{constructor(t,n){super(t),this.additionalInfo=n,this.type="NavigationError"}}class rr extends St{constructor(){super(...arguments),this.type="FillNavigationError"}}class Zu extends St{constructor(){super(...arguments),this.type="InvalidParamNavigationError"}}const Gi=e=>e===!0?!0:Array.isArray(e)?e.includes("items"):!1,_e=B.once(e=>({find({filters:t,locale:n,limit:r,orderBy:i,populate:a}){const{masterModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(({items:c,...f})=>({...f,items:c?.map(Or)}))).then(s=>s.map(({items:c,...f})=>({...f,items:c?.map(dn)}))).then(s=>Ve(Gi(a)).array().parse(s))},findOne({locale:t,filters:n,populate:r}){const{masterModel:i}=we(e);return e.strapi.documents(i.uid).findOne({documentId:n.documentId,locale:t,populate:r}).then(a=>a&&{...a,items:a.items?.map(Or)}).then(a=>Ve(Gi(r)).parse(a)).then(a=>({...a,items:a.items?.map(dn)}))},async save(t){const{masterModel:n}=we(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(Ve(!1).parse):e.strapi.documents(n.uid).create({locale:i,data:{...a,populate:["items"]}}).then(Ve(!1).parse)},remove(t){const{masterModel:n}=we(e);if(!t.documentId)throw new St("Document id is required.");return e.strapi.documents(n.uid).delete({documentId:t.documentId,locale:t.locale})}})),Ju=async e=>{const t=await _e(e).find({locale:"*",limit:Number.MAX_SAFE_INTEGER}),n=await e.strapi.plugin("i18n").service("locales").getDefaultLocale();await Promise.all(t.map(async r=>{t.find(({documentId:a,locale:o})=>a===r.documentId&&o===n)||await _e(e).remove({documentId:r.documentId,locale:r.locale})}))},_a=async({strapi:e,forceDefault:t=!1})=>{const n=e.store({type:"plugin",name:"navigation"}),r=await e.plugin("navigation").config,i=t?{}:{...Nr.default,...await n.get({key:"config"})??Nr.default};let a=B.isEmpty(i)?i:Fe.configSchema.parse(i);const o=el(a,r);return a={additionalFields:o("additionalFields"),contentTypes:o("contentTypes"),contentTypesNameFields:o("contentTypesNameFields"),contentTypesPopulate:o("contentTypesPopulate"),defaultContentType:o("defaultContentType"),allowedLevels:o("allowedLevels"),gql:o("gql"),pathDefaultFields:o("pathDefaultFields"),cascadeMenuAttached:o("cascadeMenuAttached"),preferCustomContentTypes:o("preferCustomContentTypes"),isCacheEnabled:o("isCacheEnabled")},tl(a,{strapi:e}),ba(a.additionalFields),await n.set({key:"config",value:a}),a},el=(e,t)=>n=>{const r=e?.[n]??t(n);return Sa(r,new Error(`[Navigation] Config "${n}" is undefined`)),r},tl=(e,{strapi:t})=>{const n=e.contentTypes.filter(i=>!t.contentTypes[i]);if(n.length===0)return;const r=n.map(Wu);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))},Nr={default:{additionalFields:[],allowedLevels:2,contentTypes:[],defaultContentType:"",contentTypesNameFields:{},contentTypesPopulate:{},gql:{navigationItemRelated:[]},pathDefaultFields:{},pruneObsoleteI18nNavigations:!1,cascadeMenuAttached:!0,preferCustomContentTypes:!1,isCacheEnabled:!1}},nl="Navigation",rl="navigation",il=async e=>{const t=re(e,"common"),{defaultLocale:n,restLocale:r=[]}=await t.readLocale(),i=_e(e),a=await i.find({limit:Number.MAX_SAFE_INTEGER,filters:{},locale:"*"});a.length===0&&a.push(await i.save({name:nl,visible:!0,locale:n,slug:rl}));const o=a.filter(({locale:s})=>s===n);for(const s of o)for(const c of r)!a.find(({locale:l,documentId:u})=>u===s.documentId&&c===l)&&await i.save({documentId:s.documentId,name:s.name,locale:c,visible:s.visible,slug:s.slug})},he={render:function(e){return`plugin::navigation.${e}`},navigation:{read:"read",update:"update",settings:"settings"}},ol=async({strapi:e})=>{const t=[{section:"plugins",displayName:"Read",uid:he.navigation.read,pluginName:"navigation"},{section:"plugins",displayName:"Update",uid:he.navigation.update,pluginName:"navigation"},{section:"plugins",displayName:"Settings",uid:he.navigation.settings,pluginName:"navigation"}];await e.admin.services.permission.actionProvider.registerMany(t)},al="I18NLocaleCode",sl=({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:al})},type:n(r("NavigationItem")),resolve(c,{navigationIdOrSlug:f,type:l,menuOnly:u,path:p,locale:d}){const h=Qr.z.string().parse(f);return re({strapi:e},"client").render({idOrSlug:h,type:l,rootPath:p,locale:d,menuOnly:u,wrapRelated:!0})}}},cl=({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:c,childUIKey:f,type:l,menuOnly:u}=s,p=Qr.z.string().parse(c);return re({strapi:e},"client").renderChildren({idOrSlug:p,childUIKey:f,type:l,menuOnly:u,wrapRelated:!0})}}},ul=e=>{const t={renderNavigationChild:cl,renderNavigation:sl};return e.nexus.extendType({type:"Query",definition(n){for(const[r,i]of Object.entries(t)){const a=i(e);n.field(r,a)}}})},ll=()=>({"Query.renderNavigationChild":{auth:!1},"Query.renderNavigation":{auth:!1}}),fl=({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")}}),pl=({nexus:e,strapi:t})=>e.objectType({name:"ContentTypesNameFields",async definition(n){n.nonNull.list.nonNull.string("default");const i=await re({strapi:t},"common").getPluginStore(),o=Fe.configSchema.parse(await i.get({key:"config"})).contentTypesNameFields;Object.keys(o||{}).forEach(s=>n.nonNull.list.string(s))}}),dl=({nexus:e})=>e.inputObjectType({name:"CreateNavigation",definition(t){t.nonNull.string("name"),t.nonNull.list.field("items",{type:"CreateNavigationItem"})}}),hl=({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"})}}),ml=({nexus:e})=>e.inputObjectType({name:"CreateNavigationRelated",definition(t){t.nonNull.string("ref"),t.nonNull.string("field"),t.nonNull.string("refId")}}),gl=({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")}}),yl=({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"})}}),vl=({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"})}}),wl=({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")}}),El=({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`)}})}}),bl=({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")}})},Sl=({nexus:e})=>e.enumType({name:"NavigationItemType",members:["INTERNAL","EXTERNAL","WRAPPER"]}),xl=({nexus:e})=>e.enumType({name:"NavigationRenderType",members:["FLAT","TREE"]}),_l=[El,bl,wl,xl,gl,vl,pl,fl,yl,ml,hl,dl,Sl],Al=e=>_l.map(t=>t(e)),Tl=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 re({strapi:e},"common").getPluginStore(),i=Fe.configSchema.parse(await r.get({key:"config"}));t.use(({strapi:a,nexus:o})=>{const s=Al({strapi:a,nexus:o,config:i}),c=ul({strapi:a,nexus:o}),f=ll();return{types:[s,c],resolversConfig:f}})},Cl=async({strapi:e})=>{!!e.plugin("graphql")&&await Tl({strapi:e})},Rl=async e=>{await Ju(e),await _a(e),await il(e),await ol(e),await Cl(e),await strapi.service("plugin::navigation.migrate").migrateRelatedIdToDocumentId(),strapi.db.lifecycles.subscribe({models:["plugin::i18n.locale"],async afterCreate(t){await re(e,"admin").refreshNavigationLocale(t.result?.code)}})},Fl=({strapi:e})=>{},$l=({strapi:e})=>{},Il={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"}}},Ol={schema:Il},Nl=xa("navigation",{strapi}),Pl={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"}}},Ll={schema:Pl,lifecycles:Nl},kl=xa("navigation-item",{strapi}),Dl={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:{}}}},Ml={schema:Dl,lifecycles:kl},jl={audience:Ol,navigation:Ll,"navigation-item":Ml},Aa=y.enum(["true","false"]),Qt=y.string(),Hl=y.object({locale:y.string().optional(),orderBy:y.string().optional(),orderDirection:y.enum(["DESC","ASC"]).optional()}),Ta=y.enum(["FLAT","TREE","RFR"]),Ca=y.enum(["draft","published"]),Ra=y.union([y.boolean(),y.string(),y.string().array(),y.undefined()]),Bl=y.object({type:Ta.optional(),menu:Aa.optional(),path:y.string().optional(),locale:y.string().optional(),populate:Ra.optional(),status:Ca.optional()}),Ul=y.object({type:Ta.optional(),menu:Aa.optional(),locale:y.string().optional(),status:Ca.optional()}),Gl=y.object({source:y.string().min(1),target:y.string().min(1),documentId:y.string().min(1)});function ql(e){return{getAdminService(){return re(e,"admin")},getCommonService(){return re(e,"common")},async get(){return await this.getAdminService().get({})},async post(t){const{auditLog:n}=t;try{return await this.getAdminService().post({payload:Fe.createNavigationSchema.parse(t.request.body),auditLog:n})}catch(r){const i=r instanceof Error?{name:r.name,message:r.message}:{};return t.internalServerError("Unable to create",{originalError:i})}},async put(t){const{params:{documentId:n},auditLog:r}=t,i=y.record(y.string(),y.unknown()).parse(t.request.body);try{return await this.getAdminService().put({auditLog:r,payload:Fe.updateNavigationSchema.parse({...i,documentId:n})})}catch(a){const o=a instanceof Error?{name:a.name,message:a.message}:{};return t.internalServerError("Unable to update",{originalError:o})}},async delete(t){const{auditLog:n,params:{documentId:r}}=t;return await this.getAdminService().delete({documentId:Qt.parse(r),auditLog:n}),{}},config(){return this.getAdminService().config({viaSettingsPage:!1})},async updateConfig(t){return await this.getAdminService().updateConfig({config:Fe.configSchema.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:Qt.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}=Gl.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:Qt.parse(n),target:Qt.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 Kl=e=>{if(!(!e||e===!0||e==="*")&&typeof e!="object")return Array.isArray(e),e};function Wl(e){return{getService(){return re(e,"client")},async readAll(t){try{const{query:n={}}=t,{locale:r,orderBy:i,orderDirection:a}=Hl.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:c,status:f="published"}=Bl.parse(r),l=y.string().parse(n.idOrSlug);return await this.getService().render({idOrSlug:l,type:i,menuOnly:a==="true",rootPath:o,locale:s,populate:Kl(Ra.parse(c==="true"?!0:c==="false"?!1:Array.isArray(c)?c.map(u=>u==="true"?!0:u==="false"?!1:c):c)),status:f})},async renderChild(t){const{params:n,query:r={}}=t,{type:i,menu:a,locale:o,status:s="published"}=Ul.parse(r),c=y.string().parse(n.idOrSlug),f=y.string().parse(n.childUIKey);return await this.getService().renderChildren({idOrSlug:c,childUIKey:f,type:i,menuOnly:a==="true",locale:o,status:s})}}}const zl={admin:ql,client:Wl},Yl={},Ql={},Vl={type:"admin",routes:[{method:"GET",path:"/",handler:"admin.get",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"POST",path:"/",handler:"admin.post",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/config",handler:"admin.config",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"PUT",path:"/config",handler:"admin.updateConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"DELETE",path:"/config",handler:"admin.restoreConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.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:[he.render("read")]}}]}},{method:"PUT",path:"/:documentId",handler:"admin.put",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"DELETE",path:"/:documentId",handler:"admin.delete",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.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:[he.render("settings")]}}]}},{method:"GET",path:"/settings/restart",handler:"admin.settingsRestart",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"PUT",path:"/i18n/copy/:documentId/:source/:target",handler:"admin.fillFromOtherLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/i18n/item/read/:source/:target",handler:"admin.readNavigationItemFromLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}}]},Xl={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:[]}}]},Zl={admin:Vl,"content-api":Xl};function Jl(e,t){return me.default.has(process.env,e)?process.env[e]:t}function st(e){return process.env[e]??""}const ef={int(e,t){return me.default.has(process.env,e)?parseInt(st(e),10):t},float(e,t){return me.default.has(process.env,e)?parseFloat(st(e)):t},bool(e,t){return me.default.has(process.env,e)?st(e)==="true":t},json(e,t){if(!me.default.has(process.env,e))return t;try{return JSON.parse(st(e))}catch(n){throw n instanceof Error?new Error(`Invalid json environment variable ${e}: ${n.message}`):n}},array(e,t){if(!me.default.has(process.env,e))return t;let n=st(e);return n.startsWith("[")&&n.endsWith("]")&&(n=n.substring(1,n.length-1)),n.split(",").map(r=>me.default.trim(me.default.trim(r," "),'"'))},date(e,t){return me.default.has(process.env,e)?new Date(st(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=tf(e,n);return t.includes(r)?r:n}},tf=Object.assign(Jl,ef),nf="id",rf="documentId",of={ID_ATTRIBUTE:nf,DOC_ID_ATTRIBUTE:rf},af=e=>C.union(strapi?.config?.get("api.responses.privateAttributes",[])??[],C.getOr([],"options.privateAttributes",e)),sf=(e,t)=>e?.attributes?.[t]?.private===!0?!0:af(e).includes(t),Fa=e=>e&&!["media","component","relation","dynamiczone"].includes(e.type),cf=e=>e?.type==="media",$a=e=>e?.type==="relation",uf=e=>!!e&&e.type==="dynamiczone",Ia=e=>!!e&&$a(e)&&e.relation?.startsWith?.("morphTo"),ht=async(e,t,n)=>{const{path:r={raw:null,attribute:null,rawWithIndices: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 ht(m,T,b)},c=m=>async(g,b,S)=>ht(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 ht(m,A,b)},l=async(m,g,b,S)=>ht(m,{schema:b,path:g,getModel:a,parent:o},S),u=async(m,g,b)=>{const T={schema:a(b.__component),path:g,getModel:a,parent:o};return ht(m,T,b)};if(!C.isObject(n)||C.isNil(i))return n;const p=C.clone(n),d=lf({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=C.isNil(r.raw)?g:`${r.raw}.${g}`,S.rawWithIndices=C.isNil(r.rawWithIndices)?g:`${r.rawWithIndices}.${g}`,C.isNil(b)||(S.attribute=C.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(!(C.isNil(A)||C.isNil(b))){if($a(b)){o={schema:i,key:g,attribute:b,path:S};const F=b.relation.toLowerCase().startsWith("morph")?s:c(a(b.target));if(C.isArray(A)){const D=new Array(A.length);for(let x=0;x<A.length;x+=1){const _={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${x}`:`${S.rawWithIndices}.${x}`};D[x]=await F(e,_,A[x])}p[g]=D}else p[g]=await F(e,S,A);continue}if(cf(b)){if(o={schema:i,key:g,attribute:b,path:S},C.isArray(A)){const R=new Array(A.length);for(let F=0;F<A.length;F+=1){const D={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${F}`:`${S.rawWithIndices}.${F}`};R[F]=await f(e,D,A[F])}p[g]=R}else p[g]=await f(e,S,A);continue}if(b.type==="component"){o={schema:i,key:g,attribute:b,path:S};const R=a(b.component);if(C.isArray(A)){const F=new Array(A.length);for(let D=0;D<A.length;D+=1){const x={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${D}`:`${S.rawWithIndices}.${D}`};F[D]=await l(e,x,R,A[D])}p[g]=F}else p[g]=await l(e,S,R,A);continue}if(b.type==="dynamiczone"&&C.isArray(A)){o={schema:i,key:g,attribute:b,path:S};const R=new Array(A.length);for(let F=0;F<A.length;F+=1){const D={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${F}`:`${S.rawWithIndices}.${F}`};R[F]=await u(e,D,A[F])}p[g]=R;continue}}}return p},lf=({data:e})=>({remove(t){delete e[t]},set(t,n){e[t]=n}});var ff=C.curry(ht),Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pf={exports:{}};(function(e,t){(function(n,r){e.exports=r(ln.default,ki.default)})(Ee,function(n,r){return(function(i){function a(s){if(o[s])return o[s].exports;var c=o[s]={exports:{},id:s,loaded:!1};return i[s].call(c.exports,c,c.exports,a),c.loaded=!0,c.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"),c=o(33),f=o(2).Symbol,l=typeof f=="function",u=i.exports=function(p){return s[p]||(s[p]=l&&f[p]||(l?f:c)("Symbol."+p))};u.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(c){if(!s(c))throw TypeError(c+" is not an object!");return c}},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),c=o(17);i.exports=o(4)?function(f,l,u){return s.f(f,l,c(1,u))}:function(f,l,u){return f[l]=u,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(c,f,l){if(s(c),f===void 0)return c;switch(l){case 1:return function(u){return c.call(f,u)};case 2:return function(u,p){return c.call(f,u,p)};case 3:return function(u,p,d){return c.call(f,u,p,d)}}return function(){return c.apply(f,arguments)}}},function(i,a){var o={}.hasOwnProperty;i.exports=function(s,c){return o.call(s,c)}},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),c=o(26),f=o(32),l=Object.defineProperty;a.f=o(4)?Object.defineProperty:function(u,p,d){if(s(u),p=f(p,!0),s(d),c)try{return l(u,p,d)}catch{}if("get"in d||"set"in d)throw TypeError("Accessors not supported!");return"value"in d&&(u[p]=d.value),u}},function(i,a,o){var s=o(42),c=o(15);i.exports=function(f){return s(c(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),c=o(2).document,f=s(c)&&s(c.createElement);i.exports=function(l){return f?c.createElement(l):{}}},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,c=o(8),f=o(1)("toStringTag");i.exports=function(l,u,p){l&&!c(l=p?l:l.prototype,f)&&s(l,f,{configurable:!0,value:u})}},function(i,a,o){var s=o(29)("keys"),c=o(33);i.exports=function(f){return s[f]||(s[f]=c(f))}},function(i,a){var o=Math.ceil,s=Math.floor;i.exports=function(c){return isNaN(c=+c)?0:(c>0?s:o)(c)}},function(i,a,o){var s=o(11),c=o(1)("toStringTag"),f=s((function(){return arguments})())=="Arguments",l=function(u,p){try{return u[p]}catch{}};i.exports=function(u){var p,d,h;return u===void 0?"Undefined":u===null?"Null":typeof(d=l(p=Object(u),c))=="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),c=o(6),f=o(7),l=o(5),u="prototype",p=function(d,h,m){var g,b,S,T=d&p.F,A=d&p.G,R=d&p.S,F=d&p.P,D=d&p.B,x=d&p.W,_=A?c:c[h]||(c[h]={}),N=_[u],v=A?s:R?s[h]:(s[h]||{})[u];A&&(m=h);for(g in m)b=!T&&v&&v[g]!==void 0,b&&g in _||(S=b?v[g]:m[g],_[g]=A&&typeof v[g]!="function"?m[g]:D&&b?f(S,s):x&&v[g]==S?(function(j){var H=function(K,w,E){if(this instanceof j){switch(arguments.length){case 0:return new j;case 1:return new j(K);case 2:return new j(K,w)}return new j(K,w,E)}return j.apply(this,arguments)};return H[u]=j[u],H})(S):F&&typeof S=="function"?f(Function.call,S):S,F&&((_.virtual||(_.virtual={}))[g]=S,d&p.R&&N&&!N[g]&&l(N,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),c=o(23),f=o(57),l=o(5),u=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",R=function(){return this};i.exports=function(F,D,x,_,N,v,j){d(x,D,_);var H,K,w,E=function(M){if(!b&&M in z)return z[M];switch(M){case T:return function(){return new x(this,M)};case A:return function(){return new x(this,M)}}return function(){return new x(this,M)}},$=D+" Iterator",k=N==A,U=!1,z=F.prototype,V=z[g]||z[S]||N&&z[N],ee=V||E(N),Ce=N?k?E("entries"):ee:void 0,I=D=="Array"&&z.entries||V;if(I&&(w=m(I.call(new F)),w!==Object.prototype&&(h(w,$,!0),s||u(w,g)||l(w,g,R))),k&&V&&V.name!==A&&(U=!0,ee=function(){return V.call(this)}),s&&!j||!b&&!U&&z[g]||l(z,g,ee),p[D]=ee,p[$]=R,N)if(H={values:k?ee:E(A),keys:v?ee:E(T),entries:Ce},j)for(K in H)K in z||f(z,K,H[K]);else c(c.P+c.F*(b||U),D,H);return H}},function(i,a){i.exports=!0},function(i,a,o){var s=o(2),c="__core-js_shared__",f=s[c]||(s[c]={});i.exports=function(l){return f[l]||(f[l]={})}},function(i,a,o){var s,c,f,l=o(7),u=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={},R="onreadystatechange",F=function(){var x=+this;if(A.hasOwnProperty(x)){var _=A[x];delete A[x],_()}},D=function(x){F.call(x.data)};g&&b||(g=function(x){for(var _=[],N=1;arguments.length>N;)_.push(arguments[N++]);return A[++T]=function(){u(typeof x=="function"?x:Function(x),_)},s(T),T},b=function(x){delete A[x]},o(11)(m)=="process"?s=function(x){m.nextTick(l(F,x,1))}:S?(c=new S,f=c.port2,c.port1.onmessage=D,s=l(f.postMessage,f,1)):h.addEventListener&&typeof postMessage=="function"&&!h.importScripts?(s=function(x){h.postMessage(x+"","*")},h.addEventListener("message",D,!1)):s=R in d("script")?function(x){p.appendChild(d("script"))[R]=function(){p.removeChild(this),F.call(x)}}:function(x){setTimeout(l(F,x,1),0)}),i.exports={set:g,clear:b}},function(i,a,o){var s=o(20),c=Math.min;i.exports=function(f){return f>0?c(s(f),9007199254740991):0}},function(i,a,o){var s=o(9);i.exports=function(c,f){if(!s(c))return c;var l,u;if(f&&typeof(l=c.toString)=="function"&&!s(u=l.call(c))||typeof(l=c.valueOf)=="function"&&!s(u=l.call(c))||!f&&typeof(l=c.toString)=="function"&&!s(u=l.call(c)))return u;throw TypeError("Can't convert object to primitive value")}},function(i,a){var o=0,s=Math.random();i.exports=function(c){return"Symbol(".concat(c===void 0?"":c,")_",(++o+s).toString(36))}},function(i,a,o){function s(R){return R&&R.__esModule?R:{default:R}}function c(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function f(R){return(0,g.createHash)("sha256").update(R).digest("hex")}function l(R){switch(S){case"darwin":return R.split("IOPlatformUUID")[1].split(`
2
2
  `)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return R.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return R.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return R.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function u(R){var F=l((0,m.execSync)(A[S]).toString());return R?F:f(F)}function p(R){return new h.default(function(F,D){return(0,m.exec)(A[S],{},function(x,_,N){if(x)return D(new Error("Error while obtaining machine id: "+x.stack));var v=l(_.toString());return F(R?v:f(v))})})}Object.defineProperty(a,"__esModule",{value:!0});var d=o(35),h=s(d);a.machineIdSync=u,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[c()]+"\\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,c,f){if(!(o instanceof s)||f!==void 0&&f in o)throw TypeError(c+": incorrect invocation!");return o}},function(i,a,o){var s=o(13),c=o(31),f=o(62);i.exports=function(l){return function(u,p,d){var h,m=s(u),g=c(m.length),b=f(d,g);if(l&&p!=p){for(;g>b;)if(h=m[b++],h!=h)return!0}else for(;g>b;b++)if((l||b in m)&&m[b]===p)return l||b||0;return!l&&-1}}},function(i,m,o){var s=o(7),c=o(44),f=o(43),l=o(3),u=o(31),p=o(64),d={},h={},m=i.exports=function(g,b,S,T,A){var R,F,D,x,_=A?function(){return g}:p(g),N=s(S,T,b?2:1),v=0;if(typeof _!="function")throw TypeError(g+" is not iterable!");if(f(_)){for(R=u(g.length);R>v;v++)if(x=b?N(l(F=g[v])[0],F[1]):N(g[v]),x===d||x===h)return x}else for(D=_.call(g);!(F=D.next()).done;)if(x=c(D,N,F.value,b),x===d||x===h)return x};m.BREAK=d,m.RETURN=h},function(i,a){i.exports=function(o,s,c){var f=c===void 0;switch(s.length){case 0:return f?o():o.call(c);case 1:return f?o(s[0]):o.call(c,s[0]);case 2:return f?o(s[0],s[1]):o.call(c,s[0],s[1]);case 3:return f?o(s[0],s[1],s[2]):o.call(c,s[0],s[1],s[2]);case 4:return f?o(s[0],s[1],s[2],s[3]):o.call(c,s[0],s[1],s[2],s[3])}return o.apply(c,s)}},function(i,a,o){var s=o(11);i.exports=Object("z").propertyIsEnumerable(0)?Object:function(c){return s(c)=="String"?c.split(""):Object(c)}},function(i,a,o){var s=o(10),c=o(1)("iterator"),f=Array.prototype;i.exports=function(l){return l!==void 0&&(s.Array===l||f[c]===l)}},function(i,a,o){var s=o(3);i.exports=function(c,f,l,u){try{return u?f(s(l)[0],l[1]):f(l)}catch(d){var p=c.return;throw p!==void 0&&s(p.call(c)),d}}},function(i,a,o){var s=o(49),c=o(17),f=o(18),l={};o(5)(l,o(1)("iterator"),function(){return this}),i.exports=function(u,p,d){u.prototype=s(l,{next:c(1,d)}),f(u,p+" Iterator")}},function(i,a,o){var s=o(1)("iterator"),c=!1;try{var f=[7][s]();f.return=function(){c=!0},Array.from(f,function(){throw 2})}catch{}i.exports=function(l,u){if(!u&&!c)return!1;var p=!1;try{var d=[7],h=d[s]();h.next=function(){return{done:p=!0}},d[s]=function(){return h},l(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),c=o(30).set,f=s.MutationObserver||s.WebKitMutationObserver,l=s.process,u=s.Promise,p=o(11)(l)=="process";i.exports=function(){var d,h,m,g=function(){var A,R;for(p&&(A=l.domain)&&A.exit();d;){R=d.fn,d=d.next;try{R()}catch(F){throw d?m():h=void 0,F}}h=void 0,A&&A.enter()};if(p)m=function(){l.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(u&&u.resolve){var T=u.resolve();m=function(){T.then(g)}}else m=function(){c.call(s,g)};return function(A){var R={fn:A,next:void 0};h&&(h.next=R),d||(d=R,m()),h=R}}},function(i,a,o){var s=o(3),c=o(50),f=o(22),l=o(19)("IE_PROTO"),u=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?(u[p]=s(h),g=new u,u[p]=null,g[l]=h):g=d(),m===void 0?g:c(g,m)}},function(i,a,o){var s=o(12),c=o(3),f=o(54);i.exports=o(4)?Object.defineProperties:function(l,u){c(l);for(var p,d=f(u),h=d.length,m=0;h>m;)s.f(l,p=d[m++],u[p]);return l}},function(i,a,o){var s=o(55),c=o(17),f=o(13),l=o(32),u=o(8),p=o(26),d=Object.getOwnPropertyDescriptor;a.f=o(4)?d:function(h,m){if(h=f(h),m=l(m,!0),p)try{return d(h,m)}catch{}if(u(h,m))return c(!s.f.call(h,m),h[m])}},function(i,a,o){var s=o(8),c=o(63),f=o(19)("IE_PROTO"),l=Object.prototype;i.exports=Object.getPrototypeOf||function(u){return u=c(u),s(u,f)?u[f]:typeof u.constructor=="function"&&u instanceof u.constructor?u.constructor.prototype:u instanceof Object?l:null}},function(i,a,o){var s=o(8),c=o(13),f=o(39)(!1),l=o(19)("IE_PROTO");i.exports=function(u,p){var d,h=c(u),m=0,g=[];for(d in h)d!=l&&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),c=o(22);i.exports=Object.keys||function(f){return s(f,c)}},function(i,a){a.f={}.propertyIsEnumerable},function(i,a,o){var s=o(5);i.exports=function(c,f,l){for(var u in f)l&&c[u]?c[u]=f[u]:s(c,u,f[u]);return c}},function(i,a,o){i.exports=o(5)},function(i,a,o){var s=o(9),c=o(3),f=function(l,u){if(c(l),!s(u)&&u!==null)throw TypeError(u+": can't set as prototype!")};i.exports={set:Object.setPrototypeOf||("__proto__"in{}?(function(l,u,p){try{p=o(7)(Function.call,o(51).f(Object.prototype,"__proto__").set,2),p(l,[]),u=!(l instanceof Array)}catch{u=!0}return function(d,h){return f(d,h),u?d.__proto__=h:p(d,h),d}})({},!1):void 0),check:f}},function(i,a,o){var s=o(2),c=o(6),f=o(12),l=o(4),u=o(1)("species");i.exports=function(p){var d=typeof c[p]=="function"?c[p]:s[p];l&&d&&!d[u]&&f.f(d,u,{configurable:!0,get:function(){return this}})}},function(i,a,o){var s=o(3),c=o(14),f=o(1)("species");i.exports=function(l,u){var p,d=s(l).constructor;return d===void 0||(p=s(d)[f])==null?u:c(p)}},function(i,a,o){var s=o(20),c=o(15);i.exports=function(f){return function(l,u){var p,d,h=String(c(l)),m=s(u),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),c=Math.max,f=Math.min;i.exports=function(l,u){return l=s(l),l<0?c(l+u,0):f(l,u)}},function(i,a,o){var s=o(15);i.exports=function(c){return Object(s(c))}},function(i,a,o){var s=o(21),c=o(1)("iterator"),f=o(10);i.exports=o(6).getIteratorMethod=function(l){if(l!=null)return l[c]||l["@@iterator"]||f[s(l)]}},function(i,a,o){var s=o(37),c=o(47),f=o(10),l=o(13);i.exports=o(27)(Array,"Array",function(u,p){this._t=l(u),this._i=0,this._k=p},function(){var u=this._t,p=this._k,d=this._i++;return!u||d>=u.length?(this._t=void 0,c(1)):p=="keys"?c(0,d):p=="values"?c(0,u[d]):c(0,[d,u[d]])},"values"),f.Arguments=f.Array,s("keys"),s("values"),s("entries")},function(i,a){},function(i,a,o){var s,c,f,l=o(28),u=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,R=o(48)(),F="Promise",D=u.TypeError,_=u.process,x=u[F],_=u.process,N=d(_)=="process",v=function(){},j=!!(function(){try{var I=x.resolve(1),M=(I.constructor={})[o(1)("species")]=function(P){P(v,v)};return(N||typeof PromiseRejectionEvent=="function")&&I.then(v)instanceof M}catch{}})(),H=function(I,M){return I===M||I===x&&M===f},K=function(I){var M;return!(!m(I)||typeof(M=I.then)!="function")&&M},w=function(I){return H(x,I)?new E(I):new c(I)},E=c=function(I){var M,P;this.promise=new I(function(Q,ue){if(M!==void 0||P!==void 0)throw D("Bad Promise constructor");M=Q,P=ue}),this.resolve=g(M),this.reject=g(P)},$=function(I){try{I()}catch(M){return{error:M}}},k=function(I,M){if(!I._n){I._n=!0;var P=I._c;R(function(){for(var Q=I._v,ue=I._s==1,L=0,Y=function(O){var q,X,oe=ue?O.ok:O.fail,Z=O.resolve,Ne=O.reject,je=O.domain;try{oe?(ue||(I._h==2&&V(I),I._h=1),oe===!0?q=Q:(je&&je.enter(),q=oe(Q),je&&je.exit()),q===O.promise?Ne(D("Promise-chain cycle")):(X=K(q))?X.call(q,Z,Ne):Z(q)):Ne(Q)}catch(Gc){Ne(Gc)}};P.length>L;)Y(P[L++]);I._c=[],I._n=!1,M&&!I._h&&U(I)})}},U=function(I){A.call(u,function(){var M,P,Q,ue=I._v;if(z(I)&&(M=$(function(){N?_.emit("unhandledRejection",ue,I):(P=u.onunhandledrejection)?P({promise:I,reason:ue}):(Q=u.console)&&Q.error&&Q.error("Unhandled promise rejection",ue)}),I._h=N||z(I)?2:1),I._a=void 0,M)throw M.error})},z=function(I){if(I._h==1)return!1;for(var M,P=I._a||I._c,Q=0;P.length>Q;)if(M=P[Q++],M.fail||!z(M.promise))return!1;return!0},V=function(I){A.call(u,function(){var M;N?_.emit("rejectionHandled",I):(M=u.onrejectionhandled)&&M({promise:I,reason:I._v})})},ee=function(I){var M=this;M._d||(M._d=!0,M=M._w||M,M._v=I,M._s=2,M._a||(M._a=M._c.slice()),k(M,!0))},Ce=function(I){var M,P=this;if(!P._d){P._d=!0,P=P._w||P;try{if(P===I)throw D("Promise can't be resolved itself");(M=K(I))?R(function(){var Q={_w:P,_d:!1};try{M.call(I,p(Ce,Q,1),p(ee,Q,1))}catch(ue){ee.call(Q,ue)}}):(P._v=I,P._s=1,k(P,!1))}catch(Q){ee.call({_w:P,_d:!1},Q)}}};j||(x=function(I){b(this,x,F,"_h"),g(I),s.call(this);try{I(p(Ce,this,1),p(ee,this,1))}catch(M){ee.call(this,M)}},s=function(I){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(I,M){var P=w(T(this,x));return P.ok=typeof I!="function"||I,P.fail=typeof M=="function"&&M,P.domain=N?_.domain:void 0,this._c.push(P),this._a&&this._a.push(P),this._s&&k(this,!1),P.promise},catch:function(I){return this.then(void 0,I)}}),E=function(){var I=new s;this.promise=I,this.resolve=p(Ce,I,1),this.reject=p(ee,I,1)}),h(h.G+h.W+h.F*!j,{Promise:x}),o(18)(x,F),o(59)(F),f=o(6)[F],h(h.S+h.F*!j,F,{reject:function(I){var M=w(this),P=M.reject;return P(I),M.promise}}),h(h.S+h.F*(l||!j),F,{resolve:function(I){if(I instanceof x&&H(I.constructor,this))return I;var M=w(this),P=M.resolve;return P(I),M.promise}}),h(h.S+h.F*!(j&&o(46)(function(I){x.all(I).catch(v)})),F,{all:function(I){var M=this,P=w(M),Q=P.resolve,ue=P.reject,L=$(function(){var Y=[],O=0,q=1;S(I,!1,function(X){var oe=O++,Z=!1;Y.push(void 0),q++,M.resolve(X).then(function(Ne){Z||(Z=!0,Y[oe]=Ne,--q||Q(Y))},ue)}),--q||Q(Y)});return L&&ue(L.error),P.promise},race:function(I){var M=this,P=w(M),Q=P.reject,ue=$(function(){S(I,!1,function(L){M.resolve(L).then(P.resolve,Q)})});return ue&&Q(ue.error),P.promise}})},function(i,a,o){var s=o(61)(!0);o(27)(String,"String",function(c){this._t=String(c),this._i=0},function(){var c,f=this._t,l=this._i;return l>=f.length?{value:void 0,done:!0}:(c=s(f,l),this._i+=c.length,{value:c,done:!1})})},function(i,a,o){o(65);for(var s=o(2),c=o(5),f=o(10),l=o(1)("toStringTag"),u=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],p=0;p<5;p++){var d=u[p],h=s[d],m=h&&h.prototype;m&&!m[l]&&c(m,l,d),f[d]=f.Array}},function(i,a){i.exports=ln.default},function(i,a){i.exports=ki.default}])})})(pf);var Pr;try{Pr=Map}catch{}var Lr;try{Lr=Set}catch{}function Na(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(kr);if(Pr&&e instanceof Pr)return new Map(Array.from(e.entries()));if(Lr&&e instanceof Lr)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]:Na(e[i],t,n)}return r}return e}function kr(e){return Na(e,[],[])}const df=Object.prototype.toString,hf=Error.prototype.toString,mf=RegExp.prototype.toString,gf=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",yf=/^Symbol\((.*)\)(.*)$/;function vf(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function qi(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const n=typeof e;if(n==="number")return vf(e);if(n==="string")return t?`"${e}"`:e;if(n==="function")return"[Function "+(e.name||"anonymous")+"]";if(n==="symbol")return gf.call(e).replace(yf,"Symbol($1)");const r=df.call(e).slice(8,-1);return r==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):r==="Error"||e instanceof Error?"["+hf.call(e)+"]":r==="RegExp"?mf.call(e):null}function xt(e,t){let n=qi(e,t);return n!==null?n:JSON.stringify(e,function(r,i){let a=qi(this[r],t);return a!==null?a:i},2)}let Ye={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"},Ie={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"},wf={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"},Dr={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Ef={isValue:"${path} field must be ${value}"},Mr={noUnknown:"${path} field has unspecified keys: ${unknown}"},rn={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 bf=Object.assign(Object.create(null),{mixed:Ye,string:Ie,number:wf,date:Dr,object:Mr,array:rn,boolean:Ef}),Dn=(e=>e&&e.__isYupSchema__);class Sf{constructor(t,n){if(this.refs=t,this.refs=t,typeof n=="function"){this.fn=n;return}if(!fn.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(c=>c===r);this.fn=function(...s){let c=s.pop(),f=s.pop(),l=o(...s)?i:a;if(l)return typeof l=="function"?l(f):f.concat(l.resolve(c))}}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(!Dn(i))throw new TypeError("conditions must return a schema object");return i.resolve(n)}}function Pa(e){return e==null?[]:[].concat(e)}function jr(){return jr=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},jr.apply(this,arguments)}let xf=/\$\{\s*(\w+)\s*\}/g;class ge extends Error{static formatError(t,n){const r=n.label||n.path||"this";return r!==n.path&&(n=jr({},n,{path:r})),typeof t=="string"?t.replace(xf,(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=[],Pa(t).forEach(a=>{ge.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,ge)}}const _f=e=>{let t=!1;return(...n)=>{t||(t=!0,e(...n))}};function hn(e,t){let{endEarly:n,tests:r,args:i,value:a,errors:o,sort:s,path:c}=e,f=_f(t),l=r.length;const u=[];if(o=o||[],!l)return o.length?f(new ge(o,a,c)):f(null,a);for(let p=0;p<r.length;p++){const d=r[p];d(i,function(m){if(m){if(!ge.isError(m))return f(m,a);if(n)return m.value=a,f(m,a);u.push(m)}if(--l<=0){if(u.length&&(s&&u.sort(s),o.length&&u.push(...o),o=u),o.length){f(new ge(o,a,c),a);return}f(null,a)}})}}function ot(e){this._maxSize=e,this.clear()}ot.prototype.clear=function(){this._size=0,this._values=Object.create(null)};ot.prototype.get=function(e){return this._values[e]};ot.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,La=/^\d+$/,Tf=/^\d/,Cf=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Rf=/^\s*(['"]?)(.*?)(\1)\s*$/,Zr=512,Ki=new ot(Zr),Wi=new ot(Zr),zi=new ot(Zr),Mn={Cache:ot,split:Hr,normalizePath:ir,setter:function(e){var t=ir(e);return Wi.get(e)||Wi.set(e,function(r,i){for(var a=0,o=t.length,s=r;a<o-1;){var c=t[a];if(c==="__proto__"||c==="constructor"||c==="prototype")return r;s=s[t[a++]]}s[t[a]]=i})},getter:function(e,t){var n=ir(e);return zi.get(e)||zi.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+(Jr(n)||La.test(n)?"["+n+"]":(t?".":"")+n)},"")},forEach:function(e,t,n){Ff(Array.isArray(e)?e:Hr(e),t,n)}};function ir(e){return Ki.get(e)||Ki.set(e,Hr(e).map(function(t){return t.replace(Rf,"$2")}))}function Hr(e){return e.match(Af)||[""]}function Ff(e,t,n){var r=e.length,i,a,o,s;for(a=0;a<r;a++)i=e[a],i&&(Of(i)&&(i='"'+i+'"'),s=Jr(i),o=!s&&/^\d+$/.test(i),t.call(n,i,s,o,a,e))}function Jr(e){return typeof e=="string"&&e&&["'",'"'].indexOf(e.charAt(0))!==-1}function $f(e){return e.match(Tf)&&!e.match(La)}function If(e){return Cf.test(e)}function Of(e){return!Jr(e)&&($f(e)||If(e))}const Vt={context:"$",value:"."};class tt{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]===Vt.context,this.isValue=this.key[0]===Vt.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Vt.context:this.isValue?Vt.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Mn.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}}tt.prototype.__isYupRef=!0;function mn(){return mn=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},mn.apply(this,arguments)}function Nf(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 Xt(e){function t(n,r){let{value:i,path:a="",label:o,options:s,originalValue:c,sync:f}=n,l=Nf(n,["value","path","label","options","originalValue","sync"]);const{name:u,test:p,params:d,message:h}=e;let{parent:m,context:g}=s;function b(F){return tt.isRef(F)?F.getValue(i,m,g):F}function S(F={}){const D=pa.default(mn({value:i,originalValue:c,label:o,path:F.path||a},d,F.params),b),x=new ge(ge.formatError(F.message||h,D),i,D.path,F.type||u);return x.params=D,x}let T=mn({path:a,parent:m,type:u,createError:S,resolve:b,options:s,originalValue:c},l);if(!f){try{Promise.resolve(p.call(T,i,T)).then(F=>{ge.isError(F)?r(F):F?r(null,F):r(S())})}catch(F){r(F)}return}let A;try{var R;if(A=p.call(T,i,T),typeof((R=A)==null?void 0:R.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}ge.isError(A)?r(A):A?r(null,A):r(S())}return t.OPTIONS=e,t}let Pf=e=>e.substr(0,e.length-1).substr(1);function Lf(e,t,n,r=n){let i,a,o;return t?(Mn.forEach(t,(s,c,f)=>{let l=c?Pf(s):s;if(e=e.resolve({context:r,parent:i,value:n}),e.innerType){let u=f?parseInt(l,10):0;if(n&&u>=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[u],e=e.innerType}if(!f){if(!e.fields||!e.fields[l])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[l],e=e.fields[l]}a=l,o=c?"["+s+"]":"."+s}),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}class gn{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){tt.isRef(t)?this.refs.set(t.key,t):this.list.add(t)}delete(t){tt.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 gn;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 Re(){return Re=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},Re.apply(this,arguments)}class ye{constructor(t){this.deps=[],this.conditions=[],this._whitelist=new gn,this._blacklist=new gn,this.exclusiveTests=Object.create(null),this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Ye.notType)}),this.type=t?.type||"mixed",this.spec=Re({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=Re({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=kr(Re({},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=Re({},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(Re({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}
@@ -525,7 +525,7 @@ const uo = (e) => e === !0 ? !0 : Array.isArray(e) ? e.includes("items") : !1, S
525
525
  return e.strapi.documents(n.uid).delete({ documentId: t.documentId, locale: t.locale });
526
526
  }
527
527
  })), El = async (e) => {
528
- const t = await Se(e).find({ locale: "*", limit: Number.MAX_SAFE_INTEGER }), n = e.strapi.plugin("i18n").service("locales").getDefaultLocale().code;
528
+ const t = await Se(e).find({ locale: "*", limit: Number.MAX_SAFE_INTEGER }), n = await e.strapi.plugin("i18n").service("locales").getDefaultLocale();
529
529
  await Promise.all(t.map(async (r) => {
530
530
  t.find(({ documentId: a, locale: o }) => a === r.documentId && o === n) || await Se(e).remove({ documentId: r.documentId, locale: r.locale });
531
531
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-navigation",
3
- "version": "3.2.6-beta.1",
3
+ "version": "3.2.6-beta.2",
4
4
  "description": "Strapi - Navigation plugin",
5
5
  "strapi": {
6
6
  "name": "navigation",