strapi-plugin-comments 3.1.1-beta.1 → 3.1.1

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.
Files changed (47) hide show
  1. package/dist/_chunks/{en-DeZtLd2b.mjs → en-Cbt6CXo1.mjs} +1 -0
  2. package/dist/_chunks/{en-Ca05D1aN.js → en-DalOPLjA.js} +1 -1
  3. package/dist/_chunks/fr-C4_v32Lz.js +1 -0
  4. package/dist/_chunks/{fr-xcXYnLl6.mjs → fr-CztE_B7U.mjs} +1 -0
  5. package/dist/_chunks/{index-Bd1INOJR.mjs → index-B7COUj1E.mjs} +2 -2
  6. package/dist/_chunks/{index-CtUXr7rK.js → index-BUbb2WGh.js} +264 -264
  7. package/dist/_chunks/index-CL3ZQ5c8.js +18 -0
  8. package/dist/_chunks/{index-BvE3I2WB.mjs → index-CoArx2AB.mjs} +28 -28
  9. package/dist/_chunks/{index-BzZk45CE.js → index-Cpp_f9wq.js} +3 -3
  10. package/dist/_chunks/{index-C9YD28U_.mjs → index-D7OmqK1F.mjs} +4 -4
  11. package/dist/_chunks/{index-DHYGkXW6.js → index-ZS4k_B_E.js} +1 -1
  12. package/dist/_chunks/{index-DcdRh9F7.mjs → index-s3cDVDHP.mjs} +7428 -7281
  13. package/dist/_chunks/pl-D2JXVqZi.js +1 -0
  14. package/dist/_chunks/{pl-B2Il0b0-.mjs → pl-DBv6tBP6.mjs} +1 -0
  15. package/dist/_chunks/pt-BR-CCBBpLDV.js +1 -0
  16. package/dist/_chunks/{pt-BR-KCmyuDgJ.mjs → pt-BR-VqNYQ17j.mjs} +1 -0
  17. package/dist/_chunks/{ru-Bykkb95a.mjs → ru-DHi8VpMQ.mjs} +1 -0
  18. package/dist/_chunks/ru-DUiPYaBn.js +1 -0
  19. package/dist/_chunks/{tr-Cv3hH0Rh.js → tr-D_0EQ9aV.js} +1 -1
  20. package/dist/_chunks/{tr-BW_iq8S7.mjs → tr-ZRzw4I-8.mjs} +1 -0
  21. package/dist/_chunks/{zh-Hans-DixVuF8_.mjs → zh-Hans-Bz2wrwoC.mjs} +1 -0
  22. package/dist/_chunks/zh-Hans-D1xXhhCe.js +1 -0
  23. package/dist/admin/index.js +1 -1
  24. package/dist/admin/index.mjs +1 -1
  25. package/dist/admin/src/api/client.d.ts +5 -5
  26. package/dist/admin/src/api/schemas.d.ts +63 -63
  27. package/dist/admin/src/hooks/useAPI.d.ts +5 -5
  28. package/dist/admin/src/hooks/useCommentsAll.d.ts +1 -1
  29. package/dist/admin/src/hooks/useReports.d.ts +1 -1
  30. package/dist/admin/src/translations/en.d.ts +1 -0
  31. package/dist/admin/src/translations/fr.d.ts +1 -0
  32. package/dist/admin/src/translations/pl.d.ts +1 -0
  33. package/dist/admin/src/translations/pt-BR.d.ts +1 -0
  34. package/dist/admin/src/translations/ru.d.ts +1 -0
  35. package/dist/admin/src/translations/tr.d.ts +1 -0
  36. package/dist/admin/src/translations/zh-Hans.d.ts +1 -0
  37. package/dist/server/index.js +20 -20
  38. package/dist/server/index.mjs +357 -342
  39. package/dist/server/src/validators/api/controllers/admin.controller.validator.d.ts +36 -36
  40. package/dist/server/src/validators/utils.d.ts +60 -60
  41. package/package.json +1 -1
  42. package/dist/_chunks/fr-DvC8Kjh_.js +0 -1
  43. package/dist/_chunks/index-C5ADhjCF.js +0 -18
  44. package/dist/_chunks/pl-DthJf26N.js +0 -1
  45. package/dist/_chunks/pt-BR-ByULlOKU.js +0 -1
  46. package/dist/_chunks/ru-DOajpZMF.js +0 -1
  47. package/dist/_chunks/zh-Hans-P1iGqMnb.js +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";const v=require("zod"),Rm=require("no-profanity");require("fs");require("path");const mm={uid:/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i,email:/\S+@\S+\.\S+/,sorting:/^(?<path>[a-z0-9-_\:\.]+)\:+(asc|desc)$/i},oa={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"};var Fi=(i=>(i.PENDING="PENDING",i.APPROVED="APPROVED",i.REJECTED="REJECTED",i))(Fi||{}),Zt=(i=>(i.BAD_LANGUAGE="BAD_LANGUAGE",i.DISCRIMINATION="DISCRIMINATION",i.OTHER="OTHER",i))(Zt||{});const Tv="plugin::comments",Ov={collectionName:"plugin_comments_comments",info:{tableName:"plugin-comments-comments",singularName:"comment",pluralName:"comments",displayName:"Comment",description:"Comment content type",kind:"collectionType"},options:{draftAndPublish:!1},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1}},attributes:{content:{type:"text",configurable:!1,required:!0},blocked:{type:"boolean",default:!1,configurable:!1},blockedThread:{type:"boolean",default:!1,configurable:!1},blockReason:{type:"string",configurable:!1},authorUser:{type:"relation",relation:"oneToOne",target:"plugin::users-permissions.user",configurable:!1},authorId:{type:"string",configurable:!1},authorName:{type:"string",configurable:!1},authorEmail:{type:"email",configurable:!1},authorAvatar:{type:"string",configurable:!1},isAdminComment:{type:"boolean",configurable:!1},removed:{type:"boolean",configurable:!1},approvalStatus:{type:"enumeration",enum:Object.values(Fi),configurable:!1},related:{type:"string",configurable:!1},reports:{type:"relation",relation:"oneToMany",target:"plugin::comments.comment-report",mappedBy:"related",configurable:!1},threadOf:{type:"relation",relation:"oneToOne",target:"plugin::comments.comment",configurable:!1}}},Cv={schema:Ov},Iv={collectionName:"plugin_comments_reports",info:{tableName:"plugin-comments-reports",singularName:"comment-report",pluralName:"comment-reports",displayName:"Reports",description:"Reports content type",kind:"collectionType"},options:{draftAndPublish:!1},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1}},attributes:{content:{type:"text",configurable:!1},reason:{type:"enumeration",enum:Object.values(Zt),default:Zt.OTHER,configurable:!1,required:!0},resolved:{type:"boolean",default:!1,configurable:!1},related:{type:"relation",relation:"manyToOne",target:"plugin::comments.comment",inversedBy:"reports",configurable:!1}}},xv={schema:Iv},Rv={comment:Cv,"comment-report":xv},Nv={name:"comments",plugin:"comments",type:"json"},Lv=({strapi:i})=>{if(!zv({strapi:i})){i.log.warn("[Comments Plugin] Custom fields disabled. Upgrade Strapi to use custom fields.");return}i.customFields.register(Nv)},zv=({strapi:i})=>!!i.customFields,ft=(i,u)=>i.plugin("comments").service(u),Pv=i=>{Lv(i);const u=ft(i.strapi,"common");i.strapi.documents.use(async(o,h)=>{if(o.action==="delete"&&o.uid.startsWith("api::")){const{params:{locale:m,documentId:A},uid:E}=o,C=[E,A].join(":");await u.perRemove(C,m)}return h()})},lr=(i,u)=>i.plugin("comments").contentType(u)?.uid,il=i=>{const u="plugin::users-permissions.user",o=["media","relation"],{attributes:h}=i.contentType(u)??{attributes:{}};return(Object.keys(h)?.filter(A=>o.includes(h[A]?.type))).includes("avatar")?{populate:{avatar:!0}}:!0};function vm(i){return typeof i=="string"?i.split(":"):"createdAt:desc".split(":")}const Dv=i=>{const{gql:{auth:u=!1}={}}=i;return{"Query.findAllFlat":{auth:u},"Query.findAllInHierarchy":{auth:u},"Mutation.getCreateComment":{auth:u},"Mutation.getUpdateComment":{auth:u},"Mutation.getRemoveComment":{auth:u},"Mutation.getCreateAbuseReport":{auth:u}}},Fv=(i,u)=>{const{nonNull:o}=u;return{type:o("Report"),args:{input:o("CreateReport")},async resolve(h,m,A){const{input:E}=m,{state:{user:C=void 0}={}}=A,{commentId:x,relation:N,...O}=E;try{return await ft(i,"client").reportAbuse({...O,commentId:x,relation:N},C)}catch(F){throw F}}}},Uv=(i,u)=>{const{nonNull:o}=u;return{type:o("CommentSingle"),args:{input:o("CreateComment")},async resolve(h,m,A){const{input:E}=m,{state:{user:C=void 0}={}}=A,{relation:x,...N}=E;try{return await ft(i,"client").create({...N,relation:x},C)}catch(O){throw O}}}},Mv=(i,u)=>{const{nonNull:o}=u;return{type:o("CommentSingle"),args:{input:o("RemoveComment")},async resolve(h,m,A){const{input:E}=m,{state:{user:C=void 0}={}}=A,{id:x,relation:N,author:O}=E;try{return await ft(i,"client").markAsRemoved({commentId:x,relation:N,authorId:O?.id},C)}catch(F){throw F}}}},Wv=(i,u)=>{const{nonNull:o}=u;return{type:o("CommentSingle"),args:{input:o("UpdateComment")},async resolve(h,m,A){const{input:E}=m,{state:{user:C=void 0}={}}=A,{id:x,relation:N,...O}=E;try{return await ft(i,"client").update({...O,relation:N,commentId:x},C)}catch(F){throw F}}}},Bv=(i,u)=>{const o={getCreateComment:Uv,getUpdateComment:Wv,getRemoveComment:Mv,getCreateAbuseReport:Fv};return u.extendType({type:"Mutation",definition(h){for(const[m,A]of Object.entries(o)){const E=A(i,u);h.field(m,E)}}})};var xr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},xf={exports:{}};/**
1
+ "use strict";const v=require("zod"),Nm=require("no-profanity");require("fs");require("path");const mm={uid:/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i,email:/\S+@\S+\.\S+/,sorting:/^(?<path>[a-z0-9-_\:\.]+)\:+(asc|desc)$/i},oa={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"};var Fi=(i=>(i.PENDING="PENDING",i.APPROVED="APPROVED",i.REJECTED="REJECTED",i))(Fi||{}),Zt=(i=>(i.BAD_LANGUAGE="BAD_LANGUAGE",i.DISCRIMINATION="DISCRIMINATION",i.OTHER="OTHER",i))(Zt||{});const Ov="plugin::comments",Cv={collectionName:"plugin_comments_comments",info:{tableName:"plugin-comments-comments",singularName:"comment",pluralName:"comments",displayName:"Comment",description:"Comment content type",kind:"collectionType"},options:{draftAndPublish:!1},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1}},attributes:{content:{type:"text",configurable:!1,required:!0},blocked:{type:"boolean",default:!1,configurable:!1},blockedThread:{type:"boolean",default:!1,configurable:!1},blockReason:{type:"string",configurable:!1},authorUser:{type:"relation",relation:"oneToOne",target:"plugin::users-permissions.user",configurable:!1},authorId:{type:"string",configurable:!1},authorName:{type:"string",configurable:!1},authorEmail:{type:"email",configurable:!1},authorAvatar:{type:"string",configurable:!1},isAdminComment:{type:"boolean",configurable:!1},removed:{type:"boolean",configurable:!1},approvalStatus:{type:"enumeration",enum:Object.values(Fi),configurable:!1},related:{type:"string",configurable:!1},reports:{type:"relation",relation:"oneToMany",target:"plugin::comments.comment-report",mappedBy:"related",configurable:!1},threadOf:{type:"relation",relation:"oneToOne",target:"plugin::comments.comment",configurable:!1}}},Iv={schema:Cv},xv={collectionName:"plugin_comments_reports",info:{tableName:"plugin-comments-reports",singularName:"comment-report",pluralName:"comment-reports",displayName:"Reports",description:"Reports content type",kind:"collectionType"},options:{draftAndPublish:!1},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1}},attributes:{content:{type:"text",configurable:!1},reason:{type:"enumeration",enum:Object.values(Zt),default:Zt.OTHER,configurable:!1,required:!0},resolved:{type:"boolean",default:!1,configurable:!1},related:{type:"relation",relation:"manyToOne",target:"plugin::comments.comment",inversedBy:"reports",configurable:!1}}},Rv={schema:xv},Nv={comment:Iv,"comment-report":Rv},Lv={name:"comments",plugin:"comments",type:"json"},zv=({strapi:i})=>{if(!Pv({strapi:i})){i.log.warn("[Comments Plugin] Custom fields disabled. Upgrade Strapi to use custom fields.");return}i.customFields.register(Lv)},Pv=({strapi:i})=>!!i.customFields,ft=(i,u)=>i.plugin("comments").service(u),Dv=i=>{zv(i);const u=ft(i.strapi,"common");i.strapi.documents.use(async(o,h)=>{if(o.action==="delete"&&o.uid.startsWith("api::")){const{params:{locale:m,documentId:A},uid:E}=o,C=[E,A].join(":");await u.perRemove(C,m)}return h()})},lr=(i,u)=>i.plugin("comments").contentType(u)?.uid,il=i=>{const u="plugin::users-permissions.user",o=["media","relation"],{attributes:h}=i.contentType(u)??{attributes:{}};return(Object.keys(h)?.filter(A=>o.includes(h[A]?.type))).includes("avatar")?{populate:{avatar:!0}}:!0};function vm(i){return typeof i=="string"?i.split(":"):"createdAt:desc".split(":")}const Fv=i=>{const{gql:{auth:u=!1}={}}=i;return{"Query.findAllFlat":{auth:u},"Query.findAllInHierarchy":{auth:u},"Mutation.getCreateComment":{auth:u},"Mutation.getUpdateComment":{auth:u},"Mutation.getRemoveComment":{auth:u},"Mutation.getCreateAbuseReport":{auth:u}}},Uv=(i,u)=>{const{nonNull:o}=u;return{type:o("Report"),args:{input:o("CreateReport")},async resolve(h,m,A){const{input:E}=m,{state:{user:C=void 0}={}}=A,{commentId:x,relation:N,...O}=E;try{return await ft(i,"client").reportAbuse({...O,commentId:x,relation:N},C)}catch(F){throw F}}}},Mv=(i,u)=>{const{nonNull:o}=u;return{type:o("CommentSingle"),args:{input:o("CreateComment")},async resolve(h,m,A){const{input:E}=m,{state:{user:C=void 0}={}}=A,{relation:x,...N}=E;try{return await ft(i,"client").create({...N,relation:x},C)}catch(O){throw O}}}},Wv=(i,u)=>{const{nonNull:o}=u;return{type:o("CommentSingle"),args:{input:o("RemoveComment")},async resolve(h,m,A){const{input:E}=m,{state:{user:C=void 0}={}}=A,{id:x,relation:N,author:O}=E;try{return await ft(i,"client").markAsRemoved({commentId:x,relation:N,authorId:O?.id},C)}catch(F){throw F}}}},Bv=(i,u)=>{const{nonNull:o}=u;return{type:o("CommentSingle"),args:{input:o("UpdateComment")},async resolve(h,m,A){const{input:E}=m,{state:{user:C=void 0}={}}=A,{id:x,relation:N,...O}=E;try{return await ft(i,"client").update({...O,relation:N,commentId:x},C)}catch(F){throw F}}}},$v=(i,u)=>{const o={getCreateComment:Mv,getUpdateComment:Bv,getRemoveComment:Wv,getCreateAbuseReport:Uv};return u.extendType({type:"Mutation",definition(h){for(const[m,A]of Object.entries(o)){const E=A(i,u);h.field(m,E)}}})};var xr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},xf={exports:{}};/**
2
2
  * @license
3
3
  * Lodash <https://lodash.com/>
4
4
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -24,15 +24,15 @@ __p += '`),j&&(S+=`' +
24
24
  function print() { __p += __j.call(arguments, '') }
25
25
  `:`;
26
26
  `)+S+`return __p
27
- }`;var M=Gs(function(){return D(s,R+"return "+S).apply(o,c)});if(M.source=S,Ds(M))throw M;return M}function Vs(e){return he(e).toLowerCase()}function vf(e){return he(e).toUpperCase()}function zg(e,t,n){if(e=he(e),e&&(n||t===o))return Ll(e);if(!e||!(t=Ht(t)))return e;var r=en(e),a=en(t),s=zl(r,a),c=Pl(r,a)+1;return Er(r,s,c).join("")}function Pg(e,t,n){if(e=he(e),e&&(n||t===o))return e.slice(0,Fa(e)+1);if(!e||!(t=Ht(t)))return e;var r=en(e),a=Pl(r,en(t))+1;return Er(r,0,a).join("")}function Dg(e,t,n){if(e=he(e),e&&(n||t===o))return e.replace(ri,"");if(!e||!(t=Ht(t)))return e;var r=en(e),a=zl(r,en(t));return Er(r,a).join("")}function Qr(e,t){var n=Qe,r=Sn;if(Ue(t)){var a="separator"in t?t.separator:a;n="length"in t?H(t.length):n,r="omission"in t?Ht(t.omission):r}e=he(e);var s=e.length;if(fi(e)){var c=en(e);s=c.length}if(n>=s)return e;var f=n-Fr(r);if(f<1)return r;var g=c?Er(c,0,f).join(""):e.slice(0,f);if(a===o)return g+r;if(c&&(f+=g.length-f),or(a)){if(e.slice(f).search(a)){var w,b=g;for(a.global||(a=Ua(a.source,he(oi.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var S=w.index;g=g.slice(0,S===o?f:S)}}else if(e.indexOf(Ht(a),f)!=f){var T=g.lastIndexOf(a);T>-1&&(g=g.slice(0,T))}return g+r}function ie(e){return e=he(e),e&&Vf.test(e)?e.replace(ni,Oh):e}var Fg=qr(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wn=cs("toUpperCase");function yf(e,t,n){return e=he(e),t=n?o:t,t===o?at(e)?xh(e):xl(e):e.match(t)||[]}var Gs=ne(function(e,t){try{return Lt(e,o,t)}catch(n){return Ds(n)?n:new P(n)}}),qs=Kn(function(e,t){return kt(t,function(n){n=bn(n),Nn(e,n,vt(e[n],e))}),e});function _f(e){var t=e==null?0:e.length,n=K();return e=t?Ce(e,function(r){if(typeof r[1]!="function")throw new tn(E);return[n(r[0]),r[1]]}):[],ne(function(r){for(var a=-1;++a<t;){var s=e[a];if(Lt(s[0],this,r))return Lt(s[1],this,r)}})}function zi(e){return oc(Dt(e,F))}function Hs(e){return function(){return e}}function Ug(e,t){return e==null||e!==e?t:e}var Mg=yc(),bf=yc(!0);function lt(e){return e}function Ys(e){return gu(typeof e=="function"?e:Dt(e,F))}function Wg(e){return es(Dt(e,F))}function Bg(e,t){return vu(e,Dt(t,F))}var $g=ne(function(e,t){return function(n){return _i(n,e,t)}}),jg=ne(function(e,t){return function(n){return _i(e,n,t)}});function Qs(e,t,n){var r=rt(t),a=so(t,r);n==null&&!(Ue(t)&&(a.length||!r.length))&&(n=t,t=e,e=this,a=so(t,rt(t)));var s=!(Ue(n)&&"chain"in n)||!!n.chain,c=ln(e);return kt(a,function(f){var g=t[f];e[f]=g,c&&(e.prototype[f]=function(){var w=this.__chain__;if(s||w){var b=e(this.__wrapped__),S=b.__actions__=Tt(this.__actions__);return S.push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,Vt([this.value()],arguments))})}),e}function kg(){return et._===this&&(et._=Yn),this}function Js(){}function wf(e){return e=H(e),ne(function(t){return ts(t,e)})}var Vg=fs(Ce),Gg=fs(Ho),Af=fs(Oa);function Xs(e){return ys(e)?xa(bn(e)):tp(e)}function qg(e){return function(t){return e==null?o:Vr(e,t)}}var Hg=bc(),Yg=bc(!0);function Zs(){return[]}function Ks(){return!1}function Qg(){return{}}function Jg(){return""}function el(){return!0}function Sf(e,t){if(e=H(e),e<1||e>Kt)return[];var n=Mt,r=De(e,Mt);t=K(t),e-=Mt;for(var a=za(r,t);++n<e;)t(n);return a}function Xg(e){return ee(e)?Ce(e,bn):Qt(e)?[e]:Tt(Ts(he(e)))}function Zg(e){var t=++Lh;return he(e)+t}var Kg=Iu(function(e,t){return e+t},0),em=hs("ceil"),tm=Iu(function(e,t){return e/t},1),nm=hs("floor");function rm(e){return e&&e.length?_n(e,lt,dt):o}function im(e,t){return e&&e.length?_n(e,K(t,2),dt):o}function om(e){return Rl(e,lt)}function um(e,t){return Rl(e,K(t,2))}function am(e){return e&&e.length?_n(e,lt,mu):o}function sm(e,t){return e&&e.length?_n(e,K(t,2),mu):o}var lm=Iu(function(e,t){return e*t},1),cm=hs("round"),fm=Iu(function(e,t){return e-t},0);function hm(e){return e&&e.length?La(e,lt):0}function pm(e,t){return e&&e.length?La(e,K(t,2)):0}return d.after=Fd,d.ary=Wu,d.assign=Eo,d.assignIn=Ku,d.assignInWith=ar,d.assignWith=To,d.at=Oo,d.before=qc,d.bind=vt,d.bindAll=qs,d.bindKey=Bu,d.castArray=Gd,d.chain=Bc,d.chunk=Cp,d.compact=Ip,d.concat=xp,d.cond=_f,d.conforms=zi,d.constant=Hs,d.countBy=md,d.create=ea,d.curry=Hc,d.curryRight=Yc,d.debounce=$u,d.defaults=xi,d.defaultsDeep=tg,d.defer=Ud,d.delay=Rs,d.difference=Rp,d.differenceBy=Np,d.differenceWith=Lp,d.drop=zp,d.dropRight=Pp,d.dropRightWhile=Dp,d.dropWhile=Fp,d.fill=Up,d.filter=yd,d.flatMap=jc,d.flatMapDeep=bd,d.flatMapDepth=wd,d.flatten=It,d.flattenDeep=je,d.flattenDepth=Mp,d.flip=Md,d.flow=Mg,d.flowRight=bf,d.fromPairs=Wp,d.functions=uf,d.functionsIn=Ri,d.groupBy=Ad,d.initial=$p,d.intersection=Os,d.intersectionBy=jp,d.intersectionWith=tr,d.invert=sf,d.invertBy=lf,d.invokeMap=Ed,d.iteratee=Ys,d.keyBy=Td,d.keys=rt,d.keysIn=Rt,d.map=Uu,d.mapKeys=ag,d.mapValues=Ws,d.matches=Wg,d.matchesProperty=Bg,d.memoize=So,d.merge=Bs,d.mergeWith=$s,d.method=$g,d.methodOf=jg,d.mixin=Qs,d.negate=ju,d.nthArg=wf,d.omit=_t,d.omitBy=sg,d.once=Ns,d.orderBy=Od,d.over=Vg,d.overArgs=Ls,d.overEvery=Gg,d.overSome=Af,d.partial=zs,d.partialRight=Qc,d.partition=Cd,d.pick=cf,d.pickBy=Ni,d.property=Xs,d.propertyOf=qg,d.pull=kp,d.pullAll=Dc,d.pullAllBy=Vp,d.pullAllWith=Gp,d.pullAt=qp,d.range=Hg,d.rangeRight=Yg,d.rearg=Wd,d.reject=Rd,d.remove=Hp,d.rest=Bd,d.reverse=Du,d.sampleSize=Ld,d.set=ff,d.setWith=lg,d.shuffle=zd,d.slice=wo,d.sortBy=Gc,d.sortedUniq=Fc,d.sortedUniqBy=nr,d.split=mf,d.spread=$d,d.tail=ue,d.take=Uc,d.takeRight=an,d.takeRightWhile=Mc,d.takeWhile=Zp,d.tap=sd,d.throttle=jd,d.thru=Ao,d.toArray=rf,d.toPairs=hf,d.toPairsIn=pf,d.toPath=Xg,d.toPlainObject=Ms,d.transform=cg,d.unary=kd,d.union=ge,d.unionBy=Kp,d.unionWith=ed,d.uniq=td,d.uniqBy=nd,d.uniqWith=rd,d.unset=fg,d.unzip=Cs,d.unzipWith=Wc,d.update=hg,d.updateWith=pg,d.values=Li,d.valuesIn=dg,d.without=id,d.words=yf,d.wrap=Vd,d.xor=od,d.xorBy=Is,d.xorWith=ud,d.zip=xs,d.zipObject=nt,d.zipObjectDeep=Ft,d.zipWith=ad,d.entries=hf,d.entriesIn=pf,d.extend=Ku,d.extendWith=ar,Qs(d,d),d.add=Kg,d.attempt=Gs,d.camelCase=yg,d.capitalize=df,d.ceil=em,d.clamp=gg,d.clone=qd,d.cloneDeep=Yd,d.cloneDeepWith=Qd,d.cloneWith=Hd,d.conformsTo=Jd,d.deburr=gf,d.defaultTo=Ug,d.divide=tm,d.endsWith=_g,d.eq=be,d.escape=bg,d.escapeRegExp=wg,d.every=vd,d.find=_d,d.findIndex=Lc,d.findKey=ng,d.findLast=$c,d.findLastIndex=un,d.findLastKey=rg,d.floor=nm,d.forEach=kc,d.forEachRight=Vc,d.forIn=ig,d.forInRight=og,d.forOwn=ta,d.forOwnRight=Co,d.get=Mn,d.gt=ku,d.gte=Ps,d.has=af,d.hasIn=Io,d.head=zc,d.identity=lt,d.includes=Sd,d.indexOf=Bp,d.inRange=mg,d.invoke=ug,d.isArguments=Or,d.isArray=ee,d.isArrayBuffer=Re,d.isArrayLike=yt,d.isArrayLikeObject=ke,d.isBoolean=sn,d.isBuffer=wn,d.isDate=Xd,d.isElement=Ii,d.isEmpty=Vu,d.isEqual=Gu,d.isEqualWith=we,d.isError=Ds,d.isFinite=Jc,d.isFunction=ln,d.isInteger=Xc,d.isLength=qu,d.isMap=rr,d.isMatch=Hu,d.isMatchWith=Zc,d.isNaN=Yu,d.isNative=Kc,d.isNil=Qu,d.isNull=ef,d.isNumber=Fs,d.isObject=Ue,d.isObjectLike=Ne,d.isPlainObject=ir,d.isRegExp=or,d.isSafeInteger=Ju,d.isSet=tf,d.isString=Xu,d.isSymbol=Qt,d.isTypedArray=ur,d.isUndefined=Zu,d.isWeakMap=Us,d.isWeakSet=Zd,d.join=Pc,d.kebabCase=Ag,d.last=xt,d.lastIndexOf=Fe,d.lowerCase=Sg,d.lowerFirst=Eg,d.lt=nf,d.lte=Kd,d.max=rm,d.maxBy=im,d.mean=om,d.meanBy=um,d.min=am,d.minBy=sm,d.stubArray=Zs,d.stubFalse=Ks,d.stubObject=Qg,d.stubString=Jg,d.stubTrue=el,d.multiply=lm,d.nth=Be,d.noConflict=kg,d.noop=Js,d.now=Mu,d.pad=Tg,d.padEnd=Og,d.padStart=Cg,d.parseInt=Ig,d.random=vg,d.reduce=Id,d.reduceRight=xd,d.repeat=xg,d.replace=na,d.result=js,d.round=cm,d.runInContext=p,d.sample=Nd,d.size=Pd,d.snakeCase=ks,d.some=Dd,d.sortedIndex=Yp,d.sortedIndexBy=Fu,d.sortedIndexOf=Yt,d.sortedLastIndex=Qp,d.sortedLastIndexBy=Jp,d.sortedLastIndexOf=Xp,d.startCase=Rg,d.startsWith=Ng,d.subtract=fm,d.sum=hm,d.sumBy=pm,d.template=Lg,d.times=Sf,d.toFinite=Te,d.toInteger=H,d.toLength=of,d.toLower=Vs,d.toNumber=cn,d.toSafeInteger=eg,d.toString=he,d.toUpper=vf,d.trim=zg,d.trimEnd=Pg,d.trimStart=Dg,d.truncate=Qr,d.unescape=ie,d.uniqueId=Zg,d.upperCase=Fg,d.upperFirst=Wn,d.each=kc,d.eachRight=Vc,d.first=zc,Qs(d,function(){var e={};return Ln(d,function(t,n){_e.call(d.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),d.VERSION=h,kt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){d[e].placeholder=d}),kt(["drop","take"],function(e,t){ae.prototype[e]=function(n){n=n===o?1:Je(H(n),0);var r=this.__filtered__&&!t?new ae(this):this.clone();return r.__filtered__?r.__takeCount__=De(n,r.__takeCount__):r.__views__.push({size:De(n,Mt),type:e+(r.__dir__<0?"Right":"")}),r},ae.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),kt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==fr||n==Wi;ae.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:K(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),kt(["head","last"],function(e,t){var n="take"+(t?"Right":"");ae.prototype[e]=function(){return this[n](1).value()[0]}}),kt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");ae.prototype[e]=function(){return this.__filtered__?new ae(this):this[n](1)}}),ae.prototype.compact=function(){return this.filter(lt)},ae.prototype.find=function(e){return this.filter(e).head()},ae.prototype.findLast=function(e){return this.reverse().find(e)},ae.prototype.invokeMap=ne(function(e,t){return typeof e=="function"?new ae(this):this.map(function(n){return _i(n,e,t)})}),ae.prototype.reject=function(e){return this.filter(ju(K(e)))},ae.prototype.slice=function(e,t){e=H(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ae(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(t=H(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},ae.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ae.prototype.toArray=function(){return this.take(Mt)},Ln(ae.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=d[r?"take"+(t=="last"?"Right":""):t],s=r||/^find/.test(t);a&&(d.prototype[t]=function(){var c=this.__wrapped__,f=r?[1]:arguments,g=c instanceof ae,w=f[0],b=g||ee(c),S=function(B){var j=a.apply(d,Vt([B],f));return r&&T?j[0]:j};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var T=this.__chain__,R=!!this.__actions__.length,L=s&&!T,M=g&&!R;if(!s&&b){c=M?c:new ae(this);var z=e.apply(c,f);return z.__actions__.push({func:Ao,args:[S],thisArg:o}),new rn(z,T)}return L&&M?e.apply(this,f):(z=this.thru(S),L?r?z.value()[0]:z.value():z)})}),kt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Jo[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);d.prototype[e]=function(){var a=arguments;if(r&&!this.__chain__){var s=this.value();return t.apply(ee(s)?s:[],a)}return this[n](function(c){return t.apply(ee(c)?c:[],a)})}}),Ln(ae.prototype,function(e,t){var n=d[t];if(n){var r=n.name+"";_e.call(We,r)||(We[r]=[]),We[r].push({name:t,func:n})}}),We[go(o,X).name]=[{name:"wrapper",func:o}],ae.prototype.clone=Ql,ae.prototype.reverse=Mh,ae.prototype.value=Wh,d.prototype.at=ld,d.prototype.chain=cd,d.prototype.commit=fd,d.prototype.next=hd,d.prototype.plant=dd,d.prototype.reverse=gd,d.prototype.toJSON=d.prototype.valueOf=d.prototype.value=Ci,d.prototype.first=d.prototype.head,eo&&(d.prototype[eo]=pd),d},mn=Rh();Dr?((Dr.exports=mn)._=mn,wa._=mn):et._=mn}).call(xr)})(xf,xf.exports);var Le=xf.exports;const ua=i=>{const{sort:u,fields:o,omit:h,filters:m={},populate:A={},relation:E,pagination:C}=i,x=(m.$or||[]).filter(U=>!Object.keys(U).includes("removed")),N=m.$or?.some(U=>U.removed);let O={reports:{where:{resolved:!1}},...A},F={threadOf:{populate:{authorUser:{populate:!0,avatar:{populate:!0}},...A}}};if("author"in A){const{author:U,...Q}=A;O={reports:{where:{resolved:!1}},...Q,authorUser:U},F={threadOf:{populate:{authorUser:U,...Q}}}}return x.length&&!N?{...i,filters:{...Le.omit(m,"$or"),$and:[...m.$and||[],{$or:x},{$or:[{removed:{$null:!0}},{removed:!1}]}],related:E},populate:{...O,...F},pagination:C,sort:u,fields:o,omit:h}:{...i,filters:{...m,$or:[...x,{removed:{$null:!0}},{removed:!1}],related:E},populate:{...O,...F},pagination:C,sort:u,fields:o,omit:h}},$v=(i,u)=>{const{nonNull:o,stringArg:h}=u,{service:m}=i.plugin("graphql"),{args:A}=m("internals"),E=i.contentType(lr(i,"comment"));return{type:"ResponseFindAll",args:{relation:o(h()),filters:ft(i,"gql").buildContentTypeFilters(E),pagination:A.PaginationArg,sort:A.SortArg},async resolve(C,x){const{relation:N,filters:O,sort:F,pagination:U}=x;return await ft(i,"common").findAllFlat(ua({relation:N,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(O,E),sort:F,pagination:U?{...U,withCount:!Le.isEmpty(U)}:void 0}),void 0)}}},jv=(i,u)=>{const{nonNull:o,list:h,stringArg:m}=u,{service:A}=i.plugin("graphql"),{args:E}=A("internals"),{naming:{getFiltersInputTypeName:C}}=A("utils"),x=i.contentType(lr(i,"comment"));return{type:o(h("CommentNested")),args:{relation:o(m()),sort:E.SortArg,filters:C(x)},async resolve(N,O){const{relation:F,filters:U,sort:Q}=O;return await ft(i,"common").findAllInHierarchy({...ua({relation:F,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(U,x),sort:Q}),dropBlockedThreads:!0})}}},Cr={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"},ul={GENERIC:"GENERIC",STRAPI:"STRAPI"},kv={relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i},Vv=(i,u)=>{const{nonNull:o,intArg:h,arg:m}=u,{service:A}=i.plugin("graphql"),{args:E}=A("internals"),{naming:{getFiltersInputTypeName:C}}=A("utils"),x=i.contentType(lr(i,"comment"));return{type:"ResponseFindAllPerAuthor",args:{authorId:o(h()),authorType:m({type:"CommentAuthorType"}),filters:C(x),pagination:E.PaginationArg,sort:E.SortArg},async resolve(N,O){const{authorId:F,authorType:U,filters:Q,sort:$,pagination:J}=O,te=U!==ul.GENERIC;return await ft(i,"common").findAllPerAuthor(ua({filters:ft(i,"gql").graphQLFiltersToStrapiQuery(Q,x),sort:$,pagination:J?{...J,withCount:!Le.isEmpty(J)}:void 0,authorId:F}),te)}}},Gv=(i,u)=>{const o={findAllFlat:$v,findAllInHierarchy:jv,findAllPerAuthor:Vv};return u.extendType({type:"Query",definition(h){for(const[m,A]of Object.entries(o)){const E=A(i,u);h.field(m,E)}}})},qv=i=>i.objectType({name:"CommentSingle",definition(u){u.id("id"),u.string("documentId"),u.nonNull.string("content"),u.boolean("blocked"),u.boolean("blockedThread"),u.boolean("removed"),u.string("approvalStatus"),u.field("threadOf",{type:"CommentSingle"}),u.field("author",{type:"CommentAuthor"}),u.string("createdAt"),u.string("updatedAt")}}),Hv=i=>i.objectType({name:"CommentAuthor",definition(u){u.id("id"),u.nonNull.string("name"),u.nonNull.string("email"),u.string("avatar")}}),Yv=i=>i.enumType({name:"CommentAuthorType",description:"User type which was the author of comment - Strapi built-in or generic",members:Object.values(ul)}),Qv=i=>i.objectType({name:"CommentNested",definition(u){u.id("id"),u.string("documentId"),u.nonNull.string("content"),u.boolean("blocked"),u.boolean("blockedThread"),u.string("approvalStatus"),u.boolean("removed"),u.field("threadOf",{type:"CommentSingle"}),u.list.field("children",{type:"CommentNested"}),u.field("author",{type:"CommentAuthor"}),u.string("createdAt"),u.string("updatedAt")}}),Jv=i=>i.inputObjectType({name:"CreateComment",definition(u){u.nonNull.string("content"),u.nonNull.string("relation"),u.id("threadOf"),u.field("author",{type:"CreateCommentAuthor"})}}),Xv=i=>i.inputObjectType({name:"CreateCommentAuthor",definition(u){u.nonNull.id("id"),u.nonNull.string("name"),u.string("email"),u.string("avatar")}}),Zv=i=>i.inputObjectType({name:"CreateReport",definition(u){u.id("commentId"),u.nonNull.string("relation"),u.nonNull.string("content"),u.field("reason",{type:"ReportReason"})}});function He(i,u){if(!!!i)throw new Error(u)}function Ym(i){return typeof i=="object"&&i!==null}function Kv(i,u){if(!!!i)throw new Error("Unexpected invariant triggered.")}const e0=/\r\n|[\n\r]/g;function ym(i,u){let o=0,h=1;for(const m of i.body.matchAll(e0)){if(typeof m.index=="number"||Kv(!1),m.index>=u)break;o=m.index+m[0].length,h+=1}return{line:h,column:u+1-o}}function t0(i){return Qm(i.source,ym(i.source,i.start))}function Qm(i,u){const o=i.locationOffset.column-1,h="".padStart(o)+i.body,m=u.line-1,A=i.locationOffset.line-1,E=u.line+A,C=u.line===1?o:0,x=u.column+C,N=`${i.name}:${E}:${x}
28
- `,O=h.split(/\r\n|[\n\r]/g),F=O[m];if(F.length>120){const U=Math.floor(x/80),Q=x%80,$=[];for(let J=0;J<F.length;J+=80)$.push(F.slice(J,J+80));return N+Nm([[`${E} |`,$[0]],...$.slice(1,U+1).map(J=>["|",J]),["|","^".padStart(Q)],["|",$[U+1]]])}return N+Nm([[`${E-1} |`,O[m-1]],[`${E} |`,F],["|","^".padStart(x)],[`${E+1} |`,O[m+1]]])}function Nm(i){const u=i.filter(([h,m])=>m!==void 0),o=Math.max(...u.map(([h])=>h.length));return u.map(([h,m])=>h.padStart(o)+(m?" "+m:"")).join(`
29
- `)}function n0(i){const u=i[0];return u==null||"kind"in u||"length"in u?{nodes:u,source:i[1],positions:i[2],path:i[3],originalError:i[4],extensions:i[5]}:u}class Bn extends Error{constructor(u,...o){var h,m,A;const{nodes:E,source:C,positions:x,path:N,originalError:O,extensions:F}=n0(o);super(u),this.name="GraphQLError",this.path=N??void 0,this.originalError=O??void 0,this.nodes=Lm(Array.isArray(E)?E:E?[E]:void 0);const U=Lm((h=this.nodes)===null||h===void 0?void 0:h.map($=>$.loc).filter($=>$!=null));this.source=C??(U==null||(m=U[0])===null||m===void 0?void 0:m.source),this.positions=x??U?.map($=>$.start),this.locations=x&&C?x.map($=>ym(C,$)):U?.map($=>ym($.source,$.start));const Q=Ym(O?.extensions)?O?.extensions:void 0;this.extensions=(A=F??Q)!==null&&A!==void 0?A:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),O!=null&&O.stack?Object.defineProperty(this,"stack",{value:O.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Bn):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let u=this.message;if(this.nodes)for(const o of this.nodes)o.loc&&(u+=`
27
+ }`;var M=Gs(function(){return D(s,R+"return "+S).apply(o,c)});if(M.source=S,Ds(M))throw M;return M}function Vs(e){return he(e).toLowerCase()}function vf(e){return he(e).toUpperCase()}function zg(e,t,n){if(e=he(e),e&&(n||t===o))return Ll(e);if(!e||!(t=Ht(t)))return e;var r=en(e),a=en(t),s=zl(r,a),c=Pl(r,a)+1;return Er(r,s,c).join("")}function Pg(e,t,n){if(e=he(e),e&&(n||t===o))return e.slice(0,Fa(e)+1);if(!e||!(t=Ht(t)))return e;var r=en(e),a=Pl(r,en(t))+1;return Er(r,0,a).join("")}function Dg(e,t,n){if(e=he(e),e&&(n||t===o))return e.replace(ri,"");if(!e||!(t=Ht(t)))return e;var r=en(e),a=zl(r,en(t));return Er(r,a).join("")}function Qr(e,t){var n=Qe,r=Sn;if(Ue(t)){var a="separator"in t?t.separator:a;n="length"in t?H(t.length):n,r="omission"in t?Ht(t.omission):r}e=he(e);var s=e.length;if(fi(e)){var c=en(e);s=c.length}if(n>=s)return e;var f=n-Fr(r);if(f<1)return r;var g=c?Er(c,0,f).join(""):e.slice(0,f);if(a===o)return g+r;if(c&&(f+=g.length-f),or(a)){if(e.slice(f).search(a)){var w,b=g;for(a.global||(a=Ua(a.source,he(oi.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var S=w.index;g=g.slice(0,S===o?f:S)}}else if(e.indexOf(Ht(a),f)!=f){var T=g.lastIndexOf(a);T>-1&&(g=g.slice(0,T))}return g+r}function ie(e){return e=he(e),e&&Vf.test(e)?e.replace(ni,Oh):e}var Fg=qr(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wn=cs("toUpperCase");function yf(e,t,n){return e=he(e),t=n?o:t,t===o?at(e)?xh(e):xl(e):e.match(t)||[]}var Gs=ne(function(e,t){try{return Lt(e,o,t)}catch(n){return Ds(n)?n:new P(n)}}),qs=Kn(function(e,t){return kt(t,function(n){n=bn(n),Nn(e,n,vt(e[n],e))}),e});function _f(e){var t=e==null?0:e.length,n=K();return e=t?Ce(e,function(r){if(typeof r[1]!="function")throw new tn(E);return[n(r[0]),r[1]]}):[],ne(function(r){for(var a=-1;++a<t;){var s=e[a];if(Lt(s[0],this,r))return Lt(s[1],this,r)}})}function zi(e){return oc(Dt(e,F))}function Hs(e){return function(){return e}}function Ug(e,t){return e==null||e!==e?t:e}var Mg=yc(),bf=yc(!0);function lt(e){return e}function Ys(e){return gu(typeof e=="function"?e:Dt(e,F))}function Wg(e){return es(Dt(e,F))}function Bg(e,t){return vu(e,Dt(t,F))}var $g=ne(function(e,t){return function(n){return _i(n,e,t)}}),jg=ne(function(e,t){return function(n){return _i(e,n,t)}});function Qs(e,t,n){var r=rt(t),a=so(t,r);n==null&&!(Ue(t)&&(a.length||!r.length))&&(n=t,t=e,e=this,a=so(t,rt(t)));var s=!(Ue(n)&&"chain"in n)||!!n.chain,c=ln(e);return kt(a,function(f){var g=t[f];e[f]=g,c&&(e.prototype[f]=function(){var w=this.__chain__;if(s||w){var b=e(this.__wrapped__),S=b.__actions__=Tt(this.__actions__);return S.push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,Vt([this.value()],arguments))})}),e}function kg(){return et._===this&&(et._=Yn),this}function Js(){}function wf(e){return e=H(e),ne(function(t){return ts(t,e)})}var Vg=fs(Ce),Gg=fs(Ho),Af=fs(Oa);function Xs(e){return ys(e)?xa(bn(e)):tp(e)}function qg(e){return function(t){return e==null?o:Vr(e,t)}}var Hg=bc(),Yg=bc(!0);function Zs(){return[]}function Ks(){return!1}function Qg(){return{}}function Jg(){return""}function el(){return!0}function Sf(e,t){if(e=H(e),e<1||e>Kt)return[];var n=Mt,r=De(e,Mt);t=K(t),e-=Mt;for(var a=za(r,t);++n<e;)t(n);return a}function Xg(e){return ee(e)?Ce(e,bn):Qt(e)?[e]:Tt(Ts(he(e)))}function Zg(e){var t=++Lh;return he(e)+t}var Kg=Iu(function(e,t){return e+t},0),em=hs("ceil"),tm=Iu(function(e,t){return e/t},1),nm=hs("floor");function rm(e){return e&&e.length?_n(e,lt,dt):o}function im(e,t){return e&&e.length?_n(e,K(t,2),dt):o}function om(e){return Rl(e,lt)}function um(e,t){return Rl(e,K(t,2))}function am(e){return e&&e.length?_n(e,lt,mu):o}function sm(e,t){return e&&e.length?_n(e,K(t,2),mu):o}var lm=Iu(function(e,t){return e*t},1),cm=hs("round"),fm=Iu(function(e,t){return e-t},0);function hm(e){return e&&e.length?La(e,lt):0}function pm(e,t){return e&&e.length?La(e,K(t,2)):0}return d.after=Fd,d.ary=Wu,d.assign=Eo,d.assignIn=Ku,d.assignInWith=ar,d.assignWith=To,d.at=Oo,d.before=qc,d.bind=vt,d.bindAll=qs,d.bindKey=Bu,d.castArray=Gd,d.chain=Bc,d.chunk=Cp,d.compact=Ip,d.concat=xp,d.cond=_f,d.conforms=zi,d.constant=Hs,d.countBy=md,d.create=ea,d.curry=Hc,d.curryRight=Yc,d.debounce=$u,d.defaults=xi,d.defaultsDeep=tg,d.defer=Ud,d.delay=Rs,d.difference=Rp,d.differenceBy=Np,d.differenceWith=Lp,d.drop=zp,d.dropRight=Pp,d.dropRightWhile=Dp,d.dropWhile=Fp,d.fill=Up,d.filter=yd,d.flatMap=jc,d.flatMapDeep=bd,d.flatMapDepth=wd,d.flatten=It,d.flattenDeep=je,d.flattenDepth=Mp,d.flip=Md,d.flow=Mg,d.flowRight=bf,d.fromPairs=Wp,d.functions=uf,d.functionsIn=Ri,d.groupBy=Ad,d.initial=$p,d.intersection=Os,d.intersectionBy=jp,d.intersectionWith=tr,d.invert=sf,d.invertBy=lf,d.invokeMap=Ed,d.iteratee=Ys,d.keyBy=Td,d.keys=rt,d.keysIn=Rt,d.map=Uu,d.mapKeys=ag,d.mapValues=Ws,d.matches=Wg,d.matchesProperty=Bg,d.memoize=So,d.merge=Bs,d.mergeWith=$s,d.method=$g,d.methodOf=jg,d.mixin=Qs,d.negate=ju,d.nthArg=wf,d.omit=_t,d.omitBy=sg,d.once=Ns,d.orderBy=Od,d.over=Vg,d.overArgs=Ls,d.overEvery=Gg,d.overSome=Af,d.partial=zs,d.partialRight=Qc,d.partition=Cd,d.pick=cf,d.pickBy=Ni,d.property=Xs,d.propertyOf=qg,d.pull=kp,d.pullAll=Dc,d.pullAllBy=Vp,d.pullAllWith=Gp,d.pullAt=qp,d.range=Hg,d.rangeRight=Yg,d.rearg=Wd,d.reject=Rd,d.remove=Hp,d.rest=Bd,d.reverse=Du,d.sampleSize=Ld,d.set=ff,d.setWith=lg,d.shuffle=zd,d.slice=wo,d.sortBy=Gc,d.sortedUniq=Fc,d.sortedUniqBy=nr,d.split=mf,d.spread=$d,d.tail=ue,d.take=Uc,d.takeRight=an,d.takeRightWhile=Mc,d.takeWhile=Zp,d.tap=sd,d.throttle=jd,d.thru=Ao,d.toArray=rf,d.toPairs=hf,d.toPairsIn=pf,d.toPath=Xg,d.toPlainObject=Ms,d.transform=cg,d.unary=kd,d.union=ge,d.unionBy=Kp,d.unionWith=ed,d.uniq=td,d.uniqBy=nd,d.uniqWith=rd,d.unset=fg,d.unzip=Cs,d.unzipWith=Wc,d.update=hg,d.updateWith=pg,d.values=Li,d.valuesIn=dg,d.without=id,d.words=yf,d.wrap=Vd,d.xor=od,d.xorBy=Is,d.xorWith=ud,d.zip=xs,d.zipObject=nt,d.zipObjectDeep=Ft,d.zipWith=ad,d.entries=hf,d.entriesIn=pf,d.extend=Ku,d.extendWith=ar,Qs(d,d),d.add=Kg,d.attempt=Gs,d.camelCase=yg,d.capitalize=df,d.ceil=em,d.clamp=gg,d.clone=qd,d.cloneDeep=Yd,d.cloneDeepWith=Qd,d.cloneWith=Hd,d.conformsTo=Jd,d.deburr=gf,d.defaultTo=Ug,d.divide=tm,d.endsWith=_g,d.eq=be,d.escape=bg,d.escapeRegExp=wg,d.every=vd,d.find=_d,d.findIndex=Lc,d.findKey=ng,d.findLast=$c,d.findLastIndex=un,d.findLastKey=rg,d.floor=nm,d.forEach=kc,d.forEachRight=Vc,d.forIn=ig,d.forInRight=og,d.forOwn=ta,d.forOwnRight=Co,d.get=Mn,d.gt=ku,d.gte=Ps,d.has=af,d.hasIn=Io,d.head=zc,d.identity=lt,d.includes=Sd,d.indexOf=Bp,d.inRange=mg,d.invoke=ug,d.isArguments=Or,d.isArray=ee,d.isArrayBuffer=Re,d.isArrayLike=yt,d.isArrayLikeObject=ke,d.isBoolean=sn,d.isBuffer=wn,d.isDate=Xd,d.isElement=Ii,d.isEmpty=Vu,d.isEqual=Gu,d.isEqualWith=we,d.isError=Ds,d.isFinite=Jc,d.isFunction=ln,d.isInteger=Xc,d.isLength=qu,d.isMap=rr,d.isMatch=Hu,d.isMatchWith=Zc,d.isNaN=Yu,d.isNative=Kc,d.isNil=Qu,d.isNull=ef,d.isNumber=Fs,d.isObject=Ue,d.isObjectLike=Ne,d.isPlainObject=ir,d.isRegExp=or,d.isSafeInteger=Ju,d.isSet=tf,d.isString=Xu,d.isSymbol=Qt,d.isTypedArray=ur,d.isUndefined=Zu,d.isWeakMap=Us,d.isWeakSet=Zd,d.join=Pc,d.kebabCase=Ag,d.last=xt,d.lastIndexOf=Fe,d.lowerCase=Sg,d.lowerFirst=Eg,d.lt=nf,d.lte=Kd,d.max=rm,d.maxBy=im,d.mean=om,d.meanBy=um,d.min=am,d.minBy=sm,d.stubArray=Zs,d.stubFalse=Ks,d.stubObject=Qg,d.stubString=Jg,d.stubTrue=el,d.multiply=lm,d.nth=Be,d.noConflict=kg,d.noop=Js,d.now=Mu,d.pad=Tg,d.padEnd=Og,d.padStart=Cg,d.parseInt=Ig,d.random=vg,d.reduce=Id,d.reduceRight=xd,d.repeat=xg,d.replace=na,d.result=js,d.round=cm,d.runInContext=p,d.sample=Nd,d.size=Pd,d.snakeCase=ks,d.some=Dd,d.sortedIndex=Yp,d.sortedIndexBy=Fu,d.sortedIndexOf=Yt,d.sortedLastIndex=Qp,d.sortedLastIndexBy=Jp,d.sortedLastIndexOf=Xp,d.startCase=Rg,d.startsWith=Ng,d.subtract=fm,d.sum=hm,d.sumBy=pm,d.template=Lg,d.times=Sf,d.toFinite=Te,d.toInteger=H,d.toLength=of,d.toLower=Vs,d.toNumber=cn,d.toSafeInteger=eg,d.toString=he,d.toUpper=vf,d.trim=zg,d.trimEnd=Pg,d.trimStart=Dg,d.truncate=Qr,d.unescape=ie,d.uniqueId=Zg,d.upperCase=Fg,d.upperFirst=Wn,d.each=kc,d.eachRight=Vc,d.first=zc,Qs(d,function(){var e={};return Ln(d,function(t,n){_e.call(d.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),d.VERSION=h,kt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){d[e].placeholder=d}),kt(["drop","take"],function(e,t){ae.prototype[e]=function(n){n=n===o?1:Je(H(n),0);var r=this.__filtered__&&!t?new ae(this):this.clone();return r.__filtered__?r.__takeCount__=De(n,r.__takeCount__):r.__views__.push({size:De(n,Mt),type:e+(r.__dir__<0?"Right":"")}),r},ae.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),kt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==fr||n==Wi;ae.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:K(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),kt(["head","last"],function(e,t){var n="take"+(t?"Right":"");ae.prototype[e]=function(){return this[n](1).value()[0]}}),kt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");ae.prototype[e]=function(){return this.__filtered__?new ae(this):this[n](1)}}),ae.prototype.compact=function(){return this.filter(lt)},ae.prototype.find=function(e){return this.filter(e).head()},ae.prototype.findLast=function(e){return this.reverse().find(e)},ae.prototype.invokeMap=ne(function(e,t){return typeof e=="function"?new ae(this):this.map(function(n){return _i(n,e,t)})}),ae.prototype.reject=function(e){return this.filter(ju(K(e)))},ae.prototype.slice=function(e,t){e=H(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ae(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(t=H(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},ae.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ae.prototype.toArray=function(){return this.take(Mt)},Ln(ae.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=d[r?"take"+(t=="last"?"Right":""):t],s=r||/^find/.test(t);a&&(d.prototype[t]=function(){var c=this.__wrapped__,f=r?[1]:arguments,g=c instanceof ae,w=f[0],b=g||ee(c),S=function(B){var j=a.apply(d,Vt([B],f));return r&&T?j[0]:j};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var T=this.__chain__,R=!!this.__actions__.length,L=s&&!T,M=g&&!R;if(!s&&b){c=M?c:new ae(this);var z=e.apply(c,f);return z.__actions__.push({func:Ao,args:[S],thisArg:o}),new rn(z,T)}return L&&M?e.apply(this,f):(z=this.thru(S),L?r?z.value()[0]:z.value():z)})}),kt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Jo[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);d.prototype[e]=function(){var a=arguments;if(r&&!this.__chain__){var s=this.value();return t.apply(ee(s)?s:[],a)}return this[n](function(c){return t.apply(ee(c)?c:[],a)})}}),Ln(ae.prototype,function(e,t){var n=d[t];if(n){var r=n.name+"";_e.call(We,r)||(We[r]=[]),We[r].push({name:t,func:n})}}),We[go(o,X).name]=[{name:"wrapper",func:o}],ae.prototype.clone=Ql,ae.prototype.reverse=Mh,ae.prototype.value=Wh,d.prototype.at=ld,d.prototype.chain=cd,d.prototype.commit=fd,d.prototype.next=hd,d.prototype.plant=dd,d.prototype.reverse=gd,d.prototype.toJSON=d.prototype.valueOf=d.prototype.value=Ci,d.prototype.first=d.prototype.head,eo&&(d.prototype[eo]=pd),d},mn=Rh();Dr?((Dr.exports=mn)._=mn,wa._=mn):et._=mn}).call(xr)})(xf,xf.exports);var Le=xf.exports;const ua=i=>{const{sort:u,fields:o,omit:h,filters:m={},populate:A={},relation:E,pagination:C}=i,x=(m.$or||[]).filter(U=>!Object.keys(U).includes("removed")),N=m.$or?.some(U=>U.removed);let O={reports:{where:{resolved:!1}},...A},F={threadOf:{populate:{authorUser:{populate:!0,avatar:{populate:!0}},...A}}};if("author"in A){const{author:U,...Q}=A;O={reports:{where:{resolved:!1}},...Q,authorUser:U},F={threadOf:{populate:{authorUser:U,...Q}}}}return x.length&&!N?{...i,filters:{...Le.omit(m,"$or"),$and:[...m.$and||[],{$or:x},{$or:[{removed:{$null:!0}},{removed:!1}]}],related:E},populate:{...O,...F},pagination:C,sort:u,fields:o,omit:h}:{...i,filters:{...m,$or:[...x,{removed:{$null:!0}},{removed:!1}],related:E},populate:{...O,...F},pagination:C,sort:u,fields:o,omit:h}},jv=(i,u)=>{const{nonNull:o,stringArg:h}=u,{service:m}=i.plugin("graphql"),{args:A}=m("internals"),E=i.contentType(lr(i,"comment"));return{type:"ResponseFindAll",args:{relation:o(h()),filters:ft(i,"gql").buildContentTypeFilters(E),pagination:A.PaginationArg,sort:A.SortArg},async resolve(C,x){const{relation:N,filters:O,sort:F,pagination:U}=x;return await ft(i,"common").findAllFlat(ua({relation:N,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(O,E),sort:F,pagination:U?{...U,withCount:!Le.isEmpty(U)}:void 0}),void 0)}}},kv=(i,u)=>{const{nonNull:o,list:h,stringArg:m}=u,{service:A}=i.plugin("graphql"),{args:E}=A("internals"),{naming:{getFiltersInputTypeName:C}}=A("utils"),x=i.contentType(lr(i,"comment"));return{type:o(h("CommentNested")),args:{relation:o(m()),sort:E.SortArg,filters:C(x)},async resolve(N,O){const{relation:F,filters:U,sort:Q}=O;return await ft(i,"common").findAllInHierarchy({...ua({relation:F,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(U,x),sort:Q}),dropBlockedThreads:!0})}}},Cr={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"},ul={GENERIC:"GENERIC",STRAPI:"STRAPI"},Vv={relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i},Gv=(i,u)=>{const{nonNull:o,intArg:h,arg:m}=u,{service:A}=i.plugin("graphql"),{args:E}=A("internals"),{naming:{getFiltersInputTypeName:C}}=A("utils"),x=i.contentType(lr(i,"comment"));return{type:"ResponseFindAllPerAuthor",args:{authorId:o(h()),authorType:m({type:"CommentAuthorType"}),filters:C(x),pagination:E.PaginationArg,sort:E.SortArg},async resolve(N,O){const{authorId:F,authorType:U,filters:Q,sort:$,pagination:J}=O,te=U!==ul.GENERIC;return await ft(i,"common").findAllPerAuthor(ua({filters:ft(i,"gql").graphQLFiltersToStrapiQuery(Q,x),sort:$,pagination:J?{...J,withCount:!Le.isEmpty(J)}:void 0,authorId:F}),te)}}},qv=(i,u)=>{const o={findAllFlat:jv,findAllInHierarchy:kv,findAllPerAuthor:Gv};return u.extendType({type:"Query",definition(h){for(const[m,A]of Object.entries(o)){const E=A(i,u);h.field(m,E)}}})},Hv=i=>i.objectType({name:"CommentSingle",definition(u){u.id("id"),u.string("documentId"),u.nonNull.string("content"),u.boolean("blocked"),u.boolean("blockedThread"),u.boolean("removed"),u.string("approvalStatus"),u.field("threadOf",{type:"CommentSingle"}),u.field("author",{type:"CommentAuthor"}),u.string("createdAt"),u.string("updatedAt")}}),Yv=i=>i.objectType({name:"CommentAuthor",definition(u){u.id("id"),u.nonNull.string("name"),u.nonNull.string("email"),u.string("avatar")}}),Qv=i=>i.enumType({name:"CommentAuthorType",description:"User type which was the author of comment - Strapi built-in or generic",members:Object.values(ul)}),Jv=i=>i.objectType({name:"CommentNested",definition(u){u.id("id"),u.string("documentId"),u.nonNull.string("content"),u.boolean("blocked"),u.boolean("blockedThread"),u.string("approvalStatus"),u.boolean("removed"),u.field("threadOf",{type:"CommentSingle"}),u.list.field("children",{type:"CommentNested"}),u.field("author",{type:"CommentAuthor"}),u.string("createdAt"),u.string("updatedAt")}}),Xv=i=>i.inputObjectType({name:"CreateComment",definition(u){u.nonNull.string("content"),u.nonNull.string("relation"),u.id("threadOf"),u.field("author",{type:"CreateCommentAuthor"})}}),Zv=i=>i.inputObjectType({name:"CreateCommentAuthor",definition(u){u.nonNull.id("id"),u.nonNull.string("name"),u.string("email"),u.string("avatar")}}),Kv=i=>i.inputObjectType({name:"CreateReport",definition(u){u.id("commentId"),u.nonNull.string("relation"),u.nonNull.string("content"),u.field("reason",{type:"ReportReason"})}});function He(i,u){if(!!!i)throw new Error(u)}function Qm(i){return typeof i=="object"&&i!==null}function e0(i,u){if(!!!i)throw new Error("Unexpected invariant triggered.")}const t0=/\r\n|[\n\r]/g;function ym(i,u){let o=0,h=1;for(const m of i.body.matchAll(t0)){if(typeof m.index=="number"||e0(!1),m.index>=u)break;o=m.index+m[0].length,h+=1}return{line:h,column:u+1-o}}function n0(i){return Jm(i.source,ym(i.source,i.start))}function Jm(i,u){const o=i.locationOffset.column-1,h="".padStart(o)+i.body,m=u.line-1,A=i.locationOffset.line-1,E=u.line+A,C=u.line===1?o:0,x=u.column+C,N=`${i.name}:${E}:${x}
28
+ `,O=h.split(/\r\n|[\n\r]/g),F=O[m];if(F.length>120){const U=Math.floor(x/80),Q=x%80,$=[];for(let J=0;J<F.length;J+=80)$.push(F.slice(J,J+80));return N+Lm([[`${E} |`,$[0]],...$.slice(1,U+1).map(J=>["|",J]),["|","^".padStart(Q)],["|",$[U+1]]])}return N+Lm([[`${E-1} |`,O[m-1]],[`${E} |`,F],["|","^".padStart(x)],[`${E+1} |`,O[m+1]]])}function Lm(i){const u=i.filter(([h,m])=>m!==void 0),o=Math.max(...u.map(([h])=>h.length));return u.map(([h,m])=>h.padStart(o)+(m?" "+m:"")).join(`
29
+ `)}function r0(i){const u=i[0];return u==null||"kind"in u||"length"in u?{nodes:u,source:i[1],positions:i[2],path:i[3],originalError:i[4],extensions:i[5]}:u}class Bn extends Error{constructor(u,...o){var h,m,A;const{nodes:E,source:C,positions:x,path:N,originalError:O,extensions:F}=r0(o);super(u),this.name="GraphQLError",this.path=N??void 0,this.originalError=O??void 0,this.nodes=zm(Array.isArray(E)?E:E?[E]:void 0);const U=zm((h=this.nodes)===null||h===void 0?void 0:h.map($=>$.loc).filter($=>$!=null));this.source=C??(U==null||(m=U[0])===null||m===void 0?void 0:m.source),this.positions=x??U?.map($=>$.start),this.locations=x&&C?x.map($=>ym(C,$)):U?.map($=>ym($.source,$.start));const Q=Qm(O?.extensions)?O?.extensions:void 0;this.extensions=(A=F??Q)!==null&&A!==void 0?A:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),O!=null&&O.stack?Object.defineProperty(this,"stack",{value:O.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Bn):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let u=this.message;if(this.nodes)for(const o of this.nodes)o.loc&&(u+=`
30
30
 
31
- `+t0(o.loc));else if(this.source&&this.locations)for(const o of this.locations)u+=`
31
+ `+n0(o.loc));else if(this.source&&this.locations)for(const o of this.locations)u+=`
32
32
 
33
- `+Qm(this.source,o);return u}toJSON(){const u={message:this.message};return this.locations!=null&&(u.locations=this.locations),this.path!=null&&(u.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(u.extensions=this.extensions),u}}function Lm(i){return i===void 0||i.length===0?void 0:i}const Jm={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},r0=new Set(Object.keys(Jm));function zm(i){const u=i?.kind;return typeof u=="string"&&r0.has(u)}var Pm;(function(i){i.QUERY="query",i.MUTATION="mutation",i.SUBSCRIPTION="subscription"})(Pm||(Pm={}));var Xt;(function(i){i.NAME="Name",i.DOCUMENT="Document",i.OPERATION_DEFINITION="OperationDefinition",i.VARIABLE_DEFINITION="VariableDefinition",i.SELECTION_SET="SelectionSet",i.FIELD="Field",i.ARGUMENT="Argument",i.FRAGMENT_SPREAD="FragmentSpread",i.INLINE_FRAGMENT="InlineFragment",i.FRAGMENT_DEFINITION="FragmentDefinition",i.VARIABLE="Variable",i.INT="IntValue",i.FLOAT="FloatValue",i.STRING="StringValue",i.BOOLEAN="BooleanValue",i.NULL="NullValue",i.ENUM="EnumValue",i.LIST="ListValue",i.OBJECT="ObjectValue",i.OBJECT_FIELD="ObjectField",i.DIRECTIVE="Directive",i.NAMED_TYPE="NamedType",i.LIST_TYPE="ListType",i.NON_NULL_TYPE="NonNullType",i.SCHEMA_DEFINITION="SchemaDefinition",i.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",i.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",i.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",i.FIELD_DEFINITION="FieldDefinition",i.INPUT_VALUE_DEFINITION="InputValueDefinition",i.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",i.UNION_TYPE_DEFINITION="UnionTypeDefinition",i.ENUM_TYPE_DEFINITION="EnumTypeDefinition",i.ENUM_VALUE_DEFINITION="EnumValueDefinition",i.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",i.DIRECTIVE_DEFINITION="DirectiveDefinition",i.SCHEMA_EXTENSION="SchemaExtension",i.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",i.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",i.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",i.UNION_TYPE_EXTENSION="UnionTypeExtension",i.ENUM_TYPE_EXTENSION="EnumTypeExtension",i.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(Xt||(Xt={}));function Dm(i){return i===9||i===32}function i0(i){return i>=48&&i<=57}function Xm(i){return i>=97&&i<=122||i>=65&&i<=90}function o0(i){return Xm(i)||i===95}function u0(i){return Xm(i)||i0(i)||i===95}function a0(i,u){const o=i.replace(/"""/g,'\\"""'),h=o.split(/\r\n|[\n\r]/g),m=h.length===1,A=h.length>1&&h.slice(1).every(Q=>Q.length===0||Dm(Q.charCodeAt(0))),E=o.endsWith('\\"""'),C=i.endsWith('"')&&!E,x=i.endsWith("\\"),N=C||x,O=!m||i.length>70||N||A||E;let F="";const U=m&&Dm(i.charCodeAt(0));return(O&&!U||A)&&(F+=`
33
+ `+Jm(this.source,o);return u}toJSON(){const u={message:this.message};return this.locations!=null&&(u.locations=this.locations),this.path!=null&&(u.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(u.extensions=this.extensions),u}}function zm(i){return i===void 0||i.length===0?void 0:i}const Xm={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},i0=new Set(Object.keys(Xm));function Pm(i){const u=i?.kind;return typeof u=="string"&&i0.has(u)}var Dm;(function(i){i.QUERY="query",i.MUTATION="mutation",i.SUBSCRIPTION="subscription"})(Dm||(Dm={}));var Xt;(function(i){i.NAME="Name",i.DOCUMENT="Document",i.OPERATION_DEFINITION="OperationDefinition",i.VARIABLE_DEFINITION="VariableDefinition",i.SELECTION_SET="SelectionSet",i.FIELD="Field",i.ARGUMENT="Argument",i.FRAGMENT_SPREAD="FragmentSpread",i.INLINE_FRAGMENT="InlineFragment",i.FRAGMENT_DEFINITION="FragmentDefinition",i.VARIABLE="Variable",i.INT="IntValue",i.FLOAT="FloatValue",i.STRING="StringValue",i.BOOLEAN="BooleanValue",i.NULL="NullValue",i.ENUM="EnumValue",i.LIST="ListValue",i.OBJECT="ObjectValue",i.OBJECT_FIELD="ObjectField",i.DIRECTIVE="Directive",i.NAMED_TYPE="NamedType",i.LIST_TYPE="ListType",i.NON_NULL_TYPE="NonNullType",i.SCHEMA_DEFINITION="SchemaDefinition",i.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",i.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",i.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",i.FIELD_DEFINITION="FieldDefinition",i.INPUT_VALUE_DEFINITION="InputValueDefinition",i.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",i.UNION_TYPE_DEFINITION="UnionTypeDefinition",i.ENUM_TYPE_DEFINITION="EnumTypeDefinition",i.ENUM_VALUE_DEFINITION="EnumValueDefinition",i.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",i.DIRECTIVE_DEFINITION="DirectiveDefinition",i.SCHEMA_EXTENSION="SchemaExtension",i.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",i.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",i.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",i.UNION_TYPE_EXTENSION="UnionTypeExtension",i.ENUM_TYPE_EXTENSION="EnumTypeExtension",i.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(Xt||(Xt={}));function Fm(i){return i===9||i===32}function o0(i){return i>=48&&i<=57}function Zm(i){return i>=97&&i<=122||i>=65&&i<=90}function u0(i){return Zm(i)||i===95}function a0(i){return Zm(i)||o0(i)||i===95}function s0(i,u){const o=i.replace(/"""/g,'\\"""'),h=o.split(/\r\n|[\n\r]/g),m=h.length===1,A=h.length>1&&h.slice(1).every(Q=>Q.length===0||Fm(Q.charCodeAt(0))),E=o.endsWith('\\"""'),C=i.endsWith('"')&&!E,x=i.endsWith("\\"),N=C||x,O=!m||i.length>70||N||A||E;let F="";const U=m&&Fm(i.charCodeAt(0));return(O&&!U||A)&&(F+=`
34
34
  `),F+=o,(O||N)&&(F+=`
35
- `),'"""'+F+'"""'}const s0=10,Zm=2;function $n(i){return Pf(i,[])}function Pf(i,u){switch(typeof i){case"string":return JSON.stringify(i);case"function":return i.name?`[function ${i.name}]`:"[function]";case"object":return l0(i,u);default:return String(i)}}function l0(i,u){if(i===null)return"null";if(u.includes(i))return"[Circular]";const o=[...u,i];if(c0(i)){const h=i.toJSON();if(h!==i)return typeof h=="string"?h:Pf(h,o)}else if(Array.isArray(i))return h0(i,o);return f0(i,o)}function c0(i){return typeof i.toJSON=="function"}function f0(i,u){const o=Object.entries(i);return o.length===0?"{}":u.length>Zm?"["+p0(i)+"]":"{ "+o.map(([m,A])=>m+": "+Pf(A,u)).join(", ")+" }"}function h0(i,u){if(i.length===0)return"[]";if(u.length>Zm)return"[Array]";const o=Math.min(s0,i.length),h=i.length-o,m=[];for(let A=0;A<o;++A)m.push(Pf(i[A],u));return h===1?m.push("... 1 more item"):h>1&&m.push(`... ${h} more items`),"["+m.join(", ")+"]"}function p0(i){const u=Object.prototype.toString.call(i).replace(/^\[object /,"").replace(/]$/,"");if(u==="Object"&&typeof i.constructor=="function"){const o=i.constructor.name;if(typeof o=="string"&&o!=="")return o}return u}const d0=globalThis.process&&process.env.NODE_ENV==="production",Ui=d0?function(u,o){return u instanceof o}:function(u,o){if(u instanceof o)return!0;if(typeof u=="object"&&u!==null){var h;const m=o.prototype[Symbol.toStringTag],A=Symbol.toStringTag in u?u[Symbol.toStringTag]:(h=u.constructor)===null||h===void 0?void 0:h.name;if(m===A){const E=$n(u);throw new Error(`Cannot use ${m} "${E}" from another module or realm.
35
+ `),'"""'+F+'"""'}const l0=10,Km=2;function $n(i){return Pf(i,[])}function Pf(i,u){switch(typeof i){case"string":return JSON.stringify(i);case"function":return i.name?`[function ${i.name}]`:"[function]";case"object":return c0(i,u);default:return String(i)}}function c0(i,u){if(i===null)return"null";if(u.includes(i))return"[Circular]";const o=[...u,i];if(f0(i)){const h=i.toJSON();if(h!==i)return typeof h=="string"?h:Pf(h,o)}else if(Array.isArray(i))return p0(i,o);return h0(i,o)}function f0(i){return typeof i.toJSON=="function"}function h0(i,u){const o=Object.entries(i);return o.length===0?"{}":u.length>Km?"["+d0(i)+"]":"{ "+o.map(([m,A])=>m+": "+Pf(A,u)).join(", ")+" }"}function p0(i,u){if(i.length===0)return"[]";if(u.length>Km)return"[Array]";const o=Math.min(l0,i.length),h=i.length-o,m=[];for(let A=0;A<o;++A)m.push(Pf(i[A],u));return h===1?m.push("... 1 more item"):h>1&&m.push(`... ${h} more items`),"["+m.join(", ")+"]"}function d0(i){const u=Object.prototype.toString.call(i).replace(/^\[object /,"").replace(/]$/,"");if(u==="Object"&&typeof i.constructor=="function"){const o=i.constructor.name;if(typeof o=="string"&&o!=="")return o}return u}const g0=globalThis.process&&process.env.NODE_ENV==="production",Ui=g0?function(u,o){return u instanceof o}:function(u,o){if(u instanceof o)return!0;if(typeof u=="object"&&u!==null){var h;const m=o.prototype[Symbol.toStringTag],A=Symbol.toStringTag in u?u[Symbol.toStringTag]:(h=u.constructor)===null||h===void 0?void 0:h.name;if(m===A){const E=$n(u);throw new Error(`Cannot use ${m} "${E}" from another module or realm.
36
36
 
37
37
  Ensure that there is only one instance of "graphql" in the node_modules
38
38
  directory. If different versions of "graphql" are the dependencies of other
@@ -43,16 +43,16 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
43
43
  Duplicate "graphql" modules cannot be used at the same time since different
44
44
  versions may have different capabilities and behavior. The data from one
45
45
  version used in the function from another could produce confusing and
46
- spurious results.`)}}return!1},g0=5;function m0(i,u){const[o,h]=u?[i,u]:[void 0,i];let m=" Did you mean ";o&&(m+=o+" ");const A=h.map(x=>`"${x}"`);switch(A.length){case 0:return"";case 1:return m+A[0]+"?";case 2:return m+A[0]+" or "+A[1]+"?"}const E=A.slice(0,g0),C=E.pop();return m+E.join(", ")+", or "+C+"?"}function Fm(i){return i}function v0(i,u){const o=Object.create(null);for(const h of i)o[u(h)]=h;return o}function Om(i,u,o){const h=Object.create(null);for(const m of i)h[u(m)]=o(m);return h}function Df(i,u){const o=Object.create(null);for(const h of Object.keys(i))o[h]=u(i[h],h);return o}function y0(i,u){let o=0,h=0;for(;o<i.length&&h<u.length;){let m=i.charCodeAt(o),A=u.charCodeAt(h);if(Ef(m)&&Ef(A)){let E=0;do++o,E=E*10+m-_m,m=i.charCodeAt(o);while(Ef(m)&&E>0);let C=0;do++h,C=C*10+A-_m,A=u.charCodeAt(h);while(Ef(A)&&C>0);if(E<C)return-1;if(E>C)return 1}else{if(m<A)return-1;if(m>A)return 1;++o,++h}}return i.length-u.length}const _m=48,_0=57;function Ef(i){return!isNaN(i)&&_m<=i&&i<=_0}function b0(i,u){const o=Object.create(null),h=new w0(i),m=Math.floor(i.length*.4)+1;for(const A of u){const E=h.measure(A,m);E!==void 0&&(o[A]=E)}return Object.keys(o).sort((A,E)=>{const C=o[A]-o[E];return C!==0?C:y0(A,E)})}class w0{constructor(u){this._input=u,this._inputLowerCase=u.toLowerCase(),this._inputArray=Um(this._inputLowerCase),this._rows=[new Array(u.length+1).fill(0),new Array(u.length+1).fill(0),new Array(u.length+1).fill(0)]}measure(u,o){if(this._input===u)return 0;const h=u.toLowerCase();if(this._inputLowerCase===h)return 1;let m=Um(h),A=this._inputArray;if(m.length<A.length){const O=m;m=A,A=O}const E=m.length,C=A.length;if(E-C>o)return;const x=this._rows;for(let O=0;O<=C;O++)x[0][O]=O;for(let O=1;O<=E;O++){const F=x[(O-1)%3],U=x[O%3];let Q=U[0]=O;for(let $=1;$<=C;$++){const J=m[O-1]===A[$-1]?0:1;let te=Math.min(F[$]+1,U[$-1]+1,F[$-1]+J);if(O>1&&$>1&&m[O-1]===A[$-2]&&m[O-2]===A[$-1]){const X=x[(O-2)%3][$-2];te=Math.min(te,X+1)}te<Q&&(Q=te),U[$]=te}if(Q>o)return}const N=x[E%3][C];return N<=o?N:void 0}}function Um(i){const u=i.length,o=new Array(u);for(let h=0;h<u;++h)o[h]=i.charCodeAt(h);return o}function Rr(i){if(i==null)return Object.create(null);if(Object.getPrototypeOf(i)===null)return i;const u=Object.create(null);for(const[o,h]of Object.entries(i))u[o]=h;return u}function A0(i){return`"${i.replace(S0,E0)}"`}const S0=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function E0(i){return T0[i.charCodeAt(0)]}const T0=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],O0=Object.freeze({});function C0(i,u,o=Jm){const h=new Map;for(const X of Object.values(Xt))h.set(X,I0(u,X));let m,A=Array.isArray(i),E=[i],C=-1,x=[],N=i,O,F;const U=[],Q=[];do{C++;const X=C===E.length,me=X&&x.length!==0;if(X){if(O=Q.length===0?void 0:U[U.length-1],N=F,F=Q.pop(),me)if(A){N=N.slice();let ze=0;for(const[Ve,Ye]of x){const Me=Ve-ze;Ye===null?(N.splice(Me,1),ze++):N[Me]=Ye}}else{N={...N};for(const[ze,Ve]of x)N[ze]=Ve}C=m.index,E=m.keys,x=m.edits,A=m.inArray,m=m.prev}else if(F){if(O=A?C:E[C],N=F[O],N==null)continue;U.push(O)}let ve;if(!Array.isArray(N)){var $,J;zm(N)||He(!1,`Invalid AST Node: ${$n(N)}.`);const ze=X?($=h.get(N.kind))===null||$===void 0?void 0:$.leave:(J=h.get(N.kind))===null||J===void 0?void 0:J.enter;if(ve=ze?.call(u,N,O,F,U,Q),ve===O0)break;if(ve===!1){if(!X){U.pop();continue}}else if(ve!==void 0&&(x.push([O,ve]),!X))if(zm(ve))N=ve;else{U.pop();continue}}if(ve===void 0&&me&&x.push([O,N]),X)U.pop();else{var te;m={inArray:A,index:C,keys:E,edits:x,prev:m},A=Array.isArray(N),E=A?N:(te=o[N.kind])!==null&&te!==void 0?te:[],C=-1,x=[],F&&Q.push(F),F=N}}while(m!==void 0);return x.length!==0?x[x.length-1][1]:i}function I0(i,u){const o=i[u];return typeof o=="object"?o:typeof o=="function"?{enter:o,leave:void 0}:{enter:i.enter,leave:i.leave}}function Mm(i){return C0(i,R0)}const x0=80,R0={Name:{leave:i=>i.value},Variable:{leave:i=>"$"+i.name},Document:{leave:i=>V(i.definitions,`
46
+ spurious results.`)}}return!1},m0=5;function v0(i,u){const[o,h]=u?[i,u]:[void 0,i];let m=" Did you mean ";o&&(m+=o+" ");const A=h.map(x=>`"${x}"`);switch(A.length){case 0:return"";case 1:return m+A[0]+"?";case 2:return m+A[0]+" or "+A[1]+"?"}const E=A.slice(0,m0),C=E.pop();return m+E.join(", ")+", or "+C+"?"}function Um(i){return i}function y0(i,u){const o=Object.create(null);for(const h of i)o[u(h)]=h;return o}function Cm(i,u,o){const h=Object.create(null);for(const m of i)h[u(m)]=o(m);return h}function Df(i,u){const o=Object.create(null);for(const h of Object.keys(i))o[h]=u(i[h],h);return o}function _0(i,u){let o=0,h=0;for(;o<i.length&&h<u.length;){let m=i.charCodeAt(o),A=u.charCodeAt(h);if(Ef(m)&&Ef(A)){let E=0;do++o,E=E*10+m-_m,m=i.charCodeAt(o);while(Ef(m)&&E>0);let C=0;do++h,C=C*10+A-_m,A=u.charCodeAt(h);while(Ef(A)&&C>0);if(E<C)return-1;if(E>C)return 1}else{if(m<A)return-1;if(m>A)return 1;++o,++h}}return i.length-u.length}const _m=48,b0=57;function Ef(i){return!isNaN(i)&&_m<=i&&i<=b0}function w0(i,u){const o=Object.create(null),h=new A0(i),m=Math.floor(i.length*.4)+1;for(const A of u){const E=h.measure(A,m);E!==void 0&&(o[A]=E)}return Object.keys(o).sort((A,E)=>{const C=o[A]-o[E];return C!==0?C:_0(A,E)})}class A0{constructor(u){this._input=u,this._inputLowerCase=u.toLowerCase(),this._inputArray=Mm(this._inputLowerCase),this._rows=[new Array(u.length+1).fill(0),new Array(u.length+1).fill(0),new Array(u.length+1).fill(0)]}measure(u,o){if(this._input===u)return 0;const h=u.toLowerCase();if(this._inputLowerCase===h)return 1;let m=Mm(h),A=this._inputArray;if(m.length<A.length){const O=m;m=A,A=O}const E=m.length,C=A.length;if(E-C>o)return;const x=this._rows;for(let O=0;O<=C;O++)x[0][O]=O;for(let O=1;O<=E;O++){const F=x[(O-1)%3],U=x[O%3];let Q=U[0]=O;for(let $=1;$<=C;$++){const J=m[O-1]===A[$-1]?0:1;let te=Math.min(F[$]+1,U[$-1]+1,F[$-1]+J);if(O>1&&$>1&&m[O-1]===A[$-2]&&m[O-2]===A[$-1]){const X=x[(O-2)%3][$-2];te=Math.min(te,X+1)}te<Q&&(Q=te),U[$]=te}if(Q>o)return}const N=x[E%3][C];return N<=o?N:void 0}}function Mm(i){const u=i.length,o=new Array(u);for(let h=0;h<u;++h)o[h]=i.charCodeAt(h);return o}function Rr(i){if(i==null)return Object.create(null);if(Object.getPrototypeOf(i)===null)return i;const u=Object.create(null);for(const[o,h]of Object.entries(i))u[o]=h;return u}function S0(i){return`"${i.replace(E0,T0)}"`}const E0=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function T0(i){return O0[i.charCodeAt(0)]}const O0=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],C0=Object.freeze({});function I0(i,u,o=Xm){const h=new Map;for(const X of Object.values(Xt))h.set(X,x0(u,X));let m,A=Array.isArray(i),E=[i],C=-1,x=[],N=i,O,F;const U=[],Q=[];do{C++;const X=C===E.length,me=X&&x.length!==0;if(X){if(O=Q.length===0?void 0:U[U.length-1],N=F,F=Q.pop(),me)if(A){N=N.slice();let ze=0;for(const[Ve,Ye]of x){const Me=Ve-ze;Ye===null?(N.splice(Me,1),ze++):N[Me]=Ye}}else{N={...N};for(const[ze,Ve]of x)N[ze]=Ve}C=m.index,E=m.keys,x=m.edits,A=m.inArray,m=m.prev}else if(F){if(O=A?C:E[C],N=F[O],N==null)continue;U.push(O)}let ve;if(!Array.isArray(N)){var $,J;Pm(N)||He(!1,`Invalid AST Node: ${$n(N)}.`);const ze=X?($=h.get(N.kind))===null||$===void 0?void 0:$.leave:(J=h.get(N.kind))===null||J===void 0?void 0:J.enter;if(ve=ze?.call(u,N,O,F,U,Q),ve===C0)break;if(ve===!1){if(!X){U.pop();continue}}else if(ve!==void 0&&(x.push([O,ve]),!X))if(Pm(ve))N=ve;else{U.pop();continue}}if(ve===void 0&&me&&x.push([O,N]),X)U.pop();else{var te;m={inArray:A,index:C,keys:E,edits:x,prev:m},A=Array.isArray(N),E=A?N:(te=o[N.kind])!==null&&te!==void 0?te:[],C=-1,x=[],F&&Q.push(F),F=N}}while(m!==void 0);return x.length!==0?x[x.length-1][1]:i}function x0(i,u){const o=i[u];return typeof o=="object"?o:typeof o=="function"?{enter:o,leave:void 0}:{enter:i.enter,leave:i.leave}}function Wm(i){return I0(i,N0)}const R0=80,N0={Name:{leave:i=>i.value},Variable:{leave:i=>"$"+i.name},Document:{leave:i=>V(i.definitions,`
47
47
 
48
- `)},OperationDefinition:{leave(i){const u=le("(",V(i.variableDefinitions,", "),")"),o=V([i.operation,V([i.name,u]),V(i.directives," ")]," ");return(o==="query"?"":o+" ")+i.selectionSet}},VariableDefinition:{leave:({variable:i,type:u,defaultValue:o,directives:h})=>i+": "+u+le(" = ",o)+le(" ",V(h," "))},SelectionSet:{leave:({selections:i})=>sr(i)},Field:{leave({alias:i,name:u,arguments:o,directives:h,selectionSet:m}){const A=le("",i,": ")+u;let E=A+le("(",V(o,", "),")");return E.length>x0&&(E=A+le(`(
48
+ `)},OperationDefinition:{leave(i){const u=le("(",V(i.variableDefinitions,", "),")"),o=V([i.operation,V([i.name,u]),V(i.directives," ")]," ");return(o==="query"?"":o+" ")+i.selectionSet}},VariableDefinition:{leave:({variable:i,type:u,defaultValue:o,directives:h})=>i+": "+u+le(" = ",o)+le(" ",V(h," "))},SelectionSet:{leave:({selections:i})=>sr(i)},Field:{leave({alias:i,name:u,arguments:o,directives:h,selectionSet:m}){const A=le("",i,": ")+u;let E=A+le("(",V(o,", "),")");return E.length>R0&&(E=A+le(`(
49
49
  `,If(V(o,`
50
50
  `)),`
51
- )`)),V([E,V(h," "),m]," ")}},Argument:{leave:({name:i,value:u})=>i+": "+u},FragmentSpread:{leave:({name:i,directives:u})=>"..."+i+le(" ",V(u," "))},InlineFragment:{leave:({typeCondition:i,directives:u,selectionSet:o})=>V(["...",le("on ",i),V(u," "),o]," ")},FragmentDefinition:{leave:({name:i,typeCondition:u,variableDefinitions:o,directives:h,selectionSet:m})=>`fragment ${i}${le("(",V(o,", "),")")} on ${u} ${le("",V(h," ")," ")}`+m},IntValue:{leave:({value:i})=>i},FloatValue:{leave:({value:i})=>i},StringValue:{leave:({value:i,block:u})=>u?a0(i):A0(i)},BooleanValue:{leave:({value:i})=>i?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:i})=>i},ListValue:{leave:({values:i})=>"["+V(i,", ")+"]"},ObjectValue:{leave:({fields:i})=>"{"+V(i,", ")+"}"},ObjectField:{leave:({name:i,value:u})=>i+": "+u},Directive:{leave:({name:i,arguments:u})=>"@"+i+le("(",V(u,", "),")")},NamedType:{leave:({name:i})=>i},ListType:{leave:({type:i})=>"["+i+"]"},NonNullType:{leave:({type:i})=>i+"!"},SchemaDefinition:{leave:({description:i,directives:u,operationTypes:o})=>le("",i,`
51
+ )`)),V([E,V(h," "),m]," ")}},Argument:{leave:({name:i,value:u})=>i+": "+u},FragmentSpread:{leave:({name:i,directives:u})=>"..."+i+le(" ",V(u," "))},InlineFragment:{leave:({typeCondition:i,directives:u,selectionSet:o})=>V(["...",le("on ",i),V(u," "),o]," ")},FragmentDefinition:{leave:({name:i,typeCondition:u,variableDefinitions:o,directives:h,selectionSet:m})=>`fragment ${i}${le("(",V(o,", "),")")} on ${u} ${le("",V(h," ")," ")}`+m},IntValue:{leave:({value:i})=>i},FloatValue:{leave:({value:i})=>i},StringValue:{leave:({value:i,block:u})=>u?s0(i):S0(i)},BooleanValue:{leave:({value:i})=>i?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:i})=>i},ListValue:{leave:({values:i})=>"["+V(i,", ")+"]"},ObjectValue:{leave:({fields:i})=>"{"+V(i,", ")+"}"},ObjectField:{leave:({name:i,value:u})=>i+": "+u},Directive:{leave:({name:i,arguments:u})=>"@"+i+le("(",V(u,", "),")")},NamedType:{leave:({name:i})=>i},ListType:{leave:({type:i})=>"["+i+"]"},NonNullType:{leave:({type:i})=>i+"!"},SchemaDefinition:{leave:({description:i,directives:u,operationTypes:o})=>le("",i,`
52
52
  `)+V(["schema",V(u," "),sr(o)]," ")},OperationTypeDefinition:{leave:({operation:i,type:u})=>i+": "+u},ScalarTypeDefinition:{leave:({description:i,name:u,directives:o})=>le("",i,`
53
53
  `)+V(["scalar",u,V(o," ")]," ")},ObjectTypeDefinition:{leave:({description:i,name:u,interfaces:o,directives:h,fields:m})=>le("",i,`
54
54
  `)+V(["type",u,le("implements ",V(o," & ")),V(h," "),sr(m)]," ")},FieldDefinition:{leave:({description:i,name:u,arguments:o,type:h,directives:m})=>le("",i,`
55
- `)+u+(Wm(o)?le(`(
55
+ `)+u+(Bm(o)?le(`(
56
56
  `,If(V(o,`
57
57
  `)),`
58
58
  )`):le("(",V(o,", "),")"))+": "+h+le(" ",V(m," "))},InputValueDefinition:{leave:({description:i,name:u,type:o,defaultValue:h,directives:m})=>le("",i,`
@@ -62,18 +62,18 @@ spurious results.`)}}return!1},g0=5;function m0(i,u){const[o,h]=u?[i,u]:[void 0,
62
62
  `)+V(["enum",u,V(o," "),sr(h)]," ")},EnumValueDefinition:{leave:({description:i,name:u,directives:o})=>le("",i,`
63
63
  `)+V([u,V(o," ")]," ")},InputObjectTypeDefinition:{leave:({description:i,name:u,directives:o,fields:h})=>le("",i,`
64
64
  `)+V(["input",u,V(o," "),sr(h)]," ")},DirectiveDefinition:{leave:({description:i,name:u,arguments:o,repeatable:h,locations:m})=>le("",i,`
65
- `)+"directive @"+u+(Wm(o)?le(`(
65
+ `)+"directive @"+u+(Bm(o)?le(`(
66
66
  `,If(V(o,`
67
67
  `)),`
68
68
  )`):le("(",V(o,", "),")"))+(h?" repeatable":"")+" on "+V(m," | ")},SchemaExtension:{leave:({directives:i,operationTypes:u})=>V(["extend schema",V(i," "),sr(u)]," ")},ScalarTypeExtension:{leave:({name:i,directives:u})=>V(["extend scalar",i,V(u," ")]," ")},ObjectTypeExtension:{leave:({name:i,interfaces:u,directives:o,fields:h})=>V(["extend type",i,le("implements ",V(u," & ")),V(o," "),sr(h)]," ")},InterfaceTypeExtension:{leave:({name:i,interfaces:u,directives:o,fields:h})=>V(["extend interface",i,le("implements ",V(u," & ")),V(o," "),sr(h)]," ")},UnionTypeExtension:{leave:({name:i,directives:u,types:o})=>V(["extend union",i,V(u," "),le("= ",V(o," | "))]," ")},EnumTypeExtension:{leave:({name:i,directives:u,values:o})=>V(["extend enum",i,V(u," "),sr(o)]," ")},InputObjectTypeExtension:{leave:({name:i,directives:u,fields:o})=>V(["extend input",i,V(u," "),sr(o)]," ")}};function V(i,u=""){var o;return(o=i?.filter(h=>h).join(u))!==null&&o!==void 0?o:""}function sr(i){return le(`{
69
69
  `,If(V(i,`
70
70
  `)),`
71
71
  }`)}function le(i,u,o=""){return u!=null&&u!==""?i+u+o:""}function If(i){return le(" ",i.replace(/\n/g,`
72
- `))}function Wm(i){var u;return(u=i?.some(o=>o.includes(`
73
- `)))!==null&&u!==void 0?u:!1}function bm(i,u){switch(i.kind){case Xt.NULL:return null;case Xt.INT:return parseInt(i.value,10);case Xt.FLOAT:return parseFloat(i.value);case Xt.STRING:case Xt.ENUM:case Xt.BOOLEAN:return i.value;case Xt.LIST:return i.values.map(o=>bm(o,u));case Xt.OBJECT:return Om(i.fields,o=>o.name.value,o=>bm(o.value,u));case Xt.VARIABLE:return u?.[i.name.value]}}function cr(i){if(i!=null||He(!1,"Must provide name."),typeof i=="string"||He(!1,"Expected name to be a string."),i.length===0)throw new Bn("Expected name to be a non-empty string.");for(let u=1;u<i.length;++u)if(!u0(i.charCodeAt(u)))throw new Bn(`Names must only contain [_a-zA-Z0-9] but "${i}" does not.`);if(!o0(i.charCodeAt(0)))throw new Bn(`Names must start with [_a-zA-Z] but "${i}" does not.`);return i}function N0(i){if(i==="true"||i==="false"||i==="null")throw new Bn(`Enum values cannot be named: ${i}`);return cr(i)}function ll(i){return L0(i)||z0(i)||P0(i)||D0(i)||F0(i)||U0(i)||M0(i)||Cm(i)}function L0(i){return Ui(i,tv)}function z0(i){return Ui(i,j0)}function P0(i){return Ui(i,G0)}function D0(i){return Ui(i,q0)}function F0(i){return Ui(i,Y0)}function U0(i){return Ui(i,Q0)}function M0(i){return Ui(i,W0)}function Cm(i){return Ui(i,B0)}class W0{constructor(u){ll(u)||He(!1,`Expected ${$n(u)} to be a GraphQL type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class B0{constructor(u){$0(u)||He(!1,`Expected ${$n(u)} to be a GraphQL nullable type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function $0(i){return ll(i)&&!Cm(i)}function Km(i){return typeof i=="function"?i():i}function ev(i){return typeof i=="function"?i():i}class tv{constructor(u){var o,h,m,A;const E=(o=u.parseValue)!==null&&o!==void 0?o:Fm;this.name=cr(u.name),this.description=u.description,this.specifiedByURL=u.specifiedByURL,this.serialize=(h=u.serialize)!==null&&h!==void 0?h:Fm,this.parseValue=E,this.parseLiteral=(m=u.parseLiteral)!==null&&m!==void 0?m:(C,x)=>E(bm(C,x)),this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(A=u.extensionASTNodes)!==null&&A!==void 0?A:[],u.specifiedByURL==null||typeof u.specifiedByURL=="string"||He(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${$n(u.specifiedByURL)}.`),u.serialize==null||typeof u.serialize=="function"||He(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),u.parseLiteral&&(typeof u.parseValue=="function"&&typeof u.parseLiteral=="function"||He(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class j0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.isTypeOf=u.isTypeOf,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=()=>rv(u),this._interfaces=()=>nv(u),u.isTypeOf==null||typeof u.isTypeOf=="function"||He(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${$n(u.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:iv(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function nv(i){var u;const o=Km((u=i.interfaces)!==null&&u!==void 0?u:[]);return Array.isArray(o)||He(!1,`${i.name} interfaces must be an Array or a function which returns an Array.`),o}function rv(i){const u=ev(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Df(u,(o,h)=>{var m;aa(o)||He(!1,`${i.name}.${h} field config must be an object.`),o.resolve==null||typeof o.resolve=="function"||He(!1,`${i.name}.${h} field resolver must be a function if provided, but got: ${$n(o.resolve)}.`);const A=(m=o.args)!==null&&m!==void 0?m:{};return aa(A)||He(!1,`${i.name}.${h} args must be an object with argument names as keys.`),{name:cr(h),description:o.description,type:o.type,args:k0(A),resolve:o.resolve,subscribe:o.subscribe,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}})}function k0(i){return Object.entries(i).map(([u,o])=>({name:cr(u),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}))}function aa(i){return Ym(i)&&!Array.isArray(i)}function iv(i){return Df(i,u=>({description:u.description,type:u.type,args:V0(u.args),resolve:u.resolve,subscribe:u.subscribe,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}function V0(i){return Om(i,u=>u.name,u=>({description:u.description,type:u.type,defaultValue:u.defaultValue,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}class G0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=rv.bind(void 0,u),this._interfaces=nv.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${$n(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:iv(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class q0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._types=H0.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${$n(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function H0(i){const u=Km(i.types);return Array.isArray(u)||He(!1,`Must provide Array of types or a function which returns such an array for Union ${i.name}.`),u}class Y0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._values=typeof u.values=="function"?u.values:Bm(this.name,u.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=Bm(this.name,this._values())),this._values}getValue(u){return this._nameLookup===null&&(this._nameLookup=v0(this.getValues(),o=>o.name)),this._nameLookup[u]}serialize(u){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(h=>[h.value,h])));const o=this._valueLookup.get(u);if(o===void 0)throw new Bn(`Enum "${this.name}" cannot represent value: ${$n(u)}`);return o.name}parseValue(u){if(typeof u!="string"){const h=$n(u);throw new Bn(`Enum "${this.name}" cannot represent non-string value: ${h}.`+Tf(this,h))}const o=this.getValue(u);if(o==null)throw new Bn(`Value "${u}" does not exist in "${this.name}" enum.`+Tf(this,u));return o.value}parseLiteral(u,o){if(u.kind!==Xt.ENUM){const m=Mm(u);throw new Bn(`Enum "${this.name}" cannot represent non-enum value: ${m}.`+Tf(this,m),{nodes:u})}const h=this.getValue(u.value);if(h==null){const m=Mm(u);throw new Bn(`Value "${m}" does not exist in "${this.name}" enum.`+Tf(this,m),{nodes:u})}return h.value}toConfig(){const u=Om(this.getValues(),o=>o.name,o=>({description:o.description,value:o.value,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,values:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Tf(i,u){const o=i.getValues().map(m=>m.name),h=b0(u,o);return m0("the enum value",h)}function Bm(i,u){return aa(u)||He(!1,`${i} values must be an object with value names as keys.`),Object.entries(u).map(([o,h])=>(aa(h)||He(!1,`${i}.${o} must refer to an object with a "value" key representing an internal value but got: ${$n(h)}.`),{name:N0(o),description:h.description,value:h.value!==void 0?h.value:o,deprecationReason:h.deprecationReason,extensions:Rr(h.extensions),astNode:h.astNode}))}class Q0{constructor(u){var o,h;this.name=cr(u.name),this.description=u.description,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this.isOneOf=(h=u.isOneOf)!==null&&h!==void 0?h:!1,this._fields=J0.bind(void 0,u)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){const u=Df(this.getFields(),o=>({description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,fields:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function J0(i){const u=ev(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Df(u,(o,h)=>(!("resolve"in o)||He(!1,`${i.name}.${h} field has a resolve property, but Input Types cannot define resolvers.`),{name:cr(h),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}))}function Mi(i){const u=X0(i);if(u)throw u;return i}function X0(i){if(typeof i=="string"||He(!1,"Expected name to be a string."),i.startsWith("__"))return new Bn(`Name "${i}" must not begin with "__", which is reserved by GraphQL introspection.`);try{cr(i)}catch(u){return u}}const Z0=i=>i.scalarType({name:"ID",asNexusMethod:"id",description:"id as string or integer",serialize:u=>u,parseValue(u){const o=parseInt(u);return Le.isNumber(o)?o:u},parseLiteral(u){return u.kind===Xt.INT||u.kind===Xt.STRING?u.value:null}}),K0=i=>i.inputObjectType({name:"IdentifyCommentAuthor",definition(u){u.nonNull.id("id")}}),ey=i=>i.inputObjectType({name:"RemoveComment",definition(u){u.id("id"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),ty=i=>i.objectType({name:"Report",definition(u){u.id("id"),u.nonNull.string("content"),u.field("reason",{type:"ReportReason"}),u.field("related",{type:"CommentSingle"}),u.string("createdAt"),u.string("updatedAt")}}),ny=(i,{reportReasons:u})=>i.enumType({name:"ReportReason",description:"Reason of abuse report",members:Object.values(u)}),ry=i=>i.objectType({name:"ResponseFindAll",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),iy=i=>i.objectType({name:"ResponseFindAllPerAuthor",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),oy=i=>i.objectType({name:"ResponseMeta",definition(u){u.field("pagination",{type:"ResponsePagination"})}}),uy=i=>i.objectType({name:"ResponsePagination",definition(u){u.int("page"),u.int("pageSize"),u.int("pageCount"),u.int("total"),u.int("start"),u.int("limit")}}),ay=i=>i.inputObjectType({name:"UpdateComment",definition(u){u.id("id"),u.nonNull.string("content"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),sy=[qv,Hv,Yv,Qv,Jv,Xv,Zv,Z0,K0,ey,ny,ry,iy,oy,uy,ay,ty],ly=(i,u)=>sy.map(o=>o(u,i)),ov=i=>i.plugin("graphql").service("extension"),cy=i=>{const u=ov(i);u.shadowCRUD(lr(i,"comment")).disable(),u.shadowCRUD(lr(i,"comment")).disableQueries(),u.shadowCRUD(lr(i,"comment")).disableMutations(),u.shadowCRUD(lr(i,"comment-report")).disable(),u.shadowCRUD(lr(i,"comment-report")).disableQueries(),u.shadowCRUD(lr(i,"comment-report")).disableMutations()},fy=async({strapi:i})=>{i.plugin("graphql")&&(cy(i),(await ft(i,"common").getConfig(oa.ENABLED_COLLECTIONS,[])).length&&await hy(i))},hy=async i=>{const u=ov(i),o=await ft(i,"common").getConfig();u.use(({strapi:h,nexus:m})=>{const A=ly(o,m),E=Gv(h,m),C=Bv(h,m),x=Dv(o);return{types:[A,E,C],resolversConfig:x}})},ra={comments:{read:"comments-read",moderate:"comments-moderate"},reports:{read:"reports-read",review:"reports-review"},settings:{read:"settings-read",change:"settings-change"}},py=async({strapi:i})=>{if(i.plugin("graphql")&&await fy({strapi:i}),Object.keys(i.plugins).indexOf("users-permissions")===-1)throw new Error("In order to make the comments plugin work the users-permissions plugin is required");const u=[{section:"plugins",displayName:"Comments: Read",uid:ra.comments.read,pluginName:"comments"},{section:"plugins",displayName:"Comments: Moderate",uid:ra.comments.moderate,pluginName:"comments"},{section:"plugins",displayName:"Reports: Read",uid:ra.reports.read,pluginName:"comments"},{section:"plugins",displayName:"Reports: Moderate",uid:ra.reports.review,pluginName:"comments"},{section:"plugins",displayName:"Settings: Read",uid:ra.settings.read,pluginName:"comments"},{section:"plugins",displayName:"Settings: Change",uid:ra.settings.change,pluginName:"comments"}];await i.admin.services.permission.actionProvider.registerMany(u)},dy={isValidationEnabled:!0,enabledCollections:[],moderatorRoles:[],approvalFlow:[],entryLabel:{"*":["Title","title","Name","name","Subject","subject"]},reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER},blockedAuthorProps:[]},gy=v.z.object({[Zt.BAD_LANGUAGE]:v.z.literal(Zt.BAD_LANGUAGE),[Zt.OTHER]:v.z.literal(Zt.OTHER),[Zt.DISCRIMINATION]:v.z.literal(Zt.DISCRIMINATION)}),wm=v.z.object({isValidationEnabled:v.z.boolean().optional(),reportReasons:gy.optional(),isGQLPluginEnabled:v.z.boolean().optional(),[Cr.ENABLED_COLLECTIONS]:v.z.array(v.z.string()),[Cr.MODERATOR_ROLES]:v.z.array(v.z.string()),[Cr.APPROVAL_FLOW]:v.z.array(v.z.string()),[Cr.ENTRY_LABEL]:v.z.record(v.z.array(v.z.string())),[Cr.BAD_WORDS]:v.z.boolean().optional(),[Cr.AUTHOR_BLOCKED_PROPS]:v.z.array(v.z.string()),gql:v.z.object({auth:v.z.boolean().optional()}).optional(),client:v.z.object({url:v.z.string().nullable(),contactEmail:v.z.string().nullable()}).default({url:null,contactEmail:null})}),my={default:wm.parse(dy),validate:i=>wm.safeParse(i)},Y=({left:i,right:u})=>{if(u!==void 0&&i!==void 0)throw new Error(`Received both left and right values at runtime when opening an Either
72
+ `))}function Bm(i){var u;return(u=i?.some(o=>o.includes(`
73
+ `)))!==null&&u!==void 0?u:!1}function bm(i,u){switch(i.kind){case Xt.NULL:return null;case Xt.INT:return parseInt(i.value,10);case Xt.FLOAT:return parseFloat(i.value);case Xt.STRING:case Xt.ENUM:case Xt.BOOLEAN:return i.value;case Xt.LIST:return i.values.map(o=>bm(o,u));case Xt.OBJECT:return Cm(i.fields,o=>o.name.value,o=>bm(o.value,u));case Xt.VARIABLE:return u?.[i.name.value]}}function cr(i){if(i!=null||He(!1,"Must provide name."),typeof i=="string"||He(!1,"Expected name to be a string."),i.length===0)throw new Bn("Expected name to be a non-empty string.");for(let u=1;u<i.length;++u)if(!a0(i.charCodeAt(u)))throw new Bn(`Names must only contain [_a-zA-Z0-9] but "${i}" does not.`);if(!u0(i.charCodeAt(0)))throw new Bn(`Names must start with [_a-zA-Z] but "${i}" does not.`);return i}function L0(i){if(i==="true"||i==="false"||i==="null")throw new Bn(`Enum values cannot be named: ${i}`);return cr(i)}function ll(i){return z0(i)||P0(i)||D0(i)||F0(i)||U0(i)||M0(i)||W0(i)||Im(i)}function z0(i){return Ui(i,nv)}function P0(i){return Ui(i,k0)}function D0(i){return Ui(i,q0)}function F0(i){return Ui(i,H0)}function U0(i){return Ui(i,Q0)}function M0(i){return Ui(i,J0)}function W0(i){return Ui(i,B0)}function Im(i){return Ui(i,$0)}class B0{constructor(u){ll(u)||He(!1,`Expected ${$n(u)} to be a GraphQL type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class $0{constructor(u){j0(u)||He(!1,`Expected ${$n(u)} to be a GraphQL nullable type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function j0(i){return ll(i)&&!Im(i)}function ev(i){return typeof i=="function"?i():i}function tv(i){return typeof i=="function"?i():i}class nv{constructor(u){var o,h,m,A;const E=(o=u.parseValue)!==null&&o!==void 0?o:Um;this.name=cr(u.name),this.description=u.description,this.specifiedByURL=u.specifiedByURL,this.serialize=(h=u.serialize)!==null&&h!==void 0?h:Um,this.parseValue=E,this.parseLiteral=(m=u.parseLiteral)!==null&&m!==void 0?m:(C,x)=>E(bm(C,x)),this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(A=u.extensionASTNodes)!==null&&A!==void 0?A:[],u.specifiedByURL==null||typeof u.specifiedByURL=="string"||He(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${$n(u.specifiedByURL)}.`),u.serialize==null||typeof u.serialize=="function"||He(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),u.parseLiteral&&(typeof u.parseValue=="function"&&typeof u.parseLiteral=="function"||He(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class k0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.isTypeOf=u.isTypeOf,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=()=>iv(u),this._interfaces=()=>rv(u),u.isTypeOf==null||typeof u.isTypeOf=="function"||He(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${$n(u.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:ov(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function rv(i){var u;const o=ev((u=i.interfaces)!==null&&u!==void 0?u:[]);return Array.isArray(o)||He(!1,`${i.name} interfaces must be an Array or a function which returns an Array.`),o}function iv(i){const u=tv(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Df(u,(o,h)=>{var m;aa(o)||He(!1,`${i.name}.${h} field config must be an object.`),o.resolve==null||typeof o.resolve=="function"||He(!1,`${i.name}.${h} field resolver must be a function if provided, but got: ${$n(o.resolve)}.`);const A=(m=o.args)!==null&&m!==void 0?m:{};return aa(A)||He(!1,`${i.name}.${h} args must be an object with argument names as keys.`),{name:cr(h),description:o.description,type:o.type,args:V0(A),resolve:o.resolve,subscribe:o.subscribe,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}})}function V0(i){return Object.entries(i).map(([u,o])=>({name:cr(u),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}))}function aa(i){return Qm(i)&&!Array.isArray(i)}function ov(i){return Df(i,u=>({description:u.description,type:u.type,args:G0(u.args),resolve:u.resolve,subscribe:u.subscribe,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}function G0(i){return Cm(i,u=>u.name,u=>({description:u.description,type:u.type,defaultValue:u.defaultValue,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}class q0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=iv.bind(void 0,u),this._interfaces=rv.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${$n(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:ov(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class H0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._types=Y0.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${$n(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Y0(i){const u=ev(i.types);return Array.isArray(u)||He(!1,`Must provide Array of types or a function which returns such an array for Union ${i.name}.`),u}class Q0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._values=typeof u.values=="function"?u.values:$m(this.name,u.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=$m(this.name,this._values())),this._values}getValue(u){return this._nameLookup===null&&(this._nameLookup=y0(this.getValues(),o=>o.name)),this._nameLookup[u]}serialize(u){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(h=>[h.value,h])));const o=this._valueLookup.get(u);if(o===void 0)throw new Bn(`Enum "${this.name}" cannot represent value: ${$n(u)}`);return o.name}parseValue(u){if(typeof u!="string"){const h=$n(u);throw new Bn(`Enum "${this.name}" cannot represent non-string value: ${h}.`+Tf(this,h))}const o=this.getValue(u);if(o==null)throw new Bn(`Value "${u}" does not exist in "${this.name}" enum.`+Tf(this,u));return o.value}parseLiteral(u,o){if(u.kind!==Xt.ENUM){const m=Wm(u);throw new Bn(`Enum "${this.name}" cannot represent non-enum value: ${m}.`+Tf(this,m),{nodes:u})}const h=this.getValue(u.value);if(h==null){const m=Wm(u);throw new Bn(`Value "${m}" does not exist in "${this.name}" enum.`+Tf(this,m),{nodes:u})}return h.value}toConfig(){const u=Cm(this.getValues(),o=>o.name,o=>({description:o.description,value:o.value,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,values:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Tf(i,u){const o=i.getValues().map(m=>m.name),h=w0(u,o);return v0("the enum value",h)}function $m(i,u){return aa(u)||He(!1,`${i} values must be an object with value names as keys.`),Object.entries(u).map(([o,h])=>(aa(h)||He(!1,`${i}.${o} must refer to an object with a "value" key representing an internal value but got: ${$n(h)}.`),{name:L0(o),description:h.description,value:h.value!==void 0?h.value:o,deprecationReason:h.deprecationReason,extensions:Rr(h.extensions),astNode:h.astNode}))}class J0{constructor(u){var o,h;this.name=cr(u.name),this.description=u.description,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this.isOneOf=(h=u.isOneOf)!==null&&h!==void 0?h:!1,this._fields=X0.bind(void 0,u)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){const u=Df(this.getFields(),o=>({description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,fields:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function X0(i){const u=tv(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Df(u,(o,h)=>(!("resolve"in o)||He(!1,`${i.name}.${h} field has a resolve property, but Input Types cannot define resolvers.`),{name:cr(h),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}))}function Mi(i){const u=Z0(i);if(u)throw u;return i}function Z0(i){if(typeof i=="string"||He(!1,"Expected name to be a string."),i.startsWith("__"))return new Bn(`Name "${i}" must not begin with "__", which is reserved by GraphQL introspection.`);try{cr(i)}catch(u){return u}}const K0=i=>i.scalarType({name:"ID",asNexusMethod:"id",description:"id as string or integer",serialize:u=>u,parseValue(u){const o=parseInt(u);return Le.isNumber(o)?o:u},parseLiteral(u){return u.kind===Xt.INT||u.kind===Xt.STRING?u.value:null}}),ey=i=>i.inputObjectType({name:"IdentifyCommentAuthor",definition(u){u.nonNull.id("id")}}),ty=i=>i.inputObjectType({name:"RemoveComment",definition(u){u.id("id"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),ny=i=>i.objectType({name:"Report",definition(u){u.id("id"),u.nonNull.string("content"),u.field("reason",{type:"ReportReason"}),u.field("related",{type:"CommentSingle"}),u.string("createdAt"),u.string("updatedAt")}}),ry=(i,{reportReasons:u})=>i.enumType({name:"ReportReason",description:"Reason of abuse report",members:Object.values(u)}),iy=i=>i.objectType({name:"ResponseFindAll",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),oy=i=>i.objectType({name:"ResponseFindAllPerAuthor",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),uy=i=>i.objectType({name:"ResponseMeta",definition(u){u.field("pagination",{type:"ResponsePagination"})}}),ay=i=>i.objectType({name:"ResponsePagination",definition(u){u.int("page"),u.int("pageSize"),u.int("pageCount"),u.int("total"),u.int("start"),u.int("limit")}}),sy=i=>i.inputObjectType({name:"UpdateComment",definition(u){u.id("id"),u.nonNull.string("content"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),ly=[Hv,Yv,Qv,Jv,Xv,Zv,Kv,K0,ey,ty,ry,iy,oy,uy,ay,sy,ny],cy=(i,u)=>ly.map(o=>o(u,i)),uv=i=>i.plugin("graphql").service("extension"),fy=i=>{const u=uv(i);u.shadowCRUD(lr(i,"comment")).disable(),u.shadowCRUD(lr(i,"comment")).disableQueries(),u.shadowCRUD(lr(i,"comment")).disableMutations(),u.shadowCRUD(lr(i,"comment-report")).disable(),u.shadowCRUD(lr(i,"comment-report")).disableQueries(),u.shadowCRUD(lr(i,"comment-report")).disableMutations()},hy=async({strapi:i})=>{i.plugin("graphql")&&(fy(i),(await ft(i,"common").getConfig(oa.ENABLED_COLLECTIONS,[])).length&&await py(i))},py=async i=>{const u=uv(i),o=await ft(i,"common").getConfig();u.use(({strapi:h,nexus:m})=>{const A=cy(o,m),E=qv(h,m),C=$v(h,m),x=Fv(o);return{types:[A,E,C],resolversConfig:x}})},ra={comments:{read:"comments-read",moderate:"comments-moderate"},reports:{read:"reports-read",review:"reports-review"},settings:{read:"settings-read",change:"settings-change"}},dy=async({strapi:i})=>{if(i.plugin("graphql")&&await hy({strapi:i}),Object.keys(i.plugins).indexOf("users-permissions")===-1)throw new Error("In order to make the comments plugin work the users-permissions plugin is required");const u=[{section:"plugins",displayName:"Comments: Read",uid:ra.comments.read,pluginName:"comments"},{section:"plugins",displayName:"Comments: Moderate",uid:ra.comments.moderate,pluginName:"comments"},{section:"plugins",displayName:"Reports: Read",uid:ra.reports.read,pluginName:"comments"},{section:"plugins",displayName:"Reports: Moderate",uid:ra.reports.review,pluginName:"comments"},{section:"plugins",displayName:"Settings: Read",uid:ra.settings.read,pluginName:"comments"},{section:"plugins",displayName:"Settings: Change",uid:ra.settings.change,pluginName:"comments"}];await i.admin.services.permission.actionProvider.registerMany(u)},gy={isValidationEnabled:!0,enabledCollections:[],moderatorRoles:[],approvalFlow:[],entryLabel:{"*":["Title","title","Name","name","Subject","subject"]},reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER},blockedAuthorProps:[]},my=v.z.object({[Zt.BAD_LANGUAGE]:v.z.literal(Zt.BAD_LANGUAGE),[Zt.OTHER]:v.z.literal(Zt.OTHER),[Zt.DISCRIMINATION]:v.z.literal(Zt.DISCRIMINATION)}),wm=v.z.object({isValidationEnabled:v.z.boolean().optional(),reportReasons:my.optional(),isGQLPluginEnabled:v.z.boolean().optional(),[Cr.ENABLED_COLLECTIONS]:v.z.array(v.z.string()),[Cr.MODERATOR_ROLES]:v.z.array(v.z.string()),[Cr.APPROVAL_FLOW]:v.z.array(v.z.string()),[Cr.ENTRY_LABEL]:v.z.record(v.z.array(v.z.string())),[Cr.BAD_WORDS]:v.z.boolean().optional(),[Cr.AUTHOR_BLOCKED_PROPS]:v.z.array(v.z.string()),gql:v.z.object({auth:v.z.boolean().optional()}).optional(),client:v.z.object({url:v.z.string().nullable(),contactEmail:v.z.string().nullable()}).default({url:null,contactEmail:null})}),vy={default:wm.parse(gy),validate:i=>wm.safeParse(i)},Y=({left:i,right:u})=>{if(u!==void 0&&i!==void 0)throw new Error(`Received both left and right values at runtime when opening an Either
74
74
  Left: ${JSON.stringify(i)}
75
- Right: ${JSON.stringify(u)}`);if(i!==void 0)return i;if(u!==void 0)return u;throw new Error("Received no left or right values at runtime when opening Either")},vy=i=>i.left!==void 0,pe=i=>i.right!==void 0,uv=i=>({left:i}),ol=i=>({right:i});let An=class av extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,av.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}};const ce=(i,u)=>u instanceof An?i.throw(u.status,JSON.stringify(u)):u,yy=v.z.union([v.z.object({$eq:v.z.string().min(1)}),v.z.object({$eqi:v.z.string().min(1)})]),_y=v.z.union([v.z.object({$ne:v.z.string().min(1)}),v.z.object({$nei:v.z.string().min(1)})]),by=v.z.union([v.z.object({$gt:v.z.string().min(1)}),v.z.object({$gte:v.z.string().min(1)})]),wy=v.z.union([v.z.object({$lt:v.z.string().min(1)}),v.z.object({$lte:v.z.string().min(1)})]),Ay=v.z.union([v.z.object({$startsWith:v.z.string().min(1)}),v.z.object({$startsWithi:v.z.string().min(1)})]),Sy=v.z.union([v.z.object({$endsWith:v.z.string().min(1)}),v.z.object({$endsWithi:v.z.string().min(1)})]),Ey=v.z.union([v.z.object({$contains:v.z.string().min(1)}),v.z.object({$containsi:v.z.string().min(1)})]),Ty=v.z.union([v.z.object({$notContains:v.z.string().min(1)}),v.z.object({$notContainsi:v.z.string().min(1)})]),Xr=v.z.union([v.z.string(),v.z.number()]).transform(i=>Number(i)).pipe(v.z.number()),Oy=v.z.union([v.z.string(),v.z.boolean()]).transform(i=>typeof i=="string"?["t","true"].includes(i):i).pipe(v.z.boolean()),Cy=v.z.object({_q:v.z.string().optional()}),sv=v.z.string().regex(/^(content|createdAt|updatedAt|id):(desc|asc|ASC|DESC)$/,"Invalid orderBy options"),Iy=v.z.union([v.z.string(),v.z.number(),yy,_y,by,wy,Ay,Sy,Ey,Ty,v.z.object({$null:v.z.boolean()}),v.z.object({$notNull:v.z.boolean()})]),Am=i=>v.z.object(Object.keys(i).reduce((u,o)=>({...u,[o]:Iy.optional()}),{})),Zr={single:"single",array:"array"},sa=i=>{const u=Object.entries(i).reduce((o,[h,m])=>({...o,[h]:m===Zr.single?Xr:v.z.array(Xr)}),{});return v.z.object(u)},xy=v.z.object({pageSize:Xr.default(10),page:Xr.default(1)}).merge(Cy).merge(v.z.object({orderBy:sv.optional().nullable()})).merge(v.z.object({filters:Am({removed:!0,approvalStatus:!0}).merge(v.z.object({$or:v.z.array(Am({blocked:!0,blockedThread:!0})).optional()})).optional()})),Nt=i=>{if(!i.success){const u=i.error.issues.map(o=>`Path: ${o.path.join(".")} Code: ${o.code} Message: ${o.message}`).join(`
76
- `);return uv(new An(400,u))}return ol(i.data)},Ff=i=>v.z.string().regex(mm.relatedUid,{message:'Field "relation" got incorrect format, use format like "api::<collection name>.<content type name>:<document id>"'}).refine(u=>i.some(o=>u.startsWith(o)),"Invalid relation or not enabled collections"),Ry=v.z.object({id:v.z.union([v.z.number(),v.z.string()]),name:v.z.string().min(1).max(100).optional(),email:v.z.string().email(),avatar:v.z.string().url().optional()});v.z.union([v.z.string(),v.z.number(),v.z.boolean()]);const lv=xy.merge(v.z.object({_q:v.z.string().optional()})),Jr=i=>Nt(sa({id:Zr.single}).safeParse(i)),Ny=i=>Nt(lv.safeParse(i)),Ly=i=>Nt(lv.safeParse(i)),zy=(i,u)=>{const o=sa({id:Zr.single}).merge(v.z.object({removed:v.z.string().optional().transform(h=>h==="true")})).safeParse({...u,id:i});return Nt(o)},Py=i=>Nt(sa({id:Zr.single,reportId:Zr.single}).safeParse(i)),Dy=i=>{const u=sa({id:Zr.single,reportIds:Zr.array}).safeParse(i);return Nt(u)},Fy=i=>{const u=sa({reportIds:Zr.array}).safeParse(i);return Nt(u)},Uy=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),email:v.z.string().email(),lastname:v.z.string().nullable().optional(),username:v.z.string().nullable().optional(),firstname:v.z.string().nullable().optional()}),cv=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),content:v.z.string(),author:Uy}),My=i=>Nt(cv.safeParse(i)),Wy=i=>Nt(cv.pick({content:!0,id:!0}).safeParse(i)),By=i=>Nt(wm.safeParse(i)),fv=i=>v.z.object({relation:Ff(i),content:v.z.string().min(1),author:Ry.optional(),threadOf:v.z.union([v.z.string(),v.z.number()]).optional(),approvalStatus:v.z.nativeEnum(Fi).optional(),locale:v.z.string().optional()}),$y=(i,u,o)=>Nt(fv(i).safeParse({...o,relation:u})),jy=(i,u)=>Nt(fv(i).pick({content:!0,relation:!0,author:!0}).merge(sa({commentId:Zr.single})).safeParse(u)),ky=i=>v.z.object({relation:Ff(i)}),Vy=v.z.object({pagination:v.z.object({pageSize:Xr.default(10),page:Xr.default(1),withCount:Oy.optional().default(!1)}).optional()}),Gy=v.z.record(v.z.union([v.z.union([v.z.boolean(),v.z.literal("true").transform(()=>!0),v.z.literal("false").transform(()=>!1),v.z.literal("*")]),v.z.record(v.z.any())])).optional(),Im=i=>{const u=Am({id:!0,content:!0,authorId:!0,authorName:!0,authorEmail:!0,createdAt:!0,updatedAt:!0,removed:!0,blocked:!0,blockedThread:!0,approvalStatus:!0,isAdminComment:!0,threadOf:!0});return v.z.object({sort:sv.optional().nullable().default("createdAt:desc"),fields:v.z.string().array().optional(),omit:v.z.string().array().optional(),filters:u.merge(v.z.object({$and:u.array().min(1).optional(),$or:u.array().min(1).optional()})).optional(),isAdmin:v.z.boolean().optional().default(!1),populate:Gy,limit:Xr.optional(),skip:Xr.optional(),locale:v.z.string().optional()}).merge(ky(i)).merge(Vy)},qy=(i,u,o)=>Nt(Im(i).safeParse({...o,relation:u})),Hy=(i,u,o)=>{const h=Im(i).pick({sort:!0,fields:!0,omit:!0,filters:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,relation:!0,locale:!0,pagination:!0}).merge(v.z.object({startingFromId:v.z.number().optional(),dropBlockedThreads:v.z.boolean().optional().default(!1)}));return Nt(h.safeParse({...o,relation:u}))},Yy=(i,u)=>{const o=Im([]).pick({sort:!0,fields:!0,omit:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,pagination:!0,filters:!0,locale:!0}).merge(v.z.object({type:v.z.union([v.z.literal(ul.GENERIC),v.z.literal("generic")]).optional(),authorId:v.z.union([v.z.string(),v.z.number()])}));return Nt(o.safeParse({...u,...i}))},Qy=i=>v.z.object({relation:Ff(i[Cr.ENABLED_COLLECTIONS]),commentId:Xr,content:v.z.string().min(1),reason:v.z.nativeEnum(i.reportReasons)}),Jy=(i,u)=>Nt(Qy(i).safeParse(u)),Xy=i=>v.z.object({relation:Ff(i),commentId:v.z.union([v.z.string(),v.z.number()]),authorId:v.z.union([v.z.string(),v.z.number()])}),Zy=(i,u)=>Nt(Xy(i).safeParse(u)),Ky=({strapi:i})=>({getService(u){return ft(i,u)},async findAll(u){const o=Ny(u.query);if(pe(o))return this.getService("admin").findAll(Y(o));throw ce(u,Y(o))},async findReports(u){const o=Ly(u.query);if(pe(o))return this.getService("admin").findReports(Y(o));throw ce(u,Y(o))},async findOne(u){const o=zy(u.params.id,u.query);if(pe(o))return this.getService("admin").findOneAndThread(Y(o));throw ce(u,Y(o))},async blockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!0);throw ce(u,Y(o))},async unblockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!1);throw ce(u,Y(o))},async deleteComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").deleteComment(Y(o).id);throw ce(u,Y(o))},async blockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!0);throw ce(u,Y(o))},async unblockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!1);throw ce(u,Y(o))},async resolveAbuseReport(u){const o=Py(u.params);if(pe(o))return this.getService("admin").resolveAbuseReport(Y(o));throw ce(u,Y(o))},async resolveCommentMultipleAbuseReports(u){const o=Dy({...u.request.body,id:u.params.id});if(pe(o))return this.getService("admin").resolveCommentMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async resolveAllAbuseReportsForComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForComment(Y(o).id);throw ce(u,Y(o))},async resolveAllAbuseReportsForThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForThread(Y(o).id);throw ce(u,Y(o))},async resolveMultipleAbuseReports(u){const o=Fy(u.request.body);if(pe(o))return this.getService("admin").resolveMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async postComment(u){const o=My({id:u.params.id,content:u.request.body.content,author:u.request.body.author});if(pe(o))return this.getService("admin").postComment(Y(o));throw ce(u,Y(o))},async updateComment(u){const o=Wy({id:u.params.id,content:u.request.body.content});if(pe(o))return this.getService("admin").updateComment(Y(o));throw ce(u,Y(o))},async approveComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").approveComment(Y(o).id);throw ce(u,Y(o))},async rejectComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").rejectComment(Y(o).id);throw ce(u,Y(o))}}),Ir=async(i,u,o)=>Uf(i).getLocalConfig(u,o),nl=v.z.object({url:v.z.string(),name:v.z.string(),hash:v.z.string()}),e_=v.z.object({id:v.z.number(),...nl.shape,formats:v.z.object({thumbnail:nl.optional(),small:nl.optional(),medium:nl.optional(),large:nl.optional()}).optional()}).nullable().optional(),hv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),blocked:v.z.boolean().nullable(),blockedThread:v.z.boolean().nullable(),blockReason:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string().nullable(),publishedAt:v.z.string().nullable(),authorId:v.z.string().nullable(),authorName:v.z.string().nullable(),authorEmail:v.z.string().email().nullable(),authorAvatar:v.z.string().nullable(),authorUser:v.z.union([v.z.string(),v.z.object({id:v.z.number(),username:v.z.string(),email:v.z.string().email(),avatar:e_})]).optional().nullable(),locale:v.z.string().nullable()}),pv=v.z.object({page:v.z.number(),pageSize:v.z.number(),pageCount:v.z.number(),total:v.z.number()}),Di=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),dv=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),t_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),$m=hv.merge(v.z.object({gotThread:v.z.boolean().nullable().optional(),threadFirstItemId:v.z.number().nullable().optional(),reports:v.z.array(t_).default([]),author:v.z.any()})),al=$m.extend({threadOf:v.z.lazy(()=>v.z.union([v.z.number(),$m])).nullable().optional()}),n_=v.z.object({id:v.z.number(),uid:v.z.string(),documentId:v.z.string(),requireCommentsApproval:v.z.boolean().nullable().optional(),locale:v.z.string().nullable().optional()});al.omit({related:!0}).extend({related:n_.nullable().optional()});const r_=v.z.array(al),i_=v.z.object({pagination:pv,results:v.z.array(al)}),ia={findMany:r_,findWithCount:i_,findOne:al,create:al},o_=v.z.object({id:v.z.number(),documentId:v.z.string(),content:v.z.string(),blocked:v.z.boolean(),blockedThread:v.z.boolean(),blockReason:v.z.string().nullable(),authorId:v.z.string(),authorName:v.z.string(),authorEmail:v.z.string(),authorAvatar:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string(),locale:v.z.string().nullable()}),gv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:o_.nullable().optional()}),u_=v.z.object({results:v.z.array(gv),pagination:pv}),a_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),s_=v.z.array(v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:hv.nullable()})),Of={findMany:s_,findPage:u_,update:a_,create:gv},l_=i=>{const u=lr(i,"comment-report"),o=i.query(u);return{async findPage(h){const m=await Ir(i,"isValidationEnabled",!1);return o.findPage(h).then(Di(m,Of.findPage))},async findMany(h){const m=await Ir(i,"isValidationEnabled",!1);return o.findMany(h).then(dv(m,Of.findMany))},async update(h){const m=await Ir(i,"isValidationEnabled",!1);return o.update(h).then(Di(m,Of.update))},async updateMany(h){return o.updateMany(h)},async create(h){const m=await Ir(i,"isValidationEnabled",!1);return o.create(h).then(Di(m,Of.create))}}},Pi=Le.once(l_),c_=i=>{const u=lr(i,"comment");return{async findMany(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findMany(o).then(dv(h,ia.findMany))},async findWithCount(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findPage(o).then(Di(h,ia.findWithCount))},async findOne(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findOne(o).then(m=>m?Di(h,ia.findOne)(m):null)},async update(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).update(o).then(Di(h,ia.findOne))},async delete(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).delete(o).then(m=>m?Di(h,ia.findOne)(m):null)},async deleteMany(o){return i.query(u).deleteMany(o)},updateMany(o){return i.query(u).updateMany(o)},async create(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).create(o).then(Di(h,ia.create))}}},it=Le.once(c_),f_=i=>({getLocalConfig(u,o){return i.config.get([Tv,u].filter(Boolean).join("."),o)},async getStore(){return await i.store({type:"plugin",name:"comments"})},async getConfig(){return await(await this.getStore()).get({key:"config"})},async get(u){const o=await this.getConfig(),h={regex:Object.keys(mm).reduce((O,F)=>({...O,[F]:mm[F].toString()}),{})},m=!!i.plugin("graphql"),A=this.getLocalConfig("reportReasons");if(o)return ol({...o,...h,reportReasons:A,isGQLPluginEnabled:u?m:void 0});const E=this.getLocalConfig("entryLabel"),C=this.getLocalConfig("approvalFlow"),x=this.getLocalConfig("blockedAuthorProps"),N={entryLabel:E,approvalFlow:C,blockedAuthorProps:x,reportReasons:A,...h};if(u){const O=this.getLocalConfig("enabledCollections"),F=this.getLocalConfig("moderatorRoles");return ol({...N,enabledCollections:O,moderatorRoles:F,isGQLPluginEnabled:m})}return ol(N)},async update(u){return await(await this.getStore()).set({key:"config",value:{...u,reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER}}}),this.get()},async restore(){return await(await this.getStore()).delete({key:"config"}),this.get()}}),Uf=Le.once(f_),h_=({strapi:i})=>({getService(u){return ft(i,u)},getStoreRepository(){return Uf(i)},async post(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=$y(h.enabledCollections,u.params.relation,u.request.body);if(pe(m))return this.getService("client").create(m.right,u.state.user);throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllFlat(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=qy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllFlat(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllInHierarchy(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=Hy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllInHierarchy(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllPerAuthor(u){const o=Yy(u.params,u.query);if(pe(o))return this.getService("common").findAllPerAuthor(ua(o.right),u.params.type?![ul.GENERIC.toLowerCase(),ul.GENERIC].includes(u.params.type):!1);throw ce(u,Y(o))},async put(u){const{user:o}=u.state,h=await this.getStoreRepository().get(!0);if(pe(h)){const m=Y(h),A=jy(m.enabledCollections,{...u.params,content:u.request.body.content,author:u.request.body.author});if(pe(A))return await this.getService("client").update(A.right,o);throw ce(u,Y(A))}throw ce(u,Y(h))},async reportAbuse(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),E=Jy(A,{...u.request.body,...u.params});if(pe(E))return await this.getService("client").reportAbuse(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))},async removeComment(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),E=Zy(A.enabledCollections,{...u.query,...u.params});if(pe(E))return await this.getService("client").markAsRemoved(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))}}),p_=({strapi:i})=>{const u=ft(i,"settings");return{async get(o){try{return await u.getConfig()}catch(h){throw ce(o,h)}},async getForSettingsPage(o){try{return await u.getConfig(!0)}catch(h){throw ce(o,h)}},async update(o){const h=By(o.request.body);if(pe(h))return await u.update(Y(h));throw ce(o,Y(h))},async restore(o){try{return await u.restore()}catch(h){throw ce(o,h)}},async restart(o){try{return u.restart(),o.send({message:"Restarted",status:200})}catch(h){throw ce(o,h)}}}},d_={admin:Ky,client:h_,settings:p_},g_=[{method:"GET",path:"/moderate/all",handler:"admin.findAll",config:{policies:[]}},{method:"GET",path:"/moderate/reports",handler:"admin.findReports",config:{policies:[]}},{method:"GET",path:"/moderate/single/:id",handler:"admin.findOne",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/approve",handler:"admin.approveComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/reject",handler:"admin.rejectComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/block",handler:"admin.blockComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/unblock",handler:"admin.unblockComment",config:{policies:[]}},{method:"DELETE",path:"/moderate/single/:id/delete",handler:"admin.deleteComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/:reportId/resolve",handler:"admin.resolveAbuseReport",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/resolve",handler:"admin.resolveCommentMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve",handler:"admin.resolveAllAbuseReportsForComment",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve-thread",handler:"admin.resolveAllAbuseReportsForThread",config:{policies:[]}},{method:"PUT",path:"/moderate/multiple/report/resolve",handler:"admin.resolveMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/update",handler:"admin.updateComment",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/block",handler:"admin.blockCommentThread",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/unblock",handler:"admin.unblockCommentThread",config:{policies:[]}},{method:"POST",path:"/moderate/thread/:id/postComment",handler:"admin.postComment",config:{policies:[]}}],m_=[{method:"PUT",path:"/settings/config",handler:"settings.update",config:{policies:[]}},{method:"DELETE",path:"/settings/config",handler:"settings.restore",config:{policies:[]}},{method:"POST",path:"/settings/restart",handler:"settings.restart",config:{policies:[]}},{method:"GET",path:"/settings/config",handler:"settings.getForSettingsPage",config:{policies:[]}},{method:"GET",path:"/moderate/config",handler:"settings.get",config:{policies:[]}}],v_=[...g_,...m_],y_=[{method:"GET",path:"/:relation",handler:"client.findAllInHierarchy",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a nested structure",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"POST",path:"/:relation",handler:"client.post",config:{policies:[],description:"Post a comment against configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"GET",path:"/:relation/flat",handler:"client.findAllFlat",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a flat structure for further processing",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"PUT",path:"/:relation/comment/:commentId",handler:"client.put",config:{policies:[],description:"Update comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"update"}}},{method:"POST",path:"/:relation/comment/:commentId/report-abuse",handler:"client.reportAbuse",config:{policies:[],description:"Report an abuse against comment for configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"DELETE",path:"/:relation/comment/:commentId",handler:"client.removeComment",config:{policies:[],description:"Remove comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"delete"}}},{method:"GET",path:"/author/:authorId",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by Strapi user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"GET",path:"/author/:authorId/:type",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by specified type of user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}}],__={"content-api":{type:"content-api",routes:y_},admin:{type:"admin",routes:v_}};class fn extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,fn.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}}const jm=i=>i.split(kv.relatedUid).filter(u=>u&&u.length>0),mv=i=>i&&{...i,reports:(i.reports||[]).filter(u=>!u.resolved)},km=(i,u,o=[])=>{const{authorUser:h,authorId:m,authorName:A,authorEmail:E,authorAvatar:C,...x}=i;let N={};if(h&&typeof h!="string"){const O=h;N=o.reduce((F,U)=>({...F,[U]:O[U]}),{id:O.id,name:O.username,email:O.email,avatar:O.avatar?.formats?.thumbnail.url||O.avatar?.url})}else m&&(N={id:m,name:A,email:E,avatar:C});return N=Le.isEmpty(N)?N:Object.fromEntries(Object.entries(N).filter(([O])=>!u.includes(O))),{...x,author:Le.isEmpty(N)?i.author||{}:N}},Cf=i=>{throw i?new fn(401,"Not authenticated"):new fn(403,"Not authorized")},b_=i=>{const{lastname:u,username:o,firstname:h}=i;return u&&h?`${h} ${u}`:o||h||""},w_=Le.once(i=>({findAll:{createParams(u,o,h,m,A){const[E,C]=vm(u),x={orderBy:u?{[E]:C}:void 0,where:A,page:o,pageSize:h};return m&&Le.set(x,"where.content.$contains",m),x},getPopulate(){return{authorUser:il(i),threadOf:{populate:{authorUser:il(i)}},reports:{where:{resolved:!1}}}}},findReports:{getDefaultWhere(){return{resolved:{$notNull:!0}}},createParams(u,o,h,m){const[A,E]=vm(u),C={orderBy:u?{[A]:E}:void 0,where:this.getDefaultWhere(),page:o,pageSize:h};return m&&Le.set(C,"where.content.$contains",m),C}},findOneAndThread:{getDefaultWhere(u){return u?{$or:[{removed:!1},{removed:{$notNull:!1}}]}:{}},getPopulate(){const u=il(i),o={reports:{where:{resolved:!1}}},h={populate:{threadOf:{populate:{...o}},...o}};return{populate:{...h.populate,authorUser:u,threadOf:{populate:{...h.populate.threadOf.populate,authorUser:u}}}}}}})),A_=({strapi:i})=>{const u=w_(i);return{getCommonService(){return ft(i,"common")},async findAll({_q:o,orderBy:h,page:m,pageSize:A,filters:E}){const C=u.findAll.createParams(h,m,A,o,E),x=u.findAll.getPopulate(),N=it(i),{pagination:O,results:F}=await N.findWithCount({...C,count:!0,populate:x}),U=await this.getCommonService().findRelatedEntitiesFor(F);return{pagination:O,result:F.map(Q=>this.getCommonService().sanitizeCommentEntity(Q,[],[])).map(Q=>this.getCommonService().mergeRelatedEntityTo(Q,U))}},async findReports({_q:o,orderBy:h,page:m,pageSize:A}){const E=u.findReports.createParams(h,m,A,o),{pagination:C,results:x}=await Pi(i).findPage({...E,populate:["related"]}),N=x.map($=>typeof $.related=="object"?$.related.id:null).filter(Boolean),O=il(i),F=await it(i).findMany({where:{threadOf:N},populate:["threadOf"],limit:Number.MAX_SAFE_INTEGER}),U=Array.from(new Set(F.map(({threadOf:$})=>typeof $=="object"?$.id:null).filter(Boolean)));return{result:x.map($=>{const J=U.includes($.related.id),te=this.getCommonService(),X={...$,related:te.sanitizeCommentEntity({...$.related,gotThread:J},[])},me=typeof O!="boolean"?O?.populate:{};return mv(te.sanitizeCommentEntity(X,[],[],me))}),pagination:C}},async findOneAndThread({id:o,removed:h,...m}){const A=il(i),E=u.findOneAndThread.getDefaultWhere(h),C=u.findOneAndThread.getPopulate(),x=await it(i).findOne({...C,where:{id:o}});if(!x)throw new An(404,"Not found");const{relatedId:N,uid:O}=this.getCommonService().parseRelationString(x.related),F=await i.documents(O).findOne({documentId:N}).then(te=>{if(!te)throw new An(404,"Relation not found");return{...te,uid:O}}),U=x.threadOf&&typeof x.threadOf=="object"?x.threadOf.id:null,Q=await this.getCommonService().findAllInHierarchy({filters:{...E,...m,threadOf:U,related:x.related},...C,startingFromId:U,isAdmin:!0,limit:Number.MAX_SAFE_INTEGER},!1),$=typeof A!="boolean"?A?.populate:{},J=this.getCommonService().sanitizeCommentEntity({...x,threadOf:x.threadOf||null},[],[],$);return{entity:F,selected:J,level:Q}},async changeBlockedComment(o,h){const m=await this.getCommonService().findOne({id:o});return this.getCommonService().updateComment({id:o},{blocked:Le.isNil(h)?!m.blocked:h})},async deleteComment(o){return it(i).update({where:{id:o},data:{removed:!0}})},async blockCommentThread(o,h){const m=await this.getCommonService().findOne({id:o}),A=h||!m.blocked,E=await this.getCommonService().updateComment({id:o},{blocked:A,blockedThread:A});return await this.blockNestedThreads(o,A),this.getCommonService().sanitizeCommentEntity(E,[])},async approveComment(o){const h=await it(i).update({where:{id:o},data:{approvalStatus:Fi.APPROVED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async rejectComment(o){const h=await it(i).update({where:{id:o},data:{approvalStatus:Fi.REJECTED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async blockNestedThreads(o,h){return this.getCommonService().modifiedNestedNestedComments(o,"blockedThread",h)},async resolveAbuseReport({id:o,reportId:h}){return Pi(i).update({where:{id:h,related:o},data:{resolved:!0}})},async resolveCommentMultipleAbuseReports({id:o,reportIds:h}){if((await Pi(i).findMany({where:{id:h,related:o},populate:["related"]})).length===h.length)return Pi(i).updateMany({where:{id:h},data:{resolved:!0}});throw new An(400,"At least one of selected reports got invalid comment entity relation. Try again.")},async resolveAllAbuseReportsForComment(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");return Pi(i).updateMany({where:{related:o,resolved:!1},data:{resolved:!0}})},async resolveAllAbuseReportsForThread(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");const h=await it(i).findMany({where:{threadOf:o},select:["id"]});return Pi(i).updateMany({where:{related:h.map(({id:m})=>m).concat([o]),resolved:!1},data:{resolved:!0}})},async resolveMultipleAbuseReports({reportIds:o}){return Pi(i).updateMany({where:{id:{$in:o}},data:{resolved:!0}})},async postComment({id:o,author:h,content:m}){const A=await it(i).findOne({where:{id:o}});if(!A)throw new An(404,"Not found");return it(i).create({data:{content:m,threadOf:o,authorId:h.id,authorName:b_(h),authorEmail:h.email,related:A.related,isAdminComment:!0}})},async updateComment({id:o,content:h}){const m=await it(i).update({where:{id:o},data:{content:h}});if(!m)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(m,[])}}},S_=async(i,u)=>{try{return ol(await i())}catch{return uv(u)}},E_=({strapi:i})=>{const u=async(o,h)=>{if(h)return{authorUser:h.id};if(o)return{authorId:o.id,authorName:o.name,authorEmail:o.email,authorAvatar:o.avatar}};return{getCommonService(){return ft(i,"common")},async create({relation:o,content:h,threadOf:m,author:A,approvalStatus:E,locale:C},x){const{uid:N,relatedId:O}=this.getCommonService().parseRelationString(o),F=await i.documents(N).findOne({documentId:O,locale:C});if(!F)throw new fn(400,'Relation for field "related" does not exist. Check your payload please.');const Q=(await this.getCommonService().getConfig(oa.APPROVAL_FLOW,[])).includes(N)||F.requireCommentsApproval,$=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),J=await S_(async()=>m?await this.getCommonService().findOne({id:m,related:o,locale:C||null}):null,new fn(400,"Thread does not exist"));if(vy(J))throw Y(J);const te=Y(J);if(!A&&!this.getCommonService().isValidUserContext(x))throw Cf(x);const[X,me]=await Promise.all([this.getCommonService().checkBadWords(h),u(A,x)]),ve=!Le.isEmpty(me)&&!(me.authorId||me.authorUser);if(Le.isEmpty(me)||ve)throw new fn(400,`Not able to recognise author of a comment. Make sure you've provided "author" property in a payload or authenticated your request properly.`);if(Q&&E&&E!==Fi.PENDING)throw new fn(400,"Invalid approval status");const Ve={...await it(i).create({data:{...me,threadOf:m,locale:C,content:X,related:o,approvalStatus:Q?Fi.PENDING:Fi.APPROVED},populate:{authorUser:{populate:["avatar"]}}}),threadOf:te},Ye=this.getCommonService().sanitizeCommentEntity(Ve,$);try{await this.sendResponseNotification(Ye)}catch(Me){console.error(Me)}return Ye},async update({commentId:o,content:h,author:m,relation:A},E){if(!m&&!this.getCommonService().isValidUserContext(E))throw Cf(E);const C=E?.id||m?.id;if(await this.getCommonService().checkBadWords(h)){const x=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),N=await this.getCommonService().findOne({id:o,related:A});if(N&&N.author?.id?.toString()===C?.toString()){const O=await it(i).update({where:{id:o},data:{content:h},populate:{threadOf:!0,authorUser:{populate:["avatar"]}}});return this.getCommonService().sanitizeCommentEntity(O,x)}}},async reportAbuse({commentId:o,relation:h,...m},A){if(!this.getCommonService().isValidUserContext(A))throw Cf(A);try{const E=await this.getCommonService().findOne({id:o,related:h});if(E.isAdminComment)throw new fn(403,"You're not allowed to take an action on that entity. This in a admin comment.");if(E){const C=await Pi(i).create({data:{...m,resolved:!1,related:o}});if(C){const x={...C,related:E};try{return await this.sendAbuseReportEmail(C.reason,C.content),x}catch{return x}}else throw new fn(500,"Report cannot be created")}throw new fn(403,"You're not allowed to take an action on that entity. Make sure that comment exist or you've authenticated your request properly.")}catch(E){throw E}},async markAsRemoved({commentId:o,relation:h,authorId:m},A){if(!m&&!this.getCommonService().isValidUserContext(A))throw Cf(A);const E=A?.id||m;if(!E)throw new fn(403,`You're not allowed to take an action on that entity. Make sure that you've provided proper "authorId" or authenticated your request properly.`);try{const C=A?.id?{authorUser:E}:{authorId:E};if(await this.getCommonService().findOne({id:o,related:h,...C})){const N=await it(i).update({where:{id:o,related:h},data:{removed:!0},populate:{threadOf:!0,authorUser:{populate:["avatar"]}}});await this.markAsRemovedNested(o,!0);const O=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]);return this.getCommonService().sanitizeCommentEntity(N,O)}else throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}catch{throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}},async sendAbuseReportEmail(o,h){const m="strapi-super-admin",A=await this.getCommonService().getConfig(oa.MODERATOR_ROLES,[m]);if(A.length>0){const E=await i.query("admin::user").findMany({where:{roles:{code:A}}}).then(C=>C.map(x=>x.email));if(E.length>0){const C=await i.query("admin::user").findOne({where:{roles:{code:m}}});i.plugin("email")&&await i.plugin("email").service("email").send({to:E,from:C.email,subject:"New abuse report on comment",text:`
75
+ Right: ${JSON.stringify(u)}`);if(i!==void 0)return i;if(u!==void 0)return u;throw new Error("Received no left or right values at runtime when opening Either")},yy=i=>i.left!==void 0,pe=i=>i.right!==void 0,av=i=>({left:i}),ol=i=>({right:i});let An=class sv extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,sv.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}};const ce=(i,u)=>u instanceof An?i.throw(u.status,JSON.stringify(u)):u,_y=v.z.union([v.z.object({$eq:v.z.string().min(1)}),v.z.object({$eqi:v.z.string().min(1)})]),by=v.z.union([v.z.object({$ne:v.z.string().min(1)}),v.z.object({$nei:v.z.string().min(1)})]),wy=v.z.union([v.z.object({$gt:v.z.string().min(1)}),v.z.object({$gte:v.z.string().min(1)})]),Ay=v.z.union([v.z.object({$lt:v.z.string().min(1)}),v.z.object({$lte:v.z.string().min(1)})]),Sy=v.z.union([v.z.object({$startsWith:v.z.string().min(1)}),v.z.object({$startsWithi:v.z.string().min(1)})]),Ey=v.z.union([v.z.object({$endsWith:v.z.string().min(1)}),v.z.object({$endsWithi:v.z.string().min(1)})]),Ty=v.z.union([v.z.object({$contains:v.z.string().min(1)}),v.z.object({$containsi:v.z.string().min(1)})]),Oy=v.z.union([v.z.object({$notContains:v.z.string().min(1)}),v.z.object({$notContainsi:v.z.string().min(1)})]),Xr=v.z.union([v.z.string(),v.z.number()]).transform(i=>Number(i)).pipe(v.z.number()),Am=v.z.union([v.z.string(),v.z.boolean()]).transform(i=>typeof i=="string"?["t","true"].includes(i):i).pipe(v.z.boolean()),Cy=v.z.object({_q:v.z.string().optional()}),lv=v.z.string().regex(/^(content|createdAt|updatedAt|id):(desc|asc|ASC|DESC)$/,"Invalid orderBy options"),Iy=v.z.union([v.z.string(),v.z.number(),_y,by,wy,Ay,Sy,Ey,Ty,Oy,v.z.object({$null:Am}),v.z.object({$notNull:Am})]),Sm=i=>v.z.object(Object.keys(i).reduce((u,o)=>({...u,[o]:Iy.optional()}),{})),Zr={single:"single",array:"array"},sa=i=>{const u=Object.entries(i).reduce((o,[h,m])=>({...o,[h]:m===Zr.single?Xr:v.z.array(Xr)}),{});return v.z.object(u)},xy=v.z.object({pageSize:Xr.default(10),page:Xr.default(1)}).merge(Cy).merge(v.z.object({orderBy:lv.optional().nullable()})).merge(v.z.object({filters:Sm({removed:!0,approvalStatus:!0}).merge(v.z.object({$or:v.z.array(Sm({blocked:!0,blockedThread:!0})).optional()})).optional()})),Nt=i=>{if(!i.success){const u=i.error.issues.map(o=>`Path: ${o.path.join(".")} Code: ${o.code} Message: ${o.message}`).join(`
76
+ `);return av(new An(400,u))}return ol(i.data)},Ff=i=>v.z.string().regex(mm.relatedUid,{message:'Field "relation" got incorrect format, use format like "api::<collection name>.<content type name>:<document id>"'}).refine(u=>i.some(o=>u.startsWith(o)),"Invalid relation or not enabled collections"),Ry=v.z.object({id:v.z.union([v.z.number(),v.z.string()]),name:v.z.string().min(1).max(100).optional(),email:v.z.string().email(),avatar:v.z.string().url().optional()});v.z.union([v.z.string(),v.z.number(),v.z.boolean()]);const cv=xy.merge(v.z.object({_q:v.z.string().optional()})),Jr=i=>Nt(sa({id:Zr.single}).safeParse(i)),Ny=i=>Nt(cv.safeParse(i)),Ly=i=>Nt(cv.safeParse(i)),zy=(i,u)=>{const o=sa({id:Zr.single}).merge(v.z.object({removed:v.z.string().optional().transform(h=>h==="true")})).safeParse({...u,id:i});return Nt(o)},Py=i=>Nt(sa({id:Zr.single,reportId:Zr.single}).safeParse(i)),Dy=i=>{const u=sa({id:Zr.single,reportIds:Zr.array}).safeParse(i);return Nt(u)},Fy=i=>{const u=sa({reportIds:Zr.array}).safeParse(i);return Nt(u)},Uy=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),email:v.z.string().email(),lastname:v.z.string().nullable().optional(),username:v.z.string().nullable().optional(),firstname:v.z.string().nullable().optional()}),fv=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),content:v.z.string(),author:Uy}),My=i=>Nt(fv.safeParse(i)),Wy=i=>Nt(fv.pick({content:!0,id:!0}).safeParse(i)),By=i=>Nt(wm.safeParse(i)),hv=i=>v.z.object({relation:Ff(i),content:v.z.string().min(1),author:Ry.optional(),threadOf:v.z.union([v.z.string(),v.z.number()]).optional(),approvalStatus:v.z.nativeEnum(Fi).optional(),locale:v.z.string().optional()}),$y=(i,u,o)=>Nt(hv(i).safeParse({...o,relation:u})),jy=(i,u)=>Nt(hv(i).pick({content:!0,relation:!0,author:!0}).merge(sa({commentId:Zr.single})).safeParse(u)),ky=i=>v.z.object({relation:Ff(i)}),Vy=v.z.object({pagination:v.z.object({pageSize:Xr.default(10),page:Xr.default(1),withCount:Am.optional().default(!1)}).optional()}),Gy=v.z.record(v.z.union([v.z.union([v.z.boolean(),v.z.literal("true").transform(()=>!0),v.z.literal("false").transform(()=>!1),v.z.literal("*")]),v.z.record(v.z.any())])).optional(),xm=i=>{const u=Sm({id:!0,content:!0,authorId:!0,authorName:!0,authorEmail:!0,createdAt:!0,updatedAt:!0,removed:!0,blocked:!0,blockedThread:!0,approvalStatus:!0,isAdminComment:!0,threadOf:!0});return v.z.object({sort:lv.optional().nullable().default("createdAt:desc"),fields:v.z.string().array().optional(),omit:v.z.string().array().optional(),filters:u.merge(v.z.object({$and:u.array().min(1).optional(),$or:u.array().min(1).optional()})).optional(),isAdmin:v.z.boolean().optional().default(!1),populate:Gy,limit:Xr.optional(),skip:Xr.optional(),locale:v.z.string().optional()}).merge(ky(i)).merge(Vy)},qy=(i,u,o)=>Nt(xm(i).safeParse({...o,relation:u})),Hy=(i,u,o)=>{const h=xm(i).pick({sort:!0,fields:!0,omit:!0,filters:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,relation:!0,locale:!0,pagination:!0}).merge(v.z.object({startingFromId:v.z.number().optional(),dropBlockedThreads:v.z.boolean().optional().default(!1)}));return Nt(h.safeParse({...o,relation:u}))},Yy=(i,u)=>{const o=xm([]).pick({sort:!0,fields:!0,omit:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,pagination:!0,filters:!0,locale:!0}).merge(v.z.object({type:v.z.union([v.z.literal(ul.GENERIC),v.z.literal("generic")]).optional(),authorId:v.z.union([v.z.string(),v.z.number()])}));return Nt(o.safeParse({...u,...i}))},Qy=i=>v.z.object({relation:Ff(i[Cr.ENABLED_COLLECTIONS]),commentId:Xr,content:v.z.string().min(1),reason:v.z.nativeEnum(i.reportReasons)}),Jy=(i,u)=>Nt(Qy(i).safeParse(u)),Xy=i=>v.z.object({relation:Ff(i),commentId:v.z.union([v.z.string(),v.z.number()]),authorId:v.z.union([v.z.string(),v.z.number()])}),Zy=(i,u)=>Nt(Xy(i).safeParse(u)),Ky=({strapi:i})=>({getService(u){return ft(i,u)},async findAll(u){const o=Ny(u.query);if(pe(o))return this.getService("admin").findAll(Y(o));throw ce(u,Y(o))},async findReports(u){const o=Ly(u.query);if(pe(o))return this.getService("admin").findReports(Y(o));throw ce(u,Y(o))},async findOne(u){const o=zy(u.params.id,u.query);if(pe(o))return this.getService("admin").findOneAndThread(Y(o));throw ce(u,Y(o))},async blockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!0);throw ce(u,Y(o))},async unblockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!1);throw ce(u,Y(o))},async deleteComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").deleteComment(Y(o).id);throw ce(u,Y(o))},async blockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!0);throw ce(u,Y(o))},async unblockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!1);throw ce(u,Y(o))},async resolveAbuseReport(u){const o=Py(u.params);if(pe(o))return this.getService("admin").resolveAbuseReport(Y(o));throw ce(u,Y(o))},async resolveCommentMultipleAbuseReports(u){const o=Dy({...u.request.body,id:u.params.id});if(pe(o))return this.getService("admin").resolveCommentMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async resolveAllAbuseReportsForComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForComment(Y(o).id);throw ce(u,Y(o))},async resolveAllAbuseReportsForThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForThread(Y(o).id);throw ce(u,Y(o))},async resolveMultipleAbuseReports(u){const o=Fy(u.request.body);if(pe(o))return this.getService("admin").resolveMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async postComment(u){const o=My({id:u.params.id,content:u.request.body.content,author:u.request.body.author});if(pe(o))return this.getService("admin").postComment(Y(o));throw ce(u,Y(o))},async updateComment(u){const o=Wy({id:u.params.id,content:u.request.body.content});if(pe(o))return this.getService("admin").updateComment(Y(o));throw ce(u,Y(o))},async approveComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").approveComment(Y(o).id);throw ce(u,Y(o))},async rejectComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").rejectComment(Y(o).id);throw ce(u,Y(o))}}),Ir=async(i,u,o)=>Uf(i).getLocalConfig(u,o),nl=v.z.object({url:v.z.string(),name:v.z.string(),hash:v.z.string()}),e_=v.z.object({id:v.z.number(),...nl.shape,formats:v.z.object({thumbnail:nl.optional(),small:nl.optional(),medium:nl.optional(),large:nl.optional()}).optional()}).nullable().optional(),pv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),blocked:v.z.boolean().nullable(),blockedThread:v.z.boolean().nullable(),blockReason:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string().nullable(),publishedAt:v.z.string().nullable(),authorId:v.z.string().nullable(),authorName:v.z.string().nullable(),authorEmail:v.z.string().email().nullable(),authorAvatar:v.z.string().nullable(),authorUser:v.z.union([v.z.string(),v.z.object({id:v.z.number(),username:v.z.string(),email:v.z.string().email(),avatar:e_})]).optional().nullable(),locale:v.z.string().nullable()}),dv=v.z.object({page:v.z.number(),pageSize:v.z.number(),pageCount:v.z.number(),total:v.z.number()}),Di=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),gv=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),t_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),jm=pv.merge(v.z.object({gotThread:v.z.boolean().nullable().optional(),threadFirstItemId:v.z.number().nullable().optional(),reports:v.z.array(t_).default([]),author:v.z.any()})),al=jm.extend({threadOf:v.z.lazy(()=>v.z.union([v.z.number(),jm])).nullable().optional()}),n_=v.z.object({id:v.z.number(),uid:v.z.string(),documentId:v.z.string(),requireCommentsApproval:v.z.boolean().nullable().optional(),locale:v.z.string().nullable().optional()});al.omit({related:!0}).extend({related:n_.nullable().optional()});const r_=v.z.array(al),i_=v.z.object({pagination:dv,results:v.z.array(al)}),ia={findMany:r_,findWithCount:i_,findOne:al,create:al},o_=v.z.object({id:v.z.number(),documentId:v.z.string(),content:v.z.string(),blocked:v.z.boolean(),blockedThread:v.z.boolean(),blockReason:v.z.string().nullable(),authorId:v.z.string(),authorName:v.z.string(),authorEmail:v.z.string(),authorAvatar:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string(),locale:v.z.string().nullable()}),mv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:o_.nullable().optional()}),u_=v.z.object({results:v.z.array(mv),pagination:dv}),a_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),s_=v.z.array(v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:pv.nullable()})),Of={findMany:s_,findPage:u_,update:a_,create:mv},l_=i=>{const u=lr(i,"comment-report"),o=i.query(u);return{async findPage(h){const m=await Ir(i,"isValidationEnabled",!1);return o.findPage(h).then(Di(m,Of.findPage))},async findMany(h){const m=await Ir(i,"isValidationEnabled",!1);return o.findMany(h).then(gv(m,Of.findMany))},async update(h){const m=await Ir(i,"isValidationEnabled",!1);return o.update(h).then(Di(m,Of.update))},async updateMany(h){return o.updateMany(h)},async create(h){const m=await Ir(i,"isValidationEnabled",!1);return o.create(h).then(Di(m,Of.create))}}},Pi=Le.once(l_),c_=i=>{const u=lr(i,"comment");return{async findMany(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findMany(o).then(gv(h,ia.findMany))},async findWithCount(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findPage(o).then(Di(h,ia.findWithCount))},async findOne(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findOne(o).then(m=>m?Di(h,ia.findOne)(m):null)},async update(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).update(o).then(Di(h,ia.findOne))},async delete(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).delete(o).then(m=>m?Di(h,ia.findOne)(m):null)},async deleteMany(o){return i.query(u).deleteMany(o)},updateMany(o){return i.query(u).updateMany(o)},async create(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).create(o).then(Di(h,ia.create))}}},it=Le.once(c_),f_=i=>({getLocalConfig(u,o){return i.config.get([Ov,u].filter(Boolean).join("."),o)},async getStore(){return await i.store({type:"plugin",name:"comments"})},async getConfig(){return await(await this.getStore()).get({key:"config"})},async get(u){const o=await this.getConfig(),h={regex:Object.keys(mm).reduce((O,F)=>({...O,[F]:mm[F].toString()}),{})},m=!!i.plugin("graphql"),A=this.getLocalConfig("reportReasons");if(o)return ol({...o,...h,reportReasons:A,isGQLPluginEnabled:u?m:void 0});const E=this.getLocalConfig("entryLabel"),C=this.getLocalConfig("approvalFlow"),x=this.getLocalConfig("blockedAuthorProps"),N={entryLabel:E,approvalFlow:C,blockedAuthorProps:x,reportReasons:A,...h};if(u){const O=this.getLocalConfig("enabledCollections"),F=this.getLocalConfig("moderatorRoles");return ol({...N,enabledCollections:O,moderatorRoles:F,isGQLPluginEnabled:m})}return ol(N)},async update(u){return await(await this.getStore()).set({key:"config",value:{...u,reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER}}}),this.get()},async restore(){return await(await this.getStore()).delete({key:"config"}),this.get()}}),Uf=Le.once(f_),h_=({strapi:i})=>({getService(u){return ft(i,u)},getStoreRepository(){return Uf(i)},async post(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=$y(h.enabledCollections,u.params.relation,u.request.body);if(pe(m))return this.getService("client").create(m.right,u.state.user);throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllFlat(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=qy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllFlat(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllInHierarchy(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=Hy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllInHierarchy(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllPerAuthor(u){const o=Yy(u.params,u.query);if(pe(o))return this.getService("common").findAllPerAuthor(ua(o.right),u.params.type?![ul.GENERIC.toLowerCase(),ul.GENERIC].includes(u.params.type):!1);throw ce(u,Y(o))},async put(u){const{user:o}=u.state,h=await this.getStoreRepository().get(!0);if(pe(h)){const m=Y(h),A=jy(m.enabledCollections,{...u.params,content:u.request.body.content,author:u.request.body.author});if(pe(A))return await this.getService("client").update(A.right,o);throw ce(u,Y(A))}throw ce(u,Y(h))},async reportAbuse(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),E=Jy(A,{...u.request.body,...u.params});if(pe(E))return await this.getService("client").reportAbuse(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))},async removeComment(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),E=Zy(A.enabledCollections,{...u.query,...u.params});if(pe(E))return await this.getService("client").markAsRemoved(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))}}),p_=({strapi:i})=>{const u=ft(i,"settings");return{async get(o){try{return await u.getConfig()}catch(h){throw ce(o,h)}},async getForSettingsPage(o){try{return await u.getConfig(!0)}catch(h){throw ce(o,h)}},async update(o){const h=By(o.request.body);if(pe(h))return await u.update(Y(h));throw ce(o,Y(h))},async restore(o){try{return await u.restore()}catch(h){throw ce(o,h)}},async restart(o){try{return u.restart(),o.send({message:"Restarted",status:200})}catch(h){throw ce(o,h)}}}},d_={admin:Ky,client:h_,settings:p_},g_=[{method:"GET",path:"/moderate/all",handler:"admin.findAll",config:{policies:[]}},{method:"GET",path:"/moderate/reports",handler:"admin.findReports",config:{policies:[]}},{method:"GET",path:"/moderate/single/:id",handler:"admin.findOne",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/approve",handler:"admin.approveComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/reject",handler:"admin.rejectComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/block",handler:"admin.blockComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/unblock",handler:"admin.unblockComment",config:{policies:[]}},{method:"DELETE",path:"/moderate/single/:id/delete",handler:"admin.deleteComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/:reportId/resolve",handler:"admin.resolveAbuseReport",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/resolve",handler:"admin.resolveCommentMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve",handler:"admin.resolveAllAbuseReportsForComment",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve-thread",handler:"admin.resolveAllAbuseReportsForThread",config:{policies:[]}},{method:"PUT",path:"/moderate/multiple/report/resolve",handler:"admin.resolveMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/update",handler:"admin.updateComment",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/block",handler:"admin.blockCommentThread",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/unblock",handler:"admin.unblockCommentThread",config:{policies:[]}},{method:"POST",path:"/moderate/thread/:id/postComment",handler:"admin.postComment",config:{policies:[]}}],m_=[{method:"PUT",path:"/settings/config",handler:"settings.update",config:{policies:[]}},{method:"DELETE",path:"/settings/config",handler:"settings.restore",config:{policies:[]}},{method:"POST",path:"/settings/restart",handler:"settings.restart",config:{policies:[]}},{method:"GET",path:"/settings/config",handler:"settings.getForSettingsPage",config:{policies:[]}},{method:"GET",path:"/moderate/config",handler:"settings.get",config:{policies:[]}}],v_=[...g_,...m_],y_=[{method:"GET",path:"/:relation",handler:"client.findAllInHierarchy",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a nested structure",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"POST",path:"/:relation",handler:"client.post",config:{policies:[],description:"Post a comment against configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"GET",path:"/:relation/flat",handler:"client.findAllFlat",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a flat structure for further processing",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"PUT",path:"/:relation/comment/:commentId",handler:"client.put",config:{policies:[],description:"Update comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"update"}}},{method:"POST",path:"/:relation/comment/:commentId/report-abuse",handler:"client.reportAbuse",config:{policies:[],description:"Report an abuse against comment for configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"DELETE",path:"/:relation/comment/:commentId",handler:"client.removeComment",config:{policies:[],description:"Remove comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"delete"}}},{method:"GET",path:"/author/:authorId",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by Strapi user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"GET",path:"/author/:authorId/:type",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by specified type of user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}}],__={"content-api":{type:"content-api",routes:y_},admin:{type:"admin",routes:v_}};class fn extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,fn.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}}const km=i=>i.split(Vv.relatedUid).filter(u=>u&&u.length>0),vv=i=>i&&{...i,reports:(i.reports||[]).filter(u=>!u.resolved)},Vm=(i,u,o=[])=>{const{authorUser:h,authorId:m,authorName:A,authorEmail:E,authorAvatar:C,...x}=i;let N={};if(h&&typeof h!="string"){const O=h;N=o.reduce((F,U)=>({...F,[U]:O[U]}),{id:O.id,name:O.username,email:O.email,avatar:O.avatar?.formats?.thumbnail.url||O.avatar?.url})}else m&&(N={id:m,name:A,email:E,avatar:C});return N=Le.isEmpty(N)?N:Object.fromEntries(Object.entries(N).filter(([O])=>!u.includes(O))),{...x,author:Le.isEmpty(N)?i.author||{}:N}},Cf=i=>{throw i?new fn(401,"Not authenticated"):new fn(403,"Not authorized")},b_=i=>{const{lastname:u,username:o,firstname:h}=i;return u&&h?`${h} ${u}`:o||h||""},w_=Le.once(i=>({findAll:{createParams(u,o,h,m,A){const[E,C]=vm(u),x={orderBy:u?{[E]:C}:void 0,where:A,page:o,pageSize:h};return m&&Le.set(x,"where.content.$contains",m),x},getPopulate(){return{authorUser:il(i),threadOf:{populate:{authorUser:il(i)}},reports:{where:{resolved:!1}}}}},findReports:{getDefaultWhere(){return{resolved:{$notNull:!0}}},createParams(u,o,h,m){const[A,E]=vm(u),C={orderBy:u?{[A]:E}:void 0,where:this.getDefaultWhere(),page:o,pageSize:h};return m&&Le.set(C,"where.content.$contains",m),C}},findOneAndThread:{getDefaultWhere(u){return u?{$or:[{removed:!1},{removed:{$notNull:!1}}]}:{}},getPopulate(){const u=il(i),o={reports:{where:{resolved:!1}}},h={populate:{threadOf:{populate:{...o}},...o}};return{populate:{...h.populate,authorUser:u,threadOf:{populate:{...h.populate.threadOf.populate,authorUser:u}}}}}}})),A_=({strapi:i})=>{const u=w_(i);return{getCommonService(){return ft(i,"common")},async findAll({_q:o,orderBy:h,page:m,pageSize:A,filters:E}){const C=u.findAll.createParams(h,m,A,o,E),x=u.findAll.getPopulate(),N=it(i),{pagination:O,results:F}=await N.findWithCount({...C,count:!0,populate:x}),U=await this.getCommonService().findRelatedEntitiesFor(F);return{pagination:O,result:F.map(Q=>this.getCommonService().sanitizeCommentEntity(Q,[],[])).map(Q=>this.getCommonService().mergeRelatedEntityTo(Q,U))}},async findReports({_q:o,orderBy:h,page:m,pageSize:A}){const E=u.findReports.createParams(h,m,A,o),{pagination:C,results:x}=await Pi(i).findPage({...E,populate:["related"]}),N=x.map($=>typeof $.related=="object"?$.related.id:null).filter(Boolean),O=il(i),F=await it(i).findMany({where:{threadOf:N},populate:["threadOf"],limit:Number.MAX_SAFE_INTEGER}),U=Array.from(new Set(F.map(({threadOf:$})=>typeof $=="object"?$.id:null).filter(Boolean)));return{result:x.map($=>{const J=U.includes($.related.id),te=this.getCommonService(),X={...$,related:te.sanitizeCommentEntity({...$.related,gotThread:J},[])},me=typeof O!="boolean"?O?.populate:{};return vv(te.sanitizeCommentEntity(X,[],[],me))}),pagination:C}},async findOneAndThread({id:o,removed:h,...m}){const A=il(i),E=u.findOneAndThread.getDefaultWhere(h),C=u.findOneAndThread.getPopulate(),x=await it(i).findOne({...C,where:{id:o}});if(!x)throw new An(404,"Not found");const{relatedId:N,uid:O}=this.getCommonService().parseRelationString(x.related),F=await i.documents(O).findOne({documentId:N}).then(te=>{if(!te)throw new An(404,"Relation not found");return{...te,uid:O}}),U=x.threadOf&&typeof x.threadOf=="object"?x.threadOf.id:null,Q=await this.getCommonService().findAllInHierarchy({filters:{...E,...m,threadOf:U,related:x.related},...C,startingFromId:U,isAdmin:!0,limit:Number.MAX_SAFE_INTEGER},!1),$=typeof A!="boolean"?A?.populate:{},J=this.getCommonService().sanitizeCommentEntity({...x,threadOf:x.threadOf||null},[],[],$);return{entity:F,selected:J,level:Q}},async changeBlockedComment(o,h){const m=await this.getCommonService().findOne({id:o});return this.getCommonService().updateComment({id:o},{blocked:Le.isNil(h)?!m.blocked:h})},async deleteComment(o){return it(i).update({where:{id:o},data:{removed:!0}})},async blockCommentThread(o,h){const m=await this.getCommonService().findOne({id:o}),A=h||!m.blocked,E=await this.getCommonService().updateComment({id:o},{blocked:A,blockedThread:A});return await this.blockNestedThreads(o,A),this.getCommonService().sanitizeCommentEntity(E,[])},async approveComment(o){const h=await it(i).update({where:{id:o},data:{approvalStatus:Fi.APPROVED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async rejectComment(o){const h=await it(i).update({where:{id:o},data:{approvalStatus:Fi.REJECTED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async blockNestedThreads(o,h){return this.getCommonService().modifiedNestedNestedComments(o,"blockedThread",h)},async resolveAbuseReport({id:o,reportId:h}){return Pi(i).update({where:{id:h,related:o},data:{resolved:!0}})},async resolveCommentMultipleAbuseReports({id:o,reportIds:h}){if((await Pi(i).findMany({where:{id:h,related:o},populate:["related"]})).length===h.length)return Pi(i).updateMany({where:{id:h},data:{resolved:!0}});throw new An(400,"At least one of selected reports got invalid comment entity relation. Try again.")},async resolveAllAbuseReportsForComment(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");return Pi(i).updateMany({where:{related:o,resolved:!1},data:{resolved:!0}})},async resolveAllAbuseReportsForThread(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");const h=await it(i).findMany({where:{threadOf:o},select:["id"]});return Pi(i).updateMany({where:{related:h.map(({id:m})=>m).concat([o]),resolved:!1},data:{resolved:!0}})},async resolveMultipleAbuseReports({reportIds:o}){return Pi(i).updateMany({where:{id:{$in:o}},data:{resolved:!0}})},async postComment({id:o,author:h,content:m}){const A=await it(i).findOne({where:{id:o}});if(!A)throw new An(404,"Not found");return it(i).create({data:{content:m,threadOf:o,authorId:h.id,authorName:b_(h),authorEmail:h.email,related:A.related,isAdminComment:!0}})},async updateComment({id:o,content:h}){const m=await it(i).update({where:{id:o},data:{content:h}});if(!m)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(m,[])}}},S_=async(i,u)=>{try{return ol(await i())}catch{return av(u)}},E_=({strapi:i})=>{const u=async(o,h)=>{if(h)return{authorUser:h.id};if(o)return{authorId:o.id,authorName:o.name,authorEmail:o.email,authorAvatar:o.avatar}};return{getCommonService(){return ft(i,"common")},async create({relation:o,content:h,threadOf:m,author:A,approvalStatus:E,locale:C},x){const{uid:N,relatedId:O}=this.getCommonService().parseRelationString(o),F=await i.documents(N).findOne({documentId:O,locale:C});if(!F)throw new fn(400,'Relation for field "related" does not exist. Check your payload please.');const Q=(await this.getCommonService().getConfig(oa.APPROVAL_FLOW,[])).includes(N)||F.requireCommentsApproval,$=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),J=await S_(async()=>m?await this.getCommonService().findOne({id:m,related:o,locale:C||null}):null,new fn(400,"Thread does not exist"));if(yy(J))throw Y(J);const te=Y(J);if(!A&&!this.getCommonService().isValidUserContext(x))throw Cf(x);const[X,me]=await Promise.all([this.getCommonService().checkBadWords(h),u(A,x)]),ve=!Le.isEmpty(me)&&!(me.authorId||me.authorUser);if(Le.isEmpty(me)||ve)throw new fn(400,`Not able to recognise author of a comment. Make sure you've provided "author" property in a payload or authenticated your request properly.`);if(Q&&E&&E!==Fi.PENDING)throw new fn(400,"Invalid approval status");const Ve={...await it(i).create({data:{...me,threadOf:m,locale:C,content:X,related:o,approvalStatus:Q?Fi.PENDING:Fi.APPROVED},populate:{authorUser:{populate:["avatar"]}}}),threadOf:te},Ye=this.getCommonService().sanitizeCommentEntity(Ve,$);try{await this.sendResponseNotification(Ye)}catch(Me){console.error(Me)}return Ye},async update({commentId:o,content:h,author:m,relation:A},E){if(!m&&!this.getCommonService().isValidUserContext(E))throw Cf(E);const C=E?.id||m?.id;if(await this.getCommonService().checkBadWords(h)){const x=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),N=await this.getCommonService().findOne({id:o,related:A});if(N&&N.author?.id?.toString()===C?.toString()){const O=await it(i).update({where:{id:o},data:{content:h},populate:{threadOf:!0,authorUser:{populate:["avatar"]}}});return this.getCommonService().sanitizeCommentEntity(O,x)}}},async reportAbuse({commentId:o,relation:h,...m},A){if(!this.getCommonService().isValidUserContext(A))throw Cf(A);try{const E=await this.getCommonService().findOne({id:o,related:h});if(E.isAdminComment)throw new fn(403,"You're not allowed to take an action on that entity. This in a admin comment.");if(E){const C=await Pi(i).create({data:{...m,resolved:!1,related:o}});if(C){const x={...C,related:E};try{return await this.sendAbuseReportEmail(C.reason,C.content),x}catch{return x}}else throw new fn(500,"Report cannot be created")}throw new fn(403,"You're not allowed to take an action on that entity. Make sure that comment exist or you've authenticated your request properly.")}catch(E){throw E}},async markAsRemoved({commentId:o,relation:h,authorId:m},A){if(!m&&!this.getCommonService().isValidUserContext(A))throw Cf(A);const E=A?.id||m;if(!E)throw new fn(403,`You're not allowed to take an action on that entity. Make sure that you've provided proper "authorId" or authenticated your request properly.`);try{const C=A?.id?{authorUser:E}:{authorId:E};if(await this.getCommonService().findOne({id:o,related:h,...C})){const N=await it(i).update({where:{id:o,related:h},data:{removed:!0},populate:{threadOf:!0,authorUser:{populate:["avatar"]}}});await this.markAsRemovedNested(o,!0);const O=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]);return this.getCommonService().sanitizeCommentEntity(N,O)}else throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}catch{throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}},async sendAbuseReportEmail(o,h){const m="strapi-super-admin",A=await this.getCommonService().getConfig(oa.MODERATOR_ROLES,[m]);if(A.length>0){const E=await i.query("admin::user").findMany({where:{roles:{code:A}}}).then(C=>C.map(x=>x.email));if(E.length>0){const C=await i.query("admin::user").findOne({where:{roles:{code:m}}});i.plugin("email")&&await i.plugin("email").service("email").send({to:E,from:C.email,subject:"New abuse report on comment",text:`
77
77
  There was a new abuse report on your app.
78
78
  Reason: ${o}
79
79
  Message: ${h}
@@ -87,7 +87,7 @@ spurious results.`)}}return!1},g0=5;function m0(i,u){const[o,h]=u?[i,u]:[void 0,
87
87
  ------
88
88
 
89
89
  Visit ${C} and continue the discussion.
90
- `})}catch(x){throw i.log.error(x),x}}}}}},T_=10,O_=["id"],C_=({strapi:i})=>({async getConfig(u,o,h=!1){const m=Uf(i),A=await m.getConfig();return u&&!h?Le.get(A,u,o):h?m.getLocalConfig(u,o):A},parseRelationString(u){const[o,h]=jm(u);return{uid:o,relatedId:h}},isValidUserContext(u){return u?u.id!=null:!0},sanitizeCommentEntity(u,o,h=[],m={}){const A=Array.isArray(m)?m:Object.keys(m||{});return Le.omit({...km({...u,threadOf:Le.isObject(u.threadOf)?km(u.threadOf,o,A):u.threadOf},o,A)},h)},async findAllFlat({fields:u,limit:o,skip:h,sort:m,populate:A,omit:E=[],isAdmin:C=!1,pagination:x,filters:N={},locale:O},F){const U=E.filter(Qe=>!O_.includes(Qe)),Q=["id","related"].filter(Qe=>!U.includes(Qe)),$={authorUser:{populate:!0,avatar:{populate:!0}},...Le.isObject(A)?A:{}},J=C?[]:await this.getConfig(Cr.AUTHOR_BLOCKED_PROPS,[]),[te,X]=vm(m),me={orderBy:{[te]:X},select:Array.isArray(u)?Le.uniq([...u,Q].flat()):u},ve={where:{...N,...O?{locale:O}:{}},populate:$,...me,pageSize:x?.pageSize||o||T_,page:x?.page||(h?Math.floor(h/o):1)||1},{results:ze,pagination:Ve}=await it(i).findWithCount(ve),Ye=await Promise.all(ze.map(async Qe=>{const{results:Sn,pagination:{total:En}}=await it(i).findWithCount({where:{threadOf:Qe.id}});return{id:Qe.id,itemsInTread:En,firstThreadItemId:Le.first(Sn)?.id}})),Me=U.includes("related")?[]:F!==null?[F]:await this.findRelatedEntitiesFor([...ze]),hn=Me.filter(Qe=>Qe).length>0,jn=ze.map(Qe=>{const Sn=Ye.find(Ze=>Ze.id===Qe.id),En="threadOf"in N?Le.isString(N.threadOf)?Le.parseInt(N.threadOf):N.threadOf:null;let Kr={};Le.isObject(A?.authorUser)&&(Kr="populate"in A.authorUser?A.authorUser.populate:$.authorUser);const fr=typeof En=="number"?En:null;return this.sanitizeCommentEntity({...Qe,threadOf:fr||Qe.threadOf,gotThread:(Sn?.itemsInTread||0)>0,threadFirstItemId:Sn?.firstThreadItemId},J,U,Kr)});return{data:hn?jn.map(Qe=>this.mergeRelatedEntityTo(Qe,Me)):jn,pagination:Ve}},async getCommentsChildren({filters:u,populate:o,sort:h,fields:m,isAdmin:A=!1,omit:E=[],locale:C,limit:x},N,O,F=!1,U=!1){if(!N.gotThread)return{...N,threadOf:void 0,related:void 0,blockedThread:U||N.blockedThread,children:[]};const Q=await this.findAllFlat({filters:{...u,threadOf:{$eq:N.id.toString()}},populate:o,sort:h,fields:m,isAdmin:A,omit:E,locale:C,limit:Number.MAX_SAFE_INTEGER},O),$=N.blockedThread&&F?[]:await Promise.all(Q.data.map(J=>this.getCommentsChildren({filters:u,populate:o,sort:h,fields:m,isAdmin:A,omit:E,locale:C,limit:x},J,O,F)));return{...N,threadOf:void 0,related:void 0,blockedThread:U||N.blockedThread,children:$}},async findAllInHierarchy({filters:u,populate:o,sort:h,fields:m,startingFromId:A,dropBlockedThreads:E,isAdmin:C=!1,omit:x=[],locale:N,limit:O,pagination:F},U){const Q=await this.findAllFlat({filters:{threadOf:A?{$eq:A.toString()}:{$null:!0},...u},pagination:F,populate:o,sort:h,fields:m,isAdmin:C,omit:x,locale:N,limit:O},U);return await Promise.all(Q?.data.map(J=>this.getCommentsChildren({filters:u,populate:o,sort:h,fields:m,isAdmin:C,omit:x,locale:N,limit:O},J,U,E)))},async findOne(u){const o=await it(i).findOne({where:u,populate:{reports:!0,authorUser:{populate:["avatar"]}}});if(!o)throw new An(400,"Comment does not exist. Check your payload please.");const h=await this.getConfig(Cr.AUTHOR_BLOCKED_PROPS,[]),m=this.sanitizeCommentEntity(o,h);return mv(m)},async findMany(u){return it(i).findMany(u)},async updateComment(u,o){return it(i).update({where:u,data:o})},async findAllPerAuthor({filters:u={},populate:o={},pagination:h,sort:m,fields:A,isAdmin:E=!1,authorId:C},x=!1){{if(Le.isNil(C))return{data:[]};const N=x?{authorUser:{id:C}}:{authorId:C},O=await this.findAllFlat({filters:{...Le.omit(u,["related"]),...N},pagination:h,populate:o,sort:m,fields:A,isAdmin:E});return{...O,data:O.data.map(({author:F,...U})=>U)}}},async findRelatedEntitiesFor(u){const o=u.reduce((h,m)=>{const[A,E]=jm(m.related);return{...h,[A]:{...h[A]||{},documentIds:[...h[A]?.documentIds||[],E],locale:[...h[A]?.locale||[],m.locale]}}},{});return Promise.all(Object.entries(o).map(async([h,{documentIds:m,locale:A}])=>Promise.all(m.map((E,C)=>i.documents(h).findOne({documentId:E.toString(),locale:Le.isNil(A[C])?void 0:A[C],status:"published"}))).then(E=>E.filter(C=>C).map(C=>({...C,uid:h}))))).then(h=>h.flat(2))},mergeRelatedEntityTo(u,o=[]){return{...u,related:o.find(h=>h.locale&&u.locale?u.related===`${h.uid}:${h.documentId}`&&u.locale===h.locale:u.related===`${h.uid}:${h.documentId}`)}},async modifiedNestedNestedComments(u,o,h,m=10){if(m===0)return!0;try{const A=await this.findMany({where:{threadOf:u}}),E=await it(i).updateMany({where:{id:A.map(C=>C.id)},data:{[o]:h}});return A.length===E.count&&E.count>0?(await Promise.all(A.map(x=>this.modifiedNestedNestedComments(x.id,o,h,m-1)))).length===E.count:!0}catch{return!1}},async checkBadWords(u){if(await this.getConfig(Cr.BAD_WORDS,!0)&&u&&Rm.isProfane({testString:u}))throw new An(400,"Bad language used! Please polite your comment...",{content:{original:u,filtered:u&&Rm.replaceProfanities({testString:u})}});return u},async perRemove(u,o){const h=await i.plugin("i18n")?.service("locales").getDefaultLocale()||null;return it(i).updateMany({where:{related:u,$or:[{locale:o},h===o?{locale:{$eq:null}}:null].filter(Boolean)},data:{removed:!0}})},registerLifecycleHook(){},async runLifecycleHook(){}});var Rf={exports:{}};/**
90
+ `})}catch(x){throw i.log.error(x),x}}}}}},T_=10,O_=["id"],C_=({strapi:i})=>({async getConfig(u,o,h=!1){const m=Uf(i),A=await m.getConfig();return u&&!h?Le.get(A,u,o):h?m.getLocalConfig(u,o):A},parseRelationString(u){const[o,h]=km(u);return{uid:o,relatedId:h}},isValidUserContext(u){return u?u.id!=null:!0},sanitizeCommentEntity(u,o,h=[],m={}){const A=Array.isArray(m)?m:Object.keys(m||{});return Le.omit({...Vm({...u,threadOf:Le.isObject(u.threadOf)?Vm(u.threadOf,o,A):u.threadOf},o,A)},h)},async findAllFlat({fields:u,limit:o,skip:h,sort:m,populate:A,omit:E=[],isAdmin:C=!1,pagination:x,filters:N={},locale:O},F){const U=E.filter(Qe=>!O_.includes(Qe)),Q=["id","related"].filter(Qe=>!U.includes(Qe)),$={authorUser:{populate:!0,avatar:{populate:!0}},...Le.isObject(A)?A:{}},J=C?[]:await this.getConfig(Cr.AUTHOR_BLOCKED_PROPS,[]),[te,X]=vm(m),me={orderBy:{[te]:X},select:Array.isArray(u)?Le.uniq([...u,Q].flat()):u},ve={where:{...N,...O?{locale:O}:{}},populate:$,...me,pageSize:x?.pageSize||o||T_,page:x?.page||(h?Math.floor(h/o):1)||1},{results:ze,pagination:Ve}=await it(i).findWithCount(ve),Ye=await Promise.all(ze.map(async Qe=>{const{results:Sn,pagination:{total:En}}=await it(i).findWithCount({where:{threadOf:Qe.id}});return{id:Qe.id,itemsInTread:En,firstThreadItemId:Le.first(Sn)?.id}})),Me=U.includes("related")?[]:F!==null?[F]:await this.findRelatedEntitiesFor([...ze]),hn=Me.filter(Qe=>Qe).length>0,jn=ze.map(Qe=>{const Sn=Ye.find(Ze=>Ze.id===Qe.id),En="threadOf"in N?Le.isString(N.threadOf)?Le.parseInt(N.threadOf):N.threadOf:null;let Kr={};Le.isObject(A?.authorUser)&&(Kr="populate"in A.authorUser?A.authorUser.populate:$.authorUser);const fr=typeof En=="number"?En:null;return this.sanitizeCommentEntity({...Qe,threadOf:fr||Qe.threadOf,gotThread:(Sn?.itemsInTread||0)>0,threadFirstItemId:Sn?.firstThreadItemId},J,U,Kr)});return{data:hn?jn.map(Qe=>this.mergeRelatedEntityTo(Qe,Me)):jn,pagination:Ve}},async getCommentsChildren({filters:u,populate:o,sort:h,fields:m,isAdmin:A=!1,omit:E=[],locale:C,limit:x},N,O,F=!1,U=!1){if(!N.gotThread)return{...N,threadOf:void 0,related:void 0,blockedThread:U||N.blockedThread,children:[]};const Q=await this.findAllFlat({filters:{...u,threadOf:{$eq:N.id.toString()}},populate:o,sort:h,fields:m,isAdmin:A,omit:E,locale:C,limit:Number.MAX_SAFE_INTEGER},O),$=N.blockedThread&&F?[]:await Promise.all(Q.data.map(J=>this.getCommentsChildren({filters:u,populate:o,sort:h,fields:m,isAdmin:A,omit:E,locale:C,limit:x},J,O,F)));return{...N,threadOf:void 0,related:void 0,blockedThread:U||N.blockedThread,children:$}},async findAllInHierarchy({filters:u,populate:o,sort:h,fields:m,startingFromId:A,dropBlockedThreads:E,isAdmin:C=!1,omit:x=[],locale:N,limit:O,pagination:F},U){const Q=await this.findAllFlat({filters:{threadOf:A?{$eq:A.toString()}:{$null:!0},...u},pagination:F,populate:o,sort:h,fields:m,isAdmin:C,omit:x,locale:N,limit:O},U);return await Promise.all(Q?.data.map(J=>this.getCommentsChildren({filters:u,populate:o,sort:h,fields:m,isAdmin:C,omit:x,locale:N,limit:O},J,U,E)))},async findOne(u){const o=await it(i).findOne({where:u,populate:{reports:!0,authorUser:{populate:["avatar"]}}});if(!o)throw new An(400,"Comment does not exist. Check your payload please.");const h=await this.getConfig(Cr.AUTHOR_BLOCKED_PROPS,[]),m=this.sanitizeCommentEntity(o,h);return vv(m)},async findMany(u){return it(i).findMany(u)},async updateComment(u,o){return it(i).update({where:u,data:o})},async findAllPerAuthor({filters:u={},populate:o={},pagination:h,sort:m,fields:A,isAdmin:E=!1,authorId:C},x=!1){{if(Le.isNil(C))return{data:[]};const N=x?{authorUser:{id:C}}:{authorId:C},O=await this.findAllFlat({filters:{...Le.omit(u,["related"]),...N},pagination:h,populate:o,sort:m,fields:A,isAdmin:E});return{...O,data:O.data.map(({author:F,...U})=>U)}}},async findRelatedEntitiesFor(u){const o=u.reduce((h,m)=>{const[A,E]=km(m.related);return{...h,[A]:{...h[A]||{},documentIds:[...h[A]?.documentIds||[],E],locale:[...h[A]?.locale||[],m.locale]}}},{});return Promise.all(Object.entries(o).map(async([h,{documentIds:m,locale:A}])=>Promise.all(m.map((E,C)=>i.documents(h).findOne({documentId:E.toString(),locale:Le.isNil(A[C])?void 0:A[C],status:"published"}))).then(E=>E.filter(C=>C).map(C=>({...C,uid:h}))))).then(h=>h.flat(2))},mergeRelatedEntityTo(u,o=[]){return{...u,related:o.find(h=>h.locale&&u.locale?u.related===`${h.uid}:${h.documentId}`&&u.locale===h.locale:u.related===`${h.uid}:${h.documentId}`)}},async modifiedNestedNestedComments(u,o,h,m=10){if(m===0)return!0;try{const A=await this.findMany({where:{threadOf:u}}),E=await it(i).updateMany({where:{id:A.map(C=>C.id)},data:{[o]:h}});return A.length===E.count&&E.count>0?(await Promise.all(A.map(x=>this.modifiedNestedNestedComments(x.id,o,h,m-1)))).length===E.count:!0}catch{return!1}},async checkBadWords(u){if(await this.getConfig(Cr.BAD_WORDS,!0)&&u&&Nm.isProfane({testString:u}))throw new An(400,"Bad language used! Please polite your comment...",{content:{original:u,filtered:u&&Nm.replaceProfanities({testString:u})}});return u},async perRemove(u,o){const h=await i.plugin("i18n")?.service("locales").getDefaultLocale()||null;return it(i).updateMany({where:{related:u,$or:[{locale:o},h===o?{locale:{$eq:null}}:null].filter(Boolean)},data:{removed:!0}})},registerLifecycleHook(){},async runLifecycleHook(){}});var Rf={exports:{}};/**
91
91
  * @license
92
92
  * Lodash <https://lodash.com/>
93
93
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -113,13 +113,13 @@ __p += '`),j&&(S+=`' +
113
113
  function print() { __p += __j.call(arguments, '') }
114
114
  `:`;
115
115
  `)+S+`return __p
116
- }`;var M=Sf(function(){return Or(f,R+"return "+S).apply(_,g)});if(M.source=S,Os(M))throw M;return M}function xd(e){return ge(e).toLowerCase()}function Rd(e){return ge(e).toUpperCase()}function Nd(e,t,n){if(e=ge(e),e&&(n||t===_))return fr(e);if(!e||!(t=Et(t)))return e;var r=Pe(e),a=Pe(t);return wr(r,Kt(r,a),xo(r,a)+1).join("")}function Ld(e,t,n){if(e=ge(e),e&&(n||t===_))return e.slice(0,hr(e)+1);if(!e||!(t=Et(t)))return e;var r=Pe(e);return wr(r,0,xo(r,Pe(t))+1).join("")}function zd(e,t,n){if(e=ge(e),e&&(n||t===_))return e.replace(ya,"");if(!e||!(t=Et(t)))return e;var r=Pe(e);return wr(r,Kt(r,Pe(t))).join("")}function Pd(e,t){var n=Vf,r=Gf;if(Fe(t)){var a="separator"in t?t.separator:a;n="length"in t?ue(t.length):n,r="omission"in t?Et(t.omission):r}e=ge(e);var s=e.length;if(Ge(e)){var c=Pe(e);s=c.length}if(n>=s)return e;var f=n-Ke(r);if(f<1)return r;var g=c?wr(c,0,f).join(""):e.slice(0,f);if(a===_)return g+r;if(c&&(f+=g.length-f),qs(a)){if(e.slice(f).search(a)){var w,b=g;for(a.global||(a=yt(a.source,ge(wl.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var S=w.index;g=g.slice(0,S===_?f:S)}}else if(e.indexOf(Et(a),f)!=f){var T=g.lastIndexOf(a);T>-1&&(g=g.slice(0,T))}return g+r}function Dd(e){return e=ge(e),e&&ga.test(e)?e.replace(gl,xh):e}function Gc(e,t,n){return e=ge(e),t=n?_:t,t===_?Nr(e)?cl(e):te(e):e.match(t)||[]}function Mu(e){var t=e==null?0:e.length,n=Z();return e=t?O(e,function(r){if(typeof r[1]!="function")throw new sn(At);return[n(r[0]),r[1]]}):[],se(function(r){for(var a=-1;++a<t;){var s=e[a];if(o(s[0],this,r))return o(s[1],this,r)}})}function Fd(e){return Uh(qt(e,Bt))}function Wu(e){return function(){return e}}function qc(e,t){return e==null||e!==e?t:e}function vt(e){return e}function Bu(e){return Xl(typeof e=="function"?e:qt(e,Bt))}function Hc(e){return Zl(qt(e,Bt))}function Yc(e,t){return Kl(e,qt(t,Bt))}function $u(e,t,n){var r=nt(t),a=ou(t,r);n!=null||Fe(t)&&(a.length||!r.length)||(n=t,t=e,e=this,a=ou(t,nt(t)));var s=!(Fe(n)&&"chain"in n&&!n.chain),c=tr(e);return m(a,function(f){var g=t[f];e[f]=g,c&&(e.prototype[f]=function(){var w=this.__chain__;if(s||w){var b=e(this.__wrapped__);return(b.__actions__=dt(this.__actions__)).push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,F([this.value()],arguments))})}),e}function Ud(){return at._===this&&(at._=qu),this}function Rs(){}function Md(e){return e=ue(e),se(function(t){return ec(t,e)})}function So(e){return wu(e)?Me(Fn(e)):yn(e)}function ju(e){return function(t){return e==null?_:$r(e,t)}}function Ns(){return[]}function Ls(){return!1}function zs(){return{}}function Qc(){return""}function Wd(){return!0}function Bd(e,t){if(e=ue(e),e<1||e>Tn)return[];var n=On,r=H(e,On);t=Z(t),e-=On;for(var a=En(r,t);++n<e;)t(n);return a}function $d(e){return ie(e)?O(e,Fn):Yt(e)?[e]:dt(ff(ge(e)))}function jd(e){var t=++Ds;return ge(e)+t}function kd(e){return e&&e.length?_r(e,vt,jr):_}function Vd(e,t){return e&&e.length?_r(e,Z(t,2),jr):_}function Gd(e){return Ye(e,vt)}function qd(e,t){return Ye(e,Z(t,2))}function Hd(e){return e&&e.length?_r(e,vt,ja):_}function Yd(e,t){return e&&e.length?_r(e,Z(t,2),ja):_}function Qd(e){return e&&e.length?Sn(e,vt):0}function Jd(e,t){return e&&e.length?Sn(e,Z(t,2)):0}y=y==null?at:mn.defaults(at.Object(),y,mn.pick(at,Ll));var be=y.Array,ku=y.Date,Ps=y.Error,Or=y.Function,ee=y.Math,Re=y.Object,yt=y.RegExp,ke=y.String,sn=y.TypeError,wn=be.prototype,Xd=Or.prototype,Ii=Re.prototype,Vu=y["__core-js_shared__"],Gu=Xd.toString,we=Ii.hasOwnProperty,Ds=0,Jc=function(){var e=/[^.]+$/.exec(Vu&&Vu.keys&&Vu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ln=Ii.toString,Xc=Gu.call(Re),qu=at._,Ue=yt("^"+Gu.call(we).replace(ko,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ne=Da?y.Buffer:_,rr=y.Symbol,Hu=y.Uint8Array,Zc=Ne?Ne.allocUnsafe:_,Yu=k(Re.getPrototypeOf,Re),Kc=Re.create,ef=Ii.propertyIsEnumerable,Qu=wn.splice,Fs=rr?rr.isConcatSpreadable:_,ir=rr?rr.iterator:_,or=rr?rr.toStringTag:_,Ju=function(){try{var e=Ar(Re,"defineProperty");return e({},"",{}),e}catch{}}(),tf=y.clearTimeout!==at.clearTimeout&&y.clearTimeout,Xu=ku&&ku.now!==at.Date.now&&ku.now,Qt=y.setTimeout!==at.setTimeout&&y.setTimeout,ur=ee.ceil,Zu=ee.floor,Us=Re.getOwnPropertySymbols,Zd=Ne?Ne.isBuffer:_,nf=y.isFinite,Kd=wn.join,rf=k(Re.keys,Re),Te=ee.max,H=ee.min,of=ku.now,cn=y.parseInt,Ms=ee.random,eg=wn.reverse,he=Ar(y,"DataView"),Eo=Ar(y,"Map"),Ku=Ar(y,"Promise"),ar=Ar(y,"Set"),To=Ar(y,"WeakMap"),Oo=Ar(Re,"create"),ea=To&&new To,xi={},tg=Tr(he),ng=Tr(Eo),rg=Tr(Ku),ig=Tr(ar),og=Tr(To),ta=rr?rr.prototype:_,Co=ta?ta.valueOf:_,uf=ta?ta.toString:_,Ri=function(){function e(){}return function(t){if(!Fe(t))return{};if(Kc)return Kc(t);e.prototype=t;var n=new e;return e.prototype=_,n}}();l.templateSettings={escape:li,evaluate:ml,interpolate:va,variable:"",imports:{_:l}},l.prototype=I.prototype,l.prototype.constructor=l,P.prototype=Ri(I.prototype),P.prototype.constructor=P,D.prototype=Ri(I.prototype),D.prototype.constructor=D,Ur.prototype.clear=tn,Ur.prototype.delete=Jo,Ur.prototype.get=Nh,Ur.prototype.has=hi,Ur.prototype.set=Xo,nn.prototype.clear=_e,nn.prototype.delete=Lh,nn.prototype.get=Wl,nn.prototype.has=Zo,nn.prototype.set=zh,Yn.prototype.clear=Ph,Yn.prototype.delete=Ko,Yn.prototype.get=yr,Yn.prototype.has=eu,Yn.prototype.set=Bl,In.prototype.add=In.prototype.push=$l,In.prototype.has=jl,zt.prototype.clear=kl,zt.prototype.delete=eo,zt.prototype.get=Mr,zt.prototype.has=tu,zt.prototype.set=Dh;var Mn=_i(xn),af=_i(Wa,!0),Io=Za(),sf=Za(!0),lf=ea?function(e,t){return ea.set(e,t),e}:vt,ug=Ju?function(e,t){return Ju(e,"toString",{configurable:!0,enumerable:!1,value:Wu(t),writable:!0})}:vt,rt=se,Rt=tf||function(e){return at.clearTimeout(e)},ag=ar&&1/re(new ar([,-0]))[1]==Pr?function(e){return new ar(e)}:Rs,Ws=ea?function(e){return ea.get(e)}:Rs,Bs=Us?function(e){return e==null?[]:(e=Re(e),C(Us(e),function(t){return ef.call(e,t)}))}:Ns,$s=Us?function(e){for(var t=[];e;)F(t,Bs(e)),e=Yu(e);return t}:Ns,_t=tt;(he&&_t(new he(new ArrayBuffer(1)))!=ai||Eo&&_t(new Eo)!=dn||Ku&&_t(Ku.resolve())!=Gi||ar&&_t(new ar)!=gn||To&&_t(new To)!=Yi)&&(_t=function(e){var t=tt(e),n=t==qn?e.constructor:_,r=n?Tr(n):"";if(r)switch(r){case tg:return ai;case ng:return dn;case rg:return Gi;case ig:return gn;case og:return Yi}return t});var sg=Vu?tr:Ls,cf=ls(lf),Ni=Qt||function(e,t){return at.setTimeout(e,t)},js=ls(ug),ff=Sr(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(yl,function(n,r,a,s){t.push(a?s.replace(ch,"$1"):r||n)}),t}),lg=se(function(e,t){return je(e)?Br(e,We(t,1,je,!0)):[]}),hf=se(function(e,t){var n=Ot(t);return je(n)&&(n=_),je(e)?Br(e,We(t,1,je,!0),Z(n,2)):[]}),pf=se(function(e,t){var n=Ot(t);return je(n)&&(n=_),je(e)?Br(e,We(t,1,je,!0),_,n):[]}),cg=se(function(e){var t=O(e,cu);return t.length&&t[0]===e[0]?mi(t):[]}),fg=se(function(e){var t=Ot(e),n=O(e,cu);return t===Ot(n)?t=_:n.pop(),n.length&&n[0]===e[0]?mi(n,Z(t,2)):[]}),hg=se(function(e){var t=Ot(e),n=O(e,cu);return t=typeof t=="function"?t:_,t&&n.pop(),n.length&&n[0]===e[0]?mi(n,_,t):[]}),pg=se(mo),Li=Dn(function(e,t){var n=e==null?0:e.length,r=Ma(e,t);return nc(e,O(t,function(a){return gt(a,n)?+a:a}).sort(so)),r}),dg=se(function(e){return Pt(We(e,1,je,!0))}),gg=se(function(e){var t=Ot(e);return je(t)&&(t=_),Pt(We(e,1,je,!0),Z(t,2))}),mg=se(function(e){var t=Ot(e);return t=typeof t=="function"?t:_,Pt(We(e,1,je,!0),_,t)}),vg=se(function(e,t){return je(e)?Br(e,t):[]}),yg=se(function(e){return kr(C(e,je))}),df=se(function(e){var t=Ot(e);return je(t)&&(t=_),kr(C(e,je),Z(t,2))}),gf=se(function(e){var t=Ot(e);return t=typeof t=="function"?t:_,kr(C(e,je),_,t)}),_g=se(vs),bg=se(function(e){var t=e.length,n=t>1?e[t-1]:_;return n=typeof n=="function"?(e.pop(),n):_,Lu(e,n)}),wg=Dn(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,a=function(s){return Ma(s,e)};return!(t>1||this.__actions__.length)&&r instanceof D&&gt(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:vo,args:[a],thisArg:_}),new P(r,this.__chain__).thru(function(s){return t&&!s.length&&s.push(_),s})):this.thru(a)}),Ag=vi(function(e,t,n){we.call(e,n)?++e[n]:De(e,n,1)}),Sg=hu(cs),Eg=hu(qr),Tg=vi(function(e,t,n){we.call(e,n)?e[n].push(t):De(e,n,[t])}),Og=se(function(e,t,n){var r=-1,a=typeof t=="function",s=It(e)?be(e.length):[];return Mn(e,function(c){s[++r]=a?o(t,c,n):ae(c,t,n)}),s}),Cg=vi(function(e,t,n){De(e,n,t)}),Ig=vi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),xg=se(function(e,t){if(e==null)return[];var n=t.length;return n>1&&st(e,t[0],t[1])?t=[]:n>2&&st(t[0],t[1],t[2])&&(t=[t[0]]),br(e,We(t,1),[])}),na=Xu||function(){return at.Date.now()},ks=se(function(e,t,n){var r=$t;if(n.length){var a=q(n,ne(ks));r|=Vn}return Xn(e,r,t,n,a)}),mf=se(function(e,t,n){var r=$t|mr;if(n.length){var a=q(n,ne(mf));r|=Vn}return Xn(t,r,e,n,a)}),Rg=se(function(e,t){return pi(e,1,t)}),Ng=se(function(e,t,n){return pi(e,an(t)||0,n)});Pu.Cache=Yn;var Lg=rt(function(e,t){t=t.length==1&&ie(t[0])?O(t[0],Ze(Z())):O(We(t,1),Ze(Z()));var n=t.length;return se(function(r){for(var a=-1,s=H(r.length,n);++a<s;)r[a]=t[a].call(this,r[a]);return o(e,this,r)})}),Vs=se(function(e,t){return Xn(e,Vn,_,t,q(t,ne(Vs)))}),vf=se(function(e,t){return Xn(e,ji,_,t,q(t,ne(vf)))}),zg=Dn(function(e,t){return Xn(e,ni,_,_,_,t)}),Pg=co(jr),Dg=co(function(e,t){return e>=t}),Qr=Ql(function(){return arguments}())?Ql:function(e){return Be(e)&&we.call(e,"callee")&&!ef.call(e,"callee")},ie=be.isArray,Fg=Fl?Ze(Fl):Mh,Wn=Zd||Ls,yf=Ul?Ze(Ul):Wh,Gs=Ml?Ze(Ml):$h,qs=Fr?Ze(Fr):jh,_f=en?Ze(en):Qn,zi=Fa?Ze(Fa):kh,Hs=co(ja),Ug=co(function(e,t){return e<=t}),Mg=yi(function(e,t){if(Ai(t)||It(t))return zn(t,nt(t),e),_;for(var n in t)we.call(t,n)&&no(e,n,t[n])}),bf=yi(function(e,t){zn(t,Ft(t),e)}),lt=yi(function(e,t,n,r){zn(t,Ft(t),e,r)}),Ys=yi(function(e,t,n,r){zn(t,nt(t),e,r)}),Wg=Dn(Ma),Bg=se(function(e,t){e=Re(e);var n=-1,r=t.length,a=r>2?t[2]:_;for(a&&st(t[0],t[1],a)&&(r=1);++n<r;)for(var s=t[n],c=Ft(s),f=-1,g=c.length;++f<g;){var w=c[f],b=e[w];(b===_||un(b,Ii[w])&&!we.call(e,w))&&(e[w]=s[w])}return e}),$g=se(function(e){return e.push(_,ns),o(wf,_,e)}),jg=sc(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),e[t]=n},Wu(vt)),Qs=sc(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),we.call(e,t)?e[t].push(n):e[t]=[n]},Z),kg=se(ae),Js=yi(function(e,t,n){uu(e,t,n)}),wf=yi(function(e,t,n,r){uu(e,t,n,r)}),Vg=Dn(function(e,t){var n={};if(e==null)return n;var r=!1;t=O(t,function(s){return s=_n(s,e),r||(r=s.length>1),s}),zn(e,os(e),n),r&&(n=qt(n,Bt|No|dr,ep));for(var a=t.length;a--;)Dt(n,t[a]);return n}),Gg=Dn(function(e,t){return e==null?{}:qh(e,t)}),Af=fo(nt),Xs=fo(Ft),qg=Pn(function(e,t,n){return t=t.toLowerCase(),e+(n?$c(t):t)}),Hg=Pn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Yg=Pn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Zs=ac("toLowerCase"),Ks=Pn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Qg=Pn(function(e,t,n){return e+(n?" ":"")+el(t)}),Jg=Pn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),el=ac("toUpperCase"),Sf=se(function(e,t){try{return o(e,_,t)}catch(n){return Os(n)?n:new Ps(n)}}),Xg=Dn(function(e,t){return m(t,function(n){n=Fn(n),De(e,n,ks(e[n],e))}),e}),Zg=Ka(),Kg=Ka(!0),em=se(function(e,t){return function(n){return ae(n,e,t)}}),tm=se(function(e,t){return function(n){return ae(e,n,t)}}),nm=gu(O),rm=gu(E),im=gu($),om=mu(),um=mu(!0),am=du(function(e,t){return e+t},0),sm=vu("ceil"),lm=du(function(e,t){return e/t},1),cm=vu("floor"),fm=du(function(e,t){return e*t},1),hm=vu("round"),pm=du(function(e,t){return e-t},0);return l.after=As,l.ary=Ss,l.assign=Mg,l.assignIn=bf,l.assignInWith=lt,l.assignWith=Ys,l.at=Wg,l.before=Es,l.bind=ks,l.bindAll=Xg,l.bindKey=mf,l.castArray=zp,l.chain=Oc,l.chunk=Un,l.compact=up,l.concat=ap,l.cond=Mu,l.conforms=Fd,l.constant=Wu,l.countBy=Ag,l.create=Kp,l.curry=_o,l.curryRight=Ts,l.debounce=bn,l.defaults=Bg,l.defaultsDeep=$g,l.defer=Rg,l.delay=Ng,l.difference=lg,l.differenceBy=hf,l.differenceWith=pf,l.drop=Cu,l.dropRight=Si,l.dropRightWhile=gc,l.dropWhile=mc,l.fill=sp,l.filter=bp,l.flatMap=_s,l.flatMapDeep=wp,l.flatMapDepth=Ap,l.flatten=Ei,l.flattenDeep=lp,l.flattenDepth=vc,l.flip=Yr,l.flow=Zg,l.flowRight=Kg,l.fromPairs=yc,l.functions=id,l.functionsIn=od,l.groupBy=Tg,l.initial=Iu,l.intersection=cg,l.intersectionBy=fg,l.intersectionWith=hg,l.invert=jg,l.invertBy=Qs,l.invokeMap=Og,l.iteratee=Bu,l.keyBy=Cg,l.keys=nt,l.keysIn=Ft,l.map=zu,l.mapKeys=ad,l.mapValues=Bc,l.matches=Hc,l.matchesProperty=Yc,l.memoize=Pu,l.merge=Js,l.mergeWith=wf,l.method=em,l.methodOf=tm,l.mixin=$u,l.negate=bo,l.nthArg=Md,l.omit=Vg,l.omitBy=sd,l.once=Cp,l.orderBy=Sp,l.over=nm,l.overArgs=Lg,l.overEvery=rm,l.overSome=im,l.partial=Vs,l.partialRight=vf,l.partition=Ig,l.pick=Gg,l.pickBy=Ao,l.property=So,l.propertyOf=ju,l.pull=pg,l.pullAll=mo,l.pullAllBy=wc,l.pullAllWith=hs,l.pullAt=Li,l.range=om,l.rangeRight=um,l.rearg=zg,l.reject=xc,l.remove=fp,l.rest=Ip,l.reverse=xu,l.sampleSize=Op,l.set=cd,l.setWith=fd,l.shuffle=ws,l.slice=Zn,l.sortBy=xg,l.sortedUniq=Kn,l.sortedUniqBy=ps,l.split=Od,l.spread=xp,l.tail=ds,l.take=gs,l.takeRight=Ru,l.takeRightWhile=Ti,l.takeWhile=K,l.tap=gp,l.throttle=Rp,l.thru=vo,l.toArray=Fc,l.toPairs=Af,l.toPairsIn=Xs,l.toPath=$d,l.toPlainObject=Mc,l.transform=hd,l.unary=Np,l.union=dg,l.unionBy=gg,l.unionWith=mg,l.uniq=Nu,l.uniqBy=ms,l.uniqWith=Hr,l.unset=pd,l.unzip=vs,l.unzipWith=Lu,l.update=dd,l.updateWith=gd,l.values=Ci,l.valuesIn=md,l.without=vg,l.words=Gc,l.wrap=Lp,l.xor=yg,l.xorBy=df,l.xorWith=gf,l.zip=_g,l.zipObject=Tc,l.zipObjectDeep=mt,l.zipWith=bg,l.entries=Af,l.entriesIn=Xs,l.extend=bf,l.extendWith=lt,$u(l,l),l.add=am,l.attempt=Sf,l.camelCase=qg,l.capitalize=$c,l.ceil=sm,l.clamp=vd,l.clone=Pp,l.cloneDeep=Fp,l.cloneDeepWith=Up,l.cloneWith=Dp,l.conformsTo=Lc,l.deburr=jc,l.defaultTo=qc,l.divide=lm,l.endsWith=bd,l.eq=un,l.escape=wd,l.escapeRegExp=kc,l.every=ys,l.find=Sg,l.findIndex=cs,l.findKey=ed,l.findLast=Eg,l.findLastIndex=qr,l.findLastKey=td,l.floor=cm,l.forEach=Oi,l.forEachRight=bs,l.forIn=nd,l.forInRight=rd,l.forOwn=Cs,l.forOwnRight=Wc,l.get=Is,l.gt=Pg,l.gte=Dg,l.has=ud,l.hasIn=xs,l.head=go,l.identity=vt,l.includes=Ic,l.indexOf=_c,l.inRange=yd,l.invoke=kg,l.isArguments=Qr,l.isArray=ie,l.isArrayBuffer=Fg,l.isArrayLike=It,l.isArrayLikeObject=je,l.isBoolean=Mp,l.isBuffer=Wn,l.isDate=yf,l.isElement=Wp,l.isEmpty=zc,l.isEqual=Bp,l.isEqualWith=$p,l.isError=Os,l.isFinite=jp,l.isFunction=tr,l.isInteger=Pc,l.isLength=xt,l.isMap=Gs,l.isMatch=kp,l.isMatchWith=Dc,l.isNaN=Vp,l.isNative=Gp,l.isNil=Hp,l.isNull=qp,l.isNumber=Du,l.isObject=Fe,l.isObjectLike=Be,l.isPlainObject=wo,l.isRegExp=qs,l.isSafeInteger=Yp,l.isSet=_f,l.isString=Fu,l.isSymbol=Yt,l.isTypedArray=zi,l.isUndefined=Qp,l.isWeakMap=Jp,l.isWeakSet=Xp,l.join=fs,l.kebabCase=Hg,l.last=Ot,l.lastIndexOf=cp,l.lowerCase=Yg,l.lowerFirst=Zs,l.lt=Hs,l.lte=Ug,l.max=kd,l.maxBy=Vd,l.mean=Gd,l.meanBy=qd,l.min=Hd,l.minBy=Yd,l.stubArray=Ns,l.stubFalse=Ls,l.stubObject=zs,l.stubString=Qc,l.stubTrue=Wd,l.multiply=fm,l.nth=bc,l.noConflict=Ud,l.noop=Rs,l.now=na,l.pad=Vc,l.padEnd=Ad,l.padStart=Sd,l.parseInt=Ed,l.random=_d,l.reduce=Ep,l.reduceRight=Tp,l.repeat=Td,l.replace=Uu,l.result=ld,l.round=hm,l.runInContext=p,l.sample=Rc,l.size=Nc,l.snakeCase=Ks,l.some=yo,l.sortedIndex=Ac,l.sortedIndexBy=Sc,l.sortedIndexOf=hp,l.sortedLastIndex=Ec,l.sortedLastIndexBy=pp,l.sortedLastIndexOf=dp,l.startCase=Qg,l.startsWith=Cd,l.subtract=pm,l.sum=Qd,l.sumBy=Jd,l.template=Id,l.times=Bd,l.toFinite=nr,l.toInteger=ue,l.toLength=Uc,l.toLower=xd,l.toNumber=an,l.toSafeInteger=Zp,l.toString=ge,l.toUpper=Rd,l.trim=Nd,l.trimEnd=Ld,l.trimStart=zd,l.truncate=Pd,l.unescape=Dd,l.uniqueId=jd,l.upperCase=Jg,l.upperFirst=el,l.each=Oi,l.eachRight=bs,l.first=go,$u(l,function(){var e={};return xn(l,function(t,n){we.call(l.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),l.VERSION=Bi,m(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){l[e].placeholder=l}),m(["drop","take"],function(e,t){D.prototype[e]=function(n){n=n===_?1:Te(ue(n),0);var r=this.__filtered__&&!t?new D(this):this.clone();return r.__filtered__?r.__takeCount__=H(n,r.__takeCount__):r.__views__.push({size:H(n,On),type:e+(r.__dir__<0?"Right":"")}),r},D.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),m(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==ca||n==Qf;D.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:Z(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),m(["head","last"],function(e,t){var n="take"+(t?"Right":"");D.prototype[e]=function(){return this[n](1).value()[0]}}),m(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");D.prototype[e]=function(){return this.__filtered__?new D(this):this[n](1)}}),D.prototype.compact=function(){return this.filter(vt)},D.prototype.find=function(e){return this.filter(e).head()},D.prototype.findLast=function(e){return this.reverse().find(e)},D.prototype.invokeMap=se(function(e,t){return typeof e=="function"?new D(this):this.map(function(n){return ae(n,e,t)})}),D.prototype.reject=function(e){return this.filter(bo(Z(e)))},D.prototype.slice=function(e,t){e=ue(e);var n=this;return n.__filtered__&&(e>0||t<0)?new D(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==_&&(t=ue(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},D.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},D.prototype.toArray=function(){return this.take(On)},xn(D.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=l[r?"take"+(t=="last"?"Right":""):t],s=r||/^find/.test(t);a&&(l.prototype[t]=function(){var c=this.__wrapped__,f=r?[1]:arguments,g=c instanceof D,w=f[0],b=g||ie(c),S=function(B){var j=a.apply(l,F([B],f));return r&&T?j[0]:j};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var T=this.__chain__,R=!!this.__actions__.length,L=s&&!T,M=g&&!R;if(!s&&b){c=M?c:new D(this);var z=e.apply(c,f);return z.__actions__.push({func:vo,args:[S],thisArg:_}),new P(z,T)}return L&&M?e.apply(this,f):(z=this.thru(S),L?r?z.value()[0]:z.value():z)})}),m(["pop","push","shift","sort","splice","unshift"],function(e){var t=wn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);l.prototype[e]=function(){var a=arguments;if(r&&!this.__chain__){var s=this.value();return t.apply(ie(s)?s:[],a)}return this[n](function(c){return t.apply(ie(c)?c:[],a)})}}),xn(D.prototype,function(e,t){var n=l[t];if(n){var r=n.name+"";we.call(xi,r)||(xi[r]=[]),xi[r].push({name:t,func:n})}}),xi[pu(_,mr).name]=[{name:"wrapper",func:_}],D.prototype.clone=fe,D.prototype.reverse=ye,D.prototype.value=Ua,l.prototype.at=wg,l.prototype.chain=mp,l.prototype.commit=Cc,l.prototype.next=vp,l.prototype.plant=_p,l.prototype.reverse=er,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=Ct,l.prototype.first=l.prototype.head,ir&&(l.prototype[ir]=yp),l},mn=Rh();Hn?((Hn.exports=mn)._=mn,Pa._=mn):at._=mn}).call(xr)})(Rf,Rf.exports);var I_=Rf.exports,vv={};(function(i){i.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},i.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},i.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},i.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},i.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},i.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},i.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},i.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},i.realToAlias=function(){var u=Object.prototype.hasOwnProperty,o=i.aliasToReal,h={};for(var m in o){var A=o[m];u.call(h,A)?h[A].push(m):h[A]=[m]}return h}(),i.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},i.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},i.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}})(vv);var x_={},ct=vv,R_=x_,Vm=Array.prototype.push;function N_(i,u){return u==2?function(o,h){return i.apply(void 0,arguments)}:function(o){return i.apply(void 0,arguments)}}function dm(i,u){return u==2?function(o,h){return i(o,h)}:function(o){return i(o)}}function Gm(i){for(var u=i?i.length:0,o=Array(u);u--;)o[u]=i[u];return o}function L_(i){return function(u){return i({},u)}}function z_(i,u){return function(){for(var o=arguments.length,h=o-1,m=Array(o);o--;)m[o]=arguments[o];var A=m[u],E=m.slice(0,u);return A&&Vm.apply(E,A),u!=h&&Vm.apply(E,m.slice(u+1)),i.apply(this,E)}}function gm(i,u){return function(){var o=arguments.length;if(o){for(var h=Array(o);o--;)h[o]=arguments[o];var m=h[0]=u.apply(void 0,h);return i.apply(void 0,h),m}}}function Sm(i,u,o,h){var m=typeof u=="function",A=u===Object(u);if(A&&(h=o,o=u,u=void 0),o==null)throw new TypeError;h||(h={});var E={cap:"cap"in h?h.cap:!0,curry:"curry"in h?h.curry:!0,fixed:"fixed"in h?h.fixed:!0,immutable:"immutable"in h?h.immutable:!0,rearg:"rearg"in h?h.rearg:!0},C=m?o:R_,x="curry"in h&&h.curry,N="fixed"in h&&h.fixed,O="rearg"in h&&h.rearg,F=m?o.runInContext():void 0,U=m?o:{ary:i.ary,assign:i.assign,clone:i.clone,curry:i.curry,forEach:i.forEach,isArray:i.isArray,isError:i.isError,isFunction:i.isFunction,isWeakMap:i.isWeakMap,iteratee:i.iteratee,keys:i.keys,rearg:i.rearg,toInteger:i.toInteger,toPath:i.toPath},Q=U.ary,$=U.assign,J=U.clone,te=U.curry,X=U.forEach,me=U.isArray,ve=U.isError,ze=U.isFunction,Ve=U.isWeakMap,Ye=U.keys,Me=U.rearg,hn=U.toInteger,jn=U.toPath,Qe=Ye(ct.aryMethod),Sn={castArray:function(G){return function(){var W=arguments[0];return me(W)?G(Gm(W)):G.apply(void 0,arguments)}},iteratee:function(G){return function(){var W=arguments[0],k=arguments[1],q=G(W,k),re=q.length;return E.cap&&typeof k=="number"?(k=k>2?k-2:1,re&&re<=k?q:dm(q,k)):q}},mixin:function(G){return function(W){var k=this;if(!ze(k))return G(k,Object(W));var q=[];return X(Ye(W),function(re){ze(W[re])&&q.push([re,k.prototype[re]])}),G(k,Object(W)),X(q,function(re){var ot=re[1];ze(ot)?k.prototype[re[0]]=ot:delete k.prototype[re[0]]}),k}},nthArg:function(G){return function(W){var k=W<0?1:hn(W)+1;return te(G(W),k)}},rearg:function(G){return function(W,k){var q=k?k.length:0;return te(G(W,k),q)}},runInContext:function(G){return function(W){return Sm(i,G(W),h)}}};function En(G,W){if(E.cap){var k=ct.iterateeRearg[G];if(k)return ei(W,k);var q=!m&&ct.iterateeAry[G];if(q)return xo(W,q)}return W}function Kr(G,W,k){return x||E.curry&&k>1?te(W,k):W}function fr(G,W,k){if(E.fixed&&(N||!ct.skipFixed[G])){var q=ct.methodSpread[G],re=q&&q.start;return re===void 0?Q(W,k):z_(W,re)}return W}function Ze(G,W,k){return E.rearg&&k>1&&(O||!ct.skipRearg[G])?Me(W,ct.methodRearg[G]||ct.aryRearg[k]):W}function Wi(G,W){W=jn(W);for(var k=-1,q=W.length,re=q-1,ot=J(Object(G)),wt=ot;wt!=null&&++k<q;){var ut=W[k],Ke=wt[ut];Ke!=null&&!(ze(Ke)||ve(Ke)||Ve(Ke))&&(wt[ut]=J(k==re?Ke:Object(Ke))),wt=wt[ut]}return ot}function Ut(G){return Ge.runInContext.convert(G)(void 0)}function Kt(G,W){var k=ct.aliasToReal[G]||G,q=ct.remap[k]||k,re=h;return function(ot){var wt=m?F:U,ut=m?F[q]:W,Ke=$($({},re),ot);return Sm(wt,k,ut,Ke)}}function xo(G,W){return Mt(G,function(k){return typeof k=="function"?dm(k,W):k})}function ei(G,W){return Mt(G,function(k){var q=W.length;return N_(Me(dm(k,q),W),q)})}function Mt(G,W){return function(){var k=arguments.length;if(!k)return G();for(var q=Array(k);k--;)q[k]=arguments[k];var re=E.rearg?0:k-1;return q[re]=W(q[re]),G.apply(void 0,q)}}function Ro(G,W,k){var q,re=ct.aliasToReal[G]||G,ot=W,wt=Sn[re];return wt?ot=wt(W):E.immutable&&(ct.mutate.array[re]?ot=gm(W,Gm):ct.mutate.object[re]?ot=gm(W,L_(W)):ct.mutate.set[re]&&(ot=gm(W,Wi))),X(Qe,function(ut){return X(ct.aryMethod[ut],function(Ke){if(re==Ke){var Pe=ct.methodSpread[re],hr=Pe&&Pe.afterRearg;return q=hr?fr(re,Ze(re,ot,ut),ut):Ze(re,fr(re,ot,ut),ut),q=En(re,q),q=Kr(re,q,ut),!1}}),!q}),q||(q=ot),q==W&&(q=x?te(q,1):function(){return W.apply(this,arguments)}),q.convert=Kt(re,W),q.placeholder=W.placeholder=k,q}if(!A)return Ro(u,o,C);var Ge=o,Nr=[];return X(Qe,function(G){X(ct.aryMethod[G],function(W){var k=Ge[ct.remap[W]||W];k&&Nr.push([W,Ro(W,k,Ge)])})}),X(Ye(Ge),function(G){var W=Ge[G];if(typeof W=="function"){for(var k=Nr.length;k--;)if(Nr[k][0]==G)return;W.convert=Kt(G,W),Nr.push([G,W])}}),X(Nr,function(G){Ge[G[0]]=G[1]}),Ge.convert=Ut,Ge.placeholder=Ge,X(Ye(Ge),function(G){X(ct.realToAlias[G]||[],function(W){Ge[W]=Ge[G]})}),Ge}var P_=Sm,qm=I_.runInContext(),rl=P_(qm,qm),Ie;(function(i){i.Arg="Arg",i.DynamicInput="DynamicInput",i.DynamicOutputMethod="DynamicOutputMethod",i.DynamicOutputProperty="DynamicOutputProperty",i.Enum="Enum",i.ExtendInputObject="ExtendInputObject",i.ExtendObject="ExtendObject",i.InputField="InputField",i.InputObject="InputObject",i.Interface="Interface",i.List="List",i.NonNull="NonNull",i.Null="Null",i.Object="Object",i.OutputField="OutputField",i.Plugin="Plugin",i.PrintedGenTyping="PrintedGenTyping",i.PrintedGenTypingImport="PrintedGenTypingImport",i.Scalar="Scalar",i.Union="Union"})(Ie||(Ie={}));const Mf=Symbol.for("@nexus/wrapped");function bt(i,u){i.prototype[Mf]=u}class D_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(D_,Ie.Interface);class F_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(F_,Ie.Object);class U_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(U_,Ie.Union);function M_(i,u){var o;return i.extensions=Object.assign(Object.assign({},i.extensions),{nexus:Object.assign(Object.assign({},Object((o=i.extensions)===null||o===void 0?void 0:o.nexus)),u)}),i}const Nf=Symbol.for("@nexus/meta/NEXUS_TYPE"),W_=Symbol.for("@nexus/meta/NEXUS_BUILD");function B_(i){return!!(i&&typeof sl.get(i,W_)=="function")}function $_(i){return j_(i)||yv(i)}function j_(i){return!!(i&&sl.has(i,Nf)&&la(sl.get(i,Nf)))}function yv(i){return!!(i&&sl.has(i,Nf)&&typeof sl.get(i,Nf)=="function")}function xm(i){return B_(i)||$_(i)||yv(i)}class k_{constructor(u){this.config=u}}bt(k_,Ie.PrintedGenTypingImport);class V_{constructor(u){this.config=u}get imports(){return this.config.imports||[]}toString(){let u="";this.config.description&&(u=`/**
116
+ }`;var M=Sf(function(){return Or(f,R+"return "+S).apply(_,g)});if(M.source=S,Os(M))throw M;return M}function xd(e){return ge(e).toLowerCase()}function Rd(e){return ge(e).toUpperCase()}function Nd(e,t,n){if(e=ge(e),e&&(n||t===_))return fr(e);if(!e||!(t=Et(t)))return e;var r=Pe(e),a=Pe(t);return wr(r,Kt(r,a),xo(r,a)+1).join("")}function Ld(e,t,n){if(e=ge(e),e&&(n||t===_))return e.slice(0,hr(e)+1);if(!e||!(t=Et(t)))return e;var r=Pe(e);return wr(r,0,xo(r,Pe(t))+1).join("")}function zd(e,t,n){if(e=ge(e),e&&(n||t===_))return e.replace(ya,"");if(!e||!(t=Et(t)))return e;var r=Pe(e);return wr(r,Kt(r,Pe(t))).join("")}function Pd(e,t){var n=Vf,r=Gf;if(Fe(t)){var a="separator"in t?t.separator:a;n="length"in t?ue(t.length):n,r="omission"in t?Et(t.omission):r}e=ge(e);var s=e.length;if(Ge(e)){var c=Pe(e);s=c.length}if(n>=s)return e;var f=n-Ke(r);if(f<1)return r;var g=c?wr(c,0,f).join(""):e.slice(0,f);if(a===_)return g+r;if(c&&(f+=g.length-f),qs(a)){if(e.slice(f).search(a)){var w,b=g;for(a.global||(a=yt(a.source,ge(wl.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var S=w.index;g=g.slice(0,S===_?f:S)}}else if(e.indexOf(Et(a),f)!=f){var T=g.lastIndexOf(a);T>-1&&(g=g.slice(0,T))}return g+r}function Dd(e){return e=ge(e),e&&ga.test(e)?e.replace(gl,xh):e}function Gc(e,t,n){return e=ge(e),t=n?_:t,t===_?Nr(e)?cl(e):te(e):e.match(t)||[]}function Mu(e){var t=e==null?0:e.length,n=Z();return e=t?O(e,function(r){if(typeof r[1]!="function")throw new sn(At);return[n(r[0]),r[1]]}):[],se(function(r){for(var a=-1;++a<t;){var s=e[a];if(o(s[0],this,r))return o(s[1],this,r)}})}function Fd(e){return Uh(qt(e,Bt))}function Wu(e){return function(){return e}}function qc(e,t){return e==null||e!==e?t:e}function vt(e){return e}function Bu(e){return Xl(typeof e=="function"?e:qt(e,Bt))}function Hc(e){return Zl(qt(e,Bt))}function Yc(e,t){return Kl(e,qt(t,Bt))}function $u(e,t,n){var r=nt(t),a=ou(t,r);n!=null||Fe(t)&&(a.length||!r.length)||(n=t,t=e,e=this,a=ou(t,nt(t)));var s=!(Fe(n)&&"chain"in n&&!n.chain),c=tr(e);return m(a,function(f){var g=t[f];e[f]=g,c&&(e.prototype[f]=function(){var w=this.__chain__;if(s||w){var b=e(this.__wrapped__);return(b.__actions__=dt(this.__actions__)).push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,F([this.value()],arguments))})}),e}function Ud(){return at._===this&&(at._=qu),this}function Rs(){}function Md(e){return e=ue(e),se(function(t){return ec(t,e)})}function So(e){return wu(e)?Me(Fn(e)):yn(e)}function ju(e){return function(t){return e==null?_:$r(e,t)}}function Ns(){return[]}function Ls(){return!1}function zs(){return{}}function Qc(){return""}function Wd(){return!0}function Bd(e,t){if(e=ue(e),e<1||e>Tn)return[];var n=On,r=H(e,On);t=Z(t),e-=On;for(var a=En(r,t);++n<e;)t(n);return a}function $d(e){return ie(e)?O(e,Fn):Yt(e)?[e]:dt(ff(ge(e)))}function jd(e){var t=++Ds;return ge(e)+t}function kd(e){return e&&e.length?_r(e,vt,jr):_}function Vd(e,t){return e&&e.length?_r(e,Z(t,2),jr):_}function Gd(e){return Ye(e,vt)}function qd(e,t){return Ye(e,Z(t,2))}function Hd(e){return e&&e.length?_r(e,vt,ja):_}function Yd(e,t){return e&&e.length?_r(e,Z(t,2),ja):_}function Qd(e){return e&&e.length?Sn(e,vt):0}function Jd(e,t){return e&&e.length?Sn(e,Z(t,2)):0}y=y==null?at:mn.defaults(at.Object(),y,mn.pick(at,Ll));var be=y.Array,ku=y.Date,Ps=y.Error,Or=y.Function,ee=y.Math,Re=y.Object,yt=y.RegExp,ke=y.String,sn=y.TypeError,wn=be.prototype,Xd=Or.prototype,Ii=Re.prototype,Vu=y["__core-js_shared__"],Gu=Xd.toString,we=Ii.hasOwnProperty,Ds=0,Jc=function(){var e=/[^.]+$/.exec(Vu&&Vu.keys&&Vu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ln=Ii.toString,Xc=Gu.call(Re),qu=at._,Ue=yt("^"+Gu.call(we).replace(ko,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ne=Da?y.Buffer:_,rr=y.Symbol,Hu=y.Uint8Array,Zc=Ne?Ne.allocUnsafe:_,Yu=k(Re.getPrototypeOf,Re),Kc=Re.create,ef=Ii.propertyIsEnumerable,Qu=wn.splice,Fs=rr?rr.isConcatSpreadable:_,ir=rr?rr.iterator:_,or=rr?rr.toStringTag:_,Ju=function(){try{var e=Ar(Re,"defineProperty");return e({},"",{}),e}catch{}}(),tf=y.clearTimeout!==at.clearTimeout&&y.clearTimeout,Xu=ku&&ku.now!==at.Date.now&&ku.now,Qt=y.setTimeout!==at.setTimeout&&y.setTimeout,ur=ee.ceil,Zu=ee.floor,Us=Re.getOwnPropertySymbols,Zd=Ne?Ne.isBuffer:_,nf=y.isFinite,Kd=wn.join,rf=k(Re.keys,Re),Te=ee.max,H=ee.min,of=ku.now,cn=y.parseInt,Ms=ee.random,eg=wn.reverse,he=Ar(y,"DataView"),Eo=Ar(y,"Map"),Ku=Ar(y,"Promise"),ar=Ar(y,"Set"),To=Ar(y,"WeakMap"),Oo=Ar(Re,"create"),ea=To&&new To,xi={},tg=Tr(he),ng=Tr(Eo),rg=Tr(Ku),ig=Tr(ar),og=Tr(To),ta=rr?rr.prototype:_,Co=ta?ta.valueOf:_,uf=ta?ta.toString:_,Ri=function(){function e(){}return function(t){if(!Fe(t))return{};if(Kc)return Kc(t);e.prototype=t;var n=new e;return e.prototype=_,n}}();l.templateSettings={escape:li,evaluate:ml,interpolate:va,variable:"",imports:{_:l}},l.prototype=I.prototype,l.prototype.constructor=l,P.prototype=Ri(I.prototype),P.prototype.constructor=P,D.prototype=Ri(I.prototype),D.prototype.constructor=D,Ur.prototype.clear=tn,Ur.prototype.delete=Jo,Ur.prototype.get=Nh,Ur.prototype.has=hi,Ur.prototype.set=Xo,nn.prototype.clear=_e,nn.prototype.delete=Lh,nn.prototype.get=Wl,nn.prototype.has=Zo,nn.prototype.set=zh,Yn.prototype.clear=Ph,Yn.prototype.delete=Ko,Yn.prototype.get=yr,Yn.prototype.has=eu,Yn.prototype.set=Bl,In.prototype.add=In.prototype.push=$l,In.prototype.has=jl,zt.prototype.clear=kl,zt.prototype.delete=eo,zt.prototype.get=Mr,zt.prototype.has=tu,zt.prototype.set=Dh;var Mn=_i(xn),af=_i(Wa,!0),Io=Za(),sf=Za(!0),lf=ea?function(e,t){return ea.set(e,t),e}:vt,ug=Ju?function(e,t){return Ju(e,"toString",{configurable:!0,enumerable:!1,value:Wu(t),writable:!0})}:vt,rt=se,Rt=tf||function(e){return at.clearTimeout(e)},ag=ar&&1/re(new ar([,-0]))[1]==Pr?function(e){return new ar(e)}:Rs,Ws=ea?function(e){return ea.get(e)}:Rs,Bs=Us?function(e){return e==null?[]:(e=Re(e),C(Us(e),function(t){return ef.call(e,t)}))}:Ns,$s=Us?function(e){for(var t=[];e;)F(t,Bs(e)),e=Yu(e);return t}:Ns,_t=tt;(he&&_t(new he(new ArrayBuffer(1)))!=ai||Eo&&_t(new Eo)!=dn||Ku&&_t(Ku.resolve())!=Gi||ar&&_t(new ar)!=gn||To&&_t(new To)!=Yi)&&(_t=function(e){var t=tt(e),n=t==qn?e.constructor:_,r=n?Tr(n):"";if(r)switch(r){case tg:return ai;case ng:return dn;case rg:return Gi;case ig:return gn;case og:return Yi}return t});var sg=Vu?tr:Ls,cf=ls(lf),Ni=Qt||function(e,t){return at.setTimeout(e,t)},js=ls(ug),ff=Sr(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(yl,function(n,r,a,s){t.push(a?s.replace(ch,"$1"):r||n)}),t}),lg=se(function(e,t){return je(e)?Br(e,We(t,1,je,!0)):[]}),hf=se(function(e,t){var n=Ot(t);return je(n)&&(n=_),je(e)?Br(e,We(t,1,je,!0),Z(n,2)):[]}),pf=se(function(e,t){var n=Ot(t);return je(n)&&(n=_),je(e)?Br(e,We(t,1,je,!0),_,n):[]}),cg=se(function(e){var t=O(e,cu);return t.length&&t[0]===e[0]?mi(t):[]}),fg=se(function(e){var t=Ot(e),n=O(e,cu);return t===Ot(n)?t=_:n.pop(),n.length&&n[0]===e[0]?mi(n,Z(t,2)):[]}),hg=se(function(e){var t=Ot(e),n=O(e,cu);return t=typeof t=="function"?t:_,t&&n.pop(),n.length&&n[0]===e[0]?mi(n,_,t):[]}),pg=se(mo),Li=Dn(function(e,t){var n=e==null?0:e.length,r=Ma(e,t);return nc(e,O(t,function(a){return gt(a,n)?+a:a}).sort(so)),r}),dg=se(function(e){return Pt(We(e,1,je,!0))}),gg=se(function(e){var t=Ot(e);return je(t)&&(t=_),Pt(We(e,1,je,!0),Z(t,2))}),mg=se(function(e){var t=Ot(e);return t=typeof t=="function"?t:_,Pt(We(e,1,je,!0),_,t)}),vg=se(function(e,t){return je(e)?Br(e,t):[]}),yg=se(function(e){return kr(C(e,je))}),df=se(function(e){var t=Ot(e);return je(t)&&(t=_),kr(C(e,je),Z(t,2))}),gf=se(function(e){var t=Ot(e);return t=typeof t=="function"?t:_,kr(C(e,je),_,t)}),_g=se(vs),bg=se(function(e){var t=e.length,n=t>1?e[t-1]:_;return n=typeof n=="function"?(e.pop(),n):_,Lu(e,n)}),wg=Dn(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,a=function(s){return Ma(s,e)};return!(t>1||this.__actions__.length)&&r instanceof D&&gt(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:vo,args:[a],thisArg:_}),new P(r,this.__chain__).thru(function(s){return t&&!s.length&&s.push(_),s})):this.thru(a)}),Ag=vi(function(e,t,n){we.call(e,n)?++e[n]:De(e,n,1)}),Sg=hu(cs),Eg=hu(qr),Tg=vi(function(e,t,n){we.call(e,n)?e[n].push(t):De(e,n,[t])}),Og=se(function(e,t,n){var r=-1,a=typeof t=="function",s=It(e)?be(e.length):[];return Mn(e,function(c){s[++r]=a?o(t,c,n):ae(c,t,n)}),s}),Cg=vi(function(e,t,n){De(e,n,t)}),Ig=vi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),xg=se(function(e,t){if(e==null)return[];var n=t.length;return n>1&&st(e,t[0],t[1])?t=[]:n>2&&st(t[0],t[1],t[2])&&(t=[t[0]]),br(e,We(t,1),[])}),na=Xu||function(){return at.Date.now()},ks=se(function(e,t,n){var r=$t;if(n.length){var a=q(n,ne(ks));r|=Vn}return Xn(e,r,t,n,a)}),mf=se(function(e,t,n){var r=$t|mr;if(n.length){var a=q(n,ne(mf));r|=Vn}return Xn(t,r,e,n,a)}),Rg=se(function(e,t){return pi(e,1,t)}),Ng=se(function(e,t,n){return pi(e,an(t)||0,n)});Pu.Cache=Yn;var Lg=rt(function(e,t){t=t.length==1&&ie(t[0])?O(t[0],Ze(Z())):O(We(t,1),Ze(Z()));var n=t.length;return se(function(r){for(var a=-1,s=H(r.length,n);++a<s;)r[a]=t[a].call(this,r[a]);return o(e,this,r)})}),Vs=se(function(e,t){return Xn(e,Vn,_,t,q(t,ne(Vs)))}),vf=se(function(e,t){return Xn(e,ji,_,t,q(t,ne(vf)))}),zg=Dn(function(e,t){return Xn(e,ni,_,_,_,t)}),Pg=co(jr),Dg=co(function(e,t){return e>=t}),Qr=Ql(function(){return arguments}())?Ql:function(e){return Be(e)&&we.call(e,"callee")&&!ef.call(e,"callee")},ie=be.isArray,Fg=Fl?Ze(Fl):Mh,Wn=Zd||Ls,yf=Ul?Ze(Ul):Wh,Gs=Ml?Ze(Ml):$h,qs=Fr?Ze(Fr):jh,_f=en?Ze(en):Qn,zi=Fa?Ze(Fa):kh,Hs=co(ja),Ug=co(function(e,t){return e<=t}),Mg=yi(function(e,t){if(Ai(t)||It(t))return zn(t,nt(t),e),_;for(var n in t)we.call(t,n)&&no(e,n,t[n])}),bf=yi(function(e,t){zn(t,Ft(t),e)}),lt=yi(function(e,t,n,r){zn(t,Ft(t),e,r)}),Ys=yi(function(e,t,n,r){zn(t,nt(t),e,r)}),Wg=Dn(Ma),Bg=se(function(e,t){e=Re(e);var n=-1,r=t.length,a=r>2?t[2]:_;for(a&&st(t[0],t[1],a)&&(r=1);++n<r;)for(var s=t[n],c=Ft(s),f=-1,g=c.length;++f<g;){var w=c[f],b=e[w];(b===_||un(b,Ii[w])&&!we.call(e,w))&&(e[w]=s[w])}return e}),$g=se(function(e){return e.push(_,ns),o(wf,_,e)}),jg=sc(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),e[t]=n},Wu(vt)),Qs=sc(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),we.call(e,t)?e[t].push(n):e[t]=[n]},Z),kg=se(ae),Js=yi(function(e,t,n){uu(e,t,n)}),wf=yi(function(e,t,n,r){uu(e,t,n,r)}),Vg=Dn(function(e,t){var n={};if(e==null)return n;var r=!1;t=O(t,function(s){return s=_n(s,e),r||(r=s.length>1),s}),zn(e,os(e),n),r&&(n=qt(n,Bt|No|dr,ep));for(var a=t.length;a--;)Dt(n,t[a]);return n}),Gg=Dn(function(e,t){return e==null?{}:qh(e,t)}),Af=fo(nt),Xs=fo(Ft),qg=Pn(function(e,t,n){return t=t.toLowerCase(),e+(n?$c(t):t)}),Hg=Pn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Yg=Pn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Zs=ac("toLowerCase"),Ks=Pn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Qg=Pn(function(e,t,n){return e+(n?" ":"")+el(t)}),Jg=Pn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),el=ac("toUpperCase"),Sf=se(function(e,t){try{return o(e,_,t)}catch(n){return Os(n)?n:new Ps(n)}}),Xg=Dn(function(e,t){return m(t,function(n){n=Fn(n),De(e,n,ks(e[n],e))}),e}),Zg=Ka(),Kg=Ka(!0),em=se(function(e,t){return function(n){return ae(n,e,t)}}),tm=se(function(e,t){return function(n){return ae(e,n,t)}}),nm=gu(O),rm=gu(E),im=gu($),om=mu(),um=mu(!0),am=du(function(e,t){return e+t},0),sm=vu("ceil"),lm=du(function(e,t){return e/t},1),cm=vu("floor"),fm=du(function(e,t){return e*t},1),hm=vu("round"),pm=du(function(e,t){return e-t},0);return l.after=As,l.ary=Ss,l.assign=Mg,l.assignIn=bf,l.assignInWith=lt,l.assignWith=Ys,l.at=Wg,l.before=Es,l.bind=ks,l.bindAll=Xg,l.bindKey=mf,l.castArray=zp,l.chain=Oc,l.chunk=Un,l.compact=up,l.concat=ap,l.cond=Mu,l.conforms=Fd,l.constant=Wu,l.countBy=Ag,l.create=Kp,l.curry=_o,l.curryRight=Ts,l.debounce=bn,l.defaults=Bg,l.defaultsDeep=$g,l.defer=Rg,l.delay=Ng,l.difference=lg,l.differenceBy=hf,l.differenceWith=pf,l.drop=Cu,l.dropRight=Si,l.dropRightWhile=gc,l.dropWhile=mc,l.fill=sp,l.filter=bp,l.flatMap=_s,l.flatMapDeep=wp,l.flatMapDepth=Ap,l.flatten=Ei,l.flattenDeep=lp,l.flattenDepth=vc,l.flip=Yr,l.flow=Zg,l.flowRight=Kg,l.fromPairs=yc,l.functions=id,l.functionsIn=od,l.groupBy=Tg,l.initial=Iu,l.intersection=cg,l.intersectionBy=fg,l.intersectionWith=hg,l.invert=jg,l.invertBy=Qs,l.invokeMap=Og,l.iteratee=Bu,l.keyBy=Cg,l.keys=nt,l.keysIn=Ft,l.map=zu,l.mapKeys=ad,l.mapValues=Bc,l.matches=Hc,l.matchesProperty=Yc,l.memoize=Pu,l.merge=Js,l.mergeWith=wf,l.method=em,l.methodOf=tm,l.mixin=$u,l.negate=bo,l.nthArg=Md,l.omit=Vg,l.omitBy=sd,l.once=Cp,l.orderBy=Sp,l.over=nm,l.overArgs=Lg,l.overEvery=rm,l.overSome=im,l.partial=Vs,l.partialRight=vf,l.partition=Ig,l.pick=Gg,l.pickBy=Ao,l.property=So,l.propertyOf=ju,l.pull=pg,l.pullAll=mo,l.pullAllBy=wc,l.pullAllWith=hs,l.pullAt=Li,l.range=om,l.rangeRight=um,l.rearg=zg,l.reject=xc,l.remove=fp,l.rest=Ip,l.reverse=xu,l.sampleSize=Op,l.set=cd,l.setWith=fd,l.shuffle=ws,l.slice=Zn,l.sortBy=xg,l.sortedUniq=Kn,l.sortedUniqBy=ps,l.split=Od,l.spread=xp,l.tail=ds,l.take=gs,l.takeRight=Ru,l.takeRightWhile=Ti,l.takeWhile=K,l.tap=gp,l.throttle=Rp,l.thru=vo,l.toArray=Fc,l.toPairs=Af,l.toPairsIn=Xs,l.toPath=$d,l.toPlainObject=Mc,l.transform=hd,l.unary=Np,l.union=dg,l.unionBy=gg,l.unionWith=mg,l.uniq=Nu,l.uniqBy=ms,l.uniqWith=Hr,l.unset=pd,l.unzip=vs,l.unzipWith=Lu,l.update=dd,l.updateWith=gd,l.values=Ci,l.valuesIn=md,l.without=vg,l.words=Gc,l.wrap=Lp,l.xor=yg,l.xorBy=df,l.xorWith=gf,l.zip=_g,l.zipObject=Tc,l.zipObjectDeep=mt,l.zipWith=bg,l.entries=Af,l.entriesIn=Xs,l.extend=bf,l.extendWith=lt,$u(l,l),l.add=am,l.attempt=Sf,l.camelCase=qg,l.capitalize=$c,l.ceil=sm,l.clamp=vd,l.clone=Pp,l.cloneDeep=Fp,l.cloneDeepWith=Up,l.cloneWith=Dp,l.conformsTo=Lc,l.deburr=jc,l.defaultTo=qc,l.divide=lm,l.endsWith=bd,l.eq=un,l.escape=wd,l.escapeRegExp=kc,l.every=ys,l.find=Sg,l.findIndex=cs,l.findKey=ed,l.findLast=Eg,l.findLastIndex=qr,l.findLastKey=td,l.floor=cm,l.forEach=Oi,l.forEachRight=bs,l.forIn=nd,l.forInRight=rd,l.forOwn=Cs,l.forOwnRight=Wc,l.get=Is,l.gt=Pg,l.gte=Dg,l.has=ud,l.hasIn=xs,l.head=go,l.identity=vt,l.includes=Ic,l.indexOf=_c,l.inRange=yd,l.invoke=kg,l.isArguments=Qr,l.isArray=ie,l.isArrayBuffer=Fg,l.isArrayLike=It,l.isArrayLikeObject=je,l.isBoolean=Mp,l.isBuffer=Wn,l.isDate=yf,l.isElement=Wp,l.isEmpty=zc,l.isEqual=Bp,l.isEqualWith=$p,l.isError=Os,l.isFinite=jp,l.isFunction=tr,l.isInteger=Pc,l.isLength=xt,l.isMap=Gs,l.isMatch=kp,l.isMatchWith=Dc,l.isNaN=Vp,l.isNative=Gp,l.isNil=Hp,l.isNull=qp,l.isNumber=Du,l.isObject=Fe,l.isObjectLike=Be,l.isPlainObject=wo,l.isRegExp=qs,l.isSafeInteger=Yp,l.isSet=_f,l.isString=Fu,l.isSymbol=Yt,l.isTypedArray=zi,l.isUndefined=Qp,l.isWeakMap=Jp,l.isWeakSet=Xp,l.join=fs,l.kebabCase=Hg,l.last=Ot,l.lastIndexOf=cp,l.lowerCase=Yg,l.lowerFirst=Zs,l.lt=Hs,l.lte=Ug,l.max=kd,l.maxBy=Vd,l.mean=Gd,l.meanBy=qd,l.min=Hd,l.minBy=Yd,l.stubArray=Ns,l.stubFalse=Ls,l.stubObject=zs,l.stubString=Qc,l.stubTrue=Wd,l.multiply=fm,l.nth=bc,l.noConflict=Ud,l.noop=Rs,l.now=na,l.pad=Vc,l.padEnd=Ad,l.padStart=Sd,l.parseInt=Ed,l.random=_d,l.reduce=Ep,l.reduceRight=Tp,l.repeat=Td,l.replace=Uu,l.result=ld,l.round=hm,l.runInContext=p,l.sample=Rc,l.size=Nc,l.snakeCase=Ks,l.some=yo,l.sortedIndex=Ac,l.sortedIndexBy=Sc,l.sortedIndexOf=hp,l.sortedLastIndex=Ec,l.sortedLastIndexBy=pp,l.sortedLastIndexOf=dp,l.startCase=Qg,l.startsWith=Cd,l.subtract=pm,l.sum=Qd,l.sumBy=Jd,l.template=Id,l.times=Bd,l.toFinite=nr,l.toInteger=ue,l.toLength=Uc,l.toLower=xd,l.toNumber=an,l.toSafeInteger=Zp,l.toString=ge,l.toUpper=Rd,l.trim=Nd,l.trimEnd=Ld,l.trimStart=zd,l.truncate=Pd,l.unescape=Dd,l.uniqueId=jd,l.upperCase=Jg,l.upperFirst=el,l.each=Oi,l.eachRight=bs,l.first=go,$u(l,function(){var e={};return xn(l,function(t,n){we.call(l.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),l.VERSION=Bi,m(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){l[e].placeholder=l}),m(["drop","take"],function(e,t){D.prototype[e]=function(n){n=n===_?1:Te(ue(n),0);var r=this.__filtered__&&!t?new D(this):this.clone();return r.__filtered__?r.__takeCount__=H(n,r.__takeCount__):r.__views__.push({size:H(n,On),type:e+(r.__dir__<0?"Right":"")}),r},D.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),m(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==ca||n==Qf;D.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:Z(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),m(["head","last"],function(e,t){var n="take"+(t?"Right":"");D.prototype[e]=function(){return this[n](1).value()[0]}}),m(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");D.prototype[e]=function(){return this.__filtered__?new D(this):this[n](1)}}),D.prototype.compact=function(){return this.filter(vt)},D.prototype.find=function(e){return this.filter(e).head()},D.prototype.findLast=function(e){return this.reverse().find(e)},D.prototype.invokeMap=se(function(e,t){return typeof e=="function"?new D(this):this.map(function(n){return ae(n,e,t)})}),D.prototype.reject=function(e){return this.filter(bo(Z(e)))},D.prototype.slice=function(e,t){e=ue(e);var n=this;return n.__filtered__&&(e>0||t<0)?new D(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==_&&(t=ue(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},D.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},D.prototype.toArray=function(){return this.take(On)},xn(D.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=l[r?"take"+(t=="last"?"Right":""):t],s=r||/^find/.test(t);a&&(l.prototype[t]=function(){var c=this.__wrapped__,f=r?[1]:arguments,g=c instanceof D,w=f[0],b=g||ie(c),S=function(B){var j=a.apply(l,F([B],f));return r&&T?j[0]:j};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var T=this.__chain__,R=!!this.__actions__.length,L=s&&!T,M=g&&!R;if(!s&&b){c=M?c:new D(this);var z=e.apply(c,f);return z.__actions__.push({func:vo,args:[S],thisArg:_}),new P(z,T)}return L&&M?e.apply(this,f):(z=this.thru(S),L?r?z.value()[0]:z.value():z)})}),m(["pop","push","shift","sort","splice","unshift"],function(e){var t=wn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);l.prototype[e]=function(){var a=arguments;if(r&&!this.__chain__){var s=this.value();return t.apply(ie(s)?s:[],a)}return this[n](function(c){return t.apply(ie(c)?c:[],a)})}}),xn(D.prototype,function(e,t){var n=l[t];if(n){var r=n.name+"";we.call(xi,r)||(xi[r]=[]),xi[r].push({name:t,func:n})}}),xi[pu(_,mr).name]=[{name:"wrapper",func:_}],D.prototype.clone=fe,D.prototype.reverse=ye,D.prototype.value=Ua,l.prototype.at=wg,l.prototype.chain=mp,l.prototype.commit=Cc,l.prototype.next=vp,l.prototype.plant=_p,l.prototype.reverse=er,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=Ct,l.prototype.first=l.prototype.head,ir&&(l.prototype[ir]=yp),l},mn=Rh();Hn?((Hn.exports=mn)._=mn,Pa._=mn):at._=mn}).call(xr)})(Rf,Rf.exports);var I_=Rf.exports,yv={};(function(i){i.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},i.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},i.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},i.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},i.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},i.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},i.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},i.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},i.realToAlias=function(){var u=Object.prototype.hasOwnProperty,o=i.aliasToReal,h={};for(var m in o){var A=o[m];u.call(h,A)?h[A].push(m):h[A]=[m]}return h}(),i.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},i.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},i.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}})(yv);var x_={},ct=yv,R_=x_,Gm=Array.prototype.push;function N_(i,u){return u==2?function(o,h){return i.apply(void 0,arguments)}:function(o){return i.apply(void 0,arguments)}}function dm(i,u){return u==2?function(o,h){return i(o,h)}:function(o){return i(o)}}function qm(i){for(var u=i?i.length:0,o=Array(u);u--;)o[u]=i[u];return o}function L_(i){return function(u){return i({},u)}}function z_(i,u){return function(){for(var o=arguments.length,h=o-1,m=Array(o);o--;)m[o]=arguments[o];var A=m[u],E=m.slice(0,u);return A&&Gm.apply(E,A),u!=h&&Gm.apply(E,m.slice(u+1)),i.apply(this,E)}}function gm(i,u){return function(){var o=arguments.length;if(o){for(var h=Array(o);o--;)h[o]=arguments[o];var m=h[0]=u.apply(void 0,h);return i.apply(void 0,h),m}}}function Em(i,u,o,h){var m=typeof u=="function",A=u===Object(u);if(A&&(h=o,o=u,u=void 0),o==null)throw new TypeError;h||(h={});var E={cap:"cap"in h?h.cap:!0,curry:"curry"in h?h.curry:!0,fixed:"fixed"in h?h.fixed:!0,immutable:"immutable"in h?h.immutable:!0,rearg:"rearg"in h?h.rearg:!0},C=m?o:R_,x="curry"in h&&h.curry,N="fixed"in h&&h.fixed,O="rearg"in h&&h.rearg,F=m?o.runInContext():void 0,U=m?o:{ary:i.ary,assign:i.assign,clone:i.clone,curry:i.curry,forEach:i.forEach,isArray:i.isArray,isError:i.isError,isFunction:i.isFunction,isWeakMap:i.isWeakMap,iteratee:i.iteratee,keys:i.keys,rearg:i.rearg,toInteger:i.toInteger,toPath:i.toPath},Q=U.ary,$=U.assign,J=U.clone,te=U.curry,X=U.forEach,me=U.isArray,ve=U.isError,ze=U.isFunction,Ve=U.isWeakMap,Ye=U.keys,Me=U.rearg,hn=U.toInteger,jn=U.toPath,Qe=Ye(ct.aryMethod),Sn={castArray:function(G){return function(){var W=arguments[0];return me(W)?G(qm(W)):G.apply(void 0,arguments)}},iteratee:function(G){return function(){var W=arguments[0],k=arguments[1],q=G(W,k),re=q.length;return E.cap&&typeof k=="number"?(k=k>2?k-2:1,re&&re<=k?q:dm(q,k)):q}},mixin:function(G){return function(W){var k=this;if(!ze(k))return G(k,Object(W));var q=[];return X(Ye(W),function(re){ze(W[re])&&q.push([re,k.prototype[re]])}),G(k,Object(W)),X(q,function(re){var ot=re[1];ze(ot)?k.prototype[re[0]]=ot:delete k.prototype[re[0]]}),k}},nthArg:function(G){return function(W){var k=W<0?1:hn(W)+1;return te(G(W),k)}},rearg:function(G){return function(W,k){var q=k?k.length:0;return te(G(W,k),q)}},runInContext:function(G){return function(W){return Em(i,G(W),h)}}};function En(G,W){if(E.cap){var k=ct.iterateeRearg[G];if(k)return ei(W,k);var q=!m&&ct.iterateeAry[G];if(q)return xo(W,q)}return W}function Kr(G,W,k){return x||E.curry&&k>1?te(W,k):W}function fr(G,W,k){if(E.fixed&&(N||!ct.skipFixed[G])){var q=ct.methodSpread[G],re=q&&q.start;return re===void 0?Q(W,k):z_(W,re)}return W}function Ze(G,W,k){return E.rearg&&k>1&&(O||!ct.skipRearg[G])?Me(W,ct.methodRearg[G]||ct.aryRearg[k]):W}function Wi(G,W){W=jn(W);for(var k=-1,q=W.length,re=q-1,ot=J(Object(G)),wt=ot;wt!=null&&++k<q;){var ut=W[k],Ke=wt[ut];Ke!=null&&!(ze(Ke)||ve(Ke)||Ve(Ke))&&(wt[ut]=J(k==re?Ke:Object(Ke))),wt=wt[ut]}return ot}function Ut(G){return Ge.runInContext.convert(G)(void 0)}function Kt(G,W){var k=ct.aliasToReal[G]||G,q=ct.remap[k]||k,re=h;return function(ot){var wt=m?F:U,ut=m?F[q]:W,Ke=$($({},re),ot);return Em(wt,k,ut,Ke)}}function xo(G,W){return Mt(G,function(k){return typeof k=="function"?dm(k,W):k})}function ei(G,W){return Mt(G,function(k){var q=W.length;return N_(Me(dm(k,q),W),q)})}function Mt(G,W){return function(){var k=arguments.length;if(!k)return G();for(var q=Array(k);k--;)q[k]=arguments[k];var re=E.rearg?0:k-1;return q[re]=W(q[re]),G.apply(void 0,q)}}function Ro(G,W,k){var q,re=ct.aliasToReal[G]||G,ot=W,wt=Sn[re];return wt?ot=wt(W):E.immutable&&(ct.mutate.array[re]?ot=gm(W,qm):ct.mutate.object[re]?ot=gm(W,L_(W)):ct.mutate.set[re]&&(ot=gm(W,Wi))),X(Qe,function(ut){return X(ct.aryMethod[ut],function(Ke){if(re==Ke){var Pe=ct.methodSpread[re],hr=Pe&&Pe.afterRearg;return q=hr?fr(re,Ze(re,ot,ut),ut):Ze(re,fr(re,ot,ut),ut),q=En(re,q),q=Kr(re,q,ut),!1}}),!q}),q||(q=ot),q==W&&(q=x?te(q,1):function(){return W.apply(this,arguments)}),q.convert=Kt(re,W),q.placeholder=W.placeholder=k,q}if(!A)return Ro(u,o,C);var Ge=o,Nr=[];return X(Qe,function(G){X(ct.aryMethod[G],function(W){var k=Ge[ct.remap[W]||W];k&&Nr.push([W,Ro(W,k,Ge)])})}),X(Ye(Ge),function(G){var W=Ge[G];if(typeof W=="function"){for(var k=Nr.length;k--;)if(Nr[k][0]==G)return;W.convert=Kt(G,W),Nr.push([G,W])}}),X(Nr,function(G){Ge[G[0]]=G[1]}),Ge.convert=Ut,Ge.placeholder=Ge,X(Ye(Ge),function(G){X(ct.realToAlias[G]||[],function(W){Ge[W]=Ge[G]})}),Ge}var P_=Em,Hm=I_.runInContext(),rl=P_(Hm,Hm),Ie;(function(i){i.Arg="Arg",i.DynamicInput="DynamicInput",i.DynamicOutputMethod="DynamicOutputMethod",i.DynamicOutputProperty="DynamicOutputProperty",i.Enum="Enum",i.ExtendInputObject="ExtendInputObject",i.ExtendObject="ExtendObject",i.InputField="InputField",i.InputObject="InputObject",i.Interface="Interface",i.List="List",i.NonNull="NonNull",i.Null="Null",i.Object="Object",i.OutputField="OutputField",i.Plugin="Plugin",i.PrintedGenTyping="PrintedGenTyping",i.PrintedGenTypingImport="PrintedGenTypingImport",i.Scalar="Scalar",i.Union="Union"})(Ie||(Ie={}));const Mf=Symbol.for("@nexus/wrapped");function bt(i,u){i.prototype[Mf]=u}class D_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(D_,Ie.Interface);class F_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(F_,Ie.Object);class U_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(U_,Ie.Union);function M_(i,u){var o;return i.extensions=Object.assign(Object.assign({},i.extensions),{nexus:Object.assign(Object.assign({},Object((o=i.extensions)===null||o===void 0?void 0:o.nexus)),u)}),i}const Nf=Symbol.for("@nexus/meta/NEXUS_TYPE"),W_=Symbol.for("@nexus/meta/NEXUS_BUILD");function B_(i){return!!(i&&typeof sl.get(i,W_)=="function")}function $_(i){return j_(i)||_v(i)}function j_(i){return!!(i&&sl.has(i,Nf)&&la(sl.get(i,Nf)))}function _v(i){return!!(i&&sl.has(i,Nf)&&typeof sl.get(i,Nf)=="function")}function Rm(i){return B_(i)||$_(i)||_v(i)}class k_{constructor(u){this.config=u}}bt(k_,Ie.PrintedGenTypingImport);class V_{constructor(u){this.config=u}get imports(){return this.config.imports||[]}toString(){let u="";this.config.description&&(u=`/**
117
117
  ${this.config.description.split(`
118
118
  `).map(m=>m.trim()).filter(m=>m).map(m=>` * ${m}`).join(`
119
119
  `)}
120
120
  */
121
- `);const o=`${this.config.name}${this.config.optional?"?":""}`;return u+=`${o}: ${this.config.type}`,u}}bt(V_,Ie.PrintedGenTyping);M_(new tv({name:"NEXUS__UNKNOWN__TYPE",description:`
121
+ `);const o=`${this.config.name}${this.config.optional?"?":""}`;return u+=`${o}: ${this.config.type}`,u}}bt(V_,Ie.PrintedGenTyping);M_(new nv({name:"NEXUS__UNKNOWN__TYPE",description:`
122
122
  This scalar should never make it into production. It is used as a placeholder for situations
123
123
  where GraphQL Nexus encounters a missing type. We don't want to error immediately, otherwise
124
124
  the TypeScript definitions will not be updated.
125
- `,parseValue(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")},parseLiteral(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")},serialize(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")}}),{sourceType:"never"});const sl={has(i,u){return!!Object.getOwnPropertyDescriptor(i,u)},set(i,u,o){return Object.defineProperty(i,u,{value:o}),o},get(i,u){var o;return(o=Object.getOwnPropertyDescriptor(i,u))===null||o===void 0?void 0:o.value}};class _v{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(_v,Ie.Arg);function Wf(i){if(!i.type)throw new Error('You must provide a "type" for the arg()');return new _v(typeof i.type=="string"?i.type:i.type.name,i)}function bv(i){return Wf(Object.assign({type:"String"},i))}function Bf(i){return Wf(Object.assign({type:"Int"},i))}class G_{constructor(u){if(this.ofNexusType=u,this._isNexusListDef=!0,typeof u!="string"&&!la(u)&&!xm(u)&&!ll(u))throw new Error("Cannot wrap unknown types in list(). Saw "+u)}}bt(G_,Ie.List);class Em{constructor(u){if(this.ofNexusType=u,this._isNexusNonNullDef=!0,typeof u!="string"&&!la(u)&&!xm(u)&&!ll(u))throw new Error("Cannot wrap unknown types in a nonNull(). Saw "+u)}}bt(Em,Ie.NonNull);function wv(i){return Av(i)||Cm(i)?i:Sv(i)?new Em(i.ofNexusType):new Em(i)}class Tm{constructor(u){if(this.ofNexusType=u,this._isNexusNullDef=!0,typeof u!="string"&&!la(u)&&!xm(u)&&!ll(u))throw new Error("Cannot wrap unknown types in nullable(). Saw "+u)}}bt(Tm,Ie.Null);function Lf(i){return Av(i)?new Tm(i.ofNexusType):Sv(i)?i:new Tm(i)}Ie.Enum,Ie.Object,Ie.Scalar,Ie.Union,Ie.Interface,Ie.InputObject;function la(i){return i&&!!i[Mf]}function Av(i){return la(i)&&i[Mf]===Ie.NonNull}function Sv(i){return la(i)&&i[Mf]===Ie.Null}class q_{constructor(u){this.config=u}}bt(q_,Ie.Plugin);class H_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(H_,Ie.DynamicInput);class Y_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(Y_,Ie.DynamicOutputMethod);const Q_={first:Lf(Bf({description:"Returns the first n elements from the list."})),after:Lf(bv({description:"Returns the elements in the list that come after the specified cursor"}))};Object.assign(Object.assign({},Q_),{first:wv(Bf({description:"Returns the first n elements from the list."}))});const J_={last:Lf(Bf({description:"Returns the last n elements from the list."})),before:Lf(bv({description:"Returns the elements in the list that come before the specified cursor"}))};Object.assign(Object.assign({},J_),{last:wv(Bf({description:"Returns the last n elements from the list."}))});var zf=typeof Symbol=="function"?Symbol:void 0;zf&&zf.iterator;zf&&zf.asyncIterator;class X_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Wf(Object.assign(Object.assign({},u),{type:this}))}}bt(X_,Ie.Enum);class Ev{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Wf(Object.assign(Object.assign({},u),{type:this}))}}bt(Ev,Ie.InputObject);function Z_(i){return new Ev(i.name,i)}class K_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(K_,Ie.Scalar);class e1{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(e1,Ie.ExtendInputObject);class t1{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(t1,Ie.ExtendObject);class n1{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(n1,Ie.DynamicOutputProperty);const Hm=["id"],r1=(i,u,o)=>{const{naming:h,mappers:m}=strapi.plugin("graphql").service("utils"),A=m.strapiScalarToGraphQLScalar(o.type);i.field(u,{type:h.getScalarFilterInputTypeName(A)})},i1=(i,u,o)=>{const h=strapi.plugin("graphql").service("utils"),m=strapi.plugin("graphql").service("extension"),{getFiltersInputTypeName:A}=h.naming,{isMorphRelation:E}=h.attributes,C=strapi.getModel(o.target);!C||E(o)||m.shadowCRUD(C.uid).isDisabled()||i.field(u,{type:A(C)})},o1=({strapi:i})=>{const{service:u}=i.plugin("graphql"),o=A=>{const{operators:E}=u("builders").filters;if(Array.isArray(A))return A.map(o);if(rl.isDate(A)||!rl.isObject(A))return A;const C={};for(const[x,N]of Object.entries(A)){const F=!!E[x]?E[x].strapiOperator:x;C[F]=o(N)}return C},h=()=>{const{operators:A}=i.plugin("graphql").service("builders").filters;return[A.and,A.or,A.not]},m=(A,E={})=>{const{isStrapiScalar:C,isMedia:x,isRelation:N}=u("utils").attributes,{operators:O}=u("builders").filters,F=[O.and,O.or,O.not];if(rl.isNil(A))return{};if(Array.isArray(A))return A.reduce((J,te)=>(J.push(m(te,E)),J),[]);const U={},{attributes:Q}=E,$=J=>Hm.includes(J)||rl.has(J,Q);for(const[J,te]of Object.entries(A))if($(J)){const X=Q[J];if(Hm.includes(J)||C(X))U[J]=o(te);else if(N(X)||x(X)){const me=i.getModel(X.target);U[J]=m(te,me)}}else{const X=F.find(rl.propEq("fieldName",J));if(X){const{strapiOperator:me}=X;U[me]=m(te,E)}}return U};return{graphQLFiltersToStrapiQuery:m,buildContentTypeFilters(A){const E=i.plugin("graphql").service("utils"),C=i.plugin("graphql").service("extension"),{getFiltersInputTypeName:x,getScalarFilterInputTypeName:N}=E.naming,{isStrapiScalar:O,isRelation:F}=E.attributes,{attributes:U}=A,Q=x(A);return Z_({name:Q,definition($){const J=Object.entries(U).filter(([X])=>C.shadowCRUD(A.uid).field(X).hasFiltersEnabeld()),te=C.shadowCRUD(A.uid).field("id").hasFiltersEnabeld();A.kind==="collectionType"&&te&&$.field("id",{type:N("ID")});for(const[X,me]of J)O(me)?r1($,X,me):F(me)&&i1($,X,me);for(const X of h())X.add($,Q)}})}}},u1=({strapi:i})=>{const u=Uf(i);return{getConfig:async(o=!1)=>{const h=await u.get(o);if(pe(h))return h.right;throw h.left},update:async o=>{const h=await u.update(o);if(pe(h))return h.right;throw h.left},restore:async()=>{const o=await u.restore();if(pe(o))return o.right;throw o.left},restart:()=>i.reload()}},a1={admin:A_,client:E_,common:C_,settings:u1,gql:o1},s1={register:Pv,bootstrap:py,config:my,controllers:d_,routes:__,services:a1,contentTypes:Rv};module.exports=s1;
125
+ `,parseValue(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")},parseLiteral(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")},serialize(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")}}),{sourceType:"never"});const sl={has(i,u){return!!Object.getOwnPropertyDescriptor(i,u)},set(i,u,o){return Object.defineProperty(i,u,{value:o}),o},get(i,u){var o;return(o=Object.getOwnPropertyDescriptor(i,u))===null||o===void 0?void 0:o.value}};class bv{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(bv,Ie.Arg);function Wf(i){if(!i.type)throw new Error('You must provide a "type" for the arg()');return new bv(typeof i.type=="string"?i.type:i.type.name,i)}function wv(i){return Wf(Object.assign({type:"String"},i))}function Bf(i){return Wf(Object.assign({type:"Int"},i))}class G_{constructor(u){if(this.ofNexusType=u,this._isNexusListDef=!0,typeof u!="string"&&!la(u)&&!Rm(u)&&!ll(u))throw new Error("Cannot wrap unknown types in list(). Saw "+u)}}bt(G_,Ie.List);class Tm{constructor(u){if(this.ofNexusType=u,this._isNexusNonNullDef=!0,typeof u!="string"&&!la(u)&&!Rm(u)&&!ll(u))throw new Error("Cannot wrap unknown types in a nonNull(). Saw "+u)}}bt(Tm,Ie.NonNull);function Av(i){return Sv(i)||Im(i)?i:Ev(i)?new Tm(i.ofNexusType):new Tm(i)}class Om{constructor(u){if(this.ofNexusType=u,this._isNexusNullDef=!0,typeof u!="string"&&!la(u)&&!Rm(u)&&!ll(u))throw new Error("Cannot wrap unknown types in nullable(). Saw "+u)}}bt(Om,Ie.Null);function Lf(i){return Sv(i)?new Om(i.ofNexusType):Ev(i)?i:new Om(i)}Ie.Enum,Ie.Object,Ie.Scalar,Ie.Union,Ie.Interface,Ie.InputObject;function la(i){return i&&!!i[Mf]}function Sv(i){return la(i)&&i[Mf]===Ie.NonNull}function Ev(i){return la(i)&&i[Mf]===Ie.Null}class q_{constructor(u){this.config=u}}bt(q_,Ie.Plugin);class H_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(H_,Ie.DynamicInput);class Y_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(Y_,Ie.DynamicOutputMethod);const Q_={first:Lf(Bf({description:"Returns the first n elements from the list."})),after:Lf(wv({description:"Returns the elements in the list that come after the specified cursor"}))};Object.assign(Object.assign({},Q_),{first:Av(Bf({description:"Returns the first n elements from the list."}))});const J_={last:Lf(Bf({description:"Returns the last n elements from the list."})),before:Lf(wv({description:"Returns the elements in the list that come before the specified cursor"}))};Object.assign(Object.assign({},J_),{last:Av(Bf({description:"Returns the last n elements from the list."}))});var zf=typeof Symbol=="function"?Symbol:void 0;zf&&zf.iterator;zf&&zf.asyncIterator;class X_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Wf(Object.assign(Object.assign({},u),{type:this}))}}bt(X_,Ie.Enum);class Tv{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Wf(Object.assign(Object.assign({},u),{type:this}))}}bt(Tv,Ie.InputObject);function Z_(i){return new Tv(i.name,i)}class K_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(K_,Ie.Scalar);class e1{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(e1,Ie.ExtendInputObject);class t1{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(t1,Ie.ExtendObject);class n1{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(n1,Ie.DynamicOutputProperty);const Ym=["id"],r1=(i,u,o)=>{const{naming:h,mappers:m}=strapi.plugin("graphql").service("utils"),A=m.strapiScalarToGraphQLScalar(o.type);i.field(u,{type:h.getScalarFilterInputTypeName(A)})},i1=(i,u,o)=>{const h=strapi.plugin("graphql").service("utils"),m=strapi.plugin("graphql").service("extension"),{getFiltersInputTypeName:A}=h.naming,{isMorphRelation:E}=h.attributes,C=strapi.getModel(o.target);!C||E(o)||m.shadowCRUD(C.uid).isDisabled()||i.field(u,{type:A(C)})},o1=({strapi:i})=>{const{service:u}=i.plugin("graphql"),o=A=>{const{operators:E}=u("builders").filters;if(Array.isArray(A))return A.map(o);if(rl.isDate(A)||!rl.isObject(A))return A;const C={};for(const[x,N]of Object.entries(A)){const F=!!E[x]?E[x].strapiOperator:x;C[F]=o(N)}return C},h=()=>{const{operators:A}=i.plugin("graphql").service("builders").filters;return[A.and,A.or,A.not]},m=(A,E={})=>{const{isStrapiScalar:C,isMedia:x,isRelation:N}=u("utils").attributes,{operators:O}=u("builders").filters,F=[O.and,O.or,O.not];if(rl.isNil(A))return{};if(Array.isArray(A))return A.reduce((J,te)=>(J.push(m(te,E)),J),[]);const U={},{attributes:Q}=E,$=J=>Ym.includes(J)||rl.has(J,Q);for(const[J,te]of Object.entries(A))if($(J)){const X=Q[J];if(Ym.includes(J)||C(X))U[J]=o(te);else if(N(X)||x(X)){const me=i.getModel(X.target);U[J]=m(te,me)}}else{const X=F.find(rl.propEq("fieldName",J));if(X){const{strapiOperator:me}=X;U[me]=m(te,E)}}return U};return{graphQLFiltersToStrapiQuery:m,buildContentTypeFilters(A){const E=i.plugin("graphql").service("utils"),C=i.plugin("graphql").service("extension"),{getFiltersInputTypeName:x,getScalarFilterInputTypeName:N}=E.naming,{isStrapiScalar:O,isRelation:F}=E.attributes,{attributes:U}=A,Q=x(A);return Z_({name:Q,definition($){const J=Object.entries(U).filter(([X])=>C.shadowCRUD(A.uid).field(X).hasFiltersEnabeld()),te=C.shadowCRUD(A.uid).field("id").hasFiltersEnabeld();A.kind==="collectionType"&&te&&$.field("id",{type:N("ID")});for(const[X,me]of J)O(me)?r1($,X,me):F(me)&&i1($,X,me);for(const X of h())X.add($,Q)}})}}},u1=({strapi:i})=>{const u=Uf(i);return{getConfig:async(o=!1)=>{const h=await u.get(o);if(pe(h))return h.right;throw h.left},update:async o=>{const h=await u.update(o);if(pe(h))return h.right;throw h.left},restore:async()=>{const o=await u.restore();if(pe(o))return o.right;throw o.left},restart:()=>i.reload()}},a1={admin:A_,client:E_,common:C_,settings:u1,gql:o1},s1={register:Dv,bootstrap:dy,config:vy,controllers:d_,routes:__,services:a1,contentTypes:Nv};module.exports=s1;