UNPKG

strapi-plugin-navigation

Version:
2 lines 251 kB
"use strict";const B=require("lodash"),Qr=require("zod"),R=require("lodash/fp"),Uu=require("crypto"),Gu=require("child_process"),qu=require("lodash/has"),Ku=require("lodash/mapValues"),Wu=require("lodash/snakeCase"),zu=require("lodash/camelCase"),Yu=require("lodash/mapKeys"),Qu=require("os"),Vu=require("path"),Xu=require("fs"),Zu=require("assert"),Ju=require("events"),ec=require("buffer"),tc=require("stream"),nc=require("util"),rc=require("constants");require("node:stream");const ic=require("@sindresorhus/slugify"),oc=require("zod/v4"),ac=require("pluralize"),ue=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=ue(B),y=fa(Qr),ki=ue(Uu),ln=ue(Gu),fn=ue(qu),pa=ue(Ku),Di=ue(Wu),sc=ue(zu),uc=ue(Yu),Ln=ue(Qu),Se=ue(Vu),We=ue(Xu),da=ue(Zu),cc=ue(Ju),lc=ue(ec),kn=ue(tc),it=ue(nc),fc=ue(rc),pc=ue(ic),W=fa(oc),Mi=ue(ac),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()}),dc=Vr.extend({type:y.literal("select"),multi:y.boolean(),options:y.array(y.string(),{required_error:"requiredError"}).min(1,{message:"requiredError"})}),hc=Vr.extend({type:y.enum(["boolean","string"]),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),mc=Vr.extend({type:y.literal("media"),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),ha=y.discriminatedUnion("type",[hc,mc,dc]),ma=y.union([y.literal("audience"),ha]),gc=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()}),yc=y.enum(["INTERNAL","EXTERNAL","WRAPPER"]),Xr=y.object({id:y.number(),documentId:y.string(),title:y.string(),type:yc,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()}),vc=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()}),Ec=Ve(!1).omit({items:!0,id:!0,documentId:!0,slug:!0,locale:!0}).extend({documentId:y.string().optional(),id:y.undefined().optional()}),wc=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(wc),bc=Ve(!1).extend({items:ya}).partial().required({id:!0,documentId:!0}),Sc=y.enum(["collectionType","singleType"]),xc=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()}),_c=y.enum(["string","text","richtext","blocks","email","password","date","time","datetime","timestamp","boolean","integer","biginteger","float","decimal","json","relation","media"]),Ac=va.extend({type:_c}),Tc=va.extend({type:y.literal("enumeration"),enum:y.string().array()}),Cc=y.object({type:y.literal("component"),component:y.string(),repeatable:y.boolean().optional()}),Rc=y.object({type:y.literal("dynamiczone"),components:y.string().array()}),Fc=y.object({type:y.literal("uid")}),$c=y.object({type:y.literal("media"),allowedTypes:y.enum(["images","videos","audios","files"]).array(),required:y.boolean().optional()}),Ic=y.enum(["oneToOne","oneToMany","manyToOne","manyToMany","morphToMany","manyToMorph"]),Oc=y.object({type:y.literal("relation"),relation:Ic,target:y.string(),mappedBy:y.string().optional(),inversedBy:y.string().optional()}),Nc=y.record(y.string(),y.union([Ac,Tc,Cc,Rc,Oc,$c,Fc])),Tr=y.object({kind:Sc,collectionName:y.string(),info:xc,options:y.object({draftAndPublish:y.boolean().optional(),hidden:y.boolean().optional(),templateName:y.string().optional()}).optional(),attributes:Nc,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=gc;const Pc=Mt(()=>Cr,e=>{Cr=e});let Rr=ma;const Lc=Mt(()=>Rr,e=>{Rr=e});let Fr=ha;const kc=Mt(()=>Fr,e=>{Fr=e});let $r=Ec;const Dc=Mt(()=>$r,e=>{$r=e});let Ir=bc;const Mc=Mt(()=>Ir,e=>{Ir=e}),Ce={get configSchema(){return Cr},get navigationItemAdditionalField(){return Rr},get navigationItemCustomField(){return Fr},get createNavigationSchema(){return $r},get updateNavigationSchema(){return Ir}},jc=/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,Hc=["beforeCreate","beforeCreateMany","afterCreate","afterCreateMany","beforeUpdate","beforeUpdateMany","afterUpdate","afterUpdateMany","beforeDelete","beforeDeleteMany","afterDelete","afterDeleteMany","beforeCount","afterCount","beforeFindOne","afterFindOne","beforeFindMany","afterFindMany"],Bc="$",Ea=["api::","plugin::"],wa=["admin::","plugin::content-releases","plugin::i18n.locale","plugin::navigation","plugin::review-workflows","plugin::users-permissions","plugin::upload.folder"],Uc=["title","subject","name"],Hi={SINGLE:"singleType"},Bi=["title","type","path","externalPath","uiRouterKey","menuAttached","order","collapsed","related","parent","master","audience","additionalFields"],Gc=e=>e.filter(t=>t!=="audience"),ba=e=>{const t=Gc(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")},qc=(e="")=>{const t=a=>a.split("-").map(o=>B.capitalize(o)).join(""),[n,r,i]=Kc(e);return n==="api"?t(i):`${t(r)}${t(i)}`},Kc=(e="")=>e.split(jc).filter(t=>t&&t.length>0),Wc=(e,t)=>n=>[n,async r=>{await re(t,"common").runLifeCycleHook({contentTypeName:e,hookName:n,event:r})}],xa=(e,t)=>Object.fromEntries(Hc.map(Wc(e,t))),Ee=({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,zc=(e="")=>{const t=!!Ea.find(r=>e.includes(r)),n=!wa.find(r=>e.includes(r)||e===r);return!!e&&t&&n},Ui=(e="")=>B.last(e)==="s"?e.substr(0,e.length-1):e,_a=async({strapi:e,forceDefault:t=!1})=>{const n=e.store({type:"plugin",name:"navigation"}),r=await e.plugin("navigation").config,i=t?{}:{...Or.default,...await n.get({key:"config"})??Or.default};let a=B.isEmpty(i)?i:Ce.configSchema.parse(i);const o=Yc(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")},Qc(a,{strapi:e}),ba(a.additionalFields),await n.set({key:"config",value:a}),a},Yc=(e,t)=>n=>{const r=e?.[n]??t(n);return Sa(r,new Error(`[Navigation] Config "${n}" is undefined`)),r},Qc=(e,{strapi:t})=>{const n=e.contentTypes.filter(i=>!t.contentTypes[i]);if(n.length===0)return;const r=n.map(qc);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))},Or={default:{additionalFields:[],allowedLevels:2,contentTypes:[],defaultContentType:"",contentTypesNameFields:{},contentTypesPopulate:{},gql:{navigationItemRelated:[]},pathDefaultFields:{},pruneObsoleteI18nNavigations:!1,cascadeMenuAttached:!0,preferCustomContentTypes:!1,isCacheEnabled:!1}},Vc=B.once(e=>({find(t,n){const{audienceModel:{uid:r}}=Ee(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}=Ee(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:u,...f}=t;return e.strapi.documents(r.uid).update({documentId:t.documentId,data:{...f,related:s?{...s,__type:i}:void 0},locale:n})}else return e.strapi.documents(r.uid).create({data:{...t,related:s?{...s,__type:i}:void 0},locale:n})},find({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=Ee(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(Nr)).then(ji.parse).then(s=>s.map(dn))},findV4({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=Ee(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i})},count(t){const{itemModel:n}=Ee(e);return e.strapi.query(n.uid).count({where:t})},remove(t){const{itemModel:n}=Ee(e);return e.strapi.documents(n.uid).delete({documentId:t.documentId,populate:"*"})},removeForIds(t){const{itemModel:n}=Ee(e);return t.map(r=>e.strapi.documents(n.uid).delete({documentId:r,populate:"*"}))},findForMasterIds(t){const{itemModel:n}=Ee(e);return e.strapi.query(n.uid).findMany({where:{$or:t.map(r=>({master:r}))},limit:Number.MAX_SAFE_INTEGER}).then(ji.parse)}})),Xc=["id","publishedAt","createdAt","updatedAt","locale"],dn=({related:e,items:t=[],...n})=>({...n,items:t.map(dn),related:e?B.omit(e,Xc):void 0}),Nr=({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 Zc extends St{constructor(){super(...arguments),this.type="InvalidParamNavigationError"}}const Gi=e=>e===!0?!0:Array.isArray(e)?e.includes("items"):!1,Ie=B.once(e=>({find({filters:t,locale:n,limit:r,orderBy:i,populate:a}){const{masterModel:o}=Ee(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(Nr)}))).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(dn)}))).then(s=>Ve(Gi(a)).array().parse(s))},findOne({locale:t,filters:n,populate:r}){const{masterModel:i}=Ee(e);return e.strapi.documents(i.uid).findOne({documentId:n.documentId,locale:t,populate:r}).then(a=>a&&{...a,items:a.items?.map(Nr)}).then(a=>Ve(Gi(r)).parse(a)).then(a=>({...a,items:a.items?.map(dn)}))},async save(t){const{masterModel:n}=Ee(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}=Ee(e);if(!t.documentId)throw new St("Document id is required.");return e.strapi.documents(n.uid).delete({documentId:t.documentId})}})),Jc="Navigation",el="navigation",tl=async e=>{const t=re(e,"common"),{defaultLocale:n,restLocale:r=[]}=await t.readLocale(),i=Ie(e),a=await i.find({limit:Number.MAX_SAFE_INTEGER,filters:{},locale:"*"});a.length===0&&a.push(await i.save({name:Jc,visible:!0,locale:n,slug:el}));const o=a.filter(({locale:s})=>s===n);for(const s of o)for(const u of r)!a.find(({locale:c,documentId:l})=>l===s.documentId&&u===c)&&await i.save({documentId:s.documentId,name:s.name,locale:u,visible:s.visible,slug:s.slug})},he={render:function(e){return`plugin::navigation.${e}`},navigation:{read:"read",update:"update",settings:"settings"}},nl=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)},rl="I18NLocaleCode",il=({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:rl})},type:n(r("NavigationItem")),resolve(u,{navigationIdOrSlug:f,type:c,menuOnly:l,path:p,locale:d}){const h=Qr.z.string().parse(f);return re({strapi:e},"client").render({idOrSlug:h,type:c,rootPath:p,locale:d,menuOnly:l,wrapRelated:!0})}}},ol=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:a}=t;return{type:n(r("NavigationItem")),args:{documentId:n(i()),childUiKey:n(i()),type:"NavigationRenderType",menuOnly:a()},resolve(o,s){const{documentId:u,childUIKey:f,type:c,menuOnly:l}=s,p=Qr.z.string().parse(u);return re({strapi:e},"client").renderChildren({idOrSlug:p,childUIKey:f,type:c,menuOnly:l,wrapRelated:!0})}}},al=e=>{const t={renderNavigationChild:ol,renderNavigation:il};return e.nexus.extendType({type:"Query",definition(n){for(const[r,i]of Object.entries(t)){const a=i(e);n.field(r,a)}}})},sl=()=>({"Query.renderNavigationChild":{auth:!1},"Query.renderNavigation":{auth:!1}}),ul=({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")}}),cl=({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=Ce.configSchema.parse(await i.get({key:"config"})).contentTypesNameFields;Object.keys(o||{}).forEach(s=>n.nonNull.list.string(s))}}),ll=({nexus:e})=>e.inputObjectType({name:"CreateNavigation",definition(t){t.nonNull.string("name"),t.nonNull.list.field("items",{type:"CreateNavigationItem"})}}),fl=({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"})}}),pl=({nexus:e})=>e.inputObjectType({name:"CreateNavigationRelated",definition(t){t.nonNull.string("ref"),t.nonNull.string("field"),t.nonNull.string("refId")}}),dl=({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")}}),hl=({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"})}}),ml=({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"})}}),gl=({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")}}),yl=({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`)}})}}),vl=({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")}})},El=({nexus:e})=>e.enumType({name:"NavigationItemType",members:["INTERNAL","EXTERNAL","WRAPPER"]}),wl=({nexus:e})=>e.enumType({name:"NavigationRenderType",members:["FLAT","TREE"]}),bl=[yl,vl,gl,wl,dl,ml,cl,ul,hl,pl,fl,ll,El],Sl=e=>bl.map(t=>t(e)),xl=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=Ce.configSchema.parse(await r.get({key:"config"}));t.use(({strapi:a,nexus:o})=>{const s=Sl({strapi:a,nexus:o,config:i}),u=al({strapi:a,nexus:o}),f=sl();return{types:[s,u],resolversConfig:f}})},_l=async({strapi:e})=>{!!e.plugin("graphql")&&await xl({strapi:e})},Al=async e=>{await _a(e),await tl(e),await nl(e),await _l(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)}})},Tl=({strapi:e})=>{},Cl=({strapi:e})=>{},Rl={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"}}},Fl={schema:Rl},$l=xa("navigation",{strapi}),Il={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"}}},Ol={schema:Il,lifecycles:$l},Nl=xa("navigation-item",{strapi}),Pl={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:{}}}},Ll={schema:Pl,lifecycles:Nl},kl={audience:Fl,navigation:Ol,"navigation-item":Ll},Aa=y.enum(["true","false"]),Qt=y.string(),Dl=y.object({locale:y.string().optional(),orderBy:y.string().optional(),orderDirection:y.enum(["DESC","ASC"]).optional()}),Ta=y.enum(["FLAT","TREE","RFR"]),Ca=y.union([y.boolean(),y.string(),y.string().array(),y.undefined()]),Ml=y.object({type:Ta.optional(),menu:Aa.optional(),path:y.string().optional(),locale:y.string().optional(),populate:Ca.optional()}),jl=y.object({type:Ta.optional(),menu:Aa.optional(),locale:y.string().optional()}),Hl=y.object({source:y.string().min(1),target:y.string().min(1),documentId:y.string().min(1)});function Bl(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:Ce.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:Ce.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:Ce.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}=Hl.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 Ul=e=>{if(!(!e||e===!0||e==="*")&&typeof e!="object")return Array.isArray(e),e};function Gl(e){return{getService(){return re(e,"client")},async readAll(t){try{const{query:n={}}=t,{locale:r,orderBy:i,orderDirection:a}=Dl.parse(n);return await this.getService().readAll({locale:r,orderBy:i,orderDirection:a})}catch(n){if(n instanceof Error)return t.badRequest(n.message);throw n}},async render(t){const{params:n,query:r={}}=t,{type:i,menu:a,path:o,locale:s,populate:u}=Ml.parse(r),f=y.string().parse(n.idOrSlug);return await this.getService().render({idOrSlug:f,type:i,menuOnly:a==="true",rootPath:o,locale:s,populate:Ul(Ca.parse(u==="true"?!0:u==="false"?!1:Array.isArray(u)?u.map(c=>c==="true"?!0:c==="false"?!1:u):u))})},async renderChild(t){const{params:n,query:r={}}=t,{type:i,menu:a,locale:o}=jl.parse(r),s=y.string().parse(n.documentId),u=y.string().parse(n.childUIKey);return await this.getService().renderChildren({idOrSlug:s,childUIKey:u,type:i,menuOnly:a==="true",locale:o})}}}const ql={admin:Bl,client:Gl},Kl={},Wl={},zl={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")]}}]}}]},Yl={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:[]}}]},Ql={admin:zl,"content-api":Yl};function Vl(e,t){return me.default.has(process.env,e)?process.env[e]:t}function st(e){return process.env[e]??""}const Xl={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=Zl(e,n);return t.includes(r)?r:n}},Zl=Object.assign(Vl,Xl),Jl="id",ef="documentId",tf={ID_ATTRIBUTE:Jl,DOC_ID_ATTRIBUTE:ef},nf=e=>R.union(strapi?.config?.get("api.responses.privateAttributes",[])??[],R.getOr([],"options.privateAttributes",e)),rf=(e,t)=>e?.attributes?.[t]?.private===!0?!0:nf(e).includes(t),Ra=e=>e&&!["media","component","relation","dynamiczone"].includes(e.type),of=e=>e?.type==="media",Fa=e=>e?.type==="relation",af=e=>!!e&&e.type==="dynamiczone",$a=e=>!!e&&Fa(e)&&e.relation?.startsWith?.("morphTo"),ht=async(e,t,n)=>{const{path:r={raw:null,attribute:null},schema:i,getModel:a}=t;let o=t.parent;const s=async(m,g,b)=>{const T={schema:a(b.__type),path:g,getModel:a,parent:o};return ht(m,T,b)},u=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)},c=async(m,g,b,S)=>ht(m,{schema:b,path:g,getModel:a,parent:o},S),l=async(m,g,b)=>{const T={schema:a(b.__component),path:g,getModel:a,parent:o};return ht(m,T,b)};if(!R.isObject(n)||R.isNil(i))return n;const p=R.clone(n),d=sf({data:p}),h=Object.keys(p);for(let m=0;m<h.length;m+=1){const g=h[m],b=i.attributes[g],S={...r};S.raw=R.isNil(r.raw)?g:`${r.raw}.${g}`,R.isNil(b)||(S.attribute=R.isNil(r.attribute)?g:`${r.attribute}.${g}`);const T={data:p,schema:i,key:g,value:p[g],attribute:b,path:S,getModel:a,parent:o};await e(T,d);const A=p[g];if(!(R.isNil(A)||R.isNil(b))){if(o={schema:i,key:g,attribute:b,path:S},Fa(b)){const F=b.relation.toLowerCase().startsWith("morph")?s:u(a(b.target));if(R.isArray(A)){const M=new Array(A.length);for(let x=0;x<A.length;x+=1)M[x]=await F(e,S,A[x]);p[g]=M}else p[g]=await F(e,S,A);continue}if(of(b)){if(R.isArray(A)){const C=new Array(A.length);for(let F=0;F<A.length;F+=1)C[F]=await f(e,S,A[F]);p[g]=C}else p[g]=await f(e,S,A);continue}if(b.type==="component"){const C=a(b.component);if(R.isArray(A)){const F=new Array(A.length);for(let M=0;M<A.length;M+=1)F[M]=await c(e,S,C,A[M]);p[g]=F}else p[g]=await c(e,S,C,A);continue}if(b.type==="dynamiczone"&&R.isArray(A)){const C=new Array(A.length);for(let F=0;F<A.length;F+=1)C[F]=await l(e,S,A[F]);p[g]=C;continue}}}return p},sf=({data:e})=>({remove(t){delete e[t]},set(t,n){e[t]=n}});var uf=R.curry(ht),we=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ia(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cf={exports:{}};(function(e,t){(function(n,r){e.exports=r(ln.default,ki.default)})(we,function(n,r){return function(i){function a(s){if(o[s])return o[s].exports;var u=o[s]={exports:{},id:s,loaded:!1};return i[s].call(u.exports,u,u.exports,a),u.loaded=!0,u.exports}var o={};return a.m=i,a.c=o,a.p="",a(0)}([function(i,a,o){i.exports=o(34)},function(i,a,o){var s=o(29)("wks"),u=o(33),f=o(2).Symbol,c=typeof f=="function",l=i.exports=function(p){return s[p]||(s[p]=c&&f[p]||(c?f:u)("Symbol."+p))};l.store=s},function(i,a){var o=i.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=o)},function(i,a,o){var s=o(9);i.exports=function(u){if(!s(u))throw TypeError(u+" is not an object!");return u}},function(i,a,o){i.exports=!o(24)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(12),u=o(17);i.exports=o(4)?function(f,c,l){return s.f(f,c,u(1,l))}:function(f,c,l){return f[c]=l,f}},function(i,a){var o=i.exports={version:"2.4.0"};typeof __e=="number"&&(__e=o)},function(i,a,o){var s=o(14);i.exports=function(u,f,c){if(s(u),f===void 0)return u;switch(c){case 1:return function(l){return u.call(f,l)};case 2:return function(l,p){return u.call(f,l,p)};case 3:return function(l,p,d){return u.call(f,l,p,d)}}return function(){return u.apply(f,arguments)}}},function(i,a){var o={}.hasOwnProperty;i.exports=function(s,u){return o.call(s,u)}},function(i,a){i.exports=function(o){return typeof o=="object"?o!==null:typeof o=="function"}},function(i,a){i.exports={}},function(i,a){var o={}.toString;i.exports=function(s){return o.call(s).slice(8,-1)}},function(i,a,o){var s=o(3),u=o(26),f=o(32),c=Object.defineProperty;a.f=o(4)?Object.defineProperty:function(l,p,d){if(s(l),p=f(p,!0),s(d),u)try{return c(l,p,d)}catch{}if("get"in d||"set"in d)throw TypeError("Accessors not supported!");return"value"in d&&(l[p]=d.value),l}},function(i,a,o){var s=o(42),u=o(15);i.exports=function(f){return s(u(f))}},function(i,a){i.exports=function(o){if(typeof o!="function")throw TypeError(o+" is not a function!");return o}},function(i,a){i.exports=function(o){if(o==null)throw TypeError("Can't call method on "+o);return o}},function(i,a,o){var s=o(9),u=o(2).document,f=s(u)&&s(u.createElement);i.exports=function(c){return f?u.createElement(c):{}}},function(i,a){i.exports=function(o,s){return{enumerable:!(1&o),configurable:!(2&o),writable:!(4&o),value:s}}},function(i,a,o){var s=o(12).f,u=o(8),f=o(1)("toStringTag");i.exports=function(c,l,p){c&&!u(c=p?c:c.prototype,f)&&s(c,f,{configurable:!0,value:l})}},function(i,a,o){var s=o(29)("keys"),u=o(33);i.exports=function(f){return s[f]||(s[f]=u(f))}},function(i,a){var o=Math.ceil,s=Math.floor;i.exports=function(u){return isNaN(u=+u)?0:(u>0?s:o)(u)}},function(i,a,o){var s=o(11),u=o(1)("toStringTag"),f=s(function(){return arguments}())=="Arguments",c=function(l,p){try{return l[p]}catch{}};i.exports=function(l){var p,d,h;return l===void 0?"Undefined":l===null?"Null":typeof(d=c(p=Object(l),u))=="string"?d:f?s(p):(h=s(p))=="Object"&&typeof p.callee=="function"?"Arguments":h}},function(i,a){i.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(i,a,o){var s=o(2),u=o(6),f=o(7),c=o(5),l="prototype",p=function(d,h,m){var g,b,S,T=d&p.F,A=d&p.G,C=d&p.S,F=d&p.P,M=d&p.B,x=d&p.W,_=A?u:u[h]||(u[h]={}),O=_[l],E=A?s:C?s[h]:(s[h]||{})[l];A&&(m=h);for(g in m)b=!T&&E&&E[g]!==void 0,b&&g in _||(S=b?E[g]:m[g],_[g]=A&&typeof E[g]!="function"?m[g]:M&&b?f(S,s):x&&E[g]==S?function(L){var H=function(K,w,v){if(this instanceof L){switch(arguments.length){case 0:return new L;case 1:return new L(K);case 2:return new L(K,w)}return new L(K,w,v)}return L.apply(this,arguments)};return H[l]=L[l],H}(S):F&&typeof S=="function"?f(Function.call,S):S,F&&((_.virtual||(_.virtual={}))[g]=S,d&p.R&&O&&!O[g]&&c(O,g,S)))};p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128,i.exports=p},function(i,a){i.exports=function(o){try{return!!o()}catch{return!0}}},function(i,a,o){i.exports=o(2).document&&document.documentElement},function(i,a,o){i.exports=!o(4)&&!o(24)(function(){return Object.defineProperty(o(16)("div"),"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(28),u=o(23),f=o(57),c=o(5),l=o(8),p=o(10),d=o(45),h=o(18),m=o(52),g=o(1)("iterator"),b=!([].keys&&"next"in[].keys()),S="@@iterator",T="keys",A="values",C=function(){return this};i.exports=function(F,M,x,_,O,E,L){d(x,M,_);var H,K,w,v=function(D){if(!b&&D in z)return z[D];switch(D){case T:return function(){return new x(this,D)};case A:return function(){return new x(this,D)}}return function(){return new x(this,D)}},j=M+" Iterator",k=O==A,U=!1,z=F.prototype,V=z[g]||z[S]||O&&z[O],te=V||v(O),Fe=O?k?v("entries"):te:void 0,I=M=="Array"&&z.entries||V;if(I&&(w=m(I.call(new F)),w!==Object.prototype&&(h(w,j,!0),s||l(w,g)||c(w,g,C))),k&&V&&V.name!==A&&(U=!0,te=function(){return V.call(this)}),s&&!L||!b&&!U&&z[g]||c(z,g,te),p[M]=te,p[j]=C,O)if(H={values:k?te:v(A),keys:E?te:v(T),entries:Fe},L)for(K in H)K in z||f(z,K,H[K]);else u(u.P+u.F*(b||U),M,H);return H}},function(i,a){i.exports=!0},function(i,a,o){var s=o(2),u="__core-js_shared__",f=s[u]||(s[u]={});i.exports=function(c){return f[c]||(f[c]={})}},function(i,a,o){var s,u,f,c=o(7),l=o(41),p=o(25),d=o(16),h=o(2),m=h.process,g=h.setImmediate,b=h.clearImmediate,S=h.MessageChannel,T=0,A={},C="onreadystatechange",F=function(){var x=+this;if(A.hasOwnProperty(x)){var _=A[x];delete A[x],_()}},M=function(x){F.call(x.data)};g&&b||(g=function(x){for(var _=[],O=1;arguments.length>O;)_.push(arguments[O++]);return A[++T]=function(){l(typeof x=="function"?x:Function(x),_)},s(T),T},b=function(x){delete A[x]},o(11)(m)=="process"?s=function(x){m.nextTick(c(F,x,1))}:S?(u=new S,f=u.port2,u.port1.onmessage=M,s=c(f.postMessage,f,1)):h.addEventListener&&typeof postMessage=="function"&&!h.importScripts?(s=function(x){h.postMessage(x+"","*")},h.addEventListener("message",M,!1)):s=C in d("script")?function(x){p.appendChild(d("script"))[C]=function(){p.removeChild(this),F.call(x)}}:function(x){setTimeout(c(F,x,1),0)}),i.exports={set:g,clear:b}},function(i,a,o){var s=o(20),u=Math.min;i.exports=function(f){return f>0?u(s(f),9007199254740991):0}},function(i,a,o){var s=o(9);i.exports=function(u,f){if(!s(u))return u;var c,l;if(f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u))||typeof(c=u.valueOf)=="function"&&!s(l=c.call(u))||!f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u)))return l;throw TypeError("Can't convert object to primitive value")}},function(i,a){var o=0,s=Math.random();i.exports=function(u){return"Symbol(".concat(u===void 0?"":u,")_",(++o+s).toString(36))}},function(i,a,o){function s(C){return C&&C.__esModule?C:{default:C}}function u(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function f(C){return(0,g.createHash)("sha256").update(C).digest("hex")}function c(C){switch(S){case"darwin":return C.split("IOPlatformUUID")[1].split(` `)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return C.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return C.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return C.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function l(C){var F=c((0,m.execSync)(A[S]).toString());return C?F:f(F)}function p(C){return new h.default(function(F,M){return(0,m.exec)(A[S],{},function(x,_,O){if(x)return M(new Error("Error while obtaining machine id: "+x.stack));var E=c(_.toString());return F(C?E:f(E))})})}Object.defineProperty(a,"__esModule",{value:!0});var d=o(35),h=s(d);a.machineIdSync=l,a.machineId=p;var m=o(70),g=o(71),b=process,S=b.platform,T={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},A={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:T[u()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(i,a,o){i.exports={default:o(36),__esModule:!0}},function(i,a,o){o(66),o(68),o(69),o(67),i.exports=o(6).Promise},function(i,a){i.exports=function(){}},function(i,a){i.exports=function(o,s,u,f){if(!(o instanceof s)||f!==void 0&&f in o)throw TypeError(u+": incorrect invocation!");return o}},function(i,a,o){var s=o(13),u=o(31),f=o(62);i.exports=function(c){return function(l,p,d){var h,m=s(l),g=u(m.length),b=f(d,g);if(c&&p!=p){for(;g>b;)if(h=m[b++],h!=h)return!0}else for(;g>b;b++)if((c||b in m)&&m[b]===p)return c||b||0;return!c&&-1}}},function(i,m,o){var s=o(7),u=o(44),f=o(43),c=o(3),l=o(31),p=o(64),d={},h={},m=i.exports=function(g,b,S,T,A){var C,F,M,x,_=A?function(){return g}:p(g),O=s(S,T,b?2:1),E=0;if(typeof _!="function")throw TypeError(g+" is not iterable!");if(f(_)){for(C=l(g.length);C>E;E++)if(x=b?O(c(F=g[E])[0],F[1]):O(g[E]),x===d||x===h)return x}else for(M=_.call(g);!(F=M.next()).done;)if(x=u(M,O,F.value,b),x===d||x===h)return x};m.BREAK=d,m.RETURN=h},function(i,a){i.exports=function(o,s,u){var f=u===void 0;switch(s.length){case 0:return f?o():o.call(u);case 1:return f?o(s[0]):o.call(u,s[0]);case 2:return f?o(s[0],s[1]):o.call(u,s[0],s[1]);case 3:return f?o(s[0],s[1],s[2]):o.call(u,s[0],s[1],s[2]);case 4:return f?o(s[0],s[1],s[2],s[3]):o.call(u,s[0],s[1],s[2],s[3])}return o.apply(u,s)}},function(i,a,o){var s=o(11);i.exports=Object("z").propertyIsEnumerable(0)?Object:function(u){return s(u)=="String"?u.split(""):Object(u)}},function(i,a,o){var s=o(10),u=o(1)("iterator"),f=Array.prototype;i.exports=function(c){return c!==void 0&&(s.Array===c||f[u]===c)}},function(i,a,o){var s=o(3);i.exports=function(u,f,c,l){try{return l?f(s(c)[0],c[1]):f(c)}catch(d){var p=u.return;throw p!==void 0&&s(p.call(u)),d}}},function(i,a,o){var s=o(49),u=o(17),f=o(18),c={};o(5)(c,o(1)("iterator"),function(){return this}),i.exports=function(l,p,d){l.prototype=s(c,{next:u(1,d)}),f(l,p+" Iterator")}},function(i,a,o){var s=o(1)("iterator"),u=!1;try{var f=[7][s]();f.return=function(){u=!0},Array.from(f,function(){throw 2})}catch{}i.exports=function(c,l){if(!l&&!u)return!1;var p=!1;try{var d=[7],h=d[s]();h.next=function(){return{done:p=!0}},d[s]=function(){return h},c(d)}catch{}return p}},function(i,a){i.exports=function(o,s){return{value:s,done:!!o}}},function(i,a,o){var s=o(2),u=o(30).set,f=s.MutationObserver||s.WebKitMutationObserver,c=s.process,l=s.Promise,p=o(11)(c)=="process";i.exports=function(){var d,h,m,g=function(){var A,C;for(p&&(A=c.domain)&&A.exit();d;){C=d.fn,d=d.next;try{C()}catch(F){throw d?m():h=void 0,F}}h=void 0,A&&A.enter()};if(p)m=function(){c.nextTick(g)};else if(f){var b=!0,S=document.createTextNode("");new f(g).observe(S,{characterData:!0}),m=function(){S.data=b=!b}}else if(l&&l.resolve){var T=l.resolve();m=function(){T.then(g)}}else m=function(){u.call(s,g)};return function(A){var C={fn:A,next:void 0};h&&(h.next=C),d||(d=C,m()),h=C}}},function(i,a,o){var s=o(3),u=o(50),f=o(22),c=o(19)("IE_PROTO"),l=function(){},p="prototype",d=function(){var h,m=o(16)("iframe"),g=f.length,b=">";for(m.style.display="none",o(25).appendChild(m),m.src="javascript:",h=m.contentWindow.document,h.open(),h.write("<script>document.F=Object<\/script"+b),h.close(),d=h.F;g--;)delete d[p][f[g]];return d()};i.exports=Object.create||function(h,m){var g;return h!==null?(l[p]=s(h),g=new l,l[p]=null,g[c]=h):g=d(),m===void 0?g:u(g,m)}},function(i,a,o){var s=o(12),u=o(3),f=o(54);i.exports=o(4)?Object.defineProperties:function(c,l){u(c);for(var p,d=f(l),h=d.length,m=0;h>m;)s.f(c,p=d[m++],l[p]);return c}},function(i,a,o){var s=o(55),u=o(17),f=o(13),c=o(32),l=o(8),p=o(26),d=Object.getOwnPropertyDescriptor;a.f=o(4)?d:function(h,m){if(h=f(h),m=c(m,!0),p)try{return d(h,m)}catch{}if(l(h,m))return u(!s.f.call(h,m),h[m])}},function(i,a,o){var s=o(8),u=o(63),f=o(19)("IE_PROTO"),c=Object.prototype;i.exports=Object.getPrototypeOf||function(l){return l=u(l),s(l,f)?l[f]:typeof l.constructor=="function"&&l instanceof l.constructor?l.constructor.prototype:l instanceof Object?c:null}},function(i,a,o){var s=o(8),u=o(13),f=o(39)(!1),c=o(19)("IE_PROTO");i.exports=function(l,p){var d,h=u(l),m=0,g=[];for(d in h)d!=c&&s(h,d)&&g.push(d);for(;p.length>m;)s(h,d=p[m++])&&(~f(g,d)||g.push(d));return g}},function(i,a,o){var s=o(53),u=o(22);i.exports=Object.keys||function(f){return s(f,u)}},function(i,a){a.f={}.propertyIsEnumerable},function(i,a,o){var s=o(5);i.exports=function(u,f,c){for(var l in f)c&&u[l]?u[l]=f[l]:s(u,l,f[l]);return u}},function(i,a,o){i.exports=o(5)},function(i,a,o){var s=o(9),u=o(3),f=function(c,l){if(u(c),!s(l)&&l!==null)throw TypeError(l+": can't set as prototype!")};i.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(c,l,p){try{p=o(7)(Function.call,o(51).f(Object.prototype,"__proto__").set,2),p(c,[]),l=!(c instanceof Array)}catch{l=!0}return function(d,h){return f(d,h),l?d.__proto__=h:p(d,h),d}}({},!1):void 0),check:f}},function(i,a,o){var s=o(2),u=o(6),f=o(12),c=o(4),l=o(1)("species");i.exports=function(p){var d=typeof u[p]=="function"?u[p]:s[p];c&&d&&!d[l]&&f.f(d,l,{configurable:!0,get:function(){return this}})}},function(i,a,o){var s=o(3),u=o(14),f=o(1)("species");i.exports=function(c,l){var p,d=s(c).constructor;return d===void 0||(p=s(d)[f])==null?l:u(p)}},function(i,a,o){var s=o(20),u=o(15);i.exports=function(f){return function(c,l){var p,d,h=String(u(c)),m=s(l),g=h.length;return m<0||m>=g?f?"":void 0:(p=h.charCodeAt(m),p<55296||p>56319||m+1===g||(d=h.charCodeAt(m+1))<56320||d>57343?f?h.charAt(m):p:f?h.slice(m,m+2):(p-55296<<10)+(d-56320)+65536)}}},function(i,a,o){var s=o(20),u=Math.max,f=Math.min;i.exports=function(c,l){return c=s(c),c<0?u(c+l,0):f(c,l)}},function(i,a,o){var s=o(15);i.exports=function(u){return Object(s(u))}},function(i,a,o){var s=o(21),u=o(1)("iterator"),f=o(10);i.exports=o(6).getIteratorMethod=function(c){if(c!=null)return c[u]||c["@@iterator"]||f[s(c)]}},function(i,a,o){var s=o(37),u=o(47),f=o(10),c=o(13);i.exports=o(27)(Array,"Array",function(l,p){this._t=c(l),this._i=0,this._k=p},function(){var l=this._t,p=this._k,d=this._i++;return!l||d>=l.length?(this._t=void 0,u(1)):p=="keys"?u(0,d):p=="values"?u(0,l[d]):u(0,[d,l[d]])},"values"),f.Arguments=f.Array,s("keys"),s("values"),s("entries")},function(i,a){},function(i,a,o){var s,u,f,c=o(28),l=o(2),p=o(7),d=o(21),h=o(23),m=o(9),g=(o(3),o(14)),b=o(38),S=o(40),T=(o(58).set,o(60)),A=o(30).set,C=o(48)(),F="Promise",M=l.TypeError,_=l.process,x=l[F],_=l.process,O=d(_)=="process",E=function(){},L=!!function(){try{var I=x.resolve(1),D=(I.constructor={})[o(1)("species")]=function(N){N(E,E)};return(O||typeof PromiseRejectionEvent=="function")&&I.then(E)instanceof D}catch{}}(),H=function(I,D){return I===D||I===x&&D===f},K=function(I){var D;return!(!m(I)||typeof(D=I.then)!="function")&&D},w=function(I){return H(x,I)?new v(I):new u(I)},v=u=function(I){var D,N;this.promise=new I(function(Q,ce){if(D!==void 0||N!==void 0)throw M("Bad Promise constructor");D=Q,N=ce}),this.resolve=g(D),this.reject=g(N)},j=function(I){try{I()}catch(D){return{error:D}}},k=function(I,D){if(!I._n){I._n=!0;var N=I._c;C(function(){for(var Q=I._v,ce=I._s==1,P=0,Y=function($){var q,X,oe=ce?$.ok:$.fail,Z=$.resolve,Ne=$.reject,je=$.domain;try{oe?(ce||(I._h==2&&V(I),I._h=1),oe===!0?q=Q:(je&&je.enter(),q=oe(Q),je&&je.exit()),q===$.promise?Ne(M("Promise-chain cycle")):(X=K(q))?X.call(q,Z,Ne):Z(q)):Ne(Q)}catch(Bu){Ne(Bu)}};N.length>P;)Y(N[P++]);I._c=[],I._n=!1,D&&!I._h&&U(I)})}},U=function(I){A.call(l,function(){var D,N,Q,ce=I._v;if(z(I)&&(D=j(function(){O?_.emit("unhandledRejection",ce,I):(N=l.onunhandledrejection)?N({promise:I,reason:ce}):(Q=l.console)&&Q.error&&Q.error("Unhandled promise rejection",ce)}),I._h=O||z(I)?2:1),I._a=void 0,D)throw D.error})},z=function(I){if(I._h==1)return!1;for(var D,N=I._a||I._c,Q=0;N.length>Q;)if(D=N[Q++],D.fail||!z(D.promise))return!1;return!0},V=function(I){A.call(l,function(){var D;O?_.emit("rejectionHandled",I):(D=l.onrejectionhandled)&&D({promise:I,reason:I._v})})},te=function(I){var D=this;D._d||(D._d=!0,D=D._w||D,D._v=I,D._s=2,D._a||(D._a=D._c.slice()),k(D,!0))},Fe=function(I){var D,N=this;if(!N._d){N._d=!0,N=N._w||N;try{if(N===I)throw M("Promise can't be resolved itself");(D=K(I))?C(function(){var Q={_w:N,_d:!1};try{D.call(I,p(Fe,Q,1),p(te,Q,1))}catch(ce){te.call(Q,ce)}}):(N._v=I,N._s=1,k(N,!1))}catch(Q){te.call({_w:N,_d:!1},Q)}}};L||(x=function(I){b(this,x,F,"_h"),g(I),s.call(this);try{I(p(Fe,this,1),p(te,this,1))}catch(D){te.call(this,D)}},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,D){var N=w(T(this,x));return N.ok=typeof I!="function"||I,N.fail=typeof D=="function"&&D,N.domain=O?_.domain:void 0,this._c.push(N),this._a&&this._a.push(N),this._s&&k(this,!1),N.