"use strict";(self.webpackChunkmulti_token_edit=self.webpackChunkmulti_token_edit||[]).push([[164],{6164:(e,t,s)=>{s.r(t),s.d(t,{openExpandPresets:()=>o});var a=s(8652),i=s(7671),n=s(6596),r=s(902);class PresetDialog extends r.xg{static open({presets:e,windowTitle:t}){new PresetDialog({presets:e,windowTitle:t}).render(!0)}constructor(e={}){super({},e),this.presets=e.presets,this.windowTitle=e.windowTitle??"Preset Dialog"}static DEFAULT_OPTIONS={tag:"form",classes:["mass-edit-window-fill"],form:{handler:void 0,submitOnChange:!1,closeOnSubmit:!1},window:{contentClasses:["standard-form"],resizable:!0,minimizable:!0},position:{width:500,height:500},actions:{}};static PARTS={main:{template:`modules/${n.Do}/templates/preset/dialog.hbs`}};get title(){return this.windowTitle}async _prepareContext(e){const t=await super._prepareContext(e);return Object.assign(t,{presets:this.presets})}}async function o(e){await a.P0.batchLoad(e);let t=0;const s=function(e,s,a,n){const r="Token"===s||"Tile"===s?e.texture?.src:void 0,o=r?r.split("/").pop():s,d=new i.k({name:o,img:r,documentName:s,data:[e],uuid:t});d.document={pages:{size:0}},d._temp=!0,d._loaded=!0,n&&(d.randomize=foundry.utils.deepClone(n.randomize),d.addSubtract=foundry.utils.deepClone(n.addSubtract)),a.push(d),t++};for(const a of e)if(t=0,a.data.length>1||a.attached?.length){let e=[];a.data.forEach(t=>{foundry.utils.isEmpty(t)||s(t,a.documentName,e,a)}),a.attached?.forEach(t=>s(t.data,t.documentName,e)),new ExpandDialog({preset:a,expanded:e}).render(!0)}}class ExpandDialog extends PresetDialog{constructor({preset:e,expanded:t}={}){super({presets:t,windowTitle:e.name,id:"expand-dialog-"+e.id}),this.preset=e}_retrievePresets(e){return(Array.isArray(e)?e:[e]).map(e=>this.presets[e])}_getItemContextOptions(){const e=super._getItemContextOptions(),t={brush:!0,applyToSelected:!0,copyToClipboard:!0,exportAsJson:!0,exportToCompendium:!0,delete:!0};return e.filter(e=>t[e.id])}_onSetDragDropData(e){e.transient=!0,MassEdit._transientPresets=e.uuids.map(e=>this.presets[e])}}}}]);
//# sourceMappingURL=164.mass-edit.js.map