Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • oss/minerva/grapesjs-project-manager
1 result
Show changes
Commits on Source (2)
......@@ -6,4 +6,332 @@ Makefile
.vimspector.json
*.tgz
index.html
/scripts/
\ No newline at end of file
scripts/
#GITIGNORE-START
.DS_Store
private/
/locale
node_modules/
*.log
_index.html
stats.json
##################### IDE / Tools ###
# @see https://github.com/github/gitignore/
# PHPUnit
.phpunit.result.cache
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.cache
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Cloud9 IDE - http://c9.io
.c9revisions
.c9
##Exclipse
.metadata
#bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
#local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
.apt_generated_test/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
##Kate
# Swap Files #
.*.kate-swp
.swp.*
## KDEDevelop
*.kdev4
.kdev4/
## LibreOffice
# LibreOffice locks
.~lock.*#
### LINUX
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
## Patches
*.orig
*.rej
# Private key
*.ppk
## Sublime
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# Workspace files are user-specific
*.sublime-workspace
# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
# *.sublime-project
# SFTP configuration file
sftp-config.json
sftp-config-alt*.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings
## VIM
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# gitignore template for AWS Serverless Application Model project
# website: https://docs.aws.amazon.com/serverless-application-model
# Ignore build folder
.aws-sam/
# Netbeans
**/nbproject/private/
**/nbproject/Makefile-*.mk
**/nbproject/Package-*.bash
build/
nbbuild/
nbdist/
.nb-gradle/
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
## GOLANG
go.work
......@@ -289,9 +289,7 @@ release:
npm-publish: build $(PACKAGE_DIR).npmignore
$(ECHOMARKER) "publish"
$(QUIET) $(CD) $(THIS_DIR) ; \
$(NPM) pack ; \
$(NPM) publish --access public ; \
$(CD) -
# $(NPM) publish --access public ; \
/*! For license information please see grapesjs-project-manager.min.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@schukai/grapesjs-project-manager"]=t():e["@schukai/grapesjs-project-manager"]=t()}(self,(()=>(()=>{var e={306:function(e){!function(t){"use strict";var n=function(){return{escape:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},parseExtension:t,mimeType:function(e){var n=t(e).toLowerCase();return(r="application/font-woff",i="image/jpeg",{woff:r,woff2:r,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:i,jpeg:i,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"})[n]||"";var r,i},dataAsUrl:function(e,t){return"data:"+t+";base64,"+e},isDataUrl:function(e){return-1!==e.search(/^(data:)/)},canvasToBlob:function(e){return e.toBlob?new Promise((function(t){e.toBlob(t)})):function(e){return new Promise((function(t){for(var n=window.atob(e.toDataURL().split(",")[1]),r=n.length,i=new Uint8Array(r),o=0;o<r;o++)i[o]=n.charCodeAt(o);t(new Blob([i],{type:"image/png"}))}))}(e)},resolveUrl:function(e,t){var n=document.implementation.createHTMLDocument(),r=n.createElement("base");n.head.appendChild(r);var i=n.createElement("a");return n.body.appendChild(i),r.href=t,i.href=e,i.href},getAndEncode:function(e){var t=3e4;c.impl.options.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());return new Promise((function(n){var r,i=new XMLHttpRequest;if(i.onreadystatechange=a,i.ontimeout=s,i.responseType="blob",i.timeout=t,i.open("GET",e,!0),i.send(),c.impl.options.imagePlaceholder){var o=c.impl.options.imagePlaceholder.split(/,/);o&&o[1]&&(r=o[1])}function a(){if(4===i.readyState)if(200===i.status){var t=new FileReader;t.onloadend=function(){var e=t.result.split(/,/)[1];n(e)},t.readAsDataURL(i.response)}else r?n(r):l("cannot fetch resource: "+e+", status: "+i.status)}function s(){r?n(r):l("timeout of "+t+"ms occured while fetching resource: "+e)}function l(e){console.error(e),n("")}}))},uid:(e=0,function(){return"u"+t()+e++;function t(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)}}),delay:function(e){return function(t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))}},asArray:function(e){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t},escapeXhtml:function(e){return e.replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=n,r.src=e}))},width:function(e){var t=n(e,"border-left-width"),r=n(e,"border-right-width");return e.scrollWidth+t+r},height:function(e){var t=n(e,"border-top-width"),r=n(e,"border-bottom-width");return e.scrollHeight+t+r}};var e;function t(e){var t=/\.([^\.\/]*?)$/g.exec(e);return t?t[1]:""}function n(e,t){var n=window.getComputedStyle(e).getPropertyValue(t);return parseFloat(n.replace("px",""))}}(),r=function(){var e=/url\(['"]?([^'"]+?)['"]?\)/g;return{inlineAll:function(e,n,o){return a()?Promise.resolve(e):Promise.resolve(e).then(r).then((function(t){var r=Promise.resolve(e);return t.forEach((function(e){r=r.then((function(t){return i(t,e,n,o)}))})),r}));function a(){return!t(e)}},shouldProcess:t,impl:{readUrls:r,inline:i}};function t(t){return-1!==t.search(e)}function r(t){for(var r,i=[];null!==(r=e.exec(t));)i.push(r[1]);return i.filter((function(e){return!n.isDataUrl(e)}))}function i(e,t,r,i){return Promise.resolve(t).then((function(e){return r?n.resolveUrl(e,r):e})).then(i||n.getAndEncode).then((function(e){return n.dataAsUrl(e,n.mimeType(t))})).then((function(r){return e.replace(function(e){return new RegExp("(url\\(['\"]?)("+n.escape(e)+")(['\"]?\\))","g")}(t),"$1"+r+"$3")}))}}(),i=function(){return{resolveAll:function(){return e(document).then((function(e){return Promise.all(e.map((function(e){return e.resolve()})))})).then((function(e){return e.join("\n")}))},impl:{readAll:e}};function e(){return Promise.resolve(n.asArray(document.styleSheets)).then((function(e){var t=[];return e.forEach((function(e){try{n.asArray(e.cssRules||[]).forEach(t.push.bind(t))}catch(t){console.log("Error while reading CSS rules from "+e.href,t.toString())}})),t})).then((function(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return r.shouldProcess(e.style.getPropertyValue("src"))}))})).then((function(t){return t.map(e)}));function e(e){return{resolve:function(){var t=(e.parentStyleSheet||{}).href;return r.inlineAll(e.cssText,t)},src:function(){return e.style.getPropertyValue("src")}}}}}(),o=function(){return{inlineAll:function t(i){return i instanceof Element?o(i).then((function(){return i instanceof HTMLImageElement?e(i).inline():Promise.all(n.asArray(i.childNodes).map((function(e){return t(e)})))})):Promise.resolve(i);function o(e){var t=e.style.getPropertyValue("background");return t?r.inlineAll(t).then((function(t){e.style.setProperty("background",t,e.style.getPropertyPriority("background"))})).then((function(){return e})):Promise.resolve(e)}},impl:{newImage:e}};function e(e){return{inline:function(t){return n.isDataUrl(e.src)?Promise.resolve():Promise.resolve(e.src).then(t||n.getAndEncode).then((function(t){return n.dataAsUrl(t,n.mimeType(e.src))})).then((function(t){return new Promise((function(n,r){e.onload=n,e.onerror=r,e.src=t}))}))}}}}(),a={imagePlaceholder:void 0,cacheBust:!1},c={toSvg:s,toPng:function(e,t){return l(e,t||{}).then((function(e){return e.toDataURL()}))},toJpeg:function(e,t){return l(e,t=t||{}).then((function(e){return e.toDataURL("image/jpeg",t.quality||1)}))},toBlob:function(e,t){return l(e,t||{}).then(n.canvasToBlob)},toPixelData:function(e,t){return l(e,t||{}).then((function(t){return t.getContext("2d").getImageData(0,0,n.width(e),n.height(e)).data}))},impl:{fontFaces:i,images:o,util:n,inliner:r,options:{}}};function s(e,t){return function(e){void 0===e.imagePlaceholder?c.impl.options.imagePlaceholder=a.imagePlaceholder:c.impl.options.imagePlaceholder=e.imagePlaceholder;void 0===e.cacheBust?c.impl.options.cacheBust=a.cacheBust:c.impl.options.cacheBust=e.cacheBust}(t=t||{}),Promise.resolve(e).then((function(e){return u(e,t.filter,!0)})).then(d).then(p).then((function(e){t.bgcolor&&(e.style.backgroundColor=t.bgcolor);t.width&&(e.style.width=t.width+"px");t.height&&(e.style.height=t.height+"px");t.style&&Object.keys(t.style).forEach((function(n){e.style[n]=t.style[n]}));return e})).then((function(r){return function(e,t,r){return Promise.resolve(e).then((function(e){return e.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),(new XMLSerializer).serializeToString(e)})).then(n.escapeXhtml).then((function(e){return'<foreignObject x="0" y="0" width="100%" height="100%">'+e+"</foreignObject>"})).then((function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+r+'">'+e+"</svg>"})).then((function(e){return"data:image/svg+xml;charset=utf-8,"+e}))}(r,t.width||n.width(e),t.height||n.height(e))}))}function l(e,t){return s(e,t).then(n.makeImage).then(n.delay(100)).then((function(r){var i=function(e){var r=document.createElement("canvas");if(r.width=t.width||n.width(e),r.height=t.height||n.height(e),t.bgcolor){var i=r.getContext("2d");i.fillStyle=t.bgcolor,i.fillRect(0,0,r.width,r.height)}return r}(e);return i.getContext("2d").drawImage(r,0,0),i}))}function u(e,t,r){return r||!t||t(e)?Promise.resolve(e).then((function(e){return e instanceof HTMLCanvasElement?n.makeImage(e.toDataURL()):e.cloneNode(!1)})).then((function(r){return function(e,t,r){var i=e.childNodes;return 0===i.length?Promise.resolve(t):o(t,n.asArray(i),r).then((function(){return t}));function o(e,t,n){var r=Promise.resolve();return t.forEach((function(t){r=r.then((function(){return u(t,n)})).then((function(t){t&&e.appendChild(t)}))})),r}}(e,r,t)})).then((function(t){return function(e,t){return t instanceof Element?Promise.resolve().then(r).then(i).then(o).then(a).then((function(){return t})):t;function r(){function r(e,t){function r(e,t){n.asArray(e).forEach((function(n){t.setProperty(n,e.getPropertyValue(n),e.getPropertyPriority(n))}))}e.cssText?t.cssText=e.cssText:r(e,t)}r(window.getComputedStyle(e),t.style)}function i(){function r(r){var i=window.getComputedStyle(e,r),o=i.getPropertyValue("content");if(""!==o&&"none"!==o){var a=n.uid();t.className=t.className+" "+a;var c=document.createElement("style");c.appendChild(s(a,r,i)),t.appendChild(c)}function s(e,t,r){var i="."+e+":"+t,o=r.cssText?a(r):c(r);return document.createTextNode(i+"{"+o+"}");function a(e){var t=e.getPropertyValue("content");return e.cssText+" content: "+t+";"}function c(e){return n.asArray(e).map(t).join("; ")+";";function t(t){return t+": "+e.getPropertyValue(t)+(e.getPropertyPriority(t)?" !important":"")}}}}[":before",":after"].forEach((function(e){r(e)}))}function o(){e instanceof HTMLTextAreaElement&&(t.innerHTML=e.value),e instanceof HTMLInputElement&&t.setAttribute("value",e.value)}function a(){t instanceof SVGElement&&(t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t instanceof SVGRectElement&&["width","height"].forEach((function(e){var n=t.getAttribute(e);n&&t.style.setProperty(e,n)})))}}(e,t)})):Promise.resolve()}function d(e){return i.resolveAll().then((function(t){var n=document.createElement("style");return e.appendChild(n),n.appendChild(document.createTextNode(t)),e}))}function p(e){return o.inlineAll(e).then((function(){return e}))}e.exports=c}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";function e(e){throw new TypeError('"'+e+'" is read-only')}function t(t,n){var r,i={second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2592e6,year:31536e6},o=Math.round,a=function(e,t){return void 0===n?"".concat(t," ").concat(e+(t>1?"s":"")+" ago"):t+e.substring(0,1)},c=Date.now()-new Date(t).getTime();for(var s in c<0&&(e("ts"),e("dir")),i){if(o(c)<i[s])return a(r||"m",o(c/(i[r]||1)));r=s}return a(s,o(c/i[s]))}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.r(r),n.d(r,{default:()=>we});var l=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c(this,e),this.editor=t,this.$=t.$,this.pfx=t.getConfig("stylePrefix"),this.id=t.Storage.getConfig().id,this.opts=n,this.setState=this.setState.bind(this),this.setStateSilent=this.setStateSilent.bind(this),this.onRender=this.onRender.bind(this),this.handleTabs=this.handleTabs.bind(this)}var t,n,r;return t=e,(n=[{key:"setState",value:function(e){this.state=o(o({},this.state),e),this.update()}},{key:"setStateSilent",value:function(e){this.state=o(o({},this.state),e)}},{key:"sm",get:function(){return this.editor.Storage}},{key:"cs",get:function(){return this.editor.Storage.getCurrentStorage()}},{key:"pm",get:function(){return this.editor.Pages}},{key:"onRender",value:function(){}},{key:"handleTabs",value:function(){}}])&&s(t.prototype,n),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function u(e){return d(e)/1024}function d(e){return(new TextEncoder).encode(JSON.stringify(e)).length}function p(e,t){return!(!t||!e)&&t.toLowerCase().indexOf(e.toLowerCase())>-1}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=P(e);if(t){var i=P(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}const S=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}(a,e);var n,r,i,o=j(a);function a(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return v(this,a),(t=o.call(this,e,n)).handleSort=t.handleSort.bind(O(t)),t.handleFilterInput=t.handleFilterInput.bind(O(t)),t.handleNameInput=t.handleNameInput.bind(O(t)),t.handleOpen=t.handleOpen.bind(O(t)),t.handleCreate=t.handleCreate.bind(O(t)),t.handleDelete=t.handleDelete.bind(O(t)),t.openEdit=t.openEdit.bind(O(t)),t.state={editableProjectId:"",projectId:"",tab:"pages",sites:[],nameText:"",filterText:"",loading:!1,sortBy:"published_at",sortOrder:"desc"},t}return n=a,(r=[{key:"editableId",get:function(){return this.state.editableProjectId}},{key:"allSites",get:function(){return this.state.sites}},{key:"allSitesSize",get:function(){return u(this.state.sites)}},{key:"onRender",value:function(){var e=this.setState,t=this.cs;e({loading:!0}),t.loadAll((function(t){e({sites:t,loading:!1})}),(function(e){return console.log("Error",e)}))}},{key:"handleFilterInput",value:function(e){this.setState({filterText:e.target.value.trim()})}},{key:"handleNameInput",value:function(e){this.setStateSilent({nameText:e.target.value.trim()})}},{key:"handleSort",value:function(e){var t=this.state.sortOrder;e.target&&e.target.dataset&&this.setState({sortBy:e.target.dataset.sort,sortOrder:"desc"===t?"asc":"desc"})}},{key:"handleTabs",value:function(e){var t=e.target,n=this.$el,r=this.pfx,i=this.$;n.find(".".concat(r,"tablinks")).removeClass("active"),i(t).addClass("active"),"pages"===t.id?this.setState({tab:"pages"}):this.setState({tab:"templates"})}},{key:"handleOpen",value:function(e){var t=this.editor,n=this.cs,r=this.state.projectId;r&&r!==n.currentId?(n.setId(r),t.load((function(e){n.setName(e.name),n.setThumbnail(e.thumbnail||""),n.setIsTemplate(e.template),n.setDescription(e.description||"No description"),t.Modal.close()}))):this.opts.currentPageOpen()}},{key:"handleCreate",value:function(e){var t=this.editor,n=this.cs,r=this.state,i=r.projectId,o=r.nameText,a=t.runCommand("get-uuidv4"),c=o||"New-"+a.substr(0,8),s={id:a,name:c,template:!1,thumbnail:"",styles:"[]",description:"No description"};s["".concat(this.id,"pages")]='[{"id": "'.concat(crypto.randomUUID().substr(0,8),'", "name": "index"}]'),s["".concat(this.id,"styles")]="[]",s["".concat(this.id,"assets")]="[]",i?(n.setId(i),n.setIsTemplate(!1),t.load((function(e){n.setId(a),n.setName(c),n.setThumbnail(e.thumbnail||""),n.setDescription(e.description||"No description"),t.Modal.close()}))):(n.setId(a),n.store(s,(function(e){n.setIsTemplate(!1),t.load((function(e){n.setId(e.id),n.setName(e.name),n.setThumbnail(e.thumbnail||""),n.setDescription(e.description||"No description"),t.Modal.close()}))})))}},{key:"openEdit",value:function(e){var t=this.editor;(0,this.setStateSilent)({editableProjectId:e.currentTarget.dataset.id}),t.Modal.close(),t.SettingsApp.setTab("project"),t.runCommand("open-settings")}},{key:"handleEdit",value:function(e){this.cs.update(g(g({},e),{},{updated_at:Date()}))}},{key:"handleDelete",value:function(e){var t=this.cs,n=this.setState,r=this.opts;t.delete((function(e){r.onDelete(e),t.loadAll((function(e){return n({sites:e})}),(function(e){return console.log("Error",e)}))}),r.onDeleteError,e.currentTarget.dataset.id)}},{key:"renderSiteList",value:function(){var e,n=this,r=this.state,i=r.sites,o=r.tab,a=r.filterText,c=r.loading,s=r.sortBy,l=r.sortOrder,d=this.pfx,f=this.opts,h=this.cs,g=this.editor;if(c)return f.loader||"<div>Loading sites...</div>";if(!i.length)return f.nosites||"<div>No Sites</div>";"id"===s?e=function(e,t){return function(n,r){if("asc"===t){if(n[e]<r[e])return-1;if(n[e]>r[e])return 1}return n[e]>r[e]?-1:n[e]<r[e]?1:0}}(s,l):"updated_at"===s||"created_at"===s?e=function(e,t){return function(n,r){var i=new Date(n[e]).getTime(),o=new Date(r[e]).getTime();return"asc"===t?i-o:o-i}}(s,l):"pages"===s?e=function(e,t){return function(n,r){var i=JSON.parse(n[e]),o=JSON.parse(r[e]);if("desc"===t){if(i.length<o.length)return-1;if(i.length>o.length)return 1}return i.length>o.length?-1:i.length<o.length?1:0}}(this.id+s,l):"size"===s&&(e=function(e){return function(t,n){var r=u(t),i=u(n);if("asc"===e){if(r<i)return-1;if(r>i)return 1}return r>i?-1:r<i?1:0}}(l));var m=i.sort(e).filter((function(e){if(!a&&"pages"===o)return!0;var t=e.id,n=e.name,r=e.template;return!(!p(a,t)&&!p(a,n)||"pages"!==o)||!("templates"!==o||!r)})).map((function(e,r){var i=e.id,o=e.name,a=e.description,c=e.thumbnail,s=e.created_at,l=e.updated_at,p=u(e),m=JSON.parse(e["".concat(n.id,"pages")]),v=l?t(new Date(l).getTime()):"NA",b=s?t(new Date(s).getTime()):"NA",y=m.map((function(e){return e.name})).join(", ");return'<div \n class="site-wrapper '.concat(h.currentId===i?"open":"",'" \n key="').concat(r,'" \n data-id="').concat(i,'" \n title="').concat(g.I18n.t("grapesjs-project-manager.templates.titles.open"),'">\n <div class="site-screenshot">\n <img src="').concat(c,'" alt="" />\n </div>\n <div class="site-info">\n <h2>\n ').concat(o,'\n </h2>\n <div class="site-meta">\n ').concat(a,'\n </div>\n </div>\n <div class="site-update-time">').concat(v,'</div>\n <div class="site-pages">\n <div title="').concat(y||i,'">\n ').concat(m.length||1,'\n </div>\n </div>\n <div class="site-create-time">').concat(b,"</div>\n ").concat(f.size?'<div class="site-size" title="'.concat(p,' KB">\n ').concat(p.toFixed(2)," KB\n </div>"):"",'\n <div class="site-actions">\n <i class="').concat(d,'caret-icon fa fa-hand-pointer-o edit" title="').concat(g.I18n.t("grapesjs-project-manager.templates.titles.edit"),'" data-id="').concat(i,'"></i>\n ').concat(h.currentId!==i?'<i class="'.concat(d,'caret-icon fa fa-trash-o delete" title="').concat(g.I18n.t("grapesjs-project-manager.templates.titles.delete"),'" data-id="').concat(i,'"></i>'):"","\n </div>\n </div>")})).join("\n");if(!m.length){if("templates"===o)return f.nosites||"<div>No Templates Available.</div>";m="<div>\n <h3>\n No '".concat(a,"' examples found. Clear your search and try again.\n </h3>\n </div>")}return m}},{key:"renderSiteActions",value:function(){var e=this.editor;return"pages"===this.state.tab?'<div class="flex-row">\n <input \n class="search tm-input" \n placeholder="'.concat(e.I18n.t("grapesjs-project-manager.templates.search"),'"\n />\n <button id="open" class="primary-button">\n ').concat(e.I18n.t("grapesjs-project-manager.templates.open"),"\n </button>\n </div>"):'<div class="'.concat(this.pfx,"tip-about ").concat(this.pfx,'four-color">\n ').concat(e.I18n.t("grapesjs-project-manager.templates.help"),'\n </div>\n <div class="flex-row">\n <input \n class="name tm-input" \n placeholder="').concat(e.I18n.t("grapesjs-project-manager.templates.new"),'"\n />\n <button id="create" class="primary-button">\n ').concat(e.I18n.t("grapesjs-project-manager.templates.create"),"\n </button>\n </div>")}},{key:"renderThumbnail",value:function(e,t){var n='<img src="'.concat(e,'" alt="" />');return e?n:t.html?'<svg xmlns="http://www.w3.org/2000/svg" class="template-preview" viewBox="0 0 1300 1100" width="99%" height="220">\n <foreignObject width="100%" height="100%" style="pointer-events:none">\n <div xmlns="http://www.w3.org/1999/xhtml">\n '.concat(t.html+"<style scoped>"+t.css+"</style>","\n </div>\n </foreignObject>\n </svg>"):n}},{key:"update",value:function(){var e,t,n,r,i,o,a,c,s,l=this;null===(e=this.$el)||void 0===e||e.find("#site-list").html(this.renderSiteList()),null===(t=this.$el)||void 0===t||t.find("#tm-actions").html(this.renderSiteActions());var u=null===(n=this.$el)||void 0===n?void 0:n.find(".site-wrapper"),d=null===(r=this.$el)||void 0===r?void 0:r.find("input.search"),p=null===(i=this.$el)||void 0===i?void 0:i.find("input.name");this.setStateSilent({projectId:""}),u&&u.on("click",(function(e){u.removeClass("selected"),l.$(e.currentTarget).addClass("selected"),l.setStateSilent({projectId:e.currentTarget.dataset.id})})),d&&(d.val(this.state.filterText),d.on("change",this.handleFilterInput)),p&&(p.val(this.state.nameText),p.on("change",this.handleNameInput)),null===(o=this.$el)||void 0===o||o.find("#open").on("click",this.handleOpen),null===(a=this.$el)||void 0===a||a.find("#create").on("click",this.handleCreate),null===(c=this.$el)||void 0===c||c.find("i.edit").on("click",this.openEdit),null===(s=this.$el)||void 0===s||s.find("i.delete").on("click",this.handleDelete)}},{key:"render",value:function(){var e,t=this.$,n=this.pfx,r=this.opts,i=this.editor,o=this.state.tab;this.onRender(),null===(e=this.$el)||void 0===e||e.remove();var a=t('<div class="app">\n <div class="contents">\n <div class="'.concat(n,'tab">\n <button id="pages" class="').concat(n,"tablinks ").concat("pages"===o?"active":"",'">\n ').concat(i.I18n.t("grapesjs-project-manager.templates.all"),'\n </button>\n <button id="templates" class="').concat(n,"tablinks ").concat("templates"===o?"active":"",'"">\n ').concat(i.I18n.t("grapesjs-project-manager.templates.templates"),'\n </button>\n </div>\n <div id="tm-actions">\n ').concat(this.renderSiteActions(),'\n </div>\n <div class="site-wrapper-header">\n <div\n class="site-screenshot-header header"\n data-sort="id"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.info"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.info"),'\n </div>\n <div\n class="site-info header"\n data-sort="id"\n ></div>\n <div\n class="site-update-time header"\n data-sort="updated_at"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.updated"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.updated"),'\n </div>\n <div\n class="site-pages header"\n data-sort="pages"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.pages"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.pages"),'\n </div>\n <div\n class="site-create-time header"\n data-sort="created_at"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.created"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.created"),"\n </div>\n ").concat(r.size?'<div\n class="site-size header"\n data-sort="size"\n title="'.concat(i.I18n.t("grapesjs-project-manager.templates.titles.size"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.size"),"\n </div>"):"",'\n <div\n class="site-actions header"\n data-sort="id"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.actions"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.actions"),'\n </div>\n </div>\n <div id="site-list">\n ').concat(this.renderSiteList(),"\n </div>\n </div>\n </div>"));return a.find(".header").on("click",this.handleSort),a.find("#pages, #templates").on("click",this.handleTabs),this.$el=a,a}}])&&b(n.prototype,r),i&&b(n,i),Object.defineProperty(n,"prototype",{writable:!1}),a}(l);function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function T(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function E(e,t){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},E(e,t)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return C(this,n)}}function C(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return N(e)}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var _=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&E(e,t)}(o,e);var t,n,r,i=A(o);function o(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,o),(t=i.call(this,e,n)).addPage=t.addPage.bind(N(t)),t.selectPage=t.selectPage.bind(N(t)),t.removePage=t.removePage.bind(N(t)),t.isSelected=t.isSelected.bind(N(t)),t.handleNameInput=t.handleNameInput.bind(N(t)),t.openEdit=t.openEdit.bind(N(t)),t.state={editablePageId:"",isShowing:!0,nameText:"",pages:[],loading:!1},t}return t=o,(n=[{key:"editableId",get:function(){return this.state.editablePageId}},{key:"onRender",value:function(){var e=this.pm,t=this.setState,n=this.editor;t({loading:!0}),t({pages:T(e.getAll())}),n.on("page",(function(){t({pages:T(e.getAll())})})),t({loading:!1})}},{key:"isSelected",value:function(e){return this.pm.getSelected().id===e.id}},{key:"selectPage",value:function(e){this.pm.select(e.currentTarget.dataset.key),this.update()}},{key:"removePage",value:function(e){this.pm.remove(e.currentTarget.dataset.key),this.update()}},{key:"openEdit",value:function(e){var t=this.editor;this.setStateSilent({editablePageId:e.currentTarget.dataset.key}),t.Modal.close(),t.SettingsApp.setTab("page"),t.runCommand("open-settings")}},{key:"editPage",value:function(e,t){var n=this.pm.get(e);null==n||n.set("name",t),this.update()}},{key:"addPage",value:function(){var e=this.pm,t=this.state.nameText;t&&(e.add({name:t,component:""}),this.update())}},{key:"handleNameInput",value:function(e){this.setStateSilent({nameText:e.target.value.trim()})}},{key:"renderPagesList",value:function(){var e=this.state,t=e.pages,n=e.loading,r=this.opts,i=this.isSelected;return n?r.loader||"<div>Loading pages...</div>":t.map((function(e,t){return'<div \n data-id="'.concat(t,'" \n data-key="').concat(e.id,'" \n class="page ').concat(i(e)?"selected":"",'"\n >\n <i class="fa fa-file-o" style="margin:5px;"></i>\n ').concat(e.get("name")||e.id,"\n ").concat(i(e)?"":'<span class="page-close" data-key="'.concat(e.id,'">&Cross;</span>'),'\n <span class="page-edit" data-key="').concat(e.id,'"><i class="fa fa-hand-pointer-o"></i></span>\n </div>')})).join("\n")}},{key:"update",value:function(){var e,t,n,r;null===(e=this.$el)||void 0===e||e.find(".pages").html(this.renderPagesList()),null===(t=this.$el)||void 0===t||t.find(".page").on("click",this.selectPage),null===(n=this.$el)||void 0===n||n.find(".page-edit").on("click",this.openEdit),null===(r=this.$el)||void 0===r||r.find(".page-close").on("click",this.removePage)}},{key:"render",value:function(){var e,t=this.$,n=this.editor;this.onRender(),null===(e=this.$el)||void 0===e||e.remove();var r=t('<div style="display: '.concat(this.state.isShowing?"flex":"none",';" class="pages-wrp">\n <div class="pages">\n ').concat(this.renderPagesList(),'\n </div>\n <div class="flex-row">\n <input \n class="tm-input sm" \n type="text" \n placeholder="').concat(n.I18n.t("grapesjs-project-manager.pages.placeholder"),'" \n />\n </div>\n <div class="add-page">\n ').concat(n.I18n.t("grapesjs-project-manager.pages.new"),"\n </div>\n </div>"));return r.find(".add-page").on("click",this.addPage),r.find("input").on("change",this.handleNameInput),this.$el=r,r}},{key:"findPanel",get:function(){return this.editor.Panels.getPanel("views-container")}},{key:"showPanel",value:function(){var e;this.state.isShowing=!0,null===(e=this.findPanel)||void 0===e||e.set("appendContent",this.render()).trigger("change:appendContent"),this.update()}},{key:"hidePanel",value:function(){this.state.isShowing=!1,this.render()}}])&&D(t.prototype,n),r&&D(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(l);function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}function $(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},B(e,t)}function U(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=F(e);if(t){var i=F(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return z(this,n)}}function z(e,t){if(t&&("object"===L(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return V(e)}function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},F(e)}var q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&B(e,t)}(o,e);var t,n,r,i=U(o);function o(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return $(this,o),(t=i.call(this,e,n)).handleSave=t.handleSave.bind(V(t)),t.handleThumbnail=t.handleThumbnail.bind(V(t)),t.handleThumbnailInput=t.handleThumbnailInput.bind(V(t)),t.state={tab:"page",loading:!1},t}return t=o,(n=[{key:"setTab",value:function(e){this.state.tab=e}},{key:"update",value:function(){var e=this.$el;null==e||e.find("#settings").html(this.renderSettings()),null==e||e.find("#generate").on("click",this.handleThumbnail),null==e||e.find("input#thumbnail").on("change",this.handleThumbnailInput)}},{key:"onRender",value:function(){var e=this.setState;e({loading:!0}),e({loading:!1})}},{key:"handleSave",value:function(e){var t=this.$el,n=this.editor;if("page"===this.state.tab){var r=n.PagesApp.editableId,i=null==t?void 0:t.find("input.name").val().trim();r&&n.PagesApp.editPage(r,i)}else{var o=n.TemplateManager.editableId,a=null==t?void 0:t.find("input.thumbnail").val().trim(),c=null==t?void 0:t.find("input.name").val().trim(),s=null==t?void 0:t.find("input.desc").val().trim(),l=null==t?void 0:t.find("input.template").get(0).checked;o&&n.TemplateManager.handleEdit({id:o,thumbnail:a,name:c,description:s,template:l})}n.Modal.close()}},{key:"handleThumbnail",value:function(e){var t=this.editor,n=this.$el;t.runCommand("take-screenshot",{clb:function(e){null==n||n.find("input.thumbnail").val(e),null==n||n.find("img").attr("src",e)}})}},{key:"handleThumbnailInput",value:function(e){var t;null===(t=this.$el)||void 0===t||t.find("img").attr("src",e.target.value.trim())}},{key:"renderSettings",value:function(){var e=this.state,t=e.tab,n=e.loading,r=this.opts,i=this.pfx,o=this.pm,a=this.editor;if(n)return r.loader||"<div>Loading settings...</div>";if("page"===t){var c=o.get(a.PagesApp.editableId),s=(null==c?void 0:c.get("name"))||(null==c?void 0:c.id)||"";return'<label for="name">\n '.concat(a.I18n.t("grapesjs-project-manager.settings.labels.name"),'\n </label>\n <div class="flex-row">\n <input \n class="name tm-input" \n value="').concat(s,'" \n placeholder="').concat(a.I18n.t("grapesjs-project-manager.settings.placeholders.name"),'"/>\n </div>')}var l=a.TemplateManager.allSites.find((function(e){return e.id===a.TemplateManager.editableId}));return'<div class="'.concat(i,"tip-about ").concat(i,'four-color">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.help"),'\n </div>\n <label for="thumbnail">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.labels.thumbnail"),'\n </label>\n <div class="flex-row">\n <input \n id="thumbnail" \n class="thumbnail tm-input" \n value="').concat((null==l?void 0:l.thumbnail)||"",'" \n placeholder="').concat(a.I18n.t("grapesjs-project-manager.settings.placeholders.thumbnail"),'"\n />\n </div>\n <div class="flex-row" style="margin-bottom:15px;">\n <div class="site-screenshot">\n <img src="').concat((null==l?void 0:l.thumbnail)||"",'" alt="screenshot" />\n </div>\n <button id="generate" class="primary-button">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.generate"),'\n </button>\n </div>\n <label for="name">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.labels.name"),'\n </label>\n <div class="flex-row">\n <input \n id="name" \n class="name tm-input" \n value="').concat((null==l?void 0:l.name)||"",'" \n placeholder="').concat(a.I18n.t("grapesjs-project-manager.settings.placeholders.name"),'"\n />\n </div>\n <label for="desc">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.labels.description"),'\n </label>\n <div class="flex-row">\n <input \n id="desc" \n class="desc tm-input" \n value="').concat((null==l?void 0:l.description)||"",'" \n placeholder="').concat(a.I18n.t("grapesjs-project-manager.settings.placeholders.description"),'"\n />\n </div>\n <div class="flex-row group">\n <input id="template" class="template" type="checkbox" ').concat(null!=l&&l.template?"checked":"",'/>\n <label for="template">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.labels.template"),"\n </label>\n </div>")}},{key:"render",value:function(){var e,t=this.$,n=this.editor;this.onRender(),null===(e=this.$el)||void 0===e||e.remove();var r=t('<div class="app">\n <div id="settings">\n '.concat(this.renderSettings(),'\n </div>\n <div class="flex-row">\n <button id="save" class="primary-button">\n ').concat(n.I18n.t("grapesjs-project-manager.settings.save"),"\n </button>\n </div>\n </div>"));return r.find("#save").on("click",this.handleSave),r.find("#generate").on("click",this.handleThumbnail),r.find("input#thumbnail").on("change",this.handleThumbnailInput),this.$el=r,r}}])&&M(t.prototype,n),r&&M(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(l),H=n(306),W=n.n(H);function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){G(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function G(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const X=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.Commands,r=e.Storage.getCurrentStorage(),i=e.Modal,o=e.getConfig("stylePrefix"),a="".concat(o,"mdl-dialog-tml"),c="".concat(o,"mdl-dialog-md");e.domtoimage=W(),n.add("open-templates",{run:function(e,n){var r=document.querySelector(".".concat(o,"mdl-dialog"));r.classList.add(a),(null==n?void 0:n.set)&&n.set("active"),i.setTitle(t.mdlTitle),i.setContent(e.TemplateManager.render()),i.open(),i.getModel().once("change:open",(function(){r.classList.remove(a)}))}}),n.add("open-settings",{run:function(e,n){var r=document.querySelector(".".concat(o,"mdl-dialog"));r.classList.add(c),(null==n?void 0:n.set)&&n.set("active"),i.setTitle(t.mdlTitle),i.setContent(e.SettingsApp.render()),i.open(),i.getModel().once("change:open",(function(){r.classList.remove(c)}))}}),n.add("open-pages",{run:function(e){e.PagesApp.showPanel()},stop:function(e){e.PagesApp.hidePanel()}});var s=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)}))},l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;W().toJpeg(e,t).then((function(e){return n&&n(e)})).catch((function(e){return r&&r(e)}))};n.add("get-uuidv4",(function(){if(crypto)return crypto.randomUUID?crypto.randomUUID():s()})),n.add("take-screenshot",(function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{clb:function(e){return e}},i=e.getWrapper().getEl();l(i,{quality:t.quality,height:1e3,cacheBust:!0,style:K({"background-color":"white"},e.getWrapper().getStyle())},r.clb,t.onScreenshotError)})),n.add("save-as-template",(function(e){r.setIsTemplate(!0),e.store()})),n.add("delete-template",(function(e){r.delete(t.onDelete,t.onDeleteError)}))};var Y="indexeddb",Q="rest-api",Z="firestore",ee=["id"];function te(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){ie(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const oe=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.StorageManager,i=Y,o=n.objectStoreName,a=function(){return t},c=function(e){if(t)e(t);else{var a=(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB).open(n.dbName,n.indexeddbVersion),c=function(){return r.onError(i,a.errorCode)};a.onerror=c,a.onsuccess=function(){(t=a.result).onerror=c,e(t)},a.onupgradeneeded=function(e){e.currentTarget.result.createObjectStore(o,{keyPath:"id"}).createIndex("name","name",{unique:!1})}}},s=function(){return t.transaction([o],"readwrite").objectStore(o)},l=function(e){t?e(s()):c((function(t){return e(s())}))};r.add(i,{currentName:"Default",currentId:"uuidv4",currentThumbnail:"",isTemplate:!1,description:"No description",getDb:a,getObjectStore:s,setId:function(e){this.currentId=e},setName:function(e){this.currentName=e},setThumbnail:function(e){this.currentThumbnail=e},setIsTemplate:function(e){this.isTemplate=!!e},setDescription:function(e){this.description=e},load:function(e,t,n){var r=this;l((function(e){var i=e.get(r.currentId);i.onerror=n,i.onsuccess=function(){t&&t(i.result)}}))},loadAll:function(e,t){l((function(n){var r=n.getAll();r.onerror=t,r.onsuccess=function(){e&&e(r.result)}}))},store:function(e,t,n){var r=this;l((function(i){var o=i.put(re({id:r.currentId,name:r.currentName,template:r.isTemplate,thumbnail:r.currentThumbnail,description:r.description,updated_at:Date()},e));o.onerror=n,o.onsuccess=t}))},update:function(e,t,n){var r=e.id,i=te(e,ee);l((function(e){var o=e.get(r);o.onerror=n,o.onsuccess=function(){e.put(re(re({id:r},o.result),i)),t&&t(o.result)}}))},delete:function(e,t,n){var r=this;l((function(i){var o=i.delete(n||r.currentId);o.onerror=t,o.onsuccess=e}))}})};function ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(n),!0).forEach((function(t){se(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ae(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const le=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.StorageManager,r=Q,i=n.get("remote");n.add(r,{currentName:"Default",currentId:"uuidv4",currentThumbnail:"",isTemplate:!1,description:"No description",setId:function(e){this.currentId=e},setName:function(e){this.currentName=e},setThumbnail:function(e){this.currentThumbnail=e},setIsTemplate:function(e){this.isTemplate=!!e},setDescription:function(e){this.description=e},load:function(e,t,n){var r=i.get("urlLoad"),o=r.endsWith("/")?this.currentId:"/".concat(this.currentId);i.set({urlLoad:r+o}),i.load(e,t,n),i.set({urlLoad:r})},loadAll:function(e,t){i.load({},e,t)},store:function(e,n,r){var o=i.get("urlStore"),a=o.endsWith("/")?this.currentId:"/".concat(this.currentId);t.uuidInPath&&i.set({urlStore:o+a}),i.store(ce({id:this.currentId,name:this.currentName,template:this.isTemplate,thumbnail:this.currentThumbnail,description:this.description,updated_at:Date()},e),n,r),i.set({urlStore:o})},update:function(e,t,n){var r=i.get("urlLoad"),o=e.id;o=r.endsWith("/")?o:"/".concat(o),i.set({urlLoad:r+o}),i.load({},(function(r){var a=ce(ce({},r),e),c=i.get("urlStore");o=e.id,o=c.endsWith("/")?o:"/".concat(o),i.request(c+o,{method:"post",body:a},t,n)}),n),i.set({urlLoad:r})},delete:function(e,t,n){var r=i.get("urlDelete"),o=n||this.currentId;o=r.endsWith("/")?o:"/".concat(o),i.request(r+o,{method:"delete"},e,t)}})};var ue=["id"];function de(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(n),!0).forEach((function(t){he(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function he(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ge=function(e){var t,n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=e.StorageManager,a=Z,c=i.apiKey,s=i.authDomain,l=i.projectId,u=i.settings,d=function(){return n},p=function(e){if(r)return e(r);firebase.apps.length?(firebase.app(),(t=firebase.firestore()).settings(u)):(firebase.initializeApp(fe({apiKey:c,authDomain:s,projectId:l},i.firebaseConfig)),(t=firebase.firestore()).settings(u));r=t.collection(i.objectStoreName),e(r)},f=function(t){p((function(r){var i=e.Storage.getCurrentStorage();n=r.doc(i.currentId),t(n)}))};o.add(a,{currentName:"Default",currentId:"uuidv4",currentThumbnail:"",isTemplate:!1,description:"No description",getDoc:d,setDocId:function(e){this.currentId=e},setId:function(e){this.currentId=e},setName:function(e){this.currentName=e},setThumbnail:function(e){this.currentThumbnail=e},setIsTemplate:function(e){this.isTemplate=!!e},setDescription:function(e){this.description=e},load:function(e,t,n){f((function(e){e.get().then((function(e){e.exists?t(e.data()):t({})})).catch(n)}))},loadAll:function(e,t){p((function(n){n.get().then((function(t){var n=[];t.forEach((function(e){return n.push(e.data())})),e(n)})).catch(t)}))},store:function(e,t,n){var r=this;p((function(i){i.doc(e.id||r.currentId).set(fe({id:r.currentId,name:r.currentName,template:r.isTemplate,thumbnail:r.currentThumbnail,description:r.description,updated_at:Date()},e)).then(t).catch(n)}))},update:function(e,t,n){var r=e.id,i=de(e,ue);p((function(e){e.doc(r).set(i,{merge:!0}).then(t).catch(n)}))},delete:function(e,t,n){n?p((function(r){r.doc(n).delete().then(e).catch(t)})):f((function(n){n.delete().then(e).catch(t)}))}})},me=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};oe(e,t),le(e,t),ge(e,t)},ve={"grapesjs-project-manager":{templates:{all:"All",templates:"Templates",search:"Search for sites by name or id",open:"Open",new:"Enter new page name",create:"Create",help:"Select a template, enter project name, then click create. If no template is selected a blank project will be created.",info:"Site Info",updated:"Last Updated",pages:"Pages",created:"Created At",size:"Size",actions:"Actions",titles:{open:"Select to open site",info:"Click to sort by site name",updated:"Click to sort by last update date",pages:"Click to sort by number of pages",created:"Click to sort by site creation date",size:"Click to sort by site size",actions:"Click to sort by site name",delete:"Delete",edit:"Edit"}},pages:{placeholder:"page name",new:"New Page +"},settings:{save:"Save",generate:"Generate",help:"Enter url, or generate thumbnail.",labels:{name:"Name",thumbnail:"Thumbnail",description:"Description",template:"Template"},placeholders:{name:"Name...",thumbnail:"Thumbnail...",description:"Description..."}}}};function be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?be(Object(n),!0).forEach((function(t){je(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const we=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ye(ye({},{dbName:"gjs",objectStoreName:"projects",loadFirst:!0,customLoad:!1,uuidInPath:!0,indexeddbVersion:5,onDelete:function(e){console.log("Deleted:",e)},onDeleteError:function(e){console.log(e)},onScreenshotError:function(e){console.log(e)},quality:.01,mdlTitle:"Project Manager",nopages:'<div style="display:flex;align-items:center;padding:50px;margin:auto;">No Projects Yet</div>',apiKey:"",authDomain:"",projectId:"",enableOffline:!0,firebaseConfig:{},settings:{timestampsInSnapshots:!0},size:!1,currentPageOpen:function(){console.log("Current page already open")},i18n:{}}),t);e.I18n.addMessages(ye({en:ve},n.i18n)),e.TemplateManager=new S(e,n),e.PagesApp=new _(e,n),e.SettingsApp=new q(e,n),X(e,n),me(e,n),e.on("load",(function(){var t=e.Storage.getCurrentStorage(),r=n.customLoad;r&&"function"==typeof r&&r(e,t),!r&&t.loadAll((function(r){var i=r[0];i&&n.loadFirst?(t.setId(i.id),t.setName(i.name),t.setThumbnail(i.thumbnail),t.setIsTemplate(i.template),e.load()):(t.setId(e.runCommand("get-uuidv4")),t.setName("Default-".concat(t.currentId.substr(0,7))),n.components&&e.setComponents(n.components),n.style&&e.setStyle(n.style))}))}))}})(),r})()));
\ No newline at end of file
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@schukai/grapesjs-project-manager"]=t():e["@schukai/grapesjs-project-manager"]=t()}(self,(()=>(()=>{var e={306:function(e){!function(t){"use strict";var n=function(){return{escape:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},parseExtension:t,mimeType:function(e){var n=t(e).toLowerCase();return(r="application/font-woff",i="image/jpeg",{woff:r,woff2:r,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:i,jpeg:i,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"})[n]||"";var r,i},dataAsUrl:function(e,t){return"data:"+t+";base64,"+e},isDataUrl:function(e){return-1!==e.search(/^(data:)/)},canvasToBlob:function(e){return e.toBlob?new Promise((function(t){e.toBlob(t)})):function(e){return new Promise((function(t){for(var n=window.atob(e.toDataURL().split(",")[1]),r=n.length,i=new Uint8Array(r),o=0;o<r;o++)i[o]=n.charCodeAt(o);t(new Blob([i],{type:"image/png"}))}))}(e)},resolveUrl:function(e,t){var n=document.implementation.createHTMLDocument(),r=n.createElement("base");n.head.appendChild(r);var i=n.createElement("a");return n.body.appendChild(i),r.href=t,i.href=e,i.href},getAndEncode:function(e){var t=3e4;c.impl.options.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());return new Promise((function(n){var r,i=new XMLHttpRequest;if(i.onreadystatechange=a,i.ontimeout=s,i.responseType="blob",i.timeout=t,i.open("GET",e,!0),i.send(),c.impl.options.imagePlaceholder){var o=c.impl.options.imagePlaceholder.split(/,/);o&&o[1]&&(r=o[1])}function a(){if(4===i.readyState)if(200===i.status){var t=new FileReader;t.onloadend=function(){var e=t.result.split(/,/)[1];n(e)},t.readAsDataURL(i.response)}else r?n(r):l("cannot fetch resource: "+e+", status: "+i.status)}function s(){r?n(r):l("timeout of "+t+"ms occured while fetching resource: "+e)}function l(e){console.error(e),n("")}}))},uid:(e=0,function(){return"u"+t()+e++;function t(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)}}),delay:function(e){return function(t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))}},asArray:function(e){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t},escapeXhtml:function(e){return e.replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=n,r.src=e}))},width:function(e){var t=n(e,"border-left-width"),r=n(e,"border-right-width");return e.scrollWidth+t+r},height:function(e){var t=n(e,"border-top-width"),r=n(e,"border-bottom-width");return e.scrollHeight+t+r}};var e;function t(e){var t=/\.([^\.\/]*?)$/g.exec(e);return t?t[1]:""}function n(e,t){var n=window.getComputedStyle(e).getPropertyValue(t);return parseFloat(n.replace("px",""))}}(),r=function(){var e=/url\(['"]?([^'"]+?)['"]?\)/g;return{inlineAll:function(e,n,o){return a()?Promise.resolve(e):Promise.resolve(e).then(r).then((function(t){var r=Promise.resolve(e);return t.forEach((function(e){r=r.then((function(t){return i(t,e,n,o)}))})),r}));function a(){return!t(e)}},shouldProcess:t,impl:{readUrls:r,inline:i}};function t(t){return-1!==t.search(e)}function r(t){for(var r,i=[];null!==(r=e.exec(t));)i.push(r[1]);return i.filter((function(e){return!n.isDataUrl(e)}))}function i(e,t,r,i){return Promise.resolve(t).then((function(e){return r?n.resolveUrl(e,r):e})).then(i||n.getAndEncode).then((function(e){return n.dataAsUrl(e,n.mimeType(t))})).then((function(r){return e.replace(function(e){return new RegExp("(url\\(['\"]?)("+n.escape(e)+")(['\"]?\\))","g")}(t),"$1"+r+"$3")}))}}(),i=function(){return{resolveAll:function(){return e(document).then((function(e){return Promise.all(e.map((function(e){return e.resolve()})))})).then((function(e){return e.join("\n")}))},impl:{readAll:e}};function e(){return Promise.resolve(n.asArray(document.styleSheets)).then((function(e){var t=[];return e.forEach((function(e){try{n.asArray(e.cssRules||[]).forEach(t.push.bind(t))}catch(t){console.log("Error while reading CSS rules from "+e.href,t.toString())}})),t})).then((function(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return r.shouldProcess(e.style.getPropertyValue("src"))}))})).then((function(t){return t.map(e)}));function e(e){return{resolve:function(){var t=(e.parentStyleSheet||{}).href;return r.inlineAll(e.cssText,t)},src:function(){return e.style.getPropertyValue("src")}}}}}(),o=function(){return{inlineAll:function t(i){return i instanceof Element?o(i).then((function(){return i instanceof HTMLImageElement?e(i).inline():Promise.all(n.asArray(i.childNodes).map((function(e){return t(e)})))})):Promise.resolve(i);function o(e){var t=e.style.getPropertyValue("background");return t?r.inlineAll(t).then((function(t){e.style.setProperty("background",t,e.style.getPropertyPriority("background"))})).then((function(){return e})):Promise.resolve(e)}},impl:{newImage:e}};function e(e){return{inline:function(t){return n.isDataUrl(e.src)?Promise.resolve():Promise.resolve(e.src).then(t||n.getAndEncode).then((function(t){return n.dataAsUrl(t,n.mimeType(e.src))})).then((function(t){return new Promise((function(n,r){e.onload=n,e.onerror=r,e.src=t}))}))}}}}(),a={imagePlaceholder:void 0,cacheBust:!1},c={toSvg:s,toPng:function(e,t){return l(e,t||{}).then((function(e){return e.toDataURL()}))},toJpeg:function(e,t){return l(e,t=t||{}).then((function(e){return e.toDataURL("image/jpeg",t.quality||1)}))},toBlob:function(e,t){return l(e,t||{}).then(n.canvasToBlob)},toPixelData:function(e,t){return l(e,t||{}).then((function(t){return t.getContext("2d").getImageData(0,0,n.width(e),n.height(e)).data}))},impl:{fontFaces:i,images:o,util:n,inliner:r,options:{}}};function s(e,t){return function(e){void 0===e.imagePlaceholder?c.impl.options.imagePlaceholder=a.imagePlaceholder:c.impl.options.imagePlaceholder=e.imagePlaceholder;void 0===e.cacheBust?c.impl.options.cacheBust=a.cacheBust:c.impl.options.cacheBust=e.cacheBust}(t=t||{}),Promise.resolve(e).then((function(e){return u(e,t.filter,!0)})).then(d).then(p).then((function(e){t.bgcolor&&(e.style.backgroundColor=t.bgcolor);t.width&&(e.style.width=t.width+"px");t.height&&(e.style.height=t.height+"px");t.style&&Object.keys(t.style).forEach((function(n){e.style[n]=t.style[n]}));return e})).then((function(r){return function(e,t,r){return Promise.resolve(e).then((function(e){return e.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),(new XMLSerializer).serializeToString(e)})).then(n.escapeXhtml).then((function(e){return'<foreignObject x="0" y="0" width="100%" height="100%">'+e+"</foreignObject>"})).then((function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+r+'">'+e+"</svg>"})).then((function(e){return"data:image/svg+xml;charset=utf-8,"+e}))}(r,t.width||n.width(e),t.height||n.height(e))}))}function l(e,t){return s(e,t).then(n.makeImage).then(n.delay(100)).then((function(r){var i=function(e){var r=document.createElement("canvas");if(r.width=t.width||n.width(e),r.height=t.height||n.height(e),t.bgcolor){var i=r.getContext("2d");i.fillStyle=t.bgcolor,i.fillRect(0,0,r.width,r.height)}return r}(e);return i.getContext("2d").drawImage(r,0,0),i}))}function u(e,t,r){return r||!t||t(e)?Promise.resolve(e).then((function(e){return e instanceof HTMLCanvasElement?n.makeImage(e.toDataURL()):e.cloneNode(!1)})).then((function(r){return function(e,t,r){var i=e.childNodes;return 0===i.length?Promise.resolve(t):o(t,n.asArray(i),r).then((function(){return t}));function o(e,t,n){var r=Promise.resolve();return t.forEach((function(t){r=r.then((function(){return u(t,n)})).then((function(t){t&&e.appendChild(t)}))})),r}}(e,r,t)})).then((function(t){return function(e,t){return t instanceof Element?Promise.resolve().then(r).then(i).then(o).then(a).then((function(){return t})):t;function r(){function r(e,t){function r(e,t){n.asArray(e).forEach((function(n){t.setProperty(n,e.getPropertyValue(n),e.getPropertyPriority(n))}))}e.cssText?t.cssText=e.cssText:r(e,t)}r(window.getComputedStyle(e),t.style)}function i(){function r(r){var i=window.getComputedStyle(e,r),o=i.getPropertyValue("content");if(""!==o&&"none"!==o){var a=n.uid();t.className=t.className+" "+a;var c=document.createElement("style");c.appendChild(s(a,r,i)),t.appendChild(c)}function s(e,t,r){var i="."+e+":"+t,o=r.cssText?a(r):c(r);return document.createTextNode(i+"{"+o+"}");function a(e){var t=e.getPropertyValue("content");return e.cssText+" content: "+t+";"}function c(e){return n.asArray(e).map(t).join("; ")+";";function t(t){return t+": "+e.getPropertyValue(t)+(e.getPropertyPriority(t)?" !important":"")}}}}[":before",":after"].forEach((function(e){r(e)}))}function o(){e instanceof HTMLTextAreaElement&&(t.innerHTML=e.value),e instanceof HTMLInputElement&&t.setAttribute("value",e.value)}function a(){t instanceof SVGElement&&(t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t instanceof SVGRectElement&&["width","height"].forEach((function(e){var n=t.getAttribute(e);n&&t.style.setProperty(e,n)})))}}(e,t)})):Promise.resolve()}function d(e){return i.resolveAll().then((function(t){var n=document.createElement("style");return e.appendChild(n),n.appendChild(document.createTextNode(t)),e}))}function p(e){return o.inlineAll(e).then((function(){return e}))}e.exports=c}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";function e(e){throw new TypeError('"'+e+'" is read-only')}function t(t,n){var r,i={second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2592e6,year:31536e6},o=Math.round,a=function(e,t){return void 0===n?"".concat(t," ").concat(e+(t>1?"s":"")+" ago"):t+e.substring(0,1)},c=Date.now()-new Date(t).getTime();for(var s in c<0&&(e("ts"),e("dir")),i){if(o(c)<i[s])return a(r||"m",o(c/(i[r]||1)));r=s}return a(s,o(c/i[s]))}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.r(r),n.d(r,{default:()=>we});var l=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c(this,e),this.editor=t,this.$=t.$,this.pfx=t.getConfig("stylePrefix"),this.id=t.Storage.getConfig().id,this.opts=n,this.setState=this.setState.bind(this),this.setStateSilent=this.setStateSilent.bind(this),this.onRender=this.onRender.bind(this),this.handleTabs=this.handleTabs.bind(this)}var t,n,r;return t=e,(n=[{key:"setState",value:function(e){this.state=o(o({},this.state),e),this.update()}},{key:"setStateSilent",value:function(e){this.state=o(o({},this.state),e)}},{key:"sm",get:function(){return this.editor.Storage}},{key:"cs",get:function(){return this.editor.Storage.getCurrentStorage()}},{key:"pm",get:function(){return this.editor.Pages}},{key:"onRender",value:function(){}},{key:"handleTabs",value:function(){}}])&&s(t.prototype,n),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function u(e){return d(e)/1024}function d(e){return(new TextEncoder).encode(JSON.stringify(e)).length}function p(e,t){return!(!t||!e)&&t.toLowerCase().indexOf(e.toLowerCase())>-1}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=P(e);if(t){var i=P(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}const S=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}(a,e);var n,r,i,o=j(a);function a(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return v(this,a),(t=o.call(this,e,n)).handleSort=t.handleSort.bind(O(t)),t.handleFilterInput=t.handleFilterInput.bind(O(t)),t.handleNameInput=t.handleNameInput.bind(O(t)),t.handleOpen=t.handleOpen.bind(O(t)),t.handleCreate=t.handleCreate.bind(O(t)),t.handleDelete=t.handleDelete.bind(O(t)),t.openEdit=t.openEdit.bind(O(t)),t.state={editableProjectId:"",projectId:"",tab:"pages",sites:[],nameText:"",filterText:"",loading:!1,sortBy:"published_at",sortOrder:"desc"},t}return n=a,(r=[{key:"editableId",get:function(){return this.state.editableProjectId}},{key:"allSites",get:function(){return this.state.sites}},{key:"allSitesSize",get:function(){return u(this.state.sites)}},{key:"onRender",value:function(){var e=this.setState,t=this.cs;e({loading:!0}),t.loadAll((function(t){e({sites:t,loading:!1})}),(function(e){return console.log("Error",e)}))}},{key:"handleFilterInput",value:function(e){this.setState({filterText:e.target.value.trim()})}},{key:"handleNameInput",value:function(e){this.setStateSilent({nameText:e.target.value.trim()})}},{key:"handleSort",value:function(e){var t=this.state.sortOrder;e.target&&e.target.dataset&&this.setState({sortBy:e.target.dataset.sort,sortOrder:"desc"===t?"asc":"desc"})}},{key:"handleTabs",value:function(e){var t=e.target,n=this.$el,r=this.pfx,i=this.$;n.find(".".concat(r,"tablinks")).removeClass("active"),i(t).addClass("active"),"pages"===t.id?this.setState({tab:"pages"}):this.setState({tab:"templates"})}},{key:"handleOpen",value:function(e){var t=this.editor,n=this.cs,r=this.state.projectId;r&&r!==n.currentId?(n.setId(r),t.load((function(e){n.setName(e.name),n.setThumbnail(e.thumbnail||""),n.setIsTemplate(e.template),n.setDescription(e.description||"No description"),t.Modal.close()}))):this.opts.currentPageOpen()}},{key:"handleCreate",value:function(e){var t=this.editor,n=this.cs,r=this.state,i=r.projectId,o=r.nameText,a=t.runCommand("get-uuidv4"),c=o||"New-"+a.substr(0,8),s={id:a,name:c,template:!1,thumbnail:"",styles:"[]",description:"No description"};s["".concat(this.id,"pages")]='[{"id": "'.concat(crypto.randomUUID().substr(0,8),'", "name": "index"}]'),s["".concat(this.id,"styles")]="[]",s["".concat(this.id,"assets")]="[]",i?(n.setId(i),n.setIsTemplate(!1),t.load((function(e){n.setId(a),n.setName(c),n.setThumbnail(e.thumbnail||""),n.setDescription(e.description||"No description"),t.Modal.close()}))):(n.setId(a),n.store(s,(function(e){n.setIsTemplate(!1),t.load((function(e){n.setId(e.id),n.setName(e.name),n.setThumbnail(e.thumbnail||""),n.setDescription(e.description||"No description"),t.Modal.close()}))})))}},{key:"openEdit",value:function(e){var t=this.editor;(0,this.setStateSilent)({editableProjectId:e.currentTarget.dataset.id}),t.Modal.close(),t.SettingsApp.setTab("project"),t.runCommand("open-settings")}},{key:"handleEdit",value:function(e){this.cs.update(g(g({},e),{},{updated_at:Date()}))}},{key:"handleDelete",value:function(e){var t=this.cs,n=this.setState,r=this.opts;t.delete((function(e){r.onDelete(e),t.loadAll((function(e){return n({sites:e})}),(function(e){return console.log("Error",e)}))}),r.onDeleteError,e.currentTarget.dataset.id)}},{key:"renderSiteList",value:function(){var e,n=this,r=this.state,i=r.sites,o=r.tab,a=r.filterText,c=r.loading,s=r.sortBy,l=r.sortOrder,d=this.pfx,f=this.opts,h=this.cs,g=this.editor;if(c)return f.loader||"<div>Loading sites...</div>";if(!i.length)return f.nosites||"<div>No Sites</div>";"id"===s?e=function(e,t){return function(n,r){if("asc"===t){if(n[e]<r[e])return-1;if(n[e]>r[e])return 1}return n[e]>r[e]?-1:n[e]<r[e]?1:0}}(s,l):"updated_at"===s||"created_at"===s?e=function(e,t){return function(n,r){var i=new Date(n[e]).getTime(),o=new Date(r[e]).getTime();return"asc"===t?i-o:o-i}}(s,l):"pages"===s?e=function(e,t){return function(n,r){var i=JSON.parse(n[e]),o=JSON.parse(r[e]);if("desc"===t){if(i.length<o.length)return-1;if(i.length>o.length)return 1}return i.length>o.length?-1:i.length<o.length?1:0}}(this.id+s,l):"size"===s&&(e=function(e){return function(t,n){var r=u(t),i=u(n);if("asc"===e){if(r<i)return-1;if(r>i)return 1}return r>i?-1:r<i?1:0}}(l));var m=i.sort(e).filter((function(e){if(!a&&"pages"===o)return!0;var t=e.id,n=e.name,r=e.template;return!(!p(a,t)&&!p(a,n)||"pages"!==o)||!("templates"!==o||!r)})).map((function(e,r){var i=e.id,o=e.name,a=e.description,c=e.thumbnail,s=e.created_at,l=e.updated_at,p=u(e),m=JSON.parse(e["".concat(n.id,"pages")]),v=l?t(new Date(l).getTime()):"NA",b=s?t(new Date(s).getTime()):"NA",y=m.map((function(e){return e.name})).join(", ");return'<div \n class="site-wrapper '.concat(h.currentId===i?"open":"",'" \n key="').concat(r,'" \n data-id="').concat(i,'" \n title="').concat(g.I18n.t("grapesjs-project-manager.templates.titles.open"),'">\n <div class="site-screenshot">\n <img src="').concat(c,'" alt="" />\n </div>\n <div class="site-info">\n <h2>\n ').concat(o,'\n </h2>\n <div class="site-meta">\n ').concat(a,'\n </div>\n </div>\n <div class="site-update-time">').concat(v,'</div>\n <div class="site-pages">\n <div title="').concat(y||i,'">\n ').concat(m.length||1,'\n </div>\n </div>\n <div class="site-create-time">').concat(b,"</div>\n ").concat(f.size?'<div class="site-size" title="'.concat(p,' KB">\n ').concat(p.toFixed(2)," KB\n </div>"):"",'\n <div class="site-actions">\n <i class="').concat(d,'caret-icon fa fa-hand-pointer-o edit" title="').concat(g.I18n.t("grapesjs-project-manager.templates.titles.edit"),'" data-id="').concat(i,'"></i>\n ').concat(h.currentId!==i?'<i class="'.concat(d,'caret-icon fa fa-trash-o delete" title="').concat(g.I18n.t("grapesjs-project-manager.templates.titles.delete"),'" data-id="').concat(i,'"></i>'):"","\n </div>\n </div>")})).join("\n");if(!m.length){if("templates"===o)return f.nosites||"<div>No Templates Available.</div>";m="<div>\n <h3>\n No '".concat(a,"' examples found. Clear your search and try again.\n </h3>\n </div>")}return m}},{key:"renderSiteActions",value:function(){var e=this.editor;return"pages"===this.state.tab?'<div class="flex-row">\n <input \n class="search tm-input" \n placeholder="'.concat(e.I18n.t("grapesjs-project-manager.templates.search"),'"\n />\n <button id="open" class="primary-button">\n ').concat(e.I18n.t("grapesjs-project-manager.templates.open"),"\n </button>\n </div>"):'<div class="'.concat(this.pfx,"tip-about ").concat(this.pfx,'four-color">\n ').concat(e.I18n.t("grapesjs-project-manager.templates.help"),'\n </div>\n <div class="flex-row">\n <input \n class="name tm-input" \n placeholder="').concat(e.I18n.t("grapesjs-project-manager.templates.new"),'"\n />\n <button id="create" class="primary-button">\n ').concat(e.I18n.t("grapesjs-project-manager.templates.create"),"\n </button>\n </div>")}},{key:"renderThumbnail",value:function(e,t){var n='<img src="'.concat(e,'" alt="" />');return e?n:t.html?'<svg xmlns="http://www.w3.org/2000/svg" class="template-preview" viewBox="0 0 1300 1100" width="99%" height="220">\n <foreignObject width="100%" height="100%" style="pointer-events:none">\n <div xmlns="http://www.w3.org/1999/xhtml">\n '.concat(t.html+"<style scoped>"+t.css+"</style>","\n </div>\n </foreignObject>\n </svg>"):n}},{key:"update",value:function(){var e,t,n,r,i,o,a,c,s,l=this;null===(e=this.$el)||void 0===e||e.find("#site-list").html(this.renderSiteList()),null===(t=this.$el)||void 0===t||t.find("#tm-actions").html(this.renderSiteActions());var u=null===(n=this.$el)||void 0===n?void 0:n.find(".site-wrapper"),d=null===(r=this.$el)||void 0===r?void 0:r.find("input.search"),p=null===(i=this.$el)||void 0===i?void 0:i.find("input.name");this.setStateSilent({projectId:""}),u&&u.on("click",(function(e){u.removeClass("selected"),l.$(e.currentTarget).addClass("selected"),l.setStateSilent({projectId:e.currentTarget.dataset.id})})),d&&(d.val(this.state.filterText),d.on("change",this.handleFilterInput)),p&&(p.val(this.state.nameText),p.on("change",this.handleNameInput)),null===(o=this.$el)||void 0===o||o.find("#open").on("click",this.handleOpen),null===(a=this.$el)||void 0===a||a.find("#create").on("click",this.handleCreate),null===(c=this.$el)||void 0===c||c.find("i.edit").on("click",this.openEdit),null===(s=this.$el)||void 0===s||s.find("i.delete").on("click",this.handleDelete)}},{key:"render",value:function(){var e,t=this.$,n=this.pfx,r=this.opts,i=this.editor,o=this.state.tab;this.onRender(),null===(e=this.$el)||void 0===e||e.remove();var a=t('<div class="app">\n <div class="contents">\n <div class="'.concat(n,'tab">\n <button id="pages" class="').concat(n,"tablinks ").concat("pages"===o?"active":"",'">\n ').concat(i.I18n.t("grapesjs-project-manager.templates.all"),'\n </button>\n <button id="templates" class="').concat(n,"tablinks ").concat("templates"===o?"active":"",'"">\n ').concat(i.I18n.t("grapesjs-project-manager.templates.templates"),'\n </button>\n </div>\n <div id="tm-actions">\n ').concat(this.renderSiteActions(),'\n </div>\n <div class="site-wrapper-header">\n <div\n class="site-screenshot-header header"\n data-sort="id"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.info"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.info"),'\n </div>\n <div\n class="site-info header"\n data-sort="id"\n ></div>\n <div\n class="site-update-time header"\n data-sort="updated_at"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.updated"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.updated"),'\n </div>\n <div\n class="site-pages header"\n data-sort="pages"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.pages"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.pages"),'\n </div>\n <div\n class="site-create-time header"\n data-sort="created_at"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.created"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.created"),"\n </div>\n ").concat(r.size?'<div\n class="site-size header"\n data-sort="size"\n title="'.concat(i.I18n.t("grapesjs-project-manager.templates.titles.size"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.size"),"\n </div>"):"",'\n <div\n class="site-actions header"\n data-sort="id"\n title="').concat(i.I18n.t("grapesjs-project-manager.templates.titles.actions"),'"\n >\n ').concat(i.I18n.t("grapesjs-project-manager.templates.actions"),'\n </div>\n </div>\n <div id="site-list">\n ').concat(this.renderSiteList(),"\n </div>\n </div>\n </div>"));return a.find(".header").on("click",this.handleSort),a.find("#pages, #templates").on("click",this.handleTabs),this.$el=a,a}}])&&b(n.prototype,r),i&&b(n,i),Object.defineProperty(n,"prototype",{writable:!1}),a}(l);function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function T(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function E(e,t){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},E(e,t)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return C(this,n)}}function C(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return N(e)}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var _=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&E(e,t)}(o,e);var t,n,r,i=A(o);function o(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,o),(t=i.call(this,e,n)).addPage=t.addPage.bind(N(t)),t.selectPage=t.selectPage.bind(N(t)),t.removePage=t.removePage.bind(N(t)),t.isSelected=t.isSelected.bind(N(t)),t.handleNameInput=t.handleNameInput.bind(N(t)),t.openEdit=t.openEdit.bind(N(t)),t.state={editablePageId:"",isShowing:!0,nameText:"",pages:[],loading:!1},t}return t=o,(n=[{key:"editableId",get:function(){return this.state.editablePageId}},{key:"onRender",value:function(){var e=this.pm,t=this.setState,n=this.editor;t({loading:!0}),t({pages:T(e.getAll())}),n.on("page",(function(){t({pages:T(e.getAll())})})),t({loading:!1})}},{key:"isSelected",value:function(e){return this.pm.getSelected().id===e.id}},{key:"selectPage",value:function(e){this.pm.select(e.currentTarget.dataset.key),this.update()}},{key:"removePage",value:function(e){this.pm.remove(e.currentTarget.dataset.key),this.update()}},{key:"openEdit",value:function(e){var t=this.editor;this.setStateSilent({editablePageId:e.currentTarget.dataset.key}),t.Modal.close(),t.SettingsApp.setTab("page"),t.runCommand("open-settings")}},{key:"editPage",value:function(e,t){var n=this.pm.get(e);null==n||n.set("name",t),this.update()}},{key:"addPage",value:function(){var e=this.pm,t=this.state.nameText;t&&(e.add({name:t,component:""}),this.update())}},{key:"handleNameInput",value:function(e){this.setStateSilent({nameText:e.target.value.trim()})}},{key:"renderPagesList",value:function(){var e=this.state,t=e.pages,n=e.loading,r=this.opts,i=this.isSelected;return n?r.loader||"<div>Loading pages...</div>":t.map((function(e,t){return'<div \n data-id="'.concat(t,'" \n data-key="').concat(e.id,'" \n class="page ').concat(i(e)?"selected":"",'"\n >\n <i class="fa fa-file-o" style="margin:5px;"></i>\n ').concat(e.get("name")||e.id,"\n ").concat(i(e)?"":'<span class="page-close" data-key="'.concat(e.id,'">&Cross;</span>'),'\n <span class="page-edit" data-key="').concat(e.id,'"><i class="fa fa-hand-pointer-o"></i></span>\n </div>')})).join("\n")}},{key:"update",value:function(){var e,t,n,r;null===(e=this.$el)||void 0===e||e.find(".pages").html(this.renderPagesList()),null===(t=this.$el)||void 0===t||t.find(".page").on("click",this.selectPage),null===(n=this.$el)||void 0===n||n.find(".page-edit").on("click",this.openEdit),null===(r=this.$el)||void 0===r||r.find(".page-close").on("click",this.removePage)}},{key:"render",value:function(){var e,t=this.$,n=this.editor;this.onRender(),null===(e=this.$el)||void 0===e||e.remove();var r=t('<div style="display: '.concat(this.state.isShowing?"flex":"none",';" class="pages-wrp">\n <div class="pages">\n ').concat(this.renderPagesList(),'\n </div>\n <div class="flex-row">\n <input \n class="tm-input sm" \n type="text" \n placeholder="').concat(n.I18n.t("grapesjs-project-manager.pages.placeholder"),'" \n />\n </div>\n <div class="add-page">\n ').concat(n.I18n.t("grapesjs-project-manager.pages.new"),"\n </div>\n </div>"));return r.find(".add-page").on("click",this.addPage),r.find("input").on("change",this.handleNameInput),this.$el=r,r}},{key:"findPanel",get:function(){return this.editor.Panels.getPanel("views-container")}},{key:"showPanel",value:function(){var e;this.state.isShowing=!0,null===(e=this.findPanel)||void 0===e||e.set("appendContent",this.render()).trigger("change:appendContent"),this.update()}},{key:"hidePanel",value:function(){this.state.isShowing=!1,this.render()}}])&&D(t.prototype,n),r&&D(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(l);function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}function $(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},B(e,t)}function U(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=F(e);if(t){var i=F(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return z(this,n)}}function z(e,t){if(t&&("object"===L(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return V(e)}function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},F(e)}var q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&B(e,t)}(o,e);var t,n,r,i=U(o);function o(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return $(this,o),(t=i.call(this,e,n)).handleSave=t.handleSave.bind(V(t)),t.handleThumbnail=t.handleThumbnail.bind(V(t)),t.handleThumbnailInput=t.handleThumbnailInput.bind(V(t)),t.state={tab:"page",loading:!1},t}return t=o,(n=[{key:"setTab",value:function(e){this.state.tab=e}},{key:"update",value:function(){var e=this.$el;null==e||e.find("#settings").html(this.renderSettings()),null==e||e.find("#generate").on("click",this.handleThumbnail),null==e||e.find("input#thumbnail").on("change",this.handleThumbnailInput)}},{key:"onRender",value:function(){var e=this.setState;e({loading:!0}),e({loading:!1})}},{key:"handleSave",value:function(e){var t=this.$el,n=this.editor;if("page"===this.state.tab){var r=n.PagesApp.editableId,i=null==t?void 0:t.find("input.name").val().trim();r&&n.PagesApp.editPage(r,i)}else{var o=n.TemplateManager.editableId,a=null==t?void 0:t.find("input.thumbnail").val().trim(),c=null==t?void 0:t.find("input.name").val().trim(),s=null==t?void 0:t.find("input.desc").val().trim(),l=null==t?void 0:t.find("input.template").get(0).checked;o&&n.TemplateManager.handleEdit({id:o,thumbnail:a,name:c,description:s,template:l})}n.Modal.close()}},{key:"handleThumbnail",value:function(e){var t=this.editor,n=this.$el;t.runCommand("take-screenshot",{clb:function(e){null==n||n.find("input.thumbnail").val(e),null==n||n.find("img").attr("src",e)}})}},{key:"handleThumbnailInput",value:function(e){var t;null===(t=this.$el)||void 0===t||t.find("img").attr("src",e.target.value.trim())}},{key:"renderSettings",value:function(){var e=this.state,t=e.tab,n=e.loading,r=this.opts,i=this.pfx,o=this.pm,a=this.editor;if(n)return r.loader||"<div>Loading settings...</div>";if("page"===t){var c=o.get(a.PagesApp.editableId),s=(null==c?void 0:c.get("name"))||(null==c?void 0:c.id)||"";return'<label for="name">\n '.concat(a.I18n.t("grapesjs-project-manager.settings.labels.name"),'\n </label>\n <div class="flex-row">\n <input \n class="name tm-input" \n value="').concat(s,'" \n placeholder="').concat(a.I18n.t("grapesjs-project-manager.settings.placeholders.name"),'"/>\n </div>')}var l=a.TemplateManager.allSites.find((function(e){return e.id===a.TemplateManager.editableId}));return'<div class="'.concat(i,"tip-about ").concat(i,'four-color">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.help"),'\n </div>\n <label for="thumbnail">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.labels.thumbnail"),'\n </label>\n <div class="flex-row">\n <input \n id="thumbnail" \n class="thumbnail tm-input" \n value="').concat((null==l?void 0:l.thumbnail)||"",'" \n placeholder="').concat(a.I18n.t("grapesjs-project-manager.settings.placeholders.thumbnail"),'"\n />\n </div>\n <div class="flex-row" style="margin-bottom:15px;">\n <div class="site-screenshot">\n <img src="').concat((null==l?void 0:l.thumbnail)||"",'" alt="screenshot" />\n </div>\n <button id="generate" class="primary-button">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.generate"),'\n </button>\n </div>\n <label for="name">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.labels.name"),'\n </label>\n <div class="flex-row">\n <input \n id="name" \n class="name tm-input" \n value="').concat((null==l?void 0:l.name)||"",'" \n placeholder="').concat(a.I18n.t("grapesjs-project-manager.settings.placeholders.name"),'"\n />\n </div>\n <label for="desc">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.labels.description"),'\n </label>\n <div class="flex-row">\n <input \n id="desc" \n class="desc tm-input" \n value="').concat((null==l?void 0:l.description)||"",'" \n placeholder="').concat(a.I18n.t("grapesjs-project-manager.settings.placeholders.description"),'"\n />\n </div>\n <div class="flex-row group">\n <input id="template" class="template" type="checkbox" ').concat(null!=l&&l.template?"checked":"",'/>\n <label for="template">\n ').concat(a.I18n.t("grapesjs-project-manager.settings.labels.template"),"\n </label>\n </div>")}},{key:"render",value:function(){var e,t=this.$,n=this.editor;this.onRender(),null===(e=this.$el)||void 0===e||e.remove();var r=t('<div class="app">\n <div id="settings">\n '.concat(this.renderSettings(),'\n </div>\n <div class="flex-row">\n <button id="save" class="primary-button">\n ').concat(n.I18n.t("grapesjs-project-manager.settings.save"),"\n </button>\n </div>\n </div>"));return r.find("#save").on("click",this.handleSave),r.find("#generate").on("click",this.handleThumbnail),r.find("input#thumbnail").on("change",this.handleThumbnailInput),this.$el=r,r}}])&&M(t.prototype,n),r&&M(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(l),H=n(306),W=n.n(H);function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){G(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function G(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const X=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.Commands,r=e.Storage.getCurrentStorage(),i=e.Modal,o=e.getConfig("stylePrefix"),a="".concat(o,"mdl-dialog-tml"),c="".concat(o,"mdl-dialog-md");e.domtoimage=W(),n.add("open-templates",{run:function(e,n){var r=document.querySelector(".".concat(o,"mdl-dialog"));r.classList.add(a),(null==n?void 0:n.set)&&n.set("active"),i.setTitle(t.mdlTitle),i.setContent(e.TemplateManager.render()),i.open(),i.getModel().once("change:open",(function(){r.classList.remove(a)}))}}),n.add("open-settings",{run:function(e,n){var r=document.querySelector(".".concat(o,"mdl-dialog"));r.classList.add(c),(null==n?void 0:n.set)&&n.set("active"),i.setTitle(t.mdlTitle),i.setContent(e.SettingsApp.render()),i.open(),i.getModel().once("change:open",(function(){r.classList.remove(c)}))}}),n.add("open-pages",{run:function(e){e.PagesApp.showPanel()},stop:function(e){e.PagesApp.hidePanel()}});var s=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)}))},l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;W().toJpeg(e,t).then((function(e){return n&&n(e)})).catch((function(e){return r&&r(e)}))};n.add("get-uuidv4",(function(){if(crypto)return crypto.randomUUID?crypto.randomUUID():s()})),n.add("take-screenshot",(function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{clb:function(e){return e}},i=e.getWrapper().getEl();l(i,{quality:t.quality,height:1e3,cacheBust:!0,style:K({"background-color":"white"},e.getWrapper().getStyle())},r.clb,t.onScreenshotError)})),n.add("save-as-template",(function(e){r.setIsTemplate(!0),e.store()})),n.add("delete-template",(function(e){r.delete(t.onDelete,t.onDeleteError)}))};var Y="indexeddb",Q="rest-api",Z="firestore",ee=["id"];function te(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){ie(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const oe=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.StorageManager,i=Y,o=n.objectStoreName,a=function(){return t},c=function(e){if(t)e(t);else{var a=(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB).open(n.dbName,n.indexeddbVersion),c=function(){return r.onError(i,a.errorCode)};a.onerror=c,a.onsuccess=function(){(t=a.result).onerror=c,e(t)},a.onupgradeneeded=function(e){e.currentTarget.result.createObjectStore(o,{keyPath:"id"}).createIndex("name","name",{unique:!1})}}},s=function(){return t.transaction([o],"readwrite").objectStore(o)},l=function(e){t?e(s()):c((function(t){return e(s())}))};r.add(i,{currentName:"Default",currentId:"uuidv4",currentThumbnail:"",isTemplate:!1,description:"No description",getDb:a,getObjectStore:s,setId:function(e){this.currentId=e},setName:function(e){this.currentName=e},setThumbnail:function(e){this.currentThumbnail=e},setIsTemplate:function(e){this.isTemplate=!!e},setDescription:function(e){this.description=e},load:function(e,t,n){var r=this;l((function(e){var i=e.get(r.currentId);i.onerror=n,i.onsuccess=function(){t&&t(i.result)}}))},loadAll:function(e,t){l((function(n){var r=n.getAll();r.onerror=t,r.onsuccess=function(){e&&e(r.result)}}))},store:function(e,t,n){var r=this;l((function(i){var o=i.put(re({id:r.currentId,name:r.currentName,template:r.isTemplate,thumbnail:r.currentThumbnail,description:r.description,updated_at:Date()},e));o.onerror=n,o.onsuccess=t}))},update:function(e,t,n){var r=e.id,i=te(e,ee);l((function(e){var o=e.get(r);o.onerror=n,o.onsuccess=function(){e.put(re(re({id:r},o.result),i)),t&&t(o.result)}}))},delete:function(e,t,n){var r=this;l((function(i){var o=i.delete(n||r.currentId);o.onerror=t,o.onsuccess=e}))}})};function ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(n),!0).forEach((function(t){se(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ae(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const le=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.StorageManager,r=Q,i=n.get("remote");n.add(r,{currentName:"Default",currentId:"uuidv4",currentThumbnail:"",isTemplate:!1,description:"No description",setId:function(e){this.currentId=e},setName:function(e){this.currentName=e},setThumbnail:function(e){this.currentThumbnail=e},setIsTemplate:function(e){this.isTemplate=!!e},setDescription:function(e){this.description=e},load:function(e,t,n){var r=i.get("urlLoad"),o=r.endsWith("/")?this.currentId:"/".concat(this.currentId);i.set({urlLoad:r+o}),i.load(e,t,n),i.set({urlLoad:r})},loadAll:function(e,t){i.load({},e,t)},store:function(e,n,r){var o=i.get("urlStore"),a=o.endsWith("/")?this.currentId:"/".concat(this.currentId);t.uuidInPath&&i.set({urlStore:o+a}),i.store(ce({id:this.currentId,name:this.currentName,template:this.isTemplate,thumbnail:this.currentThumbnail,description:this.description,updated_at:Date()},e),n,r),i.set({urlStore:o})},update:function(e,t,n){var r=i.get("urlLoad"),o=e.id;o=r.endsWith("/")?o:"/".concat(o),i.set({urlLoad:r+o}),i.load({},(function(r){var a=ce(ce({},r),e),c=i.get("urlStore");o=e.id,o=c.endsWith("/")?o:"/".concat(o),i.request(c+o,{method:"post",body:a},t,n)}),n),i.set({urlLoad:r})},delete:function(e,t,n){var r=i.get("urlDelete"),o=n||this.currentId;o=r.endsWith("/")?o:"/".concat(o),i.request(r+o,{method:"delete"},e,t)}})};var ue=["id"];function de(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(n),!0).forEach((function(t){he(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function he(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ge=function(e){var t,n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=e.StorageManager,a=Z,c=i.apiKey,s=i.authDomain,l=i.projectId,u=i.settings,d=function(){return n},p=function(e){if(r)return e(r);firebase.apps.length?(firebase.app(),(t=firebase.firestore()).settings(u)):(firebase.initializeApp(fe({apiKey:c,authDomain:s,projectId:l},i.firebaseConfig)),(t=firebase.firestore()).settings(u));r=t.collection(i.objectStoreName),e(r)},f=function(t){p((function(r){var i=e.Storage.getCurrentStorage();n=r.doc(i.currentId),t(n)}))};o.add(a,{currentName:"Default",currentId:"uuidv4",currentThumbnail:"",isTemplate:!1,description:"No description",getDoc:d,setDocId:function(e){this.currentId=e},setId:function(e){this.currentId=e},setName:function(e){this.currentName=e},setThumbnail:function(e){this.currentThumbnail=e},setIsTemplate:function(e){this.isTemplate=!!e},setDescription:function(e){this.description=e},load:function(e,t,n){f((function(e){e.get().then((function(e){e.exists?t(e.data()):t({})})).catch(n)}))},loadAll:function(e,t){p((function(n){n.get().then((function(t){var n=[];t.forEach((function(e){return n.push(e.data())})),e(n)})).catch(t)}))},store:function(e,t,n){var r=this;p((function(i){i.doc(e.id||r.currentId).set(fe({id:r.currentId,name:r.currentName,template:r.isTemplate,thumbnail:r.currentThumbnail,description:r.description,updated_at:Date()},e)).then(t).catch(n)}))},update:function(e,t,n){var r=e.id,i=de(e,ue);p((function(e){e.doc(r).set(i,{merge:!0}).then(t).catch(n)}))},delete:function(e,t,n){n?p((function(r){r.doc(n).delete().then(e).catch(t)})):f((function(n){n.delete().then(e).catch(t)}))}})},me=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};oe(e,t),le(e,t),ge(e,t)},ve={"grapesjs-project-manager":{templates:{all:"All",templates:"Templates",search:"Search for sites by name or id",open:"Open",new:"Enter new page name",create:"Create",help:"Select a template, enter project name, then click create. If no template is selected a blank project will be created.",info:"Site Info",updated:"Last Updated",pages:"Pages",created:"Created At",size:"Size",actions:"Actions",titles:{open:"Select to open site",info:"Click to sort by site name",updated:"Click to sort by last update date",pages:"Click to sort by number of pages",created:"Click to sort by site creation date",size:"Click to sort by site size",actions:"Click to sort by site name",delete:"Delete",edit:"Edit"}},pages:{placeholder:"page name",new:"New Page +"},settings:{save:"Save",generate:"Generate",help:"Enter url, or generate thumbnail.",labels:{name:"Name",thumbnail:"Thumbnail",description:"Description",template:"Template"},placeholders:{name:"Name...",thumbnail:"Thumbnail...",description:"Description..."}}}};function be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?be(Object(n),!0).forEach((function(t){je(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const we=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ye(ye({},{dbName:"gjs",objectStoreName:"projects",loadFirst:!0,customLoad:!1,uuidInPath:!0,indexeddbVersion:5,onDelete:function(e){console.log("Deleted:",e)},onDeleteError:function(e){console.log(e)},onScreenshotError:function(e){console.log(e)},quality:.01,mdlTitle:"Project Manager",nopages:'<div style="display:flex;align-items:center;padding:50px;margin:auto;">No Projects Yet</div>',apiKey:"",authDomain:"",projectId:"",enableOffline:!0,firebaseConfig:{},settings:{timestampsInSnapshots:!0},size:!1,currentPageOpen:function(){console.log("Current page already open")},i18n:{}}),t);e.I18n.addMessages(ye({en:ve},n.i18n)),e.TemplateManager=new S(e,n),e.PagesApp=new _(e,n),e.SettingsApp=new q(e,n),X(e,n),me(e,n),e.on("load",(function(){var t,r=e.Storage.getCurrentStorage();if(null!=r&&null!==(t=r.loadAll)&&void 0!==t&&t.call){var i=n.customLoad;i&&"function"==typeof i&&i(e,r),!i&&r.loadAll((function(t){var i=t[0];i&&n.loadFirst?(r.setId(i.id),r.setName(i.name),r.setThumbnail(i.thumbnail),r.setIsTemplate(i.template),e.load()):(r.setId(e.runCommand("get-uuidv4")),r.setName("Default-".concat(r.currentId.substr(0,7))),n.components&&e.setComponents(n.components),n.style&&e.setStyle(n.style))}))}else console.error("Storage does not have loadAll method")}))}})(),r})()));
\ No newline at end of file
/*! @schukai/grapesjs-project-manager - 1.0.0 */
/*! @schukai/grapesjs-project-manager - 1.2.0 */
{"version":3,"sourceRoot":"","sources":["../source/styles.scss"],"names":[],"mappings":"AAKA,MACI,oCACA,4BAEA,gCAGJ,KACI,YACA,gBACA,qBAEA,OACI,qBACA,MAhBI,QAmBR,QACI,mBAGJ,QACI,MAxBI,QA2BR,YACI,eACA,yBACA,oBACA,WACA,oBACA,mBACA,uBACA,eACA,yBACA,4BACA,kBACA,sBACA,yBACA,0CACA,wBACA,6DACA,UACA,gBACA,WA9CI,QA+CJ,WACA,yBAIR,aACI,aACA,mBAEA,oBACI,iBAIR,gBACI,kBAEA,sBACI,mBAIR,UACI,aACA,8BACA,mBAEA,iBACI,YAIR,UACI,kBACA,eACA,kBACA,gBACA,qBACA,2CACA,YACA,aACA,wBACA,cACA,WACA,gCAEA,iDAGI,6BAGJ,aACI,WACA,YACA,eACA,cACA,iBAIR,QACI,eACA,iBACA,0BAGJ,MACI,kBAGJ,WACI,iBACA,gBACA,kBAGJ,mCAEI,aACA,mBACA,eACA,kBACA,eACA,eAGJ,uBACI,yBAGJ,sDAEI,sCAGJ,qBACI,kBACA,0CAGJ,wDAEI,gCAGJ,mDAEI,gCAGJ,yCAEI,YACA,kBACA,kBACA,kBACA,gBAGJ,wBACI,YAGJ,wBACI,mBACA,SACA,YACA,OACA,kBACA,QACA,MAGJ,mBACI,cACA,kBACA,UACA,YAGJ,qBACI,kBACA,WACA,cACA,YAGJ,gCACI,cACA,kBACA,MACA,OACA,WACA,YACA,yBACA,gBACA,cACA,kBACA,WAGJ,WACI,gBACA,gBAEA,cACI,WACA,kBAGJ,aACI,qBAIR,aACI,eACA,2BAGJ,kBACI,gBAGJ,kBACI,gBAGJ,uBAEI,eAGJ,cACI,gBAEA,gBACI,MArPI,QAsPJ,gCACA,yBACA,kBACA,YACA,eAEA,sBACI,iBA7PA,QA8PA,WAKZ,uBACI,kBACA,oBACA,MACA,WACA,YACA,uCAGJ,oBACI,iBACA,gBAGJ,mBACI,gBACA,gBAGJ,eACI,aACA,gBACA,gCACA,8BACA,gCACA,mBAGJ,SACI,gBACA,uCACA,mBAEA,gBACI,yBACA,cACA,WACA,gCACA,aACA,eACA,kBACA,eAEA,sBACI,gCAGJ,uBACI,gCAKZ,kBAEI,aACA,sBAGJ,WACI,YAGJ,aACI,YACA,SACA,uCAGJ,UACI,WAzUQ,QA0UR,WACA,eACA,gBACA,kBACA,eACA,mBACA,mBAGJ,MACI,eACA,gBACA,YACA,kBACA,kBACA,gCACA,qCACA,2BACA,qCACA,eAEA,YACI,MAhWI,QAiWJ,uCAGJ,eACI,MArWI,QAsWJ,yBACA,gCAIR,uBAEI,WACA,YACA,gCACA,gCACA,YACA,WACA,kBACA,kBAEA,mCACI,UAIR,WACI,iBAGJ,OACI,mBAEA,aACI,UACA,eACA,cACA,gBACA,aACA,eAEA,iCACI,WACA,cACA,kBACA,QACA,SACA,UACA,YACA,qBACA,yBACA,wBAIR,aACI,kBACA,eAEA,oBACI,WACA,wBACA,6BACA,yBACA,gFACA,aACA,qBACA,kBACA,sBACA,eACA,iBAKZ,kBACI,GACI,UAGJ,KACI","file":"grapesjs-project-manager.min.css"}
\ No newline at end of file
Source diff could not be displayed: it is too large. Options to address this: view the blob.
{
"name": "@schukai/grapesjs-project-manager",
"version": "1.0.0",
"description": "Grapesjs Project Manager",
"main": "dist/@schukai/grapesjs-project-manager.min.js",
"repository": {
"type": "git",
"url": "https://gitlab.schukai.com/oss/minerva/grapesjs-project-manager.git"
},
"scripts": {
"lint": "eslint source",
"build": "webpack --env production",
"build-dev": "npm run && webpack --env production",
"start": "webpack-cli serve --static dist --mode development --progress",
"postinstall": "npm-install-peers",
"build:css": "sass source/styles.scss dist/@schukai/grapesjs-project-manager.min.css --style compressed",
"watch:scss": "sass --watch source/styles.scss dist/@schukai/grapesjs-project-manager.min.css --style compressed"
},
"keywords": [
"grapesjs",
"plugin"
],
"devDependencies": {
"grapesjs-cli": "^1.0.14",
"sass": "^1.32.8",
"@babel/core": "^7.18.2",
"@babel/plugin-proposal-object-rest-spread": "^7.18.0",
"@babel/preset-env": "^7.18.2",
"@webpack-cli/init": "^1.1.3",
"babel-loader": "^8.2.5",
"eslint": "^8.16.0",
"html-webpack-plugin": "^5.5.0",
"raw-loader": "^4.0.2",
"terser-webpack-plugin": "^5.3.1",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.9.0",
"npm": "^8.11.0",
"npm-install-peers": "^1.2.2"
},
"author": "schukai GmbH, Brendon Ngirazi",
"license": "AGPL 3.0",
"dependencies": {
"dom-to-image": "^2.6.0"
},
"peerDependencies": {
"grapesjs": "0.x"
}
"name": "@schukai/grapesjs-project-manager",
"version": "1.2.0",
"description": "Grapesjs Project Manager",
"main": "dist/@schukai/grapesjs-project-manager.min.js",
"repository": {
"type": "git",
"url": "https://gitlab.schukai.com/oss/minerva/grapesjs-project-manager.git"
},
"scripts": {
"lint": "eslint source",
"build": "webpack --env production",
"build-dev": "npm run && webpack --env production",
"start": "webpack-cli serve --static dist --mode development --progress",
"postinstall": "npm-install-peers",
"build:css": "sass source/styles.scss dist/@schukai/grapesjs-project-manager.min.css --style compressed",
"watch:scss": "sass --watch source/styles.scss dist/@schukai/grapesjs-project-manager.min.css --style compressed"
},
"keywords": [
"grapesjs",
"plugin"
],
"devDependencies": {
"grapesjs-cli": "^1.0.14",
"sass": "^1.32.8",
"@babel/core": "^7.18.2",
"@babel/plugin-proposal-object-rest-spread": "^7.18.0",
"@babel/preset-env": "^7.18.2",
"@webpack-cli/init": "^1.1.3",
"babel-loader": "^8.2.5",
"eslint": "^8.16.0",
"html-webpack-plugin": "^5.5.0",
"raw-loader": "^4.0.2",
"terser-webpack-plugin": "^5.3.1",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.9.0",
"npm": "^8.11.0",
"npm-install-peers": "^1.2.2"
},
"author": "schukai GmbH, Brendon Ngirazi",
"license": "AGPL 3.0",
"dependencies": {
"dom-to-image": "^2.6.0"
},
"peerDependencies": {
"grapesjs": "0.x"
}
}