"use strict";(globalThis.webpackChunk_tsparticles_wordpress=globalThis.webpackChunk_tsparticles_wordpress||[]).push([[1859,4855],{4855(t,e,i){i.d(e,{loadGridPath:()=>h});var n=i(1859),o=i(3199);const a=[o.Miz.create(o.D_O,o.boI.y),o.Miz.create(o.boI.x,o.D_O),o.Miz.create(-o.D_O,o.boI.y),o.Miz.create(o.boI.x,-o.D_O)],s=[2,3,0,1];class r{options;#t;#e;constructor(t){this.#t=t,this.#e=o.Miz.origin,this.options={cellSize:40,graph:void 0,autoMaze:!1}}generate(t){const e=this.options.cellSize;t.grid??={direction:Math.trunc((0,o.G0i)()*a.length),speed:t.velocity.length,cellPosition:{x:Math.floor(t.position.x/e),y:Math.floor(t.position.y/e)}};const i=t.grid,n={x:Math.floor(t.position.x/e),y:Math.floor(t.position.y/e)};if(n.x!==i.cellPosition.x||n.y!==i.cellPosition.y){i.cellPosition.x=n.x,i.cellPosition.y=n.y;const t=`${n.x},${n.y}`,e=this.options.graph?.[t];if(e&&e.length>0)i.direction=e[Math.trunc((0,o.G0i)()*e.length)];else if(!this.options.graph){const t=Math.trunc(3*(0,o.G0i)())-1;i.direction=(i.direction+t+4)%a.length}}t.velocity.x=0,t.velocity.y=0;const s=a[i.direction];return this.#e.x=s.x*i.speed,this.#e.y=s.y*i.speed,this.#e}init(){const t=this.#t.actualOptions.particles.move.path.options;if(this.options.cellSize=t.cellSize??this.options.cellSize,this.options.autoMaze=t.autoMaze??this.options.autoMaze,this.options.graph=t.graph,this.options.autoMaze){const t=this.#t.canvas.size,e=this.options.cellSize,i={width:Math.ceil(t.width/e),height:Math.ceil(t.height/e)};this.options.graph=this.#i(i)}}reset(t){delete t.grid}update(){}#i({height:t,width:e}){const i={},n=[];for(let e=0;e<t;e++)n[e]=[];const a=[{x:o.boI.x,y:o.boI.y}];for(;a.length>0;){const{x:r,y:h}=a[a.length-1];n[h][r]||(n[h][r]=!0);const l=[0,1,2,3].sort(()=>(0,o.G0i)()-.5);let c=!1;for(const o of l){const l={x:r+(0===o?1:2===o?-1:0),y:h+(1===o?1:3===o?-1:0)};if(!(l.x<0||l.y<0||l.x>=e||l.y>=t||n[l.y][l.x])){const t=`${r},${h}`,e=`${l.x},${l.y}`;i[t]??=[],i[e]??=[],i[t].push(o),i[e].push(s[o]),a.push(l),c=!0;break}}c||a.pop()}return i}}async function h(t){t.checkVersion("4.1.3"),await t.pluginManager.register(t=>{(0,n.g)(t),t.pluginManager.addPathGenerator?.("gridPathGenerator",t=>Promise.resolve(new r(t)))})}},1859(t,e,i){i.d(e,{g:()=>s,loadMovePlugin:()=>a});var n=i(3199);class o{id="move";#n;constructor(t){this.#n=t}async getPlugin(t){const{MovePluginInstance:e}=await i.e(5272).then(i.bind(i,5272));return new e(this.#n,t)}loadOptions(){}needsPlugin(){return!0}}async function a(t){t.checkVersion("4.1.3"),await t.pluginManager.register(t=>{const e=t.pluginManager;e.initializers.pathGenerators??=new Map,e.pathGenerators??=new Map,e.addPathGenerator=(t,i)=>{e.initializers.pathGenerators??=new Map,e.initializers.pathGenerators.set(t,i)},e.getPathGenerators=async(t,i=!1)=>(e.initializers.pathGenerators??=new Map,e.pathGenerators??=new Map,(0,n.OtU)(t,e.pathGenerators,e.initializers.pathGenerators,i)),t.pluginManager.addPlugin(new o(t.pluginManager))})}function s(t){if(!t.pluginManager.addPathGenerator)throw new Error("tsParticles Base Mover is not loaded")}}}]);