@stratusjs/angular 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stratusjs/angular",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "This is the angular package for StratusJS.",
5
5
  "scripts": {},
6
6
  "repository": {
@@ -33,12 +33,16 @@ System.register(["@angular/core", "@angular/common/http", "rxjs", "@stratusjs/ru
33
33
  BackendService = class BackendService {
34
34
  constructor(http) {
35
35
  this.http = http;
36
- this.title = 'tree-dnd';
36
+ this.title = 'backend';
37
37
  this.uid = lodash_1.default.uniqueId('sa_backend_service_');
38
38
  stratus_1.Stratus.Instances[this.uid] = this;
39
39
  this.cache = {};
40
40
  }
41
41
  get(url) {
42
+ if (!lodash_1.default.isString(url)) {
43
+ console.error('url is not a string:', url);
44
+ return;
45
+ }
42
46
  if (url in this.cache) {
43
47
  return this.cache[url].observable;
44
48
  }
@@ -50,6 +54,10 @@ System.register(["@angular/core", "@angular/common/http", "rxjs", "@stratusjs/ru
50
54
  return query.observable;
51
55
  }
52
56
  getData(url, subscriber) {
57
+ if (!lodash_1.default.isString(url)) {
58
+ console.error('url is not a string:', url);
59
+ return;
60
+ }
53
61
  if (!(url in this.cache)) {
54
62
  return;
55
63
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAsBa,cAAc,GAA3B,MAAa,cAAc;gBASvB,YAAoB,IAAgB;oBAAhB,SAAI,GAAJ,IAAI,CAAY;oBANpC,UAAK,GAAG,UAAU,CAAA;oBAQd,IAAI,CAAC,GAAG,GAAG,gBAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAA;oBAC5C,iBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;oBAGl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,gBAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;wBAClB,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAA;wBAC1C,OAAM;qBACT;oBAED,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE;wBACtB,OAAM;qBACT;oBACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;oBAE7B,IAAI,MAAM,IAAI,KAAK,EAAE;wBACjB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;wBAC3B,UAAU,CAAC,QAAQ,EAAE,CAAA;wBACrB,OAAM;qBACT;oBAED,IAAI,CAAC,IAAI;yBACJ,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;yBACjC,SAAS,CAAC,CAAC,QAA2B,EAAE,EAAE;wBACvC,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAA;wBACrB,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;wBACzB,UAAU,CAAC,QAAQ,EAAE,CAAA;oBACzB,CAAC,CAAC,CAAA;gBACV,CAAC;aACJ,CAAA;YA7DY,cAAc;gBAH1B,iBAAU,CAAC;oBACR,UAAU,EAAE,MAAM;iBACrB,CAAC;iDAU4B,iBAAU;eAT3B,cAAc,CA6D1B;;QACD,CAAC","file":"backend.service.js"}
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/common/http","rxjs","@stratusjs/runtime/stratus","lodash"],function(t,e){"use strict";var n,c,a,r,i,s,o=this&&this.__decorate||function(t,e,n,c){var a,r=arguments.length,i=r<3?e:null===c?c=Object.getOwnPropertyDescriptor(e,n):c;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,c);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(r<3?a(i):r>3?a(e,n,i):a(e,n))||i);return r>3&&i&&Object.defineProperty(e,n,i),i},u=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};e&&e.id;return{setters:[function(t){n=t},function(t){c=t},function(t){a=t},function(t){r=t},function(t){i=t}],execute:function(){s=class{constructor(t){this.http=t,this.title="tree-dnd",this.uid=i.default.uniqueId("sa_backend_service_"),r.Stratus.Instances[this.uid]=this,this.cache={}}get(t){if(t in this.cache)return this.cache[t].observable;const e=new Date;return(this.cache[t]={fetched:e.valueOf(),observable:new a.Observable(e=>this.getData(t,e))}).observable}getData(t,e){if(!(t in this.cache))return;const n=this.cache[t];if("data"in n)return e.next(n.data),void e.complete();this.http.get(t,{observe:"response"}).subscribe(t=>{n.data=t,e.next(t),e.complete()})}},s=o([n.Injectable({providedIn:"root"}),u("design:paramtypes",[c.HttpClient])],s),t("BackendService",s)}}});
1
+ System.register(["@angular/core","@angular/common/http","rxjs","@stratusjs/runtime/stratus","lodash"],function(t,e){"use strict";var n,r,i,s,a,c,o=this&&this.__decorate||function(t,e,n,r){var i,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(a=(s<3?i(a):s>3?i(e,n,a):i(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a},u=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};e&&e.id;return{setters:[function(t){n=t},function(t){r=t},function(t){i=t},function(t){s=t},function(t){a=t}],execute:function(){c=class{constructor(t){this.http=t,this.title="backend",this.uid=a.default.uniqueId("sa_backend_service_"),s.Stratus.Instances[this.uid]=this,this.cache={}}get(t){if(!a.default.isString(t))return void console.error("url is not a string:",t);if(t in this.cache)return this.cache[t].observable;const e=new Date;return(this.cache[t]={fetched:e.valueOf(),observable:new i.Observable(e=>this.getData(t,e))}).observable}getData(t,e){if(!a.default.isString(t))return void console.error("url is not a string:",t);if(!(t in this.cache))return;const n=this.cache[t];if("data"in n)return e.next(n.data),void e.complete();this.http.get(t,{observe:"response"}).subscribe(t=>{n.data=t,e.next(t),e.complete()})}},c=o([n.Injectable({providedIn:"root"}),u("design:paramtypes",[r.HttpClient])],c),t("BackendService",c)}}});
@@ -23,7 +23,7 @@ export interface QueryMap {
23
23
  export class BackendService {
24
24
 
25
25
  // Basic Component Settings
26
- title = 'tree-dnd'
26
+ title = 'backend'
27
27
  uid: string
28
28
 
29
29
  // HTTP Logic
@@ -40,6 +40,10 @@ export class BackendService {
40
40
 
41
41
  // Create an Observable that returns XHR data
42
42
  get(url: string): Observable<HttpResponse<any>> {
43
+ if (!_.isString(url)) {
44
+ console.error('url is not a string:', url)
45
+ return // new Observable()
46
+ }
43
47
  if (url in this.cache) {
44
48
  return this.cache[url].observable
45
49
  }
@@ -53,6 +57,10 @@ export class BackendService {
53
57
 
54
58
  // This ensures the XHR only runs once per query by caching the data
55
59
  private getData(url: string, subscriber: Subscriber<any>) {
60
+ if (!_.isString(url)) {
61
+ console.error('url is not a string:', url)
62
+ return
63
+ }
56
64
  // The observable cache reference should always be available
57
65
  if (!(url in this.cache)) {
58
66
  return
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/material/dialog","@stratusjs/core/environment","@stratusjs/runtime/stratus"],function(t,e){"use strict";var n,o,a,i,r,s,c,f=this&&this.__decorate||function(t,e,n,o){var a,i=arguments.length,r=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(r=(i<3?a(r):i>3?a(e,n,r):a(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},l=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},u=this&&this.__param||function(t,e){return function(n,o){e(n,o,t)}};e&&e.id;return{setters:[function(t){n=t},function(t){o=t},function(t){a=t},function(t){i=t}],execute:function(){"@stratusjs/angular","confirm-dialog",r=a.cookie("env")?"":".min",s=`${i.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,c=class{constructor(t,e){this.dialogRef=t,this.data=e}onConfirm(){this.dialogRef.close(!0)}onDismiss(){this.dialogRef.close(!1)}},c=f([n.Component({selector:"sa-confirm-dialog",templateUrl:`${s}/confirm-dialog/confirm-dialog.component${r}.html`}),u(1,n.Inject(o.MAT_DIALOG_DATA)),l("design:paramtypes",[o.MatDialogRef,Object])],c),t("ChangesetViewerDialogComponent",c)}}});
1
+ System.register(["@angular/core","@angular/material/dialog","@stratusjs/core/environment","@stratusjs/runtime/stratus"],function(t,e){"use strict";var n,o,a,r,i,s,c,f,l=this&&this.__decorate||function(t,e,n,o){var a,r=arguments.length,i=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(r<3?a(i):r>3?a(e,n,i):a(e,n))||i);return r>3&&i&&Object.defineProperty(e,n,i),i},u=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},g=this&&this.__param||function(t,e){return function(n,o){e(n,o,t)}};e&&e.id;return{setters:[function(t){n=t},function(t){o=t},function(t){a=t},function(t){r=t}],execute:function(){"@stratusjs/angular",i="confirm-dialog",s=a.cookie("env")?"":".min",c=`${r.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,f=class{constructor(t,e){this.dialogRef=t,this.data=e}onConfirm(){this.dialogRef.close(!0)}onDismiss(){this.dialogRef.close(!1)}},f=l([n.Component({selector:`sa-${i}`,templateUrl:`${c}/${i}/${i}.component${s}.html`}),g(1,n.Inject(o.MAT_DIALOG_DATA)),u("design:paramtypes",[o.MatDialogRef,Object])],f),t("ChangesetViewerDialogComponent",f)}}});
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/material/dialog","@stratusjs/core/environment","@stratusjs/runtime/stratus"],function(t,e){"use strict";var o,n,a,i,r,s,c,f=this&&this.__decorate||function(t,e,o,n){var a,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(r=(i<3?a(r):i>3?a(e,o,r):a(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r},l=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},u=this&&this.__param||function(t,e){return function(o,n){e(o,n,t)}};e&&e.id;return{setters:[function(t){o=t},function(t){n=t},function(t){a=t},function(t){i=t}],execute:function(){"@stratusjs/angular","confirm-dialog",r=a.cookie("env")?"":".min",s=`${i.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,c=class{constructor(t,e){this.dialogRef=t,this.data=e}onConfirm(){this.dialogRef.close(!0)}onDismiss(){this.dialogRef.close(!1)}},c=f([o.Component({selector:"sa-confirm-dialog",templateUrl:`${s}/confirm-dialog/confirm-dialog.component${r}.html`}),u(1,o.Inject(n.MAT_DIALOG_DATA)),l("design:paramtypes",[n.MatDialogRef,Object])],c),t("ConfirmDialogComponent",c)}}});
1
+ System.register(["@angular/core","@angular/material/dialog","@stratusjs/core/environment","@stratusjs/runtime/stratus"],function(t,e){"use strict";var n,o,a,r,i,s,c,f,l=this&&this.__decorate||function(t,e,n,o){var a,r=arguments.length,i=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(r<3?a(i):r>3?a(e,n,i):a(e,n))||i);return r>3&&i&&Object.defineProperty(e,n,i),i},u=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},m=this&&this.__param||function(t,e){return function(n,o){e(n,o,t)}};e&&e.id;return{setters:[function(t){n=t},function(t){o=t},function(t){a=t},function(t){r=t}],execute:function(){"@stratusjs/angular",i="confirm-dialog",s=a.cookie("env")?"":".min",c=`${r.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,f=class{constructor(t,e){this.dialogRef=t,this.data=e}onConfirm(){this.dialogRef.close(!0)}onDismiss(){this.dialogRef.close(!1)}},f=l([n.Component({selector:`sa-${i}`,templateUrl:`${c}/${i}/${i}.component${s}.html`}),m(1,n.Inject(o.MAT_DIALOG_DATA)),u("design:paramtypes",[o.MatDialogRef,Object])],f),t("ConfirmDialogComponent",f)}}});
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/forms","@angular/material/dialog","@angular/cdk/text-field","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/core/responsive.component"],function(t,e){"use strict";var o,n,s,i,r,a,c,u,l,f,h,d,p,g=this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r},m=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y=this&&this.__param||function(t,e){return function(o,n){e(o,n,t)}};e&&e.id;return{setters:[function(t){o=t},function(t){n=t},function(t){s=t},function(t){i=t},function(t){r=t},function(t){a=t},function(t){c=t},function(t){u=t},function(t){l=t}],execute:function(){"@stratusjs/angular",f="code-view-dialog","editor",h=u.cookie("env")?"":".min",d=`${c.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,p=class extends l.ResponsiveComponent{constructor(t,e,o,s,i){super(),this.dialogRef=t,this.data=e,this.ref=o,this.fb=s,this.ngZone=i,this.title=f+"_component",this._=a.default,this.Stratus=c.Stratus,this.form=this.fb.group({dataString:new n.FormControl}),this.monacoOptions={theme:"vs-dark",language:"html"}}ngOnInit(){this.uid=a.default.uniqueId(`sa_${a.default.snakeCase(f)}_component_`),c.Stratus.Instances[this.uid]=this,c.Stratus.Internals.CssLoader(`${d}/editor/${f}.component${h}.css`),this.model=this.data.model,this.property=this.data.property;const t=this.form.get("dataString");t.patchValue(this.model.get(this.property)),t.valueChanges.forEach(t=>{this.model.completed&&(null===t&&(t=""),this.model.set(this.property,t))}),this.refresh()}onCancelClick(){this.dialogRef.close(),this.refresh()}triggerResize(){this.ngZone.onStable.pipe(r.take(1)).subscribe(()=>this.autosize.resizeToFitContent(!0))}},g([o.ViewChild("autosize"),m("design:type",i.CdkTextareaAutosize)],p.prototype,"autosize",void 0),p=g([o.Component({selector:"sa-"+f,templateUrl:`${d}/editor/${f}.component${h}.html`}),y(1,o.Inject(s.MAT_DIALOG_DATA)),m("design:paramtypes",[s.MatDialogRef,Object,o.ChangeDetectorRef,n.FormBuilder,o.NgZone])],p),t("CodeViewDialogComponent",p)}}});
1
+ System.register(["@angular/core","@angular/forms","@angular/material/dialog","@angular/cdk/text-field","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/core/responsive.component"],function(t,e){"use strict";var o,n,s,i,r,a,c,u,l,f,h,d,p,g=this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r},m=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y=this&&this.__param||function(t,e){return function(o,n){e(o,n,t)}};e&&e.id;return{setters:[function(t){o=t},function(t){n=t},function(t){s=t},function(t){i=t},function(t){r=t},function(t){a=t},function(t){c=t},function(t){u=t},function(t){l=t}],execute:function(){"@stratusjs/angular",f="code-view-dialog","editor",h=u.cookie("env")?"":".min",d=`${c.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,p=class extends l.ResponsiveComponent{constructor(t,e,o,s,i){super(),this.dialogRef=t,this.data=e,this.ref=o,this.fb=s,this.ngZone=i,this.title=f+"_component",this._=a.default,this.Stratus=c.Stratus,this.form=this.fb.group({dataString:new n.FormControl}),this.monacoOptions={theme:"vs-dark",language:"html"}}ngOnInit(){this.uid=a.default.uniqueId(`sa_${a.default.snakeCase(f)}_component_`),c.Stratus.Instances[this.uid]=this,c.Stratus.Internals.CssLoader(`${d}/editor/${f}.component${h}.css`),this.model=this.data.model,this.property=this.data.property;const t=this.form.get("dataString");t.patchValue(this.model.get(this.property)),t.valueChanges.forEach(t=>{this.model.completed&&(null===t&&(t=""),this.model.set(this.property,t))}),this.refresh()}onCancelClick(){this.dialogRef.close(),this.refresh()}triggerResize(){this.ngZone.onStable.pipe(r.take(1)).subscribe(()=>this.autosize.resizeToFitContent(!0))}},g([o.ViewChild("autosize"),m("design:type",i.CdkTextareaAutosize)],p.prototype,"autosize",void 0),p=g([o.Component({selector:`sa-${f}`,templateUrl:`${d}/editor/${f}.component${h}.html`}),y(1,o.Inject(s.MAT_DIALOG_DATA)),m("design:paramtypes",[s.MatDialogRef,Object,o.ChangeDetectorRef,n.FormBuilder,o.NgZone])],p),t("CodeViewDialogComponent",p)}}});
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/forms","@angular/material/dialog","rxjs","rxjs/operators","@angular/platform-browser","@stratusjs/runtime/stratus","lodash","@stratusjs/angular/core/root.component","@stratusjs/angular/editor/media-dialog.component","@stratusjs/angularjs/services/registry","@stratusjs/core/environment","@stratusjs/core/events/eventManager","@stratusjs/angular/editor/code-view-dialog.component","codemirror/lib/codemirror","codemirror/mode/xml/xml","html2pdf","font-awesome","froala-plugins","froala-embedly","froala-font-awesome","froala-image-tui","@stratusjs/angular/froala/plugins/mediaManager"],function(e,t){"use strict";var i,n,a,r,o,s,l,d,c,g,m,u,p,h,f,b,y,v,w,k,S,x=this&&this.__decorate||function(e,t,i,n){var a,r=arguments.length,o=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(r<3?a(o):r>3?a(t,i,o):a(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o},C=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;return{setters:[function(e){i=e},function(e){n=e},function(e){a=e},function(e){r=e},function(e){o=e},function(e){s=e},function(e){l=e},function(e){d=e},function(e){c=e},function(e){g=e},function(e){m=e},function(e){u=e},function(e){p=e},function(e){h=e},function(e){f=e},function(e){},function(e){},function(e){},function(e){},function(e){},function(e){},function(e){},function(e){}],execute:function(){"@stratusjs/angular","froala-editor","codemirror","editor",b=u.cookie("env")?"":".min",y=`${l.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^\/]*$/,"")}`,v=`${l.Stratus.BaseUrl}${boot.configuration.paths["codemirror/*"].replace(/[^\/]*$/,"")}`,w=`${l.Stratus.BaseUrl}${boot.configuration.paths["froala-editor"].replace(/js\/[^\/]*$/,"")}`,k=(e,t)=>d.default.has(e,t)&&!d.default.isEmpty(d.default.get(e,t)),S=class extends c.RootComponent{constructor(e,t,i,a,s){super(),this.sanitizer=e,this.ref=t,this.elementRef=i,this.fb=a,this.dialog=s,this.title="editor_component",this.dev=!!u.cookie("env"),this.editor="froala",this._=d.default,this.has=k,this.log=console.log,this.Stratus=l.Stratus,this.registry=new m.Registry,this.onChange=new r.Subject,this.svgIcons={},this.initialized=!1,this.styled=!1,this.blurred=!1,this.focused=!1,this.form=this.fb.group({dataString:new n.FormControl}),this.dataChangeLog=[],this.dataString="",this.froalaButtons=["bold","italic","underline","strikeThrough","subscript","superscript","|","formatBlock","blockStyle","inlineStyle","paragraphStyle","paragraphFormat","align","formatOL","formatUL","outdent","indent","|","insertLink","insertImage","insertVideo","insertFile","insertTable","|","undo","redo","removeFormat","wordPaste","help","html","fullscreen"],this.froalaStandardButtons={moreText:["bold","italic","underline","strikeThrough","subscript","superscript","fontFamily","fontSize","textColor","backgroundColor","inlineClass","inlineStyle","clearFormatting"],moreParagraph:["alignLeft","alignCenter","alignRight","alignJustify","indent","outdent","paragraphFormat","paragraphStyle","formatOL","formatUL","quote"],moreRich:["insertLink","insertImage","insertVideo","insertFile","insertTable","insertHR","specialCharacters","embedly"],moreMisc:["undo","redo","fullscreen","html","print","selectAll","help"]},this.froalaConfig={attribution:!1,key:l.Stratus.Environment.get("froalaKey"),zIndex:9999,events:{initialized:e=>{this.froalaEditorDirective=e}},codeBeautifierOptions:{end_with_newline:!0,indent_inner_html:!0,extra_liners:'["p", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "pre", "ul", "ol", "table", "dl"]',brace_style:"expand",indent_char:" ",indent_size:4,wrap_line_length:0},codeMirror:f,codeMirrorOptions:{indentWithTabs:!1,lineNumbers:!0,lineWrapping:!0,mode:"text/html",tabMode:"space",tabSize:4},fileInsertButtons:["fileBack","|","mediaManager"],fileUploadURL:"https://app.sitetheory.io/?session="+u.cookie("SITETHEORY"),fontFamily:{"Arial,Helvetica,sans-serif":"Arial","Georgia,serif":"Georgia","Impact,Charcoal,sans-serif":"Impact","Tahoma,Geneva,sans-serif":"Tahoma",'"Times New Roman",Times,serif':"Times New Roman","Verdana,Geneva,sans-serif":"Verdana"},heightMax:window.innerHeight||document.documentElement.clientHeight||500,htmlAllowedAttrs:["aria-.+","data-.+","ng-.+","stratus-.+","sa-.+","accept","accept-charset","accesskey","action","align","allow","allowfullscreen","allowtransparency","alt","async","autocomplete","autofocus","autoplay","autosave","background","bgcolor","border","charset","cellpadding","cellspacing","checked","cite","class","color","cols","colspan","content","contenteditable","contextmenu","controls","coords","data","datetime","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","frameborder","headers","height","hidden","high","href","hreflang","http-equiv","icon","id","ismap","itemprop","keytype","kind","label","lang","language","list","loop","low","max","maxlength","media","method","min","mozallowfullscreen","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","scrolling","seamless","selected","shape","size","sizes","span","src","srcdoc","srclang","srcset","start","step","summary","spellcheck","style","tabindex","target","title","type","translate","usemap","value","valign","webkitallowfullscreen","width","wrap","xmlns","xmlns:xlink","accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","clip","clipPathUnits","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","contentScriptType","contentStyleType","crossorigin","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","externalResourcesRequired","fill","fill-opacity","fill-rule","filter","filterRes","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","horiz-adv-x","horiz-origin-x","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","referrerPolicy","refX","refY","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","surfaceScale","systemLanguage","tableValues","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","viewTarget","visibility","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:lang","xml:space","y","y1","y2","yChannelSelector","z","zoomAndPan"],htmlAllowedEmptyTags:["textarea","a","iframe","object","video","style","script","hr","div","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","discard","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tspan","unknown","use","view","ng-app","ng-bind","ng-bind-html","ng-bind-template","ng-blur","ng-change","ng-checked","ng-class","ng-class-even","ng-class-odd","ng-click","ng-cloak","ng-controller","ng-copy","ng-csp","ng-cut","ng-dblclick","ng-disabled","ng-focus","ng-form","ng-hide","ng-href","ng-if","ng-include","ng-init","ng-jq","ng-keydown","ng-keypress","ng-keyup","ng-list","ng-maxlength","ng-minlength","ng-model","ng-model-options","ng-mousedown","ng-mouseenter","ng-mouseleave","ng-mousemove","ng-mouseover","ng-mouseup","ng-non-bindable","ng-on","ng-open","ng-options","ng-paste","ng-pattern","ng-pluralize","ng-prop","ng-readonly","ng-ref","ng-repeat","ng-required","ng-selected","ng-show","ng-src","ng-srcset","ng-style","ng-submit","ng-switch","ng-transclude","ng-value","ng-animate-children","ng-animate-swap","ng-outlet","ng-message","ng-message-default","ng-message-exp","ng-messages","ng-messages-include","ng-view","ng-swipe-left","ng-swipe-right","md-autocomplete","md-autofocus","md-button","md-calendar","md-card","md-checkbox","md-chip","md-chip-remove","md-chips","md-colors","md-contact-chips","md-content","md-datepicker","md-dialog","md-divider","md-fab-actions","md-fab-speed-dial","md-fab-toolbar","md-force-height","md-grid-list","md-grid-tile","md-highlight-text","md-icon","md-ink-ripple","md-input","md-input-container","md-list","md-list-item","md-menu","md-menu-bar","md-nav-bar","md-nav-item","md-optgroup","md-option","md-progress-circular","md-progress-linear","md-radio-button","md-radio-group","md-select","md-select-on-focus","md-sidenav","md-slider","md-slider-container","md-subheader","md-swipe-down","md-swipe-left","md-swipe-right","md-swipe-up","md-switch","md-tab","md-tabs","md-toolbar","md-tooltip","md-truncate","md-virtual-repeat","md-virtual-repeat-container","md-whiteframe","md-svg-src","sa-boot","sa-editor","sa-map","sa-media-selector","sa-selector","sa-stripe-payment-method-list","sa-stripe-payment-method-selector","sa-tree"],htmlAllowedStyleProps:[".*"],htmlAllowedTags:["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","br","button","canvas","caption","cite","code","col","colgroup","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meter","nav","noscript","object","ol","optgroup","option","output","p","param","pre","progress","queue","rp","rt","ruby","s","samp","script","style","section","select","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","discard","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tspan","unknown","use","view","ng-app","ng-bind","ng-bind-html","ng-bind-template","ng-blur","ng-change","ng-checked","ng-class","ng-class-even","ng-class-odd","ng-click","ng-cloak","ng-controller","ng-copy","ng-csp","ng-cut","ng-dblclick","ng-disabled","ng-focus","ng-form","ng-hide","ng-href","ng-if","ng-include","ng-init","ng-jq","ng-keydown","ng-keypress","ng-keyup","ng-list","ng-maxlength","ng-minlength","ng-model","ng-model-options","ng-mousedown","ng-mouseenter","ng-mouseleave","ng-mousemove","ng-mouseover","ng-mouseup","ng-non-bindable","ng-on","ng-open","ng-options","ng-paste","ng-pattern","ng-pluralize","ng-prop","ng-readonly","ng-ref","ng-repeat","ng-required","ng-selected","ng-show","ng-src","ng-srcset","ng-style","ng-submit","ng-switch","ng-transclude","ng-value","ng-animate-children","ng-animate-swap","ng-outlet","ng-message","ng-message-default","ng-message-exp","ng-messages","ng-messages-include","ng-view","ng-swipe-left","ng-swipe-right","md-autocomplete","md-autofocus","md-button","md-calendar","md-card","md-checkbox","md-chip","md-chip-remove","md-chips","md-colors","md-contact-chips","md-content","md-datepicker","md-dialog","md-divider","md-fab-actions","md-fab-speed-dial","md-fab-toolbar","md-force-height","md-grid-list","md-grid-tile","md-highlight-text","md-icon","md-ink-ripple","md-input","md-input-container","md-list","md-list-item","md-menu","md-menu-bar","md-nav-bar","md-nav-item","md-optgroup","md-option","md-progress-circular","md-progress-linear","md-radio-button","md-radio-group","md-select","md-select-on-focus","md-sidenav","md-slider","md-slider-container","md-subheader","md-swipe-down","md-swipe-left","md-swipe-right","md-swipe-up","md-switch","md-tab","md-tabs","md-toolbar","md-tooltip","md-truncate","md-virtual-repeat","md-virtual-repeat-container","md-whiteframe","md-svg-src","sa-boot","sa-editor","sa-map","sa-media-selector","sa-selector","sa-stripe-payment-method-list","sa-stripe-payment-method-selector","sa-tree"],htmlRemoveTags:[],htmlSimpleAmpersand:!1,imageInsertButtons:["imageBack","|","mediaManager","imageUpload","imageByURL"],imageUpload:!0,imageUploadRemoteUrls:!0,imageUploadURL:"https://app.sitetheory.io/?session="+u.cookie("SITETHEORY"),imageManagerPageSize:20,imageManagerScrollOffset:10,imageManagerLoadMethod:"GET",imageManagerLoadURL:"/Api/Media?payload-only=true",multiLine:!0,paragraphStyles:{btn:"Button",header:"Header",title:"Title","alt-title":"Alt Title (over)",subtitle:"Subtitle",pullout:"Pullout Quote"},pasteDeniedAttrs:["id","class","style","dir","data-.+","aria-.+","ng-.+","stratus-.+","sa-.+"],pasteDeniedTags:["form","input","label","style"],pastePlain:!1,pluginsEnabled:["align","charCounter","codeBeautifier","codeView","colors","draggable","embedly","entities","file","fontAwesome","fontFamily","fontSize","fullscreen","help","image","imageTUI","inlineStyle","inlineClass","lineBreaker","link","lists","mediaManager","paragraphFormat","paragraphStyle","print","quickInsert","quote","save","specialCharacters","table","url","video","wordPaste"],quickInsertButtons:["image","video","media","embedly","table","ul","ol","hr"],scrollableContainer:l.Stratus.Environment.get("viewPort")||"body",spellcheck:!0,toolbarSticky:!0,toolbarButtons:{moreText:{buttons:this.froalaStandardButtons.moreText,buttonsVisible:0},moreParagraph:{buttons:this.froalaStandardButtons.moreParagraph,buttonsVisible:8},moreRich:{buttons:this.froalaStandardButtons.moreRich,buttonsVisible:5},moreMisc:{buttons:this.froalaStandardButtons.moreMisc,align:"right",buttonsVisible:4}},toolbarButtonsSM:{moreText:{buttons:this.froalaStandardButtons.moreText,buttonsVisible:3},moreParagraph:{buttons:this.froalaStandardButtons.moreParagraph,buttonsVisible:0},moreRich:{buttons:this.froalaStandardButtons.moreRich,buttonsVisible:3},moreMisc:{buttons:this.froalaStandardButtons.moreMisc,align:"right",buttonsVisible:4}},toolbarButtonsXS:{moreText:{buttons:this.froalaStandardButtons.moreText,buttonsVisible:0},moreParagraph:{buttons:this.froalaStandardButtons.moreParagraph,buttonsVisible:0},moreRich:{buttons:this.froalaStandardButtons.moreRich,buttonsVisible:0},moreMisc:{buttons:this.froalaStandardButtons.moreMisc,align:"right",buttonsVisible:2}},useClasses:!0,videoInsertButtons:["videoBack","|","mediaManager","videoByURL","videoEmbed","videoUpload"],videoUpload:!0,videoUploadURL:"https://app.sitetheory.io/?session="+u.cookie("SITETHEORY")},this.uid=d.default.uniqueId(`sa_${d.default.snakeCase("editor")}_component_`),l.Stratus.Instances[this.uid]=this,l.Stratus.Internals.LoadCss([`${y}editor/editor.component${b}.css`,v+"lib/codemirror.css",`${w}css/froala_editor.pkgd${b}.css`,`${w}css/third_party/embedly${b}.css`,`${w}css/third_party/font_awesome${b}.css`,`${w}css/third_party/image_tui${b}.css`]).then(()=>{this.styled=!0,this.refresh()}).catch(e=>{console.error(e),console.warn("Issue detected in CSS Loader for Component:",this.uid),this.styled=!0,this.refresh()}),this.hydrate(i,e,["title","uid","dev","debug","editor","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","property","_","has","log","Stratus","registry","fetched","data","collection","model","dataSub","onChange","subscriber","svgIcons","initialized","styled","blurred","focused","codeViewIsOpen","form","dataChangeLog","dataString","froalaEditorDirective","froalaButtons","froalaStandardButtons","froalaConfig","sanitizer","ref","elementRef","fb","dialog","ngOnInit","listDuplicates","normalizeIn","normalizeOut","changeImgSize","handleError","fetchData","dataDefer","dataRef","onDataChange","created","changedEditor","onChangeEvent","onFocus","onBlur","bypassHTML","trigger","openMediaDialog","openCodeViewDialog","hydrate","disableRefresh","stagger","reloading","refresh","ngOnDestroy"]),this.fetchData().then(e=>{if(!(e&&e instanceof p.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{e.completed&&(this.dataDefer(this.subscriber),this.codeViewIsOpen)};e.on("change",t),t()}),this.dataSub=new r.Observable(e=>(this.dev&&console.warn("[observable] creating subscriber on "+this.uid,e),this.dataDefer(e))),this.dataSub.pipe(o.debounce(()=>r.timer(250)),o.catchError(this.handleError)).subscribe(e=>{if(this.focused)return void(this.dev&&console.warn("[subscriber] waiting on updates due to focus on "+this.uid));const t=this.form.get("dataString");t.value!==e?(t.patchValue(e),this.refresh()):this.initialized&&this.refresh()})}ngOnInit(){this.initialized=!0;this.form.get("dataString").valueChanges.forEach(e=>{if(!this.model.completed)return;let t=null;!this.froalaConfig.useClasses&&this.froalaEditorDirective&&this.froalaEditorDirective.getEditor()&&this.froalaEditorDirective.getEditor().el&&this.froalaEditorDirective.getEditor().el.innerHTML&&(t=this.froalaEditorDirective.getEditor().el.innerHTML),this.model.set(this.property,this.normalizeOut(t||e))}),this.dev&&this.listDuplicates(this.froalaConfig)}listDuplicates(e){return d.default.forEach(e,(e,t)=>{if(!d.default.isArray(e))return;const i={};e.forEach(e=>i[e]=(i[e]||0)+1);const n=d.default.filter(d.default.map(i,(e,t)=>e>1?t:null));n.length&&console.warn("Froala Config:",t,"has duplicates:",n)}),e}normalizeIn(e){return e&&d.default.isString(e)?this.changeImgSize(e,"hq"):""}normalizeOut(e){return null===e?"":d.default.isString(e)?this.changeImgSize(e,"xs"):e}changeImgSize(e,t){if(!e||!d.default.isString(e))return e;if(!t||!d.default.isString(t))return e;const i=/<img([\w\W]+?)>/gi;let n;for(;n=i.exec(e);){const i=n[0];if(i.includes("data:image"))continue;const a=/^<img\s(.+?)(-[A-Z]{2})?\.(?=[^.]*$)(.+)>/gi.exec(i);if(null!==a)if(i.includes("data-stratus-src"))e=e.replace(i,`<img ${a[1]}-${t}.${a[3]}>`);else{if(!i.includes("cdn.sitetheory.io"))continue;if(d.default.isEmpty(a[2]))continue;e=e.replace(i,`<img data-stratus-src ${a[1]}-${t}.${a[3]}>`)}else console.warn("Unable to find file name for image src:",i)}return e}handleError(e){return console.error(e),e}fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(l.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber)return this.dev&&console.warn("[defer] debouncing due to empty subscriber on "+this.uid),void setTimeout(()=>{this.dev&&console.warn("[defer] debounced subscriber returned on "+this.uid),this.dataDefer(e)},250);const t=d.default.clone(this.dataString),i=this.dataRef();return t!==i?i||this.data&&this.data.completed?void((this.froalaConfig.useClasses||t!==i)&&(this.dev&&console.warn(`[subscriber] new value submitted on ${this.uid}:`,i),this.subscriber.next(i))):(this.dev&&console.warn("[defer] debouncing subscriber due to unavailable data on "+this.uid,this.data),void setTimeout(()=>{this.dev&&console.warn("[defer] debounced subscriber returned on "+this.uid),this.dataDefer(e)},250)):void 0}dataRef(){return this.model?this.dataString=this.normalizeIn(this.model.get(this.property)):""}onDataChange(){this.dataDefer(this.subscriber),this.refresh()}created(){}changedEditor(e){console.log("editor-change:",e)}onChangeEvent(e){console.log("change:",e)}onFocus(e){this.focused=!0,this.blurred=!1}onBlur(e){this.focused=!1,this.blurred=!0}bypassHTML(e){return this.sanitizer.bypassSecurityTrustHtml(e)}trigger(e,t,i){this.dev&&this.debug&&console.log("editor.trigger:",e,i),"media-library"===e?this.openMediaDialog(i):"code-view"===e&&this.openCodeViewDialog()}openMediaDialog(e){const t=this.dialog.open(g.MediaDialogComponent,{width:"1000px",data:{editor:this,eventManager:e,form:this.form,model:this.model,property:this.property}});this.refresh();const i=this;t.afterClosed().subscribe(e=>{e&&!d.default.isEmpty(e)&&(i.refresh(),this.dev&&e&&console.log("media dialog result:",e))})}openCodeViewDialog(){this.codeViewIsOpen=!0;const e=this.dialog.open(h.CodeViewDialogComponent,{width:"1000px",data:{form:this.form,model:this.model,property:this.property}});this.refresh(),e.afterClosed().subscribe(e=>{this.codeViewIsOpen=!1,e&&!d.default.isEmpty(e)&&(this.refresh(),this.dev&&e&&console.log("code view dialog result:",e))})}},x([i.Input(),C("design:type",String)],S.prototype,"target",void 0),x([i.Input(),C("design:type",String)],S.prototype,"targetSuffix",void 0),x([i.Input(),C("design:type",Number)],S.prototype,"id",void 0),x([i.Input(),C("design:type",Boolean)],S.prototype,"manifest",void 0),x([i.Input(),C("design:type",Boolean)],S.prototype,"decouple",void 0),x([i.Input(),C("design:type",Boolean)],S.prototype,"direct",void 0),x([i.Input(),C("design:type",Object)],S.prototype,"api",void 0),x([i.Input(),C("design:type",String)],S.prototype,"urlRoot",void 0),x([i.Input(),C("design:type",String)],S.prototype,"property",void 0),S=x([i.Component({selector:"sa-editor",templateUrl:`${y}/editor/editor.component${b}.html`}),C("design:paramtypes",[s.DomSanitizer,i.ChangeDetectorRef,i.ElementRef,n.FormBuilder,a.MatDialog])],S),e("EditorComponent",S)}}});
1
+ System.register(["@angular/core","@angular/forms","@angular/material/dialog","rxjs","rxjs/operators","@angular/platform-browser","@stratusjs/runtime/stratus","lodash","@stratusjs/angular/core/root.component","@stratusjs/angular/editor/media-dialog.component","@stratusjs/angularjs/services/registry","@stratusjs/core/environment","@stratusjs/core/events/eventManager","@stratusjs/angular/editor/code-view-dialog.component","codemirror/lib/codemirror","codemirror/mode/xml/xml","html2pdf","font-awesome","froala-plugins","froala-embedly","froala-font-awesome","froala-image-tui","@stratusjs/angular/froala/plugins/mediaManager"],function(e,t){"use strict";var i,n,a,r,o,s,l,d,c,g,m,u,p,h,f,b,y,v,w,k,S,x,C=this&&this.__decorate||function(e,t,i,n){var a,r=arguments.length,o=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(r<3?a(o):r>3?a(t,i,o):a(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o},T=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;return{setters:[function(e){i=e},function(e){n=e},function(e){a=e},function(e){r=e},function(e){o=e},function(e){s=e},function(e){l=e},function(e){d=e},function(e){c=e},function(e){g=e},function(e){m=e},function(e){u=e},function(e){p=e},function(e){h=e},function(e){f=e},function(e){},function(e){},function(e){},function(e){},function(e){},function(e){},function(e){},function(e){}],execute:function(){"@stratusjs/angular","froala-editor","codemirror",b="editor",y=u.cookie("env")?"":".min",v=`${l.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^\/]*$/,"")}`,w=`${l.Stratus.BaseUrl}${boot.configuration.paths["codemirror/*"].replace(/[^\/]*$/,"")}`,k=`${l.Stratus.BaseUrl}${boot.configuration.paths["froala-editor"].replace(/js\/[^\/]*$/,"")}`,S=(e,t)=>d.default.has(e,t)&&!d.default.isEmpty(d.default.get(e,t)),x=class extends c.RootComponent{constructor(e,t,i,a,s){super(),this.sanitizer=e,this.ref=t,this.elementRef=i,this.fb=a,this.dialog=s,this.title="editor_component",this.dev=!!u.cookie("env"),this.editor="froala",this._=d.default,this.has=S,this.log=console.log,this.Stratus=l.Stratus,this.registry=new m.Registry,this.onChange=new r.Subject,this.svgIcons={},this.initialized=!1,this.styled=!1,this.blurred=!1,this.focused=!1,this.form=this.fb.group({dataString:new n.FormControl}),this.dataChangeLog=[],this.dataString="",this.froalaButtons=["bold","italic","underline","strikeThrough","subscript","superscript","|","formatBlock","blockStyle","inlineStyle","paragraphStyle","paragraphFormat","align","formatOL","formatUL","outdent","indent","|","insertLink","insertImage","insertVideo","insertFile","insertTable","|","undo","redo","removeFormat","wordPaste","help","html","fullscreen"],this.froalaStandardButtons={moreText:["bold","italic","underline","strikeThrough","subscript","superscript","fontFamily","fontSize","textColor","backgroundColor","inlineClass","inlineStyle","clearFormatting"],moreParagraph:["alignLeft","alignCenter","alignRight","alignJustify","indent","outdent","paragraphFormat","paragraphStyle","formatOL","formatUL","quote"],moreRich:["insertLink","insertImage","insertVideo","insertFile","insertTable","insertHR","specialCharacters","embedly"],moreMisc:["undo","redo","fullscreen","html","print","selectAll","help"]},this.froalaConfig={attribution:!1,key:l.Stratus.Environment.get("froalaKey"),zIndex:9999,events:{initialized:e=>{this.froalaEditorDirective=e}},codeBeautifierOptions:{end_with_newline:!0,indent_inner_html:!0,extra_liners:'["p", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "pre", "ul", "ol", "table", "dl"]',brace_style:"expand",indent_char:" ",indent_size:4,wrap_line_length:0},codeMirror:f,codeMirrorOptions:{indentWithTabs:!1,lineNumbers:!0,lineWrapping:!0,mode:"text/html",tabMode:"space",tabSize:4},fileInsertButtons:["fileBack","|","mediaManager"],fileUploadURL:"https://app.sitetheory.io/?session="+u.cookie("SITETHEORY"),fontFamily:{"Arial,Helvetica,sans-serif":"Arial","Georgia,serif":"Georgia","Impact,Charcoal,sans-serif":"Impact","Tahoma,Geneva,sans-serif":"Tahoma",'"Times New Roman",Times,serif':"Times New Roman","Verdana,Geneva,sans-serif":"Verdana"},heightMax:window.innerHeight||document.documentElement.clientHeight||500,htmlAllowedAttrs:["aria-.+","data-.+","ng-.+","stratus-.+","sa-.+","accept","accept-charset","accesskey","action","align","allow","allowfullscreen","allowtransparency","alt","async","autocomplete","autofocus","autoplay","autosave","background","bgcolor","border","charset","cellpadding","cellspacing","checked","cite","class","color","cols","colspan","content","contenteditable","contextmenu","controls","coords","data","datetime","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","frameborder","headers","height","hidden","high","href","hreflang","http-equiv","icon","id","ismap","itemprop","keytype","kind","label","lang","language","list","loop","low","max","maxlength","media","method","min","mozallowfullscreen","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","scrolling","seamless","selected","shape","size","sizes","span","src","srcdoc","srclang","srcset","start","step","summary","spellcheck","style","tabindex","target","title","type","translate","usemap","value","valign","webkitallowfullscreen","width","wrap","xmlns","xmlns:xlink","accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","clip","clipPathUnits","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","contentScriptType","contentStyleType","crossorigin","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","externalResourcesRequired","fill","fill-opacity","fill-rule","filter","filterRes","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","horiz-adv-x","horiz-origin-x","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","referrerPolicy","refX","refY","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","surfaceScale","systemLanguage","tableValues","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","viewTarget","visibility","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:lang","xml:space","y","y1","y2","yChannelSelector","z","zoomAndPan"],htmlAllowedEmptyTags:["textarea","a","iframe","object","video","style","script","hr","div","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","discard","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tspan","unknown","use","view","ng-app","ng-bind","ng-bind-html","ng-bind-template","ng-blur","ng-change","ng-checked","ng-class","ng-class-even","ng-class-odd","ng-click","ng-cloak","ng-controller","ng-copy","ng-csp","ng-cut","ng-dblclick","ng-disabled","ng-focus","ng-form","ng-hide","ng-href","ng-if","ng-include","ng-init","ng-jq","ng-keydown","ng-keypress","ng-keyup","ng-list","ng-maxlength","ng-minlength","ng-model","ng-model-options","ng-mousedown","ng-mouseenter","ng-mouseleave","ng-mousemove","ng-mouseover","ng-mouseup","ng-non-bindable","ng-on","ng-open","ng-options","ng-paste","ng-pattern","ng-pluralize","ng-prop","ng-readonly","ng-ref","ng-repeat","ng-required","ng-selected","ng-show","ng-src","ng-srcset","ng-style","ng-submit","ng-switch","ng-transclude","ng-value","ng-animate-children","ng-animate-swap","ng-outlet","ng-message","ng-message-default","ng-message-exp","ng-messages","ng-messages-include","ng-view","ng-swipe-left","ng-swipe-right","md-autocomplete","md-autofocus","md-button","md-calendar","md-card","md-checkbox","md-chip","md-chip-remove","md-chips","md-colors","md-contact-chips","md-content","md-datepicker","md-dialog","md-divider","md-fab-actions","md-fab-speed-dial","md-fab-toolbar","md-force-height","md-grid-list","md-grid-tile","md-highlight-text","md-icon","md-ink-ripple","md-input","md-input-container","md-list","md-list-item","md-menu","md-menu-bar","md-nav-bar","md-nav-item","md-optgroup","md-option","md-progress-circular","md-progress-linear","md-radio-button","md-radio-group","md-select","md-select-on-focus","md-sidenav","md-slider","md-slider-container","md-subheader","md-swipe-down","md-swipe-left","md-swipe-right","md-swipe-up","md-switch","md-tab","md-tabs","md-toolbar","md-tooltip","md-truncate","md-virtual-repeat","md-virtual-repeat-container","md-whiteframe","md-svg-src","sa-boot","sa-editor","sa-map","sa-media-selector","sa-selector","sa-stripe-payment-method-list","sa-stripe-payment-method-selector","sa-tree"],htmlAllowedStyleProps:[".*"],htmlAllowedTags:["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","br","button","canvas","caption","cite","code","col","colgroup","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meter","nav","noscript","object","ol","optgroup","option","output","p","param","pre","progress","queue","rp","rt","ruby","s","samp","script","style","section","select","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","discard","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tspan","unknown","use","view","ng-app","ng-bind","ng-bind-html","ng-bind-template","ng-blur","ng-change","ng-checked","ng-class","ng-class-even","ng-class-odd","ng-click","ng-cloak","ng-controller","ng-copy","ng-csp","ng-cut","ng-dblclick","ng-disabled","ng-focus","ng-form","ng-hide","ng-href","ng-if","ng-include","ng-init","ng-jq","ng-keydown","ng-keypress","ng-keyup","ng-list","ng-maxlength","ng-minlength","ng-model","ng-model-options","ng-mousedown","ng-mouseenter","ng-mouseleave","ng-mousemove","ng-mouseover","ng-mouseup","ng-non-bindable","ng-on","ng-open","ng-options","ng-paste","ng-pattern","ng-pluralize","ng-prop","ng-readonly","ng-ref","ng-repeat","ng-required","ng-selected","ng-show","ng-src","ng-srcset","ng-style","ng-submit","ng-switch","ng-transclude","ng-value","ng-animate-children","ng-animate-swap","ng-outlet","ng-message","ng-message-default","ng-message-exp","ng-messages","ng-messages-include","ng-view","ng-swipe-left","ng-swipe-right","md-autocomplete","md-autofocus","md-button","md-calendar","md-card","md-checkbox","md-chip","md-chip-remove","md-chips","md-colors","md-contact-chips","md-content","md-datepicker","md-dialog","md-divider","md-fab-actions","md-fab-speed-dial","md-fab-toolbar","md-force-height","md-grid-list","md-grid-tile","md-highlight-text","md-icon","md-ink-ripple","md-input","md-input-container","md-list","md-list-item","md-menu","md-menu-bar","md-nav-bar","md-nav-item","md-optgroup","md-option","md-progress-circular","md-progress-linear","md-radio-button","md-radio-group","md-select","md-select-on-focus","md-sidenav","md-slider","md-slider-container","md-subheader","md-swipe-down","md-swipe-left","md-swipe-right","md-swipe-up","md-switch","md-tab","md-tabs","md-toolbar","md-tooltip","md-truncate","md-virtual-repeat","md-virtual-repeat-container","md-whiteframe","md-svg-src","sa-boot","sa-editor","sa-map","sa-media-selector","sa-selector","sa-stripe-payment-method-list","sa-stripe-payment-method-selector","sa-tree"],htmlRemoveTags:[],htmlSimpleAmpersand:!1,imageInsertButtons:["imageBack","|","mediaManager","imageUpload","imageByURL"],imageUpload:!0,imageUploadRemoteUrls:!0,imageUploadURL:"https://app.sitetheory.io/?session="+u.cookie("SITETHEORY"),imageManagerPageSize:20,imageManagerScrollOffset:10,imageManagerLoadMethod:"GET",imageManagerLoadURL:"/Api/Media?payload-only=true",multiLine:!0,paragraphStyles:{btn:"Button",header:"Header",title:"Title","alt-title":"Alt Title (over)",subtitle:"Subtitle",pullout:"Pullout Quote"},pasteDeniedAttrs:["id","class","style","dir","data-.+","aria-.+","ng-.+","stratus-.+","sa-.+"],pasteDeniedTags:["form","input","label","style"],pastePlain:!1,pluginsEnabled:["align","charCounter","codeBeautifier","codeView","colors","draggable","embedly","entities","file","fontAwesome","fontFamily","fontSize","fullscreen","help","image","imageTUI","inlineStyle","inlineClass","lineBreaker","link","lists","mediaManager","paragraphFormat","paragraphStyle","print","quickInsert","quote","save","specialCharacters","table","url","video","wordPaste"],quickInsertButtons:["image","video","media","embedly","table","ul","ol","hr"],scrollableContainer:l.Stratus.Environment.get("viewPort")||"body",spellcheck:!0,toolbarSticky:!0,toolbarButtons:{moreText:{buttons:this.froalaStandardButtons.moreText,buttonsVisible:0},moreParagraph:{buttons:this.froalaStandardButtons.moreParagraph,buttonsVisible:8},moreRich:{buttons:this.froalaStandardButtons.moreRich,buttonsVisible:5},moreMisc:{buttons:this.froalaStandardButtons.moreMisc,align:"right",buttonsVisible:4}},toolbarButtonsSM:{moreText:{buttons:this.froalaStandardButtons.moreText,buttonsVisible:3},moreParagraph:{buttons:this.froalaStandardButtons.moreParagraph,buttonsVisible:0},moreRich:{buttons:this.froalaStandardButtons.moreRich,buttonsVisible:3},moreMisc:{buttons:this.froalaStandardButtons.moreMisc,align:"right",buttonsVisible:4}},toolbarButtonsXS:{moreText:{buttons:this.froalaStandardButtons.moreText,buttonsVisible:0},moreParagraph:{buttons:this.froalaStandardButtons.moreParagraph,buttonsVisible:0},moreRich:{buttons:this.froalaStandardButtons.moreRich,buttonsVisible:0},moreMisc:{buttons:this.froalaStandardButtons.moreMisc,align:"right",buttonsVisible:2}},useClasses:!0,videoInsertButtons:["videoBack","|","mediaManager","videoByURL","videoEmbed","videoUpload"],videoUpload:!0,videoUploadURL:"https://app.sitetheory.io/?session="+u.cookie("SITETHEORY")},this.uid=d.default.uniqueId(`sa_${d.default.snakeCase(b)}_component_`),l.Stratus.Instances[this.uid]=this,l.Stratus.Internals.LoadCss([`${v}editor/editor.component${y}.css`,`${w}lib/codemirror.css`,`${k}css/froala_editor.pkgd${y}.css`,`${k}css/third_party/embedly${y}.css`,`${k}css/third_party/font_awesome${y}.css`,`${k}css/third_party/image_tui${y}.css`]).then(()=>{this.styled=!0,this.refresh()}).catch(e=>{console.error(e),console.warn("Issue detected in CSS Loader for Component:",this.uid),this.styled=!0,this.refresh()}),this.hydrate(i,e,["title","uid","dev","debug","editor","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","property","_","has","log","Stratus","registry","fetched","data","collection","model","dataSub","onChange","subscriber","svgIcons","initialized","styled","blurred","focused","codeViewIsOpen","form","dataChangeLog","dataString","froalaEditorDirective","froalaButtons","froalaStandardButtons","froalaConfig","sanitizer","ref","elementRef","fb","dialog","ngOnInit","listDuplicates","normalizeIn","normalizeOut","changeImgSize","handleError","fetchData","dataDefer","dataRef","onDataChange","created","changedEditor","onChangeEvent","onFocus","onBlur","bypassHTML","trigger","openMediaDialog","openCodeViewDialog","hydrate","disableRefresh","stagger","reloading","refresh","ngOnDestroy"]),this.fetchData().then(e=>{if(!(e&&e instanceof p.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{e.completed&&(this.dataDefer(this.subscriber),this.codeViewIsOpen)};e.on("change",t),t()}),this.dataSub=new r.Observable(e=>(this.dev&&console.warn(`[observable] creating subscriber on ${this.uid}`,e),this.dataDefer(e))),this.dataSub.pipe(o.debounce(()=>r.timer(250)),o.catchError(this.handleError)).subscribe(e=>{if(this.focused)return void(this.dev&&console.warn(`[subscriber] waiting on updates due to focus on ${this.uid}`));const t=this.form.get("dataString");t.value!==e?(t.patchValue(e),this.refresh()):this.initialized&&this.refresh()})}ngOnInit(){this.initialized=!0;this.form.get("dataString").valueChanges.forEach(e=>{if(!this.model.completed)return;let t=null;!this.froalaConfig.useClasses&&this.froalaEditorDirective&&this.froalaEditorDirective.getEditor()&&this.froalaEditorDirective.getEditor().el&&this.froalaEditorDirective.getEditor().el.innerHTML&&(t=this.froalaEditorDirective.getEditor().el.innerHTML),this.model.set(this.property,this.normalizeOut(t||e))}),this.dev&&this.listDuplicates(this.froalaConfig)}listDuplicates(e){return d.default.forEach(e,(e,t)=>{if(!d.default.isArray(e))return;const i={};e.forEach(e=>i[e]=(i[e]||0)+1);const n=d.default.filter(d.default.map(i,(e,t)=>e>1?t:null));n.length&&console.warn("Froala Config:",t,"has duplicates:",n)}),e}normalizeIn(e){return e&&d.default.isString(e)?this.changeImgSize(e,"hq"):""}normalizeOut(e){return null===e?"":d.default.isString(e)?this.changeImgSize(e,"xs"):e}changeImgSize(e,t){if(!e||!d.default.isString(e))return e;if(!t||!d.default.isString(t))return e;const i=/<img([\w\W]+?)>/gi;let n;for(;n=i.exec(e);){const i=n[0];if(i.includes("data:image"))continue;const a=/^<img\s(.+?)(-[A-Z]{2})?\.(?=[^.]*$)(.+)>/gi.exec(i);if(null!==a)if(i.includes("data-stratus-src"))e=e.replace(i,`<img ${a[1]}-${t}.${a[3]}>`);else{if(!i.includes("cdn.sitetheory.io"))continue;if(d.default.isEmpty(a[2]))continue;e=e.replace(i,`<img data-stratus-src ${a[1]}-${t}.${a[3]}>`)}else console.warn("Unable to find file name for image src:",i)}return e}handleError(e){return console.error(e),e}fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(l.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber)return this.dev&&console.warn(`[defer] debouncing due to empty subscriber on ${this.uid}`),void setTimeout(()=>{this.dev&&console.warn(`[defer] debounced subscriber returned on ${this.uid}`),this.dataDefer(e)},250);const t=d.default.clone(this.dataString),i=this.dataRef();return t!==i?i||this.data&&this.data.completed?void((this.froalaConfig.useClasses||t!==i)&&(this.dev&&console.warn(`[subscriber] new value submitted on ${this.uid}:`,i),this.subscriber.next(i))):(this.dev&&console.warn(`[defer] debouncing subscriber due to unavailable data on ${this.uid}`,this.data),void setTimeout(()=>{this.dev&&console.warn(`[defer] debounced subscriber returned on ${this.uid}`),this.dataDefer(e)},250)):void 0}dataRef(){return this.model?this.dataString=this.normalizeIn(this.model.get(this.property)):""}onDataChange(){this.dataDefer(this.subscriber),this.refresh()}created(){}changedEditor(e){console.log("editor-change:",e)}onChangeEvent(e){console.log("change:",e)}onFocus(e){this.focused=!0,this.blurred=!1}onBlur(e){this.focused=!1,this.blurred=!0}bypassHTML(e){return this.sanitizer.bypassSecurityTrustHtml(e)}trigger(e,t,i){this.dev&&this.debug&&console.log("editor.trigger:",e,i),"media-library"===e?this.openMediaDialog(i):"code-view"===e&&this.openCodeViewDialog()}openMediaDialog(e){const t=this.dialog.open(g.MediaDialogComponent,{width:"1000px",data:{editor:this,eventManager:e,form:this.form,model:this.model,property:this.property}});this.refresh();const i=this;t.afterClosed().subscribe(e=>{e&&!d.default.isEmpty(e)&&(i.refresh(),this.dev&&e&&console.log("media dialog result:",e))})}openCodeViewDialog(){this.codeViewIsOpen=!0;const e=this.dialog.open(h.CodeViewDialogComponent,{width:"1000px",data:{form:this.form,model:this.model,property:this.property}});this.refresh(),e.afterClosed().subscribe(e=>{this.codeViewIsOpen=!1,e&&!d.default.isEmpty(e)&&(this.refresh(),this.dev&&e&&console.log("code view dialog result:",e))})}},C([i.Input(),T("design:type",String)],x.prototype,"target",void 0),C([i.Input(),T("design:type",String)],x.prototype,"targetSuffix",void 0),C([i.Input(),T("design:type",Number)],x.prototype,"id",void 0),C([i.Input(),T("design:type",Boolean)],x.prototype,"manifest",void 0),C([i.Input(),T("design:type",Boolean)],x.prototype,"decouple",void 0),C([i.Input(),T("design:type",Boolean)],x.prototype,"direct",void 0),C([i.Input(),T("design:type",Object)],x.prototype,"api",void 0),C([i.Input(),T("design:type",String)],x.prototype,"urlRoot",void 0),C([i.Input(),T("design:type",String)],x.prototype,"property",void 0),x=C([i.Component({selector:"sa-editor",templateUrl:`${v}/editor/editor.component${y}.html`}),T("design:paramtypes",[s.DomSanitizer,i.ChangeDetectorRef,i.ElementRef,n.FormBuilder,a.MatDialog])],x),e("EditorComponent",x)}}});
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/forms","@angular/material/dialog","@angular/material/snack-bar","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/backend.service","@stratusjs/angularjs/services/model","@stratusjs/angular/core/responsive.component"],function(e,t){"use strict";var i,a,s,r,d,n,o,l,c,m,u,h,f,g,p=this&&this.__decorate||function(e,t,i,a){var s,r=arguments.length,d=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(d=(r<3?s(d):r>3?s(t,i,d):s(t,i))||d);return r>3&&d&&Object.defineProperty(t,i,d),d},b=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},v=this&&this.__param||function(e,t){return function(i,a){t(i,a,e)}};t&&t.id;return{setters:[function(e){i=e},function(e){a=e},function(e){s=e},function(e){r=e},function(e){d=e},function(e){n=e},function(e){o=e},function(e){l=e},function(e){c=e},function(e){m=e},function(e){u=e}],execute:function(){"@stratusjs/angular","media-dialog","editor",h=l.cookie("env")?"":".min",f=`${o.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,g=class extends u.ResponsiveComponent{constructor(e,t,i,a,s,r){super(),this.dialogRef=e,this.data=t,this.fb=i,this.backend=a,this.snackBar=s,this.ref=r,this.title="media-dialog_component",this._=n.default,this.Stratus=o.Stratus,this.apiBase="/Api/Media",this.mediaEntities=[],this.isMediaLoading=!0,this.limit=20,this.eventInsert=!0,this.selected=[],this.embedly=!0}ngOnInit(){this.uid=n.default.uniqueId(`sa_${n.default.snakeCase("media-dialog")}_component_`),o.Stratus.Instances[this.uid]=this,o.Stratus.Internals.CssLoader(`${f}/editor/media-dialog.component${h}.css`),this.model=this.data.model,this.property=this.data.property,this.editor=this.data.editor,this.eventManager=this.data.eventManager,n.default.isBoolean(this.data.eventInsert)&&(this.eventInsert=this.data.eventInsert),this.dialogMediaForm=this.fb.group({mediaQueryInput:""}),this.dialogMediaForm.get("mediaQueryInput").valueChanges.pipe(d.debounceTime(300),d.tap(()=>{}),d.switchMap(e=>this.getQuery(e))).subscribe(e=>this.processMedia(e)),this.getQuery().subscribe(e=>this.processMedia(e)),this.refresh()}onCancelClick(){this.dialogRef.close(),this.refresh()}onPage(e){this.pageEvent=e,this.getQuery(this.lastMediaQuery).subscribe(e=>this.processMedia(e))}getQueryUrl(e){let t=this.limit,i=1;return this.pageEvent&&(t=this.pageEvent.pageSize,i=this.pageEvent.pageIndex+1),e=n.default.isString(e)&&!n.default.isEmpty(e)?`"${e}"`:"",`${this.apiBase}?limit=${t}&p=${i}&q=${e}`}getQuery(e){return this.lastMediaQuery=e,this.isMediaLoading=!0,this.backend.get(this.getQueryUrl(e)).pipe(d.finalize(()=>this.isMediaLoading=!1))}processMedia(e){if(!e.ok||200!==e.status||n.default.isEmpty(e.body))return this.meta={},this.mediaEntities=[],this.refresh(),this.mediaEntities;this.meta=n.default.get(e.body,"meta")||{};const t=n.default.get(e.body,"payload")||e.body;return n.default.isEmpty(t)||!Array.isArray(t)?(this.mediaEntities=[],this.isMediaLoading=!1,this.refresh(),this.mediaEntities):(this.mediaEntities=t,this.isMediaLoading=!1,this.refresh(),this.mediaEntities)}select(e){if(n.default.isUndefined(e))return;const t=this.createEmbed(e);return t?(this.selected.push(e.id),this.eventInsert?void(this.eventManager?this.eventManager.trigger("media-insert",t,this.editor):console.warn("media-dialog: event manager is not set.")):this.model instanceof m.Model&&n.default.isString(this.property)?(console.warn("media-dialog: disabling eventInsert is not recommended."),void this.model.set(this.property,this.model.get(this.property)+t)):void console.warn("media-dialog: event manager not available.")):(console.warn("media-dialog: unable to build embed for Media ID: "+e.id),void this.snackBar.open(`Unable to build embed for Media ID: ${e.id}.`,"dismiss",{duration:5e3,horizontalPosition:"right",verticalPosition:"bottom"}))}isSelected(e){if(!n.default.isUndefined(e))return n.default.includes(this.selected,e.id)}createEmbed(e){if(e._embedCode)return e._embedCode;if(n.default.startsWith(e.mime,"image"))return!e._thumbnailUrl||"directLink"===e.service&&!e.file?(console.warn("media-dialog: unable to determine image source for media id: "+e.id),null):`<img src="${e._thumbnailUrl||e.file}" alt="${e.name||e.filename}" ${"image/gif"!==e.mime?"data-stratus-src":""}">`;if("video"===e.mime){if(e.embed)return e.embed;const t='width="100%" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true" webkitAllowFullScreen="" mozAllowFullScreen=""';if("facebook"===e.service){const i=e.url||e.file;return i?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='${i}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 998px;">\n <a href="${i}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://www.facebook.com/plugins/video.php?href=${i}" ${t}></iframe>`:(console.warn("media-dialog: unable to find url for video with media id: "+e.id),null)}return e.serviceMediaId?"vimeo"===e.service?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='https://vimeo.com/${e.serviceMediaId}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 370px;">\n <a href="https://vimeo.com/${e.serviceMediaId}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://player.vimeo.com/video/${e.serviceMediaId}" ${t}></iframe>`:"youtube"===e.service?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='https://www.youtube.com/watch?v=${e.serviceMediaId}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 370px;">\n <a href="https://www.youtube.com/watch?v=${e.serviceMediaId}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://www.youtube.com/embed/${e.serviceMediaId}" ${t}></iframe>`:(console.warn(`media-dialog: unsupported service: ${e.service} for media id: ${e.id}`),null):(console.warn("media-dialog: unable to find serviceMediaId for video with media id: "+e.id),null)}return n.default.startsWith(e.mime,"audio")?e.url?`<audio controls>\n <source src="https://${e.url}" type="${e.mime}">\n <p>\n Your browser doesn't support HTML5 audio, but you can <a href="https://${e.url}">download the audio here</a>.\n </p>\n </audio>`:(console.warn("media-dialog: unable to determine audio source for media id: "+e.id),null):"application/pdf"===e.mime?e.url?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='https://${e.url}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 71px;">\n <a href="https://${e.url}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://docs.google.com/viewer?url=${e.url}&embedded=true" style="min-height: 500px;" width="100%"></iframe>`:(console.warn("media-dialog: unable to determine PDF source for media id: "+e.id),null):"application/msword"===e.mime?e.url?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='https://${e.url}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 71px;">\n <a href="https://${e.url}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://docs.google.com/viewer?url=${e.url}&embedded=true" style="min-height: 500px;" width="100%"></iframe>`:(console.warn("media-dialog: unable to determine Word Document source for media id: "+e.id),null):(console.warn(`media-dialog: unsupported mime type: ${e.mime} for media id: ${e.id}`),null)}},g=p([i.Component({selector:"sa-media-dialog",templateUrl:`${f}/editor/media-dialog.component${h}.html`}),v(1,i.Inject(s.MAT_DIALOG_DATA)),b("design:paramtypes",[s.MatDialogRef,Object,a.FormBuilder,c.BackendService,r.MatSnackBar,i.ChangeDetectorRef])],g),e("MediaDialogComponent",g)}}});
1
+ System.register(["@angular/core","@angular/forms","@angular/material/dialog","@angular/material/snack-bar","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/backend.service","@stratusjs/angularjs/services/model","@stratusjs/angular/core/responsive.component"],function(e,t){"use strict";var i,a,s,r,d,n,o,l,c,u,m,h,f,g,p,b=this&&this.__decorate||function(e,t,i,a){var s,r=arguments.length,d=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(d=(r<3?s(d):r>3?s(t,i,d):s(t,i))||d);return r>3&&d&&Object.defineProperty(t,i,d),d},v=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},y=this&&this.__param||function(e,t){return function(i,a){t(i,a,e)}};t&&t.id;return{setters:[function(e){i=e},function(e){a=e},function(e){s=e},function(e){r=e},function(e){d=e},function(e){n=e},function(e){o=e},function(e){l=e},function(e){c=e},function(e){u=e},function(e){m=e}],execute:function(){"@stratusjs/angular",h="media-dialog","editor",f=l.cookie("env")?"":".min",g=`${o.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,p=class extends m.ResponsiveComponent{constructor(e,t,i,a,s,r){super(),this.dialogRef=e,this.data=t,this.fb=i,this.backend=a,this.snackBar=s,this.ref=r,this.title=h+"_component",this._=n.default,this.Stratus=o.Stratus,this.apiBase="/Api/Media",this.mediaEntities=[],this.isMediaLoading=!0,this.limit=20,this.eventInsert=!0,this.selected=[],this.embedly=!0}ngOnInit(){this.uid=n.default.uniqueId(`sa_${n.default.snakeCase(h)}_component_`),o.Stratus.Instances[this.uid]=this,o.Stratus.Internals.CssLoader(`${g}/editor/media-dialog.component${f}.css`),this.model=this.data.model,this.property=this.data.property,this.editor=this.data.editor,this.eventManager=this.data.eventManager,n.default.isBoolean(this.data.eventInsert)&&(this.eventInsert=this.data.eventInsert),this.dialogMediaForm=this.fb.group({mediaQueryInput:""}),this.dialogMediaForm.get("mediaQueryInput").valueChanges.pipe(d.debounceTime(300),d.tap(()=>{}),d.switchMap(e=>this.getQuery(e))).subscribe(e=>this.processMedia(e)),this.getQuery().subscribe(e=>this.processMedia(e)),this.refresh()}onCancelClick(){this.dialogRef.close(),this.refresh()}onPage(e){this.pageEvent=e,this.getQuery(this.lastMediaQuery).subscribe(e=>this.processMedia(e))}getQueryUrl(e){let t=this.limit,i=1;return this.pageEvent&&(t=this.pageEvent.pageSize,i=this.pageEvent.pageIndex+1),e=n.default.isString(e)&&!n.default.isEmpty(e)?`"${e}"`:"",`${this.apiBase}?limit=${t}&p=${i}&q=${e}`}getQuery(e){return this.lastMediaQuery=e,this.isMediaLoading=!0,this.backend.get(this.getQueryUrl(e)).pipe(d.finalize(()=>this.isMediaLoading=!1))}processMedia(e){if(!e.ok||200!==e.status||n.default.isEmpty(e.body))return this.meta={},this.mediaEntities=[],this.refresh(),this.mediaEntities;this.meta=n.default.get(e.body,"meta")||{};const t=n.default.get(e.body,"payload")||e.body;return n.default.isEmpty(t)||!Array.isArray(t)?(this.mediaEntities=[],this.isMediaLoading=!1,this.refresh(),this.mediaEntities):(this.mediaEntities=t,this.isMediaLoading=!1,this.refresh(),this.mediaEntities)}select(e){if(n.default.isUndefined(e))return;const t=this.createEmbed(e);return t?(this.selected.push(e.id),this.eventInsert?void(this.eventManager?this.eventManager.trigger("media-insert",t,this.editor):console.warn("media-dialog: event manager is not set.")):this.model instanceof u.Model&&n.default.isString(this.property)?(console.warn("media-dialog: disabling eventInsert is not recommended."),void this.model.set(this.property,this.model.get(this.property)+t)):void console.warn("media-dialog: event manager not available.")):(console.warn(`media-dialog: unable to build embed for Media ID: ${e.id}`),void this.snackBar.open(`Unable to build embed for Media ID: ${e.id}.`,"dismiss",{duration:5e3,horizontalPosition:"right",verticalPosition:"bottom"}))}isSelected(e){if(!n.default.isUndefined(e))return n.default.includes(this.selected,e.id)}createEmbed(e){if(e._embedCode)return e._embedCode;if(n.default.startsWith(e.mime,"image"))return!e._thumbnailUrl||"directLink"===e.service&&!e.file?(console.warn(`media-dialog: unable to determine image source for media id: ${e.id}`),null):`<img src="${e._thumbnailUrl||e.file}" alt="${e.name||e.filename}" ${"image/gif"!==e.mime?"data-stratus-src":""}">`;if("video"===e.mime){if(e.embed)return e.embed;const t='width="100%" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true" webkitAllowFullScreen="" mozAllowFullScreen=""';if("facebook"===e.service){const i=e.url||e.file;return i?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='${i}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 998px;">\n <a href="${i}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://www.facebook.com/plugins/video.php?href=${i}" ${t}></iframe>`:(console.warn(`media-dialog: unable to find url for video with media id: ${e.id}`),null)}return e.serviceMediaId?"vimeo"===e.service?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='https://vimeo.com/${e.serviceMediaId}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 370px;">\n <a href="https://vimeo.com/${e.serviceMediaId}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://player.vimeo.com/video/${e.serviceMediaId}" ${t}></iframe>`:"youtube"===e.service?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='https://www.youtube.com/watch?v=${e.serviceMediaId}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 370px;">\n <a href="https://www.youtube.com/watch?v=${e.serviceMediaId}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://www.youtube.com/embed/${e.serviceMediaId}" ${t}></iframe>`:(console.warn(`media-dialog: unsupported service: ${e.service} for media id: ${e.id}`),null):(console.warn(`media-dialog: unable to find serviceMediaId for video with media id: ${e.id}`),null)}return n.default.startsWith(e.mime,"audio")?e.url?`<audio controls>\n <source src="https://${e.url}" type="${e.mime}">\n <p>\n Your browser doesn't support HTML5 audio, but you can <a href="https://${e.url}">download the audio here</a>.\n </p>\n </audio>`:(console.warn(`media-dialog: unable to determine audio source for media id: ${e.id}`),null):"application/pdf"===e.mime?e.url?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='https://${e.url}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 71px;">\n <a href="https://${e.url}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://docs.google.com/viewer?url=${e.url}&embedded=true" style="min-height: 500px;" width="100%"></iframe>`:(console.warn(`media-dialog: unable to determine PDF source for media id: ${e.id}`),null):"application/msword"===e.mime?e.url?this.embedly?`<div class="fr-embedly"\n data-original-embed="<a href='https://${e.url}' data-card-branding='0' class='embedly-card'></a>"\n style="height: 71px;">\n <a href="https://${e.url}" data-card-branding="0" class="embedly-card"></a>\n </div>`:`<iframe src="https://docs.google.com/viewer?url=${e.url}&embedded=true" style="min-height: 500px;" width="100%"></iframe>`:(console.warn(`media-dialog: unable to determine Word Document source for media id: ${e.id}`),null):(console.warn(`media-dialog: unsupported mime type: ${e.mime} for media id: ${e.id}`),null)}},p=b([i.Component({selector:"sa-media-dialog",templateUrl:`${g}/editor/media-dialog.component${f}.html`}),y(1,i.Inject(s.MAT_DIALOG_DATA)),v("design:paramtypes",[s.MatDialogRef,Object,a.FormBuilder,c.BackendService,r.MatSnackBar,i.ChangeDetectorRef])],p),e("MediaDialogComponent",p)}}});
@@ -1 +1 @@
1
- System.register(["@stratusjs/runtime/stratus","lodash"],function(t,e){"use strict";var s,n;e&&e.id;return{setters:[function(t){s=t},function(t){n=t}],execute:function(){t("InputButtonPlugin",class{constructor(t){this.debug=!1,this.name="inputButton",this.eventName="input-button",this.uid=n.default.uniqueId("input_button_"),s.Stratus.Instances[this.uid]=this,this.debug=t&&t.debug,t&&"object"==typeof t||(t={}),this.name=t.name||this.name,this.eventName=t.eventName||this.eventName,this.editor=t.editor||null}findUID(t){return"uid"in t.dataset?t.dataset.uid:this.findUID(t.parentElement)}getInstance(t){if(t in s.Stratus.Instances)return s.Stratus.Instances[t]}onClick(t){const e=this.findUID(t),s=this.getInstance(e);s&&(this.updateSnapshot(),s.trigger(this.eventName,null,this))}trigger(t,e,s){this.debug&&console.log(this.name+".trigger():",t,e,s),n.default.isString(e)?this.editor?"media-insert"===t?this.restoreSnapshot()&&(this.editor.html.insert(e),this.updateSnapshot()):console.warn(this.name+".trigger():",t,"event is not supported."):console.warn(this.name+".trigger(): unable to inject html without a set editor."):console.warn(this.name+".trigger():",e,"is not a data string.")}restoreSnapshot(){return this.snapshot?(this.editor.events.focus(),this.editor.snapshot.restore(this.snapshot),!0):(console.warn(this.name+".restoreSnapshot(): unable to restore editor session without a snapshot."),!1)}updateSnapshot(){this.snapshot=this.editor.snapshot.get()}})}}});
1
+ System.register(["@stratusjs/runtime/stratus","lodash"],function(t,e){"use strict";var s,n;e&&e.id;return{setters:[function(t){s=t},function(t){n=t}],execute:function(){t("InputButtonPlugin",class{constructor(t){this.debug=!1,this.name="inputButton",this.eventName="input-button",this.uid=n.default.uniqueId("input_button_"),s.Stratus.Instances[this.uid]=this,this.debug=t&&t.debug,t&&"object"==typeof t||(t={}),this.name=t.name||this.name,this.eventName=t.eventName||this.eventName,this.editor=t.editor||null}findUID(t){return"uid"in t.dataset?t.dataset.uid:this.findUID(t.parentElement)}getInstance(t){if(t in s.Stratus.Instances)return s.Stratus.Instances[t]}onClick(t){const e=this.findUID(t),s=this.getInstance(e);s&&(this.updateSnapshot(),s.trigger(this.eventName,null,this))}trigger(t,e,s){this.debug&&console.log(`${this.name}.trigger():`,t,e,s),n.default.isString(e)?this.editor?"media-insert"===t?this.restoreSnapshot()&&(this.editor.html.insert(e),this.updateSnapshot()):console.warn(`${this.name}.trigger():`,t,"event is not supported."):console.warn(`${this.name}.trigger(): unable to inject html without a set editor.`):console.warn(`${this.name}.trigger():`,e,"is not a data string.")}restoreSnapshot(){return this.snapshot?(this.editor.events.focus(),this.editor.snapshot.restore(this.snapshot),!0):(console.warn(`${this.name}.restoreSnapshot(): unable to restore editor session without a snapshot.`),!1)}updateSnapshot(){this.snapshot=this.editor.snapshot.get()}})}}});
@@ -1 +1 @@
1
- System.register(["@stratusjs/angular/froala/plugins/inputButton","froala-editor"],function(e,a){"use strict";var n,t;a&&a.id;return{setters:[function(e){n=e},function(e){t=e}],execute:function(){t.default.DEFAULTS=Object.assign(t.default.DEFAULTS,{endpoint:"/Api/Media"}),t.default.PLUGINS.mediaManager=function(e){let a;return{_init:function(){a=new n.InputButtonPlugin({name:"Media Manager",eventName:"media-library",editor:e,debug:!1})},onClick:function(){e.el?a.onClick(e.el):console.warn("mediaManager.onClick(): unable to find element")}}},t.default.DEFAULTS.imageInsertButtons.push("mediaManager"),t.default.RegisterCommand("mediaManager",{title:"Insert from Media Library",undo:!1,focus:!1,modal:!0,callback(){this.mediaManager.onClick()},plugin:"mediaManager"}),t.default.DefineIcon("mediaManager",{NAME:"folder",SVG_KEY:"imageManager"}),t.default.DefineIcon("mediaManagerInsert",{NAME:"plus",SVG_KEY:"add"}),t.default.DefineIcon("mediaManagerDelete",{NAME:"trash",SVG_KEY:"remove"}),t.default.RegisterQuickInsertButton("media",{icon:"mediaManager",title:"Insert from Media Library",callback:function(){const e=new n.InputButtonPlugin({name:"Media Manager",eventName:"media-library",editor:this,debug:!1});this.el?e.onClick(this.el):console.warn("mediaManager.onClick(): unable to find element")},undo:!0})}}});
1
+ System.register(["@stratusjs/angular/froala/plugins/inputButton","froala-editor"],function(e,a){"use strict";var n,t;a&&a.id;return{setters:[function(e){n=e},function(e){t=e}],execute:function(){t.default.DEFAULTS=Object.assign(t.default.DEFAULTS,{endpoint:"/Api/Media"}),t.default.PLUGINS.mediaManager=function(e){let a;return{_init:function(){a=new n.InputButtonPlugin({name:"Media Manager",eventName:"media-library",editor:e,debug:false})},onClick:function(){e.el?a.onClick(e.el):console.warn("mediaManager.onClick(): unable to find element")}}},t.default.DEFAULTS.imageInsertButtons.push("mediaManager"),t.default.RegisterCommand("mediaManager",{title:"Insert from Media Library",undo:!1,focus:!1,modal:!0,callback(){this.mediaManager.onClick()},plugin:"mediaManager"}),t.default.DefineIcon("mediaManager",{NAME:"folder",SVG_KEY:"imageManager"}),t.default.DefineIcon("mediaManagerInsert",{NAME:"plus",SVG_KEY:"add"}),t.default.DefineIcon("mediaManagerDelete",{NAME:"trash",SVG_KEY:"remove"}),t.default.RegisterQuickInsertButton("media",{icon:"mediaManager",title:"Insert from Media Library",callback:function(){const e=new n.InputButtonPlugin({name:"Media Manager",eventName:"media-library",editor:this,debug:!1});this.el?e.onClick(this.el):console.warn("mediaManager.onClick(): unable to find element")},undo:!0})}}});
@@ -1 +1 @@
1
- System.register(["@stratusjs/angular/froala/plugins/inputButton","froala-editor"],function(n,t){"use strict";var e,u;t&&t.id;return{setters:[function(n){e=n},function(n){u=n}],execute:function(){u.default.DEFAULTS=Object.assign(u.default.DEFAULTS,{}),u.default.PLUGINS.menuButton=function(n){let t;return{_init:function(){t=new e.InputButtonPlugin({name:"Menu Button",eventName:"menu-button",editor:n,debug:!1})},onClick:function(){n.el?t.onClick(n.el):console.warn("menuButton.onClick(): unable to find element")}}},u.default.DEFAULTS.menuButtons.push("menuButton"),u.default.RegisterCommand("menuButton",{title:"Insert from Menu Button",undo:!1,focus:!1,modal:!1,refreshAfterCallback:!0,callback(){this.menuButton.onClick()},plugin:"menuButton"}),u.default.DefineIcon("menuButton",{NAME:"folder",SVG_KEY:"imageManager"}),u.default.DefineIcon("menuButtonInsert",{NAME:"plus",SVG_KEY:"add"}),u.default.DefineIcon("menuButtonDelete",{NAME:"trash",SVG_KEY:"remove"}),u.default.RegisterQuickInsertButton("menu",{icon:"menuButton",title:"Insert from Menu Button",callback:function(){const n=new e.InputButtonPlugin({name:"Menu Button",eventName:"menu-button",editor:this,debug:!1});this.el?n.onClick(this.el):console.warn("menuButton.onClick(): unable to find element")},undo:!0})}}});
1
+ System.register(["@stratusjs/angular/froala/plugins/inputButton","froala-editor"],function(n,t){"use strict";var e,u;t&&t.id;return{setters:[function(n){e=n},function(n){u=n}],execute:function(){u.default.DEFAULTS=Object.assign(u.default.DEFAULTS,{}),u.default.PLUGINS.menuButton=function(n){let t;return{_init:function(){t=new e.InputButtonPlugin({name:"Menu Button",eventName:"menu-button",editor:n,debug:false})},onClick:function(){n.el?t.onClick(n.el):console.warn("menuButton.onClick(): unable to find element")}}},u.default.DEFAULTS.menuButtons.push("menuButton"),u.default.RegisterCommand("menuButton",{title:"Insert from Menu Button",undo:!1,focus:!1,modal:!1,refreshAfterCallback:!0,callback(){this.menuButton.onClick()},plugin:"menuButton"}),u.default.DefineIcon("menuButton",{NAME:"folder",SVG_KEY:"imageManager"}),u.default.DefineIcon("menuButtonInsert",{NAME:"plus",SVG_KEY:"add"}),u.default.DefineIcon("menuButtonDelete",{NAME:"trash",SVG_KEY:"remove"}),u.default.RegisterQuickInsertButton("menu",{icon:"menuButton",title:"Insert from Menu Button",callback:function(){const n=new e.InputButtonPlugin({name:"Menu Button",eventName:"menu-button",editor:this,debug:!1});this.el?n.onClick(this.el):console.warn("menuButton.onClick(): unable to find element")},undo:!0})}}});
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/cdk/drag-drop","rxjs","@angular/platform-browser","@angular/material/icon","@stratusjs/runtime/stratus","lodash","@stratusjs/core/environment","@stratusjs/angular/core/root.component","@stratusjs/angularjs/services/registry","@stratusjs/core/events/eventManager","@angular/cdk/scrolling"],function(e,t){"use strict";var i,r,s,o,n,a,l,d,c,h,u,g,p,m,f,v,y,I=this&&this.__decorate||function(e,t,i,r){var s,o=arguments.length,n=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n},S=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;function b(e,t){return Array.prototype.indexOf.call(e,t)}return{setters:[function(e){i=e},function(e){r=e},function(e){s=e},function(e){o=e},function(e){n=e},function(e){a=e},function(e){l=e},function(e){d=e},function(e){c=e},function(e){h=e},function(e){u=e},function(e){g=e}],execute:function(){"@stratusjs/angular",p="media-selector",m=d.cookie("env")?"":".min",f=`${a.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,v=(e,t)=>l.default.has(e,t)&&!l.default.isEmpty(l.default.get(e,t)),y=class extends c.RootComponent{constructor(e,t,i,r,o){super(),this.iconRegistry=e,this.sanitizer=t,this.ref=i,this.elementRef=r,this.viewportRuler=o,this.title=p+"_component",this._=l.default,this.has=v,this.log=console.log,this.Stratus=a.Stratus,this.registry=new h.Registry,this.onChange=new s.Subject,this.svgIcons={},this.styled=!1,this.empty=!1,this.libraryDisplay=!1,this.isSelector=!0,this.isGrid=!0,this.enterPredicate=(e,t)=>{if(t===this.placeholder)return!0;if(d.cookie("env")&&console.log("entering predicate..."),t!==this.activeContainer)return!1;const i=this.placeholder.element.nativeElement,r=e.dropContainer.element.nativeElement,s=t.element.nativeElement,o=b(s.parentElement.children,this.sourceList?i:r),n=b(s.parentElement.children,s);return this.sourceList||(this.sourceIndex=o,this.sourceList=e.dropContainer,i.style.width=r.clientWidth+"px",i.style.height=r.clientHeight+"px",r.parentElement.removeChild(r)),this.targetIndex=n,this.targetList=t,d.cookie("env")&&console.log("predicate:",this.sourceIndex,"->",this.targetIndex),i.style.display="",s.parentElement.insertBefore(i,n>o?s.nextSibling:s),this.placeholder._dropListRef.enter(e._dragRef,e.element.nativeElement.offsetLeft,e.element.nativeElement.offsetTop),!1},this.uid=l.default.uniqueId(`sa_${l.default.snakeCase(p)}_component_`),a.Stratus.Instances[this.uid]=this,this.dataSub=new s.Observable(e=>this.dataDefer(e)),this.targetList=null,this.sourceList=null,l.default.forEach({media_selector_add:a.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/add.svg",media_selector_clear:a.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/clear.svg",media_selector_delete:a.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/delete.svg",media_selector_edit:a.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/edit.svg",media_selector_info:a.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/info.svg",media_selector_image:a.Stratus.BaseUrl+"sitetheorymedia/images/mediaTypeIcons/media-icon-image.svg",media_selector_video:a.Stratus.BaseUrl+"sitetheorymedia/images/mediaTypeIcons/media-icon-video.svg",media_selector_audio:a.Stratus.BaseUrl+"sitetheorymedia/images/mediaTypeIcons/media-icon-audio.svg",media_selector_document:a.Stratus.BaseUrl+"sitetheorymedia/images/mediaTypeIcons/media-icon-document.svg"},(i,r)=>e.addSvgIcon(r,t.bypassSecurityTrustResourceUrl(i)).getNamedSvgIcon(r)),a.Stratus.Internals.CssLoader(`${f}${p}/${p}.component${m}.css`).then(()=>{this.styled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.styled=!0,this.refresh()}),this.hydrate(r,t,["title","uid","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","type","property","endpoint","_","has","log","Stratus","registry","fetched","data","collection","model","dataSub","onChange","subscriber","eventID","svgIcons","styled","empty","libraryDisplay","isSelector","isGrid","listGroup","placeholder","targetList","targetIndex","sourceList","sourceIndex","activeContainer","iconRegistry","sanitizer","ref","elementRef","viewportRuler","drop","moveModel","goToUrl","remove","fetchData","dataDefer","dataRef","onDataChange","prioritize","getSvg","addSvgIcon","toggleLibrary","showDetails","deleteMedia","removeFromSelected","dragEntered","move","moveItemInGrid","enterPredicate","getPointerPositionOnPage","hydrate","disableRefresh","stagger","reloading","refresh","ngOnDestroy"]),this.eventID=`${this.target}:${this.id}:${this.property}`,this.fetchData().then(e=>{if(!(e&&e instanceof u.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{e.completed&&(this.dataDefer(this.subscriber),this.prioritize(),this.refresh())};e.on("change",t),t()})}drop(e){const t=this.dataRef();if(!t||!t.length)return;d.cookie("env")&&console.log("drop:",e.previousContainer.id,e.container.id),this.isGrid&&this.moveItemInGrid(t)||(this.isGrid&&d.cookie("env")&&console.warn("moving item in grid failed. attempting fallback."),r.moveItemInArray(t,e.previousIndex,e.currentIndex));let i=0;l.default.forEach(t,e=>e.priority=i++),this.model.trigger("change")}moveModel(e,t){const i=this.dataRef();if(!i||!i.length)return;r.moveItemInArray(i,e,t);let s=0;l.default.forEach(i,e=>e.priority=s++),this.model.trigger("change")}goToUrl(e){e&&e.contentType?window.open(e.contentType.editUrl+"?id="+e.id,"_blank"):console.error("unable to execute goToUrl() because a valid model content was not provided.")}remove(e){const t=this.dataRef();if(!t||!t.length)return console.error("unable to remove model from selection:",t),void this.refresh();let i=t.indexOf(e);if(-1===i){const r=t.map(t=>e.id===t.id?t:null).filter(e=>e);l.default.isArray(r)&&r.length&&(i=t.indexOf(l.default.first(r)))}-1!==i?(t.splice(i,1),this.model.trigger("change"),this.removeFromSelected(e.id)):console.error("unable to find model:",e,"in selection:",t)}fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(a.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber||!this.model||!this.model.completed)return void setTimeout(()=>{this.dataDefer(e)},500);const t=this.dataRef();this.empty=!t.length,this.subscriber.next(t),this.refresh()}dataRef(){if(!this.model)return[];const e=this.model.get(this.property);return e&&l.default.isArray(e)?e:[]}onDataChange(){this.prioritize(),this.dataDefer(this.subscriber),this.refresh()}prioritize(){const e=this.dataRef();if(!e||!e.length)return;let t=0;l.default.forEach(e,e=>e.priority=t++)}getSvg(e,t){const i=this.addSvgIcon(e,t);return new s.Observable(t=>{this.iconRegistry.getNamedSvgIcon(i).subscribe({error(t){console.error(`getSvg(${e}): ${t}`)},complete(){t.next(i)}})})}addSvgIcon(e,t){if(e in this.svgIcons)return this.svgIcons[e];t||(t={});const i=this.svgIcons[e]=l.default.uniqueId("media_selector_svg");return this.iconRegistry.addSvgIcon(i,this.sanitizer.bypassSecurityTrustResourceUrl(e),t),i}toggleLibrary(){this.libraryDisplay=!this.libraryDisplay,a.Stratus.Environment.trigger(this.eventID,"toggleLibrary"),a.Stratus.Environment.trigger(this.eventID+":toggleLibrary",this.libraryDisplay)}showDetails(e){a.Stratus.Environment.trigger(this.eventID,"showDetails"),a.Stratus.Environment.trigger(this.eventID+":showDetails",e)}deleteMedia(e){a.Stratus.Environment.trigger(this.eventID,"deleteMedia"),a.Stratus.Environment.trigger(this.eventID+":deleteMedia",e)}removeFromSelected(e){a.Stratus.Environment.trigger(this.eventID,"removeFromSelected"),a.Stratus.Environment.trigger(this.eventID+":removeFromSelected",e)}dragEntered(e){const t=this.dataRef();if(!t||!t.length)return;const i=e.item,s=e.container,o=i.data,n=s.data,a=s.element.nativeElement,c=a.querySelector(".cdk-drag-placeholder");a.removeChild(c),a.parentElement.insertBefore(c,a),d.cookie("env")&&console.log("media move:",o,"->",n),r.moveItemInArray(t,o,n);let h=0;l.default.forEach(t,e=>e.priority=h++),this.model.trigger("change")}move(e){const t=this.getPointerPositionOnPage(e.event);!l.default.isUndefined(this.listGroup)&&this.listGroup?l.default.isUndefined(this.listGroup._items)?console.warn("this.listGroup._items does not exist:",this.listGroup):this.listGroup._items.forEach(e=>{(function(e,t,i){const{top:r,bottom:s,left:o,right:n}=e.element.nativeElement.getBoundingClientRect();return i>=r&&i<=s&&t>=o&&t<=n})(e,t.x,t.y)&&(this.activeContainer=e)}):console.warn("this.listGroup does not exist:",this)}moveItemInGrid(e){if(d.cookie("env")&&console.log("moveItemInGrid:",e),!this.targetList)return!1;const t=this.placeholder.element.nativeElement,i=t.parentElement;return t.style.display="none",i.removeChild(t),i.appendChild(t),i.insertBefore(this.sourceList.element.nativeElement,i.children[this.sourceIndex]),this.targetList=null,this.sourceList=null,this.sourceIndex!==this.targetIndex&&(r.moveItemInArray(e,this.sourceIndex,this.targetIndex),!0)}getPointerPositionOnPage(e){const t=function(e){return e.type.startsWith("touch")}(e)?e.touches[0]||e.changedTouches[0]:e,i=this.viewportRuler.getViewportScrollPosition();return{x:t.pageX-i.left,y:t.pageY-i.top}}},I([i.Input(),S("design:type",String)],y.prototype,"target",void 0),I([i.Input(),S("design:type",String)],y.prototype,"targetSuffix",void 0),I([i.Input(),S("design:type",Number)],y.prototype,"id",void 0),I([i.Input(),S("design:type",Boolean)],y.prototype,"manifest",void 0),I([i.Input(),S("design:type",Boolean)],y.prototype,"decouple",void 0),I([i.Input(),S("design:type",Boolean)],y.prototype,"direct",void 0),I([i.Input(),S("design:type",Object)],y.prototype,"api",void 0),I([i.Input(),S("design:type",String)],y.prototype,"urlRoot",void 0),I([i.Input(),S("design:type",String)],y.prototype,"type",void 0),I([i.Input(),S("design:type",String)],y.prototype,"property",void 0),I([i.Input(),S("design:type",String)],y.prototype,"endpoint",void 0),I([i.ViewChild(r.CdkDropListGroup),S("design:type",r.CdkDropListGroup)],y.prototype,"listGroup",void 0),I([i.ViewChild(r.CdkDropList),S("design:type",r.CdkDropList)],y.prototype,"placeholder",void 0),y=I([i.Component({selector:"sa-"+p,templateUrl:`${f}/${p}/${p}.component${m}.html`}),S("design:paramtypes",[n.MatIconRegistry,o.DomSanitizer,i.ChangeDetectorRef,i.ElementRef,g.ViewportRuler])],y),e("MediaSelectorComponent",y)}}});
1
+ System.register(["@angular/core","@angular/cdk/drag-drop","rxjs","@angular/platform-browser","@angular/material/icon","@stratusjs/runtime/stratus","lodash","@stratusjs/core/environment","@stratusjs/angular/core/root.component","@stratusjs/angularjs/services/registry","@stratusjs/core/events/eventManager","@angular/cdk/scrolling"],function(e,t){"use strict";var i,r,s,o,n,a,l,d,c,h,u,g,p,m,f,v,y,I=this&&this.__decorate||function(e,t,i,r){var s,o=arguments.length,n=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n},S=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;function b(e,t){return Array.prototype.indexOf.call(e,t)}return{setters:[function(e){i=e},function(e){r=e},function(e){s=e},function(e){o=e},function(e){n=e},function(e){a=e},function(e){l=e},function(e){d=e},function(e){c=e},function(e){h=e},function(e){u=e},function(e){g=e}],execute:function(){"@stratusjs/angular",p="media-selector",m=d.cookie("env")?"":".min",f=`${a.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,v=(e,t)=>l.default.has(e,t)&&!l.default.isEmpty(l.default.get(e,t)),y=class extends c.RootComponent{constructor(e,t,i,r,o){super(),this.iconRegistry=e,this.sanitizer=t,this.ref=i,this.elementRef=r,this.viewportRuler=o,this.title=p+"_component",this._=l.default,this.has=v,this.log=console.log,this.Stratus=a.Stratus,this.registry=new h.Registry,this.onChange=new s.Subject,this.svgIcons={},this.styled=!1,this.empty=!1,this.libraryDisplay=!1,this.isSelector=!0,this.isGrid=!0,this.enterPredicate=(e,t)=>{if(t===this.placeholder)return!0;if(d.cookie("env")&&console.log("entering predicate..."),t!==this.activeContainer)return!1;const i=this.placeholder.element.nativeElement,r=e.dropContainer.element.nativeElement,s=t.element.nativeElement,o=b(s.parentElement.children,this.sourceList?i:r),n=b(s.parentElement.children,s);return this.sourceList||(this.sourceIndex=o,this.sourceList=e.dropContainer,i.style.width=`${r.clientWidth}px`,i.style.height=`${r.clientHeight}px`,r.parentElement.removeChild(r)),this.targetIndex=n,this.targetList=t,d.cookie("env")&&console.log("predicate:",this.sourceIndex,"->",this.targetIndex),i.style.display="",s.parentElement.insertBefore(i,n>o?s.nextSibling:s),this.placeholder._dropListRef.enter(e._dragRef,e.element.nativeElement.offsetLeft,e.element.nativeElement.offsetTop),!1},this.uid=l.default.uniqueId(`sa_${l.default.snakeCase(p)}_component_`),a.Stratus.Instances[this.uid]=this,this.dataSub=new s.Observable(e=>this.dataDefer(e)),this.targetList=null,this.sourceList=null,l.default.forEach({media_selector_add:`${a.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/add.svg`,media_selector_clear:`${a.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/clear.svg`,media_selector_delete:`${a.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/delete.svg`,media_selector_edit:`${a.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/edit.svg`,media_selector_info:`${a.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/info.svg`,media_selector_image:`${a.Stratus.BaseUrl}sitetheorymedia/images/mediaTypeIcons/media-icon-image.svg`,media_selector_video:`${a.Stratus.BaseUrl}sitetheorymedia/images/mediaTypeIcons/media-icon-video.svg`,media_selector_audio:`${a.Stratus.BaseUrl}sitetheorymedia/images/mediaTypeIcons/media-icon-audio.svg`,media_selector_document:`${a.Stratus.BaseUrl}sitetheorymedia/images/mediaTypeIcons/media-icon-document.svg`},(i,r)=>e.addSvgIcon(r,t.bypassSecurityTrustResourceUrl(i)).getNamedSvgIcon(r)),a.Stratus.Internals.CssLoader(`${f}${p}/${p}.component${m}.css`).then(()=>{this.styled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.styled=!0,this.refresh()}),this.hydrate(r,t,["title","uid","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","type","property","endpoint","_","has","log","Stratus","registry","fetched","data","collection","model","dataSub","onChange","subscriber","eventID","svgIcons","styled","empty","libraryDisplay","isSelector","isGrid","listGroup","placeholder","targetList","targetIndex","sourceList","sourceIndex","activeContainer","iconRegistry","sanitizer","ref","elementRef","viewportRuler","drop","moveModel","goToUrl","remove","fetchData","dataDefer","dataRef","onDataChange","prioritize","getSvg","addSvgIcon","toggleLibrary","showDetails","deleteMedia","removeFromSelected","dragEntered","move","moveItemInGrid","enterPredicate","getPointerPositionOnPage","hydrate","disableRefresh","stagger","reloading","refresh","ngOnDestroy"]),this.eventID=`${this.target}:${this.id}:${this.property}`,this.fetchData().then(e=>{if(!(e&&e instanceof u.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{e.completed&&(this.dataDefer(this.subscriber),this.prioritize(),this.refresh())};e.on("change",t),t()})}drop(e){const t=this.dataRef();if(!t||!t.length)return;d.cookie("env")&&console.log("drop:",e.previousContainer.id,e.container.id),this.isGrid&&this.moveItemInGrid(t)||(this.isGrid&&d.cookie("env")&&console.warn("moving item in grid failed. attempting fallback."),r.moveItemInArray(t,e.previousIndex,e.currentIndex));let i=0;l.default.forEach(t,e=>e.priority=i++),this.model.trigger("change")}moveModel(e,t){const i=this.dataRef();if(!i||!i.length)return;r.moveItemInArray(i,e,t);let s=0;l.default.forEach(i,e=>e.priority=s++),this.model.trigger("change")}goToUrl(e){e&&e.contentType?window.open(e.contentType.editUrl+"?id="+e.id,"_blank"):console.error("unable to execute goToUrl() because a valid model content was not provided.")}remove(e){const t=this.dataRef();if(!t||!t.length)return console.error("unable to remove model from selection:",t),void this.refresh();let i=t.indexOf(e);if(-1===i){const r=t.map(t=>e.id===t.id?t:null).filter(e=>e);l.default.isArray(r)&&r.length&&(i=t.indexOf(l.default.first(r)))}-1!==i?(t.splice(i,1),this.model.trigger("change"),this.removeFromSelected(e.id)):console.error("unable to find model:",e,"in selection:",t)}fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(a.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber||!this.model||!this.model.completed)return void setTimeout(()=>{this.dataDefer(e)},500);const t=this.dataRef();this.empty=!t.length,this.subscriber.next(t),this.refresh()}dataRef(){if(!this.model)return[];const e=this.model.get(this.property);return e&&l.default.isArray(e)?e:[]}onDataChange(){this.prioritize(),this.dataDefer(this.subscriber),this.refresh()}prioritize(){const e=this.dataRef();if(!e||!e.length)return;let t=0;l.default.forEach(e,e=>e.priority=t++)}getSvg(e,t){const i=this.addSvgIcon(e,t);return new s.Observable(t=>{this.iconRegistry.getNamedSvgIcon(i).subscribe({error(t){console.error(`getSvg(${e}): ${t}`)},complete(){t.next(i)}})})}addSvgIcon(e,t){if(e in this.svgIcons)return this.svgIcons[e];t||(t={});const i=this.svgIcons[e]=l.default.uniqueId("media_selector_svg");return this.iconRegistry.addSvgIcon(i,this.sanitizer.bypassSecurityTrustResourceUrl(e),t),i}toggleLibrary(){this.libraryDisplay=!this.libraryDisplay,a.Stratus.Environment.trigger(this.eventID,"toggleLibrary"),a.Stratus.Environment.trigger(`${this.eventID}:toggleLibrary`,this.libraryDisplay)}showDetails(e){a.Stratus.Environment.trigger(this.eventID,"showDetails"),a.Stratus.Environment.trigger(`${this.eventID}:showDetails`,e)}deleteMedia(e){a.Stratus.Environment.trigger(this.eventID,"deleteMedia"),a.Stratus.Environment.trigger(`${this.eventID}:deleteMedia`,e)}removeFromSelected(e){a.Stratus.Environment.trigger(this.eventID,"removeFromSelected"),a.Stratus.Environment.trigger(`${this.eventID}:removeFromSelected`,e)}dragEntered(e){const t=this.dataRef();if(!t||!t.length)return;const i=e.item,s=e.container,o=i.data,n=s.data,a=s.element.nativeElement,c=a.querySelector(".cdk-drag-placeholder");a.removeChild(c),a.parentElement.insertBefore(c,a),d.cookie("env")&&console.log("media move:",o,"->",n),r.moveItemInArray(t,o,n);let h=0;l.default.forEach(t,e=>e.priority=h++),this.model.trigger("change")}move(e){const t=this.getPointerPositionOnPage(e.event);!l.default.isUndefined(this.listGroup)&&this.listGroup?l.default.isUndefined(this.listGroup._items)?console.warn("this.listGroup._items does not exist:",this.listGroup):this.listGroup._items.forEach(e=>{(function(e,t,i){const{top:r,bottom:s,left:o,right:n}=e.element.nativeElement.getBoundingClientRect();return i>=r&&i<=s&&t>=o&&t<=n})(e,t.x,t.y)&&(this.activeContainer=e)}):console.warn("this.listGroup does not exist:",this)}moveItemInGrid(e){if(d.cookie("env")&&console.log("moveItemInGrid:",e),!this.targetList)return!1;const t=this.placeholder.element.nativeElement,i=t.parentElement;return t.style.display="none",i.removeChild(t),i.appendChild(t),i.insertBefore(this.sourceList.element.nativeElement,i.children[this.sourceIndex]),this.targetList=null,this.sourceList=null,this.sourceIndex!==this.targetIndex&&(r.moveItemInArray(e,this.sourceIndex,this.targetIndex),!0)}getPointerPositionOnPage(e){const t=function(e){return e.type.startsWith("touch")}(e)?e.touches[0]||e.changedTouches[0]:e,i=this.viewportRuler.getViewportScrollPosition();return{x:t.pageX-i.left,y:t.pageY-i.top}}},I([i.Input(),S("design:type",String)],y.prototype,"target",void 0),I([i.Input(),S("design:type",String)],y.prototype,"targetSuffix",void 0),I([i.Input(),S("design:type",Number)],y.prototype,"id",void 0),I([i.Input(),S("design:type",Boolean)],y.prototype,"manifest",void 0),I([i.Input(),S("design:type",Boolean)],y.prototype,"decouple",void 0),I([i.Input(),S("design:type",Boolean)],y.prototype,"direct",void 0),I([i.Input(),S("design:type",Object)],y.prototype,"api",void 0),I([i.Input(),S("design:type",String)],y.prototype,"urlRoot",void 0),I([i.Input(),S("design:type",String)],y.prototype,"type",void 0),I([i.Input(),S("design:type",String)],y.prototype,"property",void 0),I([i.Input(),S("design:type",String)],y.prototype,"endpoint",void 0),I([i.ViewChild(r.CdkDropListGroup),S("design:type",r.CdkDropListGroup)],y.prototype,"listGroup",void 0),I([i.ViewChild(r.CdkDropList),S("design:type",r.CdkDropList)],y.prototype,"placeholder",void 0),y=I([i.Component({selector:`sa-${p}`,templateUrl:`${f}/${p}/${p}.component${m}.html`}),S("design:paramtypes",[n.MatIconRegistry,o.DomSanitizer,i.ChangeDetectorRef,i.ElementRef,g.ViewportRuler])],y),e("MediaSelectorComponent",y)}}});
@@ -1 +1 @@
1
- System.register(["quill"],function(t,e){"use strict";var n,l,o,i;e&&e.id;function r(t){return document.createElement(t)}function s(t,e,n){return t.setAttribute(e,n)}function c(t,e){const n=t.container.querySelector(".ql-editor").innerHTML,l=r("div"),i=r("div"),c=e.msg||'Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced',u=e.cancelText||"Cancel",d=e.okText||"Ok";s(i,"class","ql-html-overlayContainer"),s(l,"class","ql-html-popupContainer");const a=r("i");s(a,"class","ql-html-popupTitle"),a.innerText=c;const p=r("div");p.appendChild(a),s(p,"class","ql-html-textContainer");const h=r("textarea");s(h,"class","ql-html-textArea"),h.value=function(t){const e=" ".repeat(2);let n=0;let l=null,i=null,r="";for(let o=0;o<=t.length;o++){l=t.substr(o,1),i=t.substr(o+1,1);const s="<br>"===t.substr(o,4),c="<"===l&&"/"===i&&!s;s&&(r+="\n",n--,o+=4),"<"===l&&"/"!==i&&!s?(r+="\n"+e.repeat(n),n++):c?(--n<0&&(n=0),r+="\n"+e.repeat(n)):(" "===l&&" "===i||"\n"===l&&""===t.substr(o,t.substr(o).indexOf("<")).trim())&&(l=""),r+=l}return o.log("formatHTML",{before:t,after:r}),r}(n);const b=r("button");b.innerHTML=u,s(b,"class","ql-html-buttonCancel");const m=r("button");m.innerHTML=d;const g=r("div");s(g,"class","ql-html-buttonGroup"),g.appendChild(b),g.appendChild(m),p.appendChild(h),p.appendChild(g),l.appendChild(p),i.appendChild(l),document.body.appendChild(i),b.onclick=()=>{document.body.removeChild(i)},i.onclick=b.onclick,l.onclick=t=>{t.preventDefault(),t.stopPropagation()},m.onclick=()=>{const e=h.value.split(/\r?\n/g).map(t=>t.trim()).join("");t.container.querySelector(".ql-editor").innerHTML=e,document.body.removeChild(i)}}return{setters:[function(t){n=t}],execute:function(){l=!1,o={prefixString:()=>"</> quill-html-edit-button: ",get log(){if(!l)return()=>{};return console.log.bind(console,this.prefixString())}},t("QuillHtmlEditPlugin",i=class{constructor(t,e){l=e&&e.debug,o.log("logging enabled");const n=t.getModule("toolbar");if(!n)throw new Error('quill.htmlEditButton requires the "toolbar" module to be included too');this.registerDivModule();const i=n.container,u=r("span");s(u,"class","ql-formats");const d=r("button");d.innerHTML=e.buttonHTML||"&lt;&gt;",d.title=e.buttonTitle||"Show HTML source",d.onclick=n=>{n.preventDefault(),c(t,e)},u.appendChild(d),i.appendChild(u)}registerDivModule(){const t=n.default.import("blots/block");class e extends t{}e.tagName="div",e.blotName="div",e.allowedChildren=t.allowedChildren,e.allowedChildren.push(t),n.default.register(e)}}),t("default",i)}}});
1
+ System.register(["quill"],function(t,e){"use strict";var n,l,o,i;e&&e.id;function r(t){return document.createElement(t)}function s(t,e,n){return t.setAttribute(e,n)}function c(t,e){const n=t.container.querySelector(".ql-editor").innerHTML,l=r("div"),i=r("div"),c=e.msg||'Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced',u=e.cancelText||"Cancel",d=e.okText||"Ok";s(i,"class","ql-html-overlayContainer"),s(l,"class","ql-html-popupContainer");const a=r("i");s(a,"class","ql-html-popupTitle"),a.innerText=c;const p=r("div");p.appendChild(a),s(p,"class","ql-html-textContainer");const h=r("textarea");s(h,"class","ql-html-textArea"),h.value=function(t){const e=!0,n=!0,l=" ".repeat(2);let i=0;const r="\n";let s=null,c=null,u="";for(let o=0;o<=t.length;o++){s=t.substr(o,1),c=t.substr(o+1,1);const d="<br>"===t.substr(o,4),a="<"===s&&"/"===c&&!d;d&&(u+=r,i--,o+=4),"<"===s&&"/"!==c&&!d?(u+=r+l.repeat(i),i++):a?(--i<0&&(i=0),u+=r+l.repeat(i)):(!0===e&&" "===s&&" "===c||!0===n&&s===r&&""===t.substr(o,t.substr(o).indexOf("<")).trim())&&(s=""),u+=s}return o.log("formatHTML",{before:t,after:u}),u}(n);const b=r("button");b.innerHTML=u,s(b,"class","ql-html-buttonCancel");const m=r("button");m.innerHTML=d;const g=r("div");s(g,"class","ql-html-buttonGroup"),g.appendChild(b),g.appendChild(m),p.appendChild(h),p.appendChild(g),l.appendChild(p),i.appendChild(l),document.body.appendChild(i),b.onclick=()=>{document.body.removeChild(i)},i.onclick=b.onclick,l.onclick=t=>{t.preventDefault(),t.stopPropagation()},m.onclick=()=>{const e=h.value.split(/\r?\n/g).map(t=>t.trim()).join("");t.container.querySelector(".ql-editor").innerHTML=e,document.body.removeChild(i)}}return{setters:[function(t){n=t}],execute:function(){l=!1,o={prefixString:()=>"</> quill-html-edit-button: ",get log(){if(!l)return()=>{};return console.log.bind(console,this.prefixString())}},t("QuillHtmlEditPlugin",i=class{constructor(t,e){l=e&&e.debug,o.log("logging enabled");const n=t.getModule("toolbar");if(!n)throw new Error('quill.htmlEditButton requires the "toolbar" module to be included too');this.registerDivModule();const i=n.container,u=r("span");s(u,"class","ql-formats");const d=r("button");d.innerHTML=e.buttonHTML||"&lt;&gt;",d.title=e.buttonTitle||"Show HTML source",d.onclick=n=>{n.preventDefault(),c(t,e)},u.appendChild(d),i.appendChild(u)}registerDivModule(){const t=n.default.import("blots/block");class e extends t{}e.tagName="div",e.blotName="div",e.allowedChildren=t.allowedChildren,e.allowedChildren.push(t),n.default.register(e)}}),t("default",i)}}});
@@ -1 +1 @@
1
- System.register(["quill"],function(t,s){"use strict";var e,r,o;s&&s.id;return{setters:[function(t){e=t}],execute:function(){r=e.default.import("formats/image"),o=["alt","height","width","stratus-src","stratusSrc"],t("QuillImageFormatPlugin",class extends r{constructor(){super(...arguments),this.blotName="imageCustom",this.tagName="IMG"}format(t,s){console.log("format:",t,s,this.domNode.getAttribute("src")),-1!==o.indexOf(t)?s?("stratus-src"===t&&console.log("stratus-src:",s),"stratusSrc"===t&&console.log("stratusSrc:",s),this.domNode.setAttribute(t,s)):this.domNode.removeAttribute(t):super.format(t,s)}})}}});
1
+ System.register(["quill"],function(t,s){"use strict";var e,r,o,i;s&&s.id;return{setters:[function(t){e=t}],execute:function(){r=e.default.import("formats/image"),o=["alt","height","width","stratus-src","stratusSrc"],i=class extends r{constructor(){super(...arguments),this.blotName="imageCustom",this.tagName="IMG"}format(t,s){console.log("format:",t,s,this.domNode.getAttribute("src")),-1!==o.indexOf(t)?s?("stratus-src"===t&&console.log("stratus-src:",s),"stratusSrc"===t&&console.log("stratusSrc:",s),this.domNode.setAttribute(t,s)):this.domNode.removeAttribute(t):super.format(t,s)}},t("QuillImageFormatPlugin",i)}}});
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/forms","@angular/cdk/drag-drop","rxjs","@angular/platform-browser","@angular/material/icon","@stratusjs/runtime/stratus","lodash","@stratusjs/core/environment","@stratusjs/angular/core/root.component","@stratusjs/angularjs/services/registry","@stratusjs/core/events/eventManager"],function(e,t){"use strict";var r,s,o,n,i,a,c,d,l,u,h,f,p,g,y,m,v=this&&this.__decorate||function(e,t,r,s){var o,n=arguments.length,i=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(n<3?o(i):n>3?o(t,r,i):o(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i},b=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;return{setters:[function(e){r=e},function(e){s=e},function(e){o=e},function(e){n=e},function(e){i=e},function(e){a=e},function(e){c=e},function(e){d=e},function(e){l=e},function(e){u=e},function(e){h=e},function(e){f=e}],execute:function(){"@stratusjs/angular","selector",p=l.cookie("env")?"":".min",g=`${c.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,y=(e,t)=>d.default.has(e,t)&&!d.default.isEmpty(d.default.get(e,t)),m=class extends u.RootComponent{constructor(e,t,r,o){super(),this.iconRegistry=e,this.sanitizer=t,this.ref=r,this.elementRef=o,this.title="selector_component",this._=d.default,this.has=y,this.log=console.log,this.Stratus=c.Stratus,this.selectCtrl=new s.FormControl,this.registry=new h.Registry,this.onChange=new n.Subject,this.svgIcons={},this.styled=!1,this.empty=!1,this.uid=d.default.uniqueId(`sa_${d.default.snakeCase("selector")}_component_`),c.Stratus.Instances[this.uid]=this,this.dataSub=new n.Observable(e=>this.dataDefer(e)),d.default.forEach({selector_delete:c.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/delete.svg",selector_edit:c.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/edit.svg"},(r,s)=>e.addSvgIcon(s,t.bypassSecurityTrustResourceUrl(r)).getNamedSvgIcon(s)),c.Stratus.Internals.CssLoader(`${g}selector/selector.component${p}.css`).then(()=>{this.styled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.styled=!0,this.refresh()}),this.hydrate(o,t,["title","uid","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","type","property","endpoint","_","has","log","Stratus","selectCtrl","registry","fetched","data","collection","model","dataSub","onChange","subscriber","svgIcons","styled","empty","iconRegistry","sanitizer","ref","elementRef","drop","goToUrl","remove","fetchData","dataDefer","dataRef","onDataChange","prioritize","getSvg","addSvgIcon","hydrate","disableRefresh","stagger","reloading","refresh","ngOnDestroy"]),this.fetchData().then(e=>{if(!(e&&e instanceof f.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{e.completed&&(this.dataDefer(this.subscriber),this.prioritize(),this.refresh())};e.on("change",t),t()})}drop(e){const t=this.dataRef();if(!t||!t.length)return;o.moveItemInArray(t,e.previousIndex,e.currentIndex);let r=0;d.default.forEach(t,e=>e.priority=r++),this.model.trigger("change")}goToUrl(e){e&&e.contentType?window.open(e.contentType.editUrl+"?id="+e.id,"_blank"):console.error("unable to execute goToUrl() because a valid model content was not provided.")}remove(e){const t=this.dataRef();if(!t||!t.length)return console.error("unable to remove model from selection:",t),void this.refresh();let r=t.indexOf(e);if(-1===r){const s=t.map(t=>e.id===t.id?t:null).filter(e=>e);d.default.isArray(s)&&s.length&&(r=t.indexOf(d.default.first(s)))}-1!==r?(t.splice(r,1),this.model.trigger("change")):console.error("unable to find model:",e,"in selection:",t)}fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(c.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber||!this.model||!this.model.completed)return void setTimeout(()=>{this.dataDefer(e)},500);const t=this.dataRef();this.empty=!t.length,this.subscriber.next(t),this.refresh()}dataRef(){if(!this.model)return[];const e=this.model.get(this.property);return e&&d.default.isArray(e)?e:[]}onDataChange(){this.prioritize(),this.dataDefer(this.subscriber),this.refresh()}prioritize(){const e=this.dataRef();if(!e||!e.length)return;let t=0;d.default.forEach(e,e=>e.priority=t++)}getSvg(e,t){const r=this.addSvgIcon(e,t);return new n.Observable(t=>{this.iconRegistry.getNamedSvgIcon(r).subscribe({error(t){console.error(`getSvg(${e}): ${t}`)},complete(){t.next(r)}})})}addSvgIcon(e,t){if(e in this.svgIcons)return this.svgIcons[e];t||(t={});const r=this.svgIcons[e]=d.default.uniqueId("selector_svg");return this.iconRegistry.addSvgIcon(r,this.sanitizer.bypassSecurityTrustResourceUrl(e),t),r}},v([r.Input(),b("design:type",String)],m.prototype,"target",void 0),v([r.Input(),b("design:type",String)],m.prototype,"targetSuffix",void 0),v([r.Input(),b("design:type",Number)],m.prototype,"id",void 0),v([r.Input(),b("design:type",Boolean)],m.prototype,"manifest",void 0),v([r.Input(),b("design:type",Boolean)],m.prototype,"decouple",void 0),v([r.Input(),b("design:type",Boolean)],m.prototype,"direct",void 0),v([r.Input(),b("design:type",Object)],m.prototype,"api",void 0),v([r.Input(),b("design:type",String)],m.prototype,"urlRoot",void 0),v([r.Input(),b("design:type",String)],m.prototype,"type",void 0),v([r.Input(),b("design:type",String)],m.prototype,"property",void 0),v([r.Input(),b("design:type",String)],m.prototype,"endpoint",void 0),m=v([r.Component({selector:"sa-selector",templateUrl:`${g}/selector/selector.component${p}.html`}),b("design:paramtypes",[a.MatIconRegistry,i.DomSanitizer,r.ChangeDetectorRef,r.ElementRef])],m),e("SelectorComponent",m)}}});
1
+ System.register(["@angular/core","@angular/forms","@angular/cdk/drag-drop","rxjs","@angular/platform-browser","@angular/material/icon","@stratusjs/runtime/stratus","lodash","@stratusjs/core/environment","@stratusjs/angular/core/root.component","@stratusjs/angularjs/services/registry","@stratusjs/core/events/eventManager"],function(e,t){"use strict";var r,s,o,n,i,a,c,d,l,u,h,f,p,g,y,m,v,b=this&&this.__decorate||function(e,t,r,s){var o,n=arguments.length,i=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(n<3?o(i):n>3?o(t,r,i):o(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i},S=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;return{setters:[function(e){r=e},function(e){s=e},function(e){o=e},function(e){n=e},function(e){i=e},function(e){a=e},function(e){c=e},function(e){d=e},function(e){l=e},function(e){u=e},function(e){h=e},function(e){f=e}],execute:function(){"@stratusjs/angular",p="selector",g=l.cookie("env")?"":".min",y=`${c.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,m=(e,t)=>d.default.has(e,t)&&!d.default.isEmpty(d.default.get(e,t)),v=class extends u.RootComponent{constructor(e,t,r,o){super(),this.iconRegistry=e,this.sanitizer=t,this.ref=r,this.elementRef=o,this.title="selector_component",this._=d.default,this.has=m,this.log=console.log,this.Stratus=c.Stratus,this.selectCtrl=new s.FormControl,this.registry=new h.Registry,this.onChange=new n.Subject,this.svgIcons={},this.styled=!1,this.empty=!1,this.uid=d.default.uniqueId(`sa_${d.default.snakeCase(p)}_component_`),c.Stratus.Instances[this.uid]=this,this.dataSub=new n.Observable(e=>this.dataDefer(e)),d.default.forEach({selector_delete:`${c.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/delete.svg`,selector_edit:`${c.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/edit.svg`},(r,s)=>e.addSvgIcon(s,t.bypassSecurityTrustResourceUrl(r)).getNamedSvgIcon(s)),c.Stratus.Internals.CssLoader(`${y}selector/selector.component${g}.css`).then(()=>{this.styled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.styled=!0,this.refresh()}),this.hydrate(o,t,["title","uid","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","type","property","endpoint","_","has","log","Stratus","selectCtrl","registry","fetched","data","collection","model","dataSub","onChange","subscriber","svgIcons","styled","empty","iconRegistry","sanitizer","ref","elementRef","drop","goToUrl","remove","fetchData","dataDefer","dataRef","onDataChange","prioritize","getSvg","addSvgIcon","hydrate","disableRefresh","stagger","reloading","refresh","ngOnDestroy"]),this.fetchData().then(e=>{if(!(e&&e instanceof f.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{e.completed&&(this.dataDefer(this.subscriber),this.prioritize(),this.refresh())};e.on("change",t),t()})}drop(e){const t=this.dataRef();if(!t||!t.length)return;o.moveItemInArray(t,e.previousIndex,e.currentIndex);let r=0;d.default.forEach(t,e=>e.priority=r++),this.model.trigger("change")}goToUrl(e){e&&e.contentType?window.open(e.contentType.editUrl+"?id="+e.id,"_blank"):console.error("unable to execute goToUrl() because a valid model content was not provided.")}remove(e){const t=this.dataRef();if(!t||!t.length)return console.error("unable to remove model from selection:",t),void this.refresh();let r=t.indexOf(e);if(-1===r){const s=t.map(t=>e.id===t.id?t:null).filter(e=>e);d.default.isArray(s)&&s.length&&(r=t.indexOf(d.default.first(s)))}-1!==r?(t.splice(r,1),this.model.trigger("change")):console.error("unable to find model:",e,"in selection:",t)}fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(c.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber||!this.model||!this.model.completed)return void setTimeout(()=>{this.dataDefer(e)},500);const t=this.dataRef();this.empty=!t.length,this.subscriber.next(t),this.refresh()}dataRef(){if(!this.model)return[];const e=this.model.get(this.property);return e&&d.default.isArray(e)?e:[]}onDataChange(){this.prioritize(),this.dataDefer(this.subscriber),this.refresh()}prioritize(){const e=this.dataRef();if(!e||!e.length)return;let t=0;d.default.forEach(e,e=>e.priority=t++)}getSvg(e,t){const r=this.addSvgIcon(e,t);return new n.Observable(t=>{this.iconRegistry.getNamedSvgIcon(r).subscribe({error(t){console.error(`getSvg(${e}): ${t}`)},complete(){t.next(r)}})})}addSvgIcon(e,t){if(e in this.svgIcons)return this.svgIcons[e];t||(t={});const r=this.svgIcons[e]=d.default.uniqueId("selector_svg");return this.iconRegistry.addSvgIcon(r,this.sanitizer.bypassSecurityTrustResourceUrl(e),t),r}},b([r.Input(),S("design:type",String)],v.prototype,"target",void 0),b([r.Input(),S("design:type",String)],v.prototype,"targetSuffix",void 0),b([r.Input(),S("design:type",Number)],v.prototype,"id",void 0),b([r.Input(),S("design:type",Boolean)],v.prototype,"manifest",void 0),b([r.Input(),S("design:type",Boolean)],v.prototype,"decouple",void 0),b([r.Input(),S("design:type",Boolean)],v.prototype,"direct",void 0),b([r.Input(),S("design:type",Object)],v.prototype,"api",void 0),b([r.Input(),S("design:type",String)],v.prototype,"urlRoot",void 0),b([r.Input(),S("design:type",String)],v.prototype,"type",void 0),b([r.Input(),S("design:type",String)],v.prototype,"property",void 0),b([r.Input(),S("design:type",String)],v.prototype,"endpoint",void 0),v=b([r.Component({selector:"sa-selector",templateUrl:`${y}/selector/selector.component${g}.html`}),S("design:paramtypes",[a.MatIconRegistry,i.DomSanitizer,r.ChangeDetectorRef,r.ElementRef])],v),e("SelectorComponent",v)}}});
@@ -97,7 +97,7 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
97
97
  this.data.content = value;
98
98
  this.data.url = null;
99
99
  }
100
- return this.backend.get(this.lastContentSelectorQuery)
100
+ return this.backend.get(this.lastContentSelectorQuery || this.basicContentSelectorQuery)
101
101
  .pipe(operators_1.finalize(() => {
102
102
  this.isContentLoading = false;
103
103
  this.isContentLoaded = true;
@@ -1 +1 @@
1
- {"version":3,"sources":["tree-dialog.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuFM,SAAS,GAAG,oBAAoB,CAAA;YAChC,UAAU,GAAG,aAAa,CAAA;YAC1B,gBAAgB,GAAG,MAAM,CAAA;YAGzB,GAAG,GAAG,CAAC,oBAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;YAClC,QAAQ,GAAG,GAAG,iBAAO,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAA;YAU3F,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,0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E,OAAO,CAAC,CAAA;gBACzC,CAAC;gBAED,aAAa,CAAC,IAA2B,EAAE,QAAwB;oBAC/D,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;wBACvB,OAAO,IAAI,CAAA;qBACd;oBACD,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;wBAC3B,OAAO,IAAI,CAAA;qBACd;oBACD,MAAM,WAAW,GAAG,gBAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;oBACjC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAA;oBACzD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;wBAEd,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;wBAC7B,OAAO,WAAW,CAAA;qBACrB;oBACD,2BAAe,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;oBACtC,OAAO,WAAW,CAAA;gBACtB,CAAC;aACJ,CAAA;YArSY,mBAAmB;gBAL/B,gBAAS,CAAC;oBACP,QAAQ,EAAE,MAAM,UAAU,EAAE;oBAC5B,WAAW,EAAE,GAAG,QAAQ,IAAI,gBAAgB,IAAI,UAAU,aAAa,GAAG,OAAO;iBAEpF,CAAC;gBA8CO,WAAA,aAAM,CAAC,wBAAe,CAAC,CAAA;iDADN,qBAAY,UAElB,mBAAW;oBAER,wBAAiB;eAhD3B,mBAAmB,CAqS/B;;QACD,CAAC","file":"tree-dialog.component.js"}
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/forms","@angular/cdk/drag-drop","@angular/material/dialog","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/core/responsive.component"],function(t,e){"use strict";var n,i,s,o,r,a,d,l,u,c,h,f,g=this&&this.__decorate||function(t,e,n,i){var s,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,n,r):s(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},p=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C=this&&this.__param||function(t,e){return function(n,i){e(n,i,t)}};e&&e.id;return{setters:[function(t){n=t},function(t){i=t},function(t){s=t},function(t){o=t},function(t){r=t},function(t){a=t},function(t){d=t},function(t){l=t},function(t){u=t}],execute:function(){"@stratusjs/angular","tree-dialog","tree",c=l.cookie("env")?"":".min",h=`${d.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,f=class extends u.ResponsiveComponent{constructor(t,e,n,i){super(),this.dialogRef=t,this.data=e,this.fb=n,this.ref=i,this.title="tree-dialog_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=a.default,this.Stratus=d.Stratus,this.isContentLoading=!1,this.isContentLoaded=!1,this.basicContentSelectorQuery="/Api/Content?options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true&q="}ngOnInit(){this.uid=a.default.uniqueId(`sa_${a.default.snakeCase("tree-dialog")}_component_`),d.Stratus.Instances[this.uid]=this,d.Stratus.Internals.CssLoader(`${h}/tree/tree-dialog.component${c}.css`).then(()=>{this.isStyled=!0}).catch(t=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(t),this.isStyled=!0}),this.tree=this.data.tree,this.treeNode=this.data.treeNode,this.backend=this.data.backend,this.iconRegistry=this.data.iconRegistry,this.dialogContentForm=this.fb.group({contentSelectorInput:this.data.content||null}),this.dialogContentForm.get("contentSelectorInput").valueChanges.pipe(r.debounceTime(300),r.tap(()=>this.isContentLoading=!0),r.switchMap(t=>(a.default.isString(t)?this.lastContentSelectorQuery=`${this.basicContentSelectorQuery}${t}`:(this.data.content=t,this.data.url=null),this.backend.get(this.lastContentSelectorQuery).pipe(r.finalize(()=>{this.isContentLoading=!1,this.isContentLoaded=!0}))))).subscribe(t=>this.handleContent(t)),this.backend.get(this.basicContentSelectorQuery).pipe(r.finalize(()=>this.isContentLoading=!1)).subscribe(t=>this.handleContent(t)),this.isInitialized=!0}ngOnDestroy(){this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(t=>t()):super.refresh()}onCancelClick(){this.dialogRef.close()}onBrowserTargetChange(t){this.data.browserTarget=this.browserTarget?"_blank":null}displayContentText(t){if(!t)return;const e=a.default.get(t,"routing[0].url"),n=a.default.isUndefined(e)?" (No route!)":` (/${e})`,i=a.default.get(t,"id"),s=a.default.isUndefined(i)?null:"Content: "+i;return(a.default.get(t,"version.title")||s)+n}handleContent(t){if(!t.ok||200!==t.status||a.default.isEmpty(t.body))return this.filteredContent=[],this.filteredContent;const e=a.default.get(t.body,"payload")||t.body;return a.default.isEmpty(e)||!Array.isArray(e)?(this.filteredContent=[],this.filteredContent):(this.filteredContent=this.selectedOnTop(e,this.data.content),this.filteredContent)}destroy(){this.treeNode.destroy().afterClosed().subscribe(t=>{t&&this.onCancelClick()})}toggleStatus(){this.treeNode.toggleStatus()}addChild(){this.treeNode.addChild()}isSelected(t){return!!this.data.content&&this.data.content.id===t.id}getSvg(t,e){return this.tree.getSvg(t,e)}selectedOnTop(t,e){if(!t||!t.length)return t;if(!e||!e.id)return t;const n=a.default.clone(t),i=t.findIndex(t=>t.id===e.id);return-1===i?(n.unshift(e),n):(s.moveItemInArray(n,i,0),n)}},f=g([n.Component({selector:"sa-tree-dialog",templateUrl:`${h}/tree/tree-dialog.component${c}.html`}),C(1,n.Inject(o.MAT_DIALOG_DATA)),p("design:paramtypes",[o.MatDialogRef,Object,i.FormBuilder,n.ChangeDetectorRef])],f),t("TreeDialogComponent",f)}}});
1
+ System.register(["@angular/core","@angular/forms","@angular/cdk/drag-drop","@angular/material/dialog","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/core/responsive.component"],function(t,e){"use strict";var n,i,s,o,r,a,d,l,u,c,h,f,g,p=this&&this.__decorate||function(t,e,n,i){var s,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,n,r):s(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},C=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y=this&&this.__param||function(t,e){return function(n,i){e(n,i,t)}};e&&e.id;return{setters:[function(t){n=t},function(t){i=t},function(t){s=t},function(t){o=t},function(t){r=t},function(t){a=t},function(t){d=t},function(t){l=t},function(t){u=t}],execute:function(){"@stratusjs/angular",c="tree-dialog","tree",h=l.cookie("env")?"":".min",f=`${d.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,g=class extends u.ResponsiveComponent{constructor(t,e,n,i){super(),this.dialogRef=t,this.data=e,this.fb=n,this.ref=i,this.title="tree-dialog_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=a.default,this.Stratus=d.Stratus,this.isContentLoading=!1,this.isContentLoaded=!1,this.basicContentSelectorQuery="/Api/Content?options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true&q="}ngOnInit(){this.uid=a.default.uniqueId(`sa_${a.default.snakeCase(c)}_component_`),d.Stratus.Instances[this.uid]=this,d.Stratus.Internals.CssLoader(`${f}/tree/tree-dialog.component${h}.css`).then(()=>{this.isStyled=!0}).catch(t=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(t),this.isStyled=!0}),this.tree=this.data.tree,this.treeNode=this.data.treeNode,this.backend=this.data.backend,this.iconRegistry=this.data.iconRegistry,this.dialogContentForm=this.fb.group({contentSelectorInput:this.data.content||null}),this.dialogContentForm.get("contentSelectorInput").valueChanges.pipe(r.debounceTime(300),r.tap(()=>this.isContentLoading=!0),r.switchMap(t=>(a.default.isString(t)?this.lastContentSelectorQuery=`${this.basicContentSelectorQuery}${t}`:(this.data.content=t,this.data.url=null),this.backend.get(this.lastContentSelectorQuery||this.basicContentSelectorQuery).pipe(r.finalize(()=>{this.isContentLoading=!1,this.isContentLoaded=!0}))))).subscribe(t=>this.handleContent(t)),this.backend.get(this.basicContentSelectorQuery).pipe(r.finalize(()=>this.isContentLoading=!1)).subscribe(t=>this.handleContent(t)),this.isInitialized=!0}ngOnDestroy(){this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(t=>t()):super.refresh()}onCancelClick(){this.dialogRef.close()}onBrowserTargetChange(t){this.data.browserTarget=this.browserTarget?"_blank":null}displayContentText(t){if(!t)return;const e=a.default.get(t,"routing[0].url"),n=a.default.isUndefined(e)?" (No route!)":` (/${e})`,i=a.default.get(t,"id"),s=a.default.isUndefined(i)?null:`Content: ${i}`;return(a.default.get(t,"version.title")||s)+n}handleContent(t){if(!t.ok||200!==t.status||a.default.isEmpty(t.body))return this.filteredContent=[],this.filteredContent;const e=a.default.get(t.body,"payload")||t.body;return a.default.isEmpty(e)||!Array.isArray(e)?(this.filteredContent=[],this.filteredContent):(this.filteredContent=this.selectedOnTop(e,this.data.content),this.filteredContent)}destroy(){this.treeNode.destroy().afterClosed().subscribe(t=>{t&&this.onCancelClick()})}toggleStatus(){this.treeNode.toggleStatus()}addChild(){this.treeNode.addChild()}isSelected(t){return!!this.data.content&&this.data.content.id===t.id}getSvg(t,e){return this.tree.getSvg(t,e)}selectedOnTop(t,e){if(!t||!t.length)return t;if(!e||!e.id)return t;const n=a.default.clone(t),i=t.findIndex(t=>t.id===e.id);return-1===i?(n.unshift(e),n):(s.moveItemInArray(n,i,0),n)}},g=p([n.Component({selector:"sa-tree-dialog",templateUrl:`${f}/tree/tree-dialog.component${h}.html`}),y(1,n.Inject(o.MAT_DIALOG_DATA)),C("design:paramtypes",[o.MatDialogRef,Object,i.FormBuilder,n.ChangeDetectorRef])],g),t("TreeDialogComponent",g)}}});
@@ -213,7 +213,7 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
213
213
  this.data.content = value
214
214
  this.data.url = null
215
215
  }
216
- return this.backend.get(this.lastContentSelectorQuery)
216
+ return this.backend.get(this.lastContentSelectorQuery || this.basicContentSelectorQuery)
217
217
  .pipe(
218
218
  finalize(() => {
219
219
  this.isContentLoading = false
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/material/dialog","@stratusjs/angular/tree/tree.component","@stratusjs/angular/tree/tree-dialog.component","@stratusjs/angular/confirm-dialog/confirm-dialog.component","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/core/responsive.component"],function(e,t){"use strict";var n,o,s,i,r,d,a,l,h,c,u,m,g=this&&this.__decorate||function(e,t,n,o){var s,i=arguments.length,r=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(s=e[d])&&(r=(i<3?s(r):i>3?s(t,n,r):s(t,n))||r);return i>3&&r&&Object.defineProperty(t,n,r),r},p=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;return{setters:[function(e){n=e},function(e){o=e},function(e){s=e},function(e){i=e},function(e){r=e},function(e){d=e},function(e){a=e},function(e){l=e},function(e){h=e}],execute:function(){"@stratusjs/angular","tree-node","tree",c=l.cookie("env")?"":".min",u=`${a.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,m=class extends h.ResponsiveComponent{constructor(e,t){super(),this.dialog=e,this.ref=t,this.title="tree-node_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=d.default,this.Stratus=a.Stratus,this.hasChild=e=>e.children&&e.children.length>0,this.isExpanded=e=>!e.meta||e.meta.expanded}ngOnInit(){this.uid=d.default.uniqueId(`sa_${d.default.snakeCase("tree-node")}_component_`),a.Stratus.Instances[this.uid]=this,a.Stratus.Internals.CssLoader(`${u}/tree/tree-node.component${c}.css`).then(()=>{this.isStyled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.isStyled=!0,this.refresh()}),this.node.meta.component=this,this.isInitialized=!0,this.refresh(),this.onPostPersist()}ngOnDestroy(){this.node.meta.component=null,this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(e=>e()):super.refresh()}onPostPersist(){this.node&&this.node.model&&this.node.model.meta.get("postPersist")&&(this.node.model.meta.set("postPersist",!1),this.openDialog())}destroy(){const e=this.dialog.open(r.ConfirmDialogComponent,{maxWidth:"400px",data:{title:"Delete MenuLink",message:"Are you sure you want to do this?"}});return e.afterClosed().subscribe(e=>{e&&this.node&&this.node.model&&this.node.model.destroy()}),e}getName(){return this.node.model&&this.node.model.get&&this.node.model.get("name")?this.node.model.get("name"):"Untitled"}getDragPreview(){return`name: ${this.getName()}<br>children: ${this.node.children?this.node.children.length:0}`}toggleExpanded(){this.node.meta?(this.node.meta.expanded=!this.node.meta.expanded,this.refresh()):console.error("node meta not found:",this.node)}toggleExpandedClick(){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.toggleExpanded()},this.tree.dblClickWait)}toggleExpandedDblClick(){this.isSingleClick=!1,this.toggleExpanded()}openDialog(){if(!this.node.model||!d.default.has(this.node.model,"data"))return;const e=this.dialog.open(i.TreeDialogComponent,{width:"400px",autoFocus:!0,disableClose:!0,restoreFocus:!1,data:{tree:this.tree,treeNode:this,backend:this.tree.backend,iconRegistry:this.tree.iconRegistry,id:this.node.model.data.id||null,name:this.node.model.data.name||"",target:this.node.model.data.url?"url":"content",content:this.node.model.data.content||null,url:this.node.model.data.url||null,browserTarget:this.node.model.data.browserTarget||null,model:this.node.model||null,collection:this.tree.collection||null,parent:this.node.model.data.parent||null,nestParent:this.node.model.data.nestParent||null}});this.refresh();const t=this;e.afterClosed().subscribe(e=>{if(!e||d.default.isEmpty(e))return;this.tree.unsettled=!0;["name","content","url","priority","browserTarget"].forEach(t=>{if(d.default.has(e,t))if("content"!==t)this.node.model.set(t,d.default.get(e,t));else{const n=d.default.get(e,t);this.node.model.set(t,n?{id:d.default.get(n,"id")}:null)}}),t.refresh(),t.tree.refresh(),this.node.model.save(),this.tree.unsettled=!1})}openDialogClick(){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.openDialog()},this.tree.dblClickWait)}openDialogDblClick(){this.isSingleClick=!1,this.openDialog()}getSvg(e,t){return this.tree.getSvg(e,t)}toggleStatus(){if(!this.node||!this.node.model)return;const e=this.node.model;e.set("status",e.get("status")?0:1),e.save()}addChild(){let e=d.default.max(this.tree.collection.models.filter(e=>{const t=e.get("nestParent");return!!t&&t.id===this.node.id}).map(e=>e.get("priority")))||-1;e++,this.tree.collection.add({name:"Untitled Child",parent:this.node.model.data.parent,nestParent:{id:this.node.model.data.id},priority:e},{save:!0,trigger:!0})}},g([n.Input(),p("design:type",s.TreeComponent)],m.prototype,"tree",void 0),g([n.Input(),p("design:type",Object)],m.prototype,"parent",void 0),g([n.Input(),p("design:type",Object)],m.prototype,"node",void 0),m=g([n.Component({selector:"sa-tree-node",templateUrl:`${u}/tree/tree-node.component${c}.html`}),p("design:paramtypes",[o.MatDialog,n.ChangeDetectorRef])],m),e("TreeNodeComponent",m)}}});
1
+ System.register(["@angular/core","@angular/material/dialog","@stratusjs/angular/tree/tree.component","@stratusjs/angular/tree/tree-dialog.component","@stratusjs/angular/confirm-dialog/confirm-dialog.component","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/core/responsive.component"],function(e,t){"use strict";var n,o,s,i,r,d,a,l,h,c,u,m,g,p=this&&this.__decorate||function(e,t,n,o){var s,i=arguments.length,r=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(s=e[d])&&(r=(i<3?s(r):i>3?s(t,n,r):s(t,n))||r);return i>3&&r&&Object.defineProperty(t,n,r),r},f=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;return{setters:[function(e){n=e},function(e){o=e},function(e){s=e},function(e){i=e},function(e){r=e},function(e){d=e},function(e){a=e},function(e){l=e},function(e){h=e}],execute:function(){"@stratusjs/angular",c="tree-node","tree",u=l.cookie("env")?"":".min",m=`${a.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,g=class extends h.ResponsiveComponent{constructor(e,t){super(),this.dialog=e,this.ref=t,this.title="tree-node_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=d.default,this.Stratus=a.Stratus,this.hasChild=e=>e.children&&e.children.length>0,this.isExpanded=e=>!e.meta||e.meta.expanded}ngOnInit(){this.uid=d.default.uniqueId(`sa_${d.default.snakeCase(c)}_component_`),a.Stratus.Instances[this.uid]=this,a.Stratus.Internals.CssLoader(`${m}/tree/tree-node.component${u}.css`).then(()=>{this.isStyled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.isStyled=!0,this.refresh()}),this.node.meta.component=this,this.isInitialized=!0,this.refresh(),this.onPostPersist()}ngOnDestroy(){this.node.meta.component=null,this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(e=>e()):super.refresh()}onPostPersist(){this.node&&this.node.model&&this.node.model.meta.get("postPersist")&&(this.node.model.meta.set("postPersist",!1),this.openDialog())}destroy(){const e=this.dialog.open(r.ConfirmDialogComponent,{maxWidth:"400px",data:{title:"Delete MenuLink",message:"Are you sure you want to do this?"}});return e.afterClosed().subscribe(e=>{e&&this.node&&this.node.model&&this.node.model.destroy()}),e}getName(){return this.node.model&&this.node.model.get&&this.node.model.get("name")?this.node.model.get("name"):"Untitled"}getDragPreview(){return`name: ${this.getName()}<br>children: ${this.node.children?this.node.children.length:0}`}toggleExpanded(){this.node.meta?(this.node.meta.expanded=!this.node.meta.expanded,this.refresh()):console.error("node meta not found:",this.node)}toggleExpandedClick(){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.toggleExpanded()},this.tree.dblClickWait)}toggleExpandedDblClick(){this.isSingleClick=!1,this.toggleExpanded()}openDialog(){if(!this.node.model||!d.default.has(this.node.model,"data"))return;const e=this.dialog.open(i.TreeDialogComponent,{width:"400px",autoFocus:!0,disableClose:!0,restoreFocus:!1,data:{tree:this.tree,treeNode:this,backend:this.tree.backend,iconRegistry:this.tree.iconRegistry,id:this.node.model.data.id||null,name:this.node.model.data.name||"",target:this.node.model.data.url?"url":"content",content:this.node.model.data.content||null,url:this.node.model.data.url||null,browserTarget:this.node.model.data.browserTarget||null,model:this.node.model||null,collection:this.tree.collection||null,parent:this.node.model.data.parent||null,nestParent:this.node.model.data.nestParent||null}});this.refresh();const t=this;e.afterClosed().subscribe(e=>{if(!e||d.default.isEmpty(e))return;this.tree.unsettled=!0;["name","content","url","priority","browserTarget"].forEach(t=>{if(d.default.has(e,t))if("content"!==t)this.node.model.set(t,d.default.get(e,t));else{const n=d.default.get(e,t);this.node.model.set(t,n?{id:d.default.get(n,"id")}:null)}}),t.refresh(),t.tree.refresh(),this.node.model.save(),this.tree.unsettled=!1})}openDialogClick(){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.openDialog()},this.tree.dblClickWait)}openDialogDblClick(){this.isSingleClick=!1,this.openDialog()}getSvg(e,t){return this.tree.getSvg(e,t)}toggleStatus(){if(!this.node||!this.node.model)return;const e=this.node.model;e.set("status",e.get("status")?0:1),e.save()}addChild(){let e=d.default.max(this.tree.collection.models.filter(e=>{const t=e.get("nestParent");return!!t&&t.id===this.node.id}).map(e=>e.get("priority")))||-1;e++,this.tree.collection.add({name:"Untitled Child",parent:this.node.model.data.parent,nestParent:{id:this.node.model.data.id},priority:e},{save:!0,trigger:!0})}},p([n.Input(),f("design:type",s.TreeComponent)],g.prototype,"tree",void 0),p([n.Input(),f("design:type",Object)],g.prototype,"parent",void 0),p([n.Input(),f("design:type",Object)],g.prototype,"node",void 0),g=p([n.Component({selector:"sa-tree-node",templateUrl:`${m}/tree/tree-node.component${u}.html`}),f("design:paramtypes",[o.MatDialog,n.ChangeDetectorRef])],g),e("TreeNodeComponent",g)}}});
@@ -1 +1 @@
1
- System.register(["@angular/core","@angular/cdk/drag-drop","@angular/cdk/tree","@angular/platform-browser","@angular/material/icon","rxjs","@stratusjs/runtime/stratus","lodash","@agentepsilon/decko","@stratusjs/angular/core/root.component","@stratusjs/angular/backend.service","@stratusjs/angularjs/services/registry","@stratusjs/core/environment","@stratusjs/core/events/eventManager","@stratusjs/angularjs/services/collection","@stratusjs/angularjs/services/model","@angular/common","@stratusjs/angular/tree/tree-node.component"],function(e,t){"use strict";var i,s,r,o,n,a,d,c,l,h,p,u,g,f,m,y,D,v,b,I=this&&this.__decorate||function(e,t,i,s){var r,o=arguments.length,n=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n},S=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},M=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};t&&t.id;return{setters:[function(e){i=e},function(e){s=e},function(e){r=e},function(e){o=e},function(e){n=e},function(e){a=e},function(e){d=e},function(e){c=e},function(e){l=e},function(e){h=e},function(e){p=e},function(e){u=e},function(e){g=e},function(e){f=e},function(e){},function(e){},function(e){m=e},function(e){y=e}],execute:function(){"@stratusjs/angular","tree",D=g.cookie("env")?"":".min",v=`${d.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,b=class extends h.RootComponent{constructor(e,t,i,s,o,n){super(),this.iconRegistry=e,this.sanitizer=t,this.backend=i,this.ref=s,this.elementRef=o,this.document=n,this.title="tree_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=c.default,this.Stratus=d.Stratus,this.registry=new u.Registry,this.onChange=new a.Subject,this.unsettled=!1,this.svgIcons={},this.dblClickWait=500,this.dropLists=[],this.dropListIdMap={},this.dropListMap={},this.expandedNodeSet=new Set,this.dragging=!1,this.expandDelay=1e3,this.dropData=null,this.cdkDropListSortingDisabled=!0,this.dropDebug=!1,this.treeControl=new r.NestedTreeControl(e=>e.children||[])}ngOnInit(){this.uid=c.default.uniqueId(`sa_${c.default.snakeCase("tree")}_component_`),d.Stratus.Instances[this.uid]=this,this.hydrate(this.elementRef,this.sanitizer,["title","uid","isInitialized","isDestroyed","isStyled","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","type","property","_","Stratus","registry","fetched","data","collection","model","dataSub","onChange","subscriber","unsettled","svgIcons","isSingleClick","dblClickWait","dropLists","dropListIdMap","dropListMap","expandedNodeSet","dragging","expandTimeout","expandDelay","dropData","cdkDropListSortingDisabled","dropDebug","tree","treeMap","metaMap","dataSource","treeControl","iconRegistry","sanitizer","backend","ref","elementRef","document","ngOnInit","ngOnDestroy","refresh","remove","removeNode","nodeIsEqual","fetchData","dataDefer","dataRef","trackDropLists","setExpanded","setExpandedClick","setExpandedDblClick","onDragDrop","onDragMove","showDragData","clearDragData","buildNodePatch","getSvg","addSvgIcon","hydrate","disableRefresh","stagger","reloading"]),d.Stratus.Internals.CssLoader(`${v}/tree/tree.component${D}.css`).then(()=>{this.isStyled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.isStyled=!0,this.refresh()}),c.default.forEach({tree_check:d.Stratus.BaseUrl+"sitetheorycore/images/icons/check.svg",tree_add:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/add.svg",tree_delete:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/delete.svg",tree_edit:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/edit.svg",tree_visibility:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/visibility.svg"},(e,t)=>this.iconRegistry.addSvgIcon(t,this.sanitizer.bypassSecurityTrustResourceUrl(e)).getNamedSvgIcon(t)),this.fetchData().then(e=>{if(!(e&&e instanceof f.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{!this.unsettled&&e.completed&&(this.dataDefer(this.subscriber),this.refresh())};e.on("change",t),t(),e.on("add",(e,t)=>{let i=!1;const s=()=>{if(!t.completed)return;if(i)return;if(i=!0,!(t.getIdentifier()in this.treeMap))return void t.meta.set("postPersist",!0);const e=this.treeMap[t.getIdentifier()];e.meta.component&&e.meta.component instanceof y.TreeNodeComponent?e.meta.component.openDialog():t.meta.set("postPersist",!0)};t.on("change",s),s()})}),this.dataSub=new a.Observable(e=>this.dataDefer(e)),this.dropListIdMap[this.uid+"_parent_drop_list"]=!0,this.trackDropLists(),this.isInitialized=!0,this.refresh()}ngOnDestroy(){this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(e=>e()):(c.default.forEach(this.metaMap,e=>{e.component&&"refresh"in e.component&&e.component.refresh()}),super.refresh())}remove(e){}removeNode(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}nodeIsEqual(e,t){return e&&t?e.id===t.id:e===t}async fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(d.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber||!this.collection||!this.collection.completed)return void setTimeout(()=>{this.dataDefer(e)},500);const t=this.dataRef(!0);t&&t.length?e.next(t):setTimeout(()=>this.dataDefer(e),200)}dataRef(e=!1){if(!this.collection)return[];if(!e&&this.tree&&this.tree.length>0)return this.tree;let t=this.collection.models;return t&&c.default.isArray(t)&&t.length?(t=c.default.sortBy(t,["data.priority"]),this.metaMap=this.metaMap||{},this.treeMap={},this.tree=[],c.default.forEach(t,e=>{const t=c.default.get(e,"data.id"),i=c.default.get(e,"data.nestParent.id");this.dropListIdMap[`${this.uid}_node_${t}_drop_list`]=!0,c.default.has(this.metaMap,t)||(this.metaMap[t]={id:t,expanded:!0}),c.default.has(this.treeMap,t)||(this.treeMap[t]={id:t,model:e,children:[],meta:this.metaMap[t]}),this.treeMap[t].model=e,this.treeMap[t].meta=this.metaMap[t],i?(c.default.has(this.treeMap,i)||(this.treeMap[i]={id:i,model:null,children:[],meta:null}),this.treeMap[i].children.push(this.treeMap[t])):this.tree.push(this.treeMap[t])}),this.trackDropLists(),this.tree):[]}trackDropLists(){this.dropLists=[],c.default.forEach(this.dropListIdMap,(e,t)=>{if(!e)return;const i=t in this.dropListMap,s=i?this.dropListMap[t]:document.getElementById(t);s&&(this.dropLists.push(t),i||(this.dropListMap[t]=s))})}setExpanded(e){this.metaMap&&c.default.size(this.metaMap)&&(c.default.forEach(this.metaMap,t=>{t.expanded=e}),this.refresh())}setExpandedClick(e){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.setExpanded(e)},this.dblClickWait)}setExpandedDblClick(e){this.isSingleClick=!1,this.setExpanded(e)}onDragDrop(e){if(!e.isPointerOverContainer)return;const t=e.item.data;if(!t)return;let i=e.container.data;const r=e.previousContainer.data,o=i?i.children:this.dataRef();if(!o)return;this.unsettled=!0;const n=this.dropData.targetId&&this.dropData.targetId in this.treeMap?this.treeMap[c.default.toNumber(this.dropData.targetId)]:null;if(g.cookie("env")&&this.dropDebug&&(console.group("onDragDrop()"),c.default.forEach(["model drop: "+t.model.get("name"),`list shift: ${e.container.element.nativeElement.id} -> ${e.previousContainer.element.nativeElement.id}`,`index change (event): ${e.previousIndex} -> ${e.currentIndex}`,"current priority: "+t.model.get("priority"),"target drop action: "+this.dropData.action],e=>console.log(e))),n&&!this.nodeIsEqual(i,n)){if(g.cookie("env")&&this.dropDebug&&(console.log(`target drop node differs: ${n.id} -> ${n.model.get("name")}`),console.log("target drop node is the same as target node:",t.id===n.id)),t.id!==n.id)switch(this.dropData.action){case"before":case"after":const e=n.model.get("nestParent.id");i=e&&e in this.treeMap?this.treeMap[e]:null;break;case"inside":i=n}g.cookie("env")&&this.dropDebug&&console.log("target drop node selected:",i?`${i.id} -> ${i.model.get("name")}`:"none")}if(!this.nodeIsEqual(i,r)){if(i){switch(this.dropData.action){case"before":case"after":let e=i.children.findIndex(e=>e.id===t.id);"after"===this.dropData.action&&e++,i.children.splice(e,0,t);break;case"inside":i.children.push(t)}i.meta.expanded=!0}r&&this.removeNode(r.children,t),t.model.set("nestParent",this.buildNodePatch(i)),g.cookie("env")&&this.dropDebug&&console.log("new parent: "+(t.model.get("nestParent.name")||null))}const a=i?i.children:o;let d=e.currentIndex;if(this.cdkDropListSortingDisabled)switch(d=null,this.dropData.action){case"before":case"after":d=a.findIndex(e=>e.id===n.id),"after"===this.dropData.action&&d++,g.cookie("env")&&this.dropDebug&&console.log("index change (drop node):",`${e.previousIndex} -> ${d}`)}if(c.default.isNumber(d)){s.moveItemInArray(a,e.previousIndex,d);let i=0;c.default.forEach(a,e=>{e.model&&e.model.set&&e.model.set("priority",i++)}),g.cookie("env")&&this.dropDebug&&console.log("new priority:",t.model.get("priority"))}g.cookie("env")&&this.dropDebug&&(console.log("new parent: "+(t.model.get("nestParent.name")||null)),console.groupEnd()),t.model.save(),this.unsettled=!1}onDragMove(e){const t=this.document.elementFromPoint(e.pointerPosition.x,e.pointerPosition.y);if(!t)return void this.clearDragData();const i=t.classList.contains("tree-node-content")?t:t.closest(".tree-node-content");if(!i)return void this.clearDragData();this.dropData={targetId:i.getAttribute("data-id")};const s=i.getBoundingClientRect(),r=s.height/3;e.pointerPosition.y-s.top<r?this.dropData.action="before":e.pointerPosition.y-s.top>2*r?this.dropData.action="after":this.dropData.action="inside",this.showDragData()}showDragData(){this.clearDragData(),this.dropData&&this.document.getElementById("node-"+this.dropData.targetId).classList.add("drop-"+this.dropData.action)}clearDragData(e=!1){e&&(this.dropData=null),this.document.querySelectorAll(".drop-before").forEach(e=>e.classList.remove("drop-before")),this.document.querySelectorAll(".drop-after").forEach(e=>e.classList.remove("drop-after")),this.document.querySelectorAll(".drop-inside").forEach(e=>e.classList.remove("drop-inside"))}buildNodePatch(e=null){if(!e||!e.model)return null;const t={};return c.default.forEach(["id","name"],i=>{const s=e.model.get(i);s&&c.default.set(t,i,s)}),t}getSvg(e,t){const i=this.addSvgIcon(e,t);return new a.Observable(t=>{this.iconRegistry.getNamedSvgIcon(i).subscribe({error(t){console.error(`getSvg(${e}): ${t}`)},complete(){t.next(i)}})})}addSvgIcon(e,t){if(e in this.svgIcons)return this.svgIcons[e];t||(t={});const i=this.svgIcons[e]=c.default.uniqueId("selector_svg");return this.iconRegistry.addSvgIcon(i,this.sanitizer.bypassSecurityTrustResourceUrl(e),t),i}},I([i.Input(),S("design:type",String)],b.prototype,"target",void 0),I([i.Input(),S("design:type",String)],b.prototype,"targetSuffix",void 0),I([i.Input(),S("design:type",Number)],b.prototype,"id",void 0),I([i.Input(),S("design:type",Boolean)],b.prototype,"manifest",void 0),I([i.Input(),S("design:type",Boolean)],b.prototype,"decouple",void 0),I([i.Input(),S("design:type",Boolean)],b.prototype,"direct",void 0),I([i.Input(),S("design:type",Object)],b.prototype,"api",void 0),I([i.Input(),S("design:type",String)],b.prototype,"urlRoot",void 0),I([i.Input(),S("design:type",String)],b.prototype,"type",void 0),I([i.Input(),S("design:type",String)],b.prototype,"property",void 0),I([l.debounce(50),S("design:type",Function),S("design:paramtypes",[Object]),S("design:returntype",void 0)],b.prototype,"onDragMove",null),b=I([i.Component({selector:"sa-tree",templateUrl:`${v}/tree/tree.component${D}.html`}),M(5,i.Inject(m.DOCUMENT)),S("design:paramtypes",[n.MatIconRegistry,o.DomSanitizer,p.BackendService,i.ChangeDetectorRef,i.ElementRef,Document])],b),e("TreeComponent",b)}}});
1
+ System.register(["@angular/core","@angular/cdk/drag-drop","@angular/cdk/tree","@angular/platform-browser","@angular/material/icon","rxjs","@stratusjs/runtime/stratus","lodash","@agentepsilon/decko","@stratusjs/angular/core/root.component","@stratusjs/angular/backend.service","@stratusjs/angularjs/services/registry","@stratusjs/core/environment","@stratusjs/core/events/eventManager","@stratusjs/angularjs/services/collection","@stratusjs/angularjs/services/model","@angular/common","@stratusjs/angular/tree/tree-node.component"],function(e,t){"use strict";var i,s,r,o,n,a,d,c,l,h,p,u,g,f,m,y,D,v,b,I,S=this&&this.__decorate||function(e,t,i,s){var r,o=arguments.length,n=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n},M=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},k=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};t&&t.id;return{setters:[function(e){i=e},function(e){s=e},function(e){r=e},function(e){o=e},function(e){n=e},function(e){a=e},function(e){d=e},function(e){c=e},function(e){l=e},function(e){h=e},function(e){p=e},function(e){u=e},function(e){g=e},function(e){f=e},function(e){},function(e){},function(e){m=e},function(e){y=e}],execute:function(){"@stratusjs/angular",D="tree",v=g.cookie("env")?"":".min",b=`${d.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,I=class extends h.RootComponent{constructor(e,t,i,s,o,n){super(),this.iconRegistry=e,this.sanitizer=t,this.backend=i,this.ref=s,this.elementRef=o,this.document=n,this.title="tree_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=c.default,this.Stratus=d.Stratus,this.registry=new u.Registry,this.onChange=new a.Subject,this.unsettled=!1,this.svgIcons={},this.dblClickWait=500,this.dropLists=[],this.dropListIdMap={},this.dropListMap={},this.expandedNodeSet=new Set,this.dragging=!1,this.expandDelay=1e3,this.dropData=null,this.cdkDropListSortingDisabled=!0,this.dropDebug=!1,this.treeControl=new r.NestedTreeControl(e=>e.children||[])}ngOnInit(){this.uid=c.default.uniqueId(`sa_${c.default.snakeCase(D)}_component_`),d.Stratus.Instances[this.uid]=this,this.hydrate(this.elementRef,this.sanitizer,["title","uid","isInitialized","isDestroyed","isStyled","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","type","property","_","Stratus","registry","fetched","data","collection","model","dataSub","onChange","subscriber","unsettled","svgIcons","isSingleClick","dblClickWait","dropLists","dropListIdMap","dropListMap","expandedNodeSet","dragging","expandTimeout","expandDelay","dropData","cdkDropListSortingDisabled","dropDebug","tree","treeMap","metaMap","dataSource","treeControl","iconRegistry","sanitizer","backend","ref","elementRef","document","ngOnInit","ngOnDestroy","refresh","remove","removeNode","nodeIsEqual","fetchData","dataDefer","dataRef","trackDropLists","setExpanded","setExpandedClick","setExpandedDblClick","onDragDrop","onDragMove","showDragData","clearDragData","buildNodePatch","getSvg","addSvgIcon","hydrate","disableRefresh","stagger","reloading"]),d.Stratus.Internals.CssLoader(`${b}/tree/tree.component${v}.css`).then(()=>{this.isStyled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.isStyled=!0,this.refresh()}),c.default.forEach({tree_check:`${d.Stratus.BaseUrl}sitetheorycore/images/icons/check.svg`,tree_add:`${d.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/add.svg`,tree_delete:`${d.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/delete.svg`,tree_edit:`${d.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/edit.svg`,tree_visibility:`${d.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/visibility.svg`},(e,t)=>this.iconRegistry.addSvgIcon(t,this.sanitizer.bypassSecurityTrustResourceUrl(e)).getNamedSvgIcon(t)),this.fetchData().then(e=>{if(!(e&&e instanceof f.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{!this.unsettled&&e.completed&&(this.dataDefer(this.subscriber),this.refresh())};e.on("change",t),t(),e.on("add",(e,t)=>{let i=!1;const s=()=>{if(!t.completed)return;if(i)return;if(i=!0,!(t.getIdentifier()in this.treeMap))return void t.meta.set("postPersist",!0);const e=this.treeMap[t.getIdentifier()];e.meta.component&&e.meta.component instanceof y.TreeNodeComponent?e.meta.component.openDialog():t.meta.set("postPersist",!0)};t.on("change",s),s()})}),this.dataSub=new a.Observable(e=>this.dataDefer(e)),this.dropListIdMap[`${this.uid}_parent_drop_list`]=!0,this.trackDropLists(),this.isInitialized=!0,this.refresh()}ngOnDestroy(){this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(e=>e()):(c.default.forEach(this.metaMap,e=>{e.component&&"refresh"in e.component&&e.component.refresh()}),super.refresh())}remove(e){}removeNode(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}nodeIsEqual(e,t){return e&&t?e.id===t.id:e===t}async fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(d.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber||!this.collection||!this.collection.completed)return void setTimeout(()=>{this.dataDefer(e)},500);const t=this.dataRef(!0);t&&t.length?e.next(t):setTimeout(()=>this.dataDefer(e),200)}dataRef(e=!1){if(!this.collection)return[];if(!e&&this.tree&&this.tree.length>0)return this.tree;let t=this.collection.models;return t&&c.default.isArray(t)&&t.length?(t=c.default.sortBy(t,["data.priority"]),this.metaMap=this.metaMap||{},this.treeMap={},this.tree=[],c.default.forEach(t,e=>{const t=c.default.get(e,"data.id"),i=c.default.get(e,"data.nestParent.id");this.dropListIdMap[`${this.uid}_node_${t}_drop_list`]=!0,c.default.has(this.metaMap,t)||(this.metaMap[t]={id:t,expanded:!0}),c.default.has(this.treeMap,t)||(this.treeMap[t]={id:t,model:e,children:[],meta:this.metaMap[t]}),this.treeMap[t].model=e,this.treeMap[t].meta=this.metaMap[t],i?(c.default.has(this.treeMap,i)||(this.treeMap[i]={id:i,model:null,children:[],meta:null}),this.treeMap[i].children.push(this.treeMap[t])):this.tree.push(this.treeMap[t])}),this.trackDropLists(),this.tree):[]}trackDropLists(){this.dropLists=[],c.default.forEach(this.dropListIdMap,(e,t)=>{if(!e)return;const i=t in this.dropListMap,s=i?this.dropListMap[t]:document.getElementById(t);s&&(this.dropLists.push(t),i||(this.dropListMap[t]=s))})}setExpanded(e){this.metaMap&&c.default.size(this.metaMap)&&(c.default.forEach(this.metaMap,t=>{t.expanded=e}),this.refresh())}setExpandedClick(e){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.setExpanded(e)},this.dblClickWait)}setExpandedDblClick(e){this.isSingleClick=!1,this.setExpanded(e)}onDragDrop(e){if(!e.isPointerOverContainer)return;const t=e.item.data;if(!t)return;let i=e.container.data;const r=e.previousContainer.data,o=i?i.children:this.dataRef();if(!o)return;this.unsettled=!0;const n=this.dropData.targetId&&this.dropData.targetId in this.treeMap?this.treeMap[c.default.toNumber(this.dropData.targetId)]:null;if(g.cookie("env")&&this.dropDebug&&(console.group("onDragDrop()"),c.default.forEach([`model drop: ${t.model.get("name")}`,`list shift: ${e.container.element.nativeElement.id} -> ${e.previousContainer.element.nativeElement.id}`,`index change (event): ${e.previousIndex} -> ${e.currentIndex}`,`current priority: ${t.model.get("priority")}`,`target drop action: ${this.dropData.action}`],e=>console.log(e))),n&&!this.nodeIsEqual(i,n)){if(g.cookie("env")&&this.dropDebug&&(console.log(`target drop node differs: ${n.id} -> ${n.model.get("name")}`),console.log("target drop node is the same as target node:",t.id===n.id)),t.id!==n.id)switch(this.dropData.action){case"before":case"after":const e=n.model.get("nestParent.id");i=e&&e in this.treeMap?this.treeMap[e]:null;break;case"inside":i=n}g.cookie("env")&&this.dropDebug&&console.log("target drop node selected:",i?`${i.id} -> ${i.model.get("name")}`:"none")}if(!this.nodeIsEqual(i,r)){if(i){switch(this.dropData.action){case"before":case"after":let e=i.children.findIndex(e=>e.id===t.id);"after"===this.dropData.action&&e++,i.children.splice(e,0,t);break;case"inside":i.children.push(t)}i.meta.expanded=!0}r&&this.removeNode(r.children,t),t.model.set("nestParent",this.buildNodePatch(i)),g.cookie("env")&&this.dropDebug&&console.log(`new parent: ${t.model.get("nestParent.name")||null}`)}const a=i?i.children:o;let d=e.currentIndex;if(this.cdkDropListSortingDisabled)switch(d=null,this.dropData.action){case"before":case"after":d=a.findIndex(e=>e.id===n.id),"after"===this.dropData.action&&d++,g.cookie("env")&&this.dropDebug&&console.log("index change (drop node):",`${e.previousIndex} -> ${d}`)}if(c.default.isNumber(d)){s.moveItemInArray(a,e.previousIndex,d);let i=0;c.default.forEach(a,e=>{e.model&&e.model.set&&e.model.set("priority",i++)}),g.cookie("env")&&this.dropDebug&&console.log("new priority:",t.model.get("priority"))}g.cookie("env")&&this.dropDebug&&(console.log(`new parent: ${t.model.get("nestParent.name")||null}`),console.groupEnd()),t.model.save(),this.unsettled=!1}onDragMove(e){const t=this.document.elementFromPoint(e.pointerPosition.x,e.pointerPosition.y);if(!t)return void this.clearDragData();const i="tree-node-content",s=t.classList.contains(i)?t:t.closest(".tree-node-content");if(!s)return void this.clearDragData();this.dropData={targetId:s.getAttribute("data-id")};const r=s.getBoundingClientRect(),o=r.height/3;e.pointerPosition.y-r.top<o?this.dropData.action="before":e.pointerPosition.y-r.top>2*o?this.dropData.action="after":this.dropData.action="inside",this.showDragData()}showDragData(){this.clearDragData(),this.dropData&&this.document.getElementById(`node-${this.dropData.targetId}`).classList.add(`drop-${this.dropData.action}`)}clearDragData(e=!1){e&&(this.dropData=null),this.document.querySelectorAll(".drop-before").forEach(e=>e.classList.remove("drop-before")),this.document.querySelectorAll(".drop-after").forEach(e=>e.classList.remove("drop-after")),this.document.querySelectorAll(".drop-inside").forEach(e=>e.classList.remove("drop-inside"))}buildNodePatch(e=null){if(!e||!e.model)return null;const t={};return c.default.forEach(["id","name"],i=>{const s=e.model.get(i);s&&c.default.set(t,i,s)}),t}getSvg(e,t){const i=this.addSvgIcon(e,t);return new a.Observable(t=>{this.iconRegistry.getNamedSvgIcon(i).subscribe({error(t){console.error(`getSvg(${e}): ${t}`)},complete(){t.next(i)}})})}addSvgIcon(e,t){if(e in this.svgIcons)return this.svgIcons[e];t||(t={});const i=this.svgIcons[e]=c.default.uniqueId("selector_svg");return this.iconRegistry.addSvgIcon(i,this.sanitizer.bypassSecurityTrustResourceUrl(e),t),i}},S([i.Input(),M("design:type",String)],I.prototype,"target",void 0),S([i.Input(),M("design:type",String)],I.prototype,"targetSuffix",void 0),S([i.Input(),M("design:type",Number)],I.prototype,"id",void 0),S([i.Input(),M("design:type",Boolean)],I.prototype,"manifest",void 0),S([i.Input(),M("design:type",Boolean)],I.prototype,"decouple",void 0),S([i.Input(),M("design:type",Boolean)],I.prototype,"direct",void 0),S([i.Input(),M("design:type",Object)],I.prototype,"api",void 0),S([i.Input(),M("design:type",String)],I.prototype,"urlRoot",void 0),S([i.Input(),M("design:type",String)],I.prototype,"type",void 0),S([i.Input(),M("design:type",String)],I.prototype,"property",void 0),S([l.debounce(50),M("design:type",Function),M("design:paramtypes",[Object]),M("design:returntype",void 0)],I.prototype,"onDragMove",null),I=S([i.Component({selector:"sa-tree",templateUrl:`${b}/tree/tree.component${v}.html`}),k(5,i.Inject(m.DOCUMENT)),M("design:paramtypes",[n.MatIconRegistry,o.DomSanitizer,p.BackendService,i.ChangeDetectorRef,i.ElementRef,Document])],I),e("TreeComponent",I)}}});