@luminocity/lemonate-engine 26.6.1 → 26.6.3

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/dist/lemonate.js CHANGED
@@ -4550,7 +4550,7 @@ var Lemonate = (function (exports) {
4550
4550
  ws$1 = self.WebSocket || self.MozWebSocket;
4551
4551
  }
4552
4552
 
4553
- var n$2 = ws$1;
4553
+ var i$3 = ws$1;
4554
4554
 
4555
4555
  /* eslint-env browser */
4556
4556
 
@@ -4565,7 +4565,7 @@ var Lemonate = (function (exports) {
4565
4565
  }
4566
4566
 
4567
4567
  var browserExports = requireBrowser();
4568
- var i$3 = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
4568
+ var n$2 = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
4569
4569
 
4570
4570
  function commonjsRequire(path) {
4571
4571
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
@@ -4599,9 +4599,9 @@ var Lemonate = (function (exports) {
4599
4599
  var jszip_minExports = requireJszip_min();
4600
4600
  var r$1 = /*@__PURE__*/getDefaultExportFromCjs(jszip_minExports);
4601
4601
 
4602
- let s$1 = class s{func;owner;constructor(e,t){this.func=e,this.owner=t;}};let o$1 = class o{_debugMode=false;_listeners=new Map;_onceListeners=new Map;_catchAllListeners=[];_capturedEvents=new Map;_capturedAccumulatedDuration=0;constructor(){}setDebugMode(e){this._debugMode&&!e&&(console.log("Captured events: ",this._capturedEvents),console.log(`Total duration: ${this._capturedAccumulatedDuration}ms`)),this._debugMode=e,this._capturedEvents=new Map,this._capturedAccumulatedDuration=0;}$clear(){this._listeners.clear(),this._onceListeners.clear();}clearCatchAllListeners(){this._catchAllListeners=[];}listenerCount(e){let t=0;return t+=this._listeners.get(e)?.length||0,t+=this._onceListeners.get(e)?.length||0,t}$hasListener(e){return this.listenerCount(e)>0}$catchAll(e,t){this._catchAllListeners.push(new s$1(e,t));}$on(e,t,a){let n;this._listeners.has(e)?n=this._listeners.get(e):(n=[],this._listeners.set(e,n)),n.push(new s$1(t,a));}$once(e,t,a){let n;this._onceListeners.has(e)?n=this._onceListeners.get(e):(n=[],this._onceListeners.set(e,n)),n.push(new s$1(t,a));}$off(e,t,a){let n=0;if(this._listeners.has(e)){n+=this._listeners.get(e).removeByFilterFunc((e=>e.func===t&&e.owner===a));}if(this._onceListeners.has(e)){n+=this._onceListeners.get(e).removeByFilterFunc((e=>e.func===t&&e.owner===a));}return n}$offByOwner(e,t){let a=0;if(this._listeners.has(e)){a+=this._listeners.get(e).removeByFilterFunc((e=>e.owner===t));}if(this._onceListeners.has(e)){a+=this._onceListeners.get(e).removeByFilterFunc((e=>e.owner===t));}return a}$emitSync(e,...t){const a=[],n=performance.now();let i=0;try{for(const n of this._catchAllListeners.values())try{const r=n.func.call(n.owner,e,...t);r&&r.then&&a.push(r),i++;}catch(e){console.error(e);}if(this._listeners.has(e)){const n=this._listeners.get(e);for(const e of n)try{const n=e.func.call(e.owner,...t);n&&n.then&&a.push(n),i++;}catch(e){console.error(e);}}if(this._onceListeners.has(e)){const n=this._onceListeners.get(e);for(const e of n)try{const n=e.func.call(e.owner,...t);n&&n.then&&a.push(n),i++;}catch(e){console.error(e);}this._onceListeners.set(e,[]);}}catch(e){console.error(e);}if(this._debugMode&&"log"!==e){const t=performance.now(),r=Math.floor(t-n);let s=this._capturedEvents.get(e);s?(s.count++,s.duration+=r,s.promises+=a.length,s.sentTo+=i):(s={eventType:e,count:1,duration:r,promises:a.length,sentTo:i},this._capturedEvents.set(e,s)),r>3&&console.log(`Expensive event ${e}: ${r}ms`);}return a.length>0?Promise.all(a):null}$emit(e,...t){return new Promise((a=>{a(this.$emitSync(e,...t));}))}};const l$1=new o$1;let u$2 = class u{type;itemId;elementId;target;prop;value;oldValue;createdAt=Date.now();moveTargetArray;moveTargetArrayIndex;moveTargetElementId;start;length;position;elementsToDelete;field;fieldId;isLink;bundleIndex=0;_undoFunction;_redoFunction;constructor(e,t,a,n,i,r,s){this.type=e,this.itemId=t,this.elementId=a,this.target=n,this.prop=i,this.value=r,this.oldValue=s;}async undo(){this._undoFunction&&await this._undoFunction();}async redo(){this._redoFunction&&await this._redoFunction();}setUndoFunction(e){this._undoFunction=e;}setRedoFunction(e){this._redoFunction=e;}setMoveTarget(e,t,a){this.moveTargetArray=e,this.moveTargetArrayIndex=t,this.moveTargetElementId=a;}setRange(e,t){this.start=e,this.length=t;}setPosition(e){this.position=e;}setElementsToDelete(e){this.elementsToDelete=e;}setField(e){this.field=e;}setFieldId(e){this.fieldId=e;}setIsLink(e){this.isLink=e;}clone(){return Object.assign(new u,this)}isWithinMergeDeltaOf(e,t){return Math.abs(e.createdAt-this.createdAt)<=t}isMergeableWith(e,t){if(!this.isWithinMergeDeltaOf(e,t))return false;const a=e.type===this.type&&e.itemId===this.itemId&&e.elementId===this.elementId&&e.target===this.target&&e.prop===this.prop,n=void 0!==e.value&&void 0!==e.oldValue&&void 0===e.start&&void 0===e.length&&void 0===e.position&&void 0===e.elementsToDelete;return a&&n}merge(e,t){if(!this.isMergeableWith(e,t))return null;let a=this.clone();return a.value=e.value,a.createdAt=e.createdAt,a._redoFunction=e._redoFunction,a}};const c$1=new e$1({dictionary:"hex",length:12});let d$1=(new Date).valueOf();var p={createItemOrBlockID:function(){return c$1.rnd()},createFieldID:function(){return (d$1++).toString()},createGUID:function(){return c$1.rnd()},createGeneratedItemId:function(){return "gen_"+this.createGUID()},toUserFriendlyName:function(e){return e.replace(/_./g,(e=>e.charAt(1).toUpperCase())).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^(.)/,(e=>e.toUpperCase()))},assert:function(e,t){e||console.error(`ASSERTION FAILED: '${e}' is untrue: ${t}`);},matchItemIdAndObject:(e,t)=>!(!e||!t)&&(e._id===t||e===t._id),getDepth(e,t=new WeakSet){if(null===e||"object"!=typeof e)return 1;const a=e;if(t.has(a))return 0;t.add(a);const n=Array.isArray(a)?a:Object.values(a);let i=0;for(const e of n){const a=this.getDepth(e,t);a>i&&(i=a);}return 1+i},areValuesEqual(e,t,a=3){if(e===t)return true;if("number"==typeof e&&"number"==typeof t)return isNaN(e)&&isNaN(t);if(null==e||null==t||typeof e!=typeof t)return false;if("object"!=typeof e)return false;if(Array.isArray(e)!==Array.isArray(t))return false;if(e._id&&e._id!==t._id)return false;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return false;for(let i of n){if(!Object.prototype.hasOwnProperty.call(t,i))return false;if(a>0&&!this.areValuesEqual(e[i],t[i],a-1))return false}return true},startTimer(e){const t=Date.now();return e&&console.log(`[TIMER] - ${e}`),function(e){const a=Date.now()-t;e?console.log(`[TIMER] - ${e}: ${a}ms`):console.log(`[TIMER] - ${a}ms`);}},dataURItoBlob(e){const t=e.split(",")[0].split(":")[1].split(";")[0],a=atob(e.split(",")[1]),n=[];for(let e=0;e<a.length;e++)n.push(a.charCodeAt(e));return new Blob([new Uint8Array(n)],{type:t})},xmur3(e){let t=1779033703^e.length;for(let a=0;a<e.length;a++)t=Math.imul(t^e.charCodeAt(a),3432918353),t=t<<13|t>>>19;return ()=>(t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),t^=t>>>16,t>>>0)},mulberry32:e=>()=>{let t=e+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},hslToRgb(e,t,a){const n=(1-Math.abs(2*a-1))*t,i=e/60,r=n*(1-Math.abs(i%2-1));let[s,o,l]=[0,0,0];[s,o,l]=i>=0&&i<1?[n,r,0]:i<2?[r,n,0]:i<3?[0,n,r]:i<4?[0,r,n]:i<5?[r,0,n]:[n,0,r];const u=a-n/2;return [Math.round(255*(s+u)),Math.round(255*(o+u)),Math.round(255*(l+u))]},rgbToHex:(e,t,a)=>"#"+[e,t,a].map((e=>e.toString(16).padStart(2,"0"))).join(""),colorFromString(e,t={}){const{minS:a=.72,maxS:n=.97,minL:i=.48,maxL:r=.62,return:s="hex"}=t,o=this.xmur3(e)(),l=this.mulberry32(o),u=Math.floor(360*l()),c=a+l()*(n-a),d=i+l()*(r-i);if("hsl"===s)return `hsl(${u} ${Math.round(100*c)}% ${Math.round(100*d)}%)`;const[p,h,f]=this.hslToRgb(u,c,d);return "rgb"===s?`rgb(${p}, ${h}, ${f})`:this.rgbToHex(p,h,f)},async downloadFile(e,a){if(e.startsWith("blob:")){const t=await fetch(e),a=await t.blob();return {data:a,mimeType:a.type}}return axios.get(e,{responseType:"blob",onDownloadProgress:e=>{if(a&&e.total){const t=Math.round(100*e.loaded/e.total);a(t,e.total,e.loaded);}}})}};const h$1=new Set(["dependantFields","conditionFields","dependenciesInitialized","_hidden","_updateConditions","userData"]),f=new Set(["__proto__","__ob__","isSelected","isDirty","options","_hidden","_updateConditions","dependantFields","conditionFields","separatorFields","dependenciesInitialized","order","inject","type","datatype","minValue","maxValue","id","_id","linkableTypes","info","userData"]),m=new Set(["isSelected","isDirty","_hidden","_updateConditions","options","dependantFields","conditionFields","separatorFields","dependenciesInitialized","id","_id","linkableTypes","info","userData"]);let y$1 = class y{suppressDirty=false;undoManager;_promises=[];_capturePromises=false;_profiledEvents=[];_profiling=false;_profilerStartTime=0;_profiledCount=0;static _instance;static get instance(){return this._instance||(this._instance=new this)}constructor(){}suppressDirtyFlag(e){this.suppressDirty=e;}setUndoManager(e){this.undoManager=e;}isUndoManagerActive(){return this.undoManager?.getEnabled()}_postUndoManagerEvent(e){this.undoManager&&(m.has(e.prop)||this.undoManager.event(e));}setItemDirty(e,t,a,n){this.suppressDirty||e.isDirty||a===n||f.has(t)||e.markDirty();}capturePromise(e){try{return this._capturePromises=!0,e(),Promise.all(this._promises)}finally{this._capturePromises=false,this._promises=[];}}startProfiling(){this._profiling=true,this._profiledEvents=[],this._profiledCount=0,this._profilerStartTime=performance.now(),l$1.setDebugMode(true);}endProfiling(){const e=performance.now()-this._profilerStartTime;l$1.setDebugMode(false),console.log("Profiled events: ",this._profiledEvents),console.log(`Profiling took ${e}ms`);}_addPromise(e){this._capturePromises&&this._promises.push(e);}_proxyObject(e,t,a,n){const i=this;if(!e)throw "_proxyObject(): Object is not defined. Cannot create proxy!";if(!a)throw "_proxyObject(): Item is not defined. Cannot create proxy!";if(!n)throw "_proxyObject(): Options is not defined. Cannot create proxy!";return new Proxy(e,{set:function(r,s,o){if(h$1.has(s))return Reflect.set(r,s,o);const c=performance.now();let d=i.isUndoManagerActive();const f=Reflect.get(r,s);if(p.areValuesEqual(f,o))return true;let m=Reflect.set(r,s,o);function y(i,o){const l=new u$2(n.proxyEventTypeName,a._id,t?t.id:null,r,s,i,o);return n.isField&&(l.setField(e.name),l.setFieldId(e.id)),void 0!==n.isLink&&l.setIsLink(n.isLink),l}n.changeDoesNotMakeItemDirty||(p.matchItemIdAndObject(f,o)?d=false:i.setItemDirty(a,s,f,o));const g=y(o,f);d&&(g.setUndoFunction((()=>{Reflect.set(r,s,g.oldValue);const e=y(g.oldValue,g.value);l$1.$emitSync("proxy:valueChange",e),n.changeEventFunc(e);})),g.setRedoFunction((()=>{Reflect.set(r,s,g.value);const e=y(g.value,g.oldValue);l$1.$emitSync("proxy:valueChange",e),n.changeEventFunc(e);}))),n.changeEventFunc(g),d&&i._postUndoManagerEvent(g),l$1.$emitSync("proxy:valueChange",g);const b=performance.now();return i._profiledCount++,i._profiledEvents.push({event:g,type:"object",duration:b-c}),m}})}_proxyArray(e,t,a,n){const i=this;if(!e)throw "_proxyArray(): Array is not defined. Cannot create proxy!";if(!a)throw "_proxyArray(): Item is not defined. Cannot create proxy!";if(!n)throw "_proxyArray(): Options is not defined. Cannot create proxy!";return new Proxy(e,{set(e,r,s){const o=performance.now(),c=Reflect.get(e,r);let d=Reflect.set(e,r,s);if("length"!==r&&"__proto__"!==r){const p=i.isUndoManagerActive();function h(i,s){const o=new u$2("arraySetValue",a._id,t?t.id:null,e,r,i,s);return n.field&&(o.setField(n.field.name),o.setFieldId(n.field.id)),o}n.changeDoesNotMakeItemDirty||i.setItemDirty(a,r,c,s);const f=h(s,c);p&&(f.setUndoFunction((()=>{const t=h(f.oldValue,f.value),a=parseInt(r);if(void 0===f.oldValue&&e.length-1===a){const n=e.pop();t.setElementsToDelete([n]),t.setRange(a,1);}else Reflect.set(e,r,f.oldValue);l$1.$emitSync("proxy:valueChange",t),n.deleteEventFunc(t);})),f.setRedoFunction((()=>{Reflect.set(e,r,f.value);const t=h(f.value,f.oldValue);l$1.$emitSync("proxy:valueChange",t),n.addEventFunc(t);}))),n.addEventFunc(f),p&&i._postUndoManagerEvent(f),l$1.$emitSync("proxy:valueChange",f);const m=performance.now();i._profiledCount++,i._profiledEvents.push({event:f,type:"set_array",duration:m-o});}return d},get(r,s){if("splice"===s){const e=Reflect.get(r,s);return function(...o){const c=o[0],d=o[1],p=[];for(let e=c;e<c+d;e++){const t=r[e];p.push(t);}function h(e,i,s){const o=new u$2("arraySpliceRemove",a._id,t?t.id:null,r);return n.field&&(o.setField(n.field.name),o.setFieldId(n.field.id)),o.setRange(e,i),o.setElementsToDelete(s),o}function f(e,i){const o=new u$2("arraySpliceAdd",a._id,t?t.id:null,r,s,i);return n.field&&(o.setField(n.field.name),o.setFieldId(n.field.id)),o.setPosition(e),o}if(e.apply(r,o),i.setItemDirty(a,s,true,false),d>0&&o.length<3){const e=i.isUndoManagerActive(),t=h(c,d,p);e&&(t.setUndoFunction((()=>{r.splice(c,0,...p);const e=f(c,p);l$1.$emitSync("proxy:valueChange",e),n.addEventFunc(e);})),t.setRedoFunction((()=>{r.splice(c,d);const e=h(c,d,p);l$1.$emitSync("proxy:valueChange",e),n.deleteEventFunc(e);}))),n.deleteEventFunc(t),e&&i._postUndoManagerEvent(t),l$1.$emitSync("proxy:valueChange",t);}else if(o.length>2){const e=o.slice(2),t=f(c,e);t.setPosition(c),t.setUndoFunction((()=>{r.splice(c,e.length);const t=h(c,e.length,e);l$1.$emitSync("proxy:valueChange",t),n.deleteEventFunc(t);})),t.setRedoFunction((()=>{r.splice(c,0,...e);const t=f(c,e);l$1.$emitSync("proxy:valueChange",t),n.addEventFunc(t);})),n.addEventFunc(t),i._postUndoManagerEvent(t),l$1.$emitSync("proxy:valueChange",t);}}}return "moveToArray"===s?function(e,o,c){const d=r,p=t,{array:h,element:f}=o.getTargetArrayAndElement();function m(e,t,a,n){n=void 0===n?a.length:n;const i=Reflect.get(e,"splice").apply(e,[t,1]);if(i.length>0){const e=i[0];return Reflect.get(a,"splice").apply(a,[n,0,e]),e}return null}const y=m(d,e,h,c);if(y){function g(e,n,i,r,s,o){const l=new u$2("arrayMoveToArray",a._id,t?t.id:null,e,void 0,o);return l.setRange(n,1),l.setMoveTarget(i,r,s?s.id:null),l}i.setItemDirty(a,s,true,false);const b=i.isUndoManagerActive(),v=g(d,e,o,c,f,y);b&&(v.setUndoFunction((()=>{const t=m(h,c,d,e),a=g(o,c,d,e,p,t);l$1.$emitSync("proxy:valueChange",a),n.moveEventFunc(a);})),v.setRedoFunction((()=>{const t=m(d,e,h,c),a=g(d,e,o,c,f,t);l$1.$emitSync("proxy:valueChange",a),n.moveEventFunc(a);}))),n.moveEventFunc(v),b&&i._postUndoManagerEvent(v),l$1.$emitSync("proxy:valueChange",v);}}:"getTargetArrayAndElement"===s?function(){return {array:e,element:t}}:("move"===s&&console.warn("'move' prop is not implemented in Proxifier"),Reflect.get(r,s))}})}proxyBlockArray(e,t,a){return this._proxyArray(e,t,a,{addEventFunc:e=>{this._addPromise(l$1.$emit("itemRepo:blockAdded",e));},deleteEventFunc:e=>{this._addPromise(l$1.$emit("itemRepo:blockDeleted",e));},moveEventFunc:e=>{this._addPromise(l$1.$emit("itemRepo:blockMoved",e));}})}proxyListArray(e,t,a){return this._proxyArray(e,null,a,{field:t,addEventFunc:function(e){l$1.$emit("itemRepo:listEntryAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:listEntryDeleted",e);}})}proxyScriptArray(e,t,a){return this._proxyArray(e,t,a,{addEventFunc:function(e){l$1.$emit("itemRepo:scriptAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:scriptDeleted",e);}})}proxyBlock(e,t){return this._proxyObject(e,e,t,{isLink:true,changeEventFunc:function(e){l$1.$emit("itemRepo:fieldChanged",e),l$1.$emit("itemRepo:linkChanged",e);},proxyEventTypeName:"blockSetValue"})}proxyGraphBlock(e,t){return this._proxyObject(e,e,t,{isLink:true,changeEventFunc:function(e){l$1.$emit("itemRepo:graphNodeChanged",e);},proxyEventTypeName:"blockSetValue"})}proxyGraphBlockArray(e,t){return this._proxyArray(e,t,t,{addEventFunc:function(e){l$1.$emit("itemRepo:graphNodeAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:graphNodeDeleted",e);}})}proxyConnection(e,t){return this._proxyObject(e,t,t,{changeEventFunc:function(e){l$1.$emit("itemRepo:graphConnectionChanged",e);},proxyEventTypeName:"connectionSetValue"})}proxyConnectionArray(e,t){return this._proxyArray(e,e,t,{addEventFunc:function(e){l$1.$emit("itemRepo:graphConnectionAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:graphConnectionDeleted",e);}})}proxyItemField(e,t){const a="Link"===e.type;return this._proxyObject(e,null,t,{isLink:a,isField:true,changeEventFunc:function(e){l$1.$emit("itemRepo:fieldChanged",e),a&&l$1.$emit("itemRepo:linkChanged",e);},proxyEventTypeName:"itemFieldSetValue"})}proxyGraphBlockField(e,t,a){return this._proxyObject(e,t,a,{isLink:"Link"===e.type,isField:true,changeEventFunc:function(e){l$1.$emit("itemRepo:graphNodeFieldChanged",e);},proxyEventTypeName:"blockFieldSetValue"})}proxyBlockField(e,t,a){const n="Link"===e.type;return this._proxyObject(e,t,a,{isLink:n,isField:true,changeEventFunc:function(e){l$1.$emit("itemRepo:fieldChanged",e),n&&l$1.$emit("itemRepo:linkChanged",e);},proxyEventTypeName:"blockFieldSetValue"})}proxyScriptItem(e,t,a){return this._proxyObject(e,t,a,{isLink:true,changeEventFunc:function(e){l$1.$emit("itemRepo:scriptItemChanged",e);},proxyEventTypeName:"scriptItemSetValue"})}proxyScriptFieldsArray(e,t,a){return this._proxyArray(e,t,a,{addEventFunc:function(e){l$1.$emit("itemRepo:scriptFieldAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:scriptFieldDeleted",e);},changeDoesNotMakeItemDirty:true})}proxyScriptField(e,t,a){return this._proxyObject(e,t,a,{isLink:false,isField:true,changeEventFunc:function(e){l$1.$emit("itemRepo:scriptFieldChanged",e);},proxyEventTypeName:"itemScriptFieldSetValue",changeDoesNotMakeItemDirty:false})}proxyCustomFieldsArray(e,t){return this._proxyArray(e,null,t,{addEventFunc:function(e){l$1.$emit("itemRepo:customFieldAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:customFieldDeleted",e);},changeDoesNotMakeItemDirty:true})}proxyCustomField(e,t){return this._proxyObject(e,null,t,{isLink:false,isField:true,changeEventFunc:function(e){l$1.$emit("itemRepo:customFieldChanged",e);},proxyEventTypeName:"itemCustomFieldSetValue",changeDoesNotMakeItemDirty:false})}};let g$1 = class g{level;name;times;durations=[];childrenMap=new Map;children=[];parent;constructor(e,t,a,n){this.name=e,this.level=t,this.times=[a],this.parent=n;}};function b(e,t){return _.instance.block(e,t)}async function v(e,t){return _.instance.asyncBlock(e,t)}function w(e,t){const a=performance.now();let n=false;try{const i=e();return i?.then?(n=!0,i.then((()=>{console.log(`[TIMING] for ${t||e.name||"<unknown>"}: ${Math.ceil(performance.now()-a)}ms`);}))):i}finally{n||console.log(`[TIMING] for ${t||e.name||"<unknown>"}: ${Math.ceil(performance.now()-a)}ms`);}}class _{startTime=0;endTime=0;startIteration=0;currentLevel=0;root=new g$1("root",0,0,void 0);currentEntry;active=false;static _instance;static get instance(){return this._instance||(this._instance=new this)}constructor(){this.currentEntry=this.root;}start(){this.startTime=performance.now(),this.startIteration=this.startTime,this.root=new g$1("root",0,0,void 0),this.currentEntry=this.root,this.currentLevel=0,this.active=true;}end(e=false){this.active=false,this.endTime=performance.now()-this.startTime,this.root.durations.push(this.endTime-this.root.times[0]),e&&this.printResults();}_iterate(e,t){e(t=t||this.root);for(const a of t.children)this._iterate(e,a);}getResults(){const e=[];function t(e){return Math.round(1e3*e)/1e3}function a(e){return e.reduce(((e,t)=>e+t),0)}return this._iterate((function(n){const i=t(a(n.times)/n.times.length),r=t(a(n.durations)/n.durations.length),s=t(a(n.durations)),o=t(s-n.children.reduce(((e,t)=>e+a(t.durations)),0));e.push({name:"".padStart(2*n.level," .")+n.name,executions:n.times.length,avgTimeStartMs:i,avgTimeEndMs:t(i+r),avgDurationMs:r,totalDurationMs:s,selfDurationMs:o});})),e}printResults(){console.table(this.getResults(),["name","executions","avgTimeStartMs","avgTimeEndMs","avgDurationMs","totalDurationMs","selfDurationMs"]);}newIteration(){this.startIteration=performance.now(),this.currentLevel=0;}async asyncBlock(e,t){if(!this.active)return t();let a;try{return a=this.beginBlock(e),await t()}finally{this.endBlock(a);}}block(e,t){if(!this.active)return t();let a;try{return a=this.beginBlock(e),t()}finally{this.endBlock(a);}}beginBlock(e){if(!this.active)return;this.currentLevel++;const t=performance.now()-this.startIteration;let a=this.currentEntry.childrenMap.get(e);return a?a.times.push(t):(a=new g$1(e,this.currentLevel,t,this.currentEntry),this.currentEntry.children.push(a),this.currentEntry.childrenMap.set(e,a)),this.currentEntry=a,a}endBlock(e){if(!e)return;const t=performance.now()-this.startIteration-e.times[e.times.length-1];e.durations.push(t),this.currentEntry=e.parent,this.currentLevel--;}}let A$6 = class A extends Error{constructor(e,t){super(e),t&&(this.name=t);}toString(){return this.name?`${this.name}: ${this.message}`:this.message}};class k extends A$6{constructor(e){super(e,"InvalidArgumentException");}}let S$1 = class S extends A$6{constructor(e){super(e,"InvalidStateException");}};let N$1 = class N extends A$6{constructor(e){super(e,"RuntimeException");}};let T$1 = class T extends A$6{constructor(e){super(e,"LoaderException");}};class M extends A$6{constructor(e){super(e,"QuotaExceededException");}}let x$2 = class x extends A$6{constructor(e){super(e,"AccessDeniedException");}};let C$1=class C{_id;name;folder;folderPath;links;attributes;userAttributes;filename;createdAt;updatedAt;version;filesize;hash;mimeType;type;packageType;createdBy;updatedBy;acl;visibility;properties;allowConversation;conversation;tags;contributors;description;shortDescription;userAttributeTemplate;categories;attachments;license;quotaUser;quotaGroup;itemSize;totalSize;flags;perceptiveHash;unpackagedSize;location;itemFlag;constructor(e){if(this._id=e._id,this.name=e.name,this.folder=e.folder,this.folderPath=e.folderPath,this.links=[],Array.isArray(e.links))for(const t of e.links)this.links.push({to:t.to,usage:t.usage});this.attributes=JSON.parse(JSON.stringify(e.attributes||{})),this.userAttributes=JSON.parse(JSON.stringify(e.userAttributes||{})),this.filename=e.filename,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt,this.version={major:e.version?.major||0,minor:e.version?.minor||0,revision:e.version?.revision||1},this.filesize=e.filesize,this.hash=e.hash,this.mimeType=e.mimeType,this.type=e.type,this.packageType=e.packageType,this.createdBy=e.createdBy,this.updatedBy=e.updatedBy,this.acl=JSON.parse(JSON.stringify(e.acl||[])),this.visibility=e.visibility,this.properties=JSON.parse(JSON.stringify(e.properties||{})),this.allowConversation=e.allowConversation,this.conversation=e.conversation,this.tags=JSON.parse(JSON.stringify(e.tags||[])),this.contributors=JSON.parse(JSON.stringify(e.contributors||[])),this.description=e.description,this.shortDescription=e.shortDescription,this.userAttributeTemplate=e.userAttributeTemplate,this.categories=e.categories,this.attachments=JSON.parse(JSON.stringify(e.attachments||[])),this.license=e.license,this.quotaUser=e.quotaUser,this.quotaGroup=e.quotaGroup,this.itemSize=e.itemSize,this.totalSize=e.totalSize,this.flags=JSON.parse(JSON.stringify(e.flags||[])),this.perceptiveHash=e.perceptiveHash,this.unpackagedSize=e.unpackagedSize,this.location=e.location,this.itemFlag=JSON.parse(JSON.stringify(e.itemFlag||{}));}};class V extends C$1{links;thumbnails;fieldSets;fields;userFields;isAggregatedItem=true;constructor(e){if(super(e),this.links=[],Array.isArray(e.links))for(const t of e.links)this.links.push({to:t.to,usage:t.usage,stopRecursion:t.stopRecursion});this.thumbnails=JSON.parse(JSON.stringify(e.thumbnails||[])),this.fieldSets=JSON.parse(JSON.stringify(e.fieldSets||[])),this.fields=JSON.parse(JSON.stringify(e.fields||[])),this.userFields=JSON.parse(JSON.stringify(e.userFields||[]));}}var I$1=[{_id:{$oid:"5e6a1ace89707feef5738292"},contentTypes:["model/splat"],fieldSets:[],fields:[],name:"Gaussian Splats",updateRequiresThumbRefresh:true,creatableEmpty:false},{_id:{$oid:"5e6a1ace89707eee5523aa61"},contentTypes:["application/json"],fieldSets:[],fields:[],name:"Structured Data",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ace89707feef3748569"},contentTypes:[],fieldSets:[],fields:[{label:"Scenes",type:"Separator"},{elementName:"Scene",fields:[{linkableTypes:["Scene"],type:"Link",usageAs:"Scene",mandatory:true},{datatype:"Boolean",defaultValue:true,displayName:"Load",name:"Load",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Active",if:{Load:true},name:"Active",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Primary",name:"Primary",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Exclude in packages",name:"ExcludeInPackages",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},name:"Transform",type:"Attribute"}],name:"Scenes",type:"List"},{label:"Variable Sets",type:"Separator",collapsed:true},{displayName:"Variable sets",elementName:"Variable set",fields:[{displayName:"Variable set",linkableTypes:["Variable Set"],type:"Link",usageAs:"VariableSet",mandatory:true},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"}],name:"VariableSets",type:"List"},{label:"Graphics",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Not defined",displayName:"Aspect ratio",info:"This determines the project's aspect ratio. If not defined, the game will run in the default aspect depending on platform and browser size",name:"AspectRatio",options:["Not defined","Standard (4:3)","Widescreen (16:9)","Ultrawide (21:9)","Custom"],type:"Attribute"},{datatype:"Float",defaultValue:1.3,minValue:.1,maxValue:10,displayName:"Custom Aspect",if:{AspectRatio:"Custom"},name:"CustomAspect",type:"Attribute"},{label:"Physics",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Enabled",name:"PhysicsEnabled",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:-9.81,z:0},displayName:"Gravity",if:{PhysicsEnabled:true},name:"Gravity",type:"Attribute"},{datatype:"LayerMatrix",defaultValue:[[0]],displayName:"Collision matrix",if:{PhysicsEnabled:true},info:"This controls which physics object interact with which others depending on their layers",name:"CollisionMatrix",type:"Attribute"},{datatype:"StringList",defaultValue:["Default","Terrain","TransparentFX","Water"],displayName:"Layer names",fixedLength:true,info:"Names of the layers to use with all scenegraph nodes",name:"LayerNames",type:"Attribute"},{label:"Resources",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"After loading everything",displayName:"Start execution",info:"This controls when the engine will start execution of the project in the player",name:"StartExecution",options:["Right away","After loading minimum LOD","After loading everything"],type:"Attribute"},{label:"Controls",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Automatic pointer lock",name:"AutomaticPointerLock",type:"Attribute",info:"Enabling this will cause the mouse pointer to be locked until Escape is pressed"},{label:"Canvas Fonts",type:"Separator",collapsed:true},{displayName:"Canvas fonts",elementName:"Font",fields:[{displayName:"Font",linkableTypes:["Font"],type:"Link",usageAs:"Font",mandatory:true}],name:"CanvasFonts",type:"List"}],name:"Project",recursiveLoadStopsHere:true,updateRequiresThumbRefresh:false,creatableEmpty:false},{_id:{$oid:"5e6a1ace24a07f56f3742569"},contentTypes:[],fieldSets:[],fields:[{elementName:"Variable",fields:[{datatype:"String",defaultValue:"Name",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Enum",defaultValue:"Integer",displayName:"Type",name:"Type",options:["Integer","Float","String","Boolean"],type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Value",if:{Type:"Boolean"},name:"BooleanValue",type:"Attribute"},{datatype:"Integer",defaultValue:0,displayName:"Value",if:{Type:"Integer"},name:"IntegerValue",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Value",if:{Type:"Float"},name:"FloatValue",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Value",if:{Type:"String"},name:"StringValue",type:"Attribute"}],name:"Variables",type:"List"}],name:"Variable Set",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ace89707feef9173386"},contentTypes:["audio/mpeg"],fieldSets:[],fields:[{datatype:"Float",defaultValue:1,displayName:"Volume",maxValue:1,minValue:0,name:"Volume",type:"Attribute",widget:"Slider"}],name:"Audio",updateRequiresThumbRefresh:false,creatableEmpty:false},{_id:{$oid:"5e6a1acf89707feef917338f"},contentTypes:["*"],fieldSets:[],fields:[],name:"Binary",creatableEmpty:false},{_id:{$oid:"5e6a1acf89707feef917337f"},contentTypes:["application/vnd.lumino.package"],fieldSets:[],fields:[],name:"Package",creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173391"},contentTypes:["image/vnd.radiance"],fieldSets:[],fields:[],name:"HDR Image",creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173392"},contentTypes:["image/png","image/jpeg","image/avif","image/heif"],fieldSets:[],fields:[{datatype:"Enum",defaultValue:"Linear",displayName:"Encoding",name:"Encoding",options:["Linear","sRGB"],type:"Attribute"}],name:"Image",updateRequiresThumbRefresh:true,creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173393"},contentTypes:[""],fieldSets:[],fields:[{label:"Type",type:"Separator"},{datatype:"Enum",defaultValue:"Physical",displayName:"Material type",name:"MaterialType",options:["Physical","Shader","Point","Basic","Normal","Toon","Matcap","Lambert","Phong"],type:"Attribute"},{label:"Matcap material options",type:"Separator",if:{MaterialType:"Matcap"}},{displayName:"Matcap map",linkableTypes:["Image"],type:"Link",usageAs:"Matcap",if:{MaterialType:"Matcap"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Toon material options",type:"Separator",if:{MaterialType:"Toon"}},{displayName:"Gradient map",linkableTypes:["Image"],if:{MaterialType:"Toon"},type:"Link",usageAs:"Gradient"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Nearest",displayName:"Mag filter",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientMagFilter",options:["Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Nearest",displayName:"Min Filter",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientMinFilter",options:["Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Basic material options",type:"Separator",if:{MaterialType:"Basic"}},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Color",name:"EmissionColor",type:"Attribute",if:{MaterialType:"Basic"}},{label:"Custom shaders",type:"Separator",if:{MaterialType:"Shader"}},{displayName:"Vertex shader",linkableTypes:["Vertex Shader"],type:"Link",usageAs:"VertexShader",if:{MaterialType:"Shader"}},{displayName:"Pixel shader",linkableTypes:["Pixel Shader"],type:"Link",usageAs:"PixelShader",if:{MaterialType:"Shader"}},{label:"Point rendering",type:"Separator",if:{MaterialType:"Point"}},{datatype:"Float",defaultValue:1,displayName:"Size",if:{MaterialType:"Point"},minValue:0,name:"PointSize",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Size attenuation",if:{MaterialType:"Point"},name:"PointSizeAttenuation",type:"Attribute"},{label:"Attenuation",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Color",info:"The color that white light turns into due to absorption when reaching the attenuation distance.",name:"AttenuationColor",type:"Attribute",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:1e3,displayName:"Distance",info:"Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space units, and must be greater than zero.",minValue:1e-5,name:"AttenuationDistance",type:"Attribute",if:{MaterialType:"Physical"}},{label:"Diffuse",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Color",name:"DiffuseColor",type:"Attribute",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Albedo map",linkableTypes:["Image","Composition","Video"],type:"Link",usageAs:"Albedo",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Vertex Colors",name:"VertexColors",type:"Attribute"},{label:"Transparency",type:"Separator"},{datatype:"Float",defaultValue:0,displayName:"Alpha test",maxValue:1,minValue:0,name:"AlphaTest",type:"Attribute",widget:"Slider"},{datatype:"Boolean",defaultValue:false,displayName:"Transparent",name:"Transparent",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",if:{Transparent:true},maxValue:1,minValue:0,name:"Opacity",type:"Attribute",widget:"Slider"},{displayName:"Alpha map",linkableTypes:["Image"],type:"Link",usageAs:"Alpha",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Emission",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Color",defaultValue:{a:255,b:0,g:0,r:0},displayName:"Color",name:"EmissiveColor",type:"Attribute",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1,displayName:"Intensity",maxValue:10,minValue:0,name:"EmissiveIntensity",type:"Attribute",widget:"Slider",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Emissive map",linkableTypes:["Image"],type:"Link",usageAs:"Emissive",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Sheen",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Sheen",maxValue:1,minValue:0,name:"Sheen",type:"Attribute",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Sheen roughness",maxValue:1,minValue:0,name:"SheenRoughness",type:"Attribute",if:{MaterialType:"Physical"}},{displayName:"Sheen roughness map",linkableTypes:["Image"],type:"Link",usageAs:"SheenRoughnessMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Sheen color",name:"SheenColor",type:"Attribute",if:{MaterialType:"Physical"}},{displayName:"Sheen color map",linkableTypes:["Image"],type:"Link",usageAs:"SheenColorMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Normal",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Normal map",linkableTypes:["Image"],type:"Link",usageAs:"Normal",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"Scale",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},maxValue:10,minValue:0,name:"NormalScale2d",type:"Attribute"},{datatype:"Enum",defaultValue:"TangentSpace",displayName:"Type",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalType",options:["TangentSpace","ObjectSpace"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Roughness",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:1,displayName:"Roughness Intensity",maxValue:1,minValue:0,name:"RoughnessIntensity",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Roughness map",linkableTypes:["Image"],type:"Link",usageAs:"Roughness",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{Roughness:{$isset:true}},name:"RoughnessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{Roughness:{$isset:true}},name:"RoughnessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{Roughness:{$isset:true}},name:"RoughnessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{Roughness:{$isset:true}},name:"RoughnessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",Roughness:{$isset:true}},name:"RoughnessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Metalness",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:1,displayName:"Metalness Intensity",maxValue:1,minValue:0,name:"MetalnessIntensity",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Metalness map",linkableTypes:["Image"],type:"Link",usageAs:"Metalness",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{Metalness:{$isset:true}},name:"MetalnessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{Metalness:{$isset:true}},name:"MetalnessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{Metalness:{$isset:true}},name:"MetalnessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{Metalness:{$isset:true}},name:"MetalnessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",Metalness:{$isset:true}},name:"MetalnessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Specular",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"}]}},{datatype:"Float",defaultValue:1,displayName:"Specular intensity",maxValue:1,minValue:0,name:"SpecularIntensity",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Specular intensity map",linkableTypes:["Image"],type:"Link",usageAs:"SpecularIntensityMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},if:{MaterialType:"Physical"},displayName:"Specular color",name:"SpecularColor",type:"Attribute"},{displayName:"Specular color map",linkableTypes:["Image"],if:{MaterialType:"Physical"},type:"Link",usageAs:"SpecularColorMap"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Ambient occlusion",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Ambient occlusion map",linkableTypes:["Image"],type:"Link",usageAs:"AmbientOcclusion",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1,displayName:"Intensity",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},maxValue:10,minValue:0,name:"AmbientOcclusionIntensity",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Clearcoat",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Intensity",maxValue:1,minValue:0,name:"ClearcoatLevel",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Clearcoat map",linkableTypes:["Image"],type:"Link",usageAs:"Clearcoat",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{displayName:"Normal map",linkableTypes:["Image"],type:"Link",usageAs:"ClearcoatNormalMap",if:{MaterialType:"Physical"}},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"Normal scale",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},maxValue:10,minValue:0,name:"ClearcoatNormalScale2d",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Normal H-wrapping",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Normal V-wrapping",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Normal mag filter",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Normal min Filter",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Normal Anisotropy",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Roughness intensity",maxValue:1,minValue:0,name:"ClearcoatRoughness",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Roughness map",linkableTypes:["Image"],type:"Link",usageAs:"ClearcoatRoughnessMap"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Roughness H-wrapping",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Roughness V-wrapping",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Roughness mag filter",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Roughness min Filter",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Roughness Anisotropy",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Reflections and Refractions",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:.98,displayName:"Refraction ratio",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]},minValue:0,maxValue:1,name:"RefractionRatio",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Reflectivity",maxValue:1,minValue:0,name:"Reflectivity",type:"Attribute",widget:"Slider",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1.5,displayName:"Index of refraction",maxValue:2.333,minValue:1,name:"IndexOfRefraction",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{label:"Environment",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Environment map",linkableTypes:["HDR Image"],type:"Link",usageAs:"Environment",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1,displayName:"Intensity",if:{$or:[{MaterialType:"Physical"}],Environment:{$isset:true}},maxValue:10,minValue:0,name:"EnvironmentIntensity",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Multiply",info:"How to combine the result of the surface's color with the environment map, if any. If mix is chosen, the .reflectivity is used to blend between the two colors.",displayName:"Surface combination",name:"SurfaceEnvironmentCombination",options:["Multiply","Mix","Add"],type:"Attribute",if:{$or:[{MaterialType:"Lambert"},{MaterialType:"Basic"},{MaterialType:"Phong"}]}},{label:"Thickness",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Thickness",minValue:0,name:"Thickness",type:"Attribute",if:{MaterialType:"Physical"}},{displayName:"Thickness map",linkableTypes:["Image"],type:"Link",usageAs:"ThicknessMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Displacement",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Displacement map",linkableTypes:["Image"],type:"Link",usageAs:"Displacement",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:.1,displayName:"Scale",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},maxValue:10,minValue:0,name:"DisplacementScale",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Bias",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementBias",type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Lightmaps",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Light map",linkableTypes:["Image"],type:"Link",usageAs:"LightMap",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1,displayName:"Intensity",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},maxValue:100,minValue:0,name:"LightMapIntensity",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Specular map options",type:"Separator",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:30,displayName:"Shininess",minValue:0,name:"Shininess",type:"Attribute",widget:"Slider",if:{$or:[{MaterialType:"Phong"}]}},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},if:{MaterialType:"Phong"},displayName:"Specular color",name:"SpecularColor",type:"Attribute"},{displayName:"Specular map",linkableTypes:["Image"],if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]},type:"Link",usageAs:"SpecularMap"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Transmission",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Intensity",maxValue:1,minValue:0,name:"Transmission",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Transmission map",linkableTypes:["Image"],type:"Link",usageAs:"TransmissionMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Blending",type:"Separator"},{datatype:"Enum",defaultValue:"Normal",displayName:"Mode",name:"Blending",options:["None","Normal","Additive","Subtractive","Multiply","Custom"],type:"Attribute"},{datatype:"Enum",defaultValue:"Source alpha",displayName:"Source",name:"BlendSrc",options:["Zero","One","Source color","One minus source color","Source alpha","One minus source alpha","Destination alpha","One minus destination alpha","Destination color","One minus destination color","Source alpha saturate"],type:"Attribute",if:{Blending:"Custom"}},{datatype:"Enum",defaultValue:"One minus source alpha",displayName:"Destination",name:"BlendDest",options:["Zero","One","Source color","One minus source color","Source alpha","One minus source alpha","Destination alpha","One minus destination alpha","Destination color","One minus destination color"],type:"Attribute",if:{Blending:"Custom"}},{datatype:"Enum",defaultValue:"Add",displayName:"Equation",name:"BlendEquation",options:["Add","Subtract","Reverse subtract","Min","Max"],type:"Attribute",if:{Blending:"Custom"}},{label:"Depth test",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"DepthTest",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Write",if:{DepthTest:true},name:"DepthWrite",type:"Attribute"},{datatype:"Enum",defaultValue:"Less/equal",displayName:"Mode",if:{DepthTest:true},name:"DepthMode",options:["Never","Always","Less","Less/equal","Greater/equal","Greater","Not equal"],type:"Attribute"},{label:"Culling",type:"Separator"},{datatype:"Enum",defaultValue:"Back",displayName:"Mode",name:"Culling",options:["Front","Back","Off"],type:"Attribute"},{label:"Flat shading",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Boolean",defaultValue:false,displayName:"Active",name:"FlatShading",type:"Attribute",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{label:"Wireframe",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Shader"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Boolean",defaultValue:false,displayName:"Wireframe",name:"Wireframe",type:"Attribute",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Shader"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}}],name:"Material",updateRequiresThumbRefresh:true,creatableEmpty:true},{_id:{$oid:"5e6a1ad189707feef9173394"},contentTypes:["model/obj","model/gltf-binary","model/vnd.usdz+zip","model/draco","model/ply","model/fbx"],fieldSets:[],fields:[{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{doesNotAffectThumbnail:true,linkableTypes:["Mesh"],loadingManager:"ignore",preload:false,type:"Link",usageAs:"USDZ"},{doesNotAffectThumbnail:true,linkableTypes:["Mesh"],loadingManager:"ignore",preload:false,type:"Link",usageAs:"GLB"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},name:"Pivot",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},name:"DefaultTransform",displayName:"Default transform",type:"Attribute"}],name:"Mesh",updateRequiresThumbRefresh:true,creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173396"},contentTypes:[""],fields:[{label:"Camera & Composition",type:"Separator"},{datatype:"Enum",defaultValue:"Automatic user controllable camera",displayName:"Camera mode",info:"Camera to render during playback. The main camera is the one with the 'mainCamera' Tag or if only one camera exists, that is the one. Composer setting will render whatever the composition defines.",name:"CameraMode",options:["Automatic user controllable camera","Main camera","Composer"],type:"Attribute"},{linkableTypes:["Composition"],type:"Link",if:{CameraMode:"Composer"},usageAs:"Composition",mandatory:true},{label:"Environment & Background",type:"Separator"},{datatype:"Enum",defaultValue:"None",displayName:"Background mode",name:"BackgroundMode",options:["None","Color","Image","Environment map","Shader"],type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Background blurriness",if:{BackgroundMode:"Environment map"},maxValue:1,minValue:0,name:"BackgroundBlurriness",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:1,displayName:"Background intensity",if:{$or:[{BackgroundMode:"Image"},{BackgroundMode:"Environment map"}]},maxValue:10,minValue:0,name:"BackgroundIntensity",type:"Attribute",widget:"Slider"},{displayName:"Background shader",if:{BackgroundMode:"Shader"},linkableTypes:["Background Shader"],type:"Link",usageAs:"BackgroundShader",mandatory:true},{displayName:"Background image",if:{BackgroundMode:"Image"},linkableTypes:["Image"],type:"Link",usageAs:"Background",mandatory:true},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Background color",if:{BackgroundMode:"Color"},name:"BackgroundColor",type:"Attribute"},{displayName:"Environment map",linkableTypes:["HDR Image"],type:"Link",usageAs:"Environment"},{datatype:"Float",defaultValue:1,displayName:"Environment intensity",maxValue:10,minValue:0,name:"EnvironmentIntensity",type:"Attribute",widget:"Slider"},{datatype:"Color",defaultValue:{a:255,b:0,g:0,r:0},displayName:"Clear color",name:"ClearColor",type:"Attribute"},{label:"Rendering",type:"Separator",collapsed:false},{datatype:"Enum",defaultValue:"PCF Shadow Map",displayName:"Shadow type",name:"ShadowType",options:["Basic Shadow Map","PCF Shadow Map","VSM Shadow Map"],type:"Attribute"}],name:"Scene",updateRequiresThumbRefresh:true,inherits:"Prefab",creatableEmpty:true},{_id:{$oid:"5e6a1ad189707fcef4252336"},contentTypes:[""],fieldSets:[{fields:[{label:"3D Object",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",info:"Indicates if the 3D object is currently active or inactive. When set to true, the object is active.",name:"Active",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Static",info:"A Boolean attribute indicating whether the 3D object is static or not. Static objects can and will never be transformed during runtime.",name:"Static",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",info:"Specifies the name of the 3D object. This is used for identification and reference in the scene.",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},info:"Describes the object's transformation attributes including its position, rotation, and scale in the 3D space.",name:"Transform",type:"Attribute"},{type:"Label",text:"Changing scale in transforms for physics enabled objects is not recommended. Not all objects fully support it. Keep it at least uniform!",labelType:"warning",if:{"PhysicsEnabled?":true,$or:[{"Transform.scale.x":{$not:1}},{"Transform.scale.y":{$not:1}},{"Transform.scale.z":{$not:1}}]}},{datatype:"Layers",defaultValue:[0],info:"Defines the layers that the 3D object is part of. Layers are used for managing object interactions and visibility in the scene.",name:"Layers",type:"Attribute"},{datatype:"Tags",defaultValue:[],info:"Lists tags associated with the 3D object. Tags are useful for categorizing and searching objects in the scene.",name:"Tags",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Receive shadow",info:"Determines whether the object can receive shadows from other objects. Set to true if the object should display shadows cast upon it.",name:"ReceiveShadow",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Cast shadow",info:"Controls whether the object casts shadows in the presence of light sources. Set to true to enable shadow casting from this object.",name:"CastShadow",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Rendered",info:"Indicates if the 3D object is being rendered.",name:"Rendered",type:"Attribute"}],name:"3dObjectDefault"},{fields:[{label:"3D Object",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",info:"A Boolean attribute indicating whether the 3D object is active or not. When set to true, the object is considered active in the scene.",name:"Active",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Static",info:"A Boolean attribute indicating whether the 3D object is static or not. Static objects can and will never be transformed during runtime.",name:"Static",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",info:"A string attribute representing the name of the 3D object. It is used to identify and reference the object within the scene.",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},info:"Specifies the transformation properties of the 3D object, including its position, rotation, and scale in the scene.",name:"Transform",type:"Attribute"},{datatype:"Layers",defaultValue:[0],info:"Determines the layers the 3D object belongs to. Layers are used to organize objects in the scene for various purposes like rendering and interaction.",name:"Layers",type:"Attribute"},{datatype:"Tags",defaultValue:[],info:"A list of tags associated with the 3D object. Tags are used for categorizing and identifying objects for scripting and scene management.",name:"Tags",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Rendered",info:"Indicates if the 3D object is being rendered.",name:"Rendered",type:"Attribute"}],name:"3dObjectNoShadows"},{fields:[{label:"Physics",type:"Separator"},{datatype:"Boolean",defaultValue:false,displayName:"Physics enabled",info:"A Boolean attribute that determines whether physics properties are applied to the object. Disabling it turns off physics calculations.",name:"PhysicsEnabled",type:"Attribute"},{datatype:"Enum",defaultValue:"Rigid body",displayName:"Body type",if:{PhysicsEnabled:true},name:"BodyType",options:["Rigid body","Soft body","Ghost object"],type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Separate subobjects",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"When adding all subobjects of the mesh separately, they will all act individually. We lose however also the possibility to control and watch them as a single object. The configured mass will be distributed among all subobjects",name:"SeparateSubobjects",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Mass",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Specifies the mass of the object as a float value. The mass must be a non-negative value.",minValue:0,name:"Mass",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Pressure",if:{BodyType:"Soft body",PhysicsEnabled:true},info:"Specifies the pressure of the soft body as a float value. The pressure must be a non-negative value.",minValue:0,name:"Pressure",type:"Attribute"},{datatype:"Float",defaultValue:.01,displayName:"Damping",if:{BodyType:"Soft body",PhysicsEnabled:true},info:"Specifies the damping of the soft body.",minValue:0,name:"Damping",type:"Attribute"},{datatype:"Float",defaultValue:.04,displayName:"Margin",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Defines the margin of the object for physics calculations as a float value. The margin is a non-negative value.",minValue:0,name:"Margin",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Restitution",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Determines the restitution (bounciness) of the object. It's a float value affecting how the object bounces upon impact.",name:"Restitution",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Friction",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Sets the friction coefficient of the object. It's a float value, affecting how the object slides against other surfaces.",name:"Friction",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Spinning friction",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Defines the spinning friction of the object as a float value, affecting the object's rotational resistance.",name:"SpinningFriction",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Rolling friction",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Specifies the rolling friction of the object. It's a float value that influences how the object rolls over surfaces.",name:"RollingFriction",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Linear damping",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"Sets the linear damping.",name:"LinearDamping",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Angular damping",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"Sets the angular damping.",name:"AngularDamping",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:1,y:1,z:1},displayName:"Linear factor",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"A Vector3d value that defines the linear factor of the object in terms of x, y, and z axes, controlling how the object moves linearly.",name:"LinearFactor",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Linear velocity",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"Defines the object's linear velocity using a Vector3d value, representing the velocity along the x, y, and z axes.",name:"LinearVelocity",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:1,y:1,z:1},displayName:"Angular factor",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"A Vector3d attribute that specifies the angular factor of the object, influencing the object's rotation around each axis.",name:"AngularFactor",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Angular velocity",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"Sets the angular velocity of the object using a Vector3d value, affecting the object's rotational speed.",name:"AngularVelocity",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Is kinematic",if:{BodyType:"Rigid body",PhysicsEnabled:true,SeparateSubobjects:false},info:"A Boolean attribute that makes the object kinematic when true, meaning it will not be affected by physics but can still affect other objects.",name:"IsKinematic",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Disable deactivation",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,$or:[{IsKinematic:false},{BodyType:"Soft body"}]},info:"When set to true, object will be simulated in physics forever. Otherwise it will be deactivated when not moving anymore",name:"DisableDeactivation",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Watch collisions",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"When set to true, enables monitoring of collisions involving the object.",name:"WatchCollisions",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Report contact points",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"If set to true, collision events will contain the exact contact points. Only enable if you really need it as it costs performance.",name:"ReportContactPoints",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Filter potential collisions",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"The physics engine might report collisions without contact points in cases where objects get close. Filter these out by setting this.",name:"FilterPotentialCollisions",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Watch linear velocity",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"Enables the tracking of changes in the object's linear velocity when set to true.",name:"WatchLinearVelocity",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Watch angular velocity",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"Allows for the monitoring of changes in the object's angular velocity when enabled.",name:"WatchAngularVelocity",type:"Attribute"},{if:{BodyType:{$not:"Soft body"},PhysicsEnabled:true},label:"Collider",type:"Separator"},{datatype:"Enum",defaultValue:"Self",displayName:"Collider type",if:{BodyType:{$not:"Soft body"},PhysicsEnabled:true},name:"ColliderType",options:["Self","Bounding Box","Bounding Sphere","Bounding Cylinder","Capsule","Convex Hull","Custom Mesh"],type:"Attribute"},{datatype:"Enum",defaultValue:"Derive from mesh",displayName:"Capsule size",if:{BodyType:{$not:"Soft body"},ColliderType:"Capsule",PhysicsEnabled:true},name:"CapsuleSize",options:["Derive from mesh","Manual"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Capsule height",if:{BodyType:{$not:"Soft body"},ColliderType:"Capsule",CapsuleSize:"Manual",PhysicsEnabled:true},name:"CapsuleHeight",minValue:0,type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Capsule radius",if:{BodyType:{$not:"Soft body"},ColliderType:"Capsule",CapsuleSize:"Manual",PhysicsEnabled:true},name:"CapsuleRadius",minValue:0,type:"Attribute"},{displayName:"Collider mesh",if:{BodyType:{$not:"Soft body"},ColliderType:"Custom Mesh",PhysicsEnabled:true},linkableTypes:["Mesh","Mesh Collection"],type:"Link",usageAs:"ColliderMesh",mandatory:true},{datatype:"Enum",defaultValue:"",displayName:"Collection entry",if:{BodyType:{$not:"Soft body"},ColliderType:"Custom Mesh",PhysicsEnabled:true,$optionsexist:true},name:"ColliderMeshCollectionEntry",options:[],type:"Attribute"}],name:"Physics"},{fields:[{datatype:"Enum",defaultValue:"Single",displayName:"Source type",name:"SourceType",options:["Single","Collection"],type:"Attribute"},{displayName:"Audio item",if:{SourceType:"Single"},linkableTypes:["Audio"],type:"Link",usageAs:"AudioItem"},{displayName:"Audio collection",if:{SourceType:"Collection"},linkableTypes:["Audio Collection"],type:"Link",usageAs:"AudioCollectionItem"},{datatype:"Enum",defaultValue:"",displayName:"Collection entry",if:{SourceType:"Collection"},name:"AudioCollectionEntry",options:[],type:"Attribute"}],name:"AudioLink"},{fields:[{displayName:"Mesh item",linkableTypes:["Mesh","Mesh Collection"],type:"Link",usageAs:"Mesh",mandatory:true},{datatype:"Enum",defaultValue:"",displayName:"Collection entry",if:{$optionsexist:true},name:"MeshCollectionEntry",options:[],type:"Attribute"}],name:"MeshLink"}],fields:[{childTypes:[{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Mesh specific fields",type:"Separator"},{name:"MeshLink",type:"FieldSet"},{datatype:"Enum",defaultValue:"Pivot",name:"OriginMode",displayName:"Origin mode",if:{$or:[{MeshCollectionEntry:{$isset:true}},{Mesh:{$isset:true}}]},options:["Pivot","Center","Custom"],type:"Attribute"},{name:"CustomPivot",displayName:"Custom Pivot",type:"Attribute",datatype:"Vector3d",if:{OriginMode:"Custom"},defaultValue:{x:0,y:0,z:0}},{datatype:"Animations",defaultValue:[],displayName:"Animations",if:{$or:[{MeshCollectionEntry:{$isset:true}},{Mesh:{$isset:true}}]},name:"Animations",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable instancing",info:"Prepare a static geometry source for GPU instancing. Required before using allocInstances from scripts.",name:"EnableInstancing",type:"Attribute"},{name:"Physics",type:"FieldSet"}],mainItemField:"Mesh",typeName:"Mesh"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"ScriptedMesh specific fields",type:"Separator"},{displayName:"Material(s)",linkableTypes:["Material","Material Collection"],type:"Link",usageAs:"Materials"},{datatype:"Boolean",defaultValue:false,displayName:"Indexed",info:"Indicates if the geometry buffer is indexed.",name:"Indexed",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Have positions",info:"Add a position attribute to the mesh.",name:"HavePositions",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Have normals",info:"Add a normal attribute to the mesh.",name:"HaveNormals",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Have colors",info:"Add a color attribute to the mesh.",name:"HaveColors",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Have UV Coords",info:"Add a UV texture coordinate attribute to the mesh.",name:"HaveUVs",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"ScriptedMesh"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Splats specific fields",type:"Separator"},{linkableTypes:["Gaussian Splats"],type:"Link",usageAs:"Splats",mandatory:true}],mainItemField:"Splats",typeName:"GaussianSplats"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Prefab specific fields",type:"Separator"},{linkableTypes:["Scene","Prefab"],type:"Link",usageAs:"Prefab",mandatory:true}],mainItemField:"Prefab",typeName:"Prefab"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Points specific fields",type:"Separator"},{name:"MeshLink",type:"FieldSet"}],mainItemField:"Mesh",typeName:"Points"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Lightsource specific fields",type:"Separator"},{datatype:"Enum",defaultValue:"Point",name:"Type",options:["Point","Directional","Ambient","Hemisphere","Spot"],type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},name:"Color",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:64,g:64,r:64},displayName:"Ground color (Hemisphere)",if:{Type:"Hemisphere"},name:"GroundColor",type:"Attribute"},{datatype:"Float",defaultValue:10,minValue:0,name:"Intensity",type:"Attribute"},{datatype:"Float",defaultValue:100,if:{$or:[{Type:"Spot"},{Type:"Point"}]},minValue:0,name:"Distance",type:"Attribute"},{datatype:"Float",defaultValue:2,if:{$or:[{Type:"Spot"},{Type:"Point"}]},minValue:1,name:"Decay",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Angle",if:{Type:"Spot"},maxValue:1.57,minValue:0,name:"Angle",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Penumbra",if:{Type:"Spot"},maxValue:1,minValue:0,name:"Penumbra",type:"Attribute"},{datatype:"Node",defaultValue:null,displayName:"Target",if:{$or:[{Type:"Spot"},{Type:"Directional"}]},name:"Target",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Cast shadows",name:"CastShadows",type:"Attribute",if:{$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]}},{datatype:"Float",defaultValue:0,displayName:"Shadow bias",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]},maxValue:1,minValue:-1,name:"ShadowBias",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:512,displayName:"Shadow size",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]},name:"ShadowSize",options:[128,256,512,1024,2048],type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Shadow camera near",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]},minValue:0,name:"ShadowCameraNear",type:"Attribute"},{datatype:"Float",defaultValue:500,displayName:"Shadow camera far",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]},minValue:0,name:"ShadowCameraFar",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Shadow area width",if:{CastShadows:true,Type:"Directional"},minValue:1,name:"ShadowAreaWidth",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Shadow area height",if:{CastShadows:true,Type:"Directional"},minValue:1,name:"ShadowAreaHeight",type:"Attribute"},{datatype:"Float",defaultValue:4,displayName:"Shadow radius",minValue:0,name:"ShadowRadius",type:"Attribute",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]}},{datatype:"Integer",defaultValue:8,displayName:"VSM blur samples",maxValue:32,minValue:1,name:"VsmBlurSamples",type:"Attribute",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]}}],typeName:"Lightsource"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",info:"Indicates if the 3D object is currently active or inactive. When set to true, the object is active.",name:"Active",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Static",info:"A Boolean attribute indicating whether the 3D object is static or not. Static objects can and will never be transformed during runtime.",name:"Static",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",info:"Specifies the name of the 3D object. This is used for identification and reference in the scene.",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},info:"Describes the object's transformation attributes including its position, rotation, and scale in the 3D space.",name:"Transform",type:"Attribute"},{datatype:"Layers",defaultValue:[],name:"Cullmode",info:"Defines the layers that are not visible to the camera.",displayName:"Cull mode",type:"Attribute"},{datatype:"Tags",defaultValue:[],info:"Lists tags associated with the 3D object. Tags are useful for categorizing and searching objects in the scene.",name:"Tags",type:"Attribute"},{label:"Camera specific fields",type:"Separator"},{datatype:"Enum",defaultValue:"Perspective",name:"Type",options:["Perspective","Orthographic"],type:"Attribute"},{datatype:"Float",defaultValue:60,displayName:"Field of view",if:{Type:"Perspective"},maxValue:360,minValue:1,name:"FieldOfView",type:"Attribute"},{datatype:"Float",defaultValue:-1,displayName:"Left",if:{Type:"Orthographic"},name:"Left",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Right",if:{Type:"Orthographic"},name:"Right",type:"Attribute"},{datatype:"Float",defaultValue:-1,displayName:"Top",if:{Type:"Orthographic"},name:"Top",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Bottom",if:{Type:"Orthographic"},name:"Bottom",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Near plane",minValue:0,name:"NearPlane",type:"Attribute"},{datatype:"Float",defaultValue:1e3,displayName:"Far plane",minValue:0,name:"FarPlane",type:"Attribute"},{datatype:"Enum",defaultValue:"Free",name:"Mode",options:["Free","Look at"],type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},if:{Mode:"Look at"},name:"LookAt",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:1,z:0},displayName:"Up vector",if:{Mode:"Look at"},name:"UpVector",type:"Attribute"}],typeName:"Camera"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"}],typeName:"Group"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Box specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Vector3d",defaultValue:{x:1,y:1,z:1},name:"Size",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:1,y:1,z:1},name:"Segments",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Box"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"GridMap specific fields",type:"Separator"},{linkableTypes:["GridMap"],type:"Link",usageAs:"GridMap"},{name:"Physics",type:"FieldSet"}],typeName:"GridMap"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Ribbon specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Integer",defaultValue:16,displayName:"Ring vertex count",minValue:3,maxValue:256,name:"RingVertexCount",type:"Attribute"},{datatype:"Integer",defaultValue:16,displayName:"Path steps",minValue:2,name:"PathStepCount",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Start time",minValue:0,name:"StartTime",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"End time",minValue:0,name:"EndTime",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Closed",name:"Closed",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Add caps",name:"AddCaps",if:{Closed:false},type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Vertex colors",name:"VertexColors",type:"Attribute"},{label:"Ring formulas",type:"Separator",presets:[{name:"Circle",fields:{RingFormulaX:"cos(theta) * 0.5",RingFormulaY:"0",RingFormulaZ:"sin(theta) * 0.5"}}]},{datatype:"Formula",defaultValue:"cos(theta) * 0.5",displayName:"X",name:"RingFormulaX",type:"Attribute"},{datatype:"Formula",defaultValue:"0",displayName:"Y",name:"RingFormulaY",type:"Attribute"},{datatype:"Formula",defaultValue:"sin(theta) * 0.5",displayName:"Z",name:"RingFormulaZ",type:"Attribute"},{label:"Path formulas",type:"Separator"},{datatype:"Formula",defaultValue:"0",displayName:"X",name:"PathFormulaX",type:"Attribute"},{datatype:"Formula",defaultValue:"sin(t)",displayName:"Y",name:"PathFormulaY",type:"Attribute"},{datatype:"Formula",defaultValue:"t",displayName:"Z",name:"PathFormulaZ",type:"Attribute"},{label:"Color formulas",type:"Separator",if:{VertexColors:true}},{datatype:"Formula",defaultValue:"abs(sin(t))",displayName:"R",name:"ColorFormulaR",type:"Attribute",if:{VertexColors:true}},{datatype:"Formula",defaultValue:"0",displayName:"G",name:"ColorFormulaG",type:"Attribute",if:{VertexColors:true}},{datatype:"Formula",defaultValue:"abs(cos(t))",displayName:"B",name:"ColorFormulaB",type:"Attribute",if:{VertexColors:true}},{label:"Other formulas",type:"Separator"},{datatype:"Formula",defaultValue:"1 + 0.3 * sin(t * 2)",displayName:"Scale",name:"ScaleFormula",type:"Attribute"},{datatype:"Formula",defaultValue:"t * PI * 2",displayName:"Twist",name:"TwistFormula",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Ribbon"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Billboard Specific Fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material",mandatory:true},{datatype:"Text",defaultValue:"Text",displayName:"Text",name:"Text",type:"Attribute"},{datatype:"Enum",defaultValue:"center",displayName:"Text Alignment",info:"The alignment of the text",name:"TextAlign",options:["left","center","right"],type:"Attribute"},{linkableTypes:["Font"],type:"Link",usageAs:"Font"},{datatype:"Boolean",defaultValue:true,displayName:"Size Attenuation",info:"Scales the Billboard with respect to distance to the camera.",name:"SizeAttenuation",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Size",minValue:0,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:2,displayName:"Text Stroke Width",info:"The width of the border of the text.",maxValue:100,minValue:0,name:"TextStrokeWidth",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Text Stroke Color",info:"The color of the border of the text.",name:"TextStrokeColor",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:0,g:0,r:0},displayName:"Text color",info:"The infill color of the text.",name:"TextColor",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:5,y:5},displayName:"Padding",info:"Two values controlling the vertical and horizontal padding size. Higher values increase the size of the padding.",name:"Padding",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Padding color",info:"The background color of the padding section.",name:"BackgroundColor",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Padding Line Color",info:"The color of the border delimited by the padding.",name:"BackgroundStrokeColor",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Padding Line Width",info:"The width of the border of the padding section.",minValue:0,name:"BackgroundStrokeWidth",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:2,y:2},displayName:"Border",info:"Two values controlling the vertical and horizontal border size. Higher values increase the size of the border.",name:"BorderWidth",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Border Color",info:"The background color of the border section.",name:"BorderBackgroundColor",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Border Line Color",info:"The color of the outer border of the sprite.",name:"BorderStrokeColor",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Border Line Width",info:"The width of the outer border.",minValue:0,name:"BorderStrokeWidth",type:"Attribute"},{datatype:"Integer",defaultValue:2,displayName:"Outer Radius",info:"The outer radius of the sprite. Higher values increase the roundness.",minValue:0,name:"OuterRadius",type:"Attribute"},{datatype:"Integer",defaultValue:2,displayName:"Inner Radius",info:"The inner radius of the sprite. Higher values increase the roundness.",minValue:0,name:"InnerRadius",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"}],typeName:"Billboard"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Cone specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Radius",minValue:0,name:"Radius",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Height",minValue:0,name:"Height",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Radial segments",minValue:1,name:"RadialSegments",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Height segments",minValue:1,name:"HeightSegments",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Open ended",name:"OpenEnded",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Theta start",maxValue:360,minValue:0,name:"ThetaStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:360,displayName:"Theta length",maxValue:360,minValue:0,name:"ThetaLength",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Cone"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Lod specific fields",type:"Separator"},{datatype:"String",defaultValue:"0,2,4,6,8,10",displayName:"Distances",name:"Distances",type:"Attribute"}],typeName:"Lod"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Cylinder specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Radius top",minValue:0,name:"RadiusTop",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Radius bottom",minValue:0,name:"RadiusBottom",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Radial segments",minValue:1,name:"RadialSegments",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Height",minValue:0,name:"Height",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Height segments",minValue:1,name:"HeightSegments",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Open ended",name:"OpenEnded",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Theta start",maxValue:360,minValue:0,name:"ThetaStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:360,displayName:"Theta length",maxValue:360,minValue:0,name:"ThetaLength",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Cylinder"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Plane specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Width",minValue:0,name:"Width",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Height",minValue:0,name:"Height",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Width segments",minValue:1,name:"WidthSegments",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Height segments",minValue:1,name:"HeightSegments",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Plane"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Ring specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:.5,displayName:"Inner radius",minValue:0,name:"InnerRadius",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Outer radius",minValue:0,name:"OuterRadius",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Theta segments",minValue:3,name:"ThetaSegments",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Phi segments",minValue:1,name:"PhiSegments",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Theta start",maxValue:360,minValue:0,name:"ThetaStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:360,displayName:"Theta length",maxValue:360,minValue:0,name:"ThetaLength",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Ring"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Particles Editor Fields",type:"Separator"},{datatype:"Boolean",defaultValue:false,displayName:"Preview",info:"Previews the particle system by playing it in the editor.",name:"RunPreview",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Show Emitter Preview",info:"Shows a preview of the particle system's emitter.",name:"ShowHelper",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Pause",info:"Pauses the particle system.",name:"Pause",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Kill All Particles",info:"Kills all the alive particles in the system.",name:"KillAllParticles",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Restart",info:"Hard restart of the particle system. It kills all particles, clean all data and reset the simulation time.",name:"Restart",type:"Attribute"},{displayName:"Particle System",label:"Particle System Configuration File",linkableTypes:["Particles"],type:"Link",usageAs:"ParticleData",mandatory:true}],typeName:"ParticleSystem"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"CircleShadow specific fields",type:"Separator"},{datatype:"Float",defaultValue:1,displayName:"Size",minValue:0,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Strength",maxValue:1,minValue:0,name:"Strength",type:"Attribute",widget:"Slider"}],typeName:"CircleShadow"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Sphere specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Radius",minValue:0,name:"Radius",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Width segments",minValue:3,name:"WidthSegments",type:"Attribute"},{datatype:"Integer",defaultValue:6,displayName:"Height segments",minValue:2,name:"HeightSegments",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Phi start",maxValue:360,minValue:0,name:"PhiStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:360,displayName:"Phi length",maxValue:360,minValue:0,name:"PhiLength",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Theta start",maxValue:360,minValue:0,name:"ThetaStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:180,displayName:"Theta length",maxValue:180,minValue:0,name:"ThetaLength",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Sphere"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Text specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"String",defaultValue:"Text",name:"Text",type:"Attribute"},{datatype:"Enum",defaultValue:"center",displayName:"Horizontal Alignment",info:"Horizontal text positioning",name:"HorizontalAlign",options:["left","center","right"],type:"Attribute"},{datatype:"Enum",defaultValue:"baseline",displayName:"Vertical Alignment",info:"Vertical text positioning",name:"VerticalAlign",options:["baseline","top","middle","bottom"],type:"Attribute"},{linkableTypes:["Font"],type:"Link",usageAs:"Font"},{datatype:"Float",defaultValue:1,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:1,name:"Height",type:"Attribute"},{datatype:"Integer",defaultValue:12,displayName:"Curve segments",name:"CurveSegments",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Bevel enabled",name:"BevelEnabled",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Bevel thickness",name:"BevelThickness",type:"Attribute"},{datatype:"Float",defaultValue:.03,displayName:"Bevel size",name:"BevelSize",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Bevel offset",name:"BevelOffset",type:"Attribute"},{datatype:"Integer",defaultValue:3,displayName:"Bevel segments",name:"BevelSegments",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Text"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Torus specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Radius",minValue:0,name:"Radius",type:"Attribute"},{datatype:"Float",defaultValue:.4,displayName:"Tube",minValue:0,name:"Tube",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Radial segments",minValue:3,name:"RadialSegments",type:"Attribute"},{datatype:"Integer",defaultValue:16,displayName:"Tubular segments",minValue:2,name:"TubularSegments",type:"Attribute"},{datatype:"Float",defaultValue:360,displayName:"Arc",maxValue:360,minValue:0,name:"Arc",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Torus"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"Active",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Layers",defaultValue:[0],name:"Layers",type:"Attribute"},{datatype:"Tags",defaultValue:[],name:"Tags",type:"Attribute"},{label:"Sky specific fields",type:"Separator"},{datatype:"Float",defaultValue:1e3,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Turbidity",maxValue:20,minValue:1,name:"Turbidity",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:2,displayName:"Rayleigh",maxValue:4,minValue:0,name:"Rayleigh",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.005,displayName:"Mie coefficient",maxValue:1,minValue:0,name:"MieCoefficient",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.8,displayName:"Mie directional G",maxValue:1,minValue:0,name:"MieDirectionalG",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.49,displayName:"Inclination",maxValue:1,minValue:0,name:"Inclination",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.25,displayName:"Azimuth",maxValue:1,minValue:0,name:"Azimuth",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.02,displayName:"Cloud scale",maxValue:1,minValue:0,name:"CloudScale",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.01,displayName:"Cloud speed",maxValue:1,minValue:0,name:"CloudSpeed",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.4,displayName:"Cloud coverage",maxValue:1,minValue:0,name:"CloudCoverage",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.4,displayName:"Cloud density",maxValue:1,minValue:0,name:"CloudDensity",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.5,displayName:"Cloud elevation",maxValue:1,minValue:0,name:"CloudElevation",type:"Attribute",widget:"Slider"},{datatype:"Boolean",defaultValue:true,displayName:"Show sun disc",name:"ShowSunDisc",type:"Attribute",widget:"Slider"}],typeName:"Sky"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"Active",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},name:"Transform",type:"Attribute"},{datatype:"Tags",defaultValue:[],name:"Tags",type:"Attribute"},{label:"Audio listener specific fields",type:"Separator"},{datatype:"Float",defaultValue:1,name:"Gain",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Time delta",name:"TimeDelta",type:"Attribute"}],maxInstances:1,typeName:"AudioListener"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"Active",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},name:"Transform",type:"Attribute"},{datatype:"Tags",defaultValue:[],name:"Tags",type:"Attribute"},{label:"Positional audio specific fields",type:"Separator"},{name:"AudioLink",type:"FieldSet"},{datatype:"Boolean",defaultValue:false,displayName:"Autoplay",name:"Autoplay",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Loop",name:"Loop",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Loop section",name:"LoopSection",type:"Attribute",if:{Loop:true}},{datatype:"Float",defaultValue:0,displayName:"Loop start",minValue:0,name:"LoopStart",type:"Attribute",widget:"Slider",if:{Loop:true,LoopSection:true}},{datatype:"Float",displayName:"Loop end",defaultValue:1,minValue:0,name:"LoopEnd",type:"Attribute",widget:"Slider",if:{Loop:true,LoopSection:true}},{datatype:"Float",defaultValue:1,displayName:"Volume",minValue:0,name:"Volume",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Panning",maxValue:1,minValue:-1,name:"Panning",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Duration",minValue:0,name:"Duration",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Detune",name:"Detune",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Playback rate",minValue:0,name:"PlaybackRate",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Offset",maxValue:1,minValue:0,name:"Offset",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Ref distance",minValue:0,name:"RefDistance",type:"Attribute"},{datatype:"Float",defaultValue:1e4,displayName:"Max distance",minValue:0,name:"MaxDistance",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Rolloff factor",minValue:0,name:"RolloffFactor",type:"Attribute"},{datatype:"Enum",defaultValue:"Inverse",displayName:"Distance model",name:"DistanceModel",options:["Linear","Inverse","Exponential"],type:"Attribute"},{datatype:"Enum",defaultValue:"Omnidirectional",displayName:"Direction",name:"Direction",options:["Omnidirectional","Directional"],type:"Attribute"},{datatype:"Float",defaultValue:90,displayName:"Cone inner angle",if:{Direction:"Directional"},maxValue:360,minValue:0,name:"ConeInnerAngle",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:180,displayName:"Cone outer angle",if:{Direction:"Directional"},maxValue:360,minValue:0,name:"ConeOuterAngle",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.2,displayName:"Cone outer gain",if:{Direction:"Directional"},maxValue:1,minValue:0,name:"ConeOuterGain",type:"Attribute",widget:"Slider"}],typeName:"PositionalAudio"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"Active",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Tags",defaultValue:[],name:"Tags",type:"Attribute"},{label:"Audio specific fields",type:"Separator"},{name:"AudioLink",type:"FieldSet"},{datatype:"Boolean",defaultValue:false,displayName:"Autoplay",name:"Autoplay",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Loop",name:"Loop",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Loop section",name:"LoopSection",type:"Attribute",if:{Loop:true}},{datatype:"Float",defaultValue:0,displayName:"Loop start",minValue:0,name:"LoopStart",type:"Attribute",widget:"Slider",if:{Loop:true,LoopSection:true}},{datatype:"Float",displayName:"Loop end",defaultValue:1,minValue:0,name:"LoopEnd",type:"Attribute",widget:"Slider",if:{Loop:true,LoopSection:true}},{datatype:"Float",defaultValue:1,displayName:"Volume",minValue:0,name:"Volume",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Panning",maxValue:1,minValue:-1,name:"Panning",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Duration",minValue:0,name:"Duration",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Detune",name:"Detune",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Playback rate",minValue:0,name:"PlaybackRate",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Offset",maxValue:1,minValue:0,name:"Offset",type:"Attribute"}],typeName:"Audio"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Vehicle specific fields",type:"Separator"},{datatype:"Node",defaultValue:null,displayName:"Chassis node",name:"ChassisNode",type:"Attribute"},{elementName:"Wheel",fields:[{datatype:"Node",defaultValue:null,displayName:"Wheel node",name:"WheelNode",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Is Front",name:"IsFront",type:"Attribute"},{label:"Wheel config",type:"Separator",collapsed:true},{datatype:"Float",defaultValue:.6,displayName:"Suspension rest length",name:"SuspensionRestLength",type:"Attribute"},{datatype:"Float",defaultValue:20,displayName:"Suspension stiffness",name:"SuspensionStiffness",type:"Attribute"},{datatype:"Float",defaultValue:2.3,displayName:"Suspension damping",name:"SuspensionDamping",type:"Attribute"},{datatype:"Float",defaultValue:4.4,displayName:"Suspension compression",name:"SuspensionCompression",type:"Attribute"},{datatype:"Float",defaultValue:1e3,displayName:"Friction",name:"Friction",type:"Attribute"},{datatype:"Float",defaultValue:.2,displayName:"Roll influence",name:"RollInfluence",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Radius",name:"Radius",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Acceleration",name:"Acceleration",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Brakes",name:"Brakes",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Steering",name:"Steering",type:"Attribute"}],name:"Wheels",type:"List"}],typeName:"Vehicle"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Constraint specific fields",type:"Separator"},{datatype:"Enum",defaultValue:"",displayName:"Type",name:"Type",options:["Point to Point","Hinge","Slider","Cone twist"],type:"Attribute"},{datatype:"Node",defaultValue:null,displayName:"First node",name:"FirstNode",type:"Attribute"},{datatype:"Node",defaultValue:null,displayName:"Second node",name:"SecondNode",type:"Attribute"}],typeName:"Constraint"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"NavMesh specific fields",type:"Separator"},{datatype:"Enum",defaultValue:"Solo",displayName:"Type",name:"Type",options:["Solo","Tiled","Tile cache"],info:"For simple static scenes, use solo. For large maps use tiled, for large and/or dynamic maps, use tile cache",type:"Attribute"},{datatype:"Enum",defaultValue:"From children",displayName:"Mode",name:"Mode",options:["From children","From tags","From layers"],type:"Attribute"},{datatype:"Layers",defaultValue:[0],displayName:"Navmesh layers",info:"Selects which layers are added to the navmesh",name:"NavmeshLayers",type:"Attribute",if:{Mode:"From layers"}},{datatype:"Tags",defaultValue:[],info:"Selects meshes to add to the navmesh based on tag.",displayName:"Navmesh tags",name:"NavmeshTags",type:"Attribute",if:{Mode:"From tags"}},{datatype:"Boolean",defaultValue:false,displayName:"Auto generate",name:"AutoGenerate",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Always render helper",name:"AlwaysRenderHelper",type:"Attribute"},{datatype:"Button",defaultValue:false,displayName:"Regenerate now",name:"RegenerateNow",type:"Attribute"},{datatype:"Float",defaultValue:0,minValue:0,displayName:"Border size",name:"BorderSize",type:"Attribute"},{datatype:"Float",defaultValue:.2,minValue:.01,displayName:"Voxel cell height",name:"CellHeight",type:"Attribute",info:"Needs to resolve step/climb height cleanly."},{datatype:"Float",defaultValue:.2,minValue:.01,displayName:"Voxel cell size",name:"CellSize",type:"Attribute",info:"Smaller = more detail. Around 0.2m for human‑scale"},{datatype:"Integer",defaultValue:256,minValue:1,displayName:"Chunky tri mesh tris per chunk",name:"ChunkyTriMeshTrisPerChunk",type:"Attribute",if:{Type:"Tiled"}},{datatype:"Float",defaultValue:6,minValue:.01,displayName:"Detail sample dist",name:"DetailSampleDist",type:"Attribute"},{datatype:"Float",defaultValue:1,minValue:0,displayName:"Detail sample max error",name:"DetailSampleMaxError",type:"Attribute"},{datatype:"Integer",defaultValue:4,minValue:1,displayName:"Expected layers per tile",name:"ExpectedLayersPerTile",type:"Attribute",if:{Type:"Tile Cache"}},{datatype:"Integer",defaultValue:128,minValue:1,displayName:"Max obstacles",name:"MaxObstacles",type:"Attribute",if:{Type:"Tile Cache"}},{datatype:"Float",defaultValue:12,minValue:.01,displayName:"Max edge length",name:"MaxEdgeLen",type:"Attribute"},{datatype:"Float",defaultValue:1.3,minValue:0,displayName:"Max simplification error",name:"MaxSimplificationError",type:"Attribute",info:"Allowed contour deviation from source before another vertex is kept"},{datatype:"Integer",defaultValue:6,minValue:3,displayName:"Max vertices per poly",name:"MaxVertsPerPoly",type:"Attribute"},{datatype:"Float",defaultValue:20,minValue:.01,displayName:"Merge region area",name:"MergeRegionArea",type:"Attribute"},{datatype:"Float",defaultValue:8,minValue:.01,displayName:"Min region area",name:"MinRegionArea",type:"Attribute"},{datatype:"Float",defaultValue:2,minValue:0,displayName:"Walkable climb",name:"WalkableClimb",type:"Attribute",info:"Maximum step height"},{datatype:"Float",defaultValue:2,minValue:0,displayName:"Walkable height",name:"WalkableHeight",type:"Attribute",info:"Required head‑clearance. Must be at least the height of the characters."},{datatype:"Float",defaultValue:.5,minValue:.01,displayName:"Walkable radius",name:"WalkableRadius",type:"Attribute",info:"Clearance from walls/obstacles"},{datatype:"Float",defaultValue:60,minValue:0,maxValue:360,displayName:"Walkable slope angle",name:"WalkableSlopeAngle",type:"Attribute",info:"Steepest walkable slope"},{datatype:"Boolean",defaultValue:true,displayName:"Build BV Tree",name:"BuildBvTree",info:"",type:"Attribute",if:{$or:[{Type:"Solo"},{Type:"Tiled"}]}},{datatype:"Integer",defaultValue:32,minValue:1,displayName:"Tile size",name:"TileSize",type:"Attribute",info:"The size of the tiles to be used. Typically you will want to stay in the range 32 - 64. Sizes outside this range might result in unexpected behaviour",if:{$or:[{Type:"Tiled"},{Type:"Tile cache"}]}},{label:"Crowd fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Enable crowd",name:"EnableCrowd",type:"Attribute"},{datatype:"Integer",defaultValue:100,minValue:1,displayName:"Max agent count",name:"MaxAgentCount",type:"Attribute"},{datatype:"Float",defaultValue:1,minValue:.01,displayName:"Max agent radius",name:"MaxAgentRadius",type:"Attribute"}],typeName:"NavMesh"}],name:"Scenegraph",type:"Tree"}],name:"Prefab",updateRequiresThumbRefresh:true},{_id:{$oid:"5e6a1ad189707feef9173397"},contentTypes:["text/x-lua"],fieldSets:[],fields:[],name:"Script",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ad189707f2ef9133396"},contentTypes:[],fieldSets:[],fields:[{childTypes:[{displayName:"Camera",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Tag",info:"Tag of the camera to render",name:"Tag",type:"Attribute"},{datatype:"Layers",defaultValue:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],displayName:"Layers",info:"Selects which layers are rendered by the camera. Overrides scene Camera node 'Cull mode' field.",name:"Layers",type:"Attribute"},{datatype:"Enum",defaultValue:"4x",displayName:"Multisampling",name:"Multisampling",options:["None","2x","4x","8x","16x"],info:"Multisampling will reduce aliasing artifacts, but will also decrease performance. 4x is recommended.",type:"Attribute"},{datatype:"Float",defaultValue:100,displayName:"Width",info:"Width in percent of the actual screen width to render.",name:"Width",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:100,displayName:"Height",info:"Height in percent of the actual screen height to render.",name:"Height",type:"Attribute",widget:"Slider"}],inputs:[],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"},{displayName:"Depth output",name:"DepthOutput",type:"GrayImage"},{displayName:"Depth Comparison output",name:"DepthComparisonOutput",type:"GrayImage"},{displayName:"Normal output",name:"NormalOutput",type:"RGBImage"},{displayName:"Camera Output",name:"CameraOutput",type:"Attribute"}],typeName:"camera"},{displayName:"Merge",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Enum",defaultValue:"Alpha",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",info:"Adjusts how strongly the blending mode affects the final result.",maxValue:1,minValue:0,name:"Opacity",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Offset X",info:"Horizontal offset for the secondary input (relative to composition resolution). Positive values move right, negative left. Percentage-based for resolution independence.",maxValue:100,minValue:-100,name:"OffsetX",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Offset Y",info:"Vertical offset for the secondary input (relative to composition resolution). Positive values move up, negative down. Percentage-based for resolution independence.",maxValue:100,minValue:-100,name:"OffsetY",type:"Attribute"},{datatype:"Float",defaultValue:100,displayName:"Width",info:"Horizontal scale of the secondary input as percentage of composition width. 100% maintains original aspect ratio when Height is also 100%. Values <100% shrink, >100% stretch.",maxValue:100,minValue:0,name:"Width",type:"Attribute"},{datatype:"Float",defaultValue:100,displayName:"Height",info:"Vertical scale of the secondary input as percentage of composition height. 100% maintains original aspect ratio when Width is also 100%. Values <100% shrink, >100% stretch.",maxValue:100,minValue:0,name:"Height",type:"Attribute"}],inputs:[{displayName:"Color input 1",name:"ColorInput1",types:["RGBImage"]},{displayName:"Color input 2",name:"ColorInput2",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"merge"},{displayName:"SSAO",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:.2,displayName:"Radius",minValue:.01,name:"Radius",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Samples",maxValue:32,minValue:8,name:"Samples",type:"Attribute"},{datatype:"Float",defaultValue:.001,displayName:"Bias",minValue:.001,name:"Bias",type:"Attribute"},{datatype:"Float",defaultValue:2,displayName:"Intensity",minValue:0,name:"Intensity",type:"Attribute"},{datatype:"Float",defaultValue:.07,displayName:"Max distance",minValue:.01,name:"MaxDistance",type:"Attribute"}],inputs:[{displayName:"Depth input",name:"DepthInput",types:["GrayImage"]},{displayName:"Normal input",name:"NormalInput",types:["RGBImage"]},{displayName:"Camera Input",name:"CameraInput",types:["Attribute"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"ssao"},{displayName:"FXAA",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"fxaa"},{displayName:"Bloom",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1.5,displayName:"Strength",maxValue:10,minValue:0,name:"Strength",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.4,displayName:"Radius",maxValue:1,minValue:0,name:"Radius",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.8,displayName:"Threshold",info:"Minimum luminance required for a pixel to contribute to bloom. Pixels darker than this value are suppressed, while brighter pixels contribute to the blur.",maxValue:1,minValue:0,name:"Threshold",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.4,displayName:"Soft Knee",info:"Creates a smooth transition around the threshold to avoid harsh cutoffs. Higher values produce a more gradual blend between non-blooming and blooming pixels.",maxValue:1,minValue:0,name:"SoftKnee",type:"Attribute",widget:"Slider"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"bloom"},{displayName:"Outline",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Edge Strength",maxValue:5,minValue:0,name:"EdgeStrength",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.5,displayName:"Edge Width",maxValue:2,minValue:.1,name:"EdgeWidth",type:"Attribute",widget:"Slider"},{datatype:"Color",defaultValue:{r:255,g:0,b:0,a:255},displayName:"Edge Color",name:"EdgeColor",type:"Attribute"},{datatype:"Enum",defaultValue:"Add",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.25,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Depth Comparison input",name:"DepthComparisonInput",types:["GrayImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"outline"},{displayName:"Film",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:.05,displayName:"Noise intensity",maxValue:1,minValue:0,name:"NoiseIntensity",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Scanlines intensity",maxValue:1,minValue:0,name:"ScanlinesIntensity",type:"Attribute",widget:"Slider"},{datatype:"Integer",defaultValue:0,displayName:"Scanlines count",maxValue:1e3,minValue:0,name:"ScanlinesCount",type:"Attribute",widget:"Slider"},{datatype:"Boolean",defaultValue:false,displayName:"Grayscale",name:"Grayscale",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Animated",name:"Animated",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"film"},{displayName:"Fog",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Color",defaultValue:{r:255,g:0,b:0,a:255},displayName:"Color",name:"Color",type:"Attribute"},{datatype:"Enum",defaultValue:"Camera Depth",displayName:"Direction",name:"Direction",type:"Attribute",options:["Camera Depth","X","Y","Z"],info:"Defines the ray along which the fog is evaluated. 'Camera Depth' applies fog based on distance from the camera view direction (distances should be non-negative). 'X', 'Y', and 'Z' apply fog along the corresponding world-space axis; distances may be positive or negative depending on where the fog volume should begin and end."},{datatype:"Enum",defaultValue:"Linear",displayName:"Type",name:"Type",type:"Attribute",options:["Linear","Exponential","Exponential Squared"]},{datatype:"Float",defaultValue:1,displayName:"Start Distance",name:"StartDistance",type:"Attribute",info:"Distance along the selected fog ray where the fog begins to accumulate. Must be >= 0 when using Camera Depth."},{datatype:"Float",defaultValue:1e3,displayName:"End Distance",name:"EndDistance",type:"Attribute",info:"Distance along the selected fog ray where the fog reaches maximum density. Must be >= 0 when using Camera Depth."},{datatype:"Float",defaultValue:.0025,displayName:"Density",minValue:1e-5,maxValue:1,name:"Density",type:"Attribute",step:.1,if:{$or:[{FogType:"Exponential"},{FogType:"Exponential Squared"}]}},{datatype:"Boolean",defaultValue:true,displayName:"Enable Noise",name:"EnableNoise",info:"Adds animated noise to the fog to create more natural variation.",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Noise Scale",minValue:.001,name:"NoiseScale",type:"Attribute",step:1,if:{EnableFogNoise:true}},{datatype:"Float",defaultValue:.1,displayName:"Noise Speed",maxValue:1,minValue:0,name:"NoiseSpeed",type:"Attribute",step:.1,if:{EnableFogNoise:true}},{datatype:"Float",defaultValue:.5,displayName:"Noise Amount",maxValue:1,minValue:0,name:"NoiseAmount",type:"Attribute",step:.1,if:{EnableFogNoise:true}},{datatype:"Float",defaultValue:0,maxValue:1,displayName:"Sky Density",info:"Controls the amount of fog applied to the sky.",name:"SkyDensity",type:"Attribute",step:.1}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Depth input",name:"DepthInput",types:["DepthBuffer"]},{displayName:"Camera input",name:"CameraInput",types:["Camera"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"fog"},{displayName:"Sepia",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Enum",defaultValue:"Normal",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"sepia"},{displayName:"Vignette",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Enum",defaultValue:"Normal",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.9,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"},{datatype:"Float",defaultValue:.4,displayName:"Amount",maxValue:1,minValue:0,name:"Amount",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"vignette"},{displayName:"Blur",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Amount",maxValue:10,minValue:0,name:"Amount",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"blur"},{displayName:"Scanline",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Density",maxValue:1,minValue:0,name:"Density",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.01,displayName:"Scroll Speed",maxValue:1,minValue:0,name:"ScrollSpeed",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Overlay",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.25,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"scanline"},{displayName:"Shockwave",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Continuous",info:"Whether or not new shockwaves will emit as soon as the previous shockwave ended.",name:"Continuous",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Delay",minValue:0,name:"Delay",info:"How long to wait between shockwave emissions.",type:"Attribute",if:{Continuous:false}},{datatype:"Integer",defaultValue:5,displayName:"Amount",minValue:0,name:"Amount",info:"The number of shockwaves.",type:"Attribute",if:{Continuous:false}},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Center",info:"The center in world coordinates of the shockwave effect.",name:"Center",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Size",maxValue:100,minValue:.001,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:2,displayName:"Speed",maxValue:100,minValue:.001,name:"Speed",type:"Attribute"},{datatype:"Float",defaultValue:-0.2,displayName:"Radius",maxValue:10,minValue:-10,name:"Radius",type:"Attribute"},{datatype:"Float",defaultValue:.2,displayName:"Maximum Radius",maxValue:10,minValue:0,name:"MaxRadius",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Wave Size",maxValue:100,minValue:1,name:"WaveSize",type:"Attribute"},{datatype:"Float",defaultValue:.05,displayName:"Amplitude",maxValue:10,minValue:0,name:"Amplitude",type:"Attribute"},{datatype:"Enum",defaultValue:"Screen",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.75,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable Debug",name:"Debug",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Camera Input",name:"CameraInput",types:["Attribute"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"shockwave"},{displayName:"Pixelation",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Granularity",maxValue:100,minValue:1,name:"Granularity",type:"Attribute",widget:"Slider"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"pixelation"},{displayName:"Adjust",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Brightness",maxValue:10,minValue:-10,name:"Brightness",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Contrast",maxValue:10,minValue:-10,name:"Contrast",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Hue",maxValue:6.283,minValue:0,name:"Hue",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Saturation",maxValue:1,minValue:-1,name:"Saturation",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"adjust"},{displayName:"Chromatic abberation",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Amount",maxValue:10,minValue:0,name:"Amount",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Red factor",maxValue:1,minValue:0,name:"RedFactor",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Green factor",maxValue:1,minValue:0,name:"GreenFactor",type:"Attribute"},{datatype:"Float",defaultValue:.25,displayName:"Blue factor",maxValue:1,minValue:0,name:"BlueFactor",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"chromaticAbberation"},{displayName:"Color Depth",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Integer",defaultValue:16,displayName:"Bit Depth",maxValue:32,minValue:1,name:"bitDepth",type:"Attribute"},{datatype:"Enum",defaultValue:"Normal",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",info:"Controls blending. Only valid for additive and subtractive modes",maxValue:1,minValue:0,name:"Opacity",type:"Attribute",widget:"Slider"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"colorDepth"},{displayName:"Depth Of Field",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Focus Target",name:"FocusTarget",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"World Focus Distance",minValue:0,name:"WorldFocusDistance",type:"Attribute"},{datatype:"Float",defaultValue:5,displayName:"World Focus Range",minValue:0,name:"WorldFocusRange",type:"Attribute"},{datatype:"Integer",defaultValue:4,displayName:"Kawase Blur Kernel Size",maxValue:10,minValue:0,name:"Kernel",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Bokeh Scale",maxValue:25,minValue:0,name:"BokehScale",type:"Attribute"},{datatype:"Float",defaultValue:.75,displayName:"Resolution Scale",maxValue:1,minValue:0,name:"ResolutionScale",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable Debug",name:"Debug",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Depth input",name:"DepthInput",types:["GrayImage"]},{displayName:"Camera Input",name:"CameraInput",types:["Attribute"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"depthoffield"},{displayName:"Glitch",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:.3,y:1},displayName:"Strength",info:"Two values controlling the maximum and minimum strength of the glitch effect.",name:"Strength",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Columns",maxValue:1,minValue:0,name:"Columns",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:0,y:2.5},displayName:"Delay",info:"Two values controlling the duration of the delay of the glitch effect.",name:"Delay",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:0,y:3},displayName:"Duration",info:"Two values controlling the duration of the glitch effect.",name:"Duration",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"glitch"},{displayName:"God Rays",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"String",defaultValue:"",type:"Attribute",displayName:"Light Source",name:"SunTag"},{datatype:"Float",defaultValue:1,displayName:"Size",minValue:.01,maxValue:10,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Density",minValue:.01,maxValue:1,name:"Density",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Decay",minValue:.01,maxValue:1,name:"Decay",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Weight",minValue:.01,maxValue:1,name:"Weight",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Exposure",minValue:.01,maxValue:1,name:"Exposure",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"MaximumIntensity",minValue:.01,maxValue:1,name:"MaximumIntensity",type:"Attribute"},{datatype:"Integer",defaultValue:60,displayName:"Samples",minValue:0,name:"Samples",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Blur Rays",name:"BlurRays",type:"Attribute"},{datatype:"Integer",defaultValue:2,displayName:"Kernel Size",info:"The number of kernel applied on the God Rays. A higher number yields to a better blur effect at higher computational cost",maxValue:10,minValue:0,name:"Kernel",if:{BlurRays:true},type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Resolution Scale",info:"A higher resolution yields a more realistic result at higher computational cost",maxValue:1,minValue:0,name:"ResolutionScale",type:"Attribute"},{datatype:"Enum",defaultValue:"Screen",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.25,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable Debug",name:"Debug",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Depth input",name:"DepthInput",types:["GrayImage"]},{displayName:"Camera Input",name:"CameraInput",types:["Attribute"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"godrays"},{displayName:"Kawase Blur",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Integer",defaultValue:2,displayName:"Kernel Size",info:"The number of kernel applied on the effect. A higher number yields to a better blur effect at higher computational cost",maxValue:10,minValue:0,name:"Kernel",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Scale",info:"The strenth of the blur effect.",maxValue:1,minValue:0,name:"Scale",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"kawaseblur"},{displayName:"Radial blur",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Amount",maxValue:10,minValue:0,name:"Amount",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:.5,y:.5},displayName:"Center",name:"Center",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"radialBlur"},{displayName:"Tone Mapping",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Enum",defaultValue:"LINEAR",displayName:"Mode",name:"TonemappingMode",options:["LINEAR","REINHARD","REINHARD2","REINHARD2_ADAPTIVE","UNCHARTED2","ACES_FILMIC","AGX","NEUTRAL"],type:"Attribute"},{datatype:"Integer",defaultValue:256,displayName:"Luminance Map Width. Must be a power of 2.",minValue:1,name:"LuminanceMapWidth",type:"Attribute",if:{TonemappingMode:"REINHARD2_ADAPTIVE"}},{datatype:"Integer",defaultValue:256,displayName:"Luminance Map Height. Must be a power of 2.",if:{TonemappingMode:"REINHARD2_ADAPTIVE"},minValue:1,name:"LuminanceMapHeight",type:"Attribute"},{datatype:"Float",defaultValue:4,displayName:"Maximum Luminance",minValue:0,maxValue:20,name:"MaxLuminance",type:"Attribute"},{datatype:"Float",defaultValue:.01,displayName:"Minimum Luminance",minValue:0,maxValue:3,name:"MinLuminance",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Average Luminance",minValue:0,maxValue:1,name:"MeanLuminance",type:"Attribute"},{datatype:"Float",defaultValue:.6,displayName:"Middle Grey",maxValue:1,minValue:0,name:"MiddleGrey",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Adaptation Rate",minValue:0,name:"AdaptationRate",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"tonemapping"},{displayName:"Output",fields:[{datatype:"String",defaultValue:"Output",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Integer",defaultValue:256,displayName:"Target width",minValue:1,name:"DesiredWidth",type:"Attribute",info:"This is the width of the render target in case the composition is used in a material albedo slot."},{datatype:"Integer",defaultValue:256,displayName:"Target height",minValue:1,name:"DesiredHeight",type:"Attribute",info:"This is the height of the render target in case the composition is used in a material albedo slot."}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[],typeName:"output"}],name:"NodeGraph",type:"NodeGraph"}],name:"Composition",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ad189707f2ef9147396"},contentTypes:[],fieldSets:[],fields:[],name:"Behavior",updateRequiresThumbRefresh:false,creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173398"},contentTypes:["text/x-glsl"],fieldSets:[],fields:[{datatype:"Enum",defaultValue:1,displayName:"GLSL Version",name:"GLSLVersion",options:[1,3],type:"Attribute"},{datatype:"Enum",defaultValue:"Full",displayName:"Resolution",name:"Resolution",options:["Full","Half","Quarter"],type:"Attribute"},{displayName:"Texture Channel 1",linkableTypes:["Image"],type:"Link",usageAs:"TexChannel1"},{displayName:"Texture Channel 2",linkableTypes:["Image"],type:"Link",usageAs:"TexChannel2"},{displayName:"Texture Channel 3",linkableTypes:["Image"],type:"Link",usageAs:"TexChannel3"},{displayName:"Texture Channel 4",linkableTypes:["Image"],type:"Link",usageAs:"TexChannel4"}],name:"Background Shader",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ad189707feef9173399"},contentTypes:["video/mp4","video/webm"],fieldSets:[],fields:[{datatype:"Enum",defaultValue:"Linear",displayName:"Encoding",name:"Encoding",options:["Linear","sRGB"],type:"Attribute"}],name:"Video",creatableEmpty:false},{_id:{$oid:"5e8c9d5c02a37596bb1fd5b6"},contentTypes:[""],fieldSets:[],fields:[{elementName:"Item",fields:[{datatype:"String",defaultValue:"",displayName:"Description",name:"Description",type:"Attribute"},{type:"Link",usageAs:"Item",mandatory:true}],name:"Items",type:"List"}],name:"Collection",creatableEmpty:true},{_id:{$oid:"5e8c9d5c02a33596bb53d5b6"},contentTypes:[""],fieldSets:[],fields:[{displayName:"Audio items",elementName:"AudioItem",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{linkableTypes:["Audio"],type:"Link",usageAs:"Audio",mandatory:true}],name:"AudioItems",type:"List"}],name:"Audio Collection",creatableEmpty:true},{_id:{$oid:"5e8c9d5c01a32576bb53d5b6"},contentTypes:[""],fieldSets:[],fields:[{displayName:"Mesh items",elementName:"MeshItem",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{linkableTypes:["Mesh"],type:"Link",usageAs:"Mesh",mandatory:true}],name:"MeshItems",type:"List"}],name:"Mesh Collection",creatableEmpty:true},{_id:{$oid:"5e8c9d5c0233596cb31d5ba2"},contentTypes:[""],fieldSets:[],fields:[{displayName:"Material items",elementName:"MaterialItem",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{linkableTypes:["Material"],type:"Link",usageAs:"Material",mandatory:true}],name:"MaterialItems",type:"List"}],name:"Material Collection",creatableEmpty:true},{_id:{$oid:"5edf2f6edc25bdf4e5723e52"},contentTypes:["text/x-yaml"],fieldSets:[],fields:[{displayName:"Material collections",elementName:"Material Collection",fields:[{linkableTypes:["Material Collection"],type:"Link",usageAs:"MaterialCollection",displayName:"Material Collection",mandatory:true}],name:"MaterialCollections",type:"List"},{displayName:"Mesh collections",elementName:"Mesh Collection",fields:[{linkableTypes:["Mesh Collection"],type:"Link",usageAs:"MeshCollection",displayName:"Mesh Collection",mandatory:true}],name:"MeshCollections",type:"List"}],name:"GridMap",creatableEmpty:true},{_id:{$oid:"60827c20d3f7a631e71522cc"},contentTypes:[],fieldSets:[],fields:[],name:"Dataset",creatableEmpty:false},{_id:{$oid:"62133ff41302cfcd0d9a2346"},contentTypes:["text/x-glsl"],fieldSets:[],fields:[],name:"Pixel Shader",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"62133ffb1302cf53ef9a234e"},contentTypes:["text/x-glsl"],fieldSets:[],fields:[],name:"Vertex Shader",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"62a83a1ef46738fe096fd7e3"},contentTypes:["application/zip"],fieldSets:[],fields:[],name:"Archive",updateRequiresThumbRefresh:false,creatableEmpty:false},{_id:{$oid:"640076f0e49250ab06ea4aec"},contentTypes:["font/ttf","font/otf"],fieldSets:[],fields:[],name:"Font",updateRequiresThumbRefresh:true,creatableEmpty:false},{_id:{$oid:"6463df676055450cac673d90"},contentTypes:[],fieldSets:[],fields:[{label:"General Settings",type:"Separator"},{datatype:"Integer",defaultValue:1e3,displayName:"Maximum Number of Particles",info:"The maximum number of particles that can exist at the same time in the simulation.",minValue:0,name:"MaxParticles",type:"Attribute"},{datatype:"Float",defaultValue:-1,displayName:"Duration",info:"Duration (in seconds) the particle system runs. Use -1 for infinite duration.",minValue:-1,name:"Duration",type:"Attribute"},{datatype:"Enum",defaultValue:"Local",displayName:"Coordinate System",info:"Defines whether particle movement is relative to the emitter's local space or the global world space.",name:"SystemCoordinates",options:["Local","World"],type:"Attribute"},{label:"Emission Settings",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Emit All At Once",info:"Emit all particles immediately when the simulation starts.",name:"EmitAllAtOnce",type:"Attribute"},{datatype:"Float",defaultValue:128,minValue:0,displayName:"Spawn amount",if:{EmitAllAtOnce:false},info:"The number of particles emitted each time the emitter spawns.",name:"SpawnAmount",type:"Attribute"},{datatype:"Float",defaultValue:1,minValue:0,displayName:"Spawn Interval",info:"The time, in seconds, between each consecutive spawn of particles.",if:{EmitAllAtOnce:false},name:"SpawnRate",type:"Attribute"},{datatype:"Float",defaultValue:-1,minValue:-1,displayName:"Number of Emissions",info:"Total number of spawn events before emission stops; after this number of emissions, no more particles will be emitted.",if:{EmitAllAtOnce:false},name:"MaximumEmissions",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Continuous emission",info:"If enabled, particles in each emission spawn gradually over time instead of instantly.",if:{EmitAllAtOnce:false},name:"ContinuousEmissionFlag",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Auto Respawn",info:"Automatically respawn particles when they die.",name:"Respawn",type:"Attribute",if:{EmitAllAtOnce:true}},{label:"Size Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Constant",options:["Constant","Variable","Velocity"],displayName:"Scaling Mode",info:"Determines how particle size changes over their lifetime: constant size, variable scaling, or based on velocity.",name:"ScaleMode",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Base Size",info:"The size of the particles at emission",minValue:0,name:"ParticleInitialSize",type:"Attribute"},{datatype:"Float",defaultValue:15,displayName:"Final Size",info:"The size particles reach at the end of their lifetime. If particles die early, they may not reach their final size.",minValue:0,name:"ParticleFinalSize",type:"Attribute",if:{ScaleMode:"Variable"}},{datatype:"Float",displayName:"Scale Randomness",name:"ScaleRandomness",defaultValue:.1,minValue:0,maxValue:1,info:"Random variation applied to scale curve values."},{datatype:"Enum",defaultValue:"Linear",options:["Linear","Exponential","Inverse Exponential","Ease-in, Ease-out"],displayName:"Interpolation Function",info:"Interpolation method for scaling particles over their lifetime.",type:"Attribute",name:"ScaleFunction",if:{ScaleMode:"Variable"}},{datatype:"Float",defaultValue:.5,minValue:0,maxValue:5,if:{ScaleMode:"Variable",$or:[{ScaleFunction:"Exponential"},{ScaleFunction:"Inverse Exponential"},{ScaleFunction:"Ease-in, Ease-out"}]},displayName:"Interpolation Rate",name:"ApproachSize",info:"Controls the rate at which particles scale over time based on the interpolation modes.",type:"Attribute"},{label:"Velocity Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Constant",options:["Constant","Variable"],displayName:"Velocity Mode",info:"Determines if particles maintain a constant velocity or change velocity over their lifetime.",name:"VelocityMode",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Initial Velocity",info:"The starting velocity of particles when emitted.",name:"InitialVelocity",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Final Velocity",info:"The velocity particles will reach by the end of their lifetime. Used only when Velocity Mode is set to Variable.",name:"FinalVelocity",type:"Attribute",if:{VelocityMode:"Variable"}},{datatype:"Enum",defaultValue:"Linear",options:["Linear","Exponential","Inverse Exponential","Ease-in, Ease-out"],displayName:"Interpolation Function",info:"Defines the interpolation method for velocity changes over the particle’s lifetime.",name:"VelocityFunction",type:"Attribute",if:{VelocityMode:"Variable"}},{datatype:"Float",defaultValue:.5,displayName:"Interpolation Rate",info:"Controls the rate at which particles transition from initial to final velocity for the interpolation modes.",maxValue:5,minValue:0,name:"FinalVelocityApproach",type:"Attribute",if:{VelocityMode:"Variable",$or:[{VelocityFunction:"Exponential"},{VelocityFunction:"Inverse Exponential"},{VelocityFunction:"Ease-in, Ease-out"}]}},{datatype:"Float",defaultValue:0,displayName:"Spread",info:"Randomly offsets the emission angle (in degrees) from the base direction. A value of 360° emits particles uniformly in all directions. Requires Initial Velocity not be a 0-vector to have any effect.",maxValue:360,minValue:0,name:"Spread",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Angular Velocity",info:"The speed at which particles rotate around their center of mass, in radians per second.",minValue:0,name:"AngularVelocity",type:"Attribute",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]}},{datatype:"Enum",defaultValue:"Clockwise",options:["Clockwise","Anticlockwise"],displayName:"Rotation Direction",info:"Controls the rotation direction of particles.",name:"AngularDirection",type:"Attribute",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]}},{datatype:"Float",defaultValue:0,displayName:"Rotation Randomness",info:"Random variation applied to particle angular velocity. 0 = all particles rotate at the same speed, 1 = each particle can vary ±100% of base angular velocity.",minValue:0,maxValue:1,name:"RotationRandomness",type:"Attribute",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]}},{label:"Force Settings",type:"Separator",collapsed:true},{datatype:"Float",defaultValue:0,displayName:"Drift",info:"A random velocity added to particles in all directions to simulate drifting motion.",name:"Drift",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Gravity",info:"A constant acceleration applied to particles after emission, simulating gravity. Positive values pull particles downward; negative values pull them upward.",name:"Gravity",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Tangential Velocity",info:"Applies a tangential velocity to particles, causing them to orbit the center point along the defined orbital plane.",name:"OrbitalVelocity",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Orbit Center",info:"The point in 3D space around which particles orbit.",name:"OrbitalCenterPoint",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:1,z:0},displayName:"Orbital Plane",info:"A vector normal that defines the orientation of the orbital plane. Particles orbit around an axis perpendicular to this vector. Should be normalized (length = 1), but normalization is not enforced.",name:"OrbitalPlane",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Orbital Decay",info:"Causes particles to gradually spiral inward toward the orbital center over time.",name:"OrbitalDecay",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Target",info:"A 3D point in space that particles are attracted to.",name:"Target",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Target Force",info:"The strength of the attraction force pulling particles toward the target. Set to 0 to disable.",name:"TargetForce",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Kill on target",info:"If enabled, particles are deleted once they reach the target position.",name:"TargetDeleteFlag",type:"Attribute"},{datatype:"Float",defaultValue:.1,if:{TargetDeleteFlag:true},displayName:"Target Deletion Threshold",info:"The distance from the target at which particles are deleted.",minValue:0,name:"TargetDeletionThreshold",type:"Attribute"},{label:"Life Settings",type:"Separator",collapsed:true},{datatype:"Float",defaultValue:10,displayName:"Life",info:"Time in seconds each particle remains alive before disappearing.",minValue:0,name:"Life",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Life Randomness",info:"Adds randomness, in seconds, to particle lifetimes. Each particle's life is calculated as: life + random(0 to 1) x life randomness.",minValue:0,name:"LifeRandomness",type:"Attribute"},{label:"Texture and Color Settings",type:"Separator",collapsed:true},{datatype:"ParticlePreview",displayName:"Particle Preview",info:"Visual preview of a single particle.",name:"ParticlePreview",type:"Attribute"},{datatype:"Enum",defaultValue:"Base",name:"ParticleType",info:"Defines the rendering style of particles: Base (simple points), Texture (image-based), or Sprite (animated images).",options:["Base","Texture","Sprite"],type:"Attribute"},{displayName:"Texture",info:"Image used as the particle’s texture.",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]},linkableTypes:["Image"],type:"Link",usageAs:"ParticleTexture"},{datatype:"Boolean",defaultValue:true,displayName:"Circular Mask",info:"Applies a circular alpha mask to the texture or sprite, making only the circular area visible while masking out the corners.",name:"useCircularMask",type:"Attribute"},{datatype:"Boolean",defaultValue:false,name:"TextureBlending",displayName:"Texture Blending",info:"If enabled, blends the particle texture with the background or other particles for smoother visuals.",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]},type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Texture hue",info:"Amount of hue shift applied to the particle texture, expressed as a normalized value from 0 to 1, where 0 corresponds to 0 radians (0°) and 1 corresponds to 2π radians (360°).",minValue:0,maxValue:1,name:"TextureHue",if:{$or:[{ParticleType:"Base"},{TextureBlending:true}]},type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Color",info:"Base color applied to particles at emission.",if:{$or:[{ParticleType:"Base"},{TextureBlending:true}]},name:"Color",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Use Final Color",info:"Enable color transition so particles interpolate to a specified final color at the end of their lifetime.",if:{$or:[{ParticleType:"Base"},{TextureBlending:true}]},name:"EnableFinalColor",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Final Color",info:"The color particles interpolate to at the end of their life.",if:{EnableFinalColor:true,$or:[{ParticleType:"Base"},{TextureBlending:true}]},name:"FinalColor",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Random Color Factor",info:"Linearly blends each particle's color with a unique random tint. 0 = no randomness, 1 = full random color.",if:{$or:[{ParticleType:"Base"},{TextureBlending:true}]},minValue:0,maxValue:1,name:"RandomColorFactor",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable Sprite Fade",if:{ParticleType:"Sprite"},info:"Allows the sprite to smoothly fade in and fade, creating a softer transition.",name:"EnableSpriteFade",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Roll Sprite With Life",if:{ParticleType:"Sprite"},info:"Enable the sprite to animate by rolling through its frames based on the particle's lifetime.",name:"RollSpriteWithLife",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Sprite Speed",if:{ParticleType:"Sprite",RollSpriteWithLife:false},info:"Speed, in frames per seconds, at which the sprite animation advances over time.",minValue:0,name:"SpriteSpeed",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Sprite Cols",if:{ParticleType:"Sprite"},info:"Number of horizontal frames (columns) in the sprite sheet. Must be specified manually. Incorrect values may cause improper animation.",minValue:1,name:"SpriteColumns",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Sprite Rows",if:{ParticleType:"Sprite"},info:"Number of vertical frames (rows) in the sprite sheet. Must be specified manually. Incorrect values may cause improper animation.",minValue:1,name:"SpriteRows",type:"Attribute"},{label:"Blending Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Normal",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Multiply","Negation","Normal","Subtract"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",info:"Adjusts how strongly the blending mode affects the final result.",maxValue:1,minValue:0,name:"Opacity",type:"Attribute",widget:"Slider"},{label:"Fade Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Constant",options:["Constant","Variable"],displayName:"Fading Mode",info:"Determines how particle opacity changes: constant transparency, fade over lifetime, or based on velocity.",name:"FadeMode",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Initial Opacity",info:"The opacity of particles when they are first emitted (0.0 = transparent, 1.0 = opaque)",minValue:0,maxValue:1,name:"ParticleInitialOpacity",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Final Opacity",info:"The opacity particles reach at the end of their lifetime. Creates fade-out effect when lower than initial opacity.",minValue:0,maxValue:1,name:"ParticleFinalOpacity",type:"Attribute",if:{FadeMode:"Variable"}},{datatype:"Enum",defaultValue:"Linear",options:["Linear","Exponential","Inverse Exponential","Ease-in, Ease-out"],displayName:"Fade Interpolation",info:"Controls how smoothly particles fade between initial and final opacity over their lifetime.",type:"Attribute",name:"FadeFunction",if:{FadeMode:"Variable"}},{datatype:"Float",defaultValue:1,minValue:.1,maxValue:5,if:{FadeMode:"Variable",$or:[{FadeFunction:"Exponential"},{FadeFunction:"Inverse Exponential"},{FadeFunction:"Ease-in, Ease-out"}]},displayName:"Fade Rate",name:"FadeApproach",info:"Controls how quickly the fade transition occurs. Higher values create sharper transitions, lower values create gentler fades.",type:"Attribute"},{label:"Emission Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Box",name:"EmitterShape",displayName:"Emitter Shape",info:"Defines the geometric shape from which particles are emitted.",options:["Point","Box","Sphere","Hemisphere","Torus","Cone","Circle","Edge"],type:"Attribute"},{datatype:"Enum",defaultValue:"Volume",name:"EmitterTypeSurfaceVolumeNormal",displayName:"Emitter Type",info:"Specifies whether particles are emitted from the surface, volume, or along the normals of the shape.",options:["Surface","Volume","Normals"],if:{$or:[{EmitterShape:"Box"},{EmitterShape:"Sphere"},{EmitterShape:"Cone"}]},type:"Attribute"},{datatype:"Enum",defaultValue:"Volume",name:"EmitterTypeSurfaceVolume",info:"Specifies whether particles are emitted from the surface or volume of the shape.",displayName:"Emitter Type",options:["Surface","Volume"],if:{$or:[{EmitterShape:"Hemisphere"},{EmitterShape:"Torus"}]},type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Velocity Along Normals.",info:"Speed at which particles are emitted along the surface normals.",if:{EmitterTypeSurfaceVolumeNormal:"Normals"},minValue:0,name:"NormalsVelocity",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The size of the emitter.",info:"Defines the size of the emitter.",if:{$or:[{EmitterShape:"Box"}]},minValue:0,name:"EmitterSize",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The radius of the emitter.",if:{$or:[{EmitterShape:"Torus"},{EmitterShape:"Cone"},{EmitterShape:"Sphere"},{EmitterShape:"Hemisphere"},{EmitterShape:"Circle"}]},minValue:0,name:"EmitterRadius",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The outer radius of the emitter",if:{$or:[{EmitterShape:"Torus"}]},minValue:0,name:"EmitterOuterRadius",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The height of the emitter",if:{$or:[{EmitterShape:"Cone"},{EmitterShape:"Edge"}]},minValue:0,name:"EmitterHeight",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The width of the emitter.",if:{$or:[{EmitterShape:"Edge"}]},minValue:0,name:"EmitterWidth",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Round Tip",if:{$or:[{EmitterShape:"Cone"}]},info:"Round the tip of the cone instead of using a sharp point.",name:"EmitterRoundTip",type:"Attribute"},{label:"Bounding Box Settings",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Enable Bounding Box",info:"Enable a bounding box to restrict particles within a defined 3D area.",name:"EnableBBox",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:10,y:10,z:10},info:"Coordinates of the bounding box's maximum corner (upper-right-front).",name:"BBoxMax",displayName:"Bounding Box Maximum Corner",if:{EnableBBox:true},type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},info:"Coordinates of the bounding box's minimum corner (lower-left-back).",name:"BBoxMin",displayName:"Bounding Box Minimum Corner",if:{EnableBBox:true},type:"Attribute"},{label:"Curl Noise Settings",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Enable Curl Noise",info:"Toggle curl noise effect on particles to simulate turbulent, swirling particle behavior.",name:"NoiseFlag",type:"Attribute"},{datatype:"NoisePreview",if:{NoiseFlag:true},displayName:"Noise Preview",info:"Visual preview of the curl noise pattern applied to the particle system.",name:"NoisePreview",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Noise Strength",if:{NoiseFlag:true},info:"Controls the intensity of the noise.",name:"NoiseStrength",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Noise Frequency",if:{NoiseFlag:true},info:"Determines the smoothness of the noise: lower values produce smooth, slow variations; higher values produce rapid, detailed changes.",name:"NoiseFrequency",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Noise Octaves",if:{NoiseFlag:true},info:"Number of noise layers combined to create complexity. Higher octaves add detail but reduce performance.",name:"NoiseOctaves",type:"Attribute"}],name:"Particles",updateRequiresThumbRefresh:false,creatableEmpty:true}];function E$1(e,t=false){let a=I$1.find((t=>t.name===e));if(!a)return null;if(a=structuredClone(a),a.fields=a.fields||[],a.fieldSets=a.fieldSets||[],t&&a.inherits){const e=E$1(a.inherits,true);e&&(a.fields=[...e.fields,...a.fields],a.fieldSets=[...e.fieldSets,...a.fieldSets]);}return a}function F(){return structuredClone(I$1)}var D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function R$9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function L(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var P,B$9={exports:{}};var O,$=(P||(P=1,(O=B$9).exports=function(){var e,t;function a(){return e.apply(null,arguments)}function n(t){e=t;}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(s(e,t))return false;return true}function l(e){return void 0===e}function u(e){return "number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function c(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){var a,n=[],i=e.length;for(a=0;a<i;++a)n.push(t(e[a],a));return n}function p(e,t){for(var a in t)s(t,a)&&(e[a]=t[a]);return s(t,"toString")&&(e.toString=t.toString),s(t,"valueOf")&&(e.valueOf=t.valueOf),e}function h(e,t,a,n){return qa(e,t,a,n,true).utc()}function f(){return {empty:false,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:false,invalidEra:null,invalidMonth:null,invalidFormat:false,userInvalidated:false,iso:false,parsedDateParts:[],era:null,meridiem:null,rfc2822:false,weekdayMismatch:false}}function m(e){return null==e._pf&&(e._pf=f()),e._pf}function y(e){var a=null,n=false,i=e._d&&!isNaN(e._d.getTime());return i&&(a=m(e),n=t.call(a.parsedDateParts,(function(e){return null!=e})),i=a.overflow<0&&!a.empty&&!a.invalidEra&&!a.invalidMonth&&!a.invalidWeekday&&!a.weekdayMismatch&&!a.nullInput&&!a.invalidFormat&&!a.userInvalidated&&(!a.meridiem||a.meridiem&&n),e._strict&&(i=i&&0===a.charsLeftOver&&0===a.unusedTokens.length&&void 0===a.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e)?i:(e._isValid=i,e._isValid)}function g(e){var t=h(NaN);return null!=e?p(m(t),e):m(t).userInvalidated=true,t}t=Array.prototype.some?Array.prototype.some:function(e){var t,a=Object(this),n=a.length>>>0;for(t=0;t<n;t++)if(t in a&&e.call(this,a[t],t,a))return true;return false};var b=a.momentProperties=[],v=false;function w(e,t){var a,n,i,r=b.length;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=m(t)),l(t._locale)||(e._locale=t._locale),r>0)for(a=0;a<r;a++)l(i=t[n=b[a]])||(e[n]=i);return e}function _(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),false===v&&(v=true,a.updateOffset(this),v=false);}function A(e){return e instanceof _||null!=e&&null!=e._isAMomentObject}function k(e){ false===a.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e);}function S(e,t){var n=true;return p((function(){if(null!=a.deprecationHandler&&a.deprecationHandler(null,e),n){var i,r,o,l=[],u=arguments.length;for(r=0;r<u;r++){if(i="","object"==typeof arguments[r]){for(o in i+="\n["+r+"] ",arguments[0])s(arguments[0],o)&&(i+=o+": "+arguments[0][o]+", ");i=i.slice(0,-2);}else i=arguments[r];l.push(i);}k(e+"\nArguments: "+Array.prototype.slice.call(l).join("")+"\n"+(new Error).stack),n=false;}return t.apply(this,arguments)}),t)}var N,T={};function M(e,t){null!=a.deprecationHandler&&a.deprecationHandler(e,t),T[e]||(k(t),T[e]=true);}function x(e){return "undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function C(e){var t,a;for(a in e)s(e,a)&&(x(t=e[a])?this[a]=t:this["_"+a]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source);}function V(e,t){var a,n=p({},e);for(a in t)s(t,a)&&(r(e[a])&&r(t[a])?(n[a]={},p(n[a],e[a]),p(n[a],t[a])):null!=t[a]?n[a]=t[a]:delete n[a]);for(a in e)s(e,a)&&!s(t,a)&&r(e[a])&&(n[a]=p({},n[a]));return n}function I(e){null!=e&&this.set(e);}a.suppressDeprecationWarnings=false,a.deprecationHandler=null,N=Object.keys?Object.keys:function(e){var t,a=[];for(t in e)s(e,t)&&a.push(t);return a};var E={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function F(e,t,a){var n=this._calendar[e]||this._calendar.sameElse;return x(n)?n.call(t,a):n}function D(e,t,a){var n=""+Math.abs(e),i=t-n.length;return (e>=0?a?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+n}var R=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,P=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,B={},$={};function U(e,t,a,n){var i=n;"string"==typeof n&&(i=function(){return this[n]()}),e&&($[e]=i),t&&($[t[0]]=function(){return D(i.apply(this,arguments),t[1],t[2])}),a&&($[a]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)});}function j(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function z(e){var t,a,n=e.match(R);for(t=0,a=n.length;t<a;t++)$[n[t]]?n[t]=$[n[t]]:n[t]=j(n[t]);return function(t){var i,r="";for(i=0;i<a;i++)r+=x(n[i])?n[i].call(t,e):n[i];return r}}function W(e,t){return e.isValid()?(t=Y(t,e.localeData()),B[t]=B[t]||z(t),B[t](e)):e.localeData().invalidDate()}function Y(e,t){var a=5;function n(e){return t.longDateFormat(e)||e}for(P.lastIndex=0;a>=0&&P.test(e);)e=e.replace(P,n),P.lastIndex=0,a-=1;return e}var H={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function G(e){var t=this._longDateFormat[e],a=this._longDateFormat[e.toUpperCase()];return t||!a?t:(this._longDateFormat[e]=a.match(R).map((function(e){return "MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e})).join(""),this._longDateFormat[e])}var q="Invalid date";function Z(){return this._invalidDate}var J="%d",K=/\d{1,2}/;function X(e){return this._ordinal.replace("%d",e)}var Q={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function ee(e,t,a,n){var i=this._relativeTime[a];return x(i)?i(e,t,a,n):i.replace(/%d/i,e)}function te(e,t){var a=this._relativeTime[e>0?"future":"past"];return x(a)?a(t):a.replace(/%s/i,t)}var ae={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ne(e){return "string"==typeof e?ae[e]||ae[e.toLowerCase()]:void 0}function ie(e){var t,a,n={};for(a in e)s(e,a)&&(t=ne(a))&&(n[t]=e[a]);return n}var re={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function se(e){var t,a=[];for(t in e)s(e,t)&&a.push({unit:t,priority:re[t]});return a.sort((function(e,t){return e.priority-t.priority})),a}var oe,le=/\d/,ue=/\d\d/,ce=/\d{3}/,de=/\d{4}/,pe=/[+-]?\d{6}/,he=/\d\d?/,fe=/\d\d\d\d?/,me=/\d\d\d\d\d\d?/,ye=/\d{1,3}/,ge=/\d{1,4}/,be=/[+-]?\d{1,6}/,ve=/\d+/,we=/[+-]?\d+/,_e=/Z|[+-]\d\d:?\d\d/gi,Ae=/Z|[+-]\d\d(?::?\d\d)?/gi,ke=/[+-]?\d+(\.\d{1,3})?/,Se=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Ne=/^[1-9]\d?/,Te=/^([1-9]\d|\d)/;function Me(e,t,a){oe[e]=x(t)?t:function(e,n){return e&&a?a:t};}function xe(e,t){return s(oe,e)?oe[e](t._strict,t._locale):new RegExp(Ce(e))}function Ce(e){return Ve(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,a,n,i){return t||a||n||i})))}function Ve(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Ie(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function Ee(e){var t=+e,a=0;return 0!==t&&isFinite(t)&&(a=Ie(t)),a}oe={};var Fe={};function De(e,t){var a,n,i=t;for("string"==typeof e&&(e=[e]),u(t)&&(i=function(e,a){a[t]=Ee(e);}),n=e.length,a=0;a<n;a++)Fe[e[a]]=i;}function Re(e,t){De(e,(function(e,a,n,i){n._w=n._w||{},t(e,n._w,n,i);}));}function Le(e,t,a){null!=t&&s(Fe,e)&&Fe[e](t,a._a,a,e);}function Pe(e){return e%4==0&&e%100!=0||e%400==0}var Be=0,Oe=1,$e=2,Ue=3,je=4,ze=5,We=6,Ye=7,He=8;function Ge(e){return Pe(e)?366:365}U("Y",0,0,(function(){var e=this.year();return e<=9999?D(e,4):"+"+e})),U(0,["YY",2],0,(function(){return this.year()%100})),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,true],0,"year"),Me("Y",we),Me("YY",he,ue),Me("YYYY",ge,de),Me("YYYYY",be,pe),Me("YYYYYY",be,pe),De(["YYYYY","YYYYYY"],Be),De("YYYY",(function(e,t){t[Be]=2===e.length?a.parseTwoDigitYear(e):Ee(e);})),De("YY",(function(e,t){t[Be]=a.parseTwoDigitYear(e);})),De("Y",(function(e,t){t[Be]=parseInt(e,10);})),a.parseTwoDigitYear=function(e){return Ee(e)+(Ee(e)>68?1900:2e3)};var qe,Ze=Ke("FullYear",true);function Je(){return Pe(this.year())}function Ke(e,t){return function(n){return null!=n?(Qe(this,e,n),a.updateOffset(this,t),this):Xe(this,e)}}function Xe(e,t){if(!e.isValid())return NaN;var a=e._d,n=e._isUTC;switch(t){case "Milliseconds":return n?a.getUTCMilliseconds():a.getMilliseconds();case "Seconds":return n?a.getUTCSeconds():a.getSeconds();case "Minutes":return n?a.getUTCMinutes():a.getMinutes();case "Hours":return n?a.getUTCHours():a.getHours();case "Date":return n?a.getUTCDate():a.getDate();case "Day":return n?a.getUTCDay():a.getDay();case "Month":return n?a.getUTCMonth():a.getMonth();case "FullYear":return n?a.getUTCFullYear():a.getFullYear();default:return NaN}}function Qe(e,t,a){var n,i,r,s,o;if(e.isValid()&&!isNaN(a)){switch(n=e._d,i=e._isUTC,t){case "Milliseconds":return void(i?n.setUTCMilliseconds(a):n.setMilliseconds(a));case "Seconds":return void(i?n.setUTCSeconds(a):n.setSeconds(a));case "Minutes":return void(i?n.setUTCMinutes(a):n.setMinutes(a));case "Hours":return void(i?n.setUTCHours(a):n.setHours(a));case "Date":return void(i?n.setUTCDate(a):n.setDate(a));case "FullYear":break;default:return}r=a,s=e.month(),o=29!==(o=e.date())||1!==s||Pe(r)?o:28,i?n.setUTCFullYear(r,s,o):n.setFullYear(r,s,o);}}function et(e){return x(this[e=ne(e)])?this[e]():this}function tt(e,t){if("object"==typeof e){var a,n=se(e=ie(e)),i=n.length;for(a=0;a<i;a++)this[n[a].unit](e[n[a].unit]);}else if(x(this[e=ne(e)]))return this[e](t);return this}function at(e,t){return (e%t+t)%t}function nt(e,t){if(isNaN(e)||isNaN(t))return NaN;var a=at(t,12);return e+=(t-a)/12,1===a?Pe(e)?29:28:31-a%7%2}qe=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return -1},U("M",["MM",2],"Mo",(function(){return this.month()+1})),U("MMM",0,0,(function(e){return this.localeData().monthsShort(this,e)})),U("MMMM",0,0,(function(e){return this.localeData().months(this,e)})),Me("M",he,Ne),Me("MM",he,ue),Me("MMM",(function(e,t){return t.monthsShortRegex(e)})),Me("MMMM",(function(e,t){return t.monthsRegex(e)})),De(["M","MM"],(function(e,t){t[Oe]=Ee(e)-1;})),De(["MMM","MMMM"],(function(e,t,a,n){var i=a._locale.monthsParse(e,n,a._strict);null!=i?t[Oe]=i:m(a).invalidMonth=e;}));var it="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),rt="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),st=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,ot=Se,lt=Se;function ut(e,t){return e?i(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||st).test(t)?"format":"standalone"][e.month()]:i(this._months)?this._months:this._months.standalone}function ct(e,t){return e?i(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[st.test(t)?"format":"standalone"][e.month()]:i(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function dt(e,t,a){var n,i,r,s=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)r=h([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(r,"").toLocaleLowerCase();return a?"MMM"===t?-1!==(i=qe.call(this._shortMonthsParse,s))?i:null:-1!==(i=qe.call(this._longMonthsParse,s))?i:null:"MMM"===t?-1!==(i=qe.call(this._shortMonthsParse,s))||-1!==(i=qe.call(this._longMonthsParse,s))?i:null:-1!==(i=qe.call(this._longMonthsParse,s))||-1!==(i=qe.call(this._shortMonthsParse,s))?i:null}function pt(e,t,a){var n,i,r;if(this._monthsParseExact)return dt.call(this,e,t,a);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=h([2e3,n]),a&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),a||this._monthsParse[n]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=new RegExp(r.replace(".",""),"i")),a&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(a&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!a&&this._monthsParse[n].test(e))return n}}function ht(e,t){if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=Ee(t);else if(!u(t=e.localeData().monthsParse(t)))return e;var a=t,n=e.date();return n=n<29?n:Math.min(n,nt(e.year(),a)),e._isUTC?e._d.setUTCMonth(a,n):e._d.setMonth(a,n),e}function ft(e){return null!=e?(ht(this,e),a.updateOffset(this,true),this):Xe(this,"Month")}function mt(){return nt(this.year(),this.month())}function yt(e){return this._monthsParseExact?(s(this,"_monthsRegex")||bt.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(s(this,"_monthsShortRegex")||(this._monthsShortRegex=ot),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function gt(e){return this._monthsParseExact?(s(this,"_monthsRegex")||bt.call(this),e?this._monthsStrictRegex:this._monthsRegex):(s(this,"_monthsRegex")||(this._monthsRegex=lt),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function bt(){function e(e,t){return t.length-e.length}var t,a,n,i,r=[],s=[],o=[];for(t=0;t<12;t++)a=h([2e3,t]),n=Ve(this.monthsShort(a,"")),i=Ve(this.months(a,"")),r.push(n),s.push(i),o.push(i),o.push(n);r.sort(e),s.sort(e),o.sort(e),this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")","i");}function vt(e,t,a,n,i,r,s){var o;return e<100&&e>=0?(o=new Date(e+400,t,a,n,i,r,s),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,a,n,i,r,s),o}function wt(e){var t,a;return e<100&&e>=0?((a=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,a)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function _t(e,t,a){var n=7+t-a;return -(7+wt(e,0,n).getUTCDay()-t)%7+n-1}function At(e,t,a,n,i){var r,s,o=1+7*(t-1)+(7+a-n)%7+_t(e,n,i);return o<=0?s=Ge(r=e-1)+o:o>Ge(e)?(r=e+1,s=o-Ge(e)):(r=e,s=o),{year:r,dayOfYear:s}}function kt(e,t,a){var n,i,r=_t(e.year(),t,a),s=Math.floor((e.dayOfYear()-r-1)/7)+1;return s<1?n=s+St(i=e.year()-1,t,a):s>St(e.year(),t,a)?(n=s-St(e.year(),t,a),i=e.year()+1):(i=e.year(),n=s),{week:n,year:i}}function St(e,t,a){var n=_t(e,t,a),i=_t(e+1,t,a);return (Ge(e)-n+i)/7}function Nt(e){return kt(e,this._week.dow,this._week.doy).week}U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),Me("w",he,Ne),Me("ww",he,ue),Me("W",he,Ne),Me("WW",he,ue),Re(["w","ww","W","WW"],(function(e,t,a,n){t[n.substr(0,1)]=Ee(e);}));var Tt={dow:0,doy:6};function Mt(){return this._week.dow}function xt(){return this._week.doy}function Ct(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function Vt(e){var t=kt(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function It(e,t){return "string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}function Et(e,t){return "string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Ft(e,t){return e.slice(t,7).concat(e.slice(0,t))}U("d",0,"do","day"),U("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),U("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),U("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),Me("d",he),Me("e",he),Me("E",he),Me("dd",(function(e,t){return t.weekdaysMinRegex(e)})),Me("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),Me("dddd",(function(e,t){return t.weekdaysRegex(e)})),Re(["dd","ddd","dddd"],(function(e,t,a,n){var i=a._locale.weekdaysParse(e,n,a._strict);null!=i?t.d=i:m(a).invalidWeekday=e;})),Re(["d","e","E"],(function(e,t,a,n){t[n]=Ee(e);}));var Dt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Rt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Lt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Pt=Se,Bt=Se,Ot=Se;function $t(e,t){var a=i(this._weekdays)?this._weekdays:this._weekdays[e&&true!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return true===e?Ft(a,this._week.dow):e?a[e.day()]:a}function Ut(e){return true===e?Ft(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function jt(e){return true===e?Ft(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function zt(e,t,a){var n,i,r,s=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)r=h([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(r,"").toLocaleLowerCase();return a?"dddd"===t?-1!==(i=qe.call(this._weekdaysParse,s))?i:null:"ddd"===t?-1!==(i=qe.call(this._shortWeekdaysParse,s))?i:null:-1!==(i=qe.call(this._minWeekdaysParse,s))?i:null:"dddd"===t?-1!==(i=qe.call(this._weekdaysParse,s))||-1!==(i=qe.call(this._shortWeekdaysParse,s))||-1!==(i=qe.call(this._minWeekdaysParse,s))?i:null:"ddd"===t?-1!==(i=qe.call(this._shortWeekdaysParse,s))||-1!==(i=qe.call(this._weekdaysParse,s))||-1!==(i=qe.call(this._minWeekdaysParse,s))?i:null:-1!==(i=qe.call(this._minWeekdaysParse,s))||-1!==(i=qe.call(this._weekdaysParse,s))||-1!==(i=qe.call(this._shortWeekdaysParse,s))?i:null}function Wt(e,t,a){var n,i,r;if(this._weekdaysParseExact)return zt.call(this,e,t,a);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=h([2e3,1]).day(n),a&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=new RegExp(r.replace(".",""),"i")),a&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(a&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(a&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;if(!a&&this._weekdaysParse[n].test(e))return n}}function Yt(e){if(!this.isValid())return null!=e?this:NaN;var t=Xe(this,"Day");return null!=e?(e=It(e,this.localeData()),this.add(e-t,"d")):t}function Ht(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function Gt(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=Et(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function qt(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Kt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(s(this,"_weekdaysRegex")||(this._weekdaysRegex=Pt),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Zt(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Kt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(s(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Bt),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Jt(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Kt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(s(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ot),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Kt(){function e(e,t){return t.length-e.length}var t,a,n,i,r,s=[],o=[],l=[],u=[];for(t=0;t<7;t++)a=h([2e3,1]).day(t),n=Ve(this.weekdaysMin(a,"")),i=Ve(this.weekdaysShort(a,"")),r=Ve(this.weekdays(a,"")),s.push(n),o.push(i),l.push(r),u.push(n),u.push(i),u.push(r);s.sort(e),o.sort(e),l.sort(e),u.sort(e),this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i");}function Xt(){return this.hours()%12||12}function Qt(){return this.hours()||24}function ea(e,t){U(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}));}function ta(e,t){return t._meridiemParse}function aa(e){return "p"===(e+"").toLowerCase().charAt(0)}U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Xt),U("k",["kk",2],0,Qt),U("hmm",0,0,(function(){return ""+Xt.apply(this)+D(this.minutes(),2)})),U("hmmss",0,0,(function(){return ""+Xt.apply(this)+D(this.minutes(),2)+D(this.seconds(),2)})),U("Hmm",0,0,(function(){return ""+this.hours()+D(this.minutes(),2)})),U("Hmmss",0,0,(function(){return ""+this.hours()+D(this.minutes(),2)+D(this.seconds(),2)})),ea("a",true),ea("A",false),Me("a",ta),Me("A",ta),Me("H",he,Te),Me("h",he,Ne),Me("k",he,Ne),Me("HH",he,ue),Me("hh",he,ue),Me("kk",he,ue),Me("hmm",fe),Me("hmmss",me),Me("Hmm",fe),Me("Hmmss",me),De(["H","HH"],Ue),De(["k","kk"],(function(e,t,a){var n=Ee(e);t[Ue]=24===n?0:n;})),De(["a","A"],(function(e,t,a){a._isPm=a._locale.isPM(e),a._meridiem=e;})),De(["h","hh"],(function(e,t,a){t[Ue]=Ee(e),m(a).bigHour=true;})),De("hmm",(function(e,t,a){var n=e.length-2;t[Ue]=Ee(e.substr(0,n)),t[je]=Ee(e.substr(n)),m(a).bigHour=true;})),De("hmmss",(function(e,t,a){var n=e.length-4,i=e.length-2;t[Ue]=Ee(e.substr(0,n)),t[je]=Ee(e.substr(n,2)),t[ze]=Ee(e.substr(i)),m(a).bigHour=true;})),De("Hmm",(function(e,t,a){var n=e.length-2;t[Ue]=Ee(e.substr(0,n)),t[je]=Ee(e.substr(n));})),De("Hmmss",(function(e,t,a){var n=e.length-4,i=e.length-2;t[Ue]=Ee(e.substr(0,n)),t[je]=Ee(e.substr(n,2)),t[ze]=Ee(e.substr(i));}));var na=/[ap]\.?m?\.?/i,ia=Ke("Hours",true);function ra(e,t,a){return e>11?a?"pm":"PM":a?"am":"AM"}var sa,oa={calendar:E,longDateFormat:H,invalidDate:q,ordinal:J,dayOfMonthOrdinalParse:K,relativeTime:Q,months:it,monthsShort:rt,week:Tt,weekdays:Dt,weekdaysMin:Lt,weekdaysShort:Rt,meridiemParse:na},la={},ua={};function ca(e,t){var a,n=Math.min(e.length,t.length);for(a=0;a<n;a+=1)if(e[a]!==t[a])return a;return n}function da(e){return e?e.toLowerCase().replace("_","-"):e}function pa(e){for(var t,a,n,i,r=0;r<e.length;){for(t=(i=da(e[r]).split("-")).length,a=(a=da(e[r+1]))?a.split("-"):null;t>0;){if(n=fa(i.slice(0,t).join("-")))return n;if(a&&a.length>=t&&ca(i,a)>=t-1)break;t--;}r++;}return sa}function ha(e){return !(!e||!e.match("^[^/\\\\]*$"))}function fa(e){var t=null;if(void 0===la[e]&&O&&O.exports&&ha(e))try{t=sa._abbr,L("./locale/"+e),ma(t);}catch(t){la[e]=null;}return la[e]}function ma(e,t){var a;return e&&((a=l(t)?ba(e):ya(e,t))?sa=a:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),sa._abbr}function ya(e,t){if(null!==t){var a,n=oa;if(t.abbr=e,null!=la[e])M("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=la[e]._config;else if(null!=t.parentLocale)if(null!=la[t.parentLocale])n=la[t.parentLocale]._config;else {if(null==(a=fa(t.parentLocale)))return ua[t.parentLocale]||(ua[t.parentLocale]=[]),ua[t.parentLocale].push({name:e,config:t}),null;n=a._config;}return la[e]=new I(V(n,t)),ua[e]&&ua[e].forEach((function(e){ya(e.name,e.config);})),ma(e),la[e]}return delete la[e],null}function ga(e,t){if(null!=t){var a,n,i=oa;null!=la[e]&&null!=la[e].parentLocale?la[e].set(V(la[e]._config,t)):(null!=(n=fa(e))&&(i=n._config),t=V(i,t),null==n&&(t.abbr=e),(a=new I(t)).parentLocale=la[e],la[e]=a),ma(e);}else null!=la[e]&&(null!=la[e].parentLocale?(la[e]=la[e].parentLocale,e===ma()&&ma(e)):null!=la[e]&&delete la[e]);return la[e]}function ba(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return sa;if(!i(e)){if(t=fa(e))return t;e=[e];}return pa(e)}function va(){return N(la)}function wa(e){var t,a=e._a;return a&&-2===m(e).overflow&&(t=a[Oe]<0||a[Oe]>11?Oe:a[$e]<1||a[$e]>nt(a[Be],a[Oe])?$e:a[Ue]<0||a[Ue]>24||24===a[Ue]&&(0!==a[je]||0!==a[ze]||0!==a[We])?Ue:a[je]<0||a[je]>59?je:a[ze]<0||a[ze]>59?ze:a[We]<0||a[We]>999?We:-1,m(e)._overflowDayOfYear&&(t<Be||t>$e)&&(t=$e),m(e)._overflowWeeks&&-1===t&&(t=Ye),m(e)._overflowWeekday&&-1===t&&(t=He),m(e).overflow=t),e}var _a=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Aa=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ka=/Z|[+-]\d\d(?::?\d\d)?/,Sa=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,false],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,false],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,false],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,false],["YYYY",/\d{4}/,false]],Na=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ta=/^\/?Date\((-?\d+)/i,Ma=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,xa={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ca(e){var t,a,n,i,r,s,o=e._i,l=_a.exec(o)||Aa.exec(o),u=Sa.length,c=Na.length;if(l){for(m(e).iso=true,t=0,a=u;t<a;t++)if(Sa[t][1].exec(l[1])){i=Sa[t][0],n=false!==Sa[t][2];break}if(null==i)return void(e._isValid=false);if(l[3]){for(t=0,a=c;t<a;t++)if(Na[t][1].exec(l[3])){r=(l[2]||" ")+Na[t][0];break}if(null==r)return void(e._isValid=false)}if(!n&&null!=r)return void(e._isValid=false);if(l[4]){if(!ka.exec(l[4]))return void(e._isValid=false);s="Z";}e._f=i+(r||"")+(s||""),Ua(e);}else e._isValid=false;}function Va(e,t,a,n,i,r){var s=[Ia(e),rt.indexOf(t),parseInt(a,10),parseInt(n,10),parseInt(i,10)];return r&&s.push(parseInt(r,10)),s}function Ia(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Ea(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Fa(e,t,a){return !e||Rt.indexOf(e)===new Date(t[0],t[1],t[2]).getDay()||(m(a).weekdayMismatch=true,a._isValid=false,false)}function Da(e,t,a){if(e)return xa[e];if(t)return 0;var n=parseInt(a,10),i=n%100;return (n-i)/100*60+i}function Ra(e){var t,a=Ma.exec(Ea(e._i));if(a){if(t=Va(a[4],a[3],a[2],a[5],a[6],a[7]),!Fa(a[1],t,e))return;e._a=t,e._tzm=Da(a[8],a[9],a[10]),e._d=wt.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),m(e).rfc2822=true;}else e._isValid=false;}function La(e){var t=Ta.exec(e._i);null===t?(Ca(e),false===e._isValid&&(delete e._isValid,Ra(e),false===e._isValid&&(delete e._isValid,e._strict?e._isValid=false:a.createFromInputFallback(e)))):e._d=new Date(+t[1]);}function Pa(e,t,a){return null!=e?e:null!=t?t:a}function Ba(e){var t=new Date(a.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function Oa(e){var t,a,n,i,r,s=[];if(!e._d){for(n=Ba(e),e._w&&null==e._a[$e]&&null==e._a[Oe]&&$a(e),null!=e._dayOfYear&&(r=Pa(e._a[Be],n[Be]),(e._dayOfYear>Ge(r)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=true),a=wt(r,0,e._dayOfYear),e._a[Oe]=a.getUTCMonth(),e._a[$e]=a.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=s[t]=n[t];for(;t<7;t++)e._a[t]=s[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Ue]&&0===e._a[je]&&0===e._a[ze]&&0===e._a[We]&&(e._nextDay=true,e._a[Ue]=0),e._d=(e._useUTC?wt:vt).apply(null,s),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Ue]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(m(e).weekdayMismatch=true);}}function $a(e){var t,a,n,i,r,s,o,l,u;null!=(t=e._w).GG||null!=t.W||null!=t.E?(r=1,s=4,a=Pa(t.GG,e._a[Be],kt(Za(),1,4).year),n=Pa(t.W,1),((i=Pa(t.E,1))<1||i>7)&&(l=true)):(r=e._locale._week.dow,s=e._locale._week.doy,u=kt(Za(),r,s),a=Pa(t.gg,e._a[Be],u.year),n=Pa(t.w,u.week),null!=t.d?((i=t.d)<0||i>6)&&(l=true):null!=t.e?(i=t.e+r,(t.e<0||t.e>6)&&(l=true)):i=r),n<1||n>St(a,r,s)?m(e)._overflowWeeks=true:null!=l?m(e)._overflowWeekday=true:(o=At(a,n,i,r,s),e._a[Be]=o.year,e._dayOfYear=o.dayOfYear);}function Ua(e){if(e._f!==a.ISO_8601)if(e._f!==a.RFC_2822){e._a=[],m(e).empty=true;var t,n,i,r,s,o,l,u=""+e._i,c=u.length,d=0;for(l=(i=Y(e._f,e._locale).match(R)||[]).length,t=0;t<l;t++)r=i[t],(n=(u.match(xe(r,e))||[])[0])&&((s=u.substr(0,u.indexOf(n))).length>0&&m(e).unusedInput.push(s),u=u.slice(u.indexOf(n)+n.length),d+=n.length),$[r]?(n?m(e).empty=false:m(e).unusedTokens.push(r),Le(r,n,e)):e._strict&&!n&&m(e).unusedTokens.push(r);m(e).charsLeftOver=c-d,u.length>0&&m(e).unusedInput.push(u),e._a[Ue]<=12&&true===m(e).bigHour&&e._a[Ue]>0&&(m(e).bigHour=void 0),m(e).parsedDateParts=e._a.slice(0),m(e).meridiem=e._meridiem,e._a[Ue]=ja(e._locale,e._a[Ue],e._meridiem),null!==(o=m(e).era)&&(e._a[Be]=e._locale.erasConvertYear(o,e._a[Be])),Oa(e),wa(e);}else Ra(e);else Ca(e);}function ja(e,t,a){var n;return null==a?t:null!=e.meridiemHour?e.meridiemHour(t,a):null!=e.isPM?((n=e.isPM(a))&&t<12&&(t+=12),n||12!==t||(t=0),t):t}function za(e){var t,a,n,i,r,s,o=false,l=e._f.length;if(0===l)return m(e).invalidFormat=true,void(e._d=new Date(NaN));for(i=0;i<l;i++)r=0,s=false,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Ua(t),y(t)&&(s=true),r+=m(t).charsLeftOver,r+=10*m(t).unusedTokens.length,m(t).score=r,o?r<n&&(n=r,a=t):(null==n||r<n||s)&&(n=r,a=t,s&&(o=true));p(e,a||t);}function Wa(e){if(!e._d){var t=ie(e._i),a=void 0===t.day?t.date:t.day;e._a=d([t.year,t.month,a,t.hour,t.minute,t.second,t.millisecond],(function(e){return e&&parseInt(e,10)})),Oa(e);}}function Ya(e){var t=new _(wa(Ha(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function Ha(e){var t=e._i,a=e._f;return e._locale=e._locale||ba(e._l),null===t||void 0===a&&""===t?g({nullInput:true}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),A(t)?new _(wa(t)):(c(t)?e._d=t:i(a)?za(e):a?Ua(e):Ga(e),y(e)||(e._d=null),e))}function Ga(e){var t=e._i;l(t)?e._d=new Date(a.now()):c(t)?e._d=new Date(t.valueOf()):"string"==typeof t?La(e):i(t)?(e._a=d(t.slice(0),(function(e){return parseInt(e,10)})),Oa(e)):r(t)?Wa(e):u(t)?e._d=new Date(t):a.createFromInputFallback(e);}function qa(e,t,a,n,s){var l={};return true!==t&&false!==t||(n=t,t=void 0),true!==a&&false!==a||(n=a,a=void 0),(r(e)&&o(e)||i(e)&&0===e.length)&&(e=void 0),l._isAMomentObject=true,l._useUTC=l._isUTC=s,l._l=a,l._i=e,l._f=t,l._strict=n,Ya(l)}function Za(e,t,a,n){return qa(e,t,a,n,false)}a.createFromInputFallback=S("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""));})),a.ISO_8601=function(){},a.RFC_2822=function(){};var Ja=S("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Za.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:g()})),Ka=S("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Za.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:g()}));function Xa(e,t){var a,n;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)return Za();for(a=t[0],n=1;n<t.length;++n)t[n].isValid()&&!t[n][e](a)||(a=t[n]);return a}function Qa(){return Xa("isBefore",[].slice.call(arguments,0))}function en(){return Xa("isAfter",[].slice.call(arguments,0))}var tn=function(){return Date.now?Date.now():+new Date},an=["year","quarter","month","week","day","hour","minute","second","millisecond"];function nn(e){var t,a,n=false,i=an.length;for(t in e)if(s(e,t)&&(-1===qe.call(an,t)||null!=e[t]&&isNaN(e[t])))return false;for(a=0;a<i;++a)if(e[an[a]]){if(n)return false;parseFloat(e[an[a]])!==Ee(e[an[a]])&&(n=true);}return true}function rn(){return this._isValid}function sn(){return Cn(NaN)}function on(e){var t=ie(e),a=t.year||0,n=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,s=t.day||0,o=t.hour||0,l=t.minute||0,u=t.second||0,c=t.millisecond||0;this._isValid=nn(t),this._milliseconds=+c+1e3*u+6e4*l+1e3*o*60*60,this._days=+s+7*r,this._months=+i+3*n+12*a,this._data={},this._locale=ba(),this._bubble();}function ln(e){return e instanceof on}function un(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function cn(e,t,a){var n,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),s=0;for(n=0;n<i;n++)Ee(e[n])!==Ee(t[n])&&s++;return s+r}function dn(e,t){U(e,0,0,(function(){var e=this.utcOffset(),a="+";return e<0&&(e=-e,a="-"),a+D(~~(e/60),2)+t+D(~~e%60,2)}));}dn("Z",":"),dn("ZZ",""),Me("Z",Ae),Me("ZZ",Ae),De(["Z","ZZ"],(function(e,t,a){a._useUTC=true,a._tzm=hn(Ae,e);}));var pn=/([\+\-]|\d\d)/gi;function hn(e,t){var a,n,i=(t||"").match(e);return null===i?null:0===(n=60*(a=((i[i.length-1]||[])+"").match(pn)||["-",0,0])[1]+Ee(a[2]))?0:"+"===a[0]?n:-n}function fn(e,t){var n,i;return t._isUTC?(n=t.clone(),i=(A(e)||c(e)?e.valueOf():Za(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),a.updateOffset(n,false),n):Za(e).local()}function mn(e){return -Math.round(e._d.getTimezoneOffset())}function yn(e,t,n){var i,r=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=hn(Ae,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return !this._isUTC&&t&&(i=mn(this)),this._offset=e,this._isUTC=true,null!=i&&this.add(i,"m"),r!==e&&(!t||this._changeInProgress?Dn(this,Cn(e-r,"m"),1,false):this._changeInProgress||(this._changeInProgress=true,a.updateOffset(this,true),this._changeInProgress=null)),this}return this._isUTC?r:mn(this)}function gn(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function bn(e){return this.utcOffset(0,e)}function vn(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=false,e&&this.subtract(mn(this),"m")),this}function wn(){if(null!=this._tzm)this.utcOffset(this._tzm,false,true);else if("string"==typeof this._i){var e=hn(_e,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,true);}return this}function _n(e){return !!this.isValid()&&(e=e?Za(e).utcOffset():0,(this.utcOffset()-e)%60==0)}function An(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function kn(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e,t={};return w(t,this),(t=Ha(t))._a?(e=t._isUTC?h(t._a):Za(t._a),this._isDSTShifted=this.isValid()&&cn(t._a,e.toArray())>0):this._isDSTShifted=false,this._isDSTShifted}function Sn(){return !!this.isValid()&&!this._isUTC}function Nn(){return !!this.isValid()&&this._isUTC}function Tn(){return !!this.isValid()&&this._isUTC&&0===this._offset}a.updateOffset=function(){};var Mn=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,xn=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Cn(e,t){var a,n,i,r=e,o=null;return ln(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:u(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(o=Mn.exec(e))?(a="-"===o[1]?-1:1,r={y:0,d:Ee(o[$e])*a,h:Ee(o[Ue])*a,m:Ee(o[je])*a,s:Ee(o[ze])*a,ms:Ee(un(1e3*o[We]))*a}):(o=xn.exec(e))?(a="-"===o[1]?-1:1,r={y:Vn(o[2],a),M:Vn(o[3],a),w:Vn(o[4],a),d:Vn(o[5],a),h:Vn(o[6],a),m:Vn(o[7],a),s:Vn(o[8],a)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=En(Za(r.from),Za(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),n=new on(r),ln(e)&&s(e,"_locale")&&(n._locale=e._locale),ln(e)&&s(e,"_isValid")&&(n._isValid=e._isValid),n}function Vn(e,t){var a=e&&parseFloat(e.replace(",","."));return (isNaN(a)?0:a)*t}function In(e,t){var a={};return a.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(a.months,"M").isAfter(t)&&--a.months,a.milliseconds=+t-+e.clone().add(a.months,"M"),a}function En(e,t){var a;return e.isValid()&&t.isValid()?(t=fn(t,e),e.isBefore(t)?a=In(e,t):((a=In(t,e)).milliseconds=-a.milliseconds,a.months=-a.months),a):{milliseconds:0,months:0}}function Fn(e,t){return function(a,n){var i;return null===n||isNaN(+n)||(M(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=a,a=n,n=i),Dn(this,Cn(a,n),e),this}}function Dn(e,t,n,i){var r=t._milliseconds,s=un(t._days),o=un(t._months);e.isValid()&&(i=null==i||i,o&&ht(e,Xe(e,"Month")+o*n),s&&Qe(e,"Date",Xe(e,"Date")+s*n),r&&e._d.setTime(e._d.valueOf()+r*n),i&&a.updateOffset(e,s||o));}Cn.fn=on.prototype,Cn.invalid=sn;var Rn=Fn(1,"add"),Ln=Fn(-1,"subtract");function Pn(e){return "string"==typeof e||e instanceof String}function Bn(e){return A(e)||c(e)||Pn(e)||u(e)||$n(e)||On(e)||null==e}function On(e){var t,a,n=r(e)&&!o(e),i=false,l=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],u=l.length;for(t=0;t<u;t+=1)a=l[t],i=i||s(e,a);return n&&i}function $n(e){var t=i(e),a=false;return t&&(a=0===e.filter((function(t){return !u(t)&&Pn(e)})).length),t&&a}function Un(e){var t,a,n=r(e)&&!o(e),i=false,l=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<l.length;t+=1)a=l[t],i=i||s(e,a);return n&&i}function jn(e,t){var a=e.diff(t,"days",true);return a<-6?"sameElse":a<-1?"lastWeek":a<0?"lastDay":a<1?"sameDay":a<2?"nextDay":a<7?"nextWeek":"sameElse"}function zn(e,t){1===arguments.length&&(arguments[0]?Bn(arguments[0])?(e=arguments[0],t=void 0):Un(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||Za(),i=fn(n,this).startOf("day"),r=a.calendarFormat(this,i)||"sameElse",s=t&&(x(t[r])?t[r].call(this,n):t[r]);return this.format(s||this.localeData().calendar(r,this,Za(n)))}function Wn(){return new _(this)}function Yn(e,t){var a=A(e)?e:Za(e);return !(!this.isValid()||!a.isValid())&&("millisecond"===(t=ne(t)||"millisecond")?this.valueOf()>a.valueOf():a.valueOf()<this.clone().startOf(t).valueOf())}function Hn(e,t){var a=A(e)?e:Za(e);return !(!this.isValid()||!a.isValid())&&("millisecond"===(t=ne(t)||"millisecond")?this.valueOf()<a.valueOf():this.clone().endOf(t).valueOf()<a.valueOf())}function Gn(e,t,a,n){var i=A(e)?e:Za(e),r=A(t)?t:Za(t);return !!(this.isValid()&&i.isValid()&&r.isValid())&&("("===(n=n||"()")[0]?this.isAfter(i,a):!this.isBefore(i,a))&&(")"===n[1]?this.isBefore(r,a):!this.isAfter(r,a))}function qn(e,t){var a,n=A(e)?e:Za(e);return !(!this.isValid()||!n.isValid())&&("millisecond"===(t=ne(t)||"millisecond")?this.valueOf()===n.valueOf():(a=n.valueOf(),this.clone().startOf(t).valueOf()<=a&&a<=this.clone().endOf(t).valueOf()))}function Zn(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function Jn(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function Kn(e,t,a){var n,i,r;if(!this.isValid())return NaN;if(!(n=fn(e,this)).isValid())return NaN;switch(i=6e4*(n.utcOffset()-this.utcOffset()),t=ne(t)){case "year":r=Xn(this,n)/12;break;case "month":r=Xn(this,n);break;case "quarter":r=Xn(this,n)/3;break;case "second":r=(this-n)/1e3;break;case "minute":r=(this-n)/6e4;break;case "hour":r=(this-n)/36e5;break;case "day":r=(this-n-i)/864e5;break;case "week":r=(this-n-i)/6048e5;break;default:r=this-n;}return a?r:Ie(r)}function Xn(e,t){if(e.date()<t.date())return -Xn(t,e);var a=12*(t.year()-e.year())+(t.month()-e.month()),n=e.clone().add(a,"months");return -(a+(t-n<0?(t-n)/(n-e.clone().add(a-1,"months")):(t-n)/(e.clone().add(a+1,"months")-n)))||0}function Qn(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ei(e){if(!this.isValid())return null;var t=true!==e,a=t?this.clone().utc():this;return a.year()<0||a.year()>9999?W(a,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):x(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",W(a,"Z")):W(a,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function ti(){if(!this.isValid())return "moment.invalid(/* "+this._i+" */)";var e,t,a,n,i="moment",r="";return this.isLocal()||(i=0===this.utcOffset()?"moment.utc":"moment.parseZone",r="Z"),e="["+i+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a="-MM-DD[T]HH:mm:ss.SSS",n=r+'[")]',this.format(e+t+a+n)}function ai(e){e||(e=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var t=W(this,e);return this.localeData().postformat(t)}function ni(e,t){return this.isValid()&&(A(e)&&e.isValid()||Za(e).isValid())?Cn({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function ii(e){return this.from(Za(),e)}function ri(e,t){return this.isValid()&&(A(e)&&e.isValid()||Za(e).isValid())?Cn({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function si(e){return this.to(Za(),e)}function oi(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ba(e))&&(this._locale=t),this)}a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var li=S("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(e){return void 0===e?this.localeData():this.locale(e)}));function ui(){return this._locale}var ci=1e3,di=60*ci,pi=60*di,hi=3506328*pi;function fi(e,t){return (e%t+t)%t}function mi(e,t,a){return e<100&&e>=0?new Date(e+400,t,a)-hi:new Date(e,t,a).valueOf()}function yi(e,t,a){return e<100&&e>=0?Date.UTC(e+400,t,a)-hi:Date.UTC(e,t,a)}function gi(e){var t,n;if(void 0===(e=ne(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?yi:mi,e){case "year":t=n(this.year(),0,1);break;case "quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case "month":t=n(this.year(),this.month(),1);break;case "week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case "isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case "day":case "date":t=n(this.year(),this.month(),this.date());break;case "hour":t=this._d.valueOf(),t-=fi(t+(this._isUTC?0:this.utcOffset()*di),pi);break;case "minute":t=this._d.valueOf(),t-=fi(t,di);break;case "second":t=this._d.valueOf(),t-=fi(t,ci);}return this._d.setTime(t),a.updateOffset(this,true),this}function bi(e){var t,n;if(void 0===(e=ne(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?yi:mi,e){case "year":t=n(this.year()+1,0,1)-1;break;case "quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case "month":t=n(this.year(),this.month()+1,1)-1;break;case "week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case "isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case "day":case "date":t=n(this.year(),this.month(),this.date()+1)-1;break;case "hour":t=this._d.valueOf(),t+=pi-fi(t+(this._isUTC?0:this.utcOffset()*di),pi)-1;break;case "minute":t=this._d.valueOf(),t+=di-fi(t,di)-1;break;case "second":t=this._d.valueOf(),t+=ci-fi(t,ci)-1;}return this._d.setTime(t),a.updateOffset(this,true),this}function vi(){return this._d.valueOf()-6e4*(this._offset||0)}function wi(){return Math.floor(this.valueOf()/1e3)}function _i(){return new Date(this.valueOf())}function Ai(){var e=this;return [e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function ki(){var e=this;return {years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Si(){return this.isValid()?this.toISOString():null}function Ni(){return y(this)}function Ti(){return p({},m(this))}function Mi(){return m(this).overflow}function xi(){return {input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Ci(e,t){var n,i,r,s=this._eras||ba("en")._eras;for(n=0,i=s.length;n<i;++n)switch("string"==typeof s[n].since&&(r=a(s[n].since).startOf("day"),s[n].since=r.valueOf()),typeof s[n].until){case "undefined":s[n].until=1/0;break;case "string":r=a(s[n].until).startOf("day").valueOf(),s[n].until=r.valueOf();}return s}function Vi(e,t,a){var n,i,r,s,o,l=this.eras();for(e=e.toUpperCase(),n=0,i=l.length;n<i;++n)if(r=l[n].name.toUpperCase(),s=l[n].abbr.toUpperCase(),o=l[n].narrow.toUpperCase(),a)switch(t){case "N":case "NN":case "NNN":if(s===e)return l[n];break;case "NNNN":if(r===e)return l[n];break;case "NNNNN":if(o===e)return l[n]}else if([r,s,o].indexOf(e)>=0)return l[n]}function Ii(e,t){var n=e.since<=e.until?1:-1;return void 0===t?a(e.since).year():a(e.since).year()+(t-e.offset)*n}function Ei(){var e,t,a,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e){if(a=this.clone().startOf("day").valueOf(),n[e].since<=a&&a<=n[e].until)return n[e].name;if(n[e].until<=a&&a<=n[e].since)return n[e].name}return ""}function Fi(){var e,t,a,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e){if(a=this.clone().startOf("day").valueOf(),n[e].since<=a&&a<=n[e].until)return n[e].narrow;if(n[e].until<=a&&a<=n[e].since)return n[e].narrow}return ""}function Di(){var e,t,a,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e){if(a=this.clone().startOf("day").valueOf(),n[e].since<=a&&a<=n[e].until)return n[e].abbr;if(n[e].until<=a&&a<=n[e].since)return n[e].abbr}return ""}function Ri(){var e,t,n,i,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e)if(n=r[e].since<=r[e].until?1:-1,i=this.clone().startOf("day").valueOf(),r[e].since<=i&&i<=r[e].until||r[e].until<=i&&i<=r[e].since)return (this.year()-a(r[e].since).year())*n+r[e].offset;return this.year()}function Li(e){return s(this,"_erasNameRegex")||zi.call(this),e?this._erasNameRegex:this._erasRegex}function Pi(e){return s(this,"_erasAbbrRegex")||zi.call(this),e?this._erasAbbrRegex:this._erasRegex}function Bi(e){return s(this,"_erasNarrowRegex")||zi.call(this),e?this._erasNarrowRegex:this._erasRegex}function Oi(e,t){return t.erasAbbrRegex(e)}function $i(e,t){return t.erasNameRegex(e)}function Ui(e,t){return t.erasNarrowRegex(e)}function ji(e,t){return t._eraYearOrdinalRegex||ve}function zi(){var e,t,a,n,i,r=[],s=[],o=[],l=[],u=this.eras();for(e=0,t=u.length;e<t;++e)a=Ve(u[e].name),n=Ve(u[e].abbr),i=Ve(u[e].narrow),s.push(a),r.push(n),o.push(i),l.push(a),l.push(n),l.push(i);this._erasRegex=new RegExp("^("+l.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+s.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+o.join("|")+")","i");}function Wi(e,t){U(0,[e,e.length],0,t);}function Yi(e){return Ki.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Hi(e){return Ki.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function Gi(){return St(this.year(),1,4)}function qi(){return St(this.isoWeekYear(),1,4)}function Zi(){var e=this.localeData()._week;return St(this.year(),e.dow,e.doy)}function Ji(){var e=this.localeData()._week;return St(this.weekYear(),e.dow,e.doy)}function Ki(e,t,a,n,i){var r;return null==e?kt(this,n,i).year:(t>(r=St(e,n,i))&&(t=r),Xi.call(this,e,t,a,n,i))}function Xi(e,t,a,n,i){var r=At(e,t,a,n,i),s=wt(r.year,0,r.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}function Qi(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}U("N",0,0,"eraAbbr"),U("NN",0,0,"eraAbbr"),U("NNN",0,0,"eraAbbr"),U("NNNN",0,0,"eraName"),U("NNNNN",0,0,"eraNarrow"),U("y",["y",1],"yo","eraYear"),U("y",["yy",2],0,"eraYear"),U("y",["yyy",3],0,"eraYear"),U("y",["yyyy",4],0,"eraYear"),Me("N",Oi),Me("NN",Oi),Me("NNN",Oi),Me("NNNN",$i),Me("NNNNN",Ui),De(["N","NN","NNN","NNNN","NNNNN"],(function(e,t,a,n){var i=a._locale.erasParse(e,n,a._strict);i?m(a).era=i:m(a).invalidEra=e;})),Me("y",ve),Me("yy",ve),Me("yyy",ve),Me("yyyy",ve),Me("yo",ji),De(["y","yy","yyy","yyyy"],Be),De(["yo"],(function(e,t,a,n){var i;a._locale._eraYearOrdinalRegex&&(i=e.match(a._locale._eraYearOrdinalRegex)),a._locale.eraYearOrdinalParse?t[Be]=a._locale.eraYearOrdinalParse(e,i):t[Be]=parseInt(e,10);})),U(0,["gg",2],0,(function(){return this.weekYear()%100})),U(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Wi("gggg","weekYear"),Wi("ggggg","weekYear"),Wi("GGGG","isoWeekYear"),Wi("GGGGG","isoWeekYear"),Me("G",we),Me("g",we),Me("GG",he,ue),Me("gg",he,ue),Me("GGGG",ge,de),Me("gggg",ge,de),Me("GGGGG",be,pe),Me("ggggg",be,pe),Re(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,a,n){t[n.substr(0,2)]=Ee(e);})),Re(["gg","GG"],(function(e,t,n,i){t[i]=a.parseTwoDigitYear(e);})),U("Q",0,"Qo","quarter"),Me("Q",le),De("Q",(function(e,t){t[Oe]=3*(Ee(e)-1);})),U("D",["DD",2],"Do","date"),Me("D",he,Ne),Me("DD",he,ue),Me("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),De(["D","DD"],$e),De("Do",(function(e,t){t[$e]=Ee(e.match(he)[0]);}));var er=Ke("Date",true);function tr(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}U("DDD",["DDDD",3],"DDDo","dayOfYear"),Me("DDD",ye),Me("DDDD",ce),De(["DDD","DDDD"],(function(e,t,a){a._dayOfYear=Ee(e);})),U("m",["mm",2],0,"minute"),Me("m",he,Te),Me("mm",he,ue),De(["m","mm"],je);var ar=Ke("Minutes",false);U("s",["ss",2],0,"second"),Me("s",he,Te),Me("ss",he,ue),De(["s","ss"],ze);var nr,ir,rr=Ke("Seconds",false);for(U("S",0,0,(function(){return ~~(this.millisecond()/100)})),U(0,["SS",2],0,(function(){return ~~(this.millisecond()/10)})),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),U(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),U(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),U(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),U(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),U(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),Me("S",ye,le),Me("SS",ye,ue),Me("SSS",ye,ce),nr="SSSS";nr.length<=9;nr+="S")Me(nr,ve);function sr(e,t){t[We]=Ee(1e3*("0."+e));}for(nr="S";nr.length<=9;nr+="S")De(nr,sr);function or(){return this._isUTC?"UTC":""}function lr(){return this._isUTC?"Coordinated Universal Time":""}ir=Ke("Milliseconds",false),U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var ur=_.prototype;function cr(e){return Za(1e3*e)}function dr(){return Za.apply(null,arguments).parseZone()}function pr(e){return e}ur.add=Rn,ur.calendar=zn,ur.clone=Wn,ur.diff=Kn,ur.endOf=bi,ur.format=ai,ur.from=ni,ur.fromNow=ii,ur.to=ri,ur.toNow=si,ur.get=et,ur.invalidAt=Mi,ur.isAfter=Yn,ur.isBefore=Hn,ur.isBetween=Gn,ur.isSame=qn,ur.isSameOrAfter=Zn,ur.isSameOrBefore=Jn,ur.isValid=Ni,ur.lang=li,ur.locale=oi,ur.localeData=ui,ur.max=Ka,ur.min=Ja,ur.parsingFlags=Ti,ur.set=tt,ur.startOf=gi,ur.subtract=Ln,ur.toArray=Ai,ur.toObject=ki,ur.toDate=_i,ur.toISOString=ei,ur.inspect=ti,"undefined"!=typeof Symbol&&null!=Symbol.for&&(ur[Symbol.for("nodejs.util.inspect.custom")]=function(){return "Moment<"+this.format()+">"}),ur.toJSON=Si,ur.toString=Qn,ur.unix=wi,ur.valueOf=vi,ur.creationData=xi,ur.eraName=Ei,ur.eraNarrow=Fi,ur.eraAbbr=Di,ur.eraYear=Ri,ur.year=Ze,ur.isLeapYear=Je,ur.weekYear=Yi,ur.isoWeekYear=Hi,ur.quarter=ur.quarters=Qi,ur.month=ft,ur.daysInMonth=mt,ur.week=ur.weeks=Ct,ur.isoWeek=ur.isoWeeks=Vt,ur.weeksInYear=Zi,ur.weeksInWeekYear=Ji,ur.isoWeeksInYear=Gi,ur.isoWeeksInISOWeekYear=qi,ur.date=er,ur.day=ur.days=Yt,ur.weekday=Ht,ur.isoWeekday=Gt,ur.dayOfYear=tr,ur.hour=ur.hours=ia,ur.minute=ur.minutes=ar,ur.second=ur.seconds=rr,ur.millisecond=ur.milliseconds=ir,ur.utcOffset=yn,ur.utc=bn,ur.local=vn,ur.parseZone=wn,ur.hasAlignedHourOffset=_n,ur.isDST=An,ur.isLocal=Sn,ur.isUtcOffset=Nn,ur.isUtc=Tn,ur.isUTC=Tn,ur.zoneAbbr=or,ur.zoneName=lr,ur.dates=S("dates accessor is deprecated. Use date instead.",er),ur.months=S("months accessor is deprecated. Use month instead",ft),ur.years=S("years accessor is deprecated. Use year instead",Ze),ur.zone=S("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",gn),ur.isDSTShifted=S("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",kn);var hr=I.prototype;function fr(e,t,a,n){var i=ba(),r=h().set(n,t);return i[a](r,e)}function mr(e,t,a){if(u(e)&&(t=e,e=void 0),e=e||"",null!=t)return fr(e,t,a,"month");var n,i=[];for(n=0;n<12;n++)i[n]=fr(e,n,a,"month");return i}function yr(e,t,a,n){"boolean"==typeof e?(u(t)&&(a=t,t=void 0),t=t||""):(a=t=e,e=false,u(t)&&(a=t,t=void 0),t=t||"");var i,r=ba(),s=e?r._week.dow:0,o=[];if(null!=a)return fr(t,(a+s)%7,n,"day");for(i=0;i<7;i++)o[i]=fr(t,(i+s)%7,n,"day");return o}function gr(e,t){return mr(e,t,"months")}function br(e,t){return mr(e,t,"monthsShort")}function vr(e,t,a){return yr(e,t,a,"weekdays")}function wr(e,t,a){return yr(e,t,a,"weekdaysShort")}function _r(e,t,a){return yr(e,t,a,"weekdaysMin")}hr.calendar=F,hr.longDateFormat=G,hr.invalidDate=Z,hr.ordinal=X,hr.preparse=pr,hr.postformat=pr,hr.relativeTime=ee,hr.pastFuture=te,hr.set=C,hr.eras=Ci,hr.erasParse=Vi,hr.erasConvertYear=Ii,hr.erasAbbrRegex=Pi,hr.erasNameRegex=Li,hr.erasNarrowRegex=Bi,hr.months=ut,hr.monthsShort=ct,hr.monthsParse=pt,hr.monthsRegex=gt,hr.monthsShortRegex=yt,hr.week=Nt,hr.firstDayOfYear=xt,hr.firstDayOfWeek=Mt,hr.weekdays=$t,hr.weekdaysMin=jt,hr.weekdaysShort=Ut,hr.weekdaysParse=Wt,hr.weekdaysRegex=qt,hr.weekdaysShortRegex=Zt,hr.weekdaysMinRegex=Jt,hr.isPM=aa,hr.meridiem=ra,ma("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===Ee(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),a.lang=S("moment.lang is deprecated. Use moment.locale instead.",ma),a.langData=S("moment.langData is deprecated. Use moment.localeData instead.",ba);var Ar=Math.abs;function kr(){var e=this._data;return this._milliseconds=Ar(this._milliseconds),this._days=Ar(this._days),this._months=Ar(this._months),e.milliseconds=Ar(e.milliseconds),e.seconds=Ar(e.seconds),e.minutes=Ar(e.minutes),e.hours=Ar(e.hours),e.months=Ar(e.months),e.years=Ar(e.years),this}function Sr(e,t,a,n){var i=Cn(t,a);return e._milliseconds+=n*i._milliseconds,e._days+=n*i._days,e._months+=n*i._months,e._bubble()}function Nr(e,t){return Sr(this,e,t,1)}function Tr(e,t){return Sr(this,e,t,-1)}function Mr(e){return e<0?Math.floor(e):Math.ceil(e)}function xr(){var e,t,a,n,i,r=this._milliseconds,s=this._days,o=this._months,l=this._data;return r>=0&&s>=0&&o>=0||r<=0&&s<=0&&o<=0||(r+=864e5*Mr(Vr(o)+s),s=0,o=0),l.milliseconds=r%1e3,e=Ie(r/1e3),l.seconds=e%60,t=Ie(e/60),l.minutes=t%60,a=Ie(t/60),l.hours=a%24,s+=Ie(a/24),o+=i=Ie(Cr(s)),s-=Mr(Vr(i)),n=Ie(o/12),o%=12,l.days=s,l.months=o,l.years=n,this}function Cr(e){return 4800*e/146097}function Vr(e){return 146097*e/4800}function Ir(e){if(!this.isValid())return NaN;var t,a,n=this._milliseconds;if("month"===(e=ne(e))||"quarter"===e||"year"===e)switch(t=this._days+n/864e5,a=this._months+Cr(t),e){case "month":return a;case "quarter":return a/3;case "year":return a/12}else switch(t=this._days+Math.round(Vr(this._months)),e){case "week":return t/7+n/6048e5;case "day":return t+n/864e5;case "hour":return 24*t+n/36e5;case "minute":return 1440*t+n/6e4;case "second":return 86400*t+n/1e3;case "millisecond":return Math.floor(864e5*t)+n;default:throw new Error("Unknown unit "+e)}}function Er(e){return function(){return this.as(e)}}var Fr=Er("ms"),Dr=Er("s"),Rr=Er("m"),Lr=Er("h"),Pr=Er("d"),Br=Er("w"),Or=Er("M"),$r=Er("Q"),Ur=Er("y"),jr=Fr;function zr(){return Cn(this)}function Wr(e){return e=ne(e),this.isValid()?this[e+"s"]():NaN}function Yr(e){return function(){return this.isValid()?this._data[e]:NaN}}var Hr=Yr("milliseconds"),Gr=Yr("seconds"),qr=Yr("minutes"),Zr=Yr("hours"),Jr=Yr("days"),Kr=Yr("months"),Xr=Yr("years");function Qr(){return Ie(this.days()/7)}var es=Math.round,ts={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function as(e,t,a,n,i){return i.relativeTime(t||1,!!a,e,n)}function ns(e,t,a,n){var i=Cn(e).abs(),r=es(i.as("s")),s=es(i.as("m")),o=es(i.as("h")),l=es(i.as("d")),u=es(i.as("M")),c=es(i.as("w")),d=es(i.as("y")),p=r<=a.ss&&["s",r]||r<a.s&&["ss",r]||s<=1&&["m"]||s<a.m&&["mm",s]||o<=1&&["h"]||o<a.h&&["hh",o]||l<=1&&["d"]||l<a.d&&["dd",l];return null!=a.w&&(p=p||c<=1&&["w"]||c<a.w&&["ww",c]),(p=p||u<=1&&["M"]||u<a.M&&["MM",u]||d<=1&&["y"]||["yy",d])[2]=t,p[3]=+e>0,p[4]=n,as.apply(null,p)}function is(e){return void 0===e?es:"function"==typeof e&&(es=e,true)}function rs(e,t){return void 0!==ts[e]&&(void 0===t?ts[e]:(ts[e]=t,"s"===e&&(ts.ss=t-1),true))}function ss(e,t){if(!this.isValid())return this.localeData().invalidDate();var a,n,i=false,r=ts;return "object"==typeof e&&(t=e,e=false),"boolean"==typeof e&&(i=e),"object"==typeof t&&(r=Object.assign({},ts,t),null!=t.s&&null==t.ss&&(r.ss=t.s-1)),n=ns(this,!i,r,a=this.localeData()),i&&(n=a.pastFuture(+this,n)),a.postformat(n)}var os=Math.abs;function ls(e){return (e>0)-(e<0)||+e}function us(){if(!this.isValid())return this.localeData().invalidDate();var e,t,a,n,i,r,s,o,l=os(this._milliseconds)/1e3,u=os(this._days),c=os(this._months),d=this.asSeconds();return d?(e=Ie(l/60),t=Ie(e/60),l%=60,e%=60,a=Ie(c/12),c%=12,n=l?l.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",r=ls(this._months)!==ls(d)?"-":"",s=ls(this._days)!==ls(d)?"-":"",o=ls(this._milliseconds)!==ls(d)?"-":"",i+"P"+(a?r+a+"Y":"")+(c?r+c+"M":"")+(u?s+u+"D":"")+(t||e||l?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(l?o+n+"S":"")):"P0D"}var cs=on.prototype;return cs.isValid=rn,cs.abs=kr,cs.add=Nr,cs.subtract=Tr,cs.as=Ir,cs.asMilliseconds=Fr,cs.asSeconds=Dr,cs.asMinutes=Rr,cs.asHours=Lr,cs.asDays=Pr,cs.asWeeks=Br,cs.asMonths=Or,cs.asQuarters=$r,cs.asYears=Ur,cs.valueOf=jr,cs._bubble=xr,cs.clone=zr,cs.get=Wr,cs.milliseconds=Hr,cs.seconds=Gr,cs.minutes=qr,cs.hours=Zr,cs.days=Jr,cs.weeks=Qr,cs.months=Kr,cs.years=Xr,cs.humanize=ss,cs.toISOString=us,cs.toString=us,cs.toJSON=us,cs.locale=oi,cs.localeData=ui,cs.toIsoString=S("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",us),cs.lang=li,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Me("x",we),Me("X",ke),De("X",(function(e,t,a){a._d=new Date(1e3*parseFloat(e));})),De("x",(function(e,t,a){a._d=new Date(Ee(e));})),
4602
+ let s$1 = class s{func;owner;constructor(e,t){this.func=e,this.owner=t;}};let o$1 = class o{_debugMode=false;_listeners=new Map;_onceListeners=new Map;_catchAllListeners=[];_capturedEvents=new Map;_capturedAccumulatedDuration=0;constructor(){}setDebugMode(e){this._debugMode&&!e&&(console.log("Captured events: ",this._capturedEvents),console.log(`Total duration: ${this._capturedAccumulatedDuration}ms`)),this._debugMode=e,this._capturedEvents=new Map,this._capturedAccumulatedDuration=0;}$clear(){this._listeners.clear(),this._onceListeners.clear();}clearCatchAllListeners(){this._catchAllListeners=[];}listenerCount(e){let t=0;return t+=this._listeners.get(e)?.length||0,t+=this._onceListeners.get(e)?.length||0,t}$hasListener(e){return this.listenerCount(e)>0}$catchAll(e,t){this._catchAllListeners.push(new s$1(e,t));}$on(e,t,a){let i;this._listeners.has(e)?i=this._listeners.get(e):(i=[],this._listeners.set(e,i)),i.push(new s$1(t,a));}$once(e,t,a){let i;this._onceListeners.has(e)?i=this._onceListeners.get(e):(i=[],this._onceListeners.set(e,i)),i.push(new s$1(t,a));}$off(e,t,a){let i=0;if(this._listeners.has(e)){i+=this._listeners.get(e).removeByFilterFunc((e=>e.func===t&&e.owner===a));}if(this._onceListeners.has(e)){i+=this._onceListeners.get(e).removeByFilterFunc((e=>e.func===t&&e.owner===a));}return i}$offByOwner(e,t){let a=0;if(this._listeners.has(e)){a+=this._listeners.get(e).removeByFilterFunc((e=>e.owner===t));}if(this._onceListeners.has(e)){a+=this._onceListeners.get(e).removeByFilterFunc((e=>e.owner===t));}return a}$emitSync(e,...t){const a=[],i=performance.now();let n=0;try{for(const i of this._catchAllListeners.values())try{const r=i.func.call(i.owner,e,...t);r&&r.then&&a.push(r),n++;}catch(e){console.error(e);}if(this._listeners.has(e)){const i=this._listeners.get(e);for(const e of i)try{const i=e.func.call(e.owner,...t);i&&i.then&&a.push(i),n++;}catch(e){console.error(e);}}if(this._onceListeners.has(e)){const i=this._onceListeners.get(e);for(const e of i)try{const i=e.func.call(e.owner,...t);i&&i.then&&a.push(i),n++;}catch(e){console.error(e);}this._onceListeners.set(e,[]);}}catch(e){console.error(e);}if(this._debugMode&&"log"!==e){const t=performance.now(),r=Math.floor(t-i);let s=this._capturedEvents.get(e);s?(s.count++,s.duration+=r,s.promises+=a.length,s.sentTo+=n):(s={eventType:e,count:1,duration:r,promises:a.length,sentTo:n},this._capturedEvents.set(e,s)),r>3&&console.log(`Expensive event ${e}: ${r}ms`);}return a.length>0?Promise.all(a):null}$emit(e,...t){return new Promise((a=>{a(this.$emitSync(e,...t));}))}};const l$1=new o$1;let u$2 = class u{type;itemId;elementId;target;prop;value;oldValue;createdAt=Date.now();moveTargetArray;moveTargetArrayIndex;moveTargetElementId;start;length;position;elementsToDelete;field;fieldId;isLink;bundleIndex=0;_undoFunction;_redoFunction;constructor(e,t,a,i,n,r,s){this.type=e,this.itemId=t,this.elementId=a,this.target=i,this.prop=n,this.value=r,this.oldValue=s;}async undo(){this._undoFunction&&await this._undoFunction();}async redo(){this._redoFunction&&await this._redoFunction();}setUndoFunction(e){this._undoFunction=e;}setRedoFunction(e){this._redoFunction=e;}setMoveTarget(e,t,a){this.moveTargetArray=e,this.moveTargetArrayIndex=t,this.moveTargetElementId=a;}setRange(e,t){this.start=e,this.length=t;}setPosition(e){this.position=e;}setElementsToDelete(e){this.elementsToDelete=e;}setField(e){this.field=e;}setFieldId(e){this.fieldId=e;}setIsLink(e){this.isLink=e;}clone(){return Object.assign(new u,this)}isWithinMergeDeltaOf(e,t){return Math.abs(e.createdAt-this.createdAt)<=t}isMergeableWith(e,t){if(!this.isWithinMergeDeltaOf(e,t))return false;const a=e.type===this.type&&e.itemId===this.itemId&&e.elementId===this.elementId&&e.target===this.target&&e.prop===this.prop,i=void 0!==e.value&&void 0!==e.oldValue&&void 0===e.start&&void 0===e.length&&void 0===e.position&&void 0===e.elementsToDelete;return a&&i}merge(e,t){if(!this.isMergeableWith(e,t))return null;let a=this.clone();return a.value=e.value,a.createdAt=e.createdAt,a._redoFunction=e._redoFunction,a}};const c$1=new e$1({dictionary:"hex",length:12});let d$1=(new Date).valueOf();var p={createItemOrBlockID:function(){return c$1.rnd()},createFieldID:function(){return (d$1++).toString()},createGUID:function(){return c$1.rnd()},createGeneratedItemId:function(){return "gen_"+this.createGUID()},toUserFriendlyName:function(e){return e.replace(/_./g,(e=>e.charAt(1).toUpperCase())).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^(.)/,(e=>e.toUpperCase()))},assert:function(e,t){e||console.error(`ASSERTION FAILED: '${e}' is untrue: ${t}`);},matchItemIdAndObject:(e,t)=>!(!e||!t)&&(e._id===t||e===t._id),getDepth(e,t=new WeakSet){if(null===e||"object"!=typeof e)return 1;const a=e;if(t.has(a))return 0;t.add(a);const i=Array.isArray(a)?a:Object.values(a);let n=0;for(const e of i){const a=this.getDepth(e,t);a>n&&(n=a);}return 1+n},areValuesEqual(e,t,a=3){if(e===t)return true;if("number"==typeof e&&"number"==typeof t)return isNaN(e)&&isNaN(t);if(null==e||null==t||typeof e!=typeof t)return false;if("object"!=typeof e)return false;if(Array.isArray(e)!==Array.isArray(t))return false;if(e._id&&e._id!==t._id)return false;const i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return false;for(let n of i){if(!Object.prototype.hasOwnProperty.call(t,n))return false;if(a>0&&!this.areValuesEqual(e[n],t[n],a-1))return false}return true},startTimer(e){const t=Date.now();return e&&console.log(`[TIMER] - ${e}`),function(e){const a=Date.now()-t;e?console.log(`[TIMER] - ${e}: ${a}ms`):console.log(`[TIMER] - ${a}ms`);}},dataURItoBlob(e){const t=e.split(",")[0].split(":")[1].split(";")[0],a=atob(e.split(",")[1]),i=[];for(let e=0;e<a.length;e++)i.push(a.charCodeAt(e));return new Blob([new Uint8Array(i)],{type:t})},xmur3(e){let t=1779033703^e.length;for(let a=0;a<e.length;a++)t=Math.imul(t^e.charCodeAt(a),3432918353),t=t<<13|t>>>19;return ()=>(t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),t^=t>>>16,t>>>0)},mulberry32:e=>()=>{let t=e+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},hslToRgb(e,t,a){const i=(1-Math.abs(2*a-1))*t,n=e/60,r=i*(1-Math.abs(n%2-1));let[s,o,l]=[0,0,0];[s,o,l]=n>=0&&n<1?[i,r,0]:n<2?[r,i,0]:n<3?[0,i,r]:n<4?[0,r,i]:n<5?[r,0,i]:[i,0,r];const u=a-i/2;return [Math.round(255*(s+u)),Math.round(255*(o+u)),Math.round(255*(l+u))]},rgbToHex:(e,t,a)=>"#"+[e,t,a].map((e=>e.toString(16).padStart(2,"0"))).join(""),colorFromString(e,t={}){const{minS:a=.72,maxS:i=.97,minL:n=.48,maxL:r=.62,return:s="hex"}=t,o=this.xmur3(e)(),l=this.mulberry32(o),u=Math.floor(360*l()),c=a+l()*(i-a),d=n+l()*(r-n);if("hsl"===s)return `hsl(${u} ${Math.round(100*c)}% ${Math.round(100*d)}%)`;const[p,h,f]=this.hslToRgb(u,c,d);return "rgb"===s?`rgb(${p}, ${h}, ${f})`:this.rgbToHex(p,h,f)},async downloadFile(e,a){if(e.startsWith("blob:")){const t=await fetch(e),a=await t.blob();return {data:a,mimeType:a.type}}return axios.get(e,{responseType:"blob",onDownloadProgress:e=>{if(a&&e.total){const t=Math.round(100*e.loaded/e.total);a(t,e.total,e.loaded);}}})}};const h$1=new Set(["dependantFields","conditionFields","dependenciesInitialized","_hidden","_updateConditions","userData","condition","conditionFieldNames","separatorFields","collapsed","_internalValue"]),f=new Set(["__proto__","__ob__","isSelected","isDirty","options","_hidden","_updateConditions","dependantFields","conditionFields","separatorFields","dependenciesInitialized","order","inject","type","datatype","minValue","maxValue","id","_id","linkableTypes","info","userData","condition","conditionFieldNames","collapsed","_internalValue"]),m=new Set(["isSelected","isDirty","_hidden","_updateConditions","options","dependantFields","conditionFields","separatorFields","dependenciesInitialized","id","_id","linkableTypes","info","userData"]);let y$1 = class y{suppressDirty=false;undoManager;_promises=[];_capturePromises=false;_profiledEvents=[];_profiling=false;_profilerStartTime=0;_profiledCount=0;static _instance;static get instance(){return this._instance||(this._instance=new this)}constructor(){}suppressDirtyFlag(e){this.suppressDirty=e;}setUndoManager(e){this.undoManager=e;}isUndoManagerActive(){return this.undoManager?.getEnabled()}_postUndoManagerEvent(e){this.undoManager&&(m.has(e.prop)||this.undoManager.event(e));}setItemDirty(e,t,a,i){this.suppressDirty||e.isDirty||a===i||f.has(t)||e.markDirty();}capturePromise(e){try{return this._capturePromises=!0,e(),Promise.all(this._promises)}finally{this._capturePromises=false,this._promises=[];}}startProfiling(){this._profiling=true,this._profiledEvents=[],this._profiledCount=0,this._profilerStartTime=performance.now(),l$1.setDebugMode(true);}endProfiling(){const e=performance.now()-this._profilerStartTime;l$1.setDebugMode(false),console.log("Profiled events: ",this._profiledEvents),console.log(`Profiling took ${e}ms`);}_addPromise(e){this._capturePromises&&this._promises.push(e);}_proxyObject(e,t,a,i){const n=this;if(!e)throw "_proxyObject(): Object is not defined. Cannot create proxy!";if(!a)throw "_proxyObject(): Item is not defined. Cannot create proxy!";if(!i)throw "_proxyObject(): Options is not defined. Cannot create proxy!";return new Proxy(e,{set:function(r,s,o){if(h$1.has(s))return Reflect.set(r,s,o);const c=performance.now();let d=n.isUndoManagerActive();const f=Reflect.get(r,s);if(p.areValuesEqual(f,o))return true;let m=Reflect.set(r,s,o);function y(n,o){const l=new u$2(i.proxyEventTypeName,a._id,t?t.id:null,r,s,n,o);return i.isField&&(l.setField(e.name),l.setFieldId(e.id)),void 0!==i.isLink&&l.setIsLink(i.isLink),l}i.changeDoesNotMakeItemDirty||(p.matchItemIdAndObject(f,o)?d=false:n.setItemDirty(a,s,f,o));const g=y(o,f);d&&(g.setUndoFunction((()=>{Reflect.set(r,s,g.oldValue);const e=y(g.oldValue,g.value);l$1.$emitSync("proxy:valueChange",e),i.changeEventFunc(e);})),g.setRedoFunction((()=>{Reflect.set(r,s,g.value);const e=y(g.value,g.oldValue);l$1.$emitSync("proxy:valueChange",e),i.changeEventFunc(e);}))),i.changeEventFunc(g),d&&n._postUndoManagerEvent(g),l$1.$emitSync("proxy:valueChange",g);const b=performance.now();return n._profiledCount++,n._profiledEvents.push({event:g,type:"object",duration:b-c}),m}})}_proxyArray(e,t,a,i){const n=this;if(!e)throw "_proxyArray(): Array is not defined. Cannot create proxy!";if(!a)throw "_proxyArray(): Item is not defined. Cannot create proxy!";if(!i)throw "_proxyArray(): Options is not defined. Cannot create proxy!";return new Proxy(e,{set(e,r,s){const o=performance.now(),c=Reflect.get(e,r);let d=Reflect.set(e,r,s);if("length"!==r&&"__proto__"!==r){const p=n.isUndoManagerActive();function h(n,s){const o=new u$2("arraySetValue",a._id,t?t.id:null,e,r,n,s);return i.field&&(o.setField(i.field.name),o.setFieldId(i.field.id)),o}i.changeDoesNotMakeItemDirty||n.setItemDirty(a,r,c,s);const f=h(s,c);p&&(f.setUndoFunction((()=>{const t=h(f.oldValue,f.value),a=parseInt(r);if(void 0===f.oldValue&&e.length-1===a){const i=e.pop();t.setElementsToDelete([i]),t.setRange(a,1);}else Reflect.set(e,r,f.oldValue);l$1.$emitSync("proxy:valueChange",t),i.deleteEventFunc(t);})),f.setRedoFunction((()=>{Reflect.set(e,r,f.value);const t=h(f.value,f.oldValue);l$1.$emitSync("proxy:valueChange",t),i.addEventFunc(t);}))),i.addEventFunc(f),p&&n._postUndoManagerEvent(f),l$1.$emitSync("proxy:valueChange",f);const m=performance.now();n._profiledCount++,n._profiledEvents.push({event:f,type:"set_array",duration:m-o});}return d},get(r,s){if("splice"===s){const e=Reflect.get(r,s);return function(...o){const c=o[0],d=o[1],p=[];for(let e=c;e<c+d;e++){const t=r[e];p.push(t);}function h(e,n,s){const o=new u$2("arraySpliceRemove",a._id,t?t.id:null,r);return i.field&&(o.setField(i.field.name),o.setFieldId(i.field.id)),o.setRange(e,n),o.setElementsToDelete(s),o}function f(e,n){const o=new u$2("arraySpliceAdd",a._id,t?t.id:null,r,s,n);return i.field&&(o.setField(i.field.name),o.setFieldId(i.field.id)),o.setPosition(e),o}if(e.apply(r,o),n.setItemDirty(a,s,true,false),d>0&&o.length<3){const e=n.isUndoManagerActive(),t=h(c,d,p);e&&(t.setUndoFunction((()=>{r.splice(c,0,...p);const e=f(c,p);l$1.$emitSync("proxy:valueChange",e),i.addEventFunc(e);})),t.setRedoFunction((()=>{r.splice(c,d);const e=h(c,d,p);l$1.$emitSync("proxy:valueChange",e),i.deleteEventFunc(e);}))),i.deleteEventFunc(t),e&&n._postUndoManagerEvent(t),l$1.$emitSync("proxy:valueChange",t);}else if(o.length>2){const e=o.slice(2),t=f(c,e);t.setPosition(c),t.setUndoFunction((()=>{r.splice(c,e.length);const t=h(c,e.length,e);l$1.$emitSync("proxy:valueChange",t),i.deleteEventFunc(t);})),t.setRedoFunction((()=>{r.splice(c,0,...e);const t=f(c,e);l$1.$emitSync("proxy:valueChange",t),i.addEventFunc(t);})),i.addEventFunc(t),n._postUndoManagerEvent(t),l$1.$emitSync("proxy:valueChange",t);}}}return "moveToArray"===s?function(e,o,c){const d=r,p=t,{array:h,element:f}=o.getTargetArrayAndElement();function m(e,t,a,i){i=void 0===i?a.length:i;const n=Reflect.get(e,"splice").apply(e,[t,1]);if(n.length>0){const e=n[0];return Reflect.get(a,"splice").apply(a,[i,0,e]),e}return null}const y=m(d,e,h,c);if(y){function g(e,i,n,r,s,o){const l=new u$2("arrayMoveToArray",a._id,t?t.id:null,e,void 0,o);return l.setRange(i,1),l.setMoveTarget(n,r,s?s.id:null),l}n.setItemDirty(a,s,true,false);const b=n.isUndoManagerActive(),v=g(d,e,o,c,f,y);b&&(v.setUndoFunction((()=>{const t=m(h,c,d,e),a=g(o,c,d,e,p,t);l$1.$emitSync("proxy:valueChange",a),i.moveEventFunc(a);})),v.setRedoFunction((()=>{const t=m(d,e,h,c),a=g(d,e,o,c,f,t);l$1.$emitSync("proxy:valueChange",a),i.moveEventFunc(a);}))),i.moveEventFunc(v),b&&n._postUndoManagerEvent(v),l$1.$emitSync("proxy:valueChange",v);}}:"getTargetArrayAndElement"===s?function(){return {array:e,element:t}}:("move"===s&&console.warn("'move' prop is not implemented in Proxifier"),Reflect.get(r,s))}})}proxyBlockArray(e,t,a){return this._proxyArray(e,t,a,{addEventFunc:e=>{this._addPromise(l$1.$emit("itemRepo:blockAdded",e));},deleteEventFunc:e=>{this._addPromise(l$1.$emit("itemRepo:blockDeleted",e));},moveEventFunc:e=>{this._addPromise(l$1.$emit("itemRepo:blockMoved",e));}})}proxyListArray(e,t,a){return this._proxyArray(e,null,a,{field:t,addEventFunc:function(e){l$1.$emit("itemRepo:listEntryAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:listEntryDeleted",e);}})}proxyScriptArray(e,t,a){return this._proxyArray(e,t,a,{addEventFunc:function(e){l$1.$emit("itemRepo:scriptAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:scriptDeleted",e);}})}proxyBlock(e,t){return this._proxyObject(e,e,t,{isLink:true,changeEventFunc:function(e){l$1.$emit("itemRepo:fieldChanged",e),l$1.$emit("itemRepo:linkChanged",e);},proxyEventTypeName:"blockSetValue"})}proxyGraphBlock(e,t){return this._proxyObject(e,e,t,{isLink:true,changeEventFunc:function(e){l$1.$emit("itemRepo:graphNodeChanged",e);},proxyEventTypeName:"blockSetValue"})}proxyGraphBlockArray(e,t){return this._proxyArray(e,t,t,{addEventFunc:function(e){l$1.$emit("itemRepo:graphNodeAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:graphNodeDeleted",e);}})}proxyConnection(e,t){return this._proxyObject(e,t,t,{changeEventFunc:function(e){l$1.$emit("itemRepo:graphConnectionChanged",e);},proxyEventTypeName:"connectionSetValue"})}proxyConnectionArray(e,t){return this._proxyArray(e,e,t,{addEventFunc:function(e){l$1.$emit("itemRepo:graphConnectionAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:graphConnectionDeleted",e);}})}proxyItemField(e,t){const a="Link"===e.type;return this._proxyObject(e,null,t,{isLink:a,isField:true,changeEventFunc:function(e){l$1.$emit("itemRepo:fieldChanged",e),a&&l$1.$emit("itemRepo:linkChanged",e);},proxyEventTypeName:"itemFieldSetValue"})}proxyGraphBlockField(e,t,a){return this._proxyObject(e,t,a,{isLink:"Link"===e.type,isField:true,changeEventFunc:function(e){l$1.$emit("itemRepo:graphNodeFieldChanged",e);},proxyEventTypeName:"blockFieldSetValue"})}proxyBlockField(e,t,a){const i="Link"===e.type;return this._proxyObject(e,t,a,{isLink:i,isField:true,changeEventFunc:function(e){l$1.$emit("itemRepo:fieldChanged",e),i&&l$1.$emit("itemRepo:linkChanged",e);},proxyEventTypeName:"blockFieldSetValue"})}proxyScriptItem(e,t,a){return this._proxyObject(e,t,a,{isLink:true,changeEventFunc:function(e){l$1.$emit("itemRepo:scriptItemChanged",e);},proxyEventTypeName:"scriptItemSetValue"})}proxyScriptFieldsArray(e,t,a){return this._proxyArray(e,t,a,{addEventFunc:function(e){l$1.$emit("itemRepo:scriptFieldAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:scriptFieldDeleted",e);},changeDoesNotMakeItemDirty:true})}proxyScriptField(e,t,a){const i="Link"===e.type||"LinkArray"===e.type;return this._proxyObject(e,t,a,{isLink:i,isField:true,changeEventFunc:function(t){l$1.$emit("itemRepo:scriptFieldChanged",t),"Link"!==e.type&&"LinkArray"!==e.type||l$1.$emit("itemRepo:linkChanged",t);},proxyEventTypeName:"itemScriptFieldSetValue",changeDoesNotMakeItemDirty:false})}proxyCustomFieldsArray(e,t){return this._proxyArray(e,null,t,{addEventFunc:function(e){l$1.$emit("itemRepo:customFieldAdded",e);},deleteEventFunc:function(e){l$1.$emit("itemRepo:customFieldDeleted",e);},changeDoesNotMakeItemDirty:true})}proxyCustomField(e,t){return this._proxyObject(e,null,t,{isLink:false,isField:true,changeEventFunc:function(e){l$1.$emit("itemRepo:customFieldChanged",e);},proxyEventTypeName:"itemCustomFieldSetValue",changeDoesNotMakeItemDirty:false})}};let g$1 = class g{level;name;times;durations=[];childrenMap=new Map;children=[];parent;constructor(e,t,a,i){this.name=e,this.level=t,this.times=[a],this.parent=i;}};function b(e,t){return w.instance.block(e,t)}async function v(e,t){return w.instance.asyncBlock(e,t)}function _(e,t){const a=performance.now();let i=false;try{const n=e();return n?.then?(i=!0,n.then((()=>{console.log(`[TIMING] for ${t||e.name||"<unknown>"}: ${Math.ceil(performance.now()-a)}ms`);}))):n}finally{i||console.log(`[TIMING] for ${t||e.name||"<unknown>"}: ${Math.ceil(performance.now()-a)}ms`);}}class w{startTime=0;endTime=0;startIteration=0;currentLevel=0;root=new g$1("root",0,0,void 0);currentEntry;active=false;static _instance;static get instance(){return this._instance||(this._instance=new this)}constructor(){this.currentEntry=this.root;}start(){this.startTime=performance.now(),this.startIteration=this.startTime,this.root=new g$1("root",0,0,void 0),this.currentEntry=this.root,this.currentLevel=0,this.active=true;}end(e=false){this.active=false,this.endTime=performance.now()-this.startTime,this.root.durations.push(this.endTime-this.root.times[0]),e&&this.printResults();}_iterate(e,t){e(t=t||this.root);for(const a of t.children)this._iterate(e,a);}getResults(){const e=[];function t(e){return Math.round(1e3*e)/1e3}function a(e){return e.reduce(((e,t)=>e+t),0)}return this._iterate((function(i){const n=t(a(i.times)/i.times.length),r=t(a(i.durations)/i.durations.length),s=t(a(i.durations)),o=t(s-i.children.reduce(((e,t)=>e+a(t.durations)),0));e.push({name:"".padStart(2*i.level," .")+i.name,executions:i.times.length,avgTimeStartMs:n,avgTimeEndMs:t(n+r),avgDurationMs:r,totalDurationMs:s,selfDurationMs:o});})),e}printResults(){console.table(this.getResults(),["name","executions","avgTimeStartMs","avgTimeEndMs","avgDurationMs","totalDurationMs","selfDurationMs"]);}newIteration(){this.startIteration=performance.now(),this.currentLevel=0;}async asyncBlock(e,t){if(!this.active)return t();let a;try{return a=this.beginBlock(e),await t()}finally{this.endBlock(a);}}block(e,t){if(!this.active)return t();let a;try{return a=this.beginBlock(e),t()}finally{this.endBlock(a);}}beginBlock(e){if(!this.active)return;this.currentLevel++;const t=performance.now()-this.startIteration;let a=this.currentEntry.childrenMap.get(e);return a?a.times.push(t):(a=new g$1(e,this.currentLevel,t,this.currentEntry),this.currentEntry.children.push(a),this.currentEntry.childrenMap.set(e,a)),this.currentEntry=a,a}endBlock(e){if(!e)return;const t=performance.now()-this.startIteration-e.times[e.times.length-1];e.durations.push(t),this.currentEntry=e.parent,this.currentLevel--;}}let A$6 = class A extends Error{constructor(e,t){super(e),t&&(this.name=t);}toString(){return this.name?`${this.name}: ${this.message}`:this.message}};class k extends A$6{constructor(e){super(e,"InvalidArgumentException");}}let S$1 = class S extends A$6{constructor(e){super(e,"InvalidStateException");}};let N$1 = class N extends A$6{constructor(e){super(e,"RuntimeException");}};let T$1 = class T extends A$6{constructor(e){super(e,"LoaderException");}};class M extends A$6{constructor(e){super(e,"QuotaExceededException");}}let x$2 = class x extends A$6{constructor(e){super(e,"AccessDeniedException");}};let V=class{_id;name;folder;folderPath;links;attributes;userAttributes;filename;createdAt;updatedAt;version;filesize;hash;mimeType;type;packageType;createdBy;updatedBy;acl;visibility;properties;allowConversation;conversation;tags;contributors;description;shortDescription;userAttributeTemplate;categories;attachments;license;quotaUser;quotaGroup;itemSize;totalSize;flags;perceptiveHash;unpackagedSize;location;itemFlag;constructor(e){if(this._id=e._id,this.name=e.name,this.folder=e.folder,this.folderPath=e.folderPath,this.links=[],Array.isArray(e.links))for(const t of e.links)this.links.push({to:t.to,usage:t.usage});this.attributes=JSON.parse(JSON.stringify(e.attributes||{})),this.userAttributes=JSON.parse(JSON.stringify(e.userAttributes||{})),this.filename=e.filename,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt,this.version={major:e.version?.major||0,minor:e.version?.minor||0,revision:e.version?.revision||1},this.filesize=e.filesize,this.hash=e.hash,this.mimeType=e.mimeType,this.type=e.type,this.packageType=e.packageType,this.createdBy=e.createdBy,this.updatedBy=e.updatedBy,this.acl=JSON.parse(JSON.stringify(e.acl||[])),this.visibility=e.visibility,this.properties=JSON.parse(JSON.stringify(e.properties||{})),this.allowConversation=e.allowConversation,this.conversation=e.conversation,this.tags=JSON.parse(JSON.stringify(e.tags||[])),this.contributors=JSON.parse(JSON.stringify(e.contributors||[])),this.description=e.description,this.shortDescription=e.shortDescription,this.userAttributeTemplate=e.userAttributeTemplate,this.categories=e.categories,this.attachments=JSON.parse(JSON.stringify(e.attachments||[])),this.license=e.license,this.quotaUser=e.quotaUser,this.quotaGroup=e.quotaGroup,this.itemSize=e.itemSize,this.totalSize=e.totalSize,this.flags=JSON.parse(JSON.stringify(e.flags||[])),this.perceptiveHash=e.perceptiveHash,this.unpackagedSize=e.unpackagedSize,this.location=e.location,this.itemFlag=JSON.parse(JSON.stringify(e.itemFlag||{}));}};let C$1 = class C extends V{links;thumbnails;fieldSets;fields;userFields;isAggregatedItem=true;constructor(e){if(super(e),this.links=[],Array.isArray(e.links))for(const t of e.links)this.links.push({to:t.to,usage:t.usage,stopRecursion:t.stopRecursion});this.thumbnails=JSON.parse(JSON.stringify(e.thumbnails||[])),this.fieldSets=JSON.parse(JSON.stringify(e.fieldSets||[])),this.fields=JSON.parse(JSON.stringify(e.fields||[])),this.userFields=JSON.parse(JSON.stringify(e.userFields||[]));}};var I$1=[{_id:{$oid:"5e6a1ace89707feef5738292"},contentTypes:["model/splat"],fieldSets:[],fields:[],name:"Gaussian Splats",updateRequiresThumbRefresh:true,creatableEmpty:false},{_id:{$oid:"5e6a1ace89707eee5523aa61"},contentTypes:["application/json"],fieldSets:[],fields:[],name:"Structured Data",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ace89707feef3748569"},contentTypes:[],fieldSets:[],fields:[{label:"Scenes",type:"Separator"},{elementName:"Scene",fields:[{linkableTypes:["Scene"],type:"Link",usageAs:"Scene",mandatory:true},{datatype:"Boolean",defaultValue:true,displayName:"Load",name:"Load",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Active",if:{Load:true},name:"Active",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Primary",name:"Primary",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Exclude in packages",name:"ExcludeInPackages",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},name:"Transform",type:"Attribute"}],name:"Scenes",type:"List"},{label:"Variable Sets",type:"Separator",collapsed:true},{displayName:"Variable sets",elementName:"Variable set",fields:[{displayName:"Variable set",linkableTypes:["Variable Set"],type:"Link",usageAs:"VariableSet",mandatory:true},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"}],name:"VariableSets",type:"List"},{label:"Graphics",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Not defined",displayName:"Aspect ratio",info:"This determines the project's aspect ratio. If not defined, the game will run in the default aspect depending on platform and browser size",name:"AspectRatio",options:["Not defined","Standard (4:3)","Widescreen (16:9)","Ultrawide (21:9)","Custom"],type:"Attribute"},{datatype:"Float",defaultValue:1.3,minValue:.1,maxValue:10,displayName:"Custom Aspect",if:{AspectRatio:"Custom"},name:"CustomAspect",type:"Attribute"},{label:"Physics",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Enabled",name:"PhysicsEnabled",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:-9.81,z:0},displayName:"Gravity",if:{PhysicsEnabled:true},name:"Gravity",type:"Attribute"},{datatype:"LayerMatrix",defaultValue:[[0]],displayName:"Collision matrix",if:{PhysicsEnabled:true},info:"This controls which physics object interact with which others depending on their layers",name:"CollisionMatrix",type:"Attribute"},{datatype:"StringList",defaultValue:["Default","Terrain","TransparentFX","Water"],displayName:"Layer names",fixedLength:true,info:"Names of the layers to use with all scenegraph nodes",name:"LayerNames",type:"Attribute"},{label:"Resources",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"After loading everything",displayName:"Start execution",info:"This controls when the engine will start execution of the project in the player",name:"StartExecution",options:["Right away","After loading minimum LOD","After loading everything"],type:"Attribute"},{label:"Controls",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Automatic pointer lock",name:"AutomaticPointerLock",type:"Attribute",info:"Enabling this will cause the mouse pointer to be locked until Escape is pressed"},{label:"Canvas Fonts",type:"Separator",collapsed:true},{displayName:"Canvas fonts",elementName:"Font",fields:[{displayName:"Font",linkableTypes:["Font"],type:"Link",usageAs:"Font",mandatory:true}],name:"CanvasFonts",type:"List"}],name:"Project",recursiveLoadStopsHere:true,updateRequiresThumbRefresh:false,creatableEmpty:false},{_id:{$oid:"5e6a1ace24a07f56f3742569"},contentTypes:[],fieldSets:[],fields:[{elementName:"Variable",fields:[{datatype:"String",defaultValue:"Name",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Enum",defaultValue:"Integer",displayName:"Type",name:"Type",options:["Integer","Float","String","Boolean"],type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Value",if:{Type:"Boolean"},name:"BooleanValue",type:"Attribute"},{datatype:"Integer",defaultValue:0,displayName:"Value",if:{Type:"Integer"},name:"IntegerValue",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Value",if:{Type:"Float"},name:"FloatValue",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Value",if:{Type:"String"},name:"StringValue",type:"Attribute"}],name:"Variables",type:"List"}],name:"Variable Set",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ace89707feef9173386"},contentTypes:["audio/mpeg"],fieldSets:[],fields:[{datatype:"Float",defaultValue:1,displayName:"Volume",maxValue:1,minValue:0,name:"Volume",type:"Attribute",widget:"Slider"}],name:"Audio",updateRequiresThumbRefresh:false,creatableEmpty:false},{_id:{$oid:"5e6a1acf89707feef917338f"},contentTypes:["*"],fieldSets:[],fields:[],name:"Binary",creatableEmpty:false},{_id:{$oid:"5e6a1acf89707feef917337f"},contentTypes:["application/vnd.lumino.package"],fieldSets:[],fields:[],name:"Package",creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173391"},contentTypes:["image/vnd.radiance"],fieldSets:[],fields:[],name:"HDR Image",creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173392"},contentTypes:["image/png","image/jpeg","image/avif","image/heif"],fieldSets:[],fields:[{datatype:"Enum",defaultValue:"Linear",displayName:"Encoding",name:"Encoding",options:["Linear","sRGB"],type:"Attribute"}],name:"Image",updateRequiresThumbRefresh:true,creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173393"},contentTypes:[""],fieldSets:[],fields:[{label:"Type",type:"Separator"},{datatype:"Enum",defaultValue:"Physical",displayName:"Material type",name:"MaterialType",options:["Physical","Shader","Point","Basic","Normal","Toon","Matcap","Lambert","Phong"],type:"Attribute"},{label:"Matcap material options",type:"Separator",if:{MaterialType:"Matcap"}},{displayName:"Matcap map",linkableTypes:["Image"],type:"Link",usageAs:"Matcap",if:{MaterialType:"Matcap"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Matcap",Matcap:{$isset:true}},name:"MatcapAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Toon material options",type:"Separator",if:{MaterialType:"Toon"}},{displayName:"Gradient map",linkableTypes:["Image"],if:{MaterialType:"Toon"},type:"Link",usageAs:"Gradient"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Nearest",displayName:"Mag filter",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientMagFilter",options:["Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Nearest",displayName:"Min Filter",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientMinFilter",options:["Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Toon",Gradient:{$isset:true}},name:"GradientAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Basic material options",type:"Separator",if:{MaterialType:"Basic"}},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Color",name:"EmissionColor",type:"Attribute",if:{MaterialType:"Basic"}},{label:"Custom shaders",type:"Separator",if:{MaterialType:"Shader"}},{displayName:"Vertex shader",linkableTypes:["Vertex Shader"],type:"Link",usageAs:"VertexShader",if:{MaterialType:"Shader"}},{displayName:"Pixel shader",linkableTypes:["Pixel Shader"],type:"Link",usageAs:"PixelShader",if:{MaterialType:"Shader"}},{label:"Point rendering",type:"Separator",if:{MaterialType:"Point"}},{datatype:"Float",defaultValue:1,displayName:"Size",if:{MaterialType:"Point"},minValue:0,name:"PointSize",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Size attenuation",if:{MaterialType:"Point"},name:"PointSizeAttenuation",type:"Attribute"},{label:"Attenuation",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Color",info:"The color that white light turns into due to absorption when reaching the attenuation distance.",name:"AttenuationColor",type:"Attribute",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:1e3,displayName:"Distance",info:"Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space units, and must be greater than zero.",minValue:1e-5,name:"AttenuationDistance",type:"Attribute",if:{MaterialType:"Physical"}},{label:"Diffuse",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Color",name:"DiffuseColor",type:"Attribute",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Albedo map",linkableTypes:["Image","Composition","Video"],type:"Link",usageAs:"Albedo",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Albedo:{$isset:true}},name:"AlbedoAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Vertex Colors",name:"VertexColors",type:"Attribute"},{label:"Transparency",type:"Separator"},{datatype:"Float",defaultValue:0,displayName:"Alpha test",maxValue:1,minValue:0,name:"AlphaTest",type:"Attribute",widget:"Slider"},{datatype:"Boolean",defaultValue:false,displayName:"Transparent",name:"Transparent",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",if:{Transparent:true},maxValue:1,minValue:0,name:"Opacity",type:"Attribute",widget:"Slider"},{displayName:"Alpha map",linkableTypes:["Image"],type:"Link",usageAs:"Alpha",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Point"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Alpha:{$isset:true}},name:"AlphaAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Emission",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Color",defaultValue:{a:255,b:0,g:0,r:0},displayName:"Color",name:"EmissiveColor",type:"Attribute",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1,displayName:"Intensity",maxValue:10,minValue:0,name:"EmissiveIntensity",type:"Attribute",widget:"Slider",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Emissive map",linkableTypes:["Image"],type:"Link",usageAs:"Emissive",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Emissive:{$isset:true}},name:"EmissiveAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Sheen",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Sheen",maxValue:1,minValue:0,name:"Sheen",type:"Attribute",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Sheen roughness",maxValue:1,minValue:0,name:"SheenRoughness",type:"Attribute",if:{MaterialType:"Physical"}},{displayName:"Sheen roughness map",linkableTypes:["Image"],type:"Link",usageAs:"SheenRoughnessMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",SheenRoughnessMap:{$isset:true}},name:"SheenRoughnessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Sheen color",name:"SheenColor",type:"Attribute",if:{MaterialType:"Physical"}},{displayName:"Sheen color map",linkableTypes:["Image"],type:"Link",usageAs:"SheenColorMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",SheenColorMap:{$isset:true}},name:"SheenColorAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Normal",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Normal map",linkableTypes:["Image"],type:"Link",usageAs:"Normal",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"Scale",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},maxValue:10,minValue:0,name:"NormalScale2d",type:"Attribute"},{datatype:"Enum",defaultValue:"TangentSpace",displayName:"Type",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalType",options:["TangentSpace","ObjectSpace"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Normal:{$isset:true}},name:"NormalAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Roughness",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:1,displayName:"Roughness Intensity",maxValue:1,minValue:0,name:"RoughnessIntensity",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Roughness map",linkableTypes:["Image"],type:"Link",usageAs:"Roughness",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{Roughness:{$isset:true}},name:"RoughnessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{Roughness:{$isset:true}},name:"RoughnessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{Roughness:{$isset:true}},name:"RoughnessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{Roughness:{$isset:true}},name:"RoughnessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",Roughness:{$isset:true}},name:"RoughnessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Metalness",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:1,displayName:"Metalness Intensity",maxValue:1,minValue:0,name:"MetalnessIntensity",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Metalness map",linkableTypes:["Image"],type:"Link",usageAs:"Metalness",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{Metalness:{$isset:true}},name:"MetalnessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{Metalness:{$isset:true}},name:"MetalnessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{Metalness:{$isset:true}},name:"MetalnessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{Metalness:{$isset:true}},name:"MetalnessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",Metalness:{$isset:true}},name:"MetalnessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Specular",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"}]}},{datatype:"Float",defaultValue:1,displayName:"Specular intensity",maxValue:1,minValue:0,name:"SpecularIntensity",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Specular intensity map",linkableTypes:["Image"],type:"Link",usageAs:"SpecularIntensityMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",SpecularIntensityMap:{$isset:true}},name:"SpecularIntensityAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},if:{MaterialType:"Physical"},displayName:"Specular color",name:"SpecularColor",type:"Attribute"},{displayName:"Specular color map",linkableTypes:["Image"],if:{MaterialType:"Physical"},type:"Link",usageAs:"SpecularColorMap"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",SpecularColorMap:{$isset:true}},name:"SpecularColorAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Ambient occlusion",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Ambient occlusion map",linkableTypes:["Image"],type:"Link",usageAs:"AmbientOcclusion",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1,displayName:"Intensity",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},maxValue:10,minValue:0,name:"AmbientOcclusionIntensity",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],AmbientOcclusion:{$isset:true}},name:"AmbientOcclusionAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Clearcoat",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Intensity",maxValue:1,minValue:0,name:"ClearcoatLevel",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Clearcoat map",linkableTypes:["Image"],type:"Link",usageAs:"Clearcoat",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",Clearcoat:{$isset:true}},name:"ClearcoatAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{displayName:"Normal map",linkableTypes:["Image"],type:"Link",usageAs:"ClearcoatNormalMap",if:{MaterialType:"Physical"}},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"Normal scale",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},maxValue:10,minValue:0,name:"ClearcoatNormalScale2d",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Normal H-wrapping",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Normal V-wrapping",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Normal mag filter",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Normal min Filter",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Normal Anisotropy",if:{MaterialType:"Physical",ClearcoatNormalMap:{$isset:true}},name:"ClearcoatNormalAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Roughness intensity",maxValue:1,minValue:0,name:"ClearcoatRoughness",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Roughness map",linkableTypes:["Image"],type:"Link",usageAs:"ClearcoatRoughnessMap"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Roughness H-wrapping",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Roughness V-wrapping",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Roughness mag filter",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Roughness min Filter",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Roughness Anisotropy",if:{MaterialType:"Physical",ClearcoatRoughnessMap:{$isset:true}},name:"ClearcoatRoughnessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Reflections and Refractions",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:.98,displayName:"Refraction ratio",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]},minValue:0,maxValue:1,name:"RefractionRatio",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Reflectivity",maxValue:1,minValue:0,name:"Reflectivity",type:"Attribute",widget:"Slider",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1.5,displayName:"Index of refraction",maxValue:2.333,minValue:1,name:"IndexOfRefraction",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{label:"Environment",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Environment map",linkableTypes:["HDR Image"],type:"Link",usageAs:"Environment",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1,displayName:"Intensity",if:{$or:[{MaterialType:"Physical"}],Environment:{$isset:true}},maxValue:10,minValue:0,name:"EnvironmentIntensity",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Multiply",info:"How to combine the result of the surface's color with the environment map, if any. If mix is chosen, the .reflectivity is used to blend between the two colors.",displayName:"Surface combination",name:"SurfaceEnvironmentCombination",options:["Multiply","Mix","Add"],type:"Attribute",if:{$or:[{MaterialType:"Lambert"},{MaterialType:"Basic"},{MaterialType:"Phong"}]}},{label:"Thickness",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Thickness",minValue:0,name:"Thickness",type:"Attribute",if:{MaterialType:"Physical"}},{displayName:"Thickness map",linkableTypes:["Image"],type:"Link",usageAs:"ThicknessMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",ThicknessMap:{$isset:true}},name:"ThicknessAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Displacement",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Displacement map",linkableTypes:["Image"],type:"Link",usageAs:"Displacement",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:.1,displayName:"Scale",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},maxValue:10,minValue:0,name:"DisplacementScale",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Bias",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementBias",type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],Displacement:{$isset:true}},name:"DisplacementAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Lightmaps",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{displayName:"Light map",linkableTypes:["Image"],type:"Link",usageAs:"LightMap",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:1,displayName:"Intensity",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},maxValue:100,minValue:0,name:"LightMapIntensity",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Toon"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],LightMap:{$isset:true}},name:"LightMapAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Specular map options",type:"Separator",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Float",defaultValue:30,displayName:"Shininess",minValue:0,name:"Shininess",type:"Attribute",widget:"Slider",if:{$or:[{MaterialType:"Phong"}]}},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},if:{MaterialType:"Phong"},displayName:"Specular color",name:"SpecularColor",type:"Attribute"},{displayName:"Specular map",linkableTypes:["Image"],if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]},type:"Link",usageAs:"SpecularMap"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{$or:[{MaterialType:"Basic"},{MaterialType:"Lambert"},{MaterialType:"Phong"}],SpecularMap:{$isset:true}},name:"SpecularAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Transmission",type:"Separator",if:{MaterialType:"Physical"}},{datatype:"Float",defaultValue:0,displayName:"Intensity",maxValue:1,minValue:0,name:"Transmission",type:"Attribute",widget:"Slider",if:{MaterialType:"Physical"}},{displayName:"Transmission map",linkableTypes:["Image"],type:"Link",usageAs:"TransmissionMap",if:{MaterialType:"Physical"}},{datatype:"Enum",defaultValue:"Repeat",displayName:"Horiz. wrapping",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionWrapS",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Repeat",displayName:"Vert. wrapping",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionWrapT",options:["Repeat","Clamp to edge","Mirrored repeat"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear",displayName:"Mag filter",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionMagFilter",options:["Linear","Nearest"],type:"Attribute"},{datatype:"Enum",defaultValue:"Linear, Mipmap linear",displayName:"Min Filter",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionMinFilter",options:["Nearest","Nearest, Mipmap nearest","Nearest, Mipmap linear","Linear","Linear, Mipmap nearest","Linear, Mipmap linear"],type:"Attribute"},{datatype:"Enum",defaultValue:"1x",displayName:"Anisotropy",if:{MaterialType:"Physical",TransmissionMap:{$isset:true}},name:"TransmissionAnisotropy",options:["1x","2x","4x","8x","16x"],type:"Attribute"},{label:"Blending",type:"Separator"},{datatype:"Enum",defaultValue:"Normal",displayName:"Mode",name:"Blending",options:["None","Normal","Additive","Subtractive","Multiply","Custom"],type:"Attribute"},{datatype:"Enum",defaultValue:"Source alpha",displayName:"Source",name:"BlendSrc",options:["Zero","One","Source color","One minus source color","Source alpha","One minus source alpha","Destination alpha","One minus destination alpha","Destination color","One minus destination color","Source alpha saturate"],type:"Attribute",if:{Blending:"Custom"}},{datatype:"Enum",defaultValue:"One minus source alpha",displayName:"Destination",name:"BlendDest",options:["Zero","One","Source color","One minus source color","Source alpha","One minus source alpha","Destination alpha","One minus destination alpha","Destination color","One minus destination color"],type:"Attribute",if:{Blending:"Custom"}},{datatype:"Enum",defaultValue:"Add",displayName:"Equation",name:"BlendEquation",options:["Add","Subtract","Reverse subtract","Min","Max"],type:"Attribute",if:{Blending:"Custom"}},{label:"Depth test",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"DepthTest",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Write",if:{DepthTest:true},name:"DepthWrite",type:"Attribute"},{datatype:"Enum",defaultValue:"Less/equal",displayName:"Mode",if:{DepthTest:true},name:"DepthMode",options:["Never","Always","Less","Less/equal","Greater/equal","Greater","Not equal"],type:"Attribute"},{label:"Culling",type:"Separator"},{datatype:"Enum",defaultValue:"Back",displayName:"Mode",name:"Culling",options:["Front","Back","Off"],type:"Attribute"},{label:"Flat shading",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Boolean",defaultValue:false,displayName:"Active",name:"FlatShading",type:"Attribute",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Normal"},{MaterialType:"Matcap"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{label:"Wireframe",type:"Separator",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Shader"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}},{datatype:"Boolean",defaultValue:false,displayName:"Wireframe",name:"Wireframe",type:"Attribute",if:{$or:[{MaterialType:"Physical"},{MaterialType:"Basic"},{MaterialType:"Normal"},{MaterialType:"Toon"},{MaterialType:"Shader"},{MaterialType:"Lambert"},{MaterialType:"Phong"}]}}],name:"Material",updateRequiresThumbRefresh:true,creatableEmpty:true},{_id:{$oid:"5e6a1ad189707feef9173394"},contentTypes:["model/obj","model/gltf-binary","model/vnd.usdz+zip","model/draco","model/ply","model/fbx"],fieldSets:[],fields:[{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{doesNotAffectThumbnail:true,linkableTypes:["Mesh"],loadingManager:"ignore",preload:false,type:"Link",usageAs:"USDZ"},{doesNotAffectThumbnail:true,linkableTypes:["Mesh"],loadingManager:"ignore",preload:false,type:"Link",usageAs:"GLB"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},name:"Pivot",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},name:"DefaultTransform",displayName:"Default transform",type:"Attribute"}],name:"Mesh",updateRequiresThumbRefresh:true,creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173396"},contentTypes:[""],fields:[{label:"Camera & Composition",type:"Separator"},{datatype:"Enum",defaultValue:"Automatic user controllable camera",displayName:"Camera mode",info:"Camera to render during playback. The main camera is the one with the 'mainCamera' Tag or if only one camera exists, that is the one. Composer setting will render whatever the composition defines.",name:"CameraMode",options:["Automatic user controllable camera","Main camera","Composer"],type:"Attribute"},{linkableTypes:["Composition"],type:"Link",if:{CameraMode:"Composer"},usageAs:"Composition",mandatory:true},{label:"Environment & Background",type:"Separator"},{datatype:"Enum",defaultValue:"None",displayName:"Background mode",name:"BackgroundMode",options:["None","Color","Image","Environment map","Shader"],type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Background blurriness",if:{BackgroundMode:"Environment map"},maxValue:1,minValue:0,name:"BackgroundBlurriness",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:1,displayName:"Background intensity",if:{$or:[{BackgroundMode:"Image"},{BackgroundMode:"Environment map"}]},maxValue:10,minValue:0,name:"BackgroundIntensity",type:"Attribute",widget:"Slider"},{displayName:"Background shader",if:{BackgroundMode:"Shader"},linkableTypes:["Background Shader"],type:"Link",usageAs:"BackgroundShader",mandatory:true},{displayName:"Background image",if:{BackgroundMode:"Image"},linkableTypes:["Image"],type:"Link",usageAs:"Background",mandatory:true},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Background color",if:{BackgroundMode:"Color"},name:"BackgroundColor",type:"Attribute"},{displayName:"Environment map",linkableTypes:["HDR Image"],type:"Link",usageAs:"Environment"},{datatype:"Float",defaultValue:1,displayName:"Environment intensity",maxValue:10,minValue:0,name:"EnvironmentIntensity",type:"Attribute",widget:"Slider"},{datatype:"Color",defaultValue:{a:255,b:0,g:0,r:0},displayName:"Clear color",name:"ClearColor",type:"Attribute"},{label:"Rendering",type:"Separator",collapsed:false},{datatype:"Enum",defaultValue:"PCF Shadow Map",displayName:"Shadow type",name:"ShadowType",options:["Basic Shadow Map","PCF Shadow Map","VSM Shadow Map"],type:"Attribute"}],name:"Scene",updateRequiresThumbRefresh:true,inherits:"Prefab",creatableEmpty:true},{_id:{$oid:"5e6a1ad189707fcef4252336"},contentTypes:[""],fieldSets:[{fields:[{label:"3D Object",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",info:"Indicates if the 3D object is currently active or inactive. When set to true, the object is active.",name:"Active",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Static",info:"A Boolean attribute indicating whether the 3D object is static or not. Static objects can and will never be transformed during runtime.",name:"Static",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",info:"Specifies the name of the 3D object. This is used for identification and reference in the scene.",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},info:"Describes the object's transformation attributes including its position, rotation, and scale in the 3D space.",name:"Transform",type:"Attribute"},{type:"Label",text:"Changing scale in transforms for physics enabled objects is not recommended. Not all objects fully support it. Keep it at least uniform!",labelType:"warning",if:{"PhysicsEnabled?":true,$or:[{"Transform.scale.x":{$not:1}},{"Transform.scale.y":{$not:1}},{"Transform.scale.z":{$not:1}}]}},{datatype:"Layers",defaultValue:[0],info:"Defines the layers that the 3D object is part of. Layers are used for managing object interactions and visibility in the scene.",name:"Layers",type:"Attribute"},{datatype:"Tags",defaultValue:[],info:"Lists tags associated with the 3D object. Tags are useful for categorizing and searching objects in the scene.",name:"Tags",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Receive shadow",info:"Determines whether the object can receive shadows from other objects. Set to true if the object should display shadows cast upon it.",name:"ReceiveShadow",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Cast shadow",info:"Controls whether the object casts shadows in the presence of light sources. Set to true to enable shadow casting from this object.",name:"CastShadow",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Rendered",info:"Indicates if the 3D object is being rendered.",name:"Rendered",type:"Attribute"}],name:"3dObjectDefault"},{fields:[{label:"3D Object",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",info:"A Boolean attribute indicating whether the 3D object is active or not. When set to true, the object is considered active in the scene.",name:"Active",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Static",info:"A Boolean attribute indicating whether the 3D object is static or not. Static objects can and will never be transformed during runtime.",name:"Static",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",info:"A string attribute representing the name of the 3D object. It is used to identify and reference the object within the scene.",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},info:"Specifies the transformation properties of the 3D object, including its position, rotation, and scale in the scene.",name:"Transform",type:"Attribute"},{datatype:"Layers",defaultValue:[0],info:"Determines the layers the 3D object belongs to. Layers are used to organize objects in the scene for various purposes like rendering and interaction.",name:"Layers",type:"Attribute"},{datatype:"Tags",defaultValue:[],info:"A list of tags associated with the 3D object. Tags are used for categorizing and identifying objects for scripting and scene management.",name:"Tags",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Rendered",info:"Indicates if the 3D object is being rendered.",name:"Rendered",type:"Attribute"}],name:"3dObjectNoShadows"},{fields:[{label:"Physics",type:"Separator"},{datatype:"Boolean",defaultValue:false,displayName:"Physics enabled",info:"A Boolean attribute that determines whether physics properties are applied to the object. Disabling it turns off physics calculations.",name:"PhysicsEnabled",type:"Attribute"},{datatype:"Enum",defaultValue:"Rigid body",displayName:"Body type",if:{PhysicsEnabled:true},name:"BodyType",options:["Rigid body","Soft body","Ghost object"],type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Separate subobjects",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"When adding all subobjects of the mesh separately, they will all act individually. We lose however also the possibility to control and watch them as a single object. The configured mass will be distributed among all subobjects",name:"SeparateSubobjects",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Mass",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Specifies the mass of the object as a float value. The mass must be a non-negative value.",minValue:0,name:"Mass",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Pressure",if:{BodyType:"Soft body",PhysicsEnabled:true},info:"Specifies the pressure of the soft body as a float value. The pressure must be a non-negative value.",minValue:0,name:"Pressure",type:"Attribute"},{datatype:"Float",defaultValue:.01,displayName:"Damping",if:{BodyType:"Soft body",PhysicsEnabled:true},info:"Specifies the damping of the soft body.",minValue:0,name:"Damping",type:"Attribute"},{datatype:"Float",defaultValue:.04,displayName:"Margin",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Defines the margin of the object for physics calculations as a float value. The margin is a non-negative value.",minValue:0,name:"Margin",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Restitution",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Determines the restitution (bounciness) of the object. It's a float value affecting how the object bounces upon impact.",name:"Restitution",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Friction",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Sets the friction coefficient of the object. It's a float value, affecting how the object slides against other surfaces.",name:"Friction",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Spinning friction",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Defines the spinning friction of the object as a float value, affecting the object's rotational resistance.",name:"SpinningFriction",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Rolling friction",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true},info:"Specifies the rolling friction of the object. It's a float value that influences how the object rolls over surfaces.",name:"RollingFriction",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Linear damping",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"Sets the linear damping.",name:"LinearDamping",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Angular damping",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"Sets the angular damping.",name:"AngularDamping",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:1,y:1,z:1},displayName:"Linear factor",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"A Vector3d value that defines the linear factor of the object in terms of x, y, and z axes, controlling how the object moves linearly.",name:"LinearFactor",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Linear velocity",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"Defines the object's linear velocity using a Vector3d value, representing the velocity along the x, y, and z axes.",name:"LinearVelocity",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:1,y:1,z:1},displayName:"Angular factor",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"A Vector3d attribute that specifies the angular factor of the object, influencing the object's rotation around each axis.",name:"AngularFactor",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Angular velocity",if:{BodyType:"Rigid body",PhysicsEnabled:true},info:"Sets the angular velocity of the object using a Vector3d value, affecting the object's rotational speed.",name:"AngularVelocity",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Is kinematic",if:{BodyType:"Rigid body",PhysicsEnabled:true,SeparateSubobjects:false},info:"A Boolean attribute that makes the object kinematic when true, meaning it will not be affected by physics but can still affect other objects.",name:"IsKinematic",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Disable deactivation",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,$or:[{IsKinematic:false},{BodyType:"Soft body"}]},info:"When set to true, object will be simulated in physics forever. Otherwise it will be deactivated when not moving anymore",name:"DisableDeactivation",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Watch collisions",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"When set to true, enables monitoring of collisions involving the object.",name:"WatchCollisions",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Report contact points",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"If set to true, collision events will contain the exact contact points. Only enable if you really need it as it costs performance.",name:"ReportContactPoints",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Filter potential collisions",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"The physics engine might report collisions without contact points in cases where objects get close. Filter these out by setting this.",name:"FilterPotentialCollisions",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Watch linear velocity",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"Enables the tracking of changes in the object's linear velocity when set to true.",name:"WatchLinearVelocity",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Watch angular velocity",if:{BodyType:{$not:"Ghost object"},PhysicsEnabled:true,SeparateSubobjects:false},info:"Allows for the monitoring of changes in the object's angular velocity when enabled.",name:"WatchAngularVelocity",type:"Attribute"},{if:{BodyType:{$not:"Soft body"},PhysicsEnabled:true},label:"Collider",type:"Separator"},{datatype:"Enum",defaultValue:"Self",displayName:"Collider type",if:{BodyType:{$not:"Soft body"},PhysicsEnabled:true},name:"ColliderType",options:["Self","Bounding Box","Bounding Sphere","Bounding Cylinder","Capsule","Convex Hull","Custom Mesh"],type:"Attribute"},{datatype:"Enum",defaultValue:"Derive from mesh",displayName:"Capsule size",if:{BodyType:{$not:"Soft body"},ColliderType:"Capsule",PhysicsEnabled:true},name:"CapsuleSize",options:["Derive from mesh","Manual"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Capsule height",if:{BodyType:{$not:"Soft body"},ColliderType:"Capsule",CapsuleSize:"Manual",PhysicsEnabled:true},name:"CapsuleHeight",minValue:0,type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Capsule radius",if:{BodyType:{$not:"Soft body"},ColliderType:"Capsule",CapsuleSize:"Manual",PhysicsEnabled:true},name:"CapsuleRadius",minValue:0,type:"Attribute"},{displayName:"Collider mesh",if:{BodyType:{$not:"Soft body"},ColliderType:"Custom Mesh",PhysicsEnabled:true},linkableTypes:["Mesh","Mesh Collection"],type:"Link",usageAs:"ColliderMesh",mandatory:true},{datatype:"Enum",defaultValue:"",displayName:"Collection entry",if:{BodyType:{$not:"Soft body"},ColliderType:"Custom Mesh",PhysicsEnabled:true,$optionsexist:true},name:"ColliderMeshCollectionEntry",options:[],type:"Attribute"}],name:"Physics"},{fields:[{datatype:"Enum",defaultValue:"Single",displayName:"Source type",name:"SourceType",options:["Single","Collection"],type:"Attribute"},{displayName:"Audio item",if:{SourceType:"Single"},linkableTypes:["Audio"],type:"Link",usageAs:"AudioItem"},{displayName:"Audio collection",if:{SourceType:"Collection"},linkableTypes:["Audio Collection"],type:"Link",usageAs:"AudioCollectionItem"},{datatype:"Enum",defaultValue:"",displayName:"Collection entry",if:{SourceType:"Collection"},name:"AudioCollectionEntry",options:[],type:"Attribute"}],name:"AudioLink"},{fields:[{displayName:"Mesh item",linkableTypes:["Mesh","Mesh Collection"],type:"Link",usageAs:"Mesh",mandatory:true},{datatype:"Enum",defaultValue:"",displayName:"Collection entry",if:{$optionsexist:true},name:"MeshCollectionEntry",options:[],type:"Attribute"}],name:"MeshLink"}],fields:[{childTypes:[{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Mesh specific fields",type:"Separator"},{name:"MeshLink",type:"FieldSet"},{datatype:"Enum",defaultValue:"Pivot",name:"OriginMode",displayName:"Origin mode",if:{$or:[{MeshCollectionEntry:{$isset:true}},{Mesh:{$isset:true}}]},options:["Pivot","Center","Custom"],type:"Attribute"},{name:"CustomPivot",displayName:"Custom Pivot",type:"Attribute",datatype:"Vector3d",if:{OriginMode:"Custom"},defaultValue:{x:0,y:0,z:0}},{datatype:"Animations",defaultValue:[],displayName:"Animations",if:{$or:[{MeshCollectionEntry:{$isset:true}},{Mesh:{$isset:true}}]},name:"Animations",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable instancing",info:"Prepare a static geometry source for GPU instancing. Required before using allocInstances from scripts.",name:"EnableInstancing",type:"Attribute"},{name:"Physics",type:"FieldSet"}],mainItemField:"Mesh",typeName:"Mesh"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"ScriptedMesh specific fields",type:"Separator"},{displayName:"Material(s)",linkableTypes:["Material","Material Collection"],type:"Link",usageAs:"Materials"},{datatype:"Boolean",defaultValue:false,displayName:"Indexed",info:"Indicates if the geometry buffer is indexed.",name:"Indexed",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Have positions",info:"Add a position attribute to the mesh.",name:"HavePositions",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Have normals",info:"Add a normal attribute to the mesh.",name:"HaveNormals",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Have colors",info:"Add a color attribute to the mesh.",name:"HaveColors",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Have UV Coords",info:"Add a UV texture coordinate attribute to the mesh.",name:"HaveUVs",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"ScriptedMesh"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Splats specific fields",type:"Separator"},{linkableTypes:["Gaussian Splats"],type:"Link",usageAs:"Splats",mandatory:true}],mainItemField:"Splats",typeName:"GaussianSplats"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Prefab specific fields",type:"Separator"},{linkableTypes:["Scene","Prefab"],type:"Link",usageAs:"Prefab",mandatory:true}],mainItemField:"Prefab",typeName:"Prefab"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Points specific fields",type:"Separator"},{name:"MeshLink",type:"FieldSet"}],mainItemField:"Mesh",typeName:"Points"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Lightsource specific fields",type:"Separator"},{datatype:"Enum",defaultValue:"Point",name:"Type",options:["Point","Directional","Ambient","Hemisphere","Spot"],type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},name:"Color",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:64,g:64,r:64},displayName:"Ground color (Hemisphere)",if:{Type:"Hemisphere"},name:"GroundColor",type:"Attribute"},{datatype:"Float",defaultValue:10,minValue:0,name:"Intensity",type:"Attribute"},{datatype:"Float",defaultValue:100,if:{$or:[{Type:"Spot"},{Type:"Point"}]},minValue:0,name:"Distance",type:"Attribute"},{datatype:"Float",defaultValue:2,if:{$or:[{Type:"Spot"},{Type:"Point"}]},minValue:1,name:"Decay",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Angle",if:{Type:"Spot"},maxValue:1.57,minValue:0,name:"Angle",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Penumbra",if:{Type:"Spot"},maxValue:1,minValue:0,name:"Penumbra",type:"Attribute"},{datatype:"Node",defaultValue:null,displayName:"Target",if:{$or:[{Type:"Spot"},{Type:"Directional"}]},name:"Target",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Cast shadows",name:"CastShadows",type:"Attribute",if:{$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]}},{datatype:"Float",defaultValue:0,displayName:"Shadow bias",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]},maxValue:1,minValue:-1,name:"ShadowBias",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:512,displayName:"Shadow size",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]},name:"ShadowSize",options:[128,256,512,1024,2048],type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Shadow camera near",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]},minValue:0,name:"ShadowCameraNear",type:"Attribute"},{datatype:"Float",defaultValue:500,displayName:"Shadow camera far",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]},minValue:0,name:"ShadowCameraFar",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Shadow area width",if:{CastShadows:true,Type:"Directional"},minValue:1,name:"ShadowAreaWidth",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Shadow area height",if:{CastShadows:true,Type:"Directional"},minValue:1,name:"ShadowAreaHeight",type:"Attribute"},{datatype:"Float",defaultValue:4,displayName:"Shadow radius",minValue:0,name:"ShadowRadius",type:"Attribute",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]}},{datatype:"Integer",defaultValue:8,displayName:"VSM blur samples",maxValue:32,minValue:1,name:"VsmBlurSamples",type:"Attribute",if:{CastShadows:true,$or:[{Type:"Point"},{Type:"Directional"},{Type:"Spot"}]}}],typeName:"Lightsource"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",info:"Indicates if the 3D object is currently active or inactive. When set to true, the object is active.",name:"Active",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Static",info:"A Boolean attribute indicating whether the 3D object is static or not. Static objects can and will never be transformed during runtime.",name:"Static",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",info:"Specifies the name of the 3D object. This is used for identification and reference in the scene.",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},info:"Describes the object's transformation attributes including its position, rotation, and scale in the 3D space.",name:"Transform",type:"Attribute"},{datatype:"Layers",defaultValue:[],name:"Cullmode",info:"Defines the layers that are not visible to the camera.",displayName:"Cull mode",type:"Attribute"},{datatype:"Tags",defaultValue:[],info:"Lists tags associated with the 3D object. Tags are useful for categorizing and searching objects in the scene.",name:"Tags",type:"Attribute"},{label:"Camera specific fields",type:"Separator"},{datatype:"Enum",defaultValue:"Perspective",name:"Type",options:["Perspective","Orthographic"],type:"Attribute"},{datatype:"Float",defaultValue:60,displayName:"Field of view",if:{Type:"Perspective"},maxValue:360,minValue:1,name:"FieldOfView",type:"Attribute"},{datatype:"Float",defaultValue:-1,displayName:"Left",if:{Type:"Orthographic"},name:"Left",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Right",if:{Type:"Orthographic"},name:"Right",type:"Attribute"},{datatype:"Float",defaultValue:-1,displayName:"Top",if:{Type:"Orthographic"},name:"Top",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Bottom",if:{Type:"Orthographic"},name:"Bottom",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Near plane",minValue:0,name:"NearPlane",type:"Attribute"},{datatype:"Float",defaultValue:1e3,displayName:"Far plane",minValue:0,name:"FarPlane",type:"Attribute"},{datatype:"Enum",defaultValue:"Free",name:"Mode",options:["Free","Look at"],type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},if:{Mode:"Look at"},name:"LookAt",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:1,z:0},displayName:"Up vector",if:{Mode:"Look at"},name:"UpVector",type:"Attribute"}],typeName:"Camera"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"}],typeName:"Group"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Box specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Vector3d",defaultValue:{x:1,y:1,z:1},name:"Size",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:1,y:1,z:1},name:"Segments",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Box"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"GridMap specific fields",type:"Separator"},{linkableTypes:["GridMap"],type:"Link",usageAs:"GridMap"},{name:"Physics",type:"FieldSet"}],typeName:"GridMap"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Ribbon specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Integer",defaultValue:16,displayName:"Ring vertex count",minValue:3,maxValue:256,name:"RingVertexCount",type:"Attribute"},{datatype:"Integer",defaultValue:16,displayName:"Path steps",minValue:2,name:"PathStepCount",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Start time",minValue:0,name:"StartTime",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"End time",minValue:0,name:"EndTime",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Closed",name:"Closed",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Add caps",name:"AddCaps",if:{Closed:false},type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Vertex colors",name:"VertexColors",type:"Attribute"},{label:"Ring formulas",type:"Separator",presets:[{name:"Circle",fields:{RingFormulaX:"cos(theta) * 0.5",RingFormulaY:"0",RingFormulaZ:"sin(theta) * 0.5"}}]},{datatype:"Formula",defaultValue:"cos(theta) * 0.5",displayName:"X",name:"RingFormulaX",type:"Attribute"},{datatype:"Formula",defaultValue:"0",displayName:"Y",name:"RingFormulaY",type:"Attribute"},{datatype:"Formula",defaultValue:"sin(theta) * 0.5",displayName:"Z",name:"RingFormulaZ",type:"Attribute"},{label:"Path formulas",type:"Separator"},{datatype:"Formula",defaultValue:"0",displayName:"X",name:"PathFormulaX",type:"Attribute"},{datatype:"Formula",defaultValue:"sin(t)",displayName:"Y",name:"PathFormulaY",type:"Attribute"},{datatype:"Formula",defaultValue:"t",displayName:"Z",name:"PathFormulaZ",type:"Attribute"},{label:"Color formulas",type:"Separator",if:{VertexColors:true}},{datatype:"Formula",defaultValue:"abs(sin(t))",displayName:"R",name:"ColorFormulaR",type:"Attribute",if:{VertexColors:true}},{datatype:"Formula",defaultValue:"0",displayName:"G",name:"ColorFormulaG",type:"Attribute",if:{VertexColors:true}},{datatype:"Formula",defaultValue:"abs(cos(t))",displayName:"B",name:"ColorFormulaB",type:"Attribute",if:{VertexColors:true}},{label:"Other formulas",type:"Separator"},{datatype:"Formula",defaultValue:"1 + 0.3 * sin(t * 2)",displayName:"Scale",name:"ScaleFormula",type:"Attribute"},{datatype:"Formula",defaultValue:"t * PI * 2",displayName:"Twist",name:"TwistFormula",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Ribbon"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Billboard Specific Fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material",mandatory:true},{datatype:"Text",defaultValue:"Text",displayName:"Text",name:"Text",type:"Attribute"},{datatype:"Enum",defaultValue:"center",displayName:"Text Alignment",info:"The alignment of the text",name:"TextAlign",options:["left","center","right"],type:"Attribute"},{linkableTypes:["Font"],type:"Link",usageAs:"Font"},{datatype:"Boolean",defaultValue:true,displayName:"Size Attenuation",info:"Scales the Billboard with respect to distance to the camera.",name:"SizeAttenuation",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Size",minValue:0,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:2,displayName:"Text Stroke Width",info:"The width of the border of the text.",maxValue:100,minValue:0,name:"TextStrokeWidth",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Text Stroke Color",info:"The color of the border of the text.",name:"TextStrokeColor",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:0,g:0,r:0},displayName:"Text color",info:"The infill color of the text.",name:"TextColor",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:5,y:5},displayName:"Padding",info:"Two values controlling the vertical and horizontal padding size. Higher values increase the size of the padding.",name:"Padding",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Padding color",info:"The background color of the padding section.",name:"BackgroundColor",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Padding Line Color",info:"The color of the border delimited by the padding.",name:"BackgroundStrokeColor",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Padding Line Width",info:"The width of the border of the padding section.",minValue:0,name:"BackgroundStrokeWidth",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:2,y:2},displayName:"Border",info:"Two values controlling the vertical and horizontal border size. Higher values increase the size of the border.",name:"BorderWidth",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Border Color",info:"The background color of the border section.",name:"BorderBackgroundColor",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Border Line Color",info:"The color of the outer border of the sprite.",name:"BorderStrokeColor",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Border Line Width",info:"The width of the outer border.",minValue:0,name:"BorderStrokeWidth",type:"Attribute"},{datatype:"Integer",defaultValue:2,displayName:"Outer Radius",info:"The outer radius of the sprite. Higher values increase the roundness.",minValue:0,name:"OuterRadius",type:"Attribute"},{datatype:"Integer",defaultValue:2,displayName:"Inner Radius",info:"The inner radius of the sprite. Higher values increase the roundness.",minValue:0,name:"InnerRadius",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"}],typeName:"Billboard"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Cone specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Radius",minValue:0,name:"Radius",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Height",minValue:0,name:"Height",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Radial segments",minValue:1,name:"RadialSegments",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Height segments",minValue:1,name:"HeightSegments",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Open ended",name:"OpenEnded",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Theta start",maxValue:360,minValue:0,name:"ThetaStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:360,displayName:"Theta length",maxValue:360,minValue:0,name:"ThetaLength",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Cone"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Lod specific fields",type:"Separator"},{datatype:"String",defaultValue:"0,2,4,6,8,10",displayName:"Distances",name:"Distances",type:"Attribute"}],typeName:"Lod"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Cylinder specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Radius top",minValue:0,name:"RadiusTop",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Radius bottom",minValue:0,name:"RadiusBottom",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Radial segments",minValue:1,name:"RadialSegments",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Height",minValue:0,name:"Height",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Height segments",minValue:1,name:"HeightSegments",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Open ended",name:"OpenEnded",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Theta start",maxValue:360,minValue:0,name:"ThetaStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:360,displayName:"Theta length",maxValue:360,minValue:0,name:"ThetaLength",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Cylinder"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Plane specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Width",minValue:0,name:"Width",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Height",minValue:0,name:"Height",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Width segments",minValue:1,name:"WidthSegments",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Height segments",minValue:1,name:"HeightSegments",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Plane"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Ring specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:.5,displayName:"Inner radius",minValue:0,name:"InnerRadius",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Outer radius",minValue:0,name:"OuterRadius",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Theta segments",minValue:3,name:"ThetaSegments",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Phi segments",minValue:1,name:"PhiSegments",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Theta start",maxValue:360,minValue:0,name:"ThetaStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:360,displayName:"Theta length",maxValue:360,minValue:0,name:"ThetaLength",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Ring"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Particles Editor Fields",type:"Separator"},{datatype:"Boolean",defaultValue:false,displayName:"Preview",info:"Previews the particle system by playing it in the editor.",name:"RunPreview",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Show Emitter Preview",info:"Shows a preview of the particle system's emitter.",name:"ShowHelper",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Pause",info:"Pauses the particle system.",name:"Pause",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Kill All Particles",info:"Kills all the alive particles in the system.",name:"KillAllParticles",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Restart",info:"Hard restart of the particle system. It kills all particles, clean all data and reset the simulation time.",name:"Restart",type:"Attribute"},{displayName:"Particle System",label:"Particle System Configuration File",linkableTypes:["Particles"],type:"Link",usageAs:"ParticleData",mandatory:true}],typeName:"ParticleSystem"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"CircleShadow specific fields",type:"Separator"},{datatype:"Float",defaultValue:1,displayName:"Size",minValue:0,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Strength",maxValue:1,minValue:0,name:"Strength",type:"Attribute",widget:"Slider"}],typeName:"CircleShadow"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Sphere specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Radius",minValue:0,name:"Radius",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Width segments",minValue:3,name:"WidthSegments",type:"Attribute"},{datatype:"Integer",defaultValue:6,displayName:"Height segments",minValue:2,name:"HeightSegments",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Phi start",maxValue:360,minValue:0,name:"PhiStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:360,displayName:"Phi length",maxValue:360,minValue:0,name:"PhiLength",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Theta start",maxValue:360,minValue:0,name:"ThetaStart",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:180,displayName:"Theta length",maxValue:180,minValue:0,name:"ThetaLength",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Sphere"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Text specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"String",defaultValue:"Text",name:"Text",type:"Attribute"},{datatype:"Enum",defaultValue:"center",displayName:"Horizontal Alignment",info:"Horizontal text positioning",name:"HorizontalAlign",options:["left","center","right"],type:"Attribute"},{datatype:"Enum",defaultValue:"baseline",displayName:"Vertical Alignment",info:"Vertical text positioning",name:"VerticalAlign",options:["baseline","top","middle","bottom"],type:"Attribute"},{linkableTypes:["Font"],type:"Link",usageAs:"Font"},{datatype:"Float",defaultValue:1,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:1,name:"Height",type:"Attribute"},{datatype:"Integer",defaultValue:12,displayName:"Curve segments",name:"CurveSegments",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Bevel enabled",name:"BevelEnabled",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Bevel thickness",name:"BevelThickness",type:"Attribute"},{datatype:"Float",defaultValue:.03,displayName:"Bevel size",name:"BevelSize",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Bevel offset",name:"BevelOffset",type:"Attribute"},{datatype:"Integer",defaultValue:3,displayName:"Bevel segments",name:"BevelSegments",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Text"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"Torus specific fields",type:"Separator"},{linkableTypes:["Material"],type:"Link",usageAs:"Material"},{datatype:"Float",defaultValue:1,displayName:"Radius",minValue:0,name:"Radius",type:"Attribute"},{datatype:"Float",defaultValue:.4,displayName:"Tube",minValue:0,name:"Tube",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Radial segments",minValue:3,name:"RadialSegments",type:"Attribute"},{datatype:"Integer",defaultValue:16,displayName:"Tubular segments",minValue:2,name:"TubularSegments",type:"Attribute"},{datatype:"Float",defaultValue:360,displayName:"Arc",maxValue:360,minValue:0,name:"Arc",type:"Attribute",widget:"Slider"},{datatype:"Vector2d",defaultValue:{x:1,y:1},displayName:"UV Scale",name:"UVScale",type:"Attribute"},{name:"Physics",type:"FieldSet"}],typeName:"Torus"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"Active",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Layers",defaultValue:[0],name:"Layers",type:"Attribute"},{datatype:"Tags",defaultValue:[],name:"Tags",type:"Attribute"},{label:"Sky specific fields",type:"Separator"},{datatype:"Float",defaultValue:1e3,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Turbidity",maxValue:20,minValue:1,name:"Turbidity",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:2,displayName:"Rayleigh",maxValue:4,minValue:0,name:"Rayleigh",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.005,displayName:"Mie coefficient",maxValue:1,minValue:0,name:"MieCoefficient",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.8,displayName:"Mie directional G",maxValue:1,minValue:0,name:"MieDirectionalG",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.49,displayName:"Inclination",maxValue:1,minValue:0,name:"Inclination",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.25,displayName:"Azimuth",maxValue:1,minValue:0,name:"Azimuth",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.02,displayName:"Cloud scale",maxValue:1,minValue:0,name:"CloudScale",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.01,displayName:"Cloud speed",maxValue:1,minValue:0,name:"CloudSpeed",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.4,displayName:"Cloud coverage",maxValue:1,minValue:0,name:"CloudCoverage",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.4,displayName:"Cloud density",maxValue:1,minValue:0,name:"CloudDensity",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.5,displayName:"Cloud elevation",maxValue:1,minValue:0,name:"CloudElevation",type:"Attribute",widget:"Slider"},{datatype:"Boolean",defaultValue:true,displayName:"Show sun disc",name:"ShowSunDisc",type:"Attribute",widget:"Slider"}],typeName:"Sky"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"Active",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},name:"Transform",type:"Attribute"},{datatype:"Tags",defaultValue:[],name:"Tags",type:"Attribute"},{label:"Audio listener specific fields",type:"Separator"},{datatype:"Float",defaultValue:1,name:"Gain",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Time delta",name:"TimeDelta",type:"Attribute"}],maxInstances:1,typeName:"AudioListener"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"Active",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Transform",defaultValue:{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},name:"Transform",type:"Attribute"},{datatype:"Tags",defaultValue:[],name:"Tags",type:"Attribute"},{label:"Positional audio specific fields",type:"Separator"},{name:"AudioLink",type:"FieldSet"},{datatype:"Boolean",defaultValue:false,displayName:"Autoplay",name:"Autoplay",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Loop",name:"Loop",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Loop section",name:"LoopSection",type:"Attribute",if:{Loop:true}},{datatype:"Float",defaultValue:0,displayName:"Loop start",minValue:0,name:"LoopStart",type:"Attribute",widget:"Slider",if:{Loop:true,LoopSection:true}},{datatype:"Float",displayName:"Loop end",defaultValue:1,minValue:0,name:"LoopEnd",type:"Attribute",widget:"Slider",if:{Loop:true,LoopSection:true}},{datatype:"Float",defaultValue:1,displayName:"Volume",minValue:0,name:"Volume",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Panning",maxValue:1,minValue:-1,name:"Panning",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Duration",minValue:0,name:"Duration",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Detune",name:"Detune",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Playback rate",minValue:0,name:"PlaybackRate",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Offset",maxValue:1,minValue:0,name:"Offset",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Ref distance",minValue:0,name:"RefDistance",type:"Attribute"},{datatype:"Float",defaultValue:1e4,displayName:"Max distance",minValue:0,name:"MaxDistance",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Rolloff factor",minValue:0,name:"RolloffFactor",type:"Attribute"},{datatype:"Enum",defaultValue:"Inverse",displayName:"Distance model",name:"DistanceModel",options:["Linear","Inverse","Exponential"],type:"Attribute"},{datatype:"Enum",defaultValue:"Omnidirectional",displayName:"Direction",name:"Direction",options:["Omnidirectional","Directional"],type:"Attribute"},{datatype:"Float",defaultValue:90,displayName:"Cone inner angle",if:{Direction:"Directional"},maxValue:360,minValue:0,name:"ConeInnerAngle",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:180,displayName:"Cone outer angle",if:{Direction:"Directional"},maxValue:360,minValue:0,name:"ConeOuterAngle",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.2,displayName:"Cone outer gain",if:{Direction:"Directional"},maxValue:1,minValue:0,name:"ConeOuterGain",type:"Attribute",widget:"Slider"}],typeName:"PositionalAudio"},{fields:[{label:"3D Object Fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Active",name:"Active",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Tags",defaultValue:[],name:"Tags",type:"Attribute"},{label:"Audio specific fields",type:"Separator"},{name:"AudioLink",type:"FieldSet"},{datatype:"Boolean",defaultValue:false,displayName:"Autoplay",name:"Autoplay",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Loop",name:"Loop",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Loop section",name:"LoopSection",type:"Attribute",if:{Loop:true}},{datatype:"Float",defaultValue:0,displayName:"Loop start",minValue:0,name:"LoopStart",type:"Attribute",widget:"Slider",if:{Loop:true,LoopSection:true}},{datatype:"Float",displayName:"Loop end",defaultValue:1,minValue:0,name:"LoopEnd",type:"Attribute",widget:"Slider",if:{Loop:true,LoopSection:true}},{datatype:"Float",defaultValue:1,displayName:"Volume",minValue:0,name:"Volume",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Panning",maxValue:1,minValue:-1,name:"Panning",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Duration",minValue:0,name:"Duration",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Detune",name:"Detune",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Playback rate",minValue:0,name:"PlaybackRate",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Offset",maxValue:1,minValue:0,name:"Offset",type:"Attribute"}],typeName:"Audio"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Vehicle specific fields",type:"Separator"},{datatype:"Node",defaultValue:null,displayName:"Chassis node",name:"ChassisNode",type:"Attribute"},{elementName:"Wheel",fields:[{datatype:"Node",defaultValue:null,displayName:"Wheel node",name:"WheelNode",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Is Front",name:"IsFront",type:"Attribute"},{label:"Wheel config",type:"Separator",collapsed:true},{datatype:"Float",defaultValue:.6,displayName:"Suspension rest length",name:"SuspensionRestLength",type:"Attribute"},{datatype:"Float",defaultValue:20,displayName:"Suspension stiffness",name:"SuspensionStiffness",type:"Attribute"},{datatype:"Float",defaultValue:2.3,displayName:"Suspension damping",name:"SuspensionDamping",type:"Attribute"},{datatype:"Float",defaultValue:4.4,displayName:"Suspension compression",name:"SuspensionCompression",type:"Attribute"},{datatype:"Float",defaultValue:1e3,displayName:"Friction",name:"Friction",type:"Attribute"},{datatype:"Float",defaultValue:.2,displayName:"Roll influence",name:"RollInfluence",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Radius",name:"Radius",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Acceleration",name:"Acceleration",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Brakes",name:"Brakes",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Steering",name:"Steering",type:"Attribute"}],name:"Wheels",type:"List"}],typeName:"Vehicle"},{fields:[{name:"3dObjectNoShadows",type:"FieldSet"},{label:"Constraint specific fields",type:"Separator"},{datatype:"Enum",defaultValue:"",displayName:"Type",name:"Type",options:["Point to Point","Hinge","Slider","Cone twist"],type:"Attribute"},{datatype:"Node",defaultValue:null,displayName:"First node",name:"FirstNode",type:"Attribute"},{datatype:"Node",defaultValue:null,displayName:"Second node",name:"SecondNode",type:"Attribute"}],typeName:"Constraint"},{fields:[{name:"3dObjectDefault",type:"FieldSet"},{label:"NavMesh specific fields",type:"Separator"},{datatype:"Enum",defaultValue:"Solo",displayName:"Type",name:"Type",options:["Solo","Tiled","Tile cache"],info:"For simple static scenes, use solo. For large maps use tiled, for large and/or dynamic maps, use tile cache",type:"Attribute"},{datatype:"Enum",defaultValue:"From children",displayName:"Mode",name:"Mode",options:["From children","From tags","From layers"],type:"Attribute"},{datatype:"Layers",defaultValue:[0],displayName:"Navmesh layers",info:"Selects which layers are added to the navmesh",name:"NavmeshLayers",type:"Attribute",if:{Mode:"From layers"}},{datatype:"Tags",defaultValue:[],info:"Selects meshes to add to the navmesh based on tag.",displayName:"Navmesh tags",name:"NavmeshTags",type:"Attribute",if:{Mode:"From tags"}},{datatype:"Boolean",defaultValue:false,displayName:"Auto generate",name:"AutoGenerate",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Always render helper",name:"AlwaysRenderHelper",type:"Attribute"},{datatype:"Button",defaultValue:false,displayName:"Regenerate now",name:"RegenerateNow",type:"Attribute"},{datatype:"Float",defaultValue:0,minValue:0,displayName:"Border size",name:"BorderSize",type:"Attribute"},{datatype:"Float",defaultValue:.2,minValue:.01,displayName:"Voxel cell height",name:"CellHeight",type:"Attribute",info:"Needs to resolve step/climb height cleanly."},{datatype:"Float",defaultValue:.2,minValue:.01,displayName:"Voxel cell size",name:"CellSize",type:"Attribute",info:"Smaller = more detail. Around 0.2m for human‑scale"},{datatype:"Integer",defaultValue:256,minValue:1,displayName:"Chunky tri mesh tris per chunk",name:"ChunkyTriMeshTrisPerChunk",type:"Attribute",if:{Type:"Tiled"}},{datatype:"Float",defaultValue:6,minValue:.01,displayName:"Detail sample dist",name:"DetailSampleDist",type:"Attribute"},{datatype:"Float",defaultValue:1,minValue:0,displayName:"Detail sample max error",name:"DetailSampleMaxError",type:"Attribute"},{datatype:"Integer",defaultValue:4,minValue:1,displayName:"Expected layers per tile",name:"ExpectedLayersPerTile",type:"Attribute",if:{Type:"Tile Cache"}},{datatype:"Integer",defaultValue:128,minValue:1,displayName:"Max obstacles",name:"MaxObstacles",type:"Attribute",if:{Type:"Tile Cache"}},{datatype:"Float",defaultValue:12,minValue:.01,displayName:"Max edge length",name:"MaxEdgeLen",type:"Attribute"},{datatype:"Float",defaultValue:1.3,minValue:0,displayName:"Max simplification error",name:"MaxSimplificationError",type:"Attribute",info:"Allowed contour deviation from source before another vertex is kept"},{datatype:"Integer",defaultValue:6,minValue:3,displayName:"Max vertices per poly",name:"MaxVertsPerPoly",type:"Attribute"},{datatype:"Float",defaultValue:20,minValue:.01,displayName:"Merge region area",name:"MergeRegionArea",type:"Attribute"},{datatype:"Float",defaultValue:8,minValue:.01,displayName:"Min region area",name:"MinRegionArea",type:"Attribute"},{datatype:"Float",defaultValue:2,minValue:0,displayName:"Walkable climb",name:"WalkableClimb",type:"Attribute",info:"Maximum step height"},{datatype:"Float",defaultValue:2,minValue:0,displayName:"Walkable height",name:"WalkableHeight",type:"Attribute",info:"Required head‑clearance. Must be at least the height of the characters."},{datatype:"Float",defaultValue:.5,minValue:.01,displayName:"Walkable radius",name:"WalkableRadius",type:"Attribute",info:"Clearance from walls/obstacles"},{datatype:"Float",defaultValue:60,minValue:0,maxValue:360,displayName:"Walkable slope angle",name:"WalkableSlopeAngle",type:"Attribute",info:"Steepest walkable slope"},{datatype:"Boolean",defaultValue:true,displayName:"Build BV Tree",name:"BuildBvTree",info:"",type:"Attribute",if:{$or:[{Type:"Solo"},{Type:"Tiled"}]}},{datatype:"Integer",defaultValue:32,minValue:1,displayName:"Tile size",name:"TileSize",type:"Attribute",info:"The size of the tiles to be used. Typically you will want to stay in the range 32 - 64. Sizes outside this range might result in unexpected behaviour",if:{$or:[{Type:"Tiled"},{Type:"Tile cache"}]}},{label:"Crowd fields",type:"Separator"},{datatype:"Boolean",defaultValue:true,displayName:"Enable crowd",name:"EnableCrowd",type:"Attribute"},{datatype:"Integer",defaultValue:100,minValue:1,displayName:"Max agent count",name:"MaxAgentCount",type:"Attribute"},{datatype:"Float",defaultValue:1,minValue:.01,displayName:"Max agent radius",name:"MaxAgentRadius",type:"Attribute"}],typeName:"NavMesh"}],name:"Scenegraph",type:"Tree"}],name:"Prefab",updateRequiresThumbRefresh:true},{_id:{$oid:"5e6a1ad189707feef9173397"},contentTypes:["text/x-lua"],fieldSets:[],fields:[],name:"Script",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ad189707f2ef9133396"},contentTypes:[],fieldSets:[],fields:[{childTypes:[{displayName:"Camera",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Tag",info:"Tag of the camera to render",name:"Tag",type:"Attribute"},{datatype:"Layers",defaultValue:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],displayName:"Layers",info:"Selects which layers are rendered by the camera. Overrides scene Camera node 'Cull mode' field.",name:"Layers",type:"Attribute"},{datatype:"Enum",defaultValue:"4x",displayName:"Multisampling",name:"Multisampling",options:["None","2x","4x","8x","16x"],info:"Multisampling will reduce aliasing artifacts, but will also decrease performance. 4x is recommended.",type:"Attribute"},{datatype:"Float",defaultValue:100,displayName:"Width",info:"Width in percent of the actual screen width to render.",name:"Width",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:100,displayName:"Height",info:"Height in percent of the actual screen height to render.",name:"Height",type:"Attribute",widget:"Slider"}],inputs:[],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"},{displayName:"Depth output",name:"DepthOutput",type:"GrayImage"},{displayName:"Depth Comparison output",name:"DepthComparisonOutput",type:"GrayImage"},{displayName:"Normal output",name:"NormalOutput",type:"RGBImage"},{displayName:"Camera Output",name:"CameraOutput",type:"Attribute"}],typeName:"camera"},{displayName:"Merge",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Enum",defaultValue:"Alpha",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",info:"Adjusts how strongly the blending mode affects the final result.",maxValue:1,minValue:0,name:"Opacity",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Offset X",info:"Horizontal offset for the secondary input (relative to composition resolution). Positive values move right, negative left. Percentage-based for resolution independence.",maxValue:100,minValue:-100,name:"OffsetX",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Offset Y",info:"Vertical offset for the secondary input (relative to composition resolution). Positive values move up, negative down. Percentage-based for resolution independence.",maxValue:100,minValue:-100,name:"OffsetY",type:"Attribute"},{datatype:"Float",defaultValue:100,displayName:"Width",info:"Horizontal scale of the secondary input as percentage of composition width. 100% maintains original aspect ratio when Height is also 100%. Values <100% shrink, >100% stretch.",maxValue:100,minValue:0,name:"Width",type:"Attribute"},{datatype:"Float",defaultValue:100,displayName:"Height",info:"Vertical scale of the secondary input as percentage of composition height. 100% maintains original aspect ratio when Width is also 100%. Values <100% shrink, >100% stretch.",maxValue:100,minValue:0,name:"Height",type:"Attribute"}],inputs:[{displayName:"Color input 1",name:"ColorInput1",types:["RGBImage"]},{displayName:"Color input 2",name:"ColorInput2",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"merge"},{displayName:"SSAO",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:.2,displayName:"Radius",minValue:.01,name:"Radius",type:"Attribute"},{datatype:"Integer",defaultValue:8,displayName:"Samples",maxValue:32,minValue:8,name:"Samples",type:"Attribute"},{datatype:"Float",defaultValue:.001,displayName:"Bias",minValue:.001,name:"Bias",type:"Attribute"},{datatype:"Float",defaultValue:2,displayName:"Intensity",minValue:0,name:"Intensity",type:"Attribute"},{datatype:"Float",defaultValue:.07,displayName:"Max distance",minValue:.01,name:"MaxDistance",type:"Attribute"}],inputs:[{displayName:"Depth input",name:"DepthInput",types:["GrayImage"]},{displayName:"Normal input",name:"NormalInput",types:["RGBImage"]},{displayName:"Camera Input",name:"CameraInput",types:["Attribute"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"ssao"},{displayName:"FXAA",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"fxaa"},{displayName:"Bloom",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1.5,displayName:"Strength",maxValue:10,minValue:0,name:"Strength",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.4,displayName:"Radius",maxValue:1,minValue:0,name:"Radius",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.8,displayName:"Threshold",info:"Minimum luminance required for a pixel to contribute to bloom. Pixels darker than this value are suppressed, while brighter pixels contribute to the blur.",maxValue:1,minValue:0,name:"Threshold",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.4,displayName:"Soft Knee",info:"Creates a smooth transition around the threshold to avoid harsh cutoffs. Higher values produce a more gradual blend between non-blooming and blooming pixels.",maxValue:1,minValue:0,name:"SoftKnee",type:"Attribute",widget:"Slider"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"bloom"},{displayName:"Outline",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Edge Strength",maxValue:5,minValue:0,name:"EdgeStrength",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.5,displayName:"Edge Width",maxValue:2,minValue:.1,name:"EdgeWidth",type:"Attribute",widget:"Slider"},{datatype:"Color",defaultValue:{r:255,g:0,b:0,a:255},displayName:"Edge Color",name:"EdgeColor",type:"Attribute"},{datatype:"Enum",defaultValue:"Add",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.25,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Depth Comparison input",name:"DepthComparisonInput",types:["GrayImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"outline"},{displayName:"Film",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:.05,displayName:"Noise intensity",maxValue:1,minValue:0,name:"NoiseIntensity",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:0,displayName:"Scanlines intensity",maxValue:1,minValue:0,name:"ScanlinesIntensity",type:"Attribute",widget:"Slider"},{datatype:"Integer",defaultValue:0,displayName:"Scanlines count",maxValue:1e3,minValue:0,name:"ScanlinesCount",type:"Attribute",widget:"Slider"},{datatype:"Boolean",defaultValue:false,displayName:"Grayscale",name:"Grayscale",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Animated",name:"Animated",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"film"},{displayName:"Fog",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Color",defaultValue:{r:255,g:0,b:0,a:255},displayName:"Color",name:"Color",type:"Attribute"},{datatype:"Enum",defaultValue:"Camera Depth",displayName:"Direction",name:"Direction",type:"Attribute",options:["Camera Depth","X","Y","Z"],info:"Defines the ray along which the fog is evaluated. 'Camera Depth' applies fog based on distance from the camera view direction (distances should be non-negative). 'X', 'Y', and 'Z' apply fog along the corresponding world-space axis; distances may be positive or negative depending on where the fog volume should begin and end."},{datatype:"Enum",defaultValue:"Linear",displayName:"Type",name:"Type",type:"Attribute",options:["Linear","Exponential","Exponential Squared"]},{datatype:"Float",defaultValue:1,displayName:"Start Distance",name:"StartDistance",type:"Attribute",info:"Distance along the selected fog ray where the fog begins to accumulate. Must be >= 0 when using Camera Depth."},{datatype:"Float",defaultValue:1e3,displayName:"End Distance",name:"EndDistance",type:"Attribute",info:"Distance along the selected fog ray where the fog reaches maximum density. Must be >= 0 when using Camera Depth."},{datatype:"Float",defaultValue:.0025,displayName:"Density",minValue:1e-5,maxValue:1,name:"Density",type:"Attribute",step:.1,if:{$or:[{FogType:"Exponential"},{FogType:"Exponential Squared"}]}},{datatype:"Boolean",defaultValue:true,displayName:"Enable Noise",name:"EnableNoise",info:"Adds animated noise to the fog to create more natural variation.",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Noise Scale",minValue:.001,name:"NoiseScale",type:"Attribute",step:1,if:{EnableFogNoise:true}},{datatype:"Float",defaultValue:.1,displayName:"Noise Speed",maxValue:1,minValue:0,name:"NoiseSpeed",type:"Attribute",step:.1,if:{EnableFogNoise:true}},{datatype:"Float",defaultValue:.5,displayName:"Noise Amount",maxValue:1,minValue:0,name:"NoiseAmount",type:"Attribute",step:.1,if:{EnableFogNoise:true}},{datatype:"Float",defaultValue:0,maxValue:1,displayName:"Sky Density",info:"Controls the amount of fog applied to the sky.",name:"SkyDensity",type:"Attribute",step:.1}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Depth input",name:"DepthInput",types:["DepthBuffer"]},{displayName:"Camera input",name:"CameraInput",types:["Camera"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"fog"},{displayName:"Sepia",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Enum",defaultValue:"Normal",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"sepia"},{displayName:"Vignette",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Enum",defaultValue:"Normal",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.9,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"},{datatype:"Float",defaultValue:.4,displayName:"Amount",maxValue:1,minValue:0,name:"Amount",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"vignette"},{displayName:"Blur",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Amount",maxValue:10,minValue:0,name:"Amount",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"blur"},{displayName:"Scanline",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Density",maxValue:1,minValue:0,name:"Density",type:"Attribute",widget:"Slider"},{datatype:"Float",defaultValue:.01,displayName:"Scroll Speed",maxValue:1,minValue:0,name:"ScrollSpeed",type:"Attribute",widget:"Slider"},{datatype:"Enum",defaultValue:"Overlay",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.25,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"scanline"},{displayName:"Shockwave",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Continuous",info:"Whether or not new shockwaves will emit as soon as the previous shockwave ended.",name:"Continuous",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Delay",minValue:0,name:"Delay",info:"How long to wait between shockwave emissions.",type:"Attribute",if:{Continuous:false}},{datatype:"Integer",defaultValue:5,displayName:"Amount",minValue:0,name:"Amount",info:"The number of shockwaves.",type:"Attribute",if:{Continuous:false}},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Center",info:"The center in world coordinates of the shockwave effect.",name:"Center",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Size",maxValue:100,minValue:.001,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:2,displayName:"Speed",maxValue:100,minValue:.001,name:"Speed",type:"Attribute"},{datatype:"Float",defaultValue:-0.2,displayName:"Radius",maxValue:10,minValue:-10,name:"Radius",type:"Attribute"},{datatype:"Float",defaultValue:.2,displayName:"Maximum Radius",maxValue:10,minValue:0,name:"MaxRadius",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Wave Size",maxValue:100,minValue:1,name:"WaveSize",type:"Attribute"},{datatype:"Float",defaultValue:.05,displayName:"Amplitude",maxValue:10,minValue:0,name:"Amplitude",type:"Attribute"},{datatype:"Enum",defaultValue:"Screen",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.75,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable Debug",name:"Debug",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Camera Input",name:"CameraInput",types:["Attribute"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"shockwave"},{displayName:"Pixelation",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Granularity",maxValue:100,minValue:1,name:"Granularity",type:"Attribute",widget:"Slider"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"pixelation"},{displayName:"Adjust",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Brightness",maxValue:10,minValue:-10,name:"Brightness",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Contrast",maxValue:10,minValue:-10,name:"Contrast",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Hue",maxValue:6.283,minValue:0,name:"Hue",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Saturation",maxValue:1,minValue:-1,name:"Saturation",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"adjust"},{displayName:"Chromatic abberation",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Amount",maxValue:10,minValue:0,name:"Amount",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Red factor",maxValue:1,minValue:0,name:"RedFactor",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Green factor",maxValue:1,minValue:0,name:"GreenFactor",type:"Attribute"},{datatype:"Float",defaultValue:.25,displayName:"Blue factor",maxValue:1,minValue:0,name:"BlueFactor",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"chromaticAbberation"},{displayName:"Color Depth",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Integer",defaultValue:16,displayName:"Bit Depth",maxValue:32,minValue:1,name:"bitDepth",type:"Attribute"},{datatype:"Enum",defaultValue:"Normal",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",info:"Controls blending. Only valid for additive and subtractive modes",maxValue:1,minValue:0,name:"Opacity",type:"Attribute",widget:"Slider"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"colorDepth"},{displayName:"Depth Of Field",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"String",defaultValue:"",displayName:"Focus Target",name:"FocusTarget",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"World Focus Distance",minValue:0,name:"WorldFocusDistance",type:"Attribute"},{datatype:"Float",defaultValue:5,displayName:"World Focus Range",minValue:0,name:"WorldFocusRange",type:"Attribute"},{datatype:"Integer",defaultValue:4,displayName:"Kawase Blur Kernel Size",maxValue:10,minValue:0,name:"Kernel",type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Bokeh Scale",maxValue:25,minValue:0,name:"BokehScale",type:"Attribute"},{datatype:"Float",defaultValue:.75,displayName:"Resolution Scale",maxValue:1,minValue:0,name:"ResolutionScale",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable Debug",name:"Debug",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Depth input",name:"DepthInput",types:["GrayImage"]},{displayName:"Camera Input",name:"CameraInput",types:["Attribute"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"depthoffield"},{displayName:"Glitch",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:.3,y:1},displayName:"Strength",info:"Two values controlling the maximum and minimum strength of the glitch effect.",name:"Strength",type:"Attribute"},{datatype:"Float",defaultValue:.1,displayName:"Columns",maxValue:1,minValue:0,name:"Columns",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:0,y:2.5},displayName:"Delay",info:"Two values controlling the duration of the delay of the glitch effect.",name:"Delay",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:0,y:3},displayName:"Duration",info:"Two values controlling the duration of the glitch effect.",name:"Duration",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"glitch"},{displayName:"God Rays",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"String",defaultValue:"",type:"Attribute",displayName:"Light Source",name:"SunTag"},{datatype:"Float",defaultValue:1,displayName:"Size",minValue:.01,maxValue:10,name:"Size",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Density",minValue:.01,maxValue:1,name:"Density",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Decay",minValue:.01,maxValue:1,name:"Decay",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Weight",minValue:.01,maxValue:1,name:"Weight",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Exposure",minValue:.01,maxValue:1,name:"Exposure",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"MaximumIntensity",minValue:.01,maxValue:1,name:"MaximumIntensity",type:"Attribute"},{datatype:"Integer",defaultValue:60,displayName:"Samples",minValue:0,name:"Samples",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Blur Rays",name:"BlurRays",type:"Attribute"},{datatype:"Integer",defaultValue:2,displayName:"Kernel Size",info:"The number of kernel applied on the God Rays. A higher number yields to a better blur effect at higher computational cost",maxValue:10,minValue:0,name:"Kernel",if:{BlurRays:true},type:"Attribute"},{datatype:"Float",defaultValue:.5,displayName:"Resolution Scale",info:"A higher resolution yields a more realistic result at higher computational cost",maxValue:1,minValue:0,name:"ResolutionScale",type:"Attribute"},{datatype:"Enum",defaultValue:"Screen",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Alpha","Average","Color","Color Burn","Color Dodge","Darken","Difference","Divide","Exclusion","Hard Light","Hard Mix","Hue","Invert","Invert RGB","Lighten","Linear Burn","Linear Dodge","Linear Light","Luminosity","Multiply","Negation","Normal","Overlay","Pin Light","Reflect","Saturation","Screen","Soft Light","Set","Src","Subtract","Vivid Light"],type:"Attribute"},{datatype:"Float",defaultValue:.25,displayName:"Opacity",name:"Opacity",maxValue:1,minValue:0,type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable Debug",name:"Debug",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]},{displayName:"Depth input",name:"DepthInput",types:["GrayImage"]},{displayName:"Camera Input",name:"CameraInput",types:["Attribute"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"godrays"},{displayName:"Kawase Blur",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Integer",defaultValue:2,displayName:"Kernel Size",info:"The number of kernel applied on the effect. A higher number yields to a better blur effect at higher computational cost",maxValue:10,minValue:0,name:"Kernel",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Scale",info:"The strenth of the blur effect.",maxValue:1,minValue:0,name:"Scale",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"kawaseblur"},{displayName:"Radial blur",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Amount",maxValue:10,minValue:0,name:"Amount",type:"Attribute"},{datatype:"Vector2d",defaultValue:{x:.5,y:.5},displayName:"Center",name:"Center",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"radialBlur"},{displayName:"Tone Mapping",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Boolean",defaultValue:true,displayName:"Enabled",name:"Enabled",type:"Attribute"},{datatype:"Enum",defaultValue:"LINEAR",displayName:"Mode",name:"TonemappingMode",options:["LINEAR","REINHARD","REINHARD2","REINHARD2_ADAPTIVE","UNCHARTED2","ACES_FILMIC","AGX","NEUTRAL"],type:"Attribute"},{datatype:"Integer",defaultValue:256,displayName:"Luminance Map Width. Must be a power of 2.",minValue:1,name:"LuminanceMapWidth",type:"Attribute",if:{TonemappingMode:"REINHARD2_ADAPTIVE"}},{datatype:"Integer",defaultValue:256,displayName:"Luminance Map Height. Must be a power of 2.",if:{TonemappingMode:"REINHARD2_ADAPTIVE"},minValue:1,name:"LuminanceMapHeight",type:"Attribute"},{datatype:"Float",defaultValue:4,displayName:"Maximum Luminance",minValue:0,maxValue:20,name:"MaxLuminance",type:"Attribute"},{datatype:"Float",defaultValue:.01,displayName:"Minimum Luminance",minValue:0,maxValue:3,name:"MinLuminance",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Average Luminance",minValue:0,maxValue:1,name:"MeanLuminance",type:"Attribute"},{datatype:"Float",defaultValue:.6,displayName:"Middle Grey",maxValue:1,minValue:0,name:"MiddleGrey",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Adaptation Rate",minValue:0,name:"AdaptationRate",type:"Attribute"}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[{displayName:"Color output",name:"ColorOutput",type:"RGBImage"}],typeName:"tonemapping"},{displayName:"Output",fields:[{datatype:"String",defaultValue:"Output",displayName:"Name",name:"Name",type:"Attribute"},{datatype:"Integer",defaultValue:256,displayName:"Target width",minValue:1,name:"DesiredWidth",type:"Attribute",info:"This is the width of the render target in case the composition is used in a material albedo slot."},{datatype:"Integer",defaultValue:256,displayName:"Target height",minValue:1,name:"DesiredHeight",type:"Attribute",info:"This is the height of the render target in case the composition is used in a material albedo slot."}],inputs:[{displayName:"Color input",name:"ColorInput",types:["RGBImage"]}],outputs:[],typeName:"output"}],name:"NodeGraph",type:"NodeGraph"}],name:"Composition",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ad189707f2ef9147396"},contentTypes:[],fieldSets:[],fields:[],name:"Behavior",updateRequiresThumbRefresh:false,creatableEmpty:false},{_id:{$oid:"5e6a1ad189707feef9173398"},contentTypes:["text/x-glsl"],fieldSets:[],fields:[{datatype:"Enum",defaultValue:1,displayName:"GLSL Version",name:"GLSLVersion",options:[1,3],type:"Attribute"},{datatype:"Enum",defaultValue:"Full",displayName:"Resolution",name:"Resolution",options:["Full","Half","Quarter"],type:"Attribute"},{displayName:"Texture Channel 1",linkableTypes:["Image"],type:"Link",usageAs:"TexChannel1"},{displayName:"Texture Channel 2",linkableTypes:["Image"],type:"Link",usageAs:"TexChannel2"},{displayName:"Texture Channel 3",linkableTypes:["Image"],type:"Link",usageAs:"TexChannel3"},{displayName:"Texture Channel 4",linkableTypes:["Image"],type:"Link",usageAs:"TexChannel4"}],name:"Background Shader",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"5e6a1ad189707feef9173399"},contentTypes:["video/mp4","video/webm"],fieldSets:[],fields:[{datatype:"Enum",defaultValue:"Linear",displayName:"Encoding",name:"Encoding",options:["Linear","sRGB"],type:"Attribute"}],name:"Video",creatableEmpty:false},{_id:{$oid:"5e8c9d5c02a37596bb1fd5b6"},contentTypes:[""],fieldSets:[],fields:[{elementName:"Item",fields:[{datatype:"String",defaultValue:"",displayName:"Description",name:"Description",type:"Attribute"},{type:"Link",usageAs:"Item",mandatory:true}],name:"Items",type:"List"}],name:"Collection",creatableEmpty:true},{_id:{$oid:"5e8c9d5c02a33596bb53d5b6"},contentTypes:[""],fieldSets:[],fields:[{displayName:"Audio items",elementName:"AudioItem",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{linkableTypes:["Audio"],type:"Link",usageAs:"Audio",mandatory:true}],name:"AudioItems",type:"List"}],name:"Audio Collection",creatableEmpty:true},{_id:{$oid:"5e8c9d5c01a32576bb53d5b6"},contentTypes:[""],fieldSets:[],fields:[{displayName:"Mesh items",elementName:"MeshItem",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{linkableTypes:["Mesh"],type:"Link",usageAs:"Mesh",mandatory:true}],name:"MeshItems",type:"List"}],name:"Mesh Collection",creatableEmpty:true},{_id:{$oid:"5e8c9d5c0233596cb31d5ba2"},contentTypes:[""],fieldSets:[],fields:[{displayName:"Material items",elementName:"MaterialItem",fields:[{datatype:"String",defaultValue:"",displayName:"Name",name:"Name",type:"Attribute"},{linkableTypes:["Material"],type:"Link",usageAs:"Material",mandatory:true}],name:"MaterialItems",type:"List"}],name:"Material Collection",creatableEmpty:true},{_id:{$oid:"5edf2f6edc25bdf4e5723e52"},contentTypes:["text/x-yaml"],fieldSets:[],fields:[{displayName:"Material collections",elementName:"Material Collection",fields:[{linkableTypes:["Material Collection"],type:"Link",usageAs:"MaterialCollection",displayName:"Material Collection",mandatory:true}],name:"MaterialCollections",type:"List"},{displayName:"Mesh collections",elementName:"Mesh Collection",fields:[{linkableTypes:["Mesh Collection"],type:"Link",usageAs:"MeshCollection",displayName:"Mesh Collection",mandatory:true}],name:"MeshCollections",type:"List"}],name:"GridMap",creatableEmpty:true},{_id:{$oid:"60827c20d3f7a631e71522cc"},contentTypes:[],fieldSets:[],fields:[],name:"Dataset",creatableEmpty:false},{_id:{$oid:"62133ff41302cfcd0d9a2346"},contentTypes:["text/x-glsl"],fieldSets:[],fields:[],name:"Pixel Shader",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"62133ffb1302cf53ef9a234e"},contentTypes:["text/x-glsl"],fieldSets:[],fields:[],name:"Vertex Shader",updateRequiresThumbRefresh:false,creatableEmpty:true},{_id:{$oid:"62a83a1ef46738fe096fd7e3"},contentTypes:["application/zip"],fieldSets:[],fields:[],name:"Archive",updateRequiresThumbRefresh:false,creatableEmpty:false},{_id:{$oid:"640076f0e49250ab06ea4aec"},contentTypes:["font/ttf","font/otf"],fieldSets:[],fields:[],name:"Font",updateRequiresThumbRefresh:true,creatableEmpty:false},{_id:{$oid:"6463df676055450cac673d90"},contentTypes:[],fieldSets:[],fields:[{label:"General Settings",type:"Separator"},{datatype:"Integer",defaultValue:1e3,displayName:"Maximum Number of Particles",info:"The maximum number of particles that can exist at the same time in the simulation.",minValue:0,name:"MaxParticles",type:"Attribute"},{datatype:"Float",defaultValue:-1,displayName:"Duration",info:"Duration (in seconds) the particle system runs. Use -1 for infinite duration.",minValue:-1,name:"Duration",type:"Attribute"},{datatype:"Enum",defaultValue:"Local",displayName:"Coordinate System",info:"Defines whether particle movement is relative to the emitter's local space or the global world space.",name:"SystemCoordinates",options:["Local","World"],type:"Attribute"},{label:"Emission Settings",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Emit All At Once",info:"Emit all particles immediately when the simulation starts.",name:"EmitAllAtOnce",type:"Attribute"},{datatype:"Float",defaultValue:128,minValue:0,displayName:"Spawn amount",if:{EmitAllAtOnce:false},info:"The number of particles emitted each time the emitter spawns.",name:"SpawnAmount",type:"Attribute"},{datatype:"Float",defaultValue:1,minValue:0,displayName:"Spawn Interval",info:"The time, in seconds, between each consecutive spawn of particles.",if:{EmitAllAtOnce:false},name:"SpawnRate",type:"Attribute"},{datatype:"Float",defaultValue:-1,minValue:-1,displayName:"Number of Emissions",info:"Total number of spawn events before emission stops; after this number of emissions, no more particles will be emitted.",if:{EmitAllAtOnce:false},name:"MaximumEmissions",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Continuous emission",info:"If enabled, particles in each emission spawn gradually over time instead of instantly.",if:{EmitAllAtOnce:false},name:"ContinuousEmissionFlag",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Auto Respawn",info:"Automatically respawn particles when they die.",name:"Respawn",type:"Attribute",if:{EmitAllAtOnce:true}},{label:"Size Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Constant",options:["Constant","Variable","Velocity"],displayName:"Scaling Mode",info:"Determines how particle size changes over their lifetime: constant size, variable scaling, or based on velocity.",name:"ScaleMode",type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Base Size",info:"The size of the particles at emission",minValue:0,name:"ParticleInitialSize",type:"Attribute"},{datatype:"Float",defaultValue:15,displayName:"Final Size",info:"The size particles reach at the end of their lifetime. If particles die early, they may not reach their final size.",minValue:0,name:"ParticleFinalSize",type:"Attribute",if:{ScaleMode:"Variable"}},{datatype:"Float",displayName:"Scale Randomness",name:"ScaleRandomness",defaultValue:.1,minValue:0,maxValue:1,info:"Random variation applied to scale curve values."},{datatype:"Enum",defaultValue:"Linear",options:["Linear","Exponential","Inverse Exponential","Ease-in, Ease-out"],displayName:"Interpolation Function",info:"Interpolation method for scaling particles over their lifetime.",type:"Attribute",name:"ScaleFunction",if:{ScaleMode:"Variable"}},{datatype:"Float",defaultValue:.5,minValue:0,maxValue:5,if:{ScaleMode:"Variable",$or:[{ScaleFunction:"Exponential"},{ScaleFunction:"Inverse Exponential"},{ScaleFunction:"Ease-in, Ease-out"}]},displayName:"Interpolation Rate",name:"ApproachSize",info:"Controls the rate at which particles scale over time based on the interpolation modes.",type:"Attribute"},{label:"Velocity Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Constant",options:["Constant","Variable"],displayName:"Velocity Mode",info:"Determines if particles maintain a constant velocity or change velocity over their lifetime.",name:"VelocityMode",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Initial Velocity",info:"The starting velocity of particles when emitted.",name:"InitialVelocity",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Final Velocity",info:"The velocity particles will reach by the end of their lifetime. Used only when Velocity Mode is set to Variable.",name:"FinalVelocity",type:"Attribute",if:{VelocityMode:"Variable"}},{datatype:"Enum",defaultValue:"Linear",options:["Linear","Exponential","Inverse Exponential","Ease-in, Ease-out"],displayName:"Interpolation Function",info:"Defines the interpolation method for velocity changes over the particle’s lifetime.",name:"VelocityFunction",type:"Attribute",if:{VelocityMode:"Variable"}},{datatype:"Float",defaultValue:.5,displayName:"Interpolation Rate",info:"Controls the rate at which particles transition from initial to final velocity for the interpolation modes.",maxValue:5,minValue:0,name:"FinalVelocityApproach",type:"Attribute",if:{VelocityMode:"Variable",$or:[{VelocityFunction:"Exponential"},{VelocityFunction:"Inverse Exponential"},{VelocityFunction:"Ease-in, Ease-out"}]}},{datatype:"Float",defaultValue:0,displayName:"Spread",info:"Randomly offsets the emission angle (in degrees) from the base direction. A value of 360° emits particles uniformly in all directions. Requires Initial Velocity not be a 0-vector to have any effect.",maxValue:360,minValue:0,name:"Spread",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Angular Velocity",info:"The speed at which particles rotate around their center of mass, in radians per second.",minValue:0,name:"AngularVelocity",type:"Attribute",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]}},{datatype:"Enum",defaultValue:"Clockwise",options:["Clockwise","Anticlockwise"],displayName:"Rotation Direction",info:"Controls the rotation direction of particles.",name:"AngularDirection",type:"Attribute",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]}},{datatype:"Float",defaultValue:0,displayName:"Rotation Randomness",info:"Random variation applied to particle angular velocity. 0 = all particles rotate at the same speed, 1 = each particle can vary ±100% of base angular velocity.",minValue:0,maxValue:1,name:"RotationRandomness",type:"Attribute",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]}},{label:"Force Settings",type:"Separator",collapsed:true},{datatype:"Float",defaultValue:0,displayName:"Drift",info:"A random velocity added to particles in all directions to simulate drifting motion.",name:"Drift",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Gravity",info:"A constant acceleration applied to particles after emission, simulating gravity. Positive values pull particles downward; negative values pull them upward.",name:"Gravity",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Tangential Velocity",info:"Applies a tangential velocity to particles, causing them to orbit the center point along the defined orbital plane.",name:"OrbitalVelocity",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Orbit Center",info:"The point in 3D space around which particles orbit.",name:"OrbitalCenterPoint",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:1,z:0},displayName:"Orbital Plane",info:"A vector normal that defines the orientation of the orbital plane. Particles orbit around an axis perpendicular to this vector. Should be normalized (length = 1), but normalization is not enforced.",name:"OrbitalPlane",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Orbital Decay",info:"Causes particles to gradually spiral inward toward the orbital center over time.",name:"OrbitalDecay",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},displayName:"Target",info:"A 3D point in space that particles are attracted to.",name:"Target",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Target Force",info:"The strength of the attraction force pulling particles toward the target. Set to 0 to disable.",name:"TargetForce",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Kill on target",info:"If enabled, particles are deleted once they reach the target position.",name:"TargetDeleteFlag",type:"Attribute"},{datatype:"Float",defaultValue:.1,if:{TargetDeleteFlag:true},displayName:"Target Deletion Threshold",info:"The distance from the target at which particles are deleted.",minValue:0,name:"TargetDeletionThreshold",type:"Attribute"},{label:"Life Settings",type:"Separator",collapsed:true},{datatype:"Float",defaultValue:10,displayName:"Life",info:"Time in seconds each particle remains alive before disappearing.",minValue:0,name:"Life",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Life Randomness",info:"Adds randomness, in seconds, to particle lifetimes. Each particle's life is calculated as: life + random(0 to 1) x life randomness.",minValue:0,name:"LifeRandomness",type:"Attribute"},{label:"Texture and Color Settings",type:"Separator",collapsed:true},{datatype:"ParticlePreview",displayName:"Particle Preview",info:"Visual preview of a single particle.",name:"ParticlePreview",type:"Attribute"},{datatype:"Enum",defaultValue:"Base",name:"ParticleType",info:"Defines the rendering style of particles: Base (simple points), Texture (image-based), or Sprite (animated images).",options:["Base","Texture","Sprite"],type:"Attribute"},{displayName:"Texture",info:"Image used as the particle’s texture.",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]},linkableTypes:["Image"],type:"Link",usageAs:"ParticleTexture"},{datatype:"Boolean",defaultValue:true,displayName:"Circular Mask",info:"Applies a circular alpha mask to the texture or sprite, making only the circular area visible while masking out the corners.",name:"useCircularMask",type:"Attribute"},{datatype:"Boolean",defaultValue:false,name:"TextureBlending",displayName:"Texture Blending",info:"If enabled, blends the particle texture with the background or other particles for smoother visuals.",if:{$or:[{ParticleType:"Texture"},{ParticleType:"Sprite"}]},type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Texture hue",info:"Amount of hue shift applied to the particle texture, expressed as a normalized value from 0 to 1, where 0 corresponds to 0 radians (0°) and 1 corresponds to 2π radians (360°).",minValue:0,maxValue:1,name:"TextureHue",if:{$or:[{ParticleType:"Base"},{TextureBlending:true}]},type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Color",info:"Base color applied to particles at emission.",if:{$or:[{ParticleType:"Base"},{TextureBlending:true}]},name:"Color",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Use Final Color",info:"Enable color transition so particles interpolate to a specified final color at the end of their lifetime.",if:{$or:[{ParticleType:"Base"},{TextureBlending:true}]},name:"EnableFinalColor",type:"Attribute"},{datatype:"Color",defaultValue:{a:255,b:255,g:255,r:255},displayName:"Final Color",info:"The color particles interpolate to at the end of their life.",if:{EnableFinalColor:true,$or:[{ParticleType:"Base"},{TextureBlending:true}]},name:"FinalColor",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Random Color Factor",info:"Linearly blends each particle's color with a unique random tint. 0 = no randomness, 1 = full random color.",if:{$or:[{ParticleType:"Base"},{TextureBlending:true}]},minValue:0,maxValue:1,name:"RandomColorFactor",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Enable Sprite Fade",if:{ParticleType:"Sprite"},info:"Allows the sprite to smoothly fade in and fade, creating a softer transition.",name:"EnableSpriteFade",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Roll Sprite With Life",if:{ParticleType:"Sprite"},info:"Enable the sprite to animate by rolling through its frames based on the particle's lifetime.",name:"RollSpriteWithLife",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Sprite Speed",if:{ParticleType:"Sprite",RollSpriteWithLife:false},info:"Speed, in frames per seconds, at which the sprite animation advances over time.",minValue:0,name:"SpriteSpeed",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Sprite Cols",if:{ParticleType:"Sprite"},info:"Number of horizontal frames (columns) in the sprite sheet. Must be specified manually. Incorrect values may cause improper animation.",minValue:1,name:"SpriteColumns",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Sprite Rows",if:{ParticleType:"Sprite"},info:"Number of vertical frames (rows) in the sprite sheet. Must be specified manually. Incorrect values may cause improper animation.",minValue:1,name:"SpriteRows",type:"Attribute"},{label:"Blending Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Normal",displayName:"Blending Mode",name:"BlendingMode",options:["Add","Multiply","Negation","Normal","Subtract"],type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Opacity",info:"Adjusts how strongly the blending mode affects the final result.",maxValue:1,minValue:0,name:"Opacity",type:"Attribute",widget:"Slider"},{label:"Fade Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Constant",options:["Constant","Variable"],displayName:"Fading Mode",info:"Determines how particle opacity changes: constant transparency, fade over lifetime, or based on velocity.",name:"FadeMode",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Initial Opacity",info:"The opacity of particles when they are first emitted (0.0 = transparent, 1.0 = opaque)",minValue:0,maxValue:1,name:"ParticleInitialOpacity",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Final Opacity",info:"The opacity particles reach at the end of their lifetime. Creates fade-out effect when lower than initial opacity.",minValue:0,maxValue:1,name:"ParticleFinalOpacity",type:"Attribute",if:{FadeMode:"Variable"}},{datatype:"Enum",defaultValue:"Linear",options:["Linear","Exponential","Inverse Exponential","Ease-in, Ease-out"],displayName:"Fade Interpolation",info:"Controls how smoothly particles fade between initial and final opacity over their lifetime.",type:"Attribute",name:"FadeFunction",if:{FadeMode:"Variable"}},{datatype:"Float",defaultValue:1,minValue:.1,maxValue:5,if:{FadeMode:"Variable",$or:[{FadeFunction:"Exponential"},{FadeFunction:"Inverse Exponential"},{FadeFunction:"Ease-in, Ease-out"}]},displayName:"Fade Rate",name:"FadeApproach",info:"Controls how quickly the fade transition occurs. Higher values create sharper transitions, lower values create gentler fades.",type:"Attribute"},{label:"Emission Settings",type:"Separator",collapsed:true},{datatype:"Enum",defaultValue:"Box",name:"EmitterShape",displayName:"Emitter Shape",info:"Defines the geometric shape from which particles are emitted.",options:["Point","Box","Sphere","Hemisphere","Torus","Cone","Circle","Edge"],type:"Attribute"},{datatype:"Enum",defaultValue:"Volume",name:"EmitterTypeSurfaceVolumeNormal",displayName:"Emitter Type",info:"Specifies whether particles are emitted from the surface, volume, or along the normals of the shape.",options:["Surface","Volume","Normals"],if:{$or:[{EmitterShape:"Box"},{EmitterShape:"Sphere"},{EmitterShape:"Cone"}]},type:"Attribute"},{datatype:"Enum",defaultValue:"Volume",name:"EmitterTypeSurfaceVolume",info:"Specifies whether particles are emitted from the surface or volume of the shape.",displayName:"Emitter Type",options:["Surface","Volume"],if:{$or:[{EmitterShape:"Hemisphere"},{EmitterShape:"Torus"}]},type:"Attribute"},{datatype:"Float",defaultValue:10,displayName:"Velocity Along Normals.",info:"Speed at which particles are emitted along the surface normals.",if:{EmitterTypeSurfaceVolumeNormal:"Normals"},minValue:0,name:"NormalsVelocity",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The size of the emitter.",info:"Defines the size of the emitter.",if:{$or:[{EmitterShape:"Box"}]},minValue:0,name:"EmitterSize",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The radius of the emitter.",if:{$or:[{EmitterShape:"Torus"},{EmitterShape:"Cone"},{EmitterShape:"Sphere"},{EmitterShape:"Hemisphere"},{EmitterShape:"Circle"}]},minValue:0,name:"EmitterRadius",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The outer radius of the emitter",if:{$or:[{EmitterShape:"Torus"}]},minValue:0,name:"EmitterOuterRadius",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The height of the emitter",if:{$or:[{EmitterShape:"Cone"},{EmitterShape:"Edge"}]},minValue:0,name:"EmitterHeight",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"The width of the emitter.",if:{$or:[{EmitterShape:"Edge"}]},minValue:0,name:"EmitterWidth",type:"Attribute"},{datatype:"Boolean",defaultValue:false,displayName:"Round Tip",if:{$or:[{EmitterShape:"Cone"}]},info:"Round the tip of the cone instead of using a sharp point.",name:"EmitterRoundTip",type:"Attribute"},{label:"Bounding Box Settings",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Enable Bounding Box",info:"Enable a bounding box to restrict particles within a defined 3D area.",name:"EnableBBox",type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:10,y:10,z:10},info:"Coordinates of the bounding box's maximum corner (upper-right-front).",name:"BBoxMax",displayName:"Bounding Box Maximum Corner",if:{EnableBBox:true},type:"Attribute"},{datatype:"Vector3d",defaultValue:{x:0,y:0,z:0},info:"Coordinates of the bounding box's minimum corner (lower-left-back).",name:"BBoxMin",displayName:"Bounding Box Minimum Corner",if:{EnableBBox:true},type:"Attribute"},{label:"Curl Noise Settings",type:"Separator",collapsed:true},{datatype:"Boolean",defaultValue:false,displayName:"Enable Curl Noise",info:"Toggle curl noise effect on particles to simulate turbulent, swirling particle behavior.",name:"NoiseFlag",type:"Attribute"},{datatype:"NoisePreview",if:{NoiseFlag:true},displayName:"Noise Preview",info:"Visual preview of the curl noise pattern applied to the particle system.",name:"NoisePreview",type:"Attribute"},{datatype:"Float",defaultValue:0,displayName:"Noise Strength",if:{NoiseFlag:true},info:"Controls the intensity of the noise.",name:"NoiseStrength",type:"Attribute"},{datatype:"Float",defaultValue:1,displayName:"Noise Frequency",if:{NoiseFlag:true},info:"Determines the smoothness of the noise: lower values produce smooth, slow variations; higher values produce rapid, detailed changes.",name:"NoiseFrequency",type:"Attribute"},{datatype:"Integer",defaultValue:1,displayName:"Noise Octaves",if:{NoiseFlag:true},info:"Number of noise layers combined to create complexity. Higher octaves add detail but reduce performance.",name:"NoiseOctaves",type:"Attribute"}],name:"Particles",updateRequiresThumbRefresh:false,creatableEmpty:true}];function F(e,t=false){let a=I$1.find((t=>t.name===e));if(!a)return null;if(a=structuredClone(a),a.fields=a.fields||[],a.fieldSets=a.fieldSets||[],t&&a.inherits){const e=F(a.inherits,true);e&&(a.fields=[...e.fields,...a.fields],a.fieldSets=[...e.fieldSets,...a.fieldSets]);}return a}function E$1(){return structuredClone(I$1)}var D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function R$9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function L(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var P,B$9={exports:{}};var O,$=(P||(P=1,(O=B$9).exports=function(){var e,t;function a(){return e.apply(null,arguments)}function i(t){e=t;}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(s(e,t))return false;return true}function l(e){return void 0===e}function u(e){return "number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function c(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){var a,i=[],n=e.length;for(a=0;a<n;++a)i.push(t(e[a],a));return i}function p(e,t){for(var a in t)s(t,a)&&(e[a]=t[a]);return s(t,"toString")&&(e.toString=t.toString),s(t,"valueOf")&&(e.valueOf=t.valueOf),e}function h(e,t,a,i){return qa(e,t,a,i,true).utc()}function f(){return {empty:false,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:false,invalidEra:null,invalidMonth:null,invalidFormat:false,userInvalidated:false,iso:false,parsedDateParts:[],era:null,meridiem:null,rfc2822:false,weekdayMismatch:false}}function m(e){return null==e._pf&&(e._pf=f()),e._pf}function y(e){var a=null,i=false,n=e._d&&!isNaN(e._d.getTime());return n&&(a=m(e),i=t.call(a.parsedDateParts,(function(e){return null!=e})),n=a.overflow<0&&!a.empty&&!a.invalidEra&&!a.invalidMonth&&!a.invalidWeekday&&!a.weekdayMismatch&&!a.nullInput&&!a.invalidFormat&&!a.userInvalidated&&(!a.meridiem||a.meridiem&&i),e._strict&&(n=n&&0===a.charsLeftOver&&0===a.unusedTokens.length&&void 0===a.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e)?n:(e._isValid=n,e._isValid)}function g(e){var t=h(NaN);return null!=e?p(m(t),e):m(t).userInvalidated=true,t}t=Array.prototype.some?Array.prototype.some:function(e){var t,a=Object(this),i=a.length>>>0;for(t=0;t<i;t++)if(t in a&&e.call(this,a[t],t,a))return true;return false};var b=a.momentProperties=[],v=false;function _(e,t){var a,i,n,r=b.length;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=m(t)),l(t._locale)||(e._locale=t._locale),r>0)for(a=0;a<r;a++)l(n=t[i=b[a]])||(e[i]=n);return e}function w(e){_(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),false===v&&(v=true,a.updateOffset(this),v=false);}function A(e){return e instanceof w||null!=e&&null!=e._isAMomentObject}function k(e){ false===a.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e);}function S(e,t){var i=true;return p((function(){if(null!=a.deprecationHandler&&a.deprecationHandler(null,e),i){var n,r,o,l=[],u=arguments.length;for(r=0;r<u;r++){if(n="","object"==typeof arguments[r]){for(o in n+="\n["+r+"] ",arguments[0])s(arguments[0],o)&&(n+=o+": "+arguments[0][o]+", ");n=n.slice(0,-2);}else n=arguments[r];l.push(n);}k(e+"\nArguments: "+Array.prototype.slice.call(l).join("")+"\n"+(new Error).stack),i=false;}return t.apply(this,arguments)}),t)}var N,T={};function M(e,t){null!=a.deprecationHandler&&a.deprecationHandler(e,t),T[e]||(k(t),T[e]=true);}function x(e){return "undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function V(e){var t,a;for(a in e)s(e,a)&&(x(t=e[a])?this[a]=t:this["_"+a]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source);}function C(e,t){var a,i=p({},e);for(a in t)s(t,a)&&(r(e[a])&&r(t[a])?(i[a]={},p(i[a],e[a]),p(i[a],t[a])):null!=t[a]?i[a]=t[a]:delete i[a]);for(a in e)s(e,a)&&!s(t,a)&&r(e[a])&&(i[a]=p({},i[a]));return i}function I(e){null!=e&&this.set(e);}a.suppressDeprecationWarnings=false,a.deprecationHandler=null,N=Object.keys?Object.keys:function(e){var t,a=[];for(t in e)s(e,t)&&a.push(t);return a};var F={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function E(e,t,a){var i=this._calendar[e]||this._calendar.sameElse;return x(i)?i.call(t,a):i}function D(e,t,a){var i=""+Math.abs(e),n=t-i.length;return (e>=0?a?"+":"":"-")+Math.pow(10,Math.max(0,n)).toString().substr(1)+i}var R=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,P=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,B={},$={};function j(e,t,a,i){var n=i;"string"==typeof i&&(n=function(){return this[i]()}),e&&($[e]=n),t&&($[t[0]]=function(){return D(n.apply(this,arguments),t[1],t[2])}),a&&($[a]=function(){return this.localeData().ordinal(n.apply(this,arguments),e)});}function U(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function z(e){var t,a,i=e.match(R);for(t=0,a=i.length;t<a;t++)$[i[t]]?i[t]=$[i[t]]:i[t]=U(i[t]);return function(t){var n,r="";for(n=0;n<a;n++)r+=x(i[n])?i[n].call(t,e):i[n];return r}}function W(e,t){return e.isValid()?(t=Y(t,e.localeData()),B[t]=B[t]||z(t),B[t](e)):e.localeData().invalidDate()}function Y(e,t){var a=5;function i(e){return t.longDateFormat(e)||e}for(P.lastIndex=0;a>=0&&P.test(e);)e=e.replace(P,i),P.lastIndex=0,a-=1;return e}var H={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function G(e){var t=this._longDateFormat[e],a=this._longDateFormat[e.toUpperCase()];return t||!a?t:(this._longDateFormat[e]=a.match(R).map((function(e){return "MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e})).join(""),this._longDateFormat[e])}var q="Invalid date";function Z(){return this._invalidDate}var J="%d",K=/\d{1,2}/;function X(e){return this._ordinal.replace("%d",e)}var Q={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function ee(e,t,a,i){var n=this._relativeTime[a];return x(n)?n(e,t,a,i):n.replace(/%d/i,e)}function te(e,t){var a=this._relativeTime[e>0?"future":"past"];return x(a)?a(t):a.replace(/%s/i,t)}var ae={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ie(e){return "string"==typeof e?ae[e]||ae[e.toLowerCase()]:void 0}function ne(e){var t,a,i={};for(a in e)s(e,a)&&(t=ie(a))&&(i[t]=e[a]);return i}var re={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function se(e){var t,a=[];for(t in e)s(e,t)&&a.push({unit:t,priority:re[t]});return a.sort((function(e,t){return e.priority-t.priority})),a}var oe,le=/\d/,ue=/\d\d/,ce=/\d{3}/,de=/\d{4}/,pe=/[+-]?\d{6}/,he=/\d\d?/,fe=/\d\d\d\d?/,me=/\d\d\d\d\d\d?/,ye=/\d{1,3}/,ge=/\d{1,4}/,be=/[+-]?\d{1,6}/,ve=/\d+/,_e=/[+-]?\d+/,we=/Z|[+-]\d\d:?\d\d/gi,Ae=/Z|[+-]\d\d(?::?\d\d)?/gi,ke=/[+-]?\d+(\.\d{1,3})?/,Se=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Ne=/^[1-9]\d?/,Te=/^([1-9]\d|\d)/;function Me(e,t,a){oe[e]=x(t)?t:function(e,i){return e&&a?a:t};}function xe(e,t){return s(oe,e)?oe[e](t._strict,t._locale):new RegExp(Ve(e))}function Ve(e){return Ce(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,a,i,n){return t||a||i||n})))}function Ce(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Ie(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function Fe(e){var t=+e,a=0;return 0!==t&&isFinite(t)&&(a=Ie(t)),a}oe={};var Ee={};function De(e,t){var a,i,n=t;for("string"==typeof e&&(e=[e]),u(t)&&(n=function(e,a){a[t]=Fe(e);}),i=e.length,a=0;a<i;a++)Ee[e[a]]=n;}function Re(e,t){De(e,(function(e,a,i,n){i._w=i._w||{},t(e,i._w,i,n);}));}function Le(e,t,a){null!=t&&s(Ee,e)&&Ee[e](t,a._a,a,e);}function Pe(e){return e%4==0&&e%100!=0||e%400==0}var Be=0,Oe=1,$e=2,je=3,Ue=4,ze=5,We=6,Ye=7,He=8;function Ge(e){return Pe(e)?366:365}j("Y",0,0,(function(){var e=this.year();return e<=9999?D(e,4):"+"+e})),j(0,["YY",2],0,(function(){return this.year()%100})),j(0,["YYYY",4],0,"year"),j(0,["YYYYY",5],0,"year"),j(0,["YYYYYY",6,true],0,"year"),Me("Y",_e),Me("YY",he,ue),Me("YYYY",ge,de),Me("YYYYY",be,pe),Me("YYYYYY",be,pe),De(["YYYYY","YYYYYY"],Be),De("YYYY",(function(e,t){t[Be]=2===e.length?a.parseTwoDigitYear(e):Fe(e);})),De("YY",(function(e,t){t[Be]=a.parseTwoDigitYear(e);})),De("Y",(function(e,t){t[Be]=parseInt(e,10);})),a.parseTwoDigitYear=function(e){return Fe(e)+(Fe(e)>68?1900:2e3)};var qe,Ze=Ke("FullYear",true);function Je(){return Pe(this.year())}function Ke(e,t){return function(i){return null!=i?(Qe(this,e,i),a.updateOffset(this,t),this):Xe(this,e)}}function Xe(e,t){if(!e.isValid())return NaN;var a=e._d,i=e._isUTC;switch(t){case "Milliseconds":return i?a.getUTCMilliseconds():a.getMilliseconds();case "Seconds":return i?a.getUTCSeconds():a.getSeconds();case "Minutes":return i?a.getUTCMinutes():a.getMinutes();case "Hours":return i?a.getUTCHours():a.getHours();case "Date":return i?a.getUTCDate():a.getDate();case "Day":return i?a.getUTCDay():a.getDay();case "Month":return i?a.getUTCMonth():a.getMonth();case "FullYear":return i?a.getUTCFullYear():a.getFullYear();default:return NaN}}function Qe(e,t,a){var i,n,r,s,o;if(e.isValid()&&!isNaN(a)){switch(i=e._d,n=e._isUTC,t){case "Milliseconds":return void(n?i.setUTCMilliseconds(a):i.setMilliseconds(a));case "Seconds":return void(n?i.setUTCSeconds(a):i.setSeconds(a));case "Minutes":return void(n?i.setUTCMinutes(a):i.setMinutes(a));case "Hours":return void(n?i.setUTCHours(a):i.setHours(a));case "Date":return void(n?i.setUTCDate(a):i.setDate(a));case "FullYear":break;default:return}r=a,s=e.month(),o=29!==(o=e.date())||1!==s||Pe(r)?o:28,n?i.setUTCFullYear(r,s,o):i.setFullYear(r,s,o);}}function et(e){return x(this[e=ie(e)])?this[e]():this}function tt(e,t){if("object"==typeof e){var a,i=se(e=ne(e)),n=i.length;for(a=0;a<n;a++)this[i[a].unit](e[i[a].unit]);}else if(x(this[e=ie(e)]))return this[e](t);return this}function at(e,t){return (e%t+t)%t}function it(e,t){if(isNaN(e)||isNaN(t))return NaN;var a=at(t,12);return e+=(t-a)/12,1===a?Pe(e)?29:28:31-a%7%2}qe=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return -1},j("M",["MM",2],"Mo",(function(){return this.month()+1})),j("MMM",0,0,(function(e){return this.localeData().monthsShort(this,e)})),j("MMMM",0,0,(function(e){return this.localeData().months(this,e)})),Me("M",he,Ne),Me("MM",he,ue),Me("MMM",(function(e,t){return t.monthsShortRegex(e)})),Me("MMMM",(function(e,t){return t.monthsRegex(e)})),De(["M","MM"],(function(e,t){t[Oe]=Fe(e)-1;})),De(["MMM","MMMM"],(function(e,t,a,i){var n=a._locale.monthsParse(e,i,a._strict);null!=n?t[Oe]=n:m(a).invalidMonth=e;}));var nt="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),rt="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),st=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,ot=Se,lt=Se;function ut(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||st).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone}function ct(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[st.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function dt(e,t,a){var i,n,r,s=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;i<12;++i)r=h([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(r,"").toLocaleLowerCase();return a?"MMM"===t?-1!==(n=qe.call(this._shortMonthsParse,s))?n:null:-1!==(n=qe.call(this._longMonthsParse,s))?n:null:"MMM"===t?-1!==(n=qe.call(this._shortMonthsParse,s))||-1!==(n=qe.call(this._longMonthsParse,s))?n:null:-1!==(n=qe.call(this._longMonthsParse,s))||-1!==(n=qe.call(this._shortMonthsParse,s))?n:null}function pt(e,t,a){var i,n,r;if(this._monthsParseExact)return dt.call(this,e,t,a);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(n=h([2e3,i]),a&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(n,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(n,"").replace(".","")+"$","i")),a||this._monthsParse[i]||(r="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[i]=new RegExp(r.replace(".",""),"i")),a&&"MMMM"===t&&this._longMonthsParse[i].test(e))return i;if(a&&"MMM"===t&&this._shortMonthsParse[i].test(e))return i;if(!a&&this._monthsParse[i].test(e))return i}}function ht(e,t){if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=Fe(t);else if(!u(t=e.localeData().monthsParse(t)))return e;var a=t,i=e.date();return i=i<29?i:Math.min(i,it(e.year(),a)),e._isUTC?e._d.setUTCMonth(a,i):e._d.setMonth(a,i),e}function ft(e){return null!=e?(ht(this,e),a.updateOffset(this,true),this):Xe(this,"Month")}function mt(){return it(this.year(),this.month())}function yt(e){return this._monthsParseExact?(s(this,"_monthsRegex")||bt.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(s(this,"_monthsShortRegex")||(this._monthsShortRegex=ot),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function gt(e){return this._monthsParseExact?(s(this,"_monthsRegex")||bt.call(this),e?this._monthsStrictRegex:this._monthsRegex):(s(this,"_monthsRegex")||(this._monthsRegex=lt),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function bt(){function e(e,t){return t.length-e.length}var t,a,i,n,r=[],s=[],o=[];for(t=0;t<12;t++)a=h([2e3,t]),i=Ce(this.monthsShort(a,"")),n=Ce(this.months(a,"")),r.push(i),s.push(n),o.push(n),o.push(i);r.sort(e),s.sort(e),o.sort(e),this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")","i");}function vt(e,t,a,i,n,r,s){var o;return e<100&&e>=0?(o=new Date(e+400,t,a,i,n,r,s),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,a,i,n,r,s),o}function _t(e){var t,a;return e<100&&e>=0?((a=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,a)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function wt(e,t,a){var i=7+t-a;return -(7+_t(e,0,i).getUTCDay()-t)%7+i-1}function At(e,t,a,i,n){var r,s,o=1+7*(t-1)+(7+a-i)%7+wt(e,i,n);return o<=0?s=Ge(r=e-1)+o:o>Ge(e)?(r=e+1,s=o-Ge(e)):(r=e,s=o),{year:r,dayOfYear:s}}function kt(e,t,a){var i,n,r=wt(e.year(),t,a),s=Math.floor((e.dayOfYear()-r-1)/7)+1;return s<1?i=s+St(n=e.year()-1,t,a):s>St(e.year(),t,a)?(i=s-St(e.year(),t,a),n=e.year()+1):(n=e.year(),i=s),{week:i,year:n}}function St(e,t,a){var i=wt(e,t,a),n=wt(e+1,t,a);return (Ge(e)-i+n)/7}function Nt(e){return kt(e,this._week.dow,this._week.doy).week}j("w",["ww",2],"wo","week"),j("W",["WW",2],"Wo","isoWeek"),Me("w",he,Ne),Me("ww",he,ue),Me("W",he,Ne),Me("WW",he,ue),Re(["w","ww","W","WW"],(function(e,t,a,i){t[i.substr(0,1)]=Fe(e);}));var Tt={dow:0,doy:6};function Mt(){return this._week.dow}function xt(){return this._week.doy}function Vt(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function Ct(e){var t=kt(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function It(e,t){return "string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}function Ft(e,t){return "string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Et(e,t){return e.slice(t,7).concat(e.slice(0,t))}j("d",0,"do","day"),j("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),j("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),j("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),j("e",0,0,"weekday"),j("E",0,0,"isoWeekday"),Me("d",he),Me("e",he),Me("E",he),Me("dd",(function(e,t){return t.weekdaysMinRegex(e)})),Me("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),Me("dddd",(function(e,t){return t.weekdaysRegex(e)})),Re(["dd","ddd","dddd"],(function(e,t,a,i){var n=a._locale.weekdaysParse(e,i,a._strict);null!=n?t.d=n:m(a).invalidWeekday=e;})),Re(["d","e","E"],(function(e,t,a,i){t[i]=Fe(e);}));var Dt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Rt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Lt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Pt=Se,Bt=Se,Ot=Se;function $t(e,t){var a=n(this._weekdays)?this._weekdays:this._weekdays[e&&true!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return true===e?Et(a,this._week.dow):e?a[e.day()]:a}function jt(e){return true===e?Et(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Ut(e){return true===e?Et(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function zt(e,t,a){var i,n,r,s=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)r=h([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(r,"").toLocaleLowerCase();return a?"dddd"===t?-1!==(n=qe.call(this._weekdaysParse,s))?n:null:"ddd"===t?-1!==(n=qe.call(this._shortWeekdaysParse,s))?n:null:-1!==(n=qe.call(this._minWeekdaysParse,s))?n:null:"dddd"===t?-1!==(n=qe.call(this._weekdaysParse,s))||-1!==(n=qe.call(this._shortWeekdaysParse,s))||-1!==(n=qe.call(this._minWeekdaysParse,s))?n:null:"ddd"===t?-1!==(n=qe.call(this._shortWeekdaysParse,s))||-1!==(n=qe.call(this._weekdaysParse,s))||-1!==(n=qe.call(this._minWeekdaysParse,s))?n:null:-1!==(n=qe.call(this._minWeekdaysParse,s))||-1!==(n=qe.call(this._weekdaysParse,s))||-1!==(n=qe.call(this._shortWeekdaysParse,s))?n:null}function Wt(e,t,a){var i,n,r;if(this._weekdaysParseExact)return zt.call(this,e,t,a);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(n=h([2e3,1]).day(i),a&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(n,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(n,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(n,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[i]||(r="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[i]=new RegExp(r.replace(".",""),"i")),a&&"dddd"===t&&this._fullWeekdaysParse[i].test(e))return i;if(a&&"ddd"===t&&this._shortWeekdaysParse[i].test(e))return i;if(a&&"dd"===t&&this._minWeekdaysParse[i].test(e))return i;if(!a&&this._weekdaysParse[i].test(e))return i}}function Yt(e){if(!this.isValid())return null!=e?this:NaN;var t=Xe(this,"Day");return null!=e?(e=It(e,this.localeData()),this.add(e-t,"d")):t}function Ht(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function Gt(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=Ft(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function qt(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Kt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(s(this,"_weekdaysRegex")||(this._weekdaysRegex=Pt),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Zt(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Kt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(s(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Bt),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Jt(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Kt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(s(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ot),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Kt(){function e(e,t){return t.length-e.length}var t,a,i,n,r,s=[],o=[],l=[],u=[];for(t=0;t<7;t++)a=h([2e3,1]).day(t),i=Ce(this.weekdaysMin(a,"")),n=Ce(this.weekdaysShort(a,"")),r=Ce(this.weekdays(a,"")),s.push(i),o.push(n),l.push(r),u.push(i),u.push(n),u.push(r);s.sort(e),o.sort(e),l.sort(e),u.sort(e),this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i");}function Xt(){return this.hours()%12||12}function Qt(){return this.hours()||24}function ea(e,t){j(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}));}function ta(e,t){return t._meridiemParse}function aa(e){return "p"===(e+"").toLowerCase().charAt(0)}j("H",["HH",2],0,"hour"),j("h",["hh",2],0,Xt),j("k",["kk",2],0,Qt),j("hmm",0,0,(function(){return ""+Xt.apply(this)+D(this.minutes(),2)})),j("hmmss",0,0,(function(){return ""+Xt.apply(this)+D(this.minutes(),2)+D(this.seconds(),2)})),j("Hmm",0,0,(function(){return ""+this.hours()+D(this.minutes(),2)})),j("Hmmss",0,0,(function(){return ""+this.hours()+D(this.minutes(),2)+D(this.seconds(),2)})),ea("a",true),ea("A",false),Me("a",ta),Me("A",ta),Me("H",he,Te),Me("h",he,Ne),Me("k",he,Ne),Me("HH",he,ue),Me("hh",he,ue),Me("kk",he,ue),Me("hmm",fe),Me("hmmss",me),Me("Hmm",fe),Me("Hmmss",me),De(["H","HH"],je),De(["k","kk"],(function(e,t,a){var i=Fe(e);t[je]=24===i?0:i;})),De(["a","A"],(function(e,t,a){a._isPm=a._locale.isPM(e),a._meridiem=e;})),De(["h","hh"],(function(e,t,a){t[je]=Fe(e),m(a).bigHour=true;})),De("hmm",(function(e,t,a){var i=e.length-2;t[je]=Fe(e.substr(0,i)),t[Ue]=Fe(e.substr(i)),m(a).bigHour=true;})),De("hmmss",(function(e,t,a){var i=e.length-4,n=e.length-2;t[je]=Fe(e.substr(0,i)),t[Ue]=Fe(e.substr(i,2)),t[ze]=Fe(e.substr(n)),m(a).bigHour=true;})),De("Hmm",(function(e,t,a){var i=e.length-2;t[je]=Fe(e.substr(0,i)),t[Ue]=Fe(e.substr(i));})),De("Hmmss",(function(e,t,a){var i=e.length-4,n=e.length-2;t[je]=Fe(e.substr(0,i)),t[Ue]=Fe(e.substr(i,2)),t[ze]=Fe(e.substr(n));}));var ia=/[ap]\.?m?\.?/i,na=Ke("Hours",true);function ra(e,t,a){return e>11?a?"pm":"PM":a?"am":"AM"}var sa,oa={calendar:F,longDateFormat:H,invalidDate:q,ordinal:J,dayOfMonthOrdinalParse:K,relativeTime:Q,months:nt,monthsShort:rt,week:Tt,weekdays:Dt,weekdaysMin:Lt,weekdaysShort:Rt,meridiemParse:ia},la={},ua={};function ca(e,t){var a,i=Math.min(e.length,t.length);for(a=0;a<i;a+=1)if(e[a]!==t[a])return a;return i}function da(e){return e?e.toLowerCase().replace("_","-"):e}function pa(e){for(var t,a,i,n,r=0;r<e.length;){for(t=(n=da(e[r]).split("-")).length,a=(a=da(e[r+1]))?a.split("-"):null;t>0;){if(i=fa(n.slice(0,t).join("-")))return i;if(a&&a.length>=t&&ca(n,a)>=t-1)break;t--;}r++;}return sa}function ha(e){return !(!e||!e.match("^[^/\\\\]*$"))}function fa(e){var t=null;if(void 0===la[e]&&O&&O.exports&&ha(e))try{t=sa._abbr,L("./locale/"+e),ma(t);}catch(t){la[e]=null;}return la[e]}function ma(e,t){var a;return e&&((a=l(t)?ba(e):ya(e,t))?sa=a:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),sa._abbr}function ya(e,t){if(null!==t){var a,i=oa;if(t.abbr=e,null!=la[e])M("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=la[e]._config;else if(null!=t.parentLocale)if(null!=la[t.parentLocale])i=la[t.parentLocale]._config;else {if(null==(a=fa(t.parentLocale)))return ua[t.parentLocale]||(ua[t.parentLocale]=[]),ua[t.parentLocale].push({name:e,config:t}),null;i=a._config;}return la[e]=new I(C(i,t)),ua[e]&&ua[e].forEach((function(e){ya(e.name,e.config);})),ma(e),la[e]}return delete la[e],null}function ga(e,t){if(null!=t){var a,i,n=oa;null!=la[e]&&null!=la[e].parentLocale?la[e].set(C(la[e]._config,t)):(null!=(i=fa(e))&&(n=i._config),t=C(n,t),null==i&&(t.abbr=e),(a=new I(t)).parentLocale=la[e],la[e]=a),ma(e);}else null!=la[e]&&(null!=la[e].parentLocale?(la[e]=la[e].parentLocale,e===ma()&&ma(e)):null!=la[e]&&delete la[e]);return la[e]}function ba(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return sa;if(!n(e)){if(t=fa(e))return t;e=[e];}return pa(e)}function va(){return N(la)}function _a(e){var t,a=e._a;return a&&-2===m(e).overflow&&(t=a[Oe]<0||a[Oe]>11?Oe:a[$e]<1||a[$e]>it(a[Be],a[Oe])?$e:a[je]<0||a[je]>24||24===a[je]&&(0!==a[Ue]||0!==a[ze]||0!==a[We])?je:a[Ue]<0||a[Ue]>59?Ue:a[ze]<0||a[ze]>59?ze:a[We]<0||a[We]>999?We:-1,m(e)._overflowDayOfYear&&(t<Be||t>$e)&&(t=$e),m(e)._overflowWeeks&&-1===t&&(t=Ye),m(e)._overflowWeekday&&-1===t&&(t=He),m(e).overflow=t),e}var wa=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Aa=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ka=/Z|[+-]\d\d(?::?\d\d)?/,Sa=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,false],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,false],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,false],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,false],["YYYY",/\d{4}/,false]],Na=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ta=/^\/?Date\((-?\d+)/i,Ma=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,xa={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Va(e){var t,a,i,n,r,s,o=e._i,l=wa.exec(o)||Aa.exec(o),u=Sa.length,c=Na.length;if(l){for(m(e).iso=true,t=0,a=u;t<a;t++)if(Sa[t][1].exec(l[1])){n=Sa[t][0],i=false!==Sa[t][2];break}if(null==n)return void(e._isValid=false);if(l[3]){for(t=0,a=c;t<a;t++)if(Na[t][1].exec(l[3])){r=(l[2]||" ")+Na[t][0];break}if(null==r)return void(e._isValid=false)}if(!i&&null!=r)return void(e._isValid=false);if(l[4]){if(!ka.exec(l[4]))return void(e._isValid=false);s="Z";}e._f=n+(r||"")+(s||""),ja(e);}else e._isValid=false;}function Ca(e,t,a,i,n,r){var s=[Ia(e),rt.indexOf(t),parseInt(a,10),parseInt(i,10),parseInt(n,10)];return r&&s.push(parseInt(r,10)),s}function Ia(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Fa(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Ea(e,t,a){return !e||Rt.indexOf(e)===new Date(t[0],t[1],t[2]).getDay()||(m(a).weekdayMismatch=true,a._isValid=false,false)}function Da(e,t,a){if(e)return xa[e];if(t)return 0;var i=parseInt(a,10),n=i%100;return (i-n)/100*60+n}function Ra(e){var t,a=Ma.exec(Fa(e._i));if(a){if(t=Ca(a[4],a[3],a[2],a[5],a[6],a[7]),!Ea(a[1],t,e))return;e._a=t,e._tzm=Da(a[8],a[9],a[10]),e._d=_t.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),m(e).rfc2822=true;}else e._isValid=false;}function La(e){var t=Ta.exec(e._i);null===t?(Va(e),false===e._isValid&&(delete e._isValid,Ra(e),false===e._isValid&&(delete e._isValid,e._strict?e._isValid=false:a.createFromInputFallback(e)))):e._d=new Date(+t[1]);}function Pa(e,t,a){return null!=e?e:null!=t?t:a}function Ba(e){var t=new Date(a.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function Oa(e){var t,a,i,n,r,s=[];if(!e._d){for(i=Ba(e),e._w&&null==e._a[$e]&&null==e._a[Oe]&&$a(e),null!=e._dayOfYear&&(r=Pa(e._a[Be],i[Be]),(e._dayOfYear>Ge(r)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=true),a=_t(r,0,e._dayOfYear),e._a[Oe]=a.getUTCMonth(),e._a[$e]=a.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=s[t]=i[t];for(;t<7;t++)e._a[t]=s[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[je]&&0===e._a[Ue]&&0===e._a[ze]&&0===e._a[We]&&(e._nextDay=true,e._a[je]=0),e._d=(e._useUTC?_t:vt).apply(null,s),n=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[je]=24),e._w&&void 0!==e._w.d&&e._w.d!==n&&(m(e).weekdayMismatch=true);}}function $a(e){var t,a,i,n,r,s,o,l,u;null!=(t=e._w).GG||null!=t.W||null!=t.E?(r=1,s=4,a=Pa(t.GG,e._a[Be],kt(Za(),1,4).year),i=Pa(t.W,1),((n=Pa(t.E,1))<1||n>7)&&(l=true)):(r=e._locale._week.dow,s=e._locale._week.doy,u=kt(Za(),r,s),a=Pa(t.gg,e._a[Be],u.year),i=Pa(t.w,u.week),null!=t.d?((n=t.d)<0||n>6)&&(l=true):null!=t.e?(n=t.e+r,(t.e<0||t.e>6)&&(l=true)):n=r),i<1||i>St(a,r,s)?m(e)._overflowWeeks=true:null!=l?m(e)._overflowWeekday=true:(o=At(a,i,n,r,s),e._a[Be]=o.year,e._dayOfYear=o.dayOfYear);}function ja(e){if(e._f!==a.ISO_8601)if(e._f!==a.RFC_2822){e._a=[],m(e).empty=true;var t,i,n,r,s,o,l,u=""+e._i,c=u.length,d=0;for(l=(n=Y(e._f,e._locale).match(R)||[]).length,t=0;t<l;t++)r=n[t],(i=(u.match(xe(r,e))||[])[0])&&((s=u.substr(0,u.indexOf(i))).length>0&&m(e).unusedInput.push(s),u=u.slice(u.indexOf(i)+i.length),d+=i.length),$[r]?(i?m(e).empty=false:m(e).unusedTokens.push(r),Le(r,i,e)):e._strict&&!i&&m(e).unusedTokens.push(r);m(e).charsLeftOver=c-d,u.length>0&&m(e).unusedInput.push(u),e._a[je]<=12&&true===m(e).bigHour&&e._a[je]>0&&(m(e).bigHour=void 0),m(e).parsedDateParts=e._a.slice(0),m(e).meridiem=e._meridiem,e._a[je]=Ua(e._locale,e._a[je],e._meridiem),null!==(o=m(e).era)&&(e._a[Be]=e._locale.erasConvertYear(o,e._a[Be])),Oa(e),_a(e);}else Ra(e);else Va(e);}function Ua(e,t,a){var i;return null==a?t:null!=e.meridiemHour?e.meridiemHour(t,a):null!=e.isPM?((i=e.isPM(a))&&t<12&&(t+=12),i||12!==t||(t=0),t):t}function za(e){var t,a,i,n,r,s,o=false,l=e._f.length;if(0===l)return m(e).invalidFormat=true,void(e._d=new Date(NaN));for(n=0;n<l;n++)r=0,s=false,t=_({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[n],ja(t),y(t)&&(s=true),r+=m(t).charsLeftOver,r+=10*m(t).unusedTokens.length,m(t).score=r,o?r<i&&(i=r,a=t):(null==i||r<i||s)&&(i=r,a=t,s&&(o=true));p(e,a||t);}function Wa(e){if(!e._d){var t=ne(e._i),a=void 0===t.day?t.date:t.day;e._a=d([t.year,t.month,a,t.hour,t.minute,t.second,t.millisecond],(function(e){return e&&parseInt(e,10)})),Oa(e);}}function Ya(e){var t=new w(_a(Ha(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function Ha(e){var t=e._i,a=e._f;return e._locale=e._locale||ba(e._l),null===t||void 0===a&&""===t?g({nullInput:true}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),A(t)?new w(_a(t)):(c(t)?e._d=t:n(a)?za(e):a?ja(e):Ga(e),y(e)||(e._d=null),e))}function Ga(e){var t=e._i;l(t)?e._d=new Date(a.now()):c(t)?e._d=new Date(t.valueOf()):"string"==typeof t?La(e):n(t)?(e._a=d(t.slice(0),(function(e){return parseInt(e,10)})),Oa(e)):r(t)?Wa(e):u(t)?e._d=new Date(t):a.createFromInputFallback(e);}function qa(e,t,a,i,s){var l={};return true!==t&&false!==t||(i=t,t=void 0),true!==a&&false!==a||(i=a,a=void 0),(r(e)&&o(e)||n(e)&&0===e.length)&&(e=void 0),l._isAMomentObject=true,l._useUTC=l._isUTC=s,l._l=a,l._i=e,l._f=t,l._strict=i,Ya(l)}function Za(e,t,a,i){return qa(e,t,a,i,false)}a.createFromInputFallback=S("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""));})),a.ISO_8601=function(){},a.RFC_2822=function(){};var Ja=S("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Za.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:g()})),Ka=S("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Za.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:g()}));function Xa(e,t){var a,i;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return Za();for(a=t[0],i=1;i<t.length;++i)t[i].isValid()&&!t[i][e](a)||(a=t[i]);return a}function Qa(){return Xa("isBefore",[].slice.call(arguments,0))}function ei(){return Xa("isAfter",[].slice.call(arguments,0))}var ti=function(){return Date.now?Date.now():+new Date},ai=["year","quarter","month","week","day","hour","minute","second","millisecond"];function ii(e){var t,a,i=false,n=ai.length;for(t in e)if(s(e,t)&&(-1===qe.call(ai,t)||null!=e[t]&&isNaN(e[t])))return false;for(a=0;a<n;++a)if(e[ai[a]]){if(i)return false;parseFloat(e[ai[a]])!==Fe(e[ai[a]])&&(i=true);}return true}function ni(){return this._isValid}function ri(){return xi(NaN)}function si(e){var t=ne(e),a=t.year||0,i=t.quarter||0,n=t.month||0,r=t.week||t.isoWeek||0,s=t.day||0,o=t.hour||0,l=t.minute||0,u=t.second||0,c=t.millisecond||0;this._isValid=ii(t),this._milliseconds=+c+1e3*u+6e4*l+1e3*o*60*60,this._days=+s+7*r,this._months=+n+3*i+12*a,this._data={},this._locale=ba(),this._bubble();}function oi(e){return e instanceof si}function li(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function ui(e,t,a){var i,n=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),s=0;for(i=0;i<n;i++)Fe(e[i])!==Fe(t[i])&&s++;return s+r}function ci(e,t){j(e,0,0,(function(){var e=this.utcOffset(),a="+";return e<0&&(e=-e,a="-"),a+D(~~(e/60),2)+t+D(~~e%60,2)}));}ci("Z",":"),ci("ZZ",""),Me("Z",Ae),Me("ZZ",Ae),De(["Z","ZZ"],(function(e,t,a){a._useUTC=true,a._tzm=pi(Ae,e);}));var di=/([\+\-]|\d\d)/gi;function pi(e,t){var a,i,n=(t||"").match(e);return null===n?null:0===(i=60*(a=((n[n.length-1]||[])+"").match(di)||["-",0,0])[1]+Fe(a[2]))?0:"+"===a[0]?i:-i}function hi(e,t){var i,n;return t._isUTC?(i=t.clone(),n=(A(e)||c(e)?e.valueOf():Za(e).valueOf())-i.valueOf(),i._d.setTime(i._d.valueOf()+n),a.updateOffset(i,false),i):Za(e).local()}function fi(e){return -Math.round(e._d.getTimezoneOffset())}function mi(e,t,i){var n,r=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=pi(Ae,e)))return this}else Math.abs(e)<16&&!i&&(e*=60);return !this._isUTC&&t&&(n=fi(this)),this._offset=e,this._isUTC=true,null!=n&&this.add(n,"m"),r!==e&&(!t||this._changeInProgress?Ei(this,xi(e-r,"m"),1,false):this._changeInProgress||(this._changeInProgress=true,a.updateOffset(this,true),this._changeInProgress=null)),this}return this._isUTC?r:fi(this)}function yi(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function gi(e){return this.utcOffset(0,e)}function bi(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=false,e&&this.subtract(fi(this),"m")),this}function vi(){if(null!=this._tzm)this.utcOffset(this._tzm,false,true);else if("string"==typeof this._i){var e=pi(we,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,true);}return this}function _i(e){return !!this.isValid()&&(e=e?Za(e).utcOffset():0,(this.utcOffset()-e)%60==0)}function wi(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ai(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e,t={};return _(t,this),(t=Ha(t))._a?(e=t._isUTC?h(t._a):Za(t._a),this._isDSTShifted=this.isValid()&&ui(t._a,e.toArray())>0):this._isDSTShifted=false,this._isDSTShifted}function ki(){return !!this.isValid()&&!this._isUTC}function Si(){return !!this.isValid()&&this._isUTC}function Ni(){return !!this.isValid()&&this._isUTC&&0===this._offset}a.updateOffset=function(){};var Ti=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Mi=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function xi(e,t){var a,i,n,r=e,o=null;return oi(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:u(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(o=Ti.exec(e))?(a="-"===o[1]?-1:1,r={y:0,d:Fe(o[$e])*a,h:Fe(o[je])*a,m:Fe(o[Ue])*a,s:Fe(o[ze])*a,ms:Fe(li(1e3*o[We]))*a}):(o=Mi.exec(e))?(a="-"===o[1]?-1:1,r={y:Vi(o[2],a),M:Vi(o[3],a),w:Vi(o[4],a),d:Vi(o[5],a),h:Vi(o[6],a),m:Vi(o[7],a),s:Vi(o[8],a)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(n=Ii(Za(r.from),Za(r.to)),(r={}).ms=n.milliseconds,r.M=n.months),i=new si(r),oi(e)&&s(e,"_locale")&&(i._locale=e._locale),oi(e)&&s(e,"_isValid")&&(i._isValid=e._isValid),i}function Vi(e,t){var a=e&&parseFloat(e.replace(",","."));return (isNaN(a)?0:a)*t}function Ci(e,t){var a={};return a.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(a.months,"M").isAfter(t)&&--a.months,a.milliseconds=+t-+e.clone().add(a.months,"M"),a}function Ii(e,t){var a;return e.isValid()&&t.isValid()?(t=hi(t,e),e.isBefore(t)?a=Ci(e,t):((a=Ci(t,e)).milliseconds=-a.milliseconds,a.months=-a.months),a):{milliseconds:0,months:0}}function Fi(e,t){return function(a,i){var n;return null===i||isNaN(+i)||(M(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=a,a=i,i=n),Ei(this,xi(a,i),e),this}}function Ei(e,t,i,n){var r=t._milliseconds,s=li(t._days),o=li(t._months);e.isValid()&&(n=null==n||n,o&&ht(e,Xe(e,"Month")+o*i),s&&Qe(e,"Date",Xe(e,"Date")+s*i),r&&e._d.setTime(e._d.valueOf()+r*i),n&&a.updateOffset(e,s||o));}xi.fn=si.prototype,xi.invalid=ri;var Di=Fi(1,"add"),Ri=Fi(-1,"subtract");function Li(e){return "string"==typeof e||e instanceof String}function Pi(e){return A(e)||c(e)||Li(e)||u(e)||Oi(e)||Bi(e)||null==e}function Bi(e){var t,a,i=r(e)&&!o(e),n=false,l=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],u=l.length;for(t=0;t<u;t+=1)a=l[t],n=n||s(e,a);return i&&n}function Oi(e){var t=n(e),a=false;return t&&(a=0===e.filter((function(t){return !u(t)&&Li(e)})).length),t&&a}function $i(e){var t,a,i=r(e)&&!o(e),n=false,l=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<l.length;t+=1)a=l[t],n=n||s(e,a);return i&&n}function ji(e,t){var a=e.diff(t,"days",true);return a<-6?"sameElse":a<-1?"lastWeek":a<0?"lastDay":a<1?"sameDay":a<2?"nextDay":a<7?"nextWeek":"sameElse"}function Ui(e,t){1===arguments.length&&(arguments[0]?Pi(arguments[0])?(e=arguments[0],t=void 0):$i(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var i=e||Za(),n=hi(i,this).startOf("day"),r=a.calendarFormat(this,n)||"sameElse",s=t&&(x(t[r])?t[r].call(this,i):t[r]);return this.format(s||this.localeData().calendar(r,this,Za(i)))}function zi(){return new w(this)}function Wi(e,t){var a=A(e)?e:Za(e);return !(!this.isValid()||!a.isValid())&&("millisecond"===(t=ie(t)||"millisecond")?this.valueOf()>a.valueOf():a.valueOf()<this.clone().startOf(t).valueOf())}function Yi(e,t){var a=A(e)?e:Za(e);return !(!this.isValid()||!a.isValid())&&("millisecond"===(t=ie(t)||"millisecond")?this.valueOf()<a.valueOf():this.clone().endOf(t).valueOf()<a.valueOf())}function Hi(e,t,a,i){var n=A(e)?e:Za(e),r=A(t)?t:Za(t);return !!(this.isValid()&&n.isValid()&&r.isValid())&&("("===(i=i||"()")[0]?this.isAfter(n,a):!this.isBefore(n,a))&&(")"===i[1]?this.isBefore(r,a):!this.isAfter(r,a))}function Gi(e,t){var a,i=A(e)?e:Za(e);return !(!this.isValid()||!i.isValid())&&("millisecond"===(t=ie(t)||"millisecond")?this.valueOf()===i.valueOf():(a=i.valueOf(),this.clone().startOf(t).valueOf()<=a&&a<=this.clone().endOf(t).valueOf()))}function qi(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function Zi(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function Ji(e,t,a){var i,n,r;if(!this.isValid())return NaN;if(!(i=hi(e,this)).isValid())return NaN;switch(n=6e4*(i.utcOffset()-this.utcOffset()),t=ie(t)){case "year":r=Ki(this,i)/12;break;case "month":r=Ki(this,i);break;case "quarter":r=Ki(this,i)/3;break;case "second":r=(this-i)/1e3;break;case "minute":r=(this-i)/6e4;break;case "hour":r=(this-i)/36e5;break;case "day":r=(this-i-n)/864e5;break;case "week":r=(this-i-n)/6048e5;break;default:r=this-i;}return a?r:Ie(r)}function Ki(e,t){if(e.date()<t.date())return -Ki(t,e);var a=12*(t.year()-e.year())+(t.month()-e.month()),i=e.clone().add(a,"months");return -(a+(t-i<0?(t-i)/(i-e.clone().add(a-1,"months")):(t-i)/(e.clone().add(a+1,"months")-i)))||0}function Xi(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Qi(e){if(!this.isValid())return null;var t=true!==e,a=t?this.clone().utc():this;return a.year()<0||a.year()>9999?W(a,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):x(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",W(a,"Z")):W(a,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function en(){if(!this.isValid())return "moment.invalid(/* "+this._i+" */)";var e,t,a,i,n="moment",r="";return this.isLocal()||(n=0===this.utcOffset()?"moment.utc":"moment.parseZone",r="Z"),e="["+n+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a="-MM-DD[T]HH:mm:ss.SSS",i=r+'[")]',this.format(e+t+a+i)}function tn(e){e||(e=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var t=W(this,e);return this.localeData().postformat(t)}function an(e,t){return this.isValid()&&(A(e)&&e.isValid()||Za(e).isValid())?xi({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function nn(e){return this.from(Za(),e)}function rn(e,t){return this.isValid()&&(A(e)&&e.isValid()||Za(e).isValid())?xi({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function sn(e){return this.to(Za(),e)}function on(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ba(e))&&(this._locale=t),this)}a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ln=S("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(e){return void 0===e?this.localeData():this.locale(e)}));function un(){return this._locale}var cn=1e3,dn=60*cn,pn=60*dn,hn=3506328*pn;function fn(e,t){return (e%t+t)%t}function mn(e,t,a){return e<100&&e>=0?new Date(e+400,t,a)-hn:new Date(e,t,a).valueOf()}function yn(e,t,a){return e<100&&e>=0?Date.UTC(e+400,t,a)-hn:Date.UTC(e,t,a)}function gn(e){var t,i;if(void 0===(e=ie(e))||"millisecond"===e||!this.isValid())return this;switch(i=this._isUTC?yn:mn,e){case "year":t=i(this.year(),0,1);break;case "quarter":t=i(this.year(),this.month()-this.month()%3,1);break;case "month":t=i(this.year(),this.month(),1);break;case "week":t=i(this.year(),this.month(),this.date()-this.weekday());break;case "isoWeek":t=i(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case "day":case "date":t=i(this.year(),this.month(),this.date());break;case "hour":t=this._d.valueOf(),t-=fn(t+(this._isUTC?0:this.utcOffset()*dn),pn);break;case "minute":t=this._d.valueOf(),t-=fn(t,dn);break;case "second":t=this._d.valueOf(),t-=fn(t,cn);}return this._d.setTime(t),a.updateOffset(this,true),this}function bn(e){var t,i;if(void 0===(e=ie(e))||"millisecond"===e||!this.isValid())return this;switch(i=this._isUTC?yn:mn,e){case "year":t=i(this.year()+1,0,1)-1;break;case "quarter":t=i(this.year(),this.month()-this.month()%3+3,1)-1;break;case "month":t=i(this.year(),this.month()+1,1)-1;break;case "week":t=i(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case "isoWeek":t=i(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case "day":case "date":t=i(this.year(),this.month(),this.date()+1)-1;break;case "hour":t=this._d.valueOf(),t+=pn-fn(t+(this._isUTC?0:this.utcOffset()*dn),pn)-1;break;case "minute":t=this._d.valueOf(),t+=dn-fn(t,dn)-1;break;case "second":t=this._d.valueOf(),t+=cn-fn(t,cn)-1;}return this._d.setTime(t),a.updateOffset(this,true),this}function vn(){return this._d.valueOf()-6e4*(this._offset||0)}function _n(){return Math.floor(this.valueOf()/1e3)}function wn(){return new Date(this.valueOf())}function An(){var e=this;return [e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function kn(){var e=this;return {years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Sn(){return this.isValid()?this.toISOString():null}function Nn(){return y(this)}function Tn(){return p({},m(this))}function Mn(){return m(this).overflow}function xn(){return {input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Vn(e,t){var i,n,r,s=this._eras||ba("en")._eras;for(i=0,n=s.length;i<n;++i)switch("string"==typeof s[i].since&&(r=a(s[i].since).startOf("day"),s[i].since=r.valueOf()),typeof s[i].until){case "undefined":s[i].until=1/0;break;case "string":r=a(s[i].until).startOf("day").valueOf(),s[i].until=r.valueOf();}return s}function Cn(e,t,a){var i,n,r,s,o,l=this.eras();for(e=e.toUpperCase(),i=0,n=l.length;i<n;++i)if(r=l[i].name.toUpperCase(),s=l[i].abbr.toUpperCase(),o=l[i].narrow.toUpperCase(),a)switch(t){case "N":case "NN":case "NNN":if(s===e)return l[i];break;case "NNNN":if(r===e)return l[i];break;case "NNNNN":if(o===e)return l[i]}else if([r,s,o].indexOf(e)>=0)return l[i]}function In(e,t){var i=e.since<=e.until?1:-1;return void 0===t?a(e.since).year():a(e.since).year()+(t-e.offset)*i}function Fn(){var e,t,a,i=this.localeData().eras();for(e=0,t=i.length;e<t;++e){if(a=this.clone().startOf("day").valueOf(),i[e].since<=a&&a<=i[e].until)return i[e].name;if(i[e].until<=a&&a<=i[e].since)return i[e].name}return ""}function En(){var e,t,a,i=this.localeData().eras();for(e=0,t=i.length;e<t;++e){if(a=this.clone().startOf("day").valueOf(),i[e].since<=a&&a<=i[e].until)return i[e].narrow;if(i[e].until<=a&&a<=i[e].since)return i[e].narrow}return ""}function Dn(){var e,t,a,i=this.localeData().eras();for(e=0,t=i.length;e<t;++e){if(a=this.clone().startOf("day").valueOf(),i[e].since<=a&&a<=i[e].until)return i[e].abbr;if(i[e].until<=a&&a<=i[e].since)return i[e].abbr}return ""}function Rn(){var e,t,i,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e)if(i=r[e].since<=r[e].until?1:-1,n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until||r[e].until<=n&&n<=r[e].since)return (this.year()-a(r[e].since).year())*i+r[e].offset;return this.year()}function Ln(e){return s(this,"_erasNameRegex")||zn.call(this),e?this._erasNameRegex:this._erasRegex}function Pn(e){return s(this,"_erasAbbrRegex")||zn.call(this),e?this._erasAbbrRegex:this._erasRegex}function Bn(e){return s(this,"_erasNarrowRegex")||zn.call(this),e?this._erasNarrowRegex:this._erasRegex}function On(e,t){return t.erasAbbrRegex(e)}function $n(e,t){return t.erasNameRegex(e)}function jn(e,t){return t.erasNarrowRegex(e)}function Un(e,t){return t._eraYearOrdinalRegex||ve}function zn(){var e,t,a,i,n,r=[],s=[],o=[],l=[],u=this.eras();for(e=0,t=u.length;e<t;++e)a=Ce(u[e].name),i=Ce(u[e].abbr),n=Ce(u[e].narrow),s.push(a),r.push(i),o.push(n),l.push(a),l.push(i),l.push(n);this._erasRegex=new RegExp("^("+l.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+s.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+o.join("|")+")","i");}function Wn(e,t){j(0,[e,e.length],0,t);}function Yn(e){return Kn.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Hn(e){return Kn.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function Gn(){return St(this.year(),1,4)}function qn(){return St(this.isoWeekYear(),1,4)}function Zn(){var e=this.localeData()._week;return St(this.year(),e.dow,e.doy)}function Jn(){var e=this.localeData()._week;return St(this.weekYear(),e.dow,e.doy)}function Kn(e,t,a,i,n){var r;return null==e?kt(this,i,n).year:(t>(r=St(e,i,n))&&(t=r),Xn.call(this,e,t,a,i,n))}function Xn(e,t,a,i,n){var r=At(e,t,a,i,n),s=_t(r.year,0,r.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}function Qn(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}j("N",0,0,"eraAbbr"),j("NN",0,0,"eraAbbr"),j("NNN",0,0,"eraAbbr"),j("NNNN",0,0,"eraName"),j("NNNNN",0,0,"eraNarrow"),j("y",["y",1],"yo","eraYear"),j("y",["yy",2],0,"eraYear"),j("y",["yyy",3],0,"eraYear"),j("y",["yyyy",4],0,"eraYear"),Me("N",On),Me("NN",On),Me("NNN",On),Me("NNNN",$n),Me("NNNNN",jn),De(["N","NN","NNN","NNNN","NNNNN"],(function(e,t,a,i){var n=a._locale.erasParse(e,i,a._strict);n?m(a).era=n:m(a).invalidEra=e;})),Me("y",ve),Me("yy",ve),Me("yyy",ve),Me("yyyy",ve),Me("yo",Un),De(["y","yy","yyy","yyyy"],Be),De(["yo"],(function(e,t,a,i){var n;a._locale._eraYearOrdinalRegex&&(n=e.match(a._locale._eraYearOrdinalRegex)),a._locale.eraYearOrdinalParse?t[Be]=a._locale.eraYearOrdinalParse(e,n):t[Be]=parseInt(e,10);})),j(0,["gg",2],0,(function(){return this.weekYear()%100})),j(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Wn("gggg","weekYear"),Wn("ggggg","weekYear"),Wn("GGGG","isoWeekYear"),Wn("GGGGG","isoWeekYear"),Me("G",_e),Me("g",_e),Me("GG",he,ue),Me("gg",he,ue),Me("GGGG",ge,de),Me("gggg",ge,de),Me("GGGGG",be,pe),Me("ggggg",be,pe),Re(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,a,i){t[i.substr(0,2)]=Fe(e);})),Re(["gg","GG"],(function(e,t,i,n){t[n]=a.parseTwoDigitYear(e);})),j("Q",0,"Qo","quarter"),Me("Q",le),De("Q",(function(e,t){t[Oe]=3*(Fe(e)-1);})),j("D",["DD",2],"Do","date"),Me("D",he,Ne),Me("DD",he,ue),Me("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),De(["D","DD"],$e),De("Do",(function(e,t){t[$e]=Fe(e.match(he)[0]);}));var er=Ke("Date",true);function tr(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}j("DDD",["DDDD",3],"DDDo","dayOfYear"),Me("DDD",ye),Me("DDDD",ce),De(["DDD","DDDD"],(function(e,t,a){a._dayOfYear=Fe(e);})),j("m",["mm",2],0,"minute"),Me("m",he,Te),Me("mm",he,ue),De(["m","mm"],Ue);var ar=Ke("Minutes",false);j("s",["ss",2],0,"second"),Me("s",he,Te),Me("ss",he,ue),De(["s","ss"],ze);var ir,nr,rr=Ke("Seconds",false);for(j("S",0,0,(function(){return ~~(this.millisecond()/100)})),j(0,["SS",2],0,(function(){return ~~(this.millisecond()/10)})),j(0,["SSS",3],0,"millisecond"),j(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),j(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),j(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),j(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),j(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),j(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),Me("S",ye,le),Me("SS",ye,ue),Me("SSS",ye,ce),ir="SSSS";ir.length<=9;ir+="S")Me(ir,ve);function sr(e,t){t[We]=Fe(1e3*("0."+e));}for(ir="S";ir.length<=9;ir+="S")De(ir,sr);function or(){return this._isUTC?"UTC":""}function lr(){return this._isUTC?"Coordinated Universal Time":""}nr=Ke("Milliseconds",false),j("z",0,0,"zoneAbbr"),j("zz",0,0,"zoneName");var ur=w.prototype;function cr(e){return Za(1e3*e)}function dr(){return Za.apply(null,arguments).parseZone()}function pr(e){return e}ur.add=Di,ur.calendar=Ui,ur.clone=zi,ur.diff=Ji,ur.endOf=bn,ur.format=tn,ur.from=an,ur.fromNow=nn,ur.to=rn,ur.toNow=sn,ur.get=et,ur.invalidAt=Mn,ur.isAfter=Wi,ur.isBefore=Yi,ur.isBetween=Hi,ur.isSame=Gi,ur.isSameOrAfter=qi,ur.isSameOrBefore=Zi,ur.isValid=Nn,ur.lang=ln,ur.locale=on,ur.localeData=un,ur.max=Ka,ur.min=Ja,ur.parsingFlags=Tn,ur.set=tt,ur.startOf=gn,ur.subtract=Ri,ur.toArray=An,ur.toObject=kn,ur.toDate=wn,ur.toISOString=Qi,ur.inspect=en,"undefined"!=typeof Symbol&&null!=Symbol.for&&(ur[Symbol.for("nodejs.util.inspect.custom")]=function(){return "Moment<"+this.format()+">"}),ur.toJSON=Sn,ur.toString=Xi,ur.unix=_n,ur.valueOf=vn,ur.creationData=xn,ur.eraName=Fn,ur.eraNarrow=En,ur.eraAbbr=Dn,ur.eraYear=Rn,ur.year=Ze,ur.isLeapYear=Je,ur.weekYear=Yn,ur.isoWeekYear=Hn,ur.quarter=ur.quarters=Qn,ur.month=ft,ur.daysInMonth=mt,ur.week=ur.weeks=Vt,ur.isoWeek=ur.isoWeeks=Ct,ur.weeksInYear=Zn,ur.weeksInWeekYear=Jn,ur.isoWeeksInYear=Gn,ur.isoWeeksInISOWeekYear=qn,ur.date=er,ur.day=ur.days=Yt,ur.weekday=Ht,ur.isoWeekday=Gt,ur.dayOfYear=tr,ur.hour=ur.hours=na,ur.minute=ur.minutes=ar,ur.second=ur.seconds=rr,ur.millisecond=ur.milliseconds=nr,ur.utcOffset=mi,ur.utc=gi,ur.local=bi,ur.parseZone=vi,ur.hasAlignedHourOffset=_i,ur.isDST=wi,ur.isLocal=ki,ur.isUtcOffset=Si,ur.isUtc=Ni,ur.isUTC=Ni,ur.zoneAbbr=or,ur.zoneName=lr,ur.dates=S("dates accessor is deprecated. Use date instead.",er),ur.months=S("months accessor is deprecated. Use month instead",ft),ur.years=S("years accessor is deprecated. Use year instead",Ze),ur.zone=S("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",yi),ur.isDSTShifted=S("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ai);var hr=I.prototype;function fr(e,t,a,i){var n=ba(),r=h().set(i,t);return n[a](r,e)}function mr(e,t,a){if(u(e)&&(t=e,e=void 0),e=e||"",null!=t)return fr(e,t,a,"month");var i,n=[];for(i=0;i<12;i++)n[i]=fr(e,i,a,"month");return n}function yr(e,t,a,i){"boolean"==typeof e?(u(t)&&(a=t,t=void 0),t=t||""):(a=t=e,e=false,u(t)&&(a=t,t=void 0),t=t||"");var n,r=ba(),s=e?r._week.dow:0,o=[];if(null!=a)return fr(t,(a+s)%7,i,"day");for(n=0;n<7;n++)o[n]=fr(t,(n+s)%7,i,"day");return o}function gr(e,t){return mr(e,t,"months")}function br(e,t){return mr(e,t,"monthsShort")}function vr(e,t,a){return yr(e,t,a,"weekdays")}function _r(e,t,a){return yr(e,t,a,"weekdaysShort")}function wr(e,t,a){return yr(e,t,a,"weekdaysMin")}hr.calendar=E,hr.longDateFormat=G,hr.invalidDate=Z,hr.ordinal=X,hr.preparse=pr,hr.postformat=pr,hr.relativeTime=ee,hr.pastFuture=te,hr.set=V,hr.eras=Vn,hr.erasParse=Cn,hr.erasConvertYear=In,hr.erasAbbrRegex=Pn,hr.erasNameRegex=Ln,hr.erasNarrowRegex=Bn,hr.months=ut,hr.monthsShort=ct,hr.monthsParse=pt,hr.monthsRegex=gt,hr.monthsShortRegex=yt,hr.week=Nt,hr.firstDayOfYear=xt,hr.firstDayOfWeek=Mt,hr.weekdays=$t,hr.weekdaysMin=Ut,hr.weekdaysShort=jt,hr.weekdaysParse=Wt,hr.weekdaysRegex=qt,hr.weekdaysShortRegex=Zt,hr.weekdaysMinRegex=Jt,hr.isPM=aa,hr.meridiem=ra,ma("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===Fe(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),a.lang=S("moment.lang is deprecated. Use moment.locale instead.",ma),a.langData=S("moment.langData is deprecated. Use moment.localeData instead.",ba);var Ar=Math.abs;function kr(){var e=this._data;return this._milliseconds=Ar(this._milliseconds),this._days=Ar(this._days),this._months=Ar(this._months),e.milliseconds=Ar(e.milliseconds),e.seconds=Ar(e.seconds),e.minutes=Ar(e.minutes),e.hours=Ar(e.hours),e.months=Ar(e.months),e.years=Ar(e.years),this}function Sr(e,t,a,i){var n=xi(t,a);return e._milliseconds+=i*n._milliseconds,e._days+=i*n._days,e._months+=i*n._months,e._bubble()}function Nr(e,t){return Sr(this,e,t,1)}function Tr(e,t){return Sr(this,e,t,-1)}function Mr(e){return e<0?Math.floor(e):Math.ceil(e)}function xr(){var e,t,a,i,n,r=this._milliseconds,s=this._days,o=this._months,l=this._data;return r>=0&&s>=0&&o>=0||r<=0&&s<=0&&o<=0||(r+=864e5*Mr(Cr(o)+s),s=0,o=0),l.milliseconds=r%1e3,e=Ie(r/1e3),l.seconds=e%60,t=Ie(e/60),l.minutes=t%60,a=Ie(t/60),l.hours=a%24,s+=Ie(a/24),o+=n=Ie(Vr(s)),s-=Mr(Cr(n)),i=Ie(o/12),o%=12,l.days=s,l.months=o,l.years=i,this}function Vr(e){return 4800*e/146097}function Cr(e){return 146097*e/4800}function Ir(e){if(!this.isValid())return NaN;var t,a,i=this._milliseconds;if("month"===(e=ie(e))||"quarter"===e||"year"===e)switch(t=this._days+i/864e5,a=this._months+Vr(t),e){case "month":return a;case "quarter":return a/3;case "year":return a/12}else switch(t=this._days+Math.round(Cr(this._months)),e){case "week":return t/7+i/6048e5;case "day":return t+i/864e5;case "hour":return 24*t+i/36e5;case "minute":return 1440*t+i/6e4;case "second":return 86400*t+i/1e3;case "millisecond":return Math.floor(864e5*t)+i;default:throw new Error("Unknown unit "+e)}}function Fr(e){return function(){return this.as(e)}}var Er=Fr("ms"),Dr=Fr("s"),Rr=Fr("m"),Lr=Fr("h"),Pr=Fr("d"),Br=Fr("w"),Or=Fr("M"),$r=Fr("Q"),jr=Fr("y"),Ur=Er;function zr(){return xi(this)}function Wr(e){return e=ie(e),this.isValid()?this[e+"s"]():NaN}function Yr(e){return function(){return this.isValid()?this._data[e]:NaN}}var Hr=Yr("milliseconds"),Gr=Yr("seconds"),qr=Yr("minutes"),Zr=Yr("hours"),Jr=Yr("days"),Kr=Yr("months"),Xr=Yr("years");function Qr(){return Ie(this.days()/7)}var es=Math.round,ts={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function as(e,t,a,i,n){return n.relativeTime(t||1,!!a,e,i)}function is(e,t,a,i){var n=xi(e).abs(),r=es(n.as("s")),s=es(n.as("m")),o=es(n.as("h")),l=es(n.as("d")),u=es(n.as("M")),c=es(n.as("w")),d=es(n.as("y")),p=r<=a.ss&&["s",r]||r<a.s&&["ss",r]||s<=1&&["m"]||s<a.m&&["mm",s]||o<=1&&["h"]||o<a.h&&["hh",o]||l<=1&&["d"]||l<a.d&&["dd",l];return null!=a.w&&(p=p||c<=1&&["w"]||c<a.w&&["ww",c]),(p=p||u<=1&&["M"]||u<a.M&&["MM",u]||d<=1&&["y"]||["yy",d])[2]=t,p[3]=+e>0,p[4]=i,as.apply(null,p)}function ns(e){return void 0===e?es:"function"==typeof e&&(es=e,true)}function rs(e,t){return void 0!==ts[e]&&(void 0===t?ts[e]:(ts[e]=t,"s"===e&&(ts.ss=t-1),true))}function ss(e,t){if(!this.isValid())return this.localeData().invalidDate();var a,i,n=false,r=ts;return "object"==typeof e&&(t=e,e=false),"boolean"==typeof e&&(n=e),"object"==typeof t&&(r=Object.assign({},ts,t),null!=t.s&&null==t.ss&&(r.ss=t.s-1)),i=is(this,!n,r,a=this.localeData()),n&&(i=a.pastFuture(+this,i)),a.postformat(i)}var os=Math.abs;function ls(e){return (e>0)-(e<0)||+e}function us(){if(!this.isValid())return this.localeData().invalidDate();var e,t,a,i,n,r,s,o,l=os(this._milliseconds)/1e3,u=os(this._days),c=os(this._months),d=this.asSeconds();return d?(e=Ie(l/60),t=Ie(e/60),l%=60,e%=60,a=Ie(c/12),c%=12,i=l?l.toFixed(3).replace(/\.?0+$/,""):"",n=d<0?"-":"",r=ls(this._months)!==ls(d)?"-":"",s=ls(this._days)!==ls(d)?"-":"",o=ls(this._milliseconds)!==ls(d)?"-":"",n+"P"+(a?r+a+"Y":"")+(c?r+c+"M":"")+(u?s+u+"D":"")+(t||e||l?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(l?o+i+"S":"")):"P0D"}var cs=si.prototype;return cs.isValid=ni,cs.abs=kr,cs.add=Nr,cs.subtract=Tr,cs.as=Ir,cs.asMilliseconds=Er,cs.asSeconds=Dr,cs.asMinutes=Rr,cs.asHours=Lr,cs.asDays=Pr,cs.asWeeks=Br,cs.asMonths=Or,cs.asQuarters=$r,cs.asYears=jr,cs.valueOf=Ur,cs._bubble=xr,cs.clone=zr,cs.get=Wr,cs.milliseconds=Hr,cs.seconds=Gr,cs.minutes=qr,cs.hours=Zr,cs.days=Jr,cs.weeks=Qr,cs.months=Kr,cs.years=Xr,cs.humanize=ss,cs.toISOString=us,cs.toString=us,cs.toJSON=us,cs.locale=on,cs.localeData=un,cs.toIsoString=S("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",us),cs.lang=ln,j("X",0,0,"unix"),j("x",0,0,"valueOf"),Me("x",_e),Me("X",ke),De("X",(function(e,t,a){a._d=new Date(1e3*parseFloat(e));})),De("x",(function(e,t,a){a._d=new Date(Fe(e));})),
4603
4603
  //! moment.js
4604
- a.version="2.30.1",n(Za),a.fn=ur,a.min=Qa,a.max=en,a.now=tn,a.utc=h,a.unix=cr,a.months=gr,a.isDate=c,a.locale=ma,a.invalid=g,a.duration=Cn,a.isMoment=A,a.weekdays=vr,a.parseZone=dr,a.localeData=ba,a.isDuration=ln,a.monthsShort=br,a.weekdaysMin=_r,a.defineLocale=ya,a.updateLocale=ga,a.locales=va,a.weekdaysShort=wr,a.normalizeUnits=ne,a.relativeTimeRounding=is,a.relativeTimeThreshold=rs,a.calendarFormat=jn,a.prototype=ur,a.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},a}()),B$9.exports),U=R$9($);class j{apiClient;debug;apiCalls=[];apiCallsStartTime=null;constructor(e){if(!e)throw "A lumino client needs to be passed.";this.apiClient=e,this.debug=false,this.debug&&(this.apiCalls=[],this.apiCallsStartTime=null);}start(){this.debug&&(this.apiCallsStartTime=U(),this.apiCalls=[]);}end(){if(this.debug){console.log("Calls: "+this.apiCalls.length);for(const e of this.apiCalls){const t=e.callTime.toString().padStart(6," "),a=e.totalTime.toString().padStart(6," ");console.log(t+a+" -> "+e.caller+"::"+e.method+" ("+JSON.stringify(e.params)+")");}}}async call(e,t,...a){try{if(this.debug){const n=U(),i=await this.apiClient[t](...a),r=U(),s=r.diff(n,"milliseconds"),o=r.diff(this.apiCallsStartTime,"milliseconds");return this.apiCalls.push({caller:e,method:t,params:a,callTime:s,totalTime:o}),i}return this.apiClient[t](...a)}catch(e){throw l$1.$emit("client:fatalError","API call failed: "+t),e}}}let z=class{itemCache;apiGateway;constructor(e){this.itemCache=new Map,this.apiGateway=e;}clear(){this.itemCache.clear();}async getItem(e){if(this.itemCache.has(e))return this.itemCache.get(e);const t=await this.apiGateway.call("ItemCache::getItem","getItem",e);return this.itemCache.set(e,t),t}};class W{id;type;data;constructor(e,t,a){this.id=e,this.type=t,this.data=a;}}class Y{ownerItem;constructor(e=void 0){this.ownerItem=e;}createSnapshot(){throw "createSnapshot not implemented!"}restoreFromSnapshot(e,t){throw "restoreFromSnapshot not implemented!"}rollbackFromSnapshot(e){throw "rollbackFromSnapshot not implemented!"}_getElementById(e,t){for(const a of t)if(a.id===e)return a;return null}_rollbackArray(e,t,a){if(!Array.isArray(e))return void console.log("_rollbackArray(): no array given!");const n=[],i=[];let r=0;for(const a of t){const t=this._getElementById(a.id,e);t?i.push({element:t,snapshot:a}):n.push({position:r,snapshot:a}),r++;}const s=[];r=0;for(const a of e){this._getElementById(a.id,t)||s.push(r-s.length),r++;}for(const t of s)e.splice(t,1);for(const e of i)e.element.rollbackFromSnapshot(e.snapshot);for(const t of n){const n=a(t.snapshot,this);e.splice(t.position,0,n);}}}class H extends Y{id;srcNode;srcSlot;destNode;destSlot;posX;posY;constructor(e,t){super(t),p.assert(e,"NkConnection: data is null or undefined!"),p.assert(e.srcNode,"NkConnection: srcNode is null or undefined!"),p.assert(e.srcSlot,"NkConnection: srcSlot is null or undefined!"),p.assert(e.destNode,"NkConnection: srcNode is null or undefined!"),p.assert(e.destSlot,"NkConnection: srcSlot is null or undefined!"),this.id=e.id||p.createItemOrBlockID(),this.srcNode=e.srcNode,this.srcSlot=e.srcSlot,this.destNode=e.destNode,this.destSlot=e.destSlot,this.posX=e.posX||0,this.posY=e.posY||0;}getId(){return this.id}setPosition(e,t){this.posX=e,this.posY=t;}getPosX(){return this.posX}getPosY(){return this.posY}getSrcNode(){return this.srcNode}getDestNode(){return this.destNode}getSrcSlot(){return this.srcSlot}getDestSlot(){return this.destSlot}setSrcNode(e){this.srcNode=e;}setDestNode(e){this.destNode=e;}setSrcSlot(e){this.srcSlot=e;}setDestSlot(e){this.destSlot=e;}clone(){return new H({srcNode:this.srcNode,srcSlot:this.srcSlot,destNode:this.destNode,destSlot:this.destSlot,posX:this.posX,posY:this.posY},this.ownerItem)}createSnapshot(){return new W(this.id,"connection",{id:this.id,srcNode:this.srcNode,srcSlot:this.srcSlot,destNode:this.destNode,destSlot:this.destSlot,posX:this.posX,posY:this.posY})}restoreFromSnapshot(e){this.id=e.id,this.srcNode=e.data.srcNode,this.srcSlot=e.data.srcSlot,this.destNode=e.data.destNode,this.destSlot=e.data.destSlot,this.posX=e.data.posX,this.posY=e.data.posY;}rollbackFromSnapshot(e){this.srcNode=e.data.srcNode,this.srcSlot=e.data.srcSlot,this.destNode=e.data.destNode,this.destSlot=e.data.destSlot,this.posX=e.data.posX,this.posY=e.data.posY;}}let G$9 = class G extends Y{id;name=void 0;displayName=void 0;value;script;type=void 0;datatype=void 0;minValue=void 0;maxValue=void 0;order=0;inject=void 0;info=void 0;constructor(e=void 0,t=void 0,a=void 0,n=void 0){super(n),this.value=a,this.script=e,this.id=p.createGUID(),this.name=t,this.displayName=t,this._updateDisplayName();}getId(){return this.id}setName(e){this.name=e,this._updateDisplayName();}setOrder(e){this.order=e;}setInfo(e){this.info=e;}clone(e=new Map){const t=new G;return t.ownerItem=this.ownerItem,t.value=e.get(this.value)??this.value,t.script=this.script,t.type=this.type,t.minValue=this.minValue,t.maxValue=this.maxValue,t.order=this.order,t.info=this.info,t.setName(this.name),t}clearDefinition(){this.type=void 0;}setDefinition(e){this.inject=e.inject;const t=e.type.toLowerCase();switch(t){case "boolean":case "bool":this.type="Attribute",this.datatype="Boolean",this.value=void 0!==this.value?this._toBoolean(this.value):this._toBoolean(e.defaultValue);break;case "number":{this.type="Attribute",this.datatype="Float",this.value=void 0!==this.value?Number(this.value):Number(e.defaultValue);const t=this._parseTypeParams(e.typeparams,2);t?(this.minValue=Number(t[0]),this.maxValue=Number(t[1])):(this.minValue=void 0,this.maxValue=void 0);break}case "string":this.type="Attribute",this.datatype="String",this.value=void 0!==this.value&&null!==this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():"";break;case "node":this.type="Attribute",this.datatype="Node";break;default:console.error("Unknown script field type: "+t),this.type="Attribute",this.datatype="String",this.value=this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():"";}}_toBoolean(e){return null!=e&&(true===e||false===e?e:"false"!==e.toString().toLowerCase())}_updateDisplayName(){this.name?this.displayName=p.toUserFriendlyName(this.name):this.displayName="";}_parseTypeParams(e,t){if(!e)return null;const a=e.split(",").map((e=>e.trim()));return a.length!==t?null:a}createSnapshot(){return new W(this.name,"scriptfield",{id:this.id,type:this.type,name:this.name,value:this.value,datatype:this.datatype,minValue:this.minValue,maxValue:this.maxValue,order:this.order,info:this.info})}};function q(e,t,a){const{datatype:n,minValue:i,maxValue:r,name:s,value:o,type:l,order:u,id:c,info:d}=e.data,p=new G$9(t,s,o,a);return p.id=c,p.type=l,p.datatype=n,p.minValue=i,p.maxValue=r,p.order=u,p.info=d,p}class Z extends Y{id=void 0;block=void 0;fields=[];item=null;deferInitCall=false;constructor(e=void 0,t=void 0,a=void 0,n=void 0){super(a),e instanceof W?this.restoreFromSnapshot(e,t):(this.id=e||p.createItemOrBlockID(),this.block=t),this.item||(this.item={value:n,linkableItems:[],linkableTypes:["Script"]}),this.item=y$1.instance.proxyScriptItem(this.item,this,this.ownerItem),this.fields=y$1.instance.proxyScriptFieldsArray(this.fields,this,this.ownerItem);}getId(){return this.id}makeIdsUnique(e,t=false){if(this.id)if(e.has(this.id)||t){const t=p.createItemOrBlockID();e.set(this.id,t),this.id=t;}else e.set(this.id,this.id);}transformNodeIds(e){for(const t of this.fields)t.value&&e.has(t.value)&&(t.value=e.get(t.value));}clone(e=new Map,t={}){const a=new Z(void 0,this.block,this.ownerItem,this.item.value);for(const n of this.fields){const i=n.clone(e);i.script=a,t.hasOwnProperty(i.name)&&(i.value=t[i.name]),a.addField(i);}return a}createFieldsFromDefinition(e=[]){function t(e,t){for(const a of e)if(a.name===t)return a;return null}for(const a of this.fields)t(e,a.name)||a.clearDefinition();let a=0;for(const n of e){let e=t(this.fields,n.name);e||(e=new G$9(this,n.name,void 0,this.ownerItem),this.addField(e)),e.setOrder(a++),e.setInfo(n.info),e.setDefinition(n);}this.fields.sort((function(e,t){return e.order-t.order}));}clearFieldTypes(){this.createFieldsFromDefinition();}addField(e){this.fields.push(y$1.instance.proxyScriptField(e,this,this.ownerItem));}createSnapshot(){const e=[];for(const t of this.fields)e.push(t.createSnapshot());return new W(this.id,"script",{id:this.id,value:this.item.value,fields:e})}restoreFromSnapshot(e,t){this.id=e.data.id,this.block=t,this.item={value:e.data.value,linkableItems:[],linkableTypes:["Script"]};const a=[];this._rollbackArray(a,e.data.fields,(e=>{const t=q(e,this,this.ownerItem);return y$1.instance.proxyScriptField(t,this,this.ownerItem)})),this.fields=a;}rollbackFromSnapshot(e){e.data.value&&(this.item.value=e.data.value),this._rollbackArray(this.fields,e.data.fields,(e=>{const t=q(e,this,this.ownerItem);return y$1.instance.proxyScriptField(t,this,this.ownerItem)}));}}var J,K$1={exports:{}},X$1=K$1.exports;
4604
+ a.version="2.30.1",i(Za),a.fn=ur,a.min=Qa,a.max=ei,a.now=ti,a.utc=h,a.unix=cr,a.months=gr,a.isDate=c,a.locale=ma,a.invalid=g,a.duration=xi,a.isMoment=A,a.weekdays=vr,a.parseZone=dr,a.localeData=ba,a.isDuration=oi,a.monthsShort=br,a.weekdaysMin=wr,a.defineLocale=ya,a.updateLocale=ga,a.locales=va,a.weekdaysShort=_r,a.normalizeUnits=ie,a.relativeTimeRounding=ns,a.relativeTimeThreshold=rs,a.calendarFormat=ji,a.prototype=ur,a.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},a}()),B$9.exports),j=R$9($);class U{apiClient;debug;apiCalls=[];apiCallsStartTime=null;constructor(e){if(!e)throw "A lumino client needs to be passed.";this.apiClient=e,this.debug=false,this.debug&&(this.apiCalls=[],this.apiCallsStartTime=null);}start(){this.debug&&(this.apiCallsStartTime=j(),this.apiCalls=[]);}end(){if(this.debug){console.log("Calls: "+this.apiCalls.length);for(const e of this.apiCalls){const t=e.callTime.toString().padStart(6," "),a=e.totalTime.toString().padStart(6," ");console.log(t+a+" -> "+e.caller+"::"+e.method+" ("+JSON.stringify(e.params)+")");}}}async call(e,t,...a){try{if(this.debug){const i=j(),n=await this.apiClient[t](...a),r=j(),s=r.diff(i,"milliseconds"),o=r.diff(this.apiCallsStartTime,"milliseconds");return this.apiCalls.push({caller:e,method:t,params:a,callTime:s,totalTime:o}),n}return this.apiClient[t](...a)}catch(e){throw l$1.$emit("client:fatalError","API call failed: "+t),e}}}let z=class{itemCache;apiGateway;constructor(e){this.itemCache=new Map,this.apiGateway=e;}clear(){this.itemCache.clear();}async getItem(e){if(this.itemCache.has(e))return this.itemCache.get(e);const t=await this.apiGateway.call("ItemCache::getItem","getItem",e);return this.itemCache.set(e,t),t}};class W{id;type;data;constructor(e,t,a){this.id=e,this.type=t,this.data=a;}}class Y{ownerItem;constructor(e=void 0){this.ownerItem=e;}createSnapshot(){throw "createSnapshot not implemented!"}restoreFromSnapshot(e,t){throw "restoreFromSnapshot not implemented!"}rollbackFromSnapshot(e){throw "rollbackFromSnapshot not implemented!"}_getElementById(e,t){for(const a of t)if(a.id===e)return a;return null}_rollbackArray(e,t,a){if(!Array.isArray(e))return void console.log("_rollbackArray(): no array given!");const i=[],n=[];let r=0;for(const a of t){const t=this._getElementById(a.id,e);t?n.push({element:t,snapshot:a}):i.push({position:r,snapshot:a}),r++;}const s=[];r=0;for(const a of e){this._getElementById(a.id,t)||s.push(r-s.length),r++;}for(const t of s)e.splice(t,1);for(const e of n)e.element.rollbackFromSnapshot(e.snapshot);for(const t of i){const i=a(t.snapshot,this);e.splice(t.position,0,i);}}}class H extends Y{id;srcNode;srcSlot;destNode;destSlot;posX;posY;constructor(e,t){super(t),p.assert(e,"NkConnection: data is null or undefined!"),p.assert(e.srcNode,"NkConnection: srcNode is null or undefined!"),p.assert(e.srcSlot,"NkConnection: srcSlot is null or undefined!"),p.assert(e.destNode,"NkConnection: srcNode is null or undefined!"),p.assert(e.destSlot,"NkConnection: srcSlot is null or undefined!"),this.id=e.id||p.createItemOrBlockID(),this.srcNode=e.srcNode,this.srcSlot=e.srcSlot,this.destNode=e.destNode,this.destSlot=e.destSlot,this.posX=e.posX||0,this.posY=e.posY||0;}getId(){return this.id}setPosition(e,t){this.posX=e,this.posY=t;}getPosX(){return this.posX}getPosY(){return this.posY}getSrcNode(){return this.srcNode}getDestNode(){return this.destNode}getSrcSlot(){return this.srcSlot}getDestSlot(){return this.destSlot}setSrcNode(e){this.srcNode=e;}setDestNode(e){this.destNode=e;}setSrcSlot(e){this.srcSlot=e;}setDestSlot(e){this.destSlot=e;}clone(){return new H({srcNode:this.srcNode,srcSlot:this.srcSlot,destNode:this.destNode,destSlot:this.destSlot,posX:this.posX,posY:this.posY},this.ownerItem)}createSnapshot(){return new W(this.id,"connection",{id:this.id,srcNode:this.srcNode,srcSlot:this.srcSlot,destNode:this.destNode,destSlot:this.destSlot,posX:this.posX,posY:this.posY})}restoreFromSnapshot(e){this.id=e.id,this.srcNode=e.data.srcNode,this.srcSlot=e.data.srcSlot,this.destNode=e.data.destNode,this.destSlot=e.data.destSlot,this.posX=e.data.posX,this.posY=e.data.posY;}rollbackFromSnapshot(e){this.srcNode=e.data.srcNode,this.srcSlot=e.data.srcSlot,this.destNode=e.data.destNode,this.destSlot=e.data.destSlot,this.posX=e.data.posX,this.posY=e.data.posY;}}function G$9(e){const t=[];if(!e||"object"!=typeof e)return t;for(let a in e){if(!e.hasOwnProperty(a))continue;const i=e[a];if("$or"!==a&&"$not"!==a)a.includes(".")&&(a=a.split(".")[0]),a.endsWith("?")&&(a=a.substring(0,a.length-1)),t.includes(a)||t.push(a);else if("$or"===a&&Array.isArray(i))for(const e of i)t.push(...G$9(e));else "$not"===a&&"object"==typeof i&&t.push(...G$9(i));}return t}function q(e,t,a){if(t.startsWith("$")){if(e.resolveComputed){const i=e.resolveComputed(t,a);if(void 0!==i)return i}return console.error("Computed condition value unknown: "+t),false}let i;t.includes(".")?(i=t.split("."),t=i.splice(0,1)[0]):i=[];let n=t.endsWith("?");n&&(t=t.substring(0,t.length-1));const r=e.getConditionField(t);if(!r)return n||console.error("Field to resolve condition not found: "+t),false;let s=r.value;for(let e=0;e<i.length;e++){if(!s)return console.error(`Field path ${i.join(".")} not found in field ${t}!`),false;s=s[i[e]];}return "object"==typeof a&&null!==a?void 0!==a.$isset?a.$isset===!!s:void 0!==a.$not?a.$not!==s:(console.error("Condition value cannot be interpreted: ",a),false):r.value==a}function Z(e,t){if(!t||"object"!=typeof t)return true;for(const a in t){if(!t.hasOwnProperty(a))continue;const i=t[a];if("$or"===a){if(!Array.isArray(i))return console.error("Condition contains $or but its value is not an array!"),false;for(const t of i)if(Z(e,t))return true;return false}if("$not"!==a){if(!q(e,a,i))return false}else {if("object"!=typeof i)return console.error("When using the $not operator, the value needs to be an object"),false;if(Z(e,i))return false}}return true}class J extends Y{id;name=void 0;displayName=void 0;script;type=void 0;datatype=void 0;minValue=void 0;maxValue=void 0;order=0;inject=void 0;info=void 0;collapsed=false;linkableTypes=void 0;condition=null;conditionFields=[];conditionFieldNames=[];dependantFields=[];dependenciesInitialized=false;separatorFields=[];_internalValue;_updateConditions=true;_hidden=false;constructor(e=void 0,t=void 0,a=void 0,i=void 0){super(i),this._internalValue=a,this.script=e,this.id=p.createGUID(),this.name=t,this.displayName=t,this._updateDisplayName();}get value(){return this._internalValue}set value(e){this._internalValue=e,this._processDependencies();}get hidden(){return !(!this.condition||!this.dependenciesInitialized)&&(this._updateConditions&&(this._hidden=!Z(this,this.condition),this._updateConditions=false),this._hidden)}getConditionField(e){for(const t of this.conditionFields)if(t&&t.name===e)return t;return null}getId(){return this.id}setName(e){this.name=e,this._updateDisplayName();}setOrder(e){this.order=e;}setInfo(e){this.info=e;}updateConditions(){this.condition&&this.dependenciesInitialized&&(this._updateConditions=true,l$1.$emit("field:hiddenChanged",this.id));}_processDependencies(){for(const e of this.dependantFields)e.updateConditions();}setCondition(e){e?"object"==typeof e?this.condition=e:(console.error("Condition must be an object if set",e),this.condition=null):this.condition=null,this.conditionFieldNames=this.condition?G$9(this.condition):[];}refreshDependantFields(e,t){const a=[];if(this.condition)for(let t of this.conditionFieldNames){const i=t.endsWith("?");i&&(t=t.substring(0,t.length-1));const n=e.get(t);n?a.push(n):i||console.warn("Condition field not found: "+t);}this.conditionFields=a,this.dependantFields=t||[],this.dependenciesInitialized=true;}clone(e=new Map){const t=new J;return t.ownerItem=this.ownerItem,t._internalValue=e.get(this.value)??this.value,t.script=this.script,t.type=this.type,t.minValue=this.minValue,t.maxValue=this.maxValue,t.order=this.order,t.info=this.info,t.collapsed=this.collapsed,t.linkableTypes=this.linkableTypes?[...this.linkableTypes]:void 0,t.condition=this.condition,t.conditionFieldNames=[...this.conditionFieldNames],t.setName(this.name),t}clearDefinition(){this.type=void 0,this.linkableTypes=void 0,this.condition=null,this.conditionFieldNames=[],this.conditionFields=[],this.dependantFields=[],this.dependenciesInitialized=false;}setDefinition(e){this.inject=e.inject;const t=e?.type??e?.datatype??"",a="string"==typeof t?t.toLowerCase().trim():"";switch(e.conditions?this.setCondition(e.conditions):e.condition?this.setCondition(e.condition):this.setCondition(null),a){case "boolean":case "bool":this.type="Attribute",this.datatype="Boolean",this._internalValue=void 0!==this._internalValue?this._toBoolean(this._internalValue):this._toBoolean(e.defaultValue);break;case "number":{this.type="Attribute",this.datatype="Float",this._internalValue=void 0!==this._internalValue?Number(this._internalValue):Number(e.defaultValue);const t=this._parseTypeParams(e.typeparams,2);void 0!==e.minValue&&null!==e.minValue?this.minValue=Number(e.minValue):this.minValue=t?Number(t[0]):void 0,void 0!==e.maxValue&&null!==e.maxValue?this.maxValue=Number(e.maxValue):this.maxValue=t?Number(t[1]):void 0;break}case "string":this.type="Attribute",this.datatype="String",this._internalValue=void 0!==this._internalValue&&null!==this._internalValue?this._internalValue.toString():e.defaultValue?e.defaultValue.toString():"";break;case "node":this.type="Attribute",this.datatype="Node";break;case "link":this.type="Link",this.datatype="Link",Array.isArray(e.allowedTypes)&&e.allowedTypes.length>0?this.linkableTypes=e.allowedTypes:this.linkableTypes=void 0;break;case "numberarray":{this.type="Attribute",this.datatype="NumberArray",this._internalValue=this._toNumberArray(void 0!==this._internalValue?this._internalValue:e.defaultValue);const t=this._parseTypeParams(e.typeparams,2);void 0!==e.minValue&&null!==e.minValue?this.minValue=Number(e.minValue):this.minValue=t?Number(t[0]):void 0,void 0!==e.maxValue&&null!==e.maxValue?this.maxValue=Number(e.maxValue):this.maxValue=t?Number(t[1]):void 0;break}case "stringarray":this.type="Attribute",this.datatype="StringArray",this._internalValue=this._toStringArray(void 0!==this._internalValue?this._internalValue:e.defaultValue);break;case "boolarray":case "booleanarray":this.type="Attribute",this.datatype="BoolArray",this._internalValue=this._toBoolArray(void 0!==this._internalValue?this._internalValue:e.defaultValue);break;case "nodearray":this.type="Attribute",this.datatype="NodeArray",this._internalValue=this._toNodeArray(void 0!==this._internalValue?this._internalValue:e.defaultValue);break;case "linkarray":this.type="LinkArray",this.datatype="LinkArray",Array.isArray(e.allowedTypes)&&e.allowedTypes.length>0?this.linkableTypes=e.allowedTypes:this.linkableTypes=void 0,this._internalValue=this._toLinkArray(void 0!==this._internalValue?this._internalValue:e.defaultValue);break;case "separator":{const t="Separator"===this.type;this.type="Separator",this.datatype=void 0,this._internalValue=void 0,t||(this.collapsed=!!e.collapsed),void 0!==e.defaultValue&&null!==e.defaultValue?this.displayName=e.defaultValue.toString():this._updateDisplayName();break}default:a&&console.error("Unknown script field type: "+a),this.type="Attribute",this.datatype="String",this._internalValue=this._internalValue?this._internalValue.toString():e.defaultValue?e.defaultValue.toString():"";}}_toBoolean(e){return null!=e&&(true===e||false===e?e:"false"!==e.toString().toLowerCase())}_ensureArray(e,t=[]){return Array.isArray(e)?e:Array.isArray(t)?[...t]:[]}_toNumberArray(e){return this._ensureArray(e).map((e=>Number(e)||0))}_toStringArray(e){return this._ensureArray(e).map((e=>null!=e?e.toString():""))}_toBoolArray(e){return this._ensureArray(e).map((e=>this._toBoolean(e)))}_toNodeArray(e){return this._ensureArray(e).map((e=>null==e?null:"string"==typeof e?e:"object"==typeof e&&e._id?e._id:e))}_toLinkArray(e){return this._ensureArray(e).map((e=>null==e?null:"string"==typeof e?{_id:e}:e))}_updateDisplayName(){this.name?this.displayName=p.toUserFriendlyName(this.name):this.displayName="";}_parseTypeParams(e,t){if(!e)return null;const a=e.split(",").map((e=>e.trim()));return a.length!==t?null:a}createSnapshot(){return new W(this.name,"scriptfield",{id:this.id,type:this.type,name:this.name,value:this._internalValue,datatype:this.datatype,minValue:this.minValue,maxValue:this.maxValue,order:this.order,info:this.info,collapsed:this.collapsed,linkableTypes:this.linkableTypes})}}function K$1(e){const t=new Map;for(const a of e)a.name&&t.set(a.name,a);const a=function(e,t){const a=new Map;for(const i of e)if(Array.isArray(i.conditionFieldNames))for(const e of i.conditionFieldNames){const n=t.get(e);if(!n)continue;const r=a.get(n);r?r.push(i):a.set(n,[i]);}return a}(e,t);!function(e,t,a){for(const i of e){const e=[];if(i.condition)for(let a of i.conditionFieldNames){const i=a.endsWith("?");i&&(a=a.substring(0,a.length-1));const n=t.get(a);n?e.push(n):i||console.warn("Condition field not found: "+a);}i.conditionFields=e,i.dependantFields=a.get(i)||[],i.dependenciesInitialized=true;}}(e,t,a);}function X$1(e,t,a){const{datatype:i,minValue:n,maxValue:r,name:s,value:o,type:l,order:u,id:c,info:d,collapsed:p,linkableTypes:h}=e.data,f=new J(t,s,o,a);return f.id=c,f.type=l,f.datatype=i,f.minValue=n,f.maxValue=r,f.order=u,f.info=d,f.collapsed=p??false,f.linkableTypes=h,f}let Q$1 = class Q extends Y{id=void 0;block=void 0;fields=[];item=null;deferInitCall=false;constructor(e=void 0,t=void 0,a=void 0,i=void 0){super(a),e instanceof W?this.restoreFromSnapshot(e,t):(this.id=e||p.createItemOrBlockID(),this.block=t),this.item||(this.item={value:i,linkableItems:[],linkableTypes:["Script"]}),this.item=y$1.instance.proxyScriptItem(this.item,this,this.ownerItem),this.fields=y$1.instance.proxyScriptFieldsArray(this.fields,this,this.ownerItem);}getId(){return this.id}makeIdsUnique(e,t=false){if(this.id)if(e.has(this.id)||t){const t=p.createItemOrBlockID();e.set(this.id,t),this.id=t;}else e.set(this.id,this.id);}transformNodeIds(e){for(const t of this.fields)t.value&&e.has(t.value)&&(t.value=e.get(t.value));}clone(e=new Map,t={}){const a=new Q(void 0,this.block,this.ownerItem,this.item.value);for(const i of this.fields){const n=i.clone(e);n.script=a,t.hasOwnProperty(n.name)&&(n.value=t[n.name]),a.addField(n);}return a}createFieldsFromDefinition(e=[]){function t(e,t){for(const a of e)if(a.name===t)return a;return null}for(const a of this.fields)t(e,a.name)||a.clearDefinition();let a=0;for(const i of e){let e=t(this.fields,i.name);e||(e=new J(this,i.name,void 0,this.ownerItem),this.addField(e)),e.setOrder(a++),e.setInfo(i.info??""),e.setDefinition(i);}this.fields.sort((function(e,t){return e.order-t.order})),this.refreshFieldDependencies();}refreshFieldDependencies(){K$1(this.fields);for(const e of this.fields)e.updateConditions();}clearFieldTypes(){this.createFieldsFromDefinition();}addField(e){this.fields.push(y$1.instance.proxyScriptField(e,this,this.ownerItem));}createSnapshot(){const e=[];for(const t of this.fields)e.push(t.createSnapshot());return new W(this.id,"script",{id:this.id,value:this.item.value,fields:e})}restoreFromSnapshot(e,t){this.id=e.data.id,this.block=t,this.item={value:e.data.value,linkableItems:[],linkableTypes:["Script"]};const a=[];this._rollbackArray(a,e.data.fields,(e=>{const t=X$1(e,this,this.ownerItem);return y$1.instance.proxyScriptField(t,this,this.ownerItem)})),this.fields=a;}rollbackFromSnapshot(e){e.data.value&&(this.item.value=e.data.value),this._rollbackArray(this.fields,e.data.fields,(e=>{const t=X$1(e,this,this.ownerItem);return y$1.instance.proxyScriptField(t,this,this.ownerItem)}));}};var ee,te$1={exports:{}},ae$1=te$1.exports;
4605
4605
  /**
4606
4606
  * @license
4607
4607
  * Lodash <https://lodash.com/>
@@ -4609,14 +4609,14 @@ var Lemonate = (function (exports) {
4609
4609
  * Released under MIT license <https://lodash.com/license>
4610
4610
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
4611
4611
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4612
- */var Q$1=(J||(J=1,function(e,t){(function(){var a,n="Expected a function",i="__lodash_hash_undefined__",r="__lodash_placeholder__",s=32,o=128,l=256,u=1/0,c=9007199254740991,d=NaN,p=4294967295,h=[["ary",o],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",l]],f="[object Arguments]",m="[object Array]",y="[object Boolean]",g="[object Date]",b="[object Error]",v="[object Function]",w="[object GeneratorFunction]",_="[object Map]",A="[object Number]",k="[object Object]",S="[object Promise]",N="[object RegExp]",T="[object Set]",M="[object String]",x="[object Symbol]",C="[object WeakMap]",V="[object ArrayBuffer]",I="[object DataView]",E="[object Float32Array]",F="[object Float64Array]",R="[object Int8Array]",L="[object Int16Array]",P="[object Int32Array]",B="[object Uint8Array]",O="[object Uint8ClampedArray]",$="[object Uint16Array]",U="[object Uint32Array]",j=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Y=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,G=RegExp(Y.source),q=RegExp(H.source),Z=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ae=RegExp(te.source),ne=/^\s+/,ie=/\s/,re=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,oe=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,we=/['\n\r\u2028\u2029\\]/g,_e="\\ud800-\\udfff",Ae="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Ne="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",Me="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xe="['’]",Ce="["+_e+"]",Ve="["+Me+"]",Ie="["+Ae+"]",Ee="\\d+",Fe="["+ke+"]",De="["+Se+"]",Re="[^"+_e+Me+Ee+ke+Se+Ne+"]",Le="\\ud83c[\\udffb-\\udfff]",Pe="[^"+_e+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Oe="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Ne+"]",Ue="\\u200d",je="(?:"+De+"|"+Re+")",ze="(?:"+$e+"|"+Re+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",Ye="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ie+"|"+Le+")?",Ge="["+Te+"]?",qe=Ge+He+"(?:"+Ue+"(?:"+[Pe,Be,Oe].join("|")+")"+Ge+He+")*",Ze="(?:"+[Fe,Be,Oe].join("|")+")"+qe,Je="(?:"+[Pe+Ie+"?",Ie,Be,Oe,Ce].join("|")+")",Ke=RegExp(xe,"g"),Xe=RegExp(Ie,"g"),Qe=RegExp(Le+"(?="+Le+")|"+Je+qe,"g"),et=RegExp([$e+"?"+De+"+"+We+"(?="+[Ve,$e,"$"].join("|")+")",ze+"+"+Ye+"(?="+[Ve,$e+je,"$"].join("|")+")",$e+"?"+je+"+"+We,$e+"+"+Ye,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ee,Ze].join("|"),"g"),tt=RegExp("["+Ue+_e+Ae+Te+"]"),at=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],it=-1,rt={};rt[E]=rt[F]=rt[R]=rt[L]=rt[P]=rt[B]=rt[O]=rt[$]=rt[U]=true,rt[f]=rt[m]=rt[V]=rt[y]=rt[I]=rt[g]=rt[b]=rt[v]=rt[_]=rt[A]=rt[k]=rt[N]=rt[T]=rt[M]=rt[C]=false;var st={};st[f]=st[m]=st[V]=st[I]=st[y]=st[g]=st[E]=st[F]=st[R]=st[L]=st[P]=st[_]=st[A]=st[k]=st[N]=st[T]=st[M]=st[x]=st[B]=st[O]=st[$]=st[U]=true,st[b]=st[v]=st[C]=false;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ut=parseInt,ct="object"==typeof D&&D&&D.Object===Object&&D,dt="object"==typeof self&&self&&self.Object===Object&&self,pt=ct||dt||Function("return this")(),ht=t&&!t.nodeType&&t,ft=ht&&e&&!e.nodeType&&e,mt=ft&&ft.exports===ht,yt=mt&&ct.process,gt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),bt=gt&&gt.isArrayBuffer,vt=gt&&gt.isDate,wt=gt&&gt.isMap,_t=gt&&gt.isRegExp,At=gt&&gt.isSet,kt=gt&&gt.isTypedArray;function St(e,t,a){switch(a.length){case 0:return e.call(t);case 1:return e.call(t,a[0]);case 2:return e.call(t,a[0],a[1]);case 3:return e.call(t,a[0],a[1],a[2])}return e.apply(t,a)}function Nt(e,t,a,n){for(var i=-1,r=null==e?0:e.length;++i<r;){var s=e[i];t(n,s,a(s),e);}return n}function Tt(e,t){for(var a=-1,n=null==e?0:e.length;++a<n&&false!==t(e[a],a,e););return e}function Mt(e,t){for(var a=null==e?0:e.length;a--&&false!==t(e[a],a,e););return e}function xt(e,t){for(var a=-1,n=null==e?0:e.length;++a<n;)if(!t(e[a],a,e))return false;return true}function Ct(e,t){for(var a=-1,n=null==e?0:e.length,i=0,r=[];++a<n;){var s=e[a];t(s,a,e)&&(r[i++]=s);}return r}function Vt(e,t){return !(null==e||!e.length)&&$t(e,t,0)>-1}function It(e,t,a){for(var n=-1,i=null==e?0:e.length;++n<i;)if(a(t,e[n]))return true;return false}function Et(e,t){for(var a=-1,n=null==e?0:e.length,i=Array(n);++a<n;)i[a]=t(e[a],a,e);return i}function Ft(e,t){for(var a=-1,n=t.length,i=e.length;++a<n;)e[i+a]=t[a];return e}function Dt(e,t,a,n){var i=-1,r=null==e?0:e.length;for(n&&r&&(a=e[++i]);++i<r;)a=t(a,e[i],i,e);return a}function Rt(e,t,a,n){var i=null==e?0:e.length;for(n&&i&&(a=e[--i]);i--;)a=t(a,e[i],i,e);return a}function Lt(e,t){for(var a=-1,n=null==e?0:e.length;++a<n;)if(t(e[a],a,e))return true;return false}var Pt=Wt("length");function Bt(e,t,a){var n;return a(e,(function(e,a,i){if(t(e,a,i))return n=a,false})),n}function Ot(e,t,a,n){for(var i=e.length,r=a+(n?1:-1);n?r--:++r<i;)if(t(e[r],r,e))return r;return -1}function $t(e,t,a){return t==t?function(e,t,a){for(var n=a-1,i=e.length;++n<i;)if(e[n]===t)return n;return -1}(e,t,a):Ot(e,jt,a)}function Ut(e,t,a,n){for(var i=a-1,r=e.length;++i<r;)if(n(e[i],t))return i;return -1}function jt(e){return e!=e}function zt(e,t){var a=null==e?0:e.length;return a?Gt(e,t)/a:d}function Wt(e){return function(t){return null==t?a:t[e]}}function Yt(e){return function(t){return null==e?a:e[t]}}function Ht(e,t,a,n,i){return i(e,(function(e,i,r){a=n?(n=false,e):t(a,e,i,r);})),a}function Gt(e,t){for(var n,i=-1,r=e.length;++i<r;){var s=t(e[i]);s!==a&&(n=n===a?s:n+s);}return n}function qt(e,t){for(var a=-1,n=Array(e);++a<e;)n[a]=t(a);return n}function Zt(e){return e?e.slice(0,pa(e)+1).replace(ne,""):e}function Jt(e){return function(t){return e(t)}}function Kt(e,t){return Et(t,(function(t){return e[t]}))}function Xt(e,t){return e.has(t)}function Qt(e,t){for(var a=-1,n=e.length;++a<n&&$t(t,e[a],0)>-1;);return a}function ea(e,t){for(var a=e.length;a--&&$t(t,e[a],0)>-1;);return a}var ta=Yt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),aa=Yt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function na(e){return "\\"+ot[e]}function ia(e){return tt.test(e)}function ra(e){var t=-1,a=Array(e.size);return e.forEach((function(e,n){a[++t]=[n,e];})),a}function sa(e,t){return function(a){return e(t(a))}}function oa(e,t){for(var a=-1,n=e.length,i=0,s=[];++a<n;){var o=e[a];o!==t&&o!==r||(e[a]=r,s[i++]=a);}return s}function la(e){var t=-1,a=Array(e.size);return e.forEach((function(e){a[++t]=e;})),a}function ua(e){var t=-1,a=Array(e.size);return e.forEach((function(e){a[++t]=[e,e];})),a}function ca(e){return ia(e)?function(e){for(var t=Qe.lastIndex=0;Qe.test(e);)++t;return t}(e):Pt(e)}function da(e){return ia(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.split("")}(e)}function pa(e){for(var t=e.length;t--&&ie.test(e.charAt(t)););return t}var ha=Yt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fa=function e(t){var D,ie=(t=null==t?pt:fa.defaults(pt.Object(),t,fa.pick(pt,nt))).Array,_e=t.Date,Ae=t.Error,ke=t.Function,Se=t.Math,Ne=t.Object,Te=t.RegExp,Me=t.String,xe=t.TypeError,Ce=ie.prototype,Ve=ke.prototype,Ie=Ne.prototype,Ee=t["__core-js_shared__"],Fe=Ve.toString,De=Ie.hasOwnProperty,Re=0,Le=(D=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",Pe=Ie.toString,Be=Fe.call(Ne),Oe=pt._,$e=Te("^"+Fe.call(De).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=mt?t.Buffer:a,je=t.Symbol,ze=t.Uint8Array,We=Ue?Ue.allocUnsafe:a,Ye=sa(Ne.getPrototypeOf,Ne),He=Ne.create,Ge=Ie.propertyIsEnumerable,qe=Ce.splice,Ze=je?je.isConcatSpreadable:a,Je=je?je.iterator:a,Qe=je?je.toStringTag:a,tt=function(){try{var e=cr(Ne,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ct=_e&&_e.now!==pt.Date.now&&_e.now,dt=t.setTimeout!==pt.setTimeout&&t.setTimeout,ht=Se.ceil,ft=Se.floor,yt=Ne.getOwnPropertySymbols,gt=Ue?Ue.isBuffer:a,Pt=t.isFinite,Yt=Ce.join,ma=sa(Ne.keys,Ne),ya=Se.max,ga=Se.min,ba=_e.now,va=t.parseInt,wa=Se.random,_a=Ce.reverse,Aa=cr(t,"DataView"),ka=cr(t,"Map"),Sa=cr(t,"Promise"),Na=cr(t,"Set"),Ta=cr(t,"WeakMap"),Ma=cr(Ne,"create"),xa=Ta&&new Ta,Ca={},Va=Lr(Aa),Ia=Lr(ka),Ea=Lr(Sa),Fa=Lr(Na),Da=Lr(Ta),Ra=je?je.prototype:a,La=Ra?Ra.valueOf:a,Pa=Ra?Ra.toString:a;function Ba(e){if(Qs(e)&&!js(e)&&!(e instanceof ja)){if(e instanceof Ua)return e;if(De.call(e,"__wrapped__"))return Pr(e)}return new Ua(e)}var Oa=function(){function e(){}return function(t){if(!Xs(t))return {};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=a,n}}();function $a(){}function Ua(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=a;}function ja(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[];}function za(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var n=e[t];this.set(n[0],n[1]);}}function Wa(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var n=e[t];this.set(n[0],n[1]);}}function Ya(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var n=e[t];this.set(n[0],n[1]);}}function Ha(e){var t=-1,a=null==e?0:e.length;for(this.__data__=new Ya;++t<a;)this.add(e[t]);}function Ga(e){var t=this.__data__=new Wa(e);this.size=t.size;}function qa(e,t){var a=js(e),n=!a&&Us(e),i=!a&&!n&&Hs(e),r=!a&&!n&&!i&&oo(e),s=a||n||i||r,o=s?qt(e.length,Me):[],l=o.length;for(var u in e)!t&&!De.call(e,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||r&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||gr(u,l))||o.push(u);return o}function Za(e){var t=e.length;return t?e[Gn(0,t-1)]:a}function Ja(e,t){return Fr(xi(e),sn(t,0,e.length))}function Ka(e){return Fr(xi(e))}function Xa(e,t,n){(n!==a&&!Bs(e[t],n)||n===a&&!(t in e))&&nn(e,t,n);}function Qa(e,t,n){var i=e[t];De.call(e,t)&&Bs(i,n)&&(n!==a||t in e)||nn(e,t,n);}function en(e,t){for(var a=e.length;a--;)if(Bs(e[a][0],t))return a;return -1}function tn(e,t,a,n){return dn(e,(function(e,i,r){t(n,e,a(e),r);})),n}function an(e,t){return e&&Ci(t,Vo(t),e)}function nn(e,t,a){"__proto__"==t&&tt?tt(e,t,{configurable:true,enumerable:true,value:a,writable:true}):e[t]=a;}function rn(e,t){for(var n=-1,i=t.length,r=ie(i),s=null==e;++n<i;)r[n]=s?a:No(e,t[n]);return r}function sn(e,t,n){return e==e&&(n!==a&&(e=e<=n?e:n),t!==a&&(e=e>=t?e:t)),e}function on(e,t,n,i,r,s){var o,l=1&t,u=2&t,c=4&t;if(n&&(o=r?n(e,i,r,s):n(e)),o!==a)return o;if(!Xs(e))return e;var d=js(e);if(d){if(o=function(e){var t=e.length,a=new e.constructor(t);return t&&"string"==typeof e[0]&&De.call(e,"index")&&(a.index=e.index,a.input=e.input),a}(e),!l)return xi(e,o)}else {var p=hr(e),h=p==v||p==w;if(Hs(e))return Ai(e,l);if(p==k||p==f||h&&!r){if(o=u||h?{}:mr(e),!l)return u?function(e,t){return Ci(e,pr(e),t)}(e,function(e,t){return e&&Ci(t,Io(t),e)}(o,e)):function(e,t){return Ci(e,dr(e),t)}(e,an(o,e))}else {if(!st[p])return r?e:{};o=function(e,t,a){var n,i=e.constructor;switch(t){case V:return ki(e);case y:case g:return new i(+e);case I:return function(e,t){var a=t?ki(e.buffer):e.buffer;return new e.constructor(a,e.byteOffset,e.byteLength)}(e,a);case E:case F:case R:case L:case P:case B:case O:case $:case U:return Si(e,a);case _:return new i;case A:case M:return new i(e);case N:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case T:return new i;case x:return n=e,La?Ne(La.call(n)):{}}}(e,p,l);}}s||(s=new Ga);var m=s.get(e);if(m)return m;s.set(e,o),io(e)?e.forEach((function(a){o.add(on(a,t,n,a,e,s));})):eo(e)&&e.forEach((function(a,i){o.set(i,on(a,t,n,i,e,s));}));var b=d?a:(c?u?nr:ar:u?Io:Vo)(e);return Tt(b||e,(function(a,i){b&&(a=e[i=a]),Qa(o,i,on(a,t,n,i,e,s));})),o}function ln(e,t,n){var i=n.length;if(null==e)return !i;for(e=Ne(e);i--;){var r=n[i],s=t[r],o=e[r];if(o===a&&!(r in e)||!s(o))return false}return true}function un(e,t,i){if("function"!=typeof e)throw new xe(n);return Cr((function(){e.apply(a,i);}),t)}function cn(e,t,a,n){var i=-1,r=Vt,s=true,o=e.length,l=[],u=t.length;if(!o)return l;a&&(t=Et(t,Jt(a))),n?(r=It,s=false):t.length>=200&&(r=Xt,s=false,t=new Ha(t));e:for(;++i<o;){var c=e[i],d=null==a?c:a(c);if(c=n||0!==c?c:0,s&&d==d){for(var p=u;p--;)if(t[p]===d)continue e;l.push(c);}else r(t,d,n)||l.push(c);}return l}Ba.templateSettings={escape:Z,evaluate:J,interpolate:K,variable:"",imports:{_:Ba}},Ba.prototype=$a.prototype,Ba.prototype.constructor=Ba,Ua.prototype=Oa($a.prototype),Ua.prototype.constructor=Ua,ja.prototype=Oa($a.prototype),ja.prototype.constructor=ja,za.prototype.clear=function(){this.__data__=Ma?Ma(null):{},this.size=0;},za.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},za.prototype.get=function(e){var t=this.__data__;if(Ma){var n=t[e];return n===i?a:n}return De.call(t,e)?t[e]:a},za.prototype.has=function(e){var t=this.__data__;return Ma?t[e]!==a:De.call(t,e)},za.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ma&&t===a?i:t,this},Wa.prototype.clear=function(){this.__data__=[],this.size=0;},Wa.prototype.delete=function(e){var t=this.__data__,a=en(t,e);return !(a<0||(a==t.length-1?t.pop():qe.call(t,a,1),--this.size,0))},Wa.prototype.get=function(e){var t=this.__data__,n=en(t,e);return n<0?a:t[n][1]},Wa.prototype.has=function(e){return en(this.__data__,e)>-1},Wa.prototype.set=function(e,t){var a=this.__data__,n=en(a,e);return n<0?(++this.size,a.push([e,t])):a[n][1]=t,this},Ya.prototype.clear=function(){this.size=0,this.__data__={hash:new za,map:new(ka||Wa),string:new za};},Ya.prototype.delete=function(e){var t=lr(this,e).delete(e);return this.size-=t?1:0,t},Ya.prototype.get=function(e){return lr(this,e).get(e)},Ya.prototype.has=function(e){return lr(this,e).has(e)},Ya.prototype.set=function(e,t){var a=lr(this,e),n=a.size;return a.set(e,t),this.size+=a.size==n?0:1,this},Ha.prototype.add=Ha.prototype.push=function(e){return this.__data__.set(e,i),this},Ha.prototype.has=function(e){return this.__data__.has(e)},Ga.prototype.clear=function(){this.__data__=new Wa,this.size=0;},Ga.prototype.delete=function(e){var t=this.__data__,a=t.delete(e);return this.size=t.size,a},Ga.prototype.get=function(e){return this.__data__.get(e)},Ga.prototype.has=function(e){return this.__data__.has(e)},Ga.prototype.set=function(e,t){var a=this.__data__;if(a instanceof Wa){var n=a.__data__;if(!ka||n.length<199)return n.push([e,t]),this.size=++a.size,this;a=this.__data__=new Ya(n);}return a.set(e,t),this.size=a.size,this};var dn=Ei(vn),pn=Ei(wn,true);function hn(e,t){var a=true;return dn(e,(function(e,n,i){return a=!!t(e,n,i)})),a}function fn(e,t,n){for(var i=-1,r=e.length;++i<r;){var s=e[i],o=t(s);if(null!=o&&(l===a?o==o&&!so(o):n(o,l)))var l=o,u=s;}return u}function mn(e,t){var a=[];return dn(e,(function(e,n,i){t(e,n,i)&&a.push(e);})),a}function yn(e,t,a,n,i){var r=-1,s=e.length;for(a||(a=yr),i||(i=[]);++r<s;){var o=e[r];t>0&&a(o)?t>1?yn(o,t-1,a,n,i):Ft(i,o):n||(i[i.length]=o);}return i}var gn=Fi(),bn=Fi(true);function vn(e,t){return e&&gn(e,t,Vo)}function wn(e,t){return e&&bn(e,t,Vo)}function _n(e,t){return Ct(t,(function(t){return Zs(e[t])}))}function An(e,t){for(var n=0,i=(t=bi(t,e)).length;null!=e&&n<i;)e=e[Rr(t[n++])];return n&&n==i?e:a}function kn(e,t,a){var n=t(e);return js(e)?n:Ft(n,a(e))}function Sn(e){return null==e?e===a?"[object Undefined]":"[object Null]":Qe&&Qe in Ne(e)?function(e){var t=De.call(e,Qe),n=e[Qe];try{e[Qe]=a;var i=!0;}catch(e){}var r=Pe.call(e);return i&&(t?e[Qe]=n:delete e[Qe]),r}(e):function(e){return Pe.call(e)}(e)}function Nn(e,t){return e>t}function Tn(e,t){return null!=e&&De.call(e,t)}function Mn(e,t){return null!=e&&t in Ne(e)}function xn(e,t,n){for(var i=n?It:Vt,r=e[0].length,s=e.length,o=s,l=ie(s),u=1/0,c=[];o--;){var d=e[o];o&&t&&(d=Et(d,Jt(t))),u=ga(d.length,u),l[o]=!n&&(t||r>=120&&d.length>=120)?new Ha(o&&d):a;}d=e[0];var p=-1,h=l[0];e:for(;++p<r&&c.length<u;){var f=d[p],m=t?t(f):f;if(f=n||0!==f?f:0,!(h?Xt(h,m):i(c,m,n))){for(o=s;--o;){var y=l[o];if(!(y?Xt(y,m):i(e[o],m,n)))continue e}h&&h.push(m),c.push(f);}}return c}function Cn(e,t,n){var i=null==(e=Tr(e,t=bi(t,e)))?e:e[Rr(qr(t))];return null==i?a:St(i,e,n)}function Vn(e){return Qs(e)&&Sn(e)==f}function In(e,t,n,i,r){return e===t||(null==e||null==t||!Qs(e)&&!Qs(t)?e!=e&&t!=t:function(e,t,n,i,r,s){var o=js(e),l=js(t),u=o?m:hr(e),c=l?m:hr(t),d=(u=u==f?k:u)==k,p=(c=c==f?k:c)==k,h=u==c;if(h&&Hs(e)){if(!Hs(t))return false;o=true,d=false;}if(h&&!d)return s||(s=new Ga),o||oo(e)?er(e,t,n,i,r,s):function(e,t,a,n,i,r,s){switch(a){case I:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return false;e=e.buffer,t=t.buffer;case V:return !(e.byteLength!=t.byteLength||!r(new ze(e),new ze(t)));case y:case g:case A:return Bs(+e,+t);case b:return e.name==t.name&&e.message==t.message;case N:case M:return e==t+"";case _:var o=ra;case T:var l=1&n;if(o||(o=la),e.size!=t.size&&!l)return false;var u=s.get(e);if(u)return u==t;n|=2,s.set(e,t);var c=er(o(e),o(t),n,i,r,s);return s.delete(e),c;case x:if(La)return La.call(e)==La.call(t)}return false}(e,t,u,n,i,r,s);if(!(1&n)){var v=d&&De.call(e,"__wrapped__"),w=p&&De.call(t,"__wrapped__");if(v||w){var S=v?e.value():e,C=w?t.value():t;return s||(s=new Ga),r(S,C,n,i,s)}}return !!h&&(s||(s=new Ga),function(e,t,n,i,r,s){var o=1&n,l=ar(e),u=l.length,c=ar(t),d=c.length;if(u!=d&&!o)return false;for(var p=u;p--;){var h=l[p];if(!(o?h in t:De.call(t,h)))return false}var f=s.get(e),m=s.get(t);if(f&&m)return f==t&&m==e;var y=true;s.set(e,t),s.set(t,e);for(var g=o;++p<u;){var b=e[h=l[p]],v=t[h];if(i)var w=o?i(v,b,h,t,e,s):i(b,v,h,e,t,s);if(!(w===a?b===v||r(b,v,n,i,s):w)){y=false;break}g||(g="constructor"==h);}if(y&&!g){var _=e.constructor,A=t.constructor;_==A||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof A&&A instanceof A||(y=false);}return s.delete(e),s.delete(t),y}(e,t,n,i,r,s))}(e,t,n,i,In,r))}function En(e,t,n,i){var r=n.length,s=r,o=!i;if(null==e)return !s;for(e=Ne(e);r--;){var l=n[r];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return false}for(;++r<s;){var u=(l=n[r])[0],c=e[u],d=l[1];if(o&&l[2]){if(c===a&&!(u in e))return false}else {var p=new Ga;if(i)var h=i(c,d,u,e,t,p);if(!(h===a?In(d,c,3,i,p):h))return false}}return true}function Fn(e){return !(!Xs(e)||(t=e,Le&&Le in t))&&(Zs(e)?$e:me).test(Lr(e));var t;}function Dn(e){return "function"==typeof e?e:null==e?al:"object"==typeof e?js(e)?$n(e[0],e[1]):On(e):dl(e)}function Rn(e){if(!Ar(e))return ma(e);var t=[];for(var a in Ne(e))De.call(e,a)&&"constructor"!=a&&t.push(a);return t}function Ln(e){if(!Xs(e))return function(e){var t=[];if(null!=e)for(var a in Ne(e))t.push(a);return t}(e);var t=Ar(e),a=[];for(var n in e)("constructor"!=n||!t&&De.call(e,n))&&a.push(n);return a}function Pn(e,t){return e<t}function Bn(e,t){var a=-1,n=Ws(e)?ie(e.length):[];return dn(e,(function(e,i,r){n[++a]=t(e,i,r);})),n}function On(e){var t=ur(e);return 1==t.length&&t[0][2]?Sr(t[0][0],t[0][1]):function(a){return a===e||En(a,e,t)}}function $n(e,t){return vr(e)&&kr(t)?Sr(Rr(e),t):function(n){var i=No(n,e);return i===a&&i===t?To(n,e):In(t,i,3)}}function Un(e,t,n,i,r){e!==t&&gn(t,(function(s,o){if(r||(r=new Ga),Xs(s))!function(e,t,n,i,r,s,o){var l=Mr(e,n),u=Mr(t,n),c=o.get(u);if(c)Xa(e,n,c);else {var d=s?s(l,u,n+"",e,t,o):a,p=d===a;if(p){var h=js(u),f=!h&&Hs(u),m=!h&&!f&&oo(u);d=u,h||f||m?js(l)?d=l:Ys(l)?d=xi(l):f?(p=false,d=Ai(u,true)):m?(p=false,d=Si(u,true)):d=[]:ao(u)||Us(u)?(d=l,Us(l)?d=yo(l):Xs(l)&&!Zs(l)||(d=mr(u))):p=false;}p&&(o.set(u,d),r(d,u,i,s,o),o.delete(u)),Xa(e,n,d);}}(e,t,o,n,Un,i,r);else {var l=i?i(Mr(e,o),s,o+"",e,t,r):a;l===a&&(l=s),Xa(e,o,l);}}),Io);}function jn(e,t){var n=e.length;if(n)return gr(t+=t<0?n:0,n)?e[t]:a}function zn(e,t,a){t=t.length?Et(t,(function(e){return js(e)?function(t){return An(t,1===e.length?e[0]:e)}:e})):[al];var n=-1;t=Et(t,Jt(or()));var i=Bn(e,(function(e,a,i){var r=Et(t,(function(t){return t(e)}));return {criteria:r,index:++n,value:e}}));return function(e,t){var a=e.length;for(e.sort(t);a--;)e[a]=e[a].value;return e}(i,(function(e,t){return function(e,t,a){for(var n=-1,i=e.criteria,r=t.criteria,s=i.length,o=a.length;++n<s;){var l=Ni(i[n],r[n]);if(l)return n>=o?l:l*("desc"==a[n]?-1:1)}return e.index-t.index}(e,t,a)}))}function Wn(e,t,a){for(var n=-1,i=t.length,r={};++n<i;){var s=t[n],o=An(e,s);a(o,s)&&Xn(r,bi(s,e),o);}return r}function Yn(e,t,a,n){var i=n?Ut:$t,r=-1,s=t.length,o=e;for(e===t&&(t=xi(t)),a&&(o=Et(e,Jt(a)));++r<s;)for(var l=0,u=t[r],c=a?a(u):u;(l=i(o,c,l,n))>-1;)o!==e&&qe.call(o,l,1),qe.call(e,l,1);return e}function Hn(e,t){for(var a=e?t.length:0,n=a-1;a--;){var i=t[a];if(a==n||i!==r){var r=i;gr(i)?qe.call(e,i,1):ci(e,i);}}return e}function Gn(e,t){return e+ft(wa()*(t-e+1))}function qn(e,t){var a="";if(!e||t<1||t>c)return a;do{t%2&&(a+=e),(t=ft(t/2))&&(e+=e);}while(t);return a}function Zn(e,t){return Vr(Nr(e,t,al),e+"")}function Jn(e){return Za(Oo(e))}function Kn(e,t){var a=Oo(e);return Fr(a,sn(t,0,a.length))}function Xn(e,t,n,i){if(!Xs(e))return e;for(var r=-1,s=(t=bi(t,e)).length,o=s-1,l=e;null!=l&&++r<s;){var u=Rr(t[r]),c=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(r!=o){var d=l[u];(c=i?i(d,u,l):a)===a&&(c=Xs(d)?d:gr(t[r+1])?[]:{});}Qa(l,u,c),l=l[u];}return e}var Qn=xa?function(e,t){return xa.set(e,t),e}:al,ei=tt?function(e,t){return tt(e,"toString",{configurable:true,enumerable:false,value:Qo(t),writable:true})}:al;function ti(e){return Fr(Oo(e))}function ai(e,t,a){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(a=a>i?i:a)<0&&(a+=i),i=t>a?0:a-t>>>0,t>>>=0;for(var r=ie(i);++n<i;)r[n]=e[n+t];return r}function ni(e,t){var a;return dn(e,(function(e,n,i){return !(a=t(e,n,i))})),!!a}function ii(e,t,a){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var r=n+i>>>1,s=e[r];null!==s&&!so(s)&&(a?s<=t:s<t)?n=r+1:i=r;}return i}return ri(e,t,al,a)}function ri(e,t,n,i){var r=0,s=null==e?0:e.length;if(0===s)return 0;for(var o=(t=n(t))!=t,l=null===t,u=so(t),c=t===a;r<s;){var d=ft((r+s)/2),p=n(e[d]),h=p!==a,f=null===p,m=p==p,y=so(p);if(o)var g=i||m;else g=c?m&&(i||h):l?m&&h&&(i||!f):u?m&&h&&!f&&(i||!y):!f&&!y&&(i?p<=t:p<t);g?r=d+1:s=d;}return ga(s,4294967294)}function si(e,t){for(var a=-1,n=e.length,i=0,r=[];++a<n;){var s=e[a],o=t?t(s):s;if(!a||!Bs(o,l)){var l=o;r[i++]=0===s?0:s;}}return r}function oi(e){return "number"==typeof e?e:so(e)?d:+e}function li(e){if("string"==typeof e)return e;if(js(e))return Et(e,li)+"";if(so(e))return Pa?Pa.call(e):"";var t=e+"";return "0"==t&&1/e==-1/0?"-0":t}function ui(e,t,a){var n=-1,i=Vt,r=e.length,s=true,o=[],l=o;if(a)s=false,i=It;else if(r>=200){var u=t?null:qi(e);if(u)return la(u);s=false,i=Xt,l=new Ha;}else l=t?[]:o;e:for(;++n<r;){var c=e[n],d=t?t(c):c;if(c=a||0!==c?c:0,s&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;t&&l.push(d),o.push(c);}else i(l,d,a)||(l!==o&&l.push(d),o.push(c));}return o}function ci(e,t){return null==(e=Tr(e,t=bi(t,e)))||delete e[Rr(qr(t))]}function di(e,t,a,n){return Xn(e,t,a(An(e,t)),n)}function pi(e,t,a,n){for(var i=e.length,r=n?i:-1;(n?r--:++r<i)&&t(e[r],r,e););return a?ai(e,n?0:r,n?r+1:i):ai(e,n?r+1:0,n?i:r)}function hi(e,t){var a=e;return a instanceof ja&&(a=a.value()),Dt(t,(function(e,t){return t.func.apply(t.thisArg,Ft([e],t.args))}),a)}function fi(e,t,a){var n=e.length;if(n<2)return n?ui(e[0]):[];for(var i=-1,r=ie(n);++i<n;)for(var s=e[i],o=-1;++o<n;)o!=i&&(r[i]=cn(r[i]||s,e[o],t,a));return ui(yn(r,1),t,a)}function mi(e,t,n){for(var i=-1,r=e.length,s=t.length,o={};++i<r;){var l=i<s?t[i]:a;n(o,e[i],l);}return o}function yi(e){return Ys(e)?e:[]}function gi(e){return "function"==typeof e?e:al}function bi(e,t){return js(e)?e:vr(e,t)?[e]:Dr(go(e))}var vi=Zn;function wi(e,t,n){var i=e.length;return n=n===a?i:n,!t&&n>=i?e:ai(e,t,n)}var _i=ot||function(e){return pt.clearTimeout(e)};function Ai(e,t){if(t)return e.slice();var a=e.length,n=We?We(a):new e.constructor(a);return e.copy(n),n}function ki(e){var t=new e.constructor(e.byteLength);return new ze(t).set(new ze(e)),t}function Si(e,t){var a=t?ki(e.buffer):e.buffer;return new e.constructor(a,e.byteOffset,e.length)}function Ni(e,t){if(e!==t){var n=e!==a,i=null===e,r=e==e,s=so(e),o=t!==a,l=null===t,u=t==t,c=so(t);if(!l&&!c&&!s&&e>t||s&&o&&u&&!l&&!c||i&&o&&u||!n&&u||!r)return 1;if(!i&&!s&&!c&&e<t||c&&n&&r&&!i&&!s||l&&n&&r||!o&&r||!u)return -1}return 0}function Ti(e,t,a,n){for(var i=-1,r=e.length,s=a.length,o=-1,l=t.length,u=ya(r-s,0),c=ie(l+u),d=!n;++o<l;)c[o]=t[o];for(;++i<s;)(d||i<r)&&(c[a[i]]=e[i]);for(;u--;)c[o++]=e[i++];return c}function Mi(e,t,a,n){for(var i=-1,r=e.length,s=-1,o=a.length,l=-1,u=t.length,c=ya(r-o,0),d=ie(c+u),p=!n;++i<c;)d[i]=e[i];for(var h=i;++l<u;)d[h+l]=t[l];for(;++s<o;)(p||i<r)&&(d[h+a[s]]=e[i++]);return d}function xi(e,t){var a=-1,n=e.length;for(t||(t=ie(n));++a<n;)t[a]=e[a];return t}function Ci(e,t,n,i){var r=!n;n||(n={});for(var s=-1,o=t.length;++s<o;){var l=t[s],u=i?i(n[l],e[l],l,n,e):a;u===a&&(u=e[l]),r?nn(n,l,u):Qa(n,l,u);}return n}function Vi(e,t){return function(a,n){var i=js(a)?Nt:tn,r=t?t():{};return i(a,e,or(n,2),r)}}function Ii(e){return Zn((function(t,n){var i=-1,r=n.length,s=r>1?n[r-1]:a,o=r>2?n[2]:a;for(s=e.length>3&&"function"==typeof s?(r--,s):a,o&&br(n[0],n[1],o)&&(s=r<3?a:s,r=1),t=Ne(t);++i<r;){var l=n[i];l&&e(t,l,i,s);}return t}))}function Ei(e,t){return function(a,n){if(null==a)return a;if(!Ws(a))return e(a,n);for(var i=a.length,r=t?i:-1,s=Ne(a);(t?r--:++r<i)&&false!==n(s[r],r,s););return a}}function Fi(e){return function(t,a,n){for(var i=-1,r=Ne(t),s=n(t),o=s.length;o--;){var l=s[e?o:++i];if(false===a(r[l],l,r))break}return t}}function Di(e){return function(t){var n=ia(t=go(t))?da(t):a,i=n?n[0]:t.charAt(0),r=n?wi(n,1).join(""):t.slice(1);return i[e]()+r}}function Ri(e){return function(t){return Dt(Jo(jo(t).replace(Ke,"")),e,"")}}function Li(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var a=Oa(e.prototype),n=e.apply(a,t);return Xs(n)?n:a}}function Pi(e){return function(t,n,i){var r=Ne(t);if(!Ws(t)){var s=or(n,3);t=Vo(t),n=function(e){return s(r[e],e,r)};}var o=e(t,n,i);return o>-1?r[s?t[o]:o]:a}}function Bi(e){return tr((function(t){var i=t.length,r=i,s=Ua.prototype.thru;for(e&&t.reverse();r--;){var o=t[r];if("function"!=typeof o)throw new xe(n);if(s&&!l&&"wrapper"==rr(o))var l=new Ua([],true);}for(r=l?r:i;++r<i;){var u=rr(o=t[r]),c="wrapper"==u?ir(o):a;l=c&&wr(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?l[rr(c[0])].apply(l,c[3]):1==o.length&&wr(o)?l[u]():l.thru(o);}return function(){var e=arguments,a=e[0];if(l&&1==e.length&&js(a))return l.plant(a).value();for(var n=0,r=i?t[n].apply(this,e):a;++n<i;)r=t[n].call(this,r);return r}}))}function Oi(e,t,n,i,r,s,l,u,c,d){var p=t&o,h=1&t,f=2&t,m=24&t,y=512&t,g=f?a:Li(e);return function o(){for(var b=arguments.length,v=ie(b),w=b;w--;)v[w]=arguments[w];if(m)var _=sr(o),A=function(e,t){for(var a=e.length,n=0;a--;)e[a]===t&&++n;return n}(v,_);if(i&&(v=Ti(v,i,r,m)),s&&(v=Mi(v,s,l,m)),b-=A,m&&b<d){var k=oa(v,_);return Hi(e,t,Oi,o.placeholder,n,v,k,u,c,d-b)}var S=h?n:this,N=f?S[e]:e;return b=v.length,u?v=function(e,t){for(var n=e.length,i=ga(t.length,n),r=xi(e);i--;){var s=t[i];e[i]=gr(s,n)?r[s]:a;}return e}(v,u):y&&b>1&&v.reverse(),p&&c<b&&(v.length=c),this&&this!==pt&&this instanceof o&&(N=g||Li(N)),N.apply(S,v)}}function $i(e,t){return function(a,n){return function(e,t,a,n){return vn(e,(function(e,i,r){t(n,a(e),i,r);})),n}(a,e,t(n),{})}}function Ui(e,t){return function(n,i){var r;if(n===a&&i===a)return t;if(n!==a&&(r=n),i!==a){if(r===a)return i;"string"==typeof n||"string"==typeof i?(n=li(n),i=li(i)):(n=oi(n),i=oi(i)),r=e(n,i);}return r}}function ji(e){return tr((function(t){return t=Et(t,Jt(or())),Zn((function(a){var n=this;return e(t,(function(e){return St(e,n,a)}))}))}))}function zi(e,t){var n=(t=t===a?" ":li(t)).length;if(n<2)return n?qn(t,e):t;var i=qn(t,ht(e/ca(t)));return ia(t)?wi(da(i),0,e).join(""):i.slice(0,e)}function Wi(e){return function(t,n,i){return i&&"number"!=typeof i&&br(t,n,i)&&(n=i=a),t=po(t),n===a?(n=t,t=0):n=po(n),function(e,t,a,n){for(var i=-1,r=ya(ht((t-e)/(a||1)),0),s=ie(r);r--;)s[n?r:++i]=e,e+=a;return s}(t,n,i=i===a?t<n?1:-1:po(i),e)}}function Yi(e){return function(t,a){return "string"==typeof t&&"string"==typeof a||(t=mo(t),a=mo(a)),e(t,a)}}function Hi(e,t,n,i,r,o,l,u,c,d){var p=8&t;t|=p?s:64,4&(t&=~(p?64:s))||(t&=-4);var h=[e,t,r,p?o:a,p?l:a,p?a:o,p?a:l,u,c,d],f=n.apply(a,h);return wr(e)&&xr(f,h),f.placeholder=i,Ir(f,e,t)}function Gi(e){var t=Se[e];return function(e,a){if(e=mo(e),(a=null==a?0:ga(ho(a),292))&&Pt(e)){var n=(go(e)+"e").split("e");return +((n=(go(t(n[0]+"e"+(+n[1]+a)))+"e").split("e"))[0]+"e"+(+n[1]-a))}return t(e)}}var qi=Na&&1/la(new Na([,-0]))[1]==u?function(e){return new Na(e)}:ol;function Zi(e){return function(t){var a=hr(t);return a==_?ra(t):a==T?ua(t):function(e,t){return Et(t,(function(t){return [t,e[t]]}))}(t,e(t))}}function Ji(e,t,i,u,c,d,p,h){var f=2&t;if(!f&&"function"!=typeof e)throw new xe(n);var m=u?u.length:0;if(m||(t&=-97,u=c=a),p=p===a?p:ya(ho(p),0),h=h===a?h:ho(h),m-=c?c.length:0,64&t){var y=u,g=c;u=c=a;}var b=f?a:ir(e),v=[e,t,i,u,c,y,g,d,p,h];if(b&&function(e,t){var a=e[1],n=t[1],i=a|n,s=i<131,u=n==o&&8==a||n==o&&a==l&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==a;if(!s&&!u)return e;1&n&&(e[2]=t[2],i|=1&a?0:4);var c=t[3];if(c){var d=e[3];e[3]=d?Ti(d,c,t[4]):c,e[4]=d?oa(e[3],r):t[4];}(c=t[5])&&(d=e[5],e[5]=d?Mi(d,c,t[6]):c,e[6]=d?oa(e[5],r):t[6]),(c=t[7])&&(e[7]=c),n&o&&(e[8]=null==e[8]?t[8]:ga(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i;}(v,b),e=v[0],t=v[1],i=v[2],u=v[3],c=v[4],!(h=v[9]=v[9]===a?f?0:e.length:ya(v[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)w=8==t||16==t?function(e,t,n){var i=Li(e);return function r(){for(var s=arguments.length,o=ie(s),l=s,u=sr(r);l--;)o[l]=arguments[l];var c=s<3&&o[0]!==u&&o[s-1]!==u?[]:oa(o,u);return (s-=c.length)<n?Hi(e,t,Oi,r.placeholder,a,o,c,a,a,n-s):St(this&&this!==pt&&this instanceof r?i:e,this,o)}}(e,t,h):t!=s&&33!=t||c.length?Oi.apply(a,v):function(e,t,a,n){var i=1&t,r=Li(e);return function t(){for(var s=-1,o=arguments.length,l=-1,u=n.length,c=ie(u+o),d=this&&this!==pt&&this instanceof t?r:e;++l<u;)c[l]=n[l];for(;o--;)c[l++]=arguments[++s];return St(d,i?a:this,c)}}(e,t,i,u);else var w=function(e,t,a){var n=1&t,i=Li(e);return function t(){return (this&&this!==pt&&this instanceof t?i:e).apply(n?a:this,arguments)}}(e,t,i);return Ir((b?Qn:xr)(w,v),e,t)}function Ki(e,t,n,i){return e===a||Bs(e,Ie[n])&&!De.call(i,n)?t:e}function Xi(e,t,n,i,r,s){return Xs(e)&&Xs(t)&&(s.set(t,e),Un(e,t,a,Xi,s),s.delete(t)),e}function Qi(e){return ao(e)?a:e}function er(e,t,n,i,r,s){var o=1&n,l=e.length,u=t.length;if(l!=u&&!(o&&u>l))return false;var c=s.get(e),d=s.get(t);if(c&&d)return c==t&&d==e;var p=-1,h=true,f=2&n?new Ha:a;for(s.set(e,t),s.set(t,e);++p<l;){var m=e[p],y=t[p];if(i)var g=o?i(y,m,p,t,e,s):i(m,y,p,e,t,s);if(g!==a){if(g)continue;h=false;break}if(f){if(!Lt(t,(function(e,t){if(!Xt(f,t)&&(m===e||r(m,e,n,i,s)))return f.push(t)}))){h=false;break}}else if(m!==y&&!r(m,y,n,i,s)){h=false;break}}return s.delete(e),s.delete(t),h}function tr(e){return Vr(Nr(e,a,zr),e+"")}function ar(e){return kn(e,Vo,dr)}function nr(e){return kn(e,Io,pr)}var ir=xa?function(e){return xa.get(e)}:ol;function rr(e){for(var t=e.name+"",a=Ca[t],n=De.call(Ca,t)?a.length:0;n--;){var i=a[n],r=i.func;if(null==r||r==e)return i.name}return t}function sr(e){return (De.call(Ba,"placeholder")?Ba:e).placeholder}function or(){var e=Ba.iteratee||nl;return e=e===nl?Dn:e,arguments.length?e(arguments[0],arguments[1]):e}function lr(e,t){var a,n,i=e.__data__;return ("string"==(n=typeof(a=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==a:null===a)?i["string"==typeof t?"string":"hash"]:i.map}function ur(e){for(var t=Vo(e),a=t.length;a--;){var n=t[a],i=e[n];t[a]=[n,i,kr(i)];}return t}function cr(e,t){var n=function(e,t){return null==e?a:e[t]}(e,t);return Fn(n)?n:a}var dr=yt?function(e){return null==e?[]:(e=Ne(e),Ct(yt(e),(function(t){return Ge.call(e,t)})))}:fl,pr=yt?function(e){for(var t=[];e;)Ft(t,dr(e)),e=Ye(e);return t}:fl,hr=Sn;function fr(e,t,a){for(var n=-1,i=(t=bi(t,e)).length,r=false;++n<i;){var s=Rr(t[n]);if(!(r=null!=e&&a(e,s)))break;e=e[s];}return r||++n!=i?r:!!(i=null==e?0:e.length)&&Ks(i)&&gr(s,i)&&(js(e)||Us(e))}function mr(e){return "function"!=typeof e.constructor||Ar(e)?{}:Oa(Ye(e))}function yr(e){return js(e)||Us(e)||!!(Ze&&e&&e[Ze])}function gr(e,t){var a=typeof e;return !!(t=null==t?c:t)&&("number"==a||"symbol"!=a&&ge.test(e))&&e>-1&&e%1==0&&e<t}function br(e,t,a){if(!Xs(a))return false;var n=typeof t;return !!("number"==n?Ws(a)&&gr(t,a.length):"string"==n&&t in a)&&Bs(a[t],e)}function vr(e,t){if(js(e))return false;var a=typeof e;return !("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=e&&!so(e))||Q.test(e)||!X.test(e)||null!=t&&e in Ne(t)}function wr(e){var t=rr(e),a=Ba[t];if("function"!=typeof a||!(t in ja.prototype))return false;if(e===a)return true;var n=ir(a);return !!n&&e===n[0]}(Aa&&hr(new Aa(new ArrayBuffer(1)))!=I||ka&&hr(new ka)!=_||Sa&&hr(Sa.resolve())!=S||Na&&hr(new Na)!=T||Ta&&hr(new Ta)!=C)&&(hr=function(e){var t=Sn(e),n=t==k?e.constructor:a,i=n?Lr(n):"";if(i)switch(i){case Va:return I;case Ia:return _;case Ea:return S;case Fa:return T;case Da:return C}return t});var _r=Ee?Zs:ml;function Ar(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ie)}function kr(e){return e==e&&!Xs(e)}function Sr(e,t){return function(n){return null!=n&&n[e]===t&&(t!==a||e in Ne(n))}}function Nr(e,t,n){return t=ya(t===a?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=ya(a.length-t,0),s=ie(r);++i<r;)s[i]=a[t+i];i=-1;for(var o=ie(t+1);++i<t;)o[i]=a[i];return o[t]=n(s),St(e,this,o)}}function Tr(e,t){return t.length<2?e:An(e,ai(t,0,-1))}function Mr(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var xr=Er(Qn),Cr=dt||function(e,t){return pt.setTimeout(e,t)},Vr=Er(ei);function Ir(e,t,a){var n=t+"";return Vr(e,function(e,t){var a=t.length;if(!a)return e;var n=a-1;return t[n]=(a>1?"& ":"")+t[n],t=t.join(a>2?", ":" "),e.replace(re,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return Tt(h,(function(a){var n="_."+a[0];t&a[1]&&!Vt(e,n)&&e.push(n);})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(oe):[]}(n),a)))}function Er(e){var t=0,n=0;return function(){var i=ba(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(a,arguments)}}function Fr(e,t){var n=-1,i=e.length,r=i-1;for(t=t===a?i:t;++n<t;){var s=Gn(n,r),o=e[s];e[s]=e[n],e[n]=o;}return e.length=t,e}var Dr=function(e){var t=Es(e,(function(e){return 500===a.size&&a.clear(),e})),a=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,a,n,i){t.push(n?i.replace(ce,"$1"):a||e);})),t}));function Rr(e){if("string"==typeof e||so(e))return e;var t=e+"";return "0"==t&&1/e==-1/0?"-0":t}function Lr(e){if(null!=e){try{return Fe.call(e)}catch(e){}try{return e+""}catch(e){}}return ""}function Pr(e){if(e instanceof ja)return e.clone();var t=new Ua(e.__wrapped__,e.__chain__);return t.__actions__=xi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Br=Zn((function(e,t){return Ys(e)?cn(e,yn(t,1,Ys,true)):[]})),Or=Zn((function(e,t){var n=qr(t);return Ys(n)&&(n=a),Ys(e)?cn(e,yn(t,1,Ys,true),or(n,2)):[]})),$r=Zn((function(e,t){var n=qr(t);return Ys(n)&&(n=a),Ys(e)?cn(e,yn(t,1,Ys,true),a,n):[]}));function Ur(e,t,a){var n=null==e?0:e.length;if(!n)return -1;var i=null==a?0:ho(a);return i<0&&(i=ya(n+i,0)),Ot(e,or(t,3),i)}function jr(e,t,n){var i=null==e?0:e.length;if(!i)return -1;var r=i-1;return n!==a&&(r=ho(n),r=n<0?ya(i+r,0):ga(r,i-1)),Ot(e,or(t,3),r,true)}function zr(e){return null!=e&&e.length?yn(e,1):[]}function Wr(e){return e&&e.length?e[0]:a}var Yr=Zn((function(e){var t=Et(e,yi);return t.length&&t[0]===e[0]?xn(t):[]})),Hr=Zn((function(e){var t=qr(e),n=Et(e,yi);return t===qr(n)?t=a:n.pop(),n.length&&n[0]===e[0]?xn(n,or(t,2)):[]})),Gr=Zn((function(e){var t=qr(e),n=Et(e,yi);return (t="function"==typeof t?t:a)&&n.pop(),n.length&&n[0]===e[0]?xn(n,a,t):[]}));function qr(e){var t=null==e?0:e.length;return t?e[t-1]:a}var Zr=Zn(Jr);function Jr(e,t){return e&&e.length&&t&&t.length?Yn(e,t):e}var Kr=tr((function(e,t){var a=null==e?0:e.length,n=rn(e,t);return Hn(e,Et(t,(function(e){return gr(e,a)?+e:e})).sort(Ni)),n}));function Xr(e){return null==e?e:_a.call(e)}var Qr=Zn((function(e){return ui(yn(e,1,Ys,true))})),es=Zn((function(e){var t=qr(e);return Ys(t)&&(t=a),ui(yn(e,1,Ys,true),or(t,2))})),ts=Zn((function(e){var t=qr(e);return t="function"==typeof t?t:a,ui(yn(e,1,Ys,true),a,t)}));function as(e){if(!e||!e.length)return [];var t=0;return e=Ct(e,(function(e){if(Ys(e))return t=ya(e.length,t),true})),qt(t,(function(t){return Et(e,Wt(t))}))}function ns(e,t){if(!e||!e.length)return [];var n=as(e);return null==t?n:Et(n,(function(e){return St(t,a,e)}))}var is=Zn((function(e,t){return Ys(e)?cn(e,t):[]})),rs=Zn((function(e){return fi(Ct(e,Ys))})),ss=Zn((function(e){var t=qr(e);return Ys(t)&&(t=a),fi(Ct(e,Ys),or(t,2))})),os=Zn((function(e){var t=qr(e);return t="function"==typeof t?t:a,fi(Ct(e,Ys),a,t)})),ls=Zn(as),us=Zn((function(e){var t=e.length,n=t>1?e[t-1]:a;return n="function"==typeof n?(e.pop(),n):a,ns(e,n)}));function cs(e){var t=Ba(e);return t.__chain__=true,t}function ds(e,t){return t(e)}var ps=tr((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,r=function(t){return rn(t,e)};return !(t>1||this.__actions__.length)&&i instanceof ja&&gr(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:ds,args:[r],thisArg:a}),new Ua(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(a),e}))):this.thru(r)})),hs=Vi((function(e,t,a){De.call(e,a)?++e[a]:nn(e,a,1);})),fs=Pi(Ur),ms=Pi(jr);function ys(e,t){return (js(e)?Tt:dn)(e,or(t,3))}function gs(e,t){return (js(e)?Mt:pn)(e,or(t,3))}var bs=Vi((function(e,t,a){De.call(e,a)?e[a].push(t):nn(e,a,[t]);})),vs=Zn((function(e,t,a){var n=-1,i="function"==typeof t,r=Ws(e)?ie(e.length):[];return dn(e,(function(e){r[++n]=i?St(t,e,a):Cn(e,t,a);})),r})),ws=Vi((function(e,t,a){nn(e,a,t);}));function _s(e,t){return (js(e)?Et:Bn)(e,or(t,3))}var As=Vi((function(e,t,a){e[a?0:1].push(t);}),(function(){return [[],[]]})),ks=Zn((function(e,t){if(null==e)return [];var a=t.length;return a>1&&br(e,t[0],t[1])?t=[]:a>2&&br(t[0],t[1],t[2])&&(t=[t[0]]),zn(e,yn(t,1),[])})),Ss=ct||function(){return pt.Date.now()};function Ns(e,t,n){return t=n?a:t,t=e&&null==t?e.length:t,Ji(e,o,a,a,a,a,t)}function Ts(e,t){var i;if("function"!=typeof t)throw new xe(n);return e=ho(e),function(){return --e>0&&(i=t.apply(this,arguments)),e<=1&&(t=a),i}}var Ms=Zn((function(e,t,a){var n=1;if(a.length){var i=oa(a,sr(Ms));n|=s;}return Ji(e,n,t,a,i)})),xs=Zn((function(e,t,a){var n=3;if(a.length){var i=oa(a,sr(xs));n|=s;}return Ji(t,n,e,a,i)}));function Cs(e,t,i){var r,s,o,l,u,c,d=0,p=false,h=false,f=true;if("function"!=typeof e)throw new xe(n);function m(t){var n=r,i=s;return r=s=a,d=t,l=e.apply(i,n)}function y(e){var n=e-c;return c===a||n>=t||n<0||h&&e-d>=o}function g(){var e=Ss();if(y(e))return b(e);u=Cr(g,function(e){var a=t-(e-c);return h?ga(a,o-(e-d)):a}(e));}function b(e){return u=a,f&&r?m(e):(r=s=a,l)}function v(){var e=Ss(),n=y(e);if(r=arguments,s=this,c=e,n){if(u===a)return function(e){return d=e,u=Cr(g,t),p?m(e):l}(c);if(h)return _i(u),u=Cr(g,t),m(c)}return u===a&&(u=Cr(g,t)),l}return t=mo(t)||0,Xs(i)&&(p=!!i.leading,o=(h="maxWait"in i)?ya(mo(i.maxWait)||0,t):o,f="trailing"in i?!!i.trailing:f),v.cancel=function(){u!==a&&_i(u),d=0,r=c=s=u=a;},v.flush=function(){return u===a?l:b(Ss())},v}var Vs=Zn((function(e,t){return un(e,1,t)})),Is=Zn((function(e,t,a){return un(e,mo(t)||0,a)}));function Es(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(n);var a=function(){var n=arguments,i=t?t.apply(this,n):n[0],r=a.cache;if(r.has(i))return r.get(i);var s=e.apply(this,n);return a.cache=r.set(i,s)||r,s};return a.cache=new(Es.Cache||Ya),a}function Fs(e){if("function"!=typeof e)throw new xe(n);return function(){var t=arguments;switch(t.length){case 0:return !e.call(this);case 1:return !e.call(this,t[0]);case 2:return !e.call(this,t[0],t[1]);case 3:return !e.call(this,t[0],t[1],t[2])}return !e.apply(this,t)}}Es.Cache=Ya;var Ds=vi((function(e,t){var a=(t=1==t.length&&js(t[0])?Et(t[0],Jt(or())):Et(yn(t,1),Jt(or()))).length;return Zn((function(n){for(var i=-1,r=ga(n.length,a);++i<r;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),Rs=Zn((function(e,t){var n=oa(t,sr(Rs));return Ji(e,s,a,t,n)})),Ls=Zn((function(e,t){var n=oa(t,sr(Ls));return Ji(e,64,a,t,n)})),Ps=tr((function(e,t){return Ji(e,l,a,a,a,t)}));function Bs(e,t){return e===t||e!=e&&t!=t}var Os=Yi(Nn),$s=Yi((function(e,t){return e>=t})),Us=Vn(function(){return arguments}())?Vn:function(e){return Qs(e)&&De.call(e,"callee")&&!Ge.call(e,"callee")},js=ie.isArray,zs=bt?Jt(bt):function(e){return Qs(e)&&Sn(e)==V};function Ws(e){return null!=e&&Ks(e.length)&&!Zs(e)}function Ys(e){return Qs(e)&&Ws(e)}var Hs=gt||ml,Gs=vt?Jt(vt):function(e){return Qs(e)&&Sn(e)==g};function qs(e){if(!Qs(e))return false;var t=Sn(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ao(e)}function Zs(e){if(!Xs(e))return false;var t=Sn(e);return t==v||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Js(e){return "number"==typeof e&&e==ho(e)}function Ks(e){return "number"==typeof e&&e>-1&&e%1==0&&e<=c}function Xs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Qs(e){return null!=e&&"object"==typeof e}var eo=wt?Jt(wt):function(e){return Qs(e)&&hr(e)==_};function to(e){return "number"==typeof e||Qs(e)&&Sn(e)==A}function ao(e){if(!Qs(e)||Sn(e)!=k)return false;var t=Ye(e);if(null===t)return true;var a=De.call(t,"constructor")&&t.constructor;return "function"==typeof a&&a instanceof a&&Fe.call(a)==Be}var no=_t?Jt(_t):function(e){return Qs(e)&&Sn(e)==N},io=At?Jt(At):function(e){return Qs(e)&&hr(e)==T};function ro(e){return "string"==typeof e||!js(e)&&Qs(e)&&Sn(e)==M}function so(e){return "symbol"==typeof e||Qs(e)&&Sn(e)==x}var oo=kt?Jt(kt):function(e){return Qs(e)&&Ks(e.length)&&!!rt[Sn(e)]},lo=Yi(Pn),uo=Yi((function(e,t){return e<=t}));function co(e){if(!e)return [];if(Ws(e))return ro(e)?da(e):xi(e);if(Je&&e[Je])return function(e){for(var t,a=[];!(t=e.next()).done;)a.push(t.value);return a}(e[Je]());var t=hr(e);return (t==_?ra:t==T?la:Oo)(e)}function po(e){return e?(e=mo(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ho(e){var t=po(e),a=t%1;return t==t?a?t-a:t:0}function fo(e){return e?sn(ho(e),0,p):0}function mo(e){if("number"==typeof e)return e;if(so(e))return d;if(Xs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xs(t)?t+"":t;}if("string"!=typeof e)return 0===e?e:+e;e=Zt(e);var a=fe.test(e);return a||ye.test(e)?ut(e.slice(2),a?2:8):he.test(e)?d:+e}function yo(e){return Ci(e,Io(e))}function go(e){return null==e?"":li(e)}var bo=Ii((function(e,t){if(Ar(t)||Ws(t))Ci(t,Vo(t),e);else for(var a in t)De.call(t,a)&&Qa(e,a,t[a]);})),vo=Ii((function(e,t){Ci(t,Io(t),e);})),wo=Ii((function(e,t,a,n){Ci(t,Io(t),e,n);})),_o=Ii((function(e,t,a,n){Ci(t,Vo(t),e,n);})),Ao=tr(rn),ko=Zn((function(e,t){e=Ne(e);var n=-1,i=t.length,r=i>2?t[2]:a;for(r&&br(t[0],t[1],r)&&(i=1);++n<i;)for(var s=t[n],o=Io(s),l=-1,u=o.length;++l<u;){var c=o[l],d=e[c];(d===a||Bs(d,Ie[c])&&!De.call(e,c))&&(e[c]=s[c]);}return e})),So=Zn((function(e){return e.push(a,Xi),St(Fo,a,e)}));function No(e,t,n){var i=null==e?a:An(e,t);return i===a?n:i}function To(e,t){return null!=e&&fr(e,t,Mn)}var Mo=$i((function(e,t,a){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),e[t]=a;}),Qo(al)),xo=$i((function(e,t,a){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),De.call(e,t)?e[t].push(a):e[t]=[a];}),or),Co=Zn(Cn);function Vo(e){return Ws(e)?qa(e):Rn(e)}function Io(e){return Ws(e)?qa(e,true):Ln(e)}var Eo=Ii((function(e,t,a){Un(e,t,a);})),Fo=Ii((function(e,t,a,n){Un(e,t,a,n);})),Do=tr((function(e,t){var a={};if(null==e)return a;var n=false;t=Et(t,(function(t){return t=bi(t,e),n||(n=t.length>1),t})),Ci(e,nr(e),a),n&&(a=on(a,7,Qi));for(var i=t.length;i--;)ci(a,t[i]);return a})),Ro=tr((function(e,t){return null==e?{}:function(e,t){return Wn(e,t,(function(t,a){return To(e,a)}))}(e,t)}));function Lo(e,t){if(null==e)return {};var a=Et(nr(e),(function(e){return [e]}));return t=or(t),Wn(e,a,(function(e,a){return t(e,a[0])}))}var Po=Zi(Vo),Bo=Zi(Io);function Oo(e){return null==e?[]:Kt(e,Vo(e))}var $o=Ri((function(e,t,a){return t=t.toLowerCase(),e+(a?Uo(t):t)}));function Uo(e){return Zo(go(e).toLowerCase())}function jo(e){return (e=go(e))&&e.replace(be,ta).replace(Xe,"")}var zo=Ri((function(e,t,a){return e+(a?"-":"")+t.toLowerCase()})),Wo=Ri((function(e,t,a){return e+(a?" ":"")+t.toLowerCase()})),Yo=Di("toLowerCase"),Ho=Ri((function(e,t,a){return e+(a?"_":"")+t.toLowerCase()})),Go=Ri((function(e,t,a){return e+(a?" ":"")+Zo(t)})),qo=Ri((function(e,t,a){return e+(a?" ":"")+t.toUpperCase()})),Zo=Di("toUpperCase");function Jo(e,t,n){return e=go(e),(t=n?a:t)===a?function(e){return at.test(e)}(e)?function(e){return e.match(et)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Ko=Zn((function(e,t){try{return St(e,a,t)}catch(e){return qs(e)?e:new Ae(e)}})),Xo=tr((function(e,t){return Tt(t,(function(t){t=Rr(t),nn(e,t,Ms(e[t],e));})),e}));function Qo(e){return function(){return e}}var el=Bi(),tl=Bi(true);function al(e){return e}function nl(e){return Dn("function"==typeof e?e:on(e,1))}var il=Zn((function(e,t){return function(a){return Cn(a,e,t)}})),rl=Zn((function(e,t){return function(a){return Cn(e,a,t)}}));function sl(e,t,a){var n=Vo(t),i=_n(t,n);null!=a||Xs(t)&&(i.length||!n.length)||(a=t,t=e,e=this,i=_n(t,Vo(t)));var r=!(Xs(a)&&"chain"in a&&!a.chain),s=Zs(e);return Tt(i,(function(a){var n=t[a];e[a]=n,s&&(e.prototype[a]=function(){var t=this.__chain__;if(r||t){var a=e(this.__wrapped__);return (a.__actions__=xi(this.__actions__)).push({func:n,args:arguments,thisArg:e}),a.__chain__=t,a}return n.apply(e,Ft([this.value()],arguments))});})),e}function ol(){}var ll=ji(Et),ul=ji(xt),cl=ji(Lt);function dl(e){return vr(e)?Wt(Rr(e)):function(e){return function(t){return An(t,e)}}(e)}var pl=Wi(),hl=Wi(true);function fl(){return []}function ml(){return false}var yl,gl=Ui((function(e,t){return e+t}),0),bl=Gi("ceil"),vl=Ui((function(e,t){return e/t}),1),wl=Gi("floor"),_l=Ui((function(e,t){return e*t}),1),Al=Gi("round"),kl=Ui((function(e,t){return e-t}),0);return Ba.after=function(e,t){if("function"!=typeof t)throw new xe(n);return e=ho(e),function(){if(--e<1)return t.apply(this,arguments)}},Ba.ary=Ns,Ba.assign=bo,Ba.assignIn=vo,Ba.assignInWith=wo,Ba.assignWith=_o,Ba.at=Ao,Ba.before=Ts,Ba.bind=Ms,Ba.bindAll=Xo,Ba.bindKey=xs,Ba.castArray=function(){if(!arguments.length)return [];var e=arguments[0];return js(e)?e:[e]},Ba.chain=cs,Ba.chunk=function(e,t,n){t=(n?br(e,t,n):t===a)?1:ya(ho(t),0);var i=null==e?0:e.length;if(!i||t<1)return [];for(var r=0,s=0,o=ie(ht(i/t));r<i;)o[s++]=ai(e,r,r+=t);return o},Ba.compact=function(e){for(var t=-1,a=null==e?0:e.length,n=0,i=[];++t<a;){var r=e[t];r&&(i[n++]=r);}return i},Ba.concat=function(){var e=arguments.length;if(!e)return [];for(var t=ie(e-1),a=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Ft(js(a)?xi(a):[a],yn(t,1))},Ba.cond=function(e){var t=null==e?0:e.length,a=or();return e=t?Et(e,(function(e){if("function"!=typeof e[1])throw new xe(n);return [a(e[0]),e[1]]})):[],Zn((function(a){for(var n=-1;++n<t;){var i=e[n];if(St(i[0],this,a))return St(i[1],this,a)}}))},Ba.conforms=function(e){return function(e){var t=Vo(e);return function(a){return ln(a,e,t)}}(on(e,1))},Ba.constant=Qo,Ba.countBy=hs,Ba.create=function(e,t){var a=Oa(e);return null==t?a:an(a,t)},Ba.curry=function e(t,n,i){var r=Ji(t,8,a,a,a,a,a,n=i?a:n);return r.placeholder=e.placeholder,r},Ba.curryRight=function e(t,n,i){var r=Ji(t,16,a,a,a,a,a,n=i?a:n);return r.placeholder=e.placeholder,r},Ba.debounce=Cs,Ba.defaults=ko,Ba.defaultsDeep=So,Ba.defer=Vs,Ba.delay=Is,Ba.difference=Br,Ba.differenceBy=Or,Ba.differenceWith=$r,Ba.drop=function(e,t,n){var i=null==e?0:e.length;return i?ai(e,(t=n||t===a?1:ho(t))<0?0:t,i):[]},Ba.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ai(e,0,(t=i-(t=n||t===a?1:ho(t)))<0?0:t):[]},Ba.dropRightWhile=function(e,t){return e&&e.length?pi(e,or(t,3),true,true):[]},Ba.dropWhile=function(e,t){return e&&e.length?pi(e,or(t,3),true):[]},Ba.fill=function(e,t,n,i){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&br(e,t,n)&&(n=0,i=r),function(e,t,n,i){var r=e.length;for((n=ho(n))<0&&(n=-n>r?0:r+n),(i=i===a||i>r?r:ho(i))<0&&(i+=r),i=n>i?0:fo(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},Ba.filter=function(e,t){return (js(e)?Ct:mn)(e,or(t,3))},Ba.flatMap=function(e,t){return yn(_s(e,t),1)},Ba.flatMapDeep=function(e,t){return yn(_s(e,t),u)},Ba.flatMapDepth=function(e,t,n){return n=n===a?1:ho(n),yn(_s(e,t),n)},Ba.flatten=zr,Ba.flattenDeep=function(e){return null!=e&&e.length?yn(e,u):[]},Ba.flattenDepth=function(e,t){return null!=e&&e.length?yn(e,t=t===a?1:ho(t)):[]},Ba.flip=function(e){return Ji(e,512)},Ba.flow=el,Ba.flowRight=tl,Ba.fromPairs=function(e){for(var t=-1,a=null==e?0:e.length,n={};++t<a;){var i=e[t];n[i[0]]=i[1];}return n},Ba.functions=function(e){return null==e?[]:_n(e,Vo(e))},Ba.functionsIn=function(e){return null==e?[]:_n(e,Io(e))},Ba.groupBy=bs,Ba.initial=function(e){return null!=e&&e.length?ai(e,0,-1):[]},Ba.intersection=Yr,Ba.intersectionBy=Hr,Ba.intersectionWith=Gr,Ba.invert=Mo,Ba.invertBy=xo,Ba.invokeMap=vs,Ba.iteratee=nl,Ba.keyBy=ws,Ba.keys=Vo,Ba.keysIn=Io,Ba.map=_s,Ba.mapKeys=function(e,t){var a={};return t=or(t,3),vn(e,(function(e,n,i){nn(a,t(e,n,i),e);})),a},Ba.mapValues=function(e,t){var a={};return t=or(t,3),vn(e,(function(e,n,i){nn(a,n,t(e,n,i));})),a},Ba.matches=function(e){return On(on(e,1))},Ba.matchesProperty=function(e,t){return $n(e,on(t,1))},Ba.memoize=Es,Ba.merge=Eo,Ba.mergeWith=Fo,Ba.method=il,Ba.methodOf=rl,Ba.mixin=sl,Ba.negate=Fs,Ba.nthArg=function(e){return e=ho(e),Zn((function(t){return jn(t,e)}))},Ba.omit=Do,Ba.omitBy=function(e,t){return Lo(e,Fs(or(t)))},Ba.once=function(e){return Ts(2,e)},Ba.orderBy=function(e,t,n,i){return null==e?[]:(js(t)||(t=null==t?[]:[t]),js(n=i?a:n)||(n=null==n?[]:[n]),zn(e,t,n))},Ba.over=ll,Ba.overArgs=Ds,Ba.overEvery=ul,Ba.overSome=cl,Ba.partial=Rs,Ba.partialRight=Ls,Ba.partition=As,Ba.pick=Ro,Ba.pickBy=Lo,Ba.property=dl,Ba.propertyOf=function(e){return function(t){return null==e?a:An(e,t)}},Ba.pull=Zr,Ba.pullAll=Jr,Ba.pullAllBy=function(e,t,a){return e&&e.length&&t&&t.length?Yn(e,t,or(a,2)):e},Ba.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Yn(e,t,a,n):e},Ba.pullAt=Kr,Ba.range=pl,Ba.rangeRight=hl,Ba.rearg=Ps,Ba.reject=function(e,t){return (js(e)?Ct:mn)(e,Fs(or(t,3)))},Ba.remove=function(e,t){var a=[];if(!e||!e.length)return a;var n=-1,i=[],r=e.length;for(t=or(t,3);++n<r;){var s=e[n];t(s,n,e)&&(a.push(s),i.push(n));}return Hn(e,i),a},Ba.rest=function(e,t){if("function"!=typeof e)throw new xe(n);return Zn(e,t=t===a?t:ho(t))},Ba.reverse=Xr,Ba.sampleSize=function(e,t,n){return t=(n?br(e,t,n):t===a)?1:ho(t),(js(e)?Ja:Kn)(e,t)},Ba.set=function(e,t,a){return null==e?e:Xn(e,t,a)},Ba.setWith=function(e,t,n,i){return i="function"==typeof i?i:a,null==e?e:Xn(e,t,n,i)},Ba.shuffle=function(e){return (js(e)?Ka:ti)(e)},Ba.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&br(e,t,n)?(t=0,n=i):(t=null==t?0:ho(t),n=n===a?i:ho(n)),ai(e,t,n)):[]},Ba.sortBy=ks,Ba.sortedUniq=function(e){return e&&e.length?si(e):[]},Ba.sortedUniqBy=function(e,t){return e&&e.length?si(e,or(t,2)):[]},Ba.split=function(e,t,n){return n&&"number"!=typeof n&&br(e,t,n)&&(t=n=a),(n=n===a?p:n>>>0)?(e=go(e))&&("string"==typeof t||null!=t&&!no(t))&&!(t=li(t))&&ia(e)?wi(da(e),0,n):e.split(t,n):[]},Ba.spread=function(e,t){if("function"!=typeof e)throw new xe(n);return t=null==t?0:ya(ho(t),0),Zn((function(a){var n=a[t],i=wi(a,0,t);return n&&Ft(i,n),St(e,this,i)}))},Ba.tail=function(e){var t=null==e?0:e.length;return t?ai(e,1,t):[]},Ba.take=function(e,t,n){return e&&e.length?ai(e,0,(t=n||t===a?1:ho(t))<0?0:t):[]},Ba.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ai(e,(t=i-(t=n||t===a?1:ho(t)))<0?0:t,i):[]},Ba.takeRightWhile=function(e,t){return e&&e.length?pi(e,or(t,3),false,true):[]},Ba.takeWhile=function(e,t){return e&&e.length?pi(e,or(t,3)):[]},Ba.tap=function(e,t){return t(e),e},Ba.throttle=function(e,t,a){var i=true,r=true;if("function"!=typeof e)throw new xe(n);return Xs(a)&&(i="leading"in a?!!a.leading:i,r="trailing"in a?!!a.trailing:r),Cs(e,t,{leading:i,maxWait:t,trailing:r})},Ba.thru=ds,Ba.toArray=co,Ba.toPairs=Po,Ba.toPairsIn=Bo,Ba.toPath=function(e){return js(e)?Et(e,Rr):so(e)?[e]:xi(Dr(go(e)))},Ba.toPlainObject=yo,Ba.transform=function(e,t,a){var n=js(e),i=n||Hs(e)||oo(e);if(t=or(t,4),null==a){var r=e&&e.constructor;a=i?n?new r:[]:Xs(e)&&Zs(r)?Oa(Ye(e)):{};}return (i?Tt:vn)(e,(function(e,n,i){return t(a,e,n,i)})),a},Ba.unary=function(e){return Ns(e,1)},Ba.union=Qr,Ba.unionBy=es,Ba.unionWith=ts,Ba.uniq=function(e){return e&&e.length?ui(e):[]},Ba.uniqBy=function(e,t){return e&&e.length?ui(e,or(t,2)):[]},Ba.uniqWith=function(e,t){return t="function"==typeof t?t:a,e&&e.length?ui(e,a,t):[]},Ba.unset=function(e,t){return null==e||ci(e,t)},Ba.unzip=as,Ba.unzipWith=ns,Ba.update=function(e,t,a){return null==e?e:di(e,t,gi(a))},Ba.updateWith=function(e,t,n,i){return i="function"==typeof i?i:a,null==e?e:di(e,t,gi(n),i)},Ba.values=Oo,Ba.valuesIn=function(e){return null==e?[]:Kt(e,Io(e))},Ba.without=is,Ba.words=Jo,Ba.wrap=function(e,t){return Rs(gi(t),e)},Ba.xor=rs,Ba.xorBy=ss,Ba.xorWith=os,Ba.zip=ls,Ba.zipObject=function(e,t){return mi(e||[],t||[],Qa)},Ba.zipObjectDeep=function(e,t){return mi(e||[],t||[],Xn)},Ba.zipWith=us,Ba.entries=Po,Ba.entriesIn=Bo,Ba.extend=vo,Ba.extendWith=wo,sl(Ba,Ba),Ba.add=gl,Ba.attempt=Ko,Ba.camelCase=$o,Ba.capitalize=Uo,Ba.ceil=bl,Ba.clamp=function(e,t,n){return n===a&&(n=t,t=a),n!==a&&(n=(n=mo(n))==n?n:0),t!==a&&(t=(t=mo(t))==t?t:0),sn(mo(e),t,n)},Ba.clone=function(e){return on(e,4)},Ba.cloneDeep=function(e){return on(e,5)},Ba.cloneDeepWith=function(e,t){return on(e,5,t="function"==typeof t?t:a)},Ba.cloneWith=function(e,t){return on(e,4,t="function"==typeof t?t:a)},Ba.conformsTo=function(e,t){return null==t||ln(e,t,Vo(t))},Ba.deburr=jo,Ba.defaultTo=function(e,t){return null==e||e!=e?t:e},Ba.divide=vl,Ba.endsWith=function(e,t,n){e=go(e),t=li(t);var i=e.length,r=n=n===a?i:sn(ho(n),0,i);return (n-=t.length)>=0&&e.slice(n,r)==t},Ba.eq=Bs,Ba.escape=function(e){return (e=go(e))&&q.test(e)?e.replace(H,aa):e},Ba.escapeRegExp=function(e){return (e=go(e))&&ae.test(e)?e.replace(te,"\\$&"):e},Ba.every=function(e,t,n){var i=js(e)?xt:hn;return n&&br(e,t,n)&&(t=a),i(e,or(t,3))},Ba.find=fs,Ba.findIndex=Ur,Ba.findKey=function(e,t){return Bt(e,or(t,3),vn)},Ba.findLast=ms,Ba.findLastIndex=jr,Ba.findLastKey=function(e,t){return Bt(e,or(t,3),wn)},Ba.floor=wl,Ba.forEach=ys,Ba.forEachRight=gs,Ba.forIn=function(e,t){return null==e?e:gn(e,or(t,3),Io)},Ba.forInRight=function(e,t){return null==e?e:bn(e,or(t,3),Io)},Ba.forOwn=function(e,t){return e&&vn(e,or(t,3))},Ba.forOwnRight=function(e,t){return e&&wn(e,or(t,3))},Ba.get=No,Ba.gt=Os,Ba.gte=$s,Ba.has=function(e,t){return null!=e&&fr(e,t,Tn)},Ba.hasIn=To,Ba.head=Wr,Ba.identity=al,Ba.includes=function(e,t,a,n){e=Ws(e)?e:Oo(e),a=a&&!n?ho(a):0;var i=e.length;return a<0&&(a=ya(i+a,0)),ro(e)?a<=i&&e.indexOf(t,a)>-1:!!i&&$t(e,t,a)>-1},Ba.indexOf=function(e,t,a){var n=null==e?0:e.length;if(!n)return -1;var i=null==a?0:ho(a);return i<0&&(i=ya(n+i,0)),$t(e,t,i)},Ba.inRange=function(e,t,n){return t=po(t),n===a?(n=t,t=0):n=po(n),function(e,t,a){return e>=ga(t,a)&&e<ya(t,a)}(e=mo(e),t,n)},Ba.invoke=Co,Ba.isArguments=Us,Ba.isArray=js,Ba.isArrayBuffer=zs,Ba.isArrayLike=Ws,Ba.isArrayLikeObject=Ys,Ba.isBoolean=function(e){return true===e||false===e||Qs(e)&&Sn(e)==y},Ba.isBuffer=Hs,Ba.isDate=Gs,Ba.isElement=function(e){return Qs(e)&&1===e.nodeType&&!ao(e)},Ba.isEmpty=function(e){if(null==e)return true;if(Ws(e)&&(js(e)||"string"==typeof e||"function"==typeof e.splice||Hs(e)||oo(e)||Us(e)))return !e.length;var t=hr(e);if(t==_||t==T)return !e.size;if(Ar(e))return !Rn(e).length;for(var a in e)if(De.call(e,a))return false;return true},Ba.isEqual=function(e,t){return In(e,t)},Ba.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:a)?n(e,t):a;return i===a?In(e,t,a,n):!!i},Ba.isError=qs,Ba.isFinite=function(e){return "number"==typeof e&&Pt(e)},Ba.isFunction=Zs,Ba.isInteger=Js,Ba.isLength=Ks,Ba.isMap=eo,Ba.isMatch=function(e,t){return e===t||En(e,t,ur(t))},Ba.isMatchWith=function(e,t,n){return n="function"==typeof n?n:a,En(e,t,ur(t),n)},Ba.isNaN=function(e){return to(e)&&e!=+e},Ba.isNative=function(e){if(_r(e))throw new Ae("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Fn(e)},Ba.isNil=function(e){return null==e},Ba.isNull=function(e){return null===e},Ba.isNumber=to,Ba.isObject=Xs,Ba.isObjectLike=Qs,Ba.isPlainObject=ao,Ba.isRegExp=no,Ba.isSafeInteger=function(e){return Js(e)&&e>=-9007199254740991&&e<=c},Ba.isSet=io,Ba.isString=ro,Ba.isSymbol=so,Ba.isTypedArray=oo,Ba.isUndefined=function(e){return e===a},Ba.isWeakMap=function(e){return Qs(e)&&hr(e)==C},Ba.isWeakSet=function(e){return Qs(e)&&"[object WeakSet]"==Sn(e)},Ba.join=function(e,t){return null==e?"":Yt.call(e,t)},Ba.kebabCase=zo,Ba.last=qr,Ba.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return -1;var r=i;return n!==a&&(r=(r=ho(n))<0?ya(i+r,0):ga(r,i-1)),t==t?function(e,t,a){for(var n=a+1;n--;)if(e[n]===t)return n;return n}(e,t,r):Ot(e,jt,r,true)},Ba.lowerCase=Wo,Ba.lowerFirst=Yo,Ba.lt=lo,Ba.lte=uo,Ba.max=function(e){return e&&e.length?fn(e,al,Nn):a},Ba.maxBy=function(e,t){return e&&e.length?fn(e,or(t,2),Nn):a},Ba.mean=function(e){return zt(e,al)},Ba.meanBy=function(e,t){return zt(e,or(t,2))},Ba.min=function(e){return e&&e.length?fn(e,al,Pn):a},Ba.minBy=function(e,t){return e&&e.length?fn(e,or(t,2),Pn):a},Ba.stubArray=fl,Ba.stubFalse=ml,Ba.stubObject=function(){return {}},Ba.stubString=function(){return ""},Ba.stubTrue=function(){return true},Ba.multiply=_l,Ba.nth=function(e,t){return e&&e.length?jn(e,ho(t)):a},Ba.noConflict=function(){return pt._===this&&(pt._=Oe),this},Ba.noop=ol,Ba.now=Ss,Ba.pad=function(e,t,a){e=go(e);var n=(t=ho(t))?ca(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return zi(ft(i),a)+e+zi(ht(i),a)},Ba.padEnd=function(e,t,a){e=go(e);var n=(t=ho(t))?ca(e):0;return t&&n<t?e+zi(t-n,a):e},Ba.padStart=function(e,t,a){e=go(e);var n=(t=ho(t))?ca(e):0;return t&&n<t?zi(t-n,a)+e:e},Ba.parseInt=function(e,t,a){return a||null==t?t=0:t&&(t=+t),va(go(e).replace(ne,""),t||0)},Ba.random=function(e,t,n){if(n&&"boolean"!=typeof n&&br(e,t,n)&&(t=n=a),n===a&&("boolean"==typeof t?(n=t,t=a):"boolean"==typeof e&&(n=e,e=a)),e===a&&t===a?(e=0,t=1):(e=po(e),t===a?(t=e,e=0):t=po(t)),e>t){var i=e;e=t,t=i;}if(n||e%1||t%1){var r=wa();return ga(e+r*(t-e+lt("1e-"+((r+"").length-1))),t)}return Gn(e,t)},Ba.reduce=function(e,t,a){var n=js(e)?Dt:Ht,i=arguments.length<3;return n(e,or(t,4),a,i,dn)},Ba.reduceRight=function(e,t,a){var n=js(e)?Rt:Ht,i=arguments.length<3;return n(e,or(t,4),a,i,pn)},Ba.repeat=function(e,t,n){return t=(n?br(e,t,n):t===a)?1:ho(t),qn(go(e),t)},Ba.replace=function(){var e=arguments,t=go(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ba.result=function(e,t,n){var i=-1,r=(t=bi(t,e)).length;for(r||(r=1,e=a);++i<r;){var s=null==e?a:e[Rr(t[i])];s===a&&(i=r,s=n),e=Zs(s)?s.call(e):s;}return e},Ba.round=Al,Ba.runInContext=e,Ba.sample=function(e){return (js(e)?Za:Jn)(e)},Ba.size=function(e){if(null==e)return 0;if(Ws(e))return ro(e)?ca(e):e.length;var t=hr(e);return t==_||t==T?e.size:Rn(e).length},Ba.snakeCase=Ho,Ba.some=function(e,t,n){var i=js(e)?Lt:ni;return n&&br(e,t,n)&&(t=a),i(e,or(t,3))},Ba.sortedIndex=function(e,t){return ii(e,t)},Ba.sortedIndexBy=function(e,t,a){return ri(e,t,or(a,2))},Ba.sortedIndexOf=function(e,t){var a=null==e?0:e.length;if(a){var n=ii(e,t);if(n<a&&Bs(e[n],t))return n}return -1},Ba.sortedLastIndex=function(e,t){return ii(e,t,true)},Ba.sortedLastIndexBy=function(e,t,a){return ri(e,t,or(a,2),true)},Ba.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var a=ii(e,t,true)-1;if(Bs(e[a],t))return a}return -1},Ba.startCase=Go,Ba.startsWith=function(e,t,a){return e=go(e),a=null==a?0:sn(ho(a),0,e.length),t=li(t),e.slice(a,a+t.length)==t},Ba.subtract=kl,Ba.sum=function(e){return e&&e.length?Gt(e,al):0},Ba.sumBy=function(e,t){return e&&e.length?Gt(e,or(t,2)):0},Ba.template=function(e,t,n){var i=Ba.templateSettings;n&&br(e,t,n)&&(t=a),e=go(e),t=wo({},t,i,Ki);var r,s,o=wo({},t.imports,i.imports,Ki),l=Vo(o),u=Kt(o,l),c=0,d=t.interpolate||ve,p="__p += '",h=Te((t.escape||ve).source+"|"+d.source+"|"+(d===K?de:ve).source+"|"+(t.evaluate||ve).source+"|$","g"),f="//# sourceURL="+(De.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++it+"]")+"\n";e.replace(h,(function(t,a,n,i,o,l){return n||(n=i),p+=e.slice(c,l).replace(we,na),a&&(r=true,p+="' +\n__e("+a+") +\n'"),o&&(s=true,p+="';\n"+o+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=l+t.length,t})),p+="';\n";var m=De.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new Ae("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(s?p.replace(j,""):p).replace(z,"$1").replace(W,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var y=Ko((function(){return ke(l,f+"return "+p).apply(a,u)}));if(y.source=p,qs(y))throw y;return y},Ba.times=function(e,t){if((e=ho(e))<1||e>c)return [];var a=p,n=ga(e,p);t=or(t),e-=p;for(var i=qt(n,t);++a<e;)t(a);return i},Ba.toFinite=po,Ba.toInteger=ho,Ba.toLength=fo,Ba.toLower=function(e){return go(e).toLowerCase()},Ba.toNumber=mo,Ba.toSafeInteger=function(e){return e?sn(ho(e),-9007199254740991,c):0===e?e:0},Ba.toString=go,Ba.toUpper=function(e){return go(e).toUpperCase()},Ba.trim=function(e,t,n){if((e=go(e))&&(n||t===a))return Zt(e);if(!e||!(t=li(t)))return e;var i=da(e),r=da(t);return wi(i,Qt(i,r),ea(i,r)+1).join("")},Ba.trimEnd=function(e,t,n){if((e=go(e))&&(n||t===a))return e.slice(0,pa(e)+1);if(!e||!(t=li(t)))return e;var i=da(e);return wi(i,0,ea(i,da(t))+1).join("")},Ba.trimStart=function(e,t,n){if((e=go(e))&&(n||t===a))return e.replace(ne,"");if(!e||!(t=li(t)))return e;var i=da(e);return wi(i,Qt(i,da(t))).join("")},Ba.truncate=function(e,t){var n=30,i="...";if(Xs(t)){var r="separator"in t?t.separator:r;n="length"in t?ho(t.length):n,i="omission"in t?li(t.omission):i;}var s=(e=go(e)).length;if(ia(e)){var o=da(e);s=o.length;}if(n>=s)return e;var l=n-ca(i);if(l<1)return i;var u=o?wi(o,0,l).join(""):e.slice(0,l);if(r===a)return u+i;if(o&&(l+=u.length-l),no(r)){if(e.slice(l).search(r)){var c,d=u;for(r.global||(r=Te(r.source,go(pe.exec(r))+"g")),r.lastIndex=0;c=r.exec(d);)var p=c.index;u=u.slice(0,p===a?l:p);}}else if(e.indexOf(li(r),l)!=l){var h=u.lastIndexOf(r);h>-1&&(u=u.slice(0,h));}return u+i},Ba.unescape=function(e){return (e=go(e))&&G.test(e)?e.replace(Y,ha):e},Ba.uniqueId=function(e){var t=++Re;return go(e)+t},Ba.upperCase=qo,Ba.upperFirst=Zo,Ba.each=ys,Ba.eachRight=gs,Ba.first=Wr,sl(Ba,(yl={},vn(Ba,(function(e,t){De.call(Ba.prototype,t)||(yl[t]=e);})),yl),{chain:false}),Ba.VERSION="4.17.21",Tt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ba[e].placeholder=Ba;})),Tt(["drop","take"],(function(e,t){ja.prototype[e]=function(n){n=n===a?1:ya(ho(n),0);var i=this.__filtered__&&!t?new ja(this):this.clone();return i.__filtered__?i.__takeCount__=ga(n,i.__takeCount__):i.__views__.push({size:ga(n,p),type:e+(i.__dir__<0?"Right":"")}),i},ja.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()};})),Tt(["filter","map","takeWhile"],(function(e,t){var a=t+1,n=1==a||3==a;ja.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:or(e,3),type:a}),t.__filtered__=t.__filtered__||n,t};})),Tt(["head","last"],(function(e,t){var a="take"+(t?"Right":"");ja.prototype[e]=function(){return this[a](1).value()[0]};})),Tt(["initial","tail"],(function(e,t){var a="drop"+(t?"":"Right");ja.prototype[e]=function(){return this.__filtered__?new ja(this):this[a](1)};})),ja.prototype.compact=function(){return this.filter(al)},ja.prototype.find=function(e){return this.filter(e).head()},ja.prototype.findLast=function(e){return this.reverse().find(e)},ja.prototype.invokeMap=Zn((function(e,t){return "function"==typeof e?new ja(this):this.map((function(a){return Cn(a,e,t)}))})),ja.prototype.reject=function(e){return this.filter(Fs(or(e)))},ja.prototype.slice=function(e,t){e=ho(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ja(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==a&&(n=(t=ho(t))<0?n.dropRight(-t):n.take(t-e)),n)},ja.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ja.prototype.toArray=function(){return this.take(p)},vn(ja.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),r=Ba[i?"take"+("last"==t?"Right":""):t],s=i||/^find/.test(t);r&&(Ba.prototype[t]=function(){var t=this.__wrapped__,o=i?[1]:arguments,l=t instanceof ja,u=o[0],c=l||js(t),d=function(e){var t=r.apply(Ba,Ft([e],o));return i&&p?t[0]:t};c&&n&&"function"==typeof u&&1!=u.length&&(l=c=false);var p=this.__chain__,h=!!this.__actions__.length,f=s&&!p,m=l&&!h;if(!s&&c){t=m?t:new ja(this);var y=e.apply(t,o);return y.__actions__.push({func:ds,args:[d],thisArg:a}),new Ua(y,p)}return f&&m?e.apply(this,o):(y=this.thru(d),f?i?y.value()[0]:y.value():y)});})),Tt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ce[e],a=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Ba.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(js(i)?i:[],e)}return this[a]((function(a){return t.apply(js(a)?a:[],e)}))};})),vn(ja.prototype,(function(e,t){var a=Ba[t];if(a){var n=a.name+"";De.call(Ca,n)||(Ca[n]=[]),Ca[n].push({name:t,func:a});}})),Ca[Oi(a,2).name]=[{name:"wrapper",func:a}],ja.prototype.clone=function(){var e=new ja(this.__wrapped__);return e.__actions__=xi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xi(this.__views__),e},ja.prototype.reverse=function(){if(this.__filtered__){var e=new ja(this);e.__dir__=-1,e.__filtered__=true;}else (e=this.clone()).__dir__*=-1;return e},ja.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,a=js(e),n=t<0,i=a?e.length:0,r=function(e,t,a){for(var n=-1,i=a.length;++n<i;){var r=a[n],s=r.size;switch(r.type){case "drop":e+=s;break;case "dropRight":t-=s;break;case "take":t=ga(t,e+s);break;case "takeRight":e=ya(e,t-s);}}return {start:e,end:t}}(0,i,this.__views__),s=r.start,o=r.end,l=o-s,u=n?o:s-1,c=this.__iteratees__,d=c.length,p=0,h=ga(l,this.__takeCount__);if(!a||!n&&i==l&&h==l)return hi(e,this.__actions__);var f=[];e:for(;l--&&p<h;){for(var m=-1,y=e[u+=t];++m<d;){var g=c[m],b=g.iteratee,v=g.type,w=b(y);if(2==v)y=w;else if(!w){if(1==v)continue e;break e}}f[p++]=y;}return f},Ba.prototype.at=ps,Ba.prototype.chain=function(){return cs(this)},Ba.prototype.commit=function(){return new Ua(this.value(),this.__chain__)},Ba.prototype.next=function(){this.__values__===a&&(this.__values__=co(this.value()));var e=this.__index__>=this.__values__.length;return {done:e,value:e?a:this.__values__[this.__index__++]}},Ba.prototype.plant=function(e){for(var t,n=this;n instanceof $a;){var i=Pr(n);i.__index__=0,i.__values__=a,t?r.__wrapped__=i:t=i;var r=i;n=n.__wrapped__;}return r.__wrapped__=e,t},Ba.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof ja){var t=e;return this.__actions__.length&&(t=new ja(this)),(t=t.reverse()).__actions__.push({func:ds,args:[Xr],thisArg:a}),new Ua(t,this.__chain__)}return this.thru(Xr)},Ba.prototype.toJSON=Ba.prototype.valueOf=Ba.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Ba.prototype.first=Ba.prototype.head,Je&&(Ba.prototype[Je]=function(){return this}),Ba}();ft?((ft.exports=fa)._=fa,ht._=fa):pt._=fa;}).call(X$1);}(K$1,K$1.exports)),K$1.exports);class ee extends Y{name="";displayName="";type=void 0;info;preload=true;loadingManagerRule="load";item;itemRepo;condition;conditionFields=[];conditionFieldNames=[];dependantFields=[];dependenciesInitialized=false;linkableTypes=[];collapsed=false;presets=[];datatype=null;defaultValue=null;minValue=null;maxValue=null;language=null;widget=null;length=null;labelType=null;blocks=[];connections=[];_id="";_internalValue;_internalOptions=[];_updateConditions=true;_hidden=false;get hidden(){return !(!this.condition||!this.dependenciesInitialized)&&(this._updateConditions&&(this._hidden=!this._calculateConditionBlock(this.condition),this._updateConditions=false),this._hidden)}get id(){return this._id}get options(){return this._internalOptions}set options(e){this._internalOptions=e,this.updateConditions();}get value(){return this._internalValue}set value(e){this._internalValue=e,this._processDependencies();}constructor(e,t=void 0,a=void 0,n=void 0,i=void 0,r=void 0){super(i),e instanceof W?(this._id=e.id,this.restoreFromSnapshot(e)):(p.assert(e,"Field has no name!"),p.assert(a,"Field has no type!"),this._id=p.createFieldID(),this.name=e,this.displayName=t||e,this.type=a,this._internalValue=n,this.item=i,this.itemRepo=r);}updateConditions(){this.condition&&this.dependenciesInitialized&&(this._updateConditions=true,l$1.$emit("field:hiddenChanged",this.id));}getId(){return this.id}resetValue(){this.value=this.defaultValue;}makeIdsUnique(e=new Map,t=false){if(e.has(this._id)||t){const t=p.createFieldID();e.set(this._id,t),this._id=t;}else e.set(this._id,this._id);for(const a of this.blocks)a.makeIdsUnique(e,t);return e}transformNodeIds(e){for(const t of this.blocks)t.transformNodeIds(e);"Attribute"===this.type&&"Node"===this.datatype&&this.value&&e.has(this.value)&&(this.value=e.get(this.value));}findBlock(e){for(const t of this.blocks){const a=t.findBlock(e);if(a)return a}return null}clone(e=void 0,t=false){let a=new ee(this.name,this.displayName,this.type);void 0===this._internalValue?a._internalValue=void 0:null===this._internalValue?a._internalValue=null:"Link"===this.type?a._internalValue=this._internalValue:a._internalValue=Q$1.cloneDeep(this._internalValue),a.info=this.info,a.preload=this.preload,a.loadingManagerRule=this.loadingManagerRule,a.item=this.item,a.ownerItem=this.ownerItem,a.itemRepo=this.itemRepo,a.condition=this.condition,a.conditionFields=this.conditionFields,a.conditionFieldNames=this.conditionFieldNames,a.dependantFields=this.dependantFields,a.collapsed=this.collapsed,a.presets=this.presets,a.labelType=this.labelType,a.datatype=this.datatype,a.defaultValue=this.defaultValue,a.minValue=this.minValue,a.maxValue=this.maxValue,a.options=this.options,a.language=this.language,a.widget=this.widget,a.length=this.length,a.linkableTypes=this.linkableTypes;for(const n of this.blocks){let i=n.clone(e,true,{},t);e&&(i=y$1.instance.proxyBlock(i,e)),a.blocks.push(i);}for(const t of this.connections){let n=t.clone();e&&(n=y$1.instance.proxyConnection(n,e)),a.connections.push(n);}return a}_processDependencies(){for(const e of this.dependantFields)e.updateConditions();}_getConditionField(e){for(const t of this.conditionFields)if(t&&t.name===e)return t;return null}_calculateConditionField(e,t){if(!e.startsWith("$")){let a;e.includes(".")?(a=e.split("."),e=a.splice(0,1)[0]):a=[];let n=e.endsWith("?");n&&(e=e.substring(0,e.length-1));const i=this._getConditionField(e);if(!i)return n||console.error("Field to resolve condition not found: "+e),false;let r=i.value;for(let t=0;t<a.length;t++){if(!r)return console.error(`Field path ${a.join(".")} not found in field ${e}!`),false;r=r[a[t]];}return "object"==typeof t?void 0!==t.$isset?t.$isset===!!r:void 0!==t.$not?t.$not!==r:(console.error("Condition value cannot be interpreted: ",t,this),false):i.value==t}switch(e){case "$isroot":return this.item._id===this.itemRepo.rootItemId===t;case "$parenttype":return console.log("$parenttype is not yet implemented!",this),false;case "$optionsexist":return (Array.isArray(this.options)&&this.options.length>0)===t;case "$featureenabled":return this.itemRepo.apiClient.isFeatureEnabled(t);default:return console.error("Computed value unknown: "+e,this),false}}_calculateConditionBlock(e){for(const t in e)if(e.hasOwnProperty(t)){const a=e[t];if("$or"===t)if(Array.isArray(a)){let e=false;for(const t of a)if(this._calculateConditionBlock(t)){e=true;break}if(!e)return false}else console.error("Condition contains $or but its value is not an array!");else if("$not"===t){if("object"!=typeof a)console.error("When using the $not operator, the value needs to be an object");else if(this._calculateConditionBlock(a))return false}else if(!this._calculateConditionField(t,a))return false}return true}refreshFieldDependencies(){for(const e of this.blocks)e.refreshFieldDependencies();}refreshDependantFields(e,t){const a=[];if(this.condition)for(let t of this.conditionFieldNames){const n=t.endsWith("?");n&&(t=t.substring(0,t.length-1));const i=e.get(t);i?a.push(i):n||console.warn("Condition field not found: "+t);}this.conditionFields=a,this.dependantFields=t||[],this.dependenciesInitialized=true;}setCondition(e){e?"object"==typeof e?this.condition=e:(console.error("Condition must be an object if set",e),this.condition=null):this.condition=null,this.conditionFieldNames=[],this.condition&&this._scanConditions(this.condition);}_scanConditions(e){for(let t in e)if(e.hasOwnProperty(t)){const a=e[t];if(Array.isArray(a))for(const e of a)this._scanConditions(e);else t.startsWith("$")||(t.includes(".")&&(t=t.split(".")[0]),this.conditionFieldNames.includes(t)||this.conditionFieldNames.push(t));}}forEachField(e){if(e(this),this.blocks)for(const t of this.blocks)t.forEachField(e);}setInfo(e){this.info=e;}setPreload(e){this.preload=e;}setLoadingManagerRule(e){this.loadingManagerRule=e;}setLinkableTypes(e){this.linkableTypes=e;}setDefaultValue(e){this.defaultValue=e,void 0!==this._internalValue&&null!==this._internalValue||(this._internalValue=e);}setMinValue(e){this.minValue=e;}setMaxValue(e){this.maxValue=e;}setOptions(e){this.options=e;}setDatatype(e){this.datatype=e;}setLanguage(e){this.language=e;}setLength(e){this.length=e;}setWidget(e){this.widget=e;}setBlocks(e){this.blocks=e;}setConnections(e){this.connections=e;}setCollapsed(e){this.collapsed=!!e;}setPresets(e){this.presets=e||[];}setLabelType(e){this.labelType=e||"info";}createSnapshot(e=false){p.assert(this.id,"Field has no ID. Cannot create snapshot");const t=[];for(const a of this.blocks)t.push(a.createSnapshot(e));const a=[];for(const e of this.connections)a.push(e.createSnapshot());return new W(this.id,"field",{name:this.name,displayName:this.displayName,type:this.type,value:this._internalValue,preload:this.preload,info:this.info,loadingManagerRule:this.loadingManagerRule,item:this.item,itemRepo:this.itemRepo,condition:this.condition,conditionFields:this.conditionFields,conditionFieldNames:this.conditionFieldNames,dependantFields:this.dependantFields,linkableTypes:this.linkableTypes,collapsed:this.collapsed,presets:this.presets,datatype:this.datatype,defaultValue:this.defaultValue,minValue:this.minValue,maxValue:this.maxValue,options:this.options,language:this.language,widget:this.widget,length:this.length,labelType:this.labelType,blocks:t,connections:a})}restoreFromSnapshot(e){e.id===this.id?(this.name=e.data.name,this.displayName=e.data.displayName,this.type=e.data.type,this._internalValue=e.data.value,this.info=e.data.info,this.preload=e.data.preload,this.loadingManagerRule=e.data.loadingManagerRule,this.item=e.data.item,this.ownerItem=e.data.item,this.itemRepo=e.data.itemRepo,this.condition=e.data.condition,this.conditionFields=e.data.conditionFields,this.conditionFieldNames=e.data.conditionFieldNames,this.dependantFields=e.data.dependantFields,this.linkableTypes=e.data.linkableTypes,this.collapsed=e.data.collapsed,this.presets=e.data.presets,this.datatype=e.data.datatype,this.defaultValue=e.data.defaultValue,this.minValue=e.data.minValue,this.maxValue=e.data.maxValue,this.options=e.data.options,this.language=e.data.language,this.widget=e.data.widget,this.length=e.data.length,this.labelType=e.data.labelType,this.blocks=[],this.connections=[],this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>y$1.instance.proxyBlock(new le(e,t),this.ownerItem))),this._rollbackArray(this.connections,e.data.connections,((e,t)=>y$1.instance.proxyConnection(new H(e.data,t),this.ownerItem)))):console.error("Snapshot ID does not match! Cannot rollback!",this,e);}rollbackFromSnapshot(e){this.value=e.data.value,this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>y$1.instance.proxyBlock(new le(e,t),this.ownerItem))),this._rollbackArray(this.connections,e.data.connections,((e,t)=>y$1.instance.proxyConnection(new H(e.data,t),this.ownerItem)));}}let te$1 = class te extends Y{id;name=void 0;displayName=void 0;value;type=void 0;datatype=void 0;linkableTypes=[];order=0;constructor(e=void 0,t=void 0,a=void 0){super(a),this.value=t,this.id=p.createItemOrBlockID(),this.name=e,this.displayName=e,this._updateDisplayName();}getId(){return this.id}setName(e){this.name=e,this._updateDisplayName();}setType(e){this.type=e;}setOrder(e){this.order=e;}clone(e=new Map){const t=new te;return t.ownerItem=this.ownerItem,t.value=e.get(this.value)??this.value,t.type=this.type,t.order=this.order,t.setName(this.name),t}clearDefinition(){this.type=void 0;}setDefinition(e){const t=e.type.toLowerCase();switch(t){case "boolean":case "bool":this.type="Attribute",this.datatype="Boolean",this.value=void 0!==this.value?this._toBoolean(this.value):this._toBoolean(e.defaultValue);break;case "float":this.type="Attribute",this.datatype="Float",this.value=void 0!==this.value?Number(this.value):Number(e.defaultValue);break;case "int":this.type="Attribute",this.datatype="Integer",this.value=void 0!==this.value?parseInt(this.value):parseInt(e.defaultValue);break;case "string":this.type="Attribute",this.datatype="String",this.value=void 0!==this.value&&null!==this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():"";break;case "vec2":this.type="Attribute",this.datatype="Vector2d";break;case "vec3":this.type="Attribute",this.datatype="Vector3d";break;case "vec4":this.type="Attribute",this.datatype="Vector4d";break;case "mat3":this.type="Attribute",this.datatype="Mat3";break;case "mat4":this.type="Attribute",this.datatype="Mat4";break;case "color":this.type="Attribute",this.datatype="Color";break;case "image":this.type="Link",this.linkableTypes=["Image"];break;default:console.error("Unknown script field type: "+t),this.type="Attribute",this.datatype="String",this.value=this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():"";}}_toBoolean(e){return null!=e&&(true===e||false===e?e:"false"!==e.toString().toLowerCase())}_updateDisplayName(){this.name?this.displayName=p.toUserFriendlyName(this.name):this.displayName="";}createSnapshot(){return new W(this.id,"customfield",{id:this.id,value:this.value})}rollbackFromSnapshot(e){this.value=e.data.value;}};let ae$1 = class ae extends V{links;instanceId;isDirty=false;fieldInstances;userFieldInstances;customFieldInstances;packageContent;packageType;public=false;readOnly=false;isPackaged=false;isGenerated=false;packageItem;isPreparedItem=true;resultingAcl;userData={};constructor(e){if(super(e),this.instanceId=p.createItemOrBlockID(),this.links=[],Array.isArray(e.links))for(const t of e.links)this.links.push({to:t.to,usage:t.usage,stopRecursion:t.stopRecursion,item:t.item});this.fieldInstances=[],this.userFieldInstances=[],this.customFieldInstances=y$1.instance.proxyCustomFieldsArray([],this),this.public=!!e.public,this.packageContent=e.packageContent,this.packageType=e.packageType,this.packageItem=e.packageItem,this.readOnly=!!e.readOnly,this.isPackaged=!!e.isPackaged,this.isGenerated=!!e.isGenerated,this.resultingAcl=JSON.parse(JSON.stringify(e.resultingAcl||[]));}createCustomFieldInstances(e){function t(e,t){for(const a of e)if(a.name===t)return a;return null}for(const a of this.customFieldInstances)t(e,a.name)||a.clearDefinition();let a=0;for(const n of e){let e=t(this.customFieldInstances,n.name);e||(e=new te$1(n.name,n.defaultValue,this),this.addCustomField(e)),e.setOrder(a++),e.setDefinition(n);}this.customFieldInstances.sort((function(e,t){return e.order-t.order}));}addCustomField(e){this.customFieldInstances.push(y$1.instance.proxyCustomField(e,this));}markDirty(){this.isDirty||(this.isDirty=true,l$1.$emit("itemRepo:itemBecameDirty",this._id));}makeIdsUnique(){const e=new Map;for(const t of this.fieldInstances)t.makeIdsUnique(e,true);this.packageContent&&this.packageContent.makeIdsUnique();}clone(e=false){let t=new ae(this);const a=new Map;for(const n of this.fieldInstances){const i=n.clone(this,true);e&&i.makeIdsUnique(a,true),t.fieldInstances.push(i);}if(e)for(const e of t.fieldInstances)e.transformNodeIds(a);return t}findBlock(e){for(const t of this.fieldInstances){const a=t.findBlock(e);if(a)return a}return null}refreshFieldDependencies(){oe.refreshFieldDependencies(this.fieldInstances);for(const e of this.fieldInstances)e.refreshFieldDependencies();}forEachItem(e){if(e(this),this.links)for(const t of this.links)t.item&&t.item.forEachItem(e);}forEachFieldInstance(e){if(this.fieldInstances)for(const t of this.fieldInstances)t.forEachField(e);}toString(){return `PreparedItem(${JSON.stringify({_id:this._id,name:this.name,type:this.type})})`}};function ne(e,t,a){if(e.admin||e.superadmin)return true;if(!Array.isArray(t))return true;for(const n of t)if(n.can.includes(a)){if(!n.user&&!n.group)return true;if(n.user&&n.user===e._id)return true;if(n.group)for(const t of e.groups){if("object"==typeof t&&t._id===n.group)return true;if(t===n.group)return true}}}function ie(e,t,a){if(e.admin&&!a)return true;if(e.superadmin)return true;if(Array.isArray(e.permissions))if(Array.isArray(t)){for(const a of e.permissions)for(const e of t)if(a===e)return true}else for(const a of e.permissions)if(a===t)return true;return false}class re{fields;constructor(e){if(!Array.isArray(e))throw "Template fields need to be an array!";this.fields=e;}clone(){const e=[];for(const t of this.fields)e.push(t.clone());return new re(e)}specialize(e){for(const t of this.fields) void 0!==e[t.name]&&(t.defaultValue=e[t.name]);return this}instantiate(e){if(e)return this.fields;{const e=[];for(const t of this.fields)e.push(t.clone());return e}}}class se{templates=new Map;templatesByField=new Map;static _instance;static get instance(){return this._instance||(this._instance=new this)}_existsTemplate(e,t){for(const a of e)if(a.typeName===t)return true;return false}addTemplates(e,t,a){const n=`${e}_${t}`,i=this.templatesByField.get(n)||[];for(const e of a){const t=`${n}_${e.typeName}`;this.templates.set(t,e),this._existsTemplate(i,e.typeName)||i.push(e);}this.templatesByField.set(n,i);}getTemplate(e,t,a){const n=`${e}_${t}_${a}`;return this.templates.get(n)}getTemplates(e,t){const a=`${e}_${t}`;return this.templatesByField.get(a)||[]}}class oe{itemRepo;itemFetcher;constructor(e){this.itemRepo=e,this.itemFetcher=function(e){return e};}setItemFetcher(e){this.itemFetcher=e;}setFieldsFromDatatypes(e){const t=E$1(e.type,true);e.fields=t?.fields||[],e.fieldSets=t?.fieldSets||[];}async prepare(e){return e instanceof ae$1?(console.warn("Trying to prepare an already prepared item: ",e),e):this.itemRepo.undoManager.ignore((async()=>{const t=new ae$1(e);return this.setFieldsFromDatatypes(t),t.fieldInstances=await this.createFieldInstances(t,t.fields,t.attributes,"","attributes",false),t.userFieldInstances=await this.createFieldInstances(t,t.userFields,t.userAttributes,"","userAttributes",false),t.customFieldInstances=await this.createCustomFieldInstances(t,t.userAttributes,"_"),t.allowConversation=!!t.allowConversation,t.packageContent&&(t.packageContent.name=t.name,await this.itemRepo.traverseItems((e=>{e.readOnly=true,e.isPackaged=true,e.packageItem=t;}),t.packageContent)),t.packageItem?(t.readOnly=true,t.isPackaged=true):(t.isPackaged=false,t.resultingAcl&&t.resultingAcl.length>0?t.readOnly=!ne(await this.itemRepo.apiClient.me(true),t.resultingAcl,"write"):t.readOnly=true),t}))}async createCustomFieldInstances(e,t,a=""){if(!e)throw new k("createCustomFieldInstances(): Item cannot be null!");if(!t)throw new k("createCustomFieldInstances(): attributes cannot be null!");const n=[];for(const i in t)if(!a.length||i.startsWith(a)){const r=i.substring(a.length);let s=new te$1(r,t[i],e);s.setType("Attribute"),n.push(y$1.instance.proxyCustomField(s,e));}if(e.links)for(const t of e.links)if(!a.length||t.usage.startsWith(a)){const i=t.usage.substring(a.length);let r,{id:s,linkItem:o,stopRecursion:l}=await this.fetchLinkValue(e,t.usage);o?r=o:l&&(r=s);let u=new te$1(i,r,e);u.setType("Link"),n.push(y$1.instance.proxyCustomField(u,e));}return n}async createFieldInstances(e,t,a,n,i,r=false){if(!e)throw new k("createFieldInstances(): Item cannot be null!");if(!t)throw new k("createFieldInstances(): Fields cannot be null!");const s=[],o=n.length?`${n}->`:n;for(let a=0;a<t.length;a++){const n=t[a];if("FieldSet"===n.type){const i=this.getFieldSet(e,n.name);i?(t.splice(a,1,...structuredClone(i.fields)),a+=i.fields.length-1):console.error("Fieldset not found: "+n.name);}}for(const n of t)switch(n.type){case "Separator":{const t=new ee("Separator",n.label,"Separator",null,e,this.itemRepo);t.setInfo(n.info),t.setCondition(n.if),t.setCollapsed(n.collapsed),t.setPresets(n.presets),s.push(t);break}case "Label":{const t=new ee("Label","","Label",n.text,e,this.itemRepo);t.setLabelType(n.labelType),t.setCondition(n.if),s.push(t);break}case "Link":{let t;if(!r){let{id:a,linkItem:i,stopRecursion:r}=await this.fetchLinkValue(e,n.usageAs);i?t=i:r&&(t=a);}let a=new ee(n.usageAs,n.displayName,n.type,t,e,this.itemRepo);a.setInfo(n.info),a.setCondition(n.if),a.setLinkableTypes(n.linkableTypes),void 0!==n.preload&&a.setPreload(n.preload),void 0!==n.loadingManager&&a.setLoadingManagerRule(n.loadingManager),s.push(y$1.instance.proxyItemField(a,e));break}case "Tree":{const t=`${o}${n.name}`,r=[];for(const s of n.childTypes){const n=new re(await this.createFieldInstances(e,s.fields,a,t,i,true));r.push({typeName:s.typeName,displayName:s.displayName||s.typeName,template:n,inputs:[],outputs:[]});}r.sort((function(e,t){return e.displayName.localeCompare(t.displayName)})),se.instance.addTemplates(e.type,n.name,r);const l=new le(void 0,void 0,"","Root",void 0,e),u=await this.readBlocks(e,l,n.name,t,a,true,true,"Tree");l.blocks=y$1.instance.proxyBlockArray(u,l,e);let c=new ee(n.name,n.displayName,n.type,null,e,this.itemRepo);c.setInfo(n.info),c.setCondition(n.if),c.setBlocks([l]),s.push(c);break}case "List":{const t=`${o}${n.name}`,r=new re(await this.createFieldInstances(e,n.fields,a,t,i,true)),l=[{typeName:"Entry",displayName:n.elementName,template:r,inputs:[],outputs:[]}];se.instance.addTemplates(e.type,n.name,l);let u=new ee(n.name,n.displayName,n.type,null,e,this.itemRepo);const c=await this.readBlocks(e,void 0,n.name,t,a,true,true,"List"),d=y$1.instance.proxyListArray(c,u,e);u.setInfo(n.info),u.setCondition(n.if),u.setBlocks(d),s.push(u);break}case "NodeGraph":{const t=`${o}${n.name}`,r=[];for(const s of n.childTypes){const n=new re(await this.createFieldInstances(e,s.fields,a,t,i,true));r.push({typeName:s.typeName,displayName:s.displayName||s.typeName,template:n,inputs:s.inputs||[],outputs:s.outputs||[]});}r.sort((function(e,t){return e.displayName.localeCompare(t.displayName)})),se.instance.addTemplates(e.type,n.name,r);let l=await this.readBlocks(e,void 0,n.name,t,a,false,false,"NodeGraph"),u=this.readConnections(e,t,a),c=new ee(n.name,n.displayName,n.type,null,e,this.itemRepo);c.setInfo(n.info),c.setCondition(n.if),c.setBlocks(y$1.instance.proxyGraphBlockArray(l,e)),c.setConnections(y$1.instance.proxyConnectionArray(u,e)),s.push(c);break}case "Attribute":{let t;r||(t=e[i]?e[i][n.name]:void 0,void 0===t&&(t=n.defaultValue));let a=new ee(n.name,n.displayName,n.type,t,e,this.itemRepo);a.setInfo(n.info),a.setCondition(n.if),a.setDefaultValue(n.defaultValue),a.setMinValue(n.minValue),a.setMaxValue(n.maxValue),a.setOptions(n.options),a.setDatatype(n.datatype),a.setLanguage(n.language),a.setWidget(n.widget),a.setLength(n.length),s.push(y$1.instance.proxyItemField(a,e));break}}return s}getFieldSet(e,t){if(Array.isArray(e.fieldSets))for(const a of e.fieldSets)if(a.name===t)return a;return null}async fetchLinkValue(e,t){if(!e)throw new k("fetchLinkValue(): Item cannot be null!");for(const a of e.links)if(a.usage===t)return {id:a.to,linkItem:a.item?await this.itemFetcher(a.item):null,stopRecursion:a.stopRecursion};return {id:null,linkItem:null}}async readBlocks(e,t,a,n,i,r,s,o){if(!e)throw new k("readBlocks(): Item cannot be null!");const l=[];let u=0;for(;;){const c=`${n}[${u}]`;if(!this.existsBlockNamespace(e,i,c))break;{const n=`${c}#id`,u=e.attributes[n],d=`${c}#subnodeid`,p=e.attributes[d],h=`${c}#type`;let f,m,g=e.attributes[h];switch(o){case "NodeGraph":{const t=`${c}#posx`,a=`${c}#posy`;f=e.attributes[t]||0,m=e.attributes[a]||0;break}case "List":r=false,g="Entry";}const b=se.instance.getTemplate(e.packageType||e.type,a,g);if(b){const n=b.typeName,d=b.displayName,h=new le(u,t,n,n,d,e);p&&h.setSubNodeId(p);const g=await this.createFields(h,e,b.template,c,"NodeGraph"===o,i);if(h.setFields(g),"NodeGraph"===o&&(h.setPosition(f,m),h.setInputs(b.inputs),h.setOutputs(b.outputs)),r){const t=await this.readBlocks(e,h,a,c,i,r,s,o);h.blocks=y$1.instance.proxyBlockArray(t,h,e);}if(s){const t=await this.readScripts(e,h,c,i);h.scripts=y$1.instance.proxyScriptArray(t,h,e);}"NodeGraph"===o?l.push(y$1.instance.proxyGraphBlock(h,e)):l.push(y$1.instance.proxyBlock(h,e));}else console.error(`Block template not found: ${a}_${g}`);}u++;}return l}async readScripts(e,t,a,n){if(!e)throw new k("readScripts(): Item cannot be null!");const i=[];let r=0;for(;;){const s=`${a}#scripts[${r}]`;if(!this.existsScriptNamespace(e,n,s))break;{const a=n[`${s}#id`],r=`${s}#item`,o=`${s}->`,l=o.length;let{linkItem:u}=await this.fetchLinkValue(e,r);const c=new Z(a,t,e,u);i.push(c);for(const t in n)if(n.hasOwnProperty(t)&&t.startsWith(o)){const a=n[t],i=t.substring(l),r=new G$9(c,i,a,e);c.addField(r);}}r++;}return i}existsScriptNamespace(e,t,a){if(!e)throw new k("existsScriptNamespace(): Item cannot be null!");return "Script"===t[`${a}#usage`]}readConnections(e,t,a){const n=[];let i=0;for(;;){const r=a[`${t}#connection[${i++}]`];if(!r)break;n.push(new H(r,e));}return n}existsBlockNamespace(e,t,a){if(!e)throw new k("existsBlockNamespace(): Item cannot be null!");const n=t[`${a}#usage`];if(n)return "Block"===n;for(const e in t)if(t.hasOwnProperty(e)&&e.startsWith(a))return true;for(const t of e.links)if(t.usage.startsWith(a))return true;return false}async createFields(e,t,a,n,i,r,s=false){let o=a.instantiate(s),l=[];for(const a of o)if(a.name){const s=`${n}->${a.name}`;switch(a.type){case "Link":if(n){let{id:e,linkItem:n,stopRecursion:i}=await this.fetchLinkValue(t,s);a.value=n||(i?e:null);}else a.value=a.defaultValue;break;case "List":{const e=await this.readBlocks(t,void 0,a.name,s,r,true,true,"List"),n=y$1.instance.proxyListArray(e,a,t);a.setBlocks(n);break}case "Attribute":n?(a.value=t.attributes[s],void 0===a.value&&(a.value=a.defaultValue)):a.value=a.defaultValue;}i?l.push(y$1.instance.proxyGraphBlockField(a,e,t)):l.push(y$1.instance.proxyBlockField(a,e,t));}return l}static refreshFieldDependencies(e){const t=new Map,a=new Map;for(const a of e)t.set(a.name,a);for(const n of e)if(Array.isArray(n.conditionFieldNames))for(const e of n.conditionFieldNames){const i=t.get(e);if(i){const e=a.get(i);e?e.push(n):a.set(i,[n]);}}for(const n of e)n.refreshDependantFields(t,a.get(n));}}class le extends Y{id="";parent=void 0;type=void 0;name="";displayName="";fields=[];blocks=[];isSelected=false;isExpanded=true;scripts=[];subNodeId=void 0;inputs=[];outputs=[];posX=0;posY=0;_fieldsByName=new Map;_firstLinkField=void 0;constructor(e=void 0,t=void 0,a=void 0,n=void 0,i=void 0,r=void 0){super(r),e instanceof W?this.restoreFromSnapshot(e,t):(this.id=e||p.createItemOrBlockID(),this.parent=t,this.type=a,this.name=n||this.type||"",this.displayName=i||this.name);}getId(){return this.id}setSubNodeId(e){this.subNodeId=e;}getFirstLinkField(){if(void 0!==this._firstLinkField)return this._firstLinkField;for(const e of this.fields)if("Link"===e.type)return this._firstLinkField=e,e;return this._firstLinkField=null,null}findField(e){if(this._fieldsByName.has(e))return this._fieldsByName.get(e);for(const t of this.fields)if(t.name===e)return this._fieldsByName.set(e,t),t;return this._fieldsByName.set(e,null),null}getPositionInParent(){if(this.parent){let e=0;for(const t of this.parent.blocks){if(t.id===this.id)return e;e++;}}return -1}refreshFieldDependencies(){oe.refreshFieldDependencies(this.fields);for(const e of this.fields)e.refreshFieldDependencies();for(const e of this.blocks)e.refreshFieldDependencies();}resetFieldValues(e=false){for(const e of this.fields)e.resetValue();if(e)for(const t of this.blocks)t.resetFieldValues(e);}makeIdsUnique(e=new Map,t=false){if(e.has(this.id)||t){const t=p.createItemOrBlockID();e.set(this.id,t),this.id=t;}else e.set(this.id,this.id);for(const a of this.fields)a.makeIdsUnique(e,t);for(const a of this.blocks)a.makeIdsUnique(e,t);for(const a of this.scripts)a.makeIdsUnique(e,t);return e}transformNodeIds(e){for(const t of this.fields)t.transformNodeIds(e);for(const t of this.blocks)t.transformNodeIds(e);for(const t of this.scripts)t.transformNodeIds(e);}clone(e,t=true,a={},n=false){const i=new le;n&&(i.id=this.id),i.ownerItem=this.ownerItem,i.parent=this.parent,i.type=this.type,i.name=this.name,i.displayName=this.displayName,i.isSelected=false,i.isExpanded=true,i.inputs=this.inputs,i.outputs=this.outputs,i.subNodeId=this.subNodeId,i.posX=0,i.posY=0;for(const t of this.fields){let r=t.clone(e,n);void 0!==a[t.name]&&(r.value=a[t.name]),e&&(r=y$1.instance.proxyBlockField(r,i,e)),i.fields.push(r);}if(e&&(i.scripts=y$1.instance.proxyScriptArray(i.scripts,i,e)),t)for(const e of this.scripts){const t=e.clone();i.scripts.push(t);}const r=i.blocks;e&&(i.blocks=y$1.instance.proxyBlockArray(r,i,e));for(const a of this.blocks){let s=a.clone(e,t,{},n);s.parent=i,e&&(s=y$1.instance.proxyBlock(s,e)),r.push(s);}return i}getDescendantBlocks(e=[]){const t=this.blocks;return e.push(...t),t.forEach((t=>t.getDescendantBlocks(e))),e}setFields(e){this.fields=e;}setInputs(e){this.inputs=e;}setOutputs(e){this.outputs=e;}setPosition(e,t){this.posX=e,this.posY=t;}setSelected(e){this.isSelected=e;}setExpanded(e){this.isExpanded=e;}getRoot(){return this.parent?this.parent.getRoot():this}forEachField(e){if(this.fields)for(const t of this.fields)t.forEachField(e);if(this.blocks)for(const t of this.blocks)t.forEachField(e);}findBlock(e){if(this.id===e)return this;for(const t of this.blocks){const a=t.findBlock(e);if(a)return a}return null}removeBlock(e){this.blocks.removeObject(e);}addBlock(e,t){this.blocks.includes(e)||(void 0===t?this.blocks.push(e):this.blocks.splice(t,0,e));}moveBlock(e,t){e.parent.blocks.moveObjectToArray(e,e.parent.blocks,t);}moveToPosition(e){this.parent.moveBlock(this,e);}moveBlockToParent(e,t){this.parent.blocks.moveObjectToArray(this,e.blocks,t),this.parent=e;}moveToParent(e,t){if(this.findBlock(e))return void console.error("Cannot move block to a parent that is a child.");const a=this.getRoot();if(!a)return void console.error("Cannot find root block!");const n=a.findBlock(e);n?this.parent!==n?this.moveBlockToParent(n,t):console.warn(`Node is already in parent ${e}`):console.error(`Cannot find the new parent block: ${e}`);}getField(e){for(const t of this.fields)if(t.name===e)return t;return null}hasTag(e){const t=this.getField("Tags");return !(!t||!Array.isArray(t.value))&&t.value.includes(e)}hasOneTag(e){const t=this.getField("Tags");if(t&&Array.isArray(t.value))for(const a of e)if(t.value.includes(a))return true;return false}getNameFieldValue(){const e=this.getField("Name");return e?e.value:null}getActiveFieldValue(){const e=this.getField("Active");return !e||e.value}createSnapshot(e=false){const t=[];for(const a of this.fields)a.createSnapshot&&t.push(a.createSnapshot(e));const a=[];if(!e)for(const t of this.blocks)a.push(t.createSnapshot(e));const n=[];for(const e of this.scripts)n.push(e.createSnapshot());return new W(this.id,"block",{id:this.id,ownerItem:this.ownerItem,subNodeId:this.subNodeId,type:this.type,name:this.name,displayName:this.displayName,fields:t,blocks:a,isExpanded:this.isExpanded,scripts:n,inputs:this.inputs,outputs:this.outputs,posX:this.posX,posY:this.posY})}restoreFromSnapshot(e,t){this.id=e.data.id,this.parent=t,this.subNodeId=e.data.subNodeId,this.type=e.data.type,this.ownerItem=e.data.ownerItem,this.name=e.data.name,this.displayName=e.data.displayName,this.isSelected=false,this.isExpanded=e.data.isExpanded,this.inputs=e.data.inputs,this.outputs=e.data.outputs,this.posX=e.data.posX,this.posY=e.data.posY;const a=[];this._rollbackArray(a,e.data.fields,(e=>y$1.instance.proxyBlockField(new ee(e),this,this.ownerItem))),this.fields=a;const n=[];this._rollbackArray(n,e.data.blocks,((e,t)=>y$1.instance.proxyBlock(new le(e,t),this.ownerItem))),this.blocks=y$1.instance.proxyBlockArray(n,this,this.ownerItem);const i=[];this._rollbackArray(i,e.data.scripts,((e,t)=>new Z(e,t,this.ownerItem))),this.scripts=y$1.instance.proxyScriptArray(i,this,this.ownerItem);}rollbackFromSnapshot(e,t=false){this._rollbackArray(this.fields,e.data.fields,(e=>y$1.instance.proxyBlockField(new ee(e),this,this.ownerItem))),this._rollbackArray(this.scripts,e.data.scripts,(e=>new Z(e,this,this.ownerItem))),t||this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>y$1.instance.proxyBlock(new le(e,t),this.ownerItem)));}_getFieldByName(e,t){for(const a of t)if(a.id===e)return a;return null}}
4613
- /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function ue$1(e){let t=e.length;for(;--t>=0;)e[t]=0;}const ce=256,de$1=286,pe=30,he=15,fe=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),me=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ye$1=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ge=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),be=new Array(576);ue$1(be);const ve=new Array(60);ue$1(ve);const we=new Array(512);ue$1(we);const _e=new Array(256);ue$1(_e);const Ae$1=new Array(29);ue$1(Ae$1);const ke=new Array(pe);function Se(e,t,a,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=a,this.elems=n,this.max_length=i,this.has_stree=e&&e.length;}let Ne,Te,Me;function xe(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t;}ue$1(ke);const Ce=e=>e<256?we[e]:we[256+(e>>>7)],Ve=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255;},Ie=(e,t,a)=>{e.bi_valid>16-a?(e.bi_buf|=t<<e.bi_valid&65535,Ve(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=a-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=a);},Ee=(e,t,a)=>{Ie(e,a[2*t],a[2*t+1]);},Fe=(e,t)=>{let a=0;do{a|=1&e,e>>>=1,a<<=1;}while(--t>0);return a>>>1},De=(e,t,a)=>{const n=new Array(16);let i,r,s=0;for(i=1;i<=he;i++)s=s+a[i-1]<<1,n[i]=s;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=Fe(n[t]++,t));}},Re=e=>{let t;for(t=0;t<de$1;t++)e.dyn_ltree[2*t]=0;for(t=0;t<pe;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0;},Le=e=>{e.bi_valid>8?Ve(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0;},Pe=(e,t,a,n)=>{const i=2*t,r=2*a;return e[i]<e[r]||e[i]===e[r]&&n[t]<=n[a]},Be=(e,t,a)=>{const n=e.heap[a];let i=a<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Pe(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Pe(t,n,e.heap[i],e.depth));)e.heap[a]=e.heap[i],a=i,i<<=1;e.heap[a]=n;},Oe=(e,t,a)=>{let n,i,r,s,o=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+o++],n+=(255&e.pending_buf[e.sym_buf+o++])<<8,i=e.pending_buf[e.sym_buf+o++],0===n?Ee(e,i,t):(r=_e[i],Ee(e,r+ce+1,t),s=fe[r],0!==s&&(i-=Ae$1[r],Ie(e,i,s)),n--,r=Ce(n),Ee(e,r,a),s=me[r],0!==s&&(n-=ke[r],Ie(e,n,s)));}while(o<e.sym_next);Ee(e,256,t);},$e=(e,t)=>{const a=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,r=t.stat_desc.elems;let s,o,l,u=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<r;s++)0!==a[2*s]?(e.heap[++e.heap_len]=u=s,e.depth[s]=0):a[2*s+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=u<2?++u:0,a[2*l]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=n[2*l+1]);for(t.max_code=u,s=e.heap_len>>1;s>=1;s--)Be(e,a,s);l=r;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Be(e,a,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,a[2*l]=a[2*s]+a[2*o],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,a[2*s+1]=a[2*o+1]=l,e.heap[1]=l++,Be(e,a,1);}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const a=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,p,h,f,m=0;for(p=0;p<=he;p++)e.bl_count[p]=0;for(a[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)c=e.heap[u],p=a[2*a[2*c+1]+1]+1,p>l&&(p=l,m++),a[2*c+1]=p,c>n||(e.bl_count[p]++,h=0,c>=o&&(h=s[c-o]),f=a[2*c],e.opt_len+=f*(p+h),r&&(e.static_len+=f*(i[2*c+1]+h)));if(0!==m){do{for(p=l-1;0===e.bl_count[p];)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[l]--,m-=2;}while(m>0);for(p=l;0!==p;p--)for(c=e.bl_count[p];0!==c;)d=e.heap[--u],d>n||(a[2*d+1]!==p&&(e.opt_len+=(p-a[2*d+1])*a[2*d],a[2*d+1]=p),c--);}})(e,t),De(a,u,e.bl_count);},Ue$1=(e,t,a)=>{let n,i,r=-1,s=t[1],o=0,l=7,u=4;for(0===s&&(l=138,u=3),t[2*(a+1)+1]=65535,n=0;n<=a;n++)i=s,s=t[2*(n+1)+1],++o<l&&i===s||(o<u?e.bl_tree[2*i]+=o:0!==i?(i!==r&&e.bl_tree[2*i]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,r=i,0===s?(l=138,u=3):i===s?(l=6,u=3):(l=7,u=4));},je=(e,t,a)=>{let n,i,r=-1,s=t[1],o=0,l=7,u=4;for(0===s&&(l=138,u=3),n=0;n<=a;n++)if(i=s,s=t[2*(n+1)+1],!(++o<l&&i===s)){if(o<u)do{Ee(e,i,e.bl_tree);}while(0!=--o);else 0!==i?(i!==r&&(Ee(e,i,e.bl_tree),o--),Ee(e,16,e.bl_tree),Ie(e,o-3,2)):o<=10?(Ee(e,17,e.bl_tree),Ie(e,o-3,3)):(Ee(e,18,e.bl_tree),Ie(e,o-11,7));o=0,r=i,0===s?(l=138,u=3):i===s?(l=6,u=3):(l=7,u=4);}};let ze=false;const We$1=(e,t,a,n)=>{Ie(e,0+(n?1:0),3),Le(e),Ve(e,a),Ve(e,~a),a&&e.pending_buf.set(e.window.subarray(t,t+a),e.pending),e.pending+=a;};var Ye=e=>{ze||((()=>{let e,t,a,n,i;const r=new Array(16);for(a=0,n=0;n<28;n++)for(Ae$1[n]=a,e=0;e<1<<fe[n];e++)_e[a++]=n;for(_e[a-1]=n,i=0,n=0;n<16;n++)for(ke[n]=i,e=0;e<1<<me[n];e++)we[i++]=n;for(i>>=7;n<pe;n++)for(ke[n]=i<<7,e=0;e<1<<me[n]-7;e++)we[256+i++]=n;for(t=0;t<=he;t++)r[t]=0;for(e=0;e<=143;)be[2*e+1]=8,e++,r[8]++;for(;e<=255;)be[2*e+1]=9,e++,r[9]++;for(;e<=279;)be[2*e+1]=7,e++,r[7]++;for(;e<=287;)be[2*e+1]=8,e++,r[8]++;for(De(be,287,r),e=0;e<pe;e++)ve[2*e+1]=5,ve[2*e]=Fe(e,5);Ne=new Se(be,fe,257,de$1,he),Te=new Se(ve,me,0,pe,he),Me=new Se(new Array(0),ye$1,0,19,7);})(),ze=true),e.l_desc=new xe(e.dyn_ltree,Ne),e.d_desc=new xe(e.dyn_dtree,Te),e.bl_desc=new xe(e.bl_tree,Me),e.bi_buf=0,e.bi_valid=0,Re(e);},He$1=(e,t,a,n)=>{let i,r,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,a=4093624447;for(t=0;t<=31;t++,a>>>=1)if(1&a&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<ce;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),$e(e,e.l_desc),$e(e,e.d_desc),s=(e=>{let t;for(Ue$1(e,e.dyn_ltree,e.l_desc.max_code),Ue$1(e,e.dyn_dtree,e.d_desc.max_code),$e(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ge[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=i&&(i=r)):i=r=a+5,a+4<=i&&-1!==t?We$1(e,t,a,n):4===e.strategy||r===i?(Ie(e,2+(n?1:0),3),Oe(e,be,ve)):(Ie(e,4+(n?1:0),3),((e,t,a,n)=>{let i;for(Ie(e,t-257,5),Ie(e,a-1,5),Ie(e,n-4,4),i=0;i<n;i++)Ie(e,e.bl_tree[2*ge[i]+1],3);je(e,e.dyn_ltree,t-1),je(e,e.dyn_dtree,a-1);})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Oe(e,e.dyn_ltree,e.dyn_dtree)),Re(e),n&&Le(e);},Ge={_tr_init:Ye,_tr_stored_block:We$1,_tr_flush_block:He$1,_tr_tally:(e,t,a)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=a,0===t?e.dyn_ltree[2*a]++:(e.matches++,t--,e.dyn_ltree[2*(_e[a]+ce+1)]++,e.dyn_dtree[2*Ce(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Ie(e,2,3),Ee(e,256,be),(e=>{16===e.bi_valid?(Ve(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8);})(e);}};var qe$1=(e,t,a,n)=>{let i=65535&e,r=e>>>16&65535,s=0;for(;0!==a;){s=a>2e3?2e3:a,a-=s;do{i=i+t[n++]|0,r=r+i|0;}while(--s);i%=65521,r%=65521;}return i|r<<16};const Ze$1=new Uint32Array((()=>{let e,t=[];for(var a=0;a<256;a++){e=a;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[a]=e;}return t})());var Je$1=(e,t,a,n)=>{const i=Ze$1,r=n+a;e^=-1;for(let a=n;a<r;a++)e=e>>>8^i[255&(e^t[a])];return ~e},Ke={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Xe={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Qe$1,_tr_stored_block:et$2,_tr_flush_block:tt,_tr_tally:at,_tr_align:nt}=Ge,{Z_NO_FLUSH:it$1,Z_PARTIAL_FLUSH:rt,Z_FULL_FLUSH:st,Z_FINISH:ot,Z_BLOCK:lt,Z_OK:ut,Z_STREAM_END:ct,Z_STREAM_ERROR:dt$1,Z_DATA_ERROR:pt,Z_BUF_ERROR:ht$1,Z_DEFAULT_COMPRESSION:ft,Z_FILTERED:mt,Z_HUFFMAN_ONLY:yt,Z_RLE:gt$1,Z_FIXED:bt,Z_DEFAULT_STRATEGY:vt,Z_UNKNOWN:wt,Z_DEFLATED:_t}=Xe,At=258,kt=262,St=42,Nt=113,Tt=666,Mt=(e,t)=>(e.msg=Ke[t],t),xt$1=e=>2*e-(e>4?9:0),Ct=e=>{let t=e.length;for(;--t>=0;)e[t]=0;},Vt=e=>{let t,a,n,i=e.w_size;t=e.hash_size,n=t;do{a=e.head[--n],e.head[n]=a>=i?a-i:0;}while(--t);t=i,n=t;do{a=e.prev[--n],e.prev[n]=a>=i?a-i:0;}while(--t)};let It=(e,t,a)=>(t<<e.hash_shift^a)&e.hash_mask;const Et$1=e=>{const t=e.state;let a=t.pending;a>e.avail_out&&(a=e.avail_out),0!==a&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+a),e.next_out),e.next_out+=a,t.pending_out+=a,e.total_out+=a,e.avail_out-=a,t.pending-=a,0===t.pending&&(t.pending_out=0));},Ft$1=(e,t)=>{tt(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Et$1(e.strm);},Dt=(e,t)=>{e.pending_buf[e.pending++]=t;},Rt=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t;},Lt=(e,t,a,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),a),1===e.state.wrap?e.adler=qe$1(e.adler,t,i,a):2===e.state.wrap&&(e.adler=Je$1(e.adler,t,i,a)),e.next_in+=i,e.total_in+=i,i)},Pt=(e,t)=>{let a,n,i=e.max_chain_length,r=e.strstart,s=e.prev_length,o=e.nice_match;const l=e.strstart>e.w_size-kt?e.strstart-(e.w_size-kt):0,u=e.window,c=e.w_mask,d=e.prev,p=e.strstart+At;let h=u[r+s-1],f=u[r+s];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(a=t,u[a+s]===f&&u[a+s-1]===h&&u[a]===u[r]&&u[++a]===u[r+1]){r+=2,a++;do{}while(u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&r<p);if(n=At-(p-r),r=p-At,n>s){if(e.match_start=t,s=n,n>=o)break;h=u[r+s-1],f=u[r+s];}}}while((t=d[t&c])>l&&0!=--i);return s<=e.lookahead?s:e.lookahead},Bt=e=>{const t=e.w_size;let a,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-kt)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Vt(e),n+=t),0===e.strm.avail_in)break;if(a=Lt(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=It(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=It(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<kt&&0!==e.strm.avail_in)},Ot=(e,t)=>{let a,n,i,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,o=e.strm.avail_in;do{if(a=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,a>n+e.strm.avail_in&&(a=n+e.strm.avail_in),a>i&&(a=i),a<r&&(0===a&&t!==ot||t===it$1||a!==n+e.strm.avail_in))break;s=t===ot&&a===n+e.strm.avail_in?1:0,et$2(e,0,0,s),e.pending_buf[e.pending-4]=a,e.pending_buf[e.pending-3]=a>>8,e.pending_buf[e.pending-2]=~a,e.pending_buf[e.pending-1]=~a>>8,Et$1(e.strm),n&&(n>a&&(n=a),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,a-=n),a&&(Lt(e.strm,e.strm.output,e.strm.next_out,a),e.strm.next_out+=a,e.strm.avail_out-=a,e.strm.total_out+=a);}while(0===s);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==it$1&&t!==ot&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(Lt(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,r=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=r||(n||t===ot)&&t!==it$1&&0===e.strm.avail_in&&n<=i)&&(a=n>i?i:n,s=t===ot&&0===e.strm.avail_in&&a===n?1:0,et$2(e,e.block_start,a,s),e.block_start+=a,Et$1(e.strm)),s?3:1)},$t=(e,t)=>{let a,n;for(;;){if(e.lookahead<kt){if(Bt(e),e.lookahead<kt&&t===it$1)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=It(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==a&&e.strstart-a<=e.w_size-kt&&(e.match_length=Pt(e,a)),e.match_length>=3)if(n=at(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=It(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;}while(0!=--e.match_length);e.strstart++;}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=It(e,e.ins_h,e.window[e.strstart+1]);else n=at(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Ft$1(e,false),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===ot?(Ft$1(e,true),0===e.strm.avail_out?3:4):e.sym_next&&(Ft$1(e,false),0===e.strm.avail_out)?1:2},Ut=(e,t)=>{let a,n,i;for(;;){if(e.lookahead<kt){if(Bt(e),e.lookahead<kt&&t===it$1)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=It(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==a&&e.prev_length<e.max_lazy_match&&e.strstart-a<=e.w_size-kt&&(e.match_length=Pt(e,a),e.match_length<=5&&(e.strategy===mt||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=at(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=It(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(Ft$1(e,false),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=at(e,0,e.window[e.strstart-1]),n&&Ft$1(e,false),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--;}return e.match_available&&(n=at(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===ot?(Ft$1(e,true),0===e.strm.avail_out?3:4):e.sym_next&&(Ft$1(e,false),0===e.strm.avail_out)?1:2};function jt(e,t,a,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=a,this.max_chain=n,this.func=i;}const zt=[new jt(0,0,0,0,Ot),new jt(4,4,8,4,$t),new jt(4,5,16,8,$t),new jt(4,6,32,32,$t),new jt(4,4,16,16,Ut),new jt(8,16,32,32,Ut),new jt(8,16,128,128,Ut),new jt(8,32,128,256,Ut),new jt(32,128,258,1024,Ut),new jt(32,258,258,4096,Ut)];function Wt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=_t,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Ct(this.dyn_ltree),Ct(this.dyn_dtree),Ct(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Ct(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ct(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}const Yt=e=>{if(!e)return 1;const t=e.state;return !t||t.strm!==e||t.status!==St&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Nt&&t.status!==Tt?1:0},Ht=e=>{if(Yt(e))return Mt(e,dt$1);e.total_in=e.total_out=0,e.data_type=wt;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?St:Nt,e.adler=2===t.wrap?0:1,t.last_flush=-2,Qe$1(t),ut},Gt=e=>{const t=Ht(e);var a;return t===ut&&((a=e.state).window_size=2*a.w_size,Ct(a.head),a.max_lazy_match=zt[a.level].max_lazy,a.good_match=zt[a.level].good_length,a.nice_match=zt[a.level].nice_length,a.max_chain_length=zt[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),t},qt=(e,t,a,n,i,r)=>{if(!e)return dt$1;let s=1;if(t===ft&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>9||a!==_t||n<8||n>15||t<0||t>9||r<0||r>bt||8===n&&1!==s)return Mt(e,dt$1);8===n&&(n=9);const o=new Wt;return e.state=o,o.strm=e,o.status=St,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=i+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<i+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=t,o.strategy=r,o.method=a,Gt(e)};var Zt=(e,t)=>{if(Yt(e)||t>lt||t<0)return e?Mt(e,dt$1):dt$1;const a=e.state;if(!e.output||0!==e.avail_in&&!e.input||a.status===Tt&&t!==ot)return Mt(e,0===e.avail_out?ht$1:dt$1);const n=a.last_flush;if(a.last_flush=t,0!==a.pending){if(Et$1(e),0===e.avail_out)return a.last_flush=-1,ut}else if(0===e.avail_in&&xt$1(t)<=xt$1(n)&&t!==ot)return Mt(e,ht$1);if(a.status===Tt&&0!==e.avail_in)return Mt(e,ht$1);if(a.status===St&&0===a.wrap&&(a.status=Nt),a.status===St){let t=_t+(a.w_bits-8<<4)<<8,n=-1;if(n=a.strategy>=yt||a.level<2?0:a.level<6?1:6===a.level?2:3,t|=n<<6,0!==a.strstart&&(t|=32),t+=31-t%31,Rt(a,t),0!==a.strstart&&(Rt(a,e.adler>>>16),Rt(a,65535&e.adler)),e.adler=1,a.status=Nt,Et$1(e),0!==a.pending)return a.last_flush=-1,ut}if(57===a.status)if(e.adler=0,Dt(a,31),Dt(a,139),Dt(a,8),a.gzhead)Dt(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),Dt(a,255&a.gzhead.time),Dt(a,a.gzhead.time>>8&255),Dt(a,a.gzhead.time>>16&255),Dt(a,a.gzhead.time>>24&255),Dt(a,9===a.level?2:a.strategy>=yt||a.level<2?4:0),Dt(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(Dt(a,255&a.gzhead.extra.length),Dt(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=Je$1(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(Dt(a,0),Dt(a,0),Dt(a,0),Dt(a,0),Dt(a,0),Dt(a,9===a.level?2:a.strategy>=yt||a.level<2?4:0),Dt(a,3),a.status=Nt,Et$1(e),0!==a.pending)return a.last_flush=-1,ut;if(69===a.status){if(a.gzhead.extra){let t=a.pending,n=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+n>a.pending_buf_size;){let i=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+i),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>t&&(e.adler=Je$1(e.adler,a.pending_buf,a.pending-t,t)),a.gzindex+=i,Et$1(e),0!==a.pending)return a.last_flush=-1,ut;t=0,n-=i;}let i=new Uint8Array(a.gzhead.extra);a.pending_buf.set(i.subarray(a.gzindex,a.gzindex+n),a.pending),a.pending+=n,a.gzhead.hcrc&&a.pending>t&&(e.adler=Je$1(e.adler,a.pending_buf,a.pending-t,t)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){let t,n=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>n&&(e.adler=Je$1(e.adler,a.pending_buf,a.pending-n,n)),Et$1(e),0!==a.pending)return a.last_flush=-1,ut;n=0;}t=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,Dt(a,t);}while(0!==t);a.gzhead.hcrc&&a.pending>n&&(e.adler=Je$1(e.adler,a.pending_buf,a.pending-n,n)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){let t,n=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>n&&(e.adler=Je$1(e.adler,a.pending_buf,a.pending-n,n)),Et$1(e),0!==a.pending)return a.last_flush=-1,ut;n=0;}t=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,Dt(a,t);}while(0!==t);a.gzhead.hcrc&&a.pending>n&&(e.adler=Je$1(e.adler,a.pending_buf,a.pending-n,n));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(Et$1(e),0!==a.pending))return a.last_flush=-1,ut;Dt(a,255&e.adler),Dt(a,e.adler>>8&255),e.adler=0;}if(a.status=Nt,Et$1(e),0!==a.pending)return a.last_flush=-1,ut}if(0!==e.avail_in||0!==a.lookahead||t!==it$1&&a.status!==Tt){let n=0===a.level?Ot(a,t):a.strategy===yt?((e,t)=>{let a;for(;;){if(0===e.lookahead&&(Bt(e),0===e.lookahead)){if(t===it$1)return 1;break}if(e.match_length=0,a=at(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,a&&(Ft$1(e,false),0===e.strm.avail_out))return 1}return e.insert=0,t===ot?(Ft$1(e,true),0===e.strm.avail_out?3:4):e.sym_next&&(Ft$1(e,false),0===e.strm.avail_out)?1:2})(a,t):a.strategy===gt$1?((e,t)=>{let a,n,i,r;const s=e.window;for(;;){if(e.lookahead<=At){if(Bt(e),e.lookahead<=At&&t===it$1)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){r=e.strstart+At;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<r);e.match_length=At-(r-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead);}if(e.match_length>=3?(a=at(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(a=at(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),a&&(Ft$1(e,false),0===e.strm.avail_out))return 1}return e.insert=0,t===ot?(Ft$1(e,true),0===e.strm.avail_out?3:4):e.sym_next&&(Ft$1(e,false),0===e.strm.avail_out)?1:2})(a,t):zt[a.level].func(a,t);if(3!==n&&4!==n||(a.status=Tt),1===n||3===n)return 0===e.avail_out&&(a.last_flush=-1),ut;if(2===n&&(t===rt?nt(a):t!==lt&&(et$2(a,0,0,false),t===st&&(Ct(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),Et$1(e),0===e.avail_out))return a.last_flush=-1,ut}return t!==ot?ut:a.wrap<=0?ct:(2===a.wrap?(Dt(a,255&e.adler),Dt(a,e.adler>>8&255),Dt(a,e.adler>>16&255),Dt(a,e.adler>>24&255),Dt(a,255&e.total_in),Dt(a,e.total_in>>8&255),Dt(a,e.total_in>>16&255),Dt(a,e.total_in>>24&255)):(Rt(a,e.adler>>>16),Rt(a,65535&e.adler)),Et$1(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?ut:ct)},Jt={deflateInit:(e,t)=>qt(e,t,_t,15,8,vt),deflateInit2:qt,deflateReset:Gt,deflateResetKeep:Ht,deflateSetHeader:(e,t)=>Yt(e)||2!==e.state.wrap?dt$1:(e.state.gzhead=t,ut),deflate:Zt,deflateEnd:e=>{if(Yt(e))return dt$1;const t=e.state.status;return e.state=null,t===Nt?Mt(e,pt):ut},deflateSetDictionary:(e,t)=>{let a=t.length;if(Yt(e))return dt$1;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==St||n.lookahead)return dt$1;if(1===i&&(e.adler=qe$1(e.adler,t,a,0)),n.wrap=0,a>=n.w_size){0===i&&(Ct(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(a-n.w_size,a),0),t=e,a=n.w_size;}const r=e.avail_in,s=e.next_in,o=e.input;for(e.avail_in=a,e.next_in=0,e.input=t,Bt(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=It(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++;}while(--t);n.strstart=e,n.lookahead=2,Bt(n);}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=s,e.input=o,e.avail_in=r,n.wrap=i,ut},deflateInfo:"pako deflate (from Nodeca project)"};const Kt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Xt=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const a=t.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const t in a)Kt(a,t)&&(e[t]=a[t]);}}return e},Qt=e=>{let t=0;for(let a=0,n=e.length;a<n;a++)t+=e[a].length;const a=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];a.set(i,n),n+=i.length;}return a};let ea=true;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(e){ea=false;}const ta=new Uint8Array(256);for(let e=0;e<256;e++)ta[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;ta[254]=ta[254]=1;var aa=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return (new TextEncoder).encode(e);let t,a,n,i,r,s=e.length,o=0;for(i=0;i<s;i++)a=e.charCodeAt(i),55296==(64512&a)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),i++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(t=new Uint8Array(o),r=0,i=0;r<o;i++)a=e.charCodeAt(i),55296==(64512&a)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),i++)),a<128?t[r++]=a:a<2048?(t[r++]=192|a>>>6,t[r++]=128|63&a):a<65536?(t[r++]=224|a>>>12,t[r++]=128|a>>>6&63,t[r++]=128|63&a):(t[r++]=240|a>>>18,t[r++]=128|a>>>12&63,t[r++]=128|a>>>6&63,t[r++]=128|63&a);return t},na=(e,t)=>{const a=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return (new TextDecoder).decode(e.subarray(0,t));let n,i;const r=new Array(2*a);for(i=0,n=0;n<a;){let t=e[n++];if(t<128){r[i++]=t;continue}let s=ta[t];if(s>4)r[i++]=65533,n+=s-1;else {for(t&=2===s?31:3===s?15:7;s>1&&n<a;)t=t<<6|63&e[n++],s--;s>1?r[i++]=65533:t<65536?r[i++]=t:(t-=65536,r[i++]=55296|t>>10&1023,r[i++]=56320|1023&t);}}return ((e,t)=>{if(t<65534&&e.subarray&&ea)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let a="";for(let n=0;n<t;n++)a+=String.fromCharCode(e[n]);return a})(r,i)},ia=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let a=t-1;for(;a>=0&&128==(192&e[a]);)a--;return a<0||0===a?t:a+ta[e[a]]>t?a:t};var ra=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};const sa=Object.prototype.toString,{Z_NO_FLUSH:oa,Z_SYNC_FLUSH:la,Z_FULL_FLUSH:ua,Z_FINISH:ca,Z_OK:da,Z_STREAM_END:pa,Z_DEFAULT_COMPRESSION:ha,Z_DEFAULT_STRATEGY:fa,Z_DEFLATED:ma}=Xe;function ya(e){this.options=Xt({level:ha,method:ma,chunkSize:16384,windowBits:15,memLevel:8,strategy:fa},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=false,this.chunks=[],this.strm=new ra,this.strm.avail_out=0;let a=Jt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(a!==da)throw new Error(Ke[a]);if(t.header&&Jt.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?aa(t.dictionary):"[object ArrayBuffer]"===sa.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,a=Jt.deflateSetDictionary(this.strm,e),a!==da)throw new Error(Ke[a]);this._dict_set=true;}}function ga(e,t){const a=new ya(t);if(a.push(e,true),a.err)throw a.msg||Ke[a.err];return a.result}ya.prototype.push=function(e,t){const a=this.strm,n=this.options.chunkSize;let i,r;if(this.ended)return false;for(r=t===~~t?t:true===t?ca:oa,"string"==typeof e?a.input=aa(e):"[object ArrayBuffer]"===sa.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(n),a.next_out=0,a.avail_out=n),(r===la||r===ua)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else {if(i=Jt.deflate(a,r),i===pa)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),i=Jt.deflateEnd(this.strm),this.onEnd(i),this.ended=true,i===da;if(0!==a.avail_out){if(r>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output);}return true},ya.prototype.onData=function(e){this.chunks.push(e);},ya.prototype.onEnd=function(e){e===da&&(this.result=Qt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg;};var ba=function(e,t){return (t=t||{}).raw=true,ga(e,t)},va=function(e,t){return (t=t||{}).gzip=true,ga(e,t)},wa={Deflate:ya,deflate:ga,deflateRaw:ba,gzip:va};const _a$2=16209;var Aa=function(e,t){let a,n,i,r,s,o,l,u,c,d,p,h,f,m,y,g,b,v,w,_,A,k,S,N;const T=e.state;a=e.next_in,S=e.input,n=a+(e.avail_in-5),i=e.next_out,N=e.output,r=i-(t-e.avail_out),s=i+(e.avail_out-257),o=T.dmax,l=T.wsize,u=T.whave,c=T.wnext,d=T.window,p=T.hold,h=T.bits,f=T.lencode,m=T.distcode,y=(1<<T.lenbits)-1,g=(1<<T.distbits)-1;e:do{h<15&&(p+=S[a++]<<h,h+=8,p+=S[a++]<<h,h+=8),b=f[p&y];t:for(;;){if(v=b>>>24,p>>>=v,h-=v,v=b>>>16&255,0===v)N[i++]=65535&b;else {if(!(16&v)){if(64&v){if(32&v){T.mode=16191;break e}e.msg="invalid literal/length code",T.mode=_a$2;break e}b=f[(65535&b)+(p&(1<<v)-1)];continue t}for(w=65535&b,v&=15,v&&(h<v&&(p+=S[a++]<<h,h+=8),w+=p&(1<<v)-1,p>>>=v,h-=v),h<15&&(p+=S[a++]<<h,h+=8,p+=S[a++]<<h,h+=8),b=m[p&g];;){if(v=b>>>24,p>>>=v,h-=v,v=b>>>16&255,16&v){if(_=65535&b,v&=15,h<v&&(p+=S[a++]<<h,h+=8,h<v&&(p+=S[a++]<<h,h+=8)),_+=p&(1<<v)-1,_>o){e.msg="invalid distance too far back",T.mode=_a$2;break e}if(p>>>=v,h-=v,v=i-r,_>v){if(v=_-v,v>u&&T.sane){e.msg="invalid distance too far back",T.mode=_a$2;break e}if(A=0,k=d,0===c){if(A+=l-v,v<w){w-=v;do{N[i++]=d[A++];}while(--v);A=i-_,k=N;}}else if(c<v){if(A+=l+c-v,v-=c,v<w){w-=v;do{N[i++]=d[A++];}while(--v);if(A=0,c<w){v=c,w-=v;do{N[i++]=d[A++];}while(--v);A=i-_,k=N;}}}else if(A+=c-v,v<w){w-=v;do{N[i++]=d[A++];}while(--v);A=i-_,k=N;}for(;w>2;)N[i++]=k[A++],N[i++]=k[A++],N[i++]=k[A++],w-=3;w&&(N[i++]=k[A++],w>1&&(N[i++]=k[A++]));}else {A=i-_;do{N[i++]=N[A++],N[i++]=N[A++],N[i++]=N[A++],w-=3;}while(w>2);w&&(N[i++]=N[A++],w>1&&(N[i++]=N[A++]));}break}if(64&v){e.msg="invalid distance code",T.mode=_a$2;break e}b=m[(65535&b)+(p&(1<<v)-1)];}}break}}while(a<n&&i<s);w=h>>3,a-=w,h-=w<<3,p&=(1<<h)-1,e.next_in=a,e.next_out=i,e.avail_in=a<n?n-a+5:5-(a-n),e.avail_out=i<s?s-i+257:257-(i-s),T.hold=p,T.bits=h;};const ka=15,Sa=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Na=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ta=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ma=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var xa=(e,t,a,n,i,r,s,o)=>{const l=o.bits;let u,c,d,p,h,f,m=0,y=0,g=0,b=0,v=0,w=0,_=0,A=0,k=0,S=0,N=null;const T=new Uint16Array(16),M=new Uint16Array(16);let x,C,V,I=null;for(m=0;m<=ka;m++)T[m]=0;for(y=0;y<n;y++)T[t[a+y]]++;for(v=l,b=ka;b>=1&&0===T[b];b--);if(v>b&&(v=b),0===b)return i[r++]=20971520,i[r++]=20971520,o.bits=1,0;for(g=1;g<b&&0===T[g];g++);for(v<g&&(v=g),A=1,m=1;m<=ka;m++)if(A<<=1,A-=T[m],A<0)return -1;if(A>0&&(0===e||1!==b))return -1;for(M[1]=0,m=1;m<ka;m++)M[m+1]=M[m]+T[m];for(y=0;y<n;y++)0!==t[a+y]&&(s[M[t[a+y]]++]=y);if(0===e?(N=I=s,f=20):1===e?(N=Sa,I=Na,f=257):(N=Ta,I=Ma,f=0),S=0,y=0,m=g,h=r,w=v,_=0,d=-1,k=1<<v,p=k-1,1===e&&k>852||2===e&&k>592)return 1;for(;;){x=m-_,s[y]+1<f?(C=0,V=s[y]):s[y]>=f?(C=I[s[y]-f],V=N[s[y]-f]):(C=96,V=0),u=1<<m-_,c=1<<w,g=c;do{c-=u,i[h+(S>>_)+c]=x<<24|C<<16|V;}while(0!==c);for(u=1<<m-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,y++,0==--T[m]){if(m===b)break;m=t[a+s[y]];}if(m>v&&(S&p)!==d){for(0===_&&(_=v),h+=g,w=m-_,A=1<<w;w+_<b&&(A-=T[w+_],!(A<=0));)w++,A<<=1;if(k+=1<<w,1===e&&k>852||2===e&&k>592)return 1;d=S&p,i[d]=v<<24|w<<16|h-r;}}return 0!==S&&(i[h+S]=m-_<<24|64<<16),o.bits=v,0};const{Z_FINISH:Ca,Z_BLOCK:Va,Z_TREES:Ia,Z_OK:Ea,Z_STREAM_END:Fa,Z_NEED_DICT:Da,Z_STREAM_ERROR:Ra,Z_DATA_ERROR:La,Z_MEM_ERROR:Pa,Z_BUF_ERROR:Ba,Z_DEFLATED:Oa}=Xe,$a=16180,Ua=16190,ja=16191,za=16192,Wa=16194,Ya=16199,Ha=16200,Ga=16206,qa=16209,Za=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ja(){this.strm=null,this.mode=0,this.last=false,this.wrap=0,this.havedict=false,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}const Ka=e=>{if(!e)return 1;const t=e.state;return !t||t.strm!==e||t.mode<$a||t.mode>16211?1:0},Xa=e=>{if(Ka(e))return Ra;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=$a,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Ea},Qa=e=>{if(Ka(e))return Ra;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Xa(e)},en$1=(e,t)=>{let a;if(Ka(e))return Ra;const n=e.state;return t<0?(a=0,t=-t):(a=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Ra:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=a,n.wbits=t,Qa(e))},tn=(e,t)=>{if(!e)return Ra;const a=new Ja;e.state=a,a.strm=e,a.window=null,a.mode=$a;const n=en$1(e,t);return n!==Ea&&(e.state=null),n};let an$1,nn$1,rn$1=true;const sn$1=e=>{if(rn$1){an$1=new Int32Array(512),nn$1=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(xa(1,e.lens,0,288,an$1,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;xa(2,e.lens,0,32,nn$1,0,e.work,{bits:5}),rn$1=false;}e.lencode=an$1,e.lenbits=9,e.distcode=nn$1,e.distbits=5;},on$1=(e,t,a,n)=>{let i;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),n>=r.wsize?(r.window.set(t.subarray(a-r.wsize,a),0),r.wnext=0,r.whave=r.wsize):(i=r.wsize-r.wnext,i>n&&(i=n),r.window.set(t.subarray(a-n,a-n+i),r.wnext),(n-=i)?(r.window.set(t.subarray(a-n,a),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=i,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=i))),0};var ln=(e,t)=>{let a,n,i,r,s,o,l,u,c,d,p,h,f,m,y,g,b,v,w,_,A,k,S=0;const N=new Uint8Array(4);let T,M;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ka(e)||!e.output||!e.input&&0!==e.avail_in)return Ra;a=e.state,a.mode===ja&&(a.mode=za),s=e.next_out,i=e.output,l=e.avail_out,r=e.next_in,n=e.input,o=e.avail_in,u=a.hold,c=a.bits,d=o,p=l,k=Ea;e:for(;;)switch(a.mode){case $a:if(0===a.wrap){a.mode=za;break}for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if(2&a.wrap&&35615===u){0===a.wbits&&(a.wbits=15),a.check=0,N[0]=255&u,N[1]=u>>>8&255,a.check=Je$1(a.check,N,2,0),u=0,c=0,a.mode=16181;break}if(a.head&&(a.head.done=false),!(1&a.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",a.mode=qa;break}if((15&u)!==Oa){e.msg="unknown compression method",a.mode=qa;break}if(u>>>=4,c-=4,A=8+(15&u),0===a.wbits&&(a.wbits=A),A>15||A>a.wbits){e.msg="invalid window size",a.mode=qa;break}a.dmax=1<<a.wbits,a.flags=0,e.adler=a.check=1,a.mode=512&u?16189:ja,u=0,c=0;break;case 16181:for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if(a.flags=u,(255&a.flags)!==Oa){e.msg="unknown compression method",a.mode=qa;break}if(57344&a.flags){e.msg="unknown header flags set",a.mode=qa;break}a.head&&(a.head.text=u>>8&1),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=Je$1(a.check,N,2,0)),u=0,c=0,a.mode=16182;case 16182:for(;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}a.head&&(a.head.time=u),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,N[2]=u>>>16&255,N[3]=u>>>24&255,a.check=Je$1(a.check,N,4,0)),u=0,c=0,a.mode=16183;case 16183:for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}a.head&&(a.head.xflags=255&u,a.head.os=u>>8),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=Je$1(a.check,N,2,0)),u=0,c=0,a.mode=16184;case 16184:if(1024&a.flags){for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}a.length=u,a.head&&(a.head.extra_len=u),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=Je$1(a.check,N,2,0)),u=0,c=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(h=a.length,h>o&&(h=o),h&&(a.head&&(A=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(n.subarray(r,r+h),A)),512&a.flags&&4&a.wrap&&(a.check=Je$1(a.check,n,h,r)),o-=h,r+=h,a.length-=h),a.length))break e;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break e;h=0;do{A=n[r+h++],a.head&&A&&a.length<65536&&(a.head.name+=String.fromCharCode(A));}while(A&&h<o);if(512&a.flags&&4&a.wrap&&(a.check=Je$1(a.check,n,h,r)),o-=h,r+=h,A)break e}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break e;h=0;do{A=n[r+h++],a.head&&A&&a.length<65536&&(a.head.comment+=String.fromCharCode(A));}while(A&&h<o);if(512&a.flags&&4&a.wrap&&(a.check=Je$1(a.check,n,h,r)),o-=h,r+=h,A)break e}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if(4&a.wrap&&u!==(65535&a.check)){e.msg="header crc mismatch",a.mode=qa;break}u=0,c=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=true),e.adler=a.check=0,a.mode=ja;break;case 16189:for(;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}e.adler=a.check=Za(u),u=0,c=0,a.mode=Ua;case Ua:if(0===a.havedict)return e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,Da;e.adler=a.check=1,a.mode=ja;case ja:if(t===Va||t===Ia)break e;case za:if(a.last){u>>>=7&c,c-=7&c,a.mode=Ga;break}for(;c<3;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}switch(a.last=1&u,u>>>=1,c-=1,3&u){case 0:a.mode=16193;break;case 1:if(sn$1(a),a.mode=Ya,t===Ia){u>>>=2,c-=2;break e}break;case 2:a.mode=16196;break;case 3:e.msg="invalid block type",a.mode=qa;}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",a.mode=qa;break}if(a.length=65535&u,u=0,c=0,a.mode=Wa,t===Ia)break e;case Wa:a.mode=16195;case 16195:if(h=a.length,h){if(h>o&&(h=o),h>l&&(h=l),0===h)break e;i.set(n.subarray(r,r+h),s),o-=h,r+=h,l-=h,s+=h,a.length-=h;break}a.mode=ja;break;case 16196:for(;c<14;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if(a.nlen=257+(31&u),u>>>=5,c-=5,a.ndist=1+(31&u),u>>>=5,c-=5,a.ncode=4+(15&u),u>>>=4,c-=4,a.nlen>286||a.ndist>30){e.msg="too many length or distance symbols",a.mode=qa;break}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;c<3;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}a.lens[x[a.have++]]=7&u,u>>>=3,c-=3;}for(;a.have<19;)a.lens[x[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,T={bits:a.lenbits},k=xa(0,a.lens,0,19,a.lencode,0,a.work,T),a.lenbits=T.bits,k){e.msg="invalid code lengths set",a.mode=qa;break}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;S=a.lencode[u&(1<<a.lenbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if(b<16)u>>>=y,c-=y,a.lens[a.have++]=b;else {if(16===b){for(M=y+2;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if(u>>>=y,c-=y,0===a.have){e.msg="invalid bit length repeat",a.mode=qa;break}A=a.lens[a.have-1],h=3+(3&u),u>>>=2,c-=2;}else if(17===b){for(M=y+3;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}u>>>=y,c-=y,A=0,h=3+(7&u),u>>>=3,c-=3;}else {for(M=y+7;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}u>>>=y,c-=y,A=0,h=11+(127&u),u>>>=7,c-=7;}if(a.have+h>a.nlen+a.ndist){e.msg="invalid bit length repeat",a.mode=qa;break}for(;h--;)a.lens[a.have++]=A;}}if(a.mode===qa)break;if(0===a.lens[256]){e.msg="invalid code -- missing end-of-block",a.mode=qa;break}if(a.lenbits=9,T={bits:a.lenbits},k=xa(1,a.lens,0,a.nlen,a.lencode,0,a.work,T),a.lenbits=T.bits,k){e.msg="invalid literal/lengths set",a.mode=qa;break}if(a.distbits=6,a.distcode=a.distdyn,T={bits:a.distbits},k=xa(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,T),a.distbits=T.bits,k){e.msg="invalid distances set",a.mode=qa;break}if(a.mode=Ya,t===Ia)break e;case Ya:a.mode=Ha;case Ha:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,Aa(e,p),s=e.next_out,i=e.output,l=e.avail_out,r=e.next_in,n=e.input,o=e.avail_in,u=a.hold,c=a.bits,a.mode===ja&&(a.back=-1);break}for(a.back=0;S=a.lencode[u&(1<<a.lenbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if(g&&!(240&g)){for(v=y,w=g,_=b;S=a.lencode[_+((u&(1<<v+w)-1)>>v)],y=S>>>24,g=S>>>16&255,b=65535&S,!(v+y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}u>>>=v,c-=v,a.back+=v;}if(u>>>=y,c-=y,a.back+=y,a.length=b,0===g){a.mode=16205;break}if(32&g){a.back=-1,a.mode=ja;break}if(64&g){e.msg="invalid literal/length code",a.mode=qa;break}a.extra=15&g,a.mode=16201;case 16201:if(a.extra){for(M=a.extra;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}a.length+=u&(1<<a.extra)-1,u>>>=a.extra,c-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;S=a.distcode[u&(1<<a.distbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if(!(240&g)){for(v=y,w=g,_=b;S=a.distcode[_+((u&(1<<v+w)-1)>>v)],y=S>>>24,g=S>>>16&255,b=65535&S,!(v+y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}u>>>=v,c-=v,a.back+=v;}if(u>>>=y,c-=y,a.back+=y,64&g){e.msg="invalid distance code",a.mode=qa;break}a.offset=b,a.extra=15&g,a.mode=16203;case 16203:if(a.extra){for(M=a.extra;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}a.offset+=u&(1<<a.extra)-1,u>>>=a.extra,c-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){e.msg="invalid distance too far back",a.mode=qa;break}a.mode=16204;case 16204:if(0===l)break e;if(h=p-l,a.offset>h){if(h=a.offset-h,h>a.whave&&a.sane){e.msg="invalid distance too far back",a.mode=qa;break}h>a.wnext?(h-=a.wnext,f=a.wsize-h):f=a.wnext-h,h>a.length&&(h=a.length),m=a.window;}else m=i,f=s-a.offset,h=a.length;h>l&&(h=l),l-=h,a.length-=h;do{i[s++]=m[f++];}while(--h);0===a.length&&(a.mode=Ha);break;case 16205:if(0===l)break e;i[s++]=a.length,l--,a.mode=Ha;break;case Ga:if(a.wrap){for(;c<32;){if(0===o)break e;o--,u|=n[r++]<<c,c+=8;}if(p-=l,e.total_out+=p,a.total+=p,4&a.wrap&&p&&(e.adler=a.check=a.flags?Je$1(a.check,i,p,s-p):qe$1(a.check,i,p,s-p)),p=l,4&a.wrap&&(a.flags?u:Za(u))!==a.check){e.msg="incorrect data check",a.mode=qa;break}u=0,c=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8;}if(4&a.wrap&&u!==(4294967295&a.total)){e.msg="incorrect length check",a.mode=qa;break}u=0,c=0;}a.mode=16208;case 16208:k=Fa;break e;case qa:k=La;break e;case 16210:return Pa;default:return Ra}return e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,(a.wsize||p!==e.avail_out&&a.mode<qa&&(a.mode<Ga||t!==Ca))&&on$1(e,e.output,e.next_out,p-e.avail_out),d-=e.avail_in,p-=e.avail_out,e.total_in+=d,e.total_out+=p,a.total+=p,4&a.wrap&&p&&(e.adler=a.check=a.flags?Je$1(a.check,i,p,e.next_out-p):qe$1(a.check,i,p,e.next_out-p)),e.data_type=a.bits+(a.last?64:0)+(a.mode===ja?128:0)+(a.mode===Ya||a.mode===Wa?256:0),(0===d&&0===p||t===Ca)&&k===Ea&&(k=Ba),k},un={inflateReset:Qa,inflateReset2:en$1,inflateResetKeep:Xa,inflateInit:e=>tn(e,15),inflateInit2:tn,inflate:ln,inflateEnd:e=>{if(Ka(e))return Ra;let t=e.state;return t.window&&(t.window=null),e.state=null,Ea},inflateGetHeader:(e,t)=>{if(Ka(e))return Ra;const a=e.state;return 2&a.wrap?(a.head=t,t.done=false,Ea):Ra},inflateSetDictionary:(e,t)=>{const a=t.length;let n,i,r;return Ka(e)?Ra:(n=e.state,0!==n.wrap&&n.mode!==Ua?Ra:n.mode===Ua&&(i=1,i=qe$1(i,t,a,0),i!==n.check)?La:(r=on$1(e,t,a,a),r?(n.mode=16210,Pa):(n.havedict=1,Ea)))},inflateInfo:"pako inflate (from Nodeca project)"};var cn$1=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=false;};const dn$1=Object.prototype.toString,{Z_NO_FLUSH:pn$1,Z_FINISH:hn,Z_OK:fn,Z_STREAM_END:mn$1,Z_NEED_DICT:yn$1,Z_STREAM_ERROR:gn,Z_DATA_ERROR:bn$1,Z_MEM_ERROR:vn}=Xe;function wn$1(e){this.options=Xt({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=false,this.chunks=[],this.strm=new ra,this.strm.avail_out=0;let a=un.inflateInit2(this.strm,t.windowBits);if(a!==fn)throw new Error(Ke[a]);if(this.header=new cn$1,un.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=aa(t.dictionary):"[object ArrayBuffer]"===dn$1.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(a=un.inflateSetDictionary(this.strm,t.dictionary),a!==fn)))throw new Error(Ke[a])}function _n(e,t){const a=new wn$1(t);if(a.push(e),a.err)throw a.msg||Ke[a.err];return a.result}wn$1.prototype.push=function(e,t){const a=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let r,s,o;if(this.ended)return false;for(s=t===~~t?t:true===t?hn:pn$1,"[object ArrayBuffer]"===dn$1.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(n),a.next_out=0,a.avail_out=n),r=un.inflate(a,s),r===yn$1&&i&&(r=un.inflateSetDictionary(a,i),r===fn?r=un.inflate(a,s):r===bn$1&&(r=yn$1));a.avail_in>0&&r===mn$1&&a.state.wrap>0&&0!==e[a.next_in];)un.inflateReset(a),r=un.inflate(a,s);switch(r){case gn:case bn$1:case yn$1:case vn:return this.onEnd(r),this.ended=true,false}if(o=a.avail_out,a.next_out&&(0===a.avail_out||r===mn$1))if("string"===this.options.to){let e=ia(a.output,a.next_out),t=a.next_out-e,i=na(a.output,e);a.next_out=t,a.avail_out=n-t,t&&a.output.set(a.output.subarray(e,e+t),0),this.onData(i);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(r!==fn||0!==o){if(r===mn$1)return r=un.inflateEnd(this.strm),this.onEnd(r),this.ended=true,true;if(0===a.avail_in)break}}return true},wn$1.prototype.onData=function(e){this.chunks.push(e);},wn$1.prototype.onEnd=function(e){e===fn&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Qt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg;};var An=function(e,t){return (t=t||{}).raw=true,_n(e,t)},kn={Inflate:wn$1,inflate:_n,inflateRaw:An,ungzip:_n};const{Deflate:Sn,deflate:Nn,deflateRaw:Tn,gzip:Mn}=wa,{Inflate:xn$1,inflate:Cn$1,inflateRaw:Vn$1,ungzip:In}=kn;var En={Deflate:Sn,deflate:Nn,deflateRaw:Tn,gzip:Mn,Inflate:xn$1,inflate:Cn$1,inflateRaw:Vn$1,ungzip:In,constants:Xe},Fn$2="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Dn$1=[],Rn=[],Ln="undefined"!=typeof Uint8Array?Uint8Array:Array,Pn=false;function Bn(){Pn=true;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)Dn$1[t]=e[t],Rn[e.charCodeAt(t)]=t;Rn["-".charCodeAt(0)]=62,Rn["_".charCodeAt(0)]=63;}function On(e,t,a){for(var n,i,r=[],s=t;s<a;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],r.push(Dn$1[(i=n)>>18&63]+Dn$1[i>>12&63]+Dn$1[i>>6&63]+Dn$1[63&i]);return r.join("")}function $n(e){var t;Pn||Bn();for(var a=e.length,n=a%3,i="",r=[],s=16383,o=0,l=a-n;o<l;o+=s)r.push(On(e,o,o+s>l?l:o+s));return 1===n?(t=e[a-1],i+=Dn$1[t>>2],i+=Dn$1[t<<4&63],i+="=="):2===n&&(t=(e[a-2]<<8)+e[a-1],i+=Dn$1[t>>10],i+=Dn$1[t>>4&63],i+=Dn$1[t<<2&63],i+="="),r.push(i),r.join("")}function Un$1(e,t,a,n,i){var r,s,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,d=a?i-1:0,p=a?-1:1,h=e[t+d];for(d+=p,r=h&(1<<-c)-1,h>>=-c,c+=o;c>0;r=256*r+e[t+d],d+=p,c-=8);for(s=r&(1<<-c)-1,r>>=-c,c+=n;c>0;s=256*s+e[t+d],d+=p,c-=8);if(0===r)r=1-u;else {if(r===l)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),r-=u;}return (h?-1:1)*s*Math.pow(2,r-n)}function jn(e,t,a,n,i,r){var s,o,l,u=8*r-i-1,c=(1<<u)-1,d=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:r-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=c?(o=0,s=c):s+d>=1?(o=(t*l-1)*Math.pow(2,i),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[a+h]=255&o,h+=f,o/=256,i-=8);for(s=s<<i|o,u+=i;u>0;e[a+h]=255&s,h+=f,s/=256,u-=8);e[a+h-f]|=128*m;}var zn={}.toString,Wn=Array.isArray||function(e){return "[object Array]"==zn.call(e)};function Yn(){return Gn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Hn(e,t){if(Yn()<t)throw new RangeError("Invalid typed array length");return Gn.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Gn.prototype:(null===e&&(e=new Gn(t)),e.length=t),e}function Gn(e,t,a){if(!(Gn.TYPED_ARRAY_SUPPORT||this instanceof Gn))return new Gn(e,t,a);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Jn(this,e)}return qn(this,e,t,a)}function qn(e,t,a,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return "undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,a,n){if(t.byteLength,a<0||t.byteLength<a)throw new RangeError("'offset' is out of bounds");if(t.byteLength<a+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===a&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,a):new Uint8Array(t,a,n);Gn.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Gn.prototype:e=Kn(e,t);return e}(e,t,a,n):"string"==typeof t?function(e,t,a){"string"==typeof a&&""!==a||(a="utf8");if(!Gn.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');var n=0|ei(t,a);e=Hn(e,n);var i=e.write(t,a);i!==n&&(e=e.slice(0,i));return e}(e,t,a):function(e,t){if(Qn(t)){var a=0|Xn(t.length);return 0===(e=Hn(e,a)).length||t.copy(e,0,0,a),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return "number"!=typeof t.length||(n=t.length)!=n?Hn(e,0):Kn(e,t);if("Buffer"===t.type&&Wn(t.data))return Kn(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Zn(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Jn(e,t){if(Zn(t),e=Hn(e,t<0?0:0|Xn(t)),!Gn.TYPED_ARRAY_SUPPORT)for(var a=0;a<t;++a)e[a]=0;return e}function Kn(e,t){var a=t.length<0?0:0|Xn(t.length);e=Hn(e,a);for(var n=0;n<a;n+=1)e[n]=255&t[n];return e}function Xn(e){if(e>=Yn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yn().toString(16)+" bytes");return 0|e}function Qn(e){return !(null==e||!e._isBuffer)}function ei(e,t){if(Qn(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var a=e.length;if(0===a)return 0;for(var n=false;;)switch(t){case "ascii":case "latin1":case "binary":return a;case "utf8":case "utf-8":case void 0:return Mi$1(e).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*a;case "hex":return a>>>1;case "base64":return xi(e).length;default:if(n)return Mi$1(e).length;t=(""+t).toLowerCase(),n=true;}}function ti(e,t,a){var n=false;if((void 0===t||t<0)&&(t=0),t>this.length)return "";if((void 0===a||a>this.length)&&(a=this.length),a<=0)return "";if((a>>>=0)<=(t>>>=0))return "";for(e||(e="utf8");;)switch(e){case "hex":return yi$1(this,t,a);case "utf8":case "utf-8":return pi(this,t,a);case "ascii":return fi(this,t,a);case "latin1":case "binary":return mi(this,t,a);case "base64":return di(this,t,a);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return gi(this,t,a);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=true;}}function ai(e,t,a){var n=e[t];e[t]=e[a],e[a]=n;}function ni(e,t,a,n,i){if(0===e.length)return -1;if("string"==typeof a?(n=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,isNaN(a)&&(a=i?0:e.length-1),a<0&&(a=e.length+a),a>=e.length){if(i)return -1;a=e.length-1;}else if(a<0){if(!i)return -1;a=0;}if("string"==typeof t&&(t=Gn.from(t,n)),Qn(t))return 0===t.length?-1:ii(e,t,a,n,i);if("number"==typeof t)return t&=255,Gn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,a):Uint8Array.prototype.lastIndexOf.call(e,t,a):ii(e,[t],a,n,i);throw new TypeError("val must be string, number or Buffer")}function ii(e,t,a,n,i){var r,s=1,o=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;s=2,o/=2,l/=2,a/=2;}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(r=a;r<o;r++)if(u(e,r)===u(t,-1===c?0:r-c)){if(-1===c&&(c=r),r-c+1===l)return c*s}else -1!==c&&(r-=r-c),c=-1;}else for(a+l>o&&(a=o-l),r=a;r>=0;r--){for(var d=true,p=0;p<l;p++)if(u(e,r+p)!==u(t,p)){d=false;break}if(d)return r}return -1}function ri$1(e,t,a,n){a=Number(a)||0;var i=e.length-a;n?(n=Number(n))>i&&(n=i):n=i;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");n>r/2&&(n=r/2);for(var s=0;s<n;++s){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))return s;e[a+s]=o;}return s}function si(e,t,a,n){return Ci$1(Mi$1(t,e.length-a),e,a,n)}function oi$1(e,t,a,n){return Ci$1(function(e){for(var t=[],a=0;a<e.length;++a)t.push(255&e.charCodeAt(a));return t}(t),e,a,n)}function li(e,t,a,n){return oi$1(e,t,a,n)}function ui(e,t,a,n){return Ci$1(xi(t),e,a,n)}function ci$1(e,t,a,n){return Ci$1(function(e,t){for(var a,n,i,r=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(a=e.charCodeAt(s))>>8,i=a%256,r.push(i),r.push(n);return r}(t,e.length-a),e,a,n)}function di(e,t,a){return 0===t&&a===e.length?$n(e):$n(e.slice(t,a))}function pi(e,t,a){a=Math.min(e.length,a);for(var n=[],i=t;i<a;){var r,s,o,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=a)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(r=e[i+1]))&&(l=(31&u)<<6|63&r)>127&&(c=l);break;case 3:r=e[i+1],s=e[i+2],128==(192&r)&&128==(192&s)&&(l=(15&u)<<12|(63&r)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:r=e[i+1],s=e[i+2],o=e[i+3],128==(192&r)&&128==(192&s)&&128==(192&o)&&(l=(15&u)<<18|(63&r)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(c=l);}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d;}return function(e){var t=e.length;if(t<=hi)return String.fromCharCode.apply(String,e);var a="",n=0;for(;n<t;)a+=String.fromCharCode.apply(String,e.slice(n,n+=hi));return a}(n)}Gn.TYPED_ARRAY_SUPPORT=void 0===Fn$2.TYPED_ARRAY_SUPPORT||Fn$2.TYPED_ARRAY_SUPPORT,Yn(),Gn.poolSize=8192,Gn._augment=function(e){return e.__proto__=Gn.prototype,e},Gn.from=function(e,t,a){return qn(null,e,t,a)},Gn.TYPED_ARRAY_SUPPORT&&(Gn.prototype.__proto__=Uint8Array.prototype,Gn.__proto__=Uint8Array),Gn.alloc=function(e,t,a){return function(e,t,a,n){return Zn(t),t<=0?Hn(e,t):void 0!==a?"string"==typeof n?Hn(e,t).fill(a,n):Hn(e,t).fill(a):Hn(e,t)}(null,e,t,a)},Gn.allocUnsafe=function(e){return Jn(null,e)},Gn.allocUnsafeSlow=function(e){return Jn(null,e)},Gn.isBuffer=function(e){return null!=e&&(!!e._isBuffer||Vi(e)||function(e){return "function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Vi(e.slice(0,0))}(e))},Gn.compare=function(e,t){if(!Qn(e)||!Qn(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var a=e.length,n=t.length,i=0,r=Math.min(a,n);i<r;++i)if(e[i]!==t[i]){a=e[i],n=t[i];break}return a<n?-1:n<a?1:0},Gn.isEncoding=function(e){switch(String(e).toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "latin1":case "binary":case "base64":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return true;default:return false}},Gn.concat=function(e,t){if(!Wn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Gn.alloc(0);var a;if(void 0===t)for(t=0,a=0;a<e.length;++a)t+=e[a].length;var n=Gn.allocUnsafe(t),i=0;for(a=0;a<e.length;++a){var r=e[a];if(!Qn(r))throw new TypeError('"list" argument must be an Array of Buffers');r.copy(n,i),i+=r.length;}return n},Gn.byteLength=ei,Gn.prototype._isBuffer=true,Gn.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)ai(this,t,t+1);return this},Gn.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)ai(this,t,t+3),ai(this,t+1,t+2);return this},Gn.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)ai(this,t,t+7),ai(this,t+1,t+6),ai(this,t+2,t+5),ai(this,t+3,t+4);return this},Gn.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?pi(this,0,e):ti.apply(this,arguments)},Gn.prototype.equals=function(e){if(!Qn(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Gn.compare(this,e)},Gn.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Gn.prototype.compare=function(e,t,a,n,i){if(!Qn(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===a&&(a=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||a>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=a)return 0;if(n>=i)return -1;if(t>=a)return 1;if(this===e)return 0;for(var r=(i>>>=0)-(n>>>=0),s=(a>>>=0)-(t>>>=0),o=Math.min(r,s),l=this.slice(n,i),u=e.slice(t,a),c=0;c<o;++c)if(l[c]!==u[c]){r=l[c],s=u[c];break}return r<s?-1:s<r?1:0},Gn.prototype.includes=function(e,t,a){return -1!==this.indexOf(e,t,a)},Gn.prototype.indexOf=function(e,t,a){return ni(this,e,t,a,true)},Gn.prototype.lastIndexOf=function(e,t,a){return ni(this,e,t,a,false)},Gn.prototype.write=function(e,t,a,n){if(void 0===t)n="utf8",a=this.length,t=0;else if(void 0===a&&"string"==typeof t)n=t,a=this.length,t=0;else {if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(a)?(a|=0,void 0===n&&(n="utf8")):(n=a,a=void 0);}var i=this.length-t;if((void 0===a||a>i)&&(a=i),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var r=false;;)switch(n){case "hex":return ri$1(this,e,t,a);case "utf8":case "utf-8":return si(this,e,t,a);case "ascii":return oi$1(this,e,t,a);case "latin1":case "binary":return li(this,e,t,a);case "base64":return ui(this,e,t,a);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return ci$1(this,e,t,a);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),r=true;}},Gn.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var hi=4096;function fi(e,t,a){var n="";a=Math.min(e.length,a);for(var i=t;i<a;++i)n+=String.fromCharCode(127&e[i]);return n}function mi(e,t,a){var n="";a=Math.min(e.length,a);for(var i=t;i<a;++i)n+=String.fromCharCode(e[i]);return n}function yi$1(e,t,a){var n=e.length;(!t||t<0)&&(t=0),(!a||a<0||a>n)&&(a=n);for(var i="",r=t;r<a;++r)i+=Ti(e[r]);return i}function gi(e,t,a){for(var n=e.slice(t,a),i="",r=0;r<n.length;r+=2)i+=String.fromCharCode(n[r]+256*n[r+1]);return i}function bi(e,t,a){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>a)throw new RangeError("Trying to access beyond buffer length")}function vi(e,t,a,n,i,r){if(!Qn(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<r)throw new RangeError('"value" argument is out of bounds');if(a+n>e.length)throw new RangeError("Index out of range")}function wi(e,t,a,n){t<0&&(t=65535+t+1);for(var i=0,r=Math.min(e.length-a,2);i<r;++i)e[a+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i);}function _i$1(e,t,a,n){t<0&&(t=4294967295+t+1);for(var i=0,r=Math.min(e.length-a,4);i<r;++i)e[a+i]=t>>>8*(n?i:3-i)&255;}function Ai(e,t,a,n,i,r){if(a+n>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function ki(e,t,a,n,i){return i||Ai(e,0,a,4),jn(e,t,a,n,23,4),a+4}function Si$1(e,t,a,n,i){return i||Ai(e,0,a,8),jn(e,t,a,n,52,8),a+8}Gn.prototype.slice=function(e,t){var a,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Gn.TYPED_ARRAY_SUPPORT)(a=this.subarray(e,t)).__proto__=Gn.prototype;else {var i=t-e;a=new Gn(i,void 0);for(var r=0;r<i;++r)a[r]=this[r+e];}return a},Gn.prototype.readUIntLE=function(e,t,a){e|=0,t|=0,a||bi(e,t,this.length);for(var n=this[e],i=1,r=0;++r<t&&(i*=256);)n+=this[e+r]*i;return n},Gn.prototype.readUIntBE=function(e,t,a){e|=0,t|=0,a||bi(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Gn.prototype.readUInt8=function(e,t){return t||bi(e,1,this.length),this[e]},Gn.prototype.readUInt16LE=function(e,t){return t||bi(e,2,this.length),this[e]|this[e+1]<<8},Gn.prototype.readUInt16BE=function(e,t){return t||bi(e,2,this.length),this[e]<<8|this[e+1]},Gn.prototype.readUInt32LE=function(e,t){return t||bi(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Gn.prototype.readUInt32BE=function(e,t){return t||bi(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Gn.prototype.readIntLE=function(e,t,a){e|=0,t|=0,a||bi(e,t,this.length);for(var n=this[e],i=1,r=0;++r<t&&(i*=256);)n+=this[e+r]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Gn.prototype.readIntBE=function(e,t,a){e|=0,t|=0,a||bi(e,t,this.length);for(var n=t,i=1,r=this[e+--n];n>0&&(i*=256);)r+=this[e+--n]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},Gn.prototype.readInt8=function(e,t){return t||bi(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Gn.prototype.readInt16LE=function(e,t){t||bi(e,2,this.length);var a=this[e]|this[e+1]<<8;return 32768&a?4294901760|a:a},Gn.prototype.readInt16BE=function(e,t){t||bi(e,2,this.length);var a=this[e+1]|this[e]<<8;return 32768&a?4294901760|a:a},Gn.prototype.readInt32LE=function(e,t){return t||bi(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Gn.prototype.readInt32BE=function(e,t){return t||bi(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Gn.prototype.readFloatLE=function(e,t){return t||bi(e,4,this.length),Un$1(this,e,true,23,4)},Gn.prototype.readFloatBE=function(e,t){return t||bi(e,4,this.length),Un$1(this,e,false,23,4)},Gn.prototype.readDoubleLE=function(e,t){return t||bi(e,8,this.length),Un$1(this,e,true,52,8)},Gn.prototype.readDoubleBE=function(e,t){return t||bi(e,8,this.length),Un$1(this,e,false,52,8)},Gn.prototype.writeUIntLE=function(e,t,a,n){(e=+e,t|=0,a|=0,n)||vi(this,e,t,a,Math.pow(2,8*a)-1,0);var i=1,r=0;for(this[t]=255&e;++r<a&&(i*=256);)this[t+r]=e/i&255;return t+a},Gn.prototype.writeUIntBE=function(e,t,a,n){(e=+e,t|=0,a|=0,n)||vi(this,e,t,a,Math.pow(2,8*a)-1,0);var i=a-1,r=1;for(this[t+i]=255&e;--i>=0&&(r*=256);)this[t+i]=e/r&255;return t+a},Gn.prototype.writeUInt8=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,1,255,0),Gn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Gn.prototype.writeUInt16LE=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,2,65535,0),Gn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):wi(this,e,t,true),t+2},Gn.prototype.writeUInt16BE=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,2,65535,0),Gn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):wi(this,e,t,false),t+2},Gn.prototype.writeUInt32LE=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,4,4294967295,0),Gn.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):_i$1(this,e,t,true),t+4},Gn.prototype.writeUInt32BE=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,4,4294967295,0),Gn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):_i$1(this,e,t,false),t+4},Gn.prototype.writeIntLE=function(e,t,a,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*a-1);vi(this,e,t,a,i-1,-i);}var r=0,s=1,o=0;for(this[t]=255&e;++r<a&&(s*=256);)e<0&&0===o&&0!==this[t+r-1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+a},Gn.prototype.writeIntBE=function(e,t,a,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*a-1);vi(this,e,t,a,i-1,-i);}var r=a-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+a},Gn.prototype.writeInt8=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,1,127,-128),Gn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Gn.prototype.writeInt16LE=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,2,32767,-32768),Gn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):wi(this,e,t,true),t+2},Gn.prototype.writeInt16BE=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,2,32767,-32768),Gn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):wi(this,e,t,false),t+2},Gn.prototype.writeInt32LE=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,4,2147483647,-2147483648),Gn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):_i$1(this,e,t,true),t+4},Gn.prototype.writeInt32BE=function(e,t,a){return e=+e,t|=0,a||vi(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Gn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):_i$1(this,e,t,false),t+4},Gn.prototype.writeFloatLE=function(e,t,a){return ki(this,e,t,true,a)},Gn.prototype.writeFloatBE=function(e,t,a){return ki(this,e,t,false,a)},Gn.prototype.writeDoubleLE=function(e,t,a){return Si$1(this,e,t,true,a)},Gn.prototype.writeDoubleBE=function(e,t,a){return Si$1(this,e,t,false,a)},Gn.prototype.copy=function(e,t,a,n){if(a||(a=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<a&&(n=a),n===a)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-a&&(n=e.length-t+a);var i,r=n-a;if(this===e&&a<t&&t<n)for(i=r-1;i>=0;--i)e[i+t]=this[i+a];else if(r<1e3||!Gn.TYPED_ARRAY_SUPPORT)for(i=0;i<r;++i)e[i+t]=this[i+a];else Uint8Array.prototype.set.call(e,this.subarray(a,a+r),t);return r},Gn.prototype.fill=function(e,t,a,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,a=this.length):"string"==typeof a&&(n=a,a=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i);}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Gn.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else "number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<a)throw new RangeError("Out of range index");if(a<=t)return this;var r;if(t>>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(r=t;r<a;++r)this[r]=e;else {var s=Qn(e)?e:Mi$1(new Gn(e,n).toString()),o=s.length;for(r=0;r<a-t;++r)this[r+t]=s[r%o];}return this};var Ni=/[^+\/0-9A-Za-z-_]/g;function Ti(e){return e<16?"0"+e.toString(16):e.toString(16)}function Mi$1(e,t){var a;t=t||1/0;for(var n=e.length,i=null,r=[],s=0;s<n;++s){if((a=e.charCodeAt(s))>55295&&a<57344){if(!i){if(a>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&r.push(239,191,189);continue}i=a;continue}if(a<56320){(t-=3)>-1&&r.push(239,191,189),i=a;continue}a=65536+(i-55296<<10|a-56320);}else i&&(t-=3)>-1&&r.push(239,191,189);if(i=null,a<128){if((t-=1)<0)break;r.push(a);}else if(a<2048){if((t-=2)<0)break;r.push(a>>6|192,63&a|128);}else if(a<65536){if((t-=3)<0)break;r.push(a>>12|224,a>>6&63|128,63&a|128);}else {if(!(a<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128);}}return r}function xi(e){return function(e){var t,a,n,i,r,s;Pn||Bn();var o=e.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");r="="===e[o-2]?2:"="===e[o-1]?1:0,s=new Ln(3*o/4-r),n=r>0?o-4:o;var l=0;for(t=0,a=0;t<n;t+=4,a+=3)i=Rn[e.charCodeAt(t)]<<18|Rn[e.charCodeAt(t+1)]<<12|Rn[e.charCodeAt(t+2)]<<6|Rn[e.charCodeAt(t+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=255&i;return 2===r?(i=Rn[e.charCodeAt(t)]<<2|Rn[e.charCodeAt(t+1)]>>4,s[l++]=255&i):1===r&&(i=Rn[e.charCodeAt(t)]<<10|Rn[e.charCodeAt(t+1)]<<4|Rn[e.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Ni,"")).length<2)return "";for(;e.length%4!=0;)e+="=";return e}(e))}function Ci$1(e,t,a,n){for(var i=0;i<n&&!(i+a>=t.length||i>=e.length);++i)t[i+a]=e[i];return i}function Vi(e){return !!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}const Ii={files:{},items:{},folders:{}};function Ei(e){return Ii.files[e]}function Fi(){return Ii.folders}function Di(e){return Ii.folders[e]}function Ri(e,t){for(const a of Object.values(Ii.folders))if(a.name===e&&a.parent===t)return a}function Li(e,t){for(const a of Object.values(Ii.items))if(a.name===e&&a.folder._id===t)return a}function Pi(){return Ii.items}function Bi(e){return Ii.items[e]}function Oi$1(e,t){Ii.items[e]=t.rootItem;for(const[e,a]of Object.entries(t.metadata)){if(t.files[e]&&(Ii.files[e]={blob:new Blob([new Uint8Array(t.files[e])],{type:a.mimeType}),hash:a.hash,itemName:a.name,itemType:a.type,mimeType:a.mimeType}),a.attachments)for(const n of a.attachments){const a=Ui$1(e,n.name,n.queryParam,n.index);Ii.files[a]={blob:new Blob([new Uint8Array(t.files[a])],{type:n.mimeType}),hash:n.hash,itemName:n.name,itemType:n.type,mimeType:n.mimeType};}Ii.items[e]=a;}for(const a of Object.values(t.folders))a._id=e+":"+a._id,a.parent=e+":"+a.parent,Ii.folders[a._id]=a;}async function $i(e,t){const a=Gn.from(await e.arrayBuffer());let n=0;n+=8;const i=a.readInt32LE(8);n+=4;const r=new TextDecoder,s=a.subarray(n,n+i);n+=i;const o=JSON.parse(r.decode(s));o.root=t+"/"+o.root;let l=0;const u=En.ungzip(a.subarray(n)),c=Gn.from(u),d=c.subarray(l,l+o.metadataSize);l+=o.metadataSize;const p=JSON.parse(r.decode(d)),h={};Object.entries(p).forEach((([e,a])=>{const n=t+"/"+e;a._id=n,h[n]=a,a.folder._id=t+":"+a.folder._id;for(const e of a.links)e.to=t+"/"+e.to;}));const f=c.subarray(l,l+o.foldersSize);l+=o.foldersSize;const m=JSON.parse(r.decode(f)),y={};for(const[,e]of Object.entries(h))if(e.filesize&&(y[e._id]={start:l+(e.packageFileOffset||0),end:l+(e.packageFileOffset||0)+e.filesize}),e.attachments)for(const t of e.attachments)y[Ui$1(e._id,t.name,t.queryParam,t.index)]={start:l+(t.packageFileOffset||0),end:l+(t.packageFileOffset||0)+t.filesize};const g={};for(const[e,t]of Object.entries(y)){const a=c.subarray(t.start,t.end);g[e]=a;}const b=h[o.root],v=[],w=e=>{v.push(e._id);for(const t of e.links)t.item=structuredClone(h[t.to]),w(t.item);};return w(b),{rootItem:b,metadata:h,folders:m,files:g}}function Ui$1(e,t,a,n){return `${e}_${t}`+(null!=a?`_${a}`:"")+(null!=n?`_${n}`:"")}function ji(e,t,a,n){return Array.isArray(e.attachments)?e.attachments.filter((e=>e.name===t&&(void 0===n||e.index===n))).reduce(((e,t)=>Math.abs(t.queryParam-(a??0))<Math.abs(e.queryParam-(a??0))?t:e),{queryParam:1/0}):null}function zi(e,t,a,n){const i=Bi(e);if(i){const r=ji(i,t,a,n);if(!r)return null;return Ei(Ui$1(e,r.name,r.queryParam,r.index))}}var Wi=Object.freeze({__proto__:null,addPackageToCache:Oi$1,createAttachmentID:Ui$1,findFolder:Ri,findItem:Li,getAttachmentFromPackageCache:zi,getFileFromCache:Ei,getFolder:Di,getFolders:Fi,getItemFromCache:Bi,getItems:Pi,parsePackage:$i,queryAttachments:ji});class Yi{id=p.createGUID();items=[]}class Hi{itemRepo;undoEvents=[];redoEvents=[];maxUndoCount=100;enabled=true;snapshots=new Map;_undoRedoPromise=Promise.resolve();constructor(e,t=100){this.itemRepo=e,this.maxUndoCount=t,y$1.instance.setUndoManager(this),l$1.$on("undoManager:undo",(e=>this.undo(e))),l$1.$on("undoManager:redo",(e=>this.redo(e)));}clear(){this.undoEvents=[],this.redoEvents=[],this.snapshots.clear(),l$1.$emit("undoManager:undoStepsChanged",0),l$1.$emit("undoManager:redoStepsChanged",0);}createSnapshot(){const e=new Yi;for(const t of this.itemRepo.itemInstances.values())for(const a of t.values())e.items.push({_id:a._id,instanceId:a.instanceId,data:this._grabSnapshot(a)});return this.snapshots.set(e.id,e),e.id}rollbackFromSnapshot(e){const t=this.snapshots.get(e);if(!t)throw new k("Snapshot not found");for(const e of t.items){const t=this.itemRepo.itemInstances.get(e._id);if(t){const a=t.get(e.instanceId);a?this._rollbackFromSnapshot(a,e.data):console.error(`[SNAPSHOT] - Trying to rollback snapshot for item but did not find the instance: ${e._id} -> ${e.instanceId}`);}else console.error(`[SNAPSHOT] - Trying to rollback snapshot for item but did not find the item map: ${e._id}`);}this.snapshots.delete(e);}_grabSnapshot(e){const t=[];for(const a of e.fieldInstances)try{t.push(a.createSnapshot());}catch(e){const t=`[SNAPSHOT] - Could not grab snapshot of field ${a.name}`;throw console.error(t,e),new Error(e.toString())}const a=[];for(const t of e.customFieldInstances)try{a.push(t.createSnapshot());}catch(e){const a=`[SNAPSHOT] - Could not grab snapshot of custom field ${t.name}`;throw console.error(a,e),new Error(e.toString())}return new W(e._id,"item",{fieldInstances:t,customFieldInstances:a})}_getFieldInstance(e,t){for(const a of e.fieldInstances)if(a.getId()===t)return a;return null}_getCustomFieldInstance(e,t){for(const a of e.customFieldInstances)if(a.getId()===t)return a;return null}_rollbackFromSnapshot(e,t){for(const a of t.data.fieldInstances){const t=this._getFieldInstance(e,a.id);t?t.rollbackFromSnapshot(a):console.warn("[SNAPSHOT] - Could not find field instance in snapshot: "+a.id);}for(const a of t.data.customFieldInstances){const t=this._getCustomFieldInstance(e,a.id);t?t.rollbackFromSnapshot(a):console.warn("[SNAPSHOT] - Could not find custom field instance in snapshot: "+a.id);}}getEnabled(){return this.enabled}setEnabled(e){this.enabled=!!e;}ignore(e){const t=this.enabled;let a=false;try{t&&this.setEnabled(!1);const n=e();if(n&&n.then)return a=!0,n.finally((()=>{t&&this.setEnabled(!0);}))}finally{t&&!a&&this.setEnabled(true);}}undo(e){return this._undoRedoPromise=this._undoRedoPromise.then((()=>this._performUndo(e))),this._undoRedoPromise}redo(e){return this._undoRedoPromise=this._undoRedoPromise.then((()=>this._performRedo(e))),this._undoRedoPromise}async _performUndo(e){if(this.enabled&&this.undoEvents.length){for(e=e||1;this.undoEvents.length>0&&e>0;){const t=this.spliceLastEventBundle(this.undoEvents).reverse();for(const e of t)await e.undo(),this.redoEvents.push(e);e--;}l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()),l$1.$emit("undoManager:redoStepsChanged",this.getNumberOfRedoBundles());}}async _performRedo(e){if(this.enabled&&this.redoEvents.length){for(e=e||1;this.redoEvents.length>0&&e>0;){const t=this.spliceLastEventBundle(this.redoEvents).reverse();for(const e of t)await e.redo(),this.undoEvents.push(e);e--;}l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()),l$1.$emit("undoManager:redoStepsChanged",this.getNumberOfRedoBundles());}}getUndoSteps(){return this.undoEvents.map((function(e){return {type:e.type,itemId:e.itemId,prop:e.prop}}))}getRedoSteps(){return this.redoEvents.map((e=>({type:e.type,itemId:e.itemId,prop:e.prop})))}event(e){if(this.enabled){if(this.redoEvents=[],l$1.$emit("undoManager:redoStepsChanged",0),this.assignBundleIndexToEvent(e),0!==this.undoEvents.length){let t=false;for(let a=this.undoEvents.length-1;a>=0;a--){const n=this.undoEvents[a];if(!e.isWithinMergeDeltaOf(n,300))break;const i=n.merge(e,300);if(i){t=true,this.undoEvents.splice(a,1),this.undoEvents.push(i);break}}t||(this.undoEvents.push(e),l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()));}else this.undoEvents.push(e),l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles());if(this.getNumberOfUndoBundles()>this.maxUndoCount){this.spliceFirstEventBundle(this.undoEvents);for(const e of this.undoEvents)e.bundleIndex-=1;l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles());}}}getNumberOfUndoBundles(){return 0===this.undoEvents.length?0:this.undoEvents.at(-1).bundleIndex+1}getNumberOfRedoBundles(){if(0===this.redoEvents.length)return 0;const e=this.getNumberOfUndoBundles()-1;return this.redoEvents.at(0).bundleIndex-e}spliceLastEventBundle(e){if(0===e.length)return [];const t=e.at(-1).bundleIndex;let a=e.length-1;for(let n=e.length-1;n>=0&&e[n].bundleIndex===t;n--)a=n;return e.splice(a)}spliceFirstEventBundle(e){if(0===e.length)return [];const t=e.at(0).bundleIndex;for(let a=1;a<e.length;a++)if(e[a].bundleIndex!==t)return e.splice(0,a);return e.splice(0)}assignBundleIndexToEvent(e){if(0===this.undoEvents.length)return void(e.bundleIndex=0);const t=this.undoEvents.at(-1),a=Math.abs(e.createdAt-t.createdAt);e.bundleIndex=a>300?t.bundleIndex+1:t.bundleIndex;}}class Gi{updateItemLinksAndAttributes(e,t,a){try{const n=[],i={},r={};this.getLinksAndAttributes(e,n,i,r,t,a),e.attributes=i,e.userAttributes=r,e.links=n;}catch(e){throw console.error(e),new T$1(e)}}getLinksAndAttributes(e,t,a,n,i,r){e.fieldInstances.length&&this.retrieveLinksAndAttributesFromFieldInstances(e.fieldInstances,t,a,i,r),e.userFieldInstances.length&&this.retrieveLinksAndAttributesFromFieldInstances(e.userFieldInstances,t,n,i,r),e.customFieldInstances.length&&(console.log(e.customFieldInstances),this.retrieveLinksAndAttributesFromFieldInstances(e.customFieldInstances,t,n,i,r,"_"));}retrieveLinksAndAttributesFromFieldInstances(e,t,a,n,i,r=""){for(const s of e)switch(s.type){case "Link":if(s.value&&t){if(i&&s.hidden)continue;n?t.push({usage:r+s.name,to:s.value._id,item:s.value}):t.push({usage:r+s.name,to:s.value._id});}break;case "Attribute":a&&(a[r+s.name]=s.value);break;case "List":s.blocks&&this.traverseListFieldInstances(s.blocks,t,a,r+s.name,n);break;case "Tree":if(s.blocks){const e=s.blocks[0];e.blocks&&this.traverseTreeFieldInstance(e.blocks,t,a,r+s.name,n);}break;case "NodeGraph":if(s.blocks&&this.traverseTreeFieldInstance(s.blocks,t,a,r+s.name,n),a&&Array.isArray(s.connections)){let e=0;for(const t of s.connections){a[`${r}${s.name}#connection[${e++}]`]={srcNode:t.srcNode,srcSlot:t.srcSlot,destNode:t.destNode,destSlot:t.destSlot};}}}}traverseTreeFieldInstance(e,t,a,n,i){let r=0;for(const s of e){const e=`${n}[${r}]`,o=e+"#type",l=e+"#subnodeid",u=e+"#id",c=e+"#posx",d=e+"#posy";a&&(a[e+"#usage"]="Block",a[o]=s.type,a[u]=s.id,void 0!==s.subNodeId&&(a[l]=s.subNodeId),void 0!==s.posX&&(a[c]=s.posX||0),void 0!==s.posY&&(a[d]=s.posY||0));for(const n of s.fields){const r=`${e}->${n.name}`;switch(n.type){case "Link":n.value&&t&&(i?t.push({usage:r,to:n.value._id,item:n.value}):t.push({usage:r,to:n.value._id}));break;case "List":n.blocks&&this.traverseListFieldInstances(n.blocks,t,a,r,i);break;case "Attribute":a&&(a[r]=n.value);}}s.scripts&&this.processScripts(s.scripts,t,a,e,i),s.blocks&&this.traverseTreeFieldInstance(s.blocks,t,a,e,i),r++;}}traverseListFieldInstances(e,t,a,n,i){let r=0;for(const s of e){const e=`${n}[${r}]`;for(const n of s.fields){const r=`${e}->${n.name}`;switch(n.type){case "Link":if(n.value&&t){const e={usage:r,to:"object"==typeof n.value?n.value._id:n.value,item:null};i&&"object"===n.value&&(e.item=n.value),t.push(e);}break;case "Attribute":a&&(a[r]=n.value);}}r++;}}processScripts(e,t,a,n,i){let r=0;for(const s of e){const e=`${n}#scripts[${r}]`,o=e+"#id",l=e+"#item";a&&(a[e+"#usage"]="Script",a[o]=s.id),t&&s.item.value&&(i?t.push({usage:l,to:s.item.value._id,item:s.item.value}):t.push({usage:l,to:s.item.value._id}));for(const n of s.fields){const r=`${e}->${n.name}`;if("Link"===n.type)n.value&&t&&(i?t.push({usage:r,to:n.value._id,item:n.value}):t.push({usage:r,to:n.value._id}));else a&&(a[r]=n.value);}r++;}}}class qi{apiClient;activeItem=void 0;rootItemId=void 0;loadingItems=new Map;loadedItems=new Map;itemInstances=new Map;resolvedPaths=new Map;jail;apiGateway;itemCache;undoManager=new Hi(this);itemPreparator=new oe(this);itemChangeProcessor=new Gi;usePublicApi;constructor(e,t){this.apiClient=t,this.apiGateway=new j(t),this.itemCache=new z(this.apiGateway),this.usePublicApi=!!e,this.jail={active:false,mountedFolders:[]},l$1.$on("item:rename",(e=>this.handleRename(e)));}_logGroup(e){}_logGroupEnd(){}_log(e){}getLoadedItems(){return Array.from(this.loadedItems.values())}getItemInstances(){return this.itemInstances}findLoadedItem(e){return this.loadedItems.get(e)}_handleError(e,t){throw console.error(e),new T$1("ItemRepo: "+t)}getUndoManager(){return this.undoManager}async createFieldsForItem(e,t,a,n=false){return this.itemPreparator.createFields(e,a,t,"",false,a.attributes,n)}async createScriptsForItem(e,t=[],a,n=true){const i=[];for(const n of t){if(!n.item)continue;const t=await this.loadItem(n.item);if(!t)continue;const r=new Z(void 0,e,a,t);i.push(r);for(const e of n.fields){const t=new G$9(r,e.name,e.value,a);r.addField(t);}}e.scripts=n?y$1.instance.proxyScriptArray(i,e,a):i;}clear(){this.rootItemId=void 0,this.activeItem=void 0,this.loadedItems.clear(),this.resolvedPaths.clear(),this.itemInstances.clear(),this.loadingItems.clear();const e=this.apiClient.getCollab();e&&e.endCollaboration();}removeBlock(e,t){t.blocks.removeObject(e),e.parent=void 0;}traverseBlockPairs(e,t,a){a(e,t);for(let n=0;n<e.blocks.length&&n<t.blocks.length;n++)this.traverseBlockPairs(e.blocks[n],t.blocks[n],a);}copyScripts(e,t,a=false,n={}){const i=new Map;this.traverseBlockPairs(e,t,((e,t)=>i.set(e.getId(),t.getId())));const r=[];return this.traverseBlockPairs(e,t,((e,t)=>{for(const s of e.scripts){const e=s.clone(i,n);a&&(e.deferInitCall=true),t.scripts.push(e),r.push(e);}})),r}updateScriptFieldReferences(e,t){const a=new Map;this.traverseBlockPairs(e,t,((e,t)=>{a.set(e.id,t.id);})),this.updateScriptFieldReferencesFromMap(a,t);}updateScriptFieldReferencesFromMap(e,t){this.traverseBlocks((t=>{for(const a of t.scripts)for(const t of a.fields)e.has(t.value)&&(t.value=e.get(t.value));}),[t]);}async createNewBlock(e,t,a,n){const i=new le(void 0,t,e.typeName,void 0,void 0,a);n&&i.setSubNodeId(n);const r=await this.createFieldsForItem(i,e.template,a);return i.setFields(r),i.blocks=y$1.instance.proxyBlockArray(i.blocks,i,a),await this.createScriptsForItem(i,void 0,a),this.addBlockToParent(i,t,a)}addBlockToParent(e,t,a){e.parent=t;const n=y$1.instance.proxyBlock(e,a);return t.blocks.push(n),n}async createNewListEntry(e,t,a){const n=new le(void 0,void 0,e.typeName,void 0,void 0,a),i=await this.createFieldsForItem(n,e.template,a);return n.setFields(i),n.blocks=y$1.instance.proxyListArray(n.blocks,t,a),y$1.instance.proxyBlock(n,a)}async createNewGraphNode(e,t,a,n,i){const r=new le(void 0,void 0,e.typeName,void 0,e.displayName,i),s=await this.itemPreparator.createFields(r,i,e.template,"",true,i.attributes);return r.setFields(s),r.setInputs(e.inputs),r.setOutputs(e.outputs),r.setPosition(a,n),r.blocks=y$1.instance.proxyGraphBlockArray(r.blocks,t),this.addNodeToGraph(r,t,i),r}addNodeToGraph(e,t,a){const n=y$1.instance.proxyGraphBlock(e,a);t.blocks.push(n);}removeGraphNode(e,t){const a=[];for(const n of e.connections)n.srcNode!==t.id&&n.destNode!==t.id||a.push(n);for(const t of a)e.connections.removeObject(t);e.blocks.removeObject(t);}addGraphLink(e,t,a,n,i,r){e.connections.push(new H({srcNode:t,srcSlot:a,destNode:n,destSlot:i},r));}removeGraphLink(e,t,a,n,i){for(const r of e.connections)if(r.srcNode===t&&r.srcSlot===a&&r.destNode===n&&r.destSlot===i)return void e.connections.removeObject(r)}createNewScript(e,t=-1,a){t=t>=0?t:e.scripts.length;const n=new Z(void 0,e,a);return e.scripts.splice(t,0,n),n}removeScript(e,t){t.scripts.removeObject(e);}findBlock(e){for(const t of this.itemInstances.values())for(const a of t.values()){const t=a.findBlock(e);if(t)return t}return null}async loadPackage(e,t){const a=await p.downloadFile(e,((e,a,n)=>{t&&t({phase:"Loading",percent:e,bytesTotal:a,bytesLoaded:n});})),n=await a.data,i=this.apiClient.getCollab();i&&i.endCollaboration();const r=new ae$1({_id:"root",name:"Root package",type:"Package",links:[],attributes:{},fields:[],readOnly:true,isPackaged:false}),s=await $i(n,r._id);Oi$1(r._id,structuredClone(s));const o=Object.values(s.metadata).reverse();for(const e of o)e._id===s.rootItem._id&&(r.packageContent=e,r.packageType=e.type);return await this._linkAndPrepareItems(o),r.packageContent=this.loadedItems.get(s.rootItem._id),this.activeItem=r,r}createPackageItemUrl(e){const t=Ei(e);return t?URL.createObjectURL(t.blob):null}revokePackageItemUrl(e){URL.revokeObjectURL(e);}async _loadPackageContentRecursively(e,t){t("Loading from cache",0);const a=await this.apiClient.itemCache.addItemToCache(e._id,void 0,e.hash,(function(e,a,n){t("Loading from cloud",.9*e,n,a);})),n=await(await fetch(a.objectUrl)).blob();t("Unpacking",90);const i=await $i(n,e._id);Oi$1(e._id,structuredClone(i));const r=Object.values(i.metadata).reverse();for(const t of r)t._id===i.rootItem._id&&(e.packageContent=t,e.packageType=t.type);return r}createNewItemInstance(e){const t=this.loadedItems.get(e);if(!t)return console.error(`Tried creating new instance of item, but it was not found: ${e}`),null;const a=t.clone(true);return this._addItemInstance(a),a}_addLoadedItem(e){this.loadedItems.set(e._id,e),this._addItemInstance(e);}_addItemInstance(e){let t=this.itemInstances.get(e._id);t||(t=new Map,this.itemInstances.set(e._id,t)),t.set(e.instanceId,e);}async loadItemByRelativePath(e,t,a={}){try{const n=Bi(e);let i;if(n){const e=t.split("/"),a=e.pop();let r=Di(n.folder._id);for(const t of e)if(r=".."===t?Di(r.parent):Ri(t,r._id),!r)return;const s=Li(a,r._id);i=s?._id;}else i=await this.resolveRelativePath(t,e);return this.loadItem(i,a)}catch(e){this._handleError(e,`Unable to load item by relative path: ${t}: ${e}`);}}async _loadItemFromApi(e,t={}){let a;if(this.apiGateway.start(),t.recursive)if(this.usePublicApi)a=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e,true),a.forEach((e=>e.public=true));else try{a=await this.apiGateway.call("_loadItemFromApi","getItemAggregatedRecursive",e,{withAttachmentInfo:!0,noFields:!0});}catch{a=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e,true),a.forEach((e=>e.public=true));}else {let t;if(this.usePublicApi)t=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e),t.public=true;else try{t=await this.apiGateway.call("_loadItemFromApi","getItemAggregated",e,{noFields:!0});}catch{t=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e),t.public=true;}a=[t];}return this.apiGateway.end(),a}_relinkItems(e,t){for(const a of e){if(Array.isArray(a.links))for(const e of a.links)e.item=t.get(e.to),e.item||e.stopRecursion||console.warn(`Missing link in item '${a.name}' (${a._id}) to: ${e.to} with usage ${e.usage}`);a.packageContent&&(a.packageContent=t.get(a.packageContent._id));}}createItem(e,t){const a={_id:p.createGeneratedItemId(),name:`Generated ${e}`,type:e,attributes:t||{},links:[],fields:[],fieldInstances:[],userFieldInstances:[],isGenerated:true};return this.itemPreparator.prepare(a)}getLoadedItem(e){return this.loadedItems.get(e)}async loadItem(e,t={}){let a,n,i;if(i=this.loadedItems.get(e),i)return i;if(i=this.loadingItems.get(e),i)return i;try{const r=new Promise(((e,t)=>{a=e,n=t;}));return this.loadingItems.set(e,r),i=await this._loadItemInternal(e,t),a(i),!this.activeItem&&i&&(this.rootItemId=e,this.activeItem=i,t.withCollaboration,await l$1.$emit("itemRepo:itemLoaded",i)),i}catch(t){return this._handleError(t,`Unable to load item ${e}: ${t}`),void n(void 0)}finally{this.loadingItems.delete(e);}}async _loadItemInternal(e,t={}){const a=(e,a,n=0,i=0)=>{"function"==typeof t.progressCallback&&t.progressCallback({phase:e,percent:a,bytesTotal:n,bytesLoaded:i});};a("Fetching metadata",1);let n=await this._loadItemFromApi(e,t);if(n=n.filter((e=>!this.loadedItems.has(e._id))),0===n.length)return console.log("After loading the item, it turns out we have them all already loaded! This should not happen!"),this.loadedItems.get(e);const i=n[0]._id;for(const e of n)if("Package"===e.type){const t=await this._loadPackageContentRecursively(e,a);for(const e of t)n.push(e);}a("Preparing data",100),await this._linkAndPrepareItems(n);return this.loadedItems.get(i)}async _linkAndPrepareItems(e){const t=new Map;for(const a of e)t.set(a._id,a);const a=new Map([...this.loadedItems,...t]);this._relinkItems(e,a);const n=[],i=()=>{const e=t.values().next().value;return t.delete(e._id),this._log(`- Fetched next item ${e.name} (${e._id})`),e},r=async e=>{this._logGroup(`- Preparing item ${e.name} (${e._id})`);const t=await this.itemPreparator.prepare(e);return n.push(t),this._addLoadedItem(t),this._logGroupEnd(),t};for(this.itemPreparator.setItemFetcher((async e=>{this._logGroup(`- Requesting item ${e.name} (${e._id})`);let a=this.loadedItems.get(e._id);if(a)return this._log("- Already prepared. Returning."),this._logGroupEnd(),a;const n=t.get(e._id);return n?(t.delete(e._id),this._log("- Don't have it yet. Preparing..."),a=await r(n),this._log("- Now prepared. Returning."),this._logGroupEnd(),a):(console.error("ItemFetcher: Could not find requested item: "+e._id,t,this.loadedItems),null)}));t.size>0;){let e=i();await r(e);}return this._relinkItems(n,this.loadedItems),n}async resolveRelativePath(e,t=null){if(!(t=t||this.activeItem?._id||null))return null;const a=`${t}#${e}`;let n;return n=this.resolvedPaths.has(a)?this.resolvedPaths.get(a):this.usePublicApi?await this.apiClient.publicResolveRelativeItem(t,e):await this.apiClient.resolveRelativeItem(t,e),this.resolvedPaths.set(a,n),n}async traverseItems(e,t=void 0){if("function"!=typeof e)return;const a=this,n=new Map;await async function t(i){if(!i)return;if(n.has(i._id))return;n.set(i._id,true);const r=e(i);if(r&&r.then&&await r,Array.isArray(i.links))for(const e of i.links)if(e.item)await t(e.item);else if(e.to)try{const n=await a.loadItem(e.to);await t(n);}catch{console.warn(`Could not load additional item ${e.to} so cannot traverse it. Probably dead link!`);}}(t||this.activeItem);}async traverseBlocks(e,t){for(const a of t){const t=e(a);t&&t.then&&await t,Array.isArray(a.blocks)&&a.blocks?.length&&await this.traverseBlocks(e,a.blocks);}}async traverseFieldInstances(e,t){const a=this;t=t||this.activeItem?.fieldInstances||[];for(const n of t){const t=e(n);t&&t.then&&await t,Array.isArray(n.blocks)&&await this.traverseBlocks((async function(t){Array.isArray(t.fields)&&t.fields?.length&&await a.traverseFieldInstances(e,t.fields);}),n.blocks);}}async _updateLinkReferences(e,t,a,n){t?await this.traverseItems((async i=>{if(Array.isArray(i.fieldInstances)&&i.fieldInstances.length){await this.traverseFieldInstances((async a=>{"Link"===a.type&&a.value&&a.value._id===e&&(n&&(a.value=null),a.value=t);}),i.fieldInstances);for(const a of i.fieldInstances)Array.isArray(a.blocks)&&await this.traverseBlocks((async a=>{if(Array.isArray(a.scripts))for(const i of a.scripts)i.item?.value?._id===e&&(n&&(i.item.value=void 0),i.item.value=t);}),a.blocks);}if(i.links)for(const r of i.links)r.to===e&&(n&&(r.to=null,r.item=null),r.to=a,r.item=t);})):console.warn(`Aborting link update: Could not load item ${a}`);}async replaceLink(e,t){if(this.getLoadedItem(e)){const a=await this.loadItem(t,{recursive:true});await this._updateLinkReferences(e,a,t,false);}}async forceUpdateLink(e){const t=await this.loadItem(e,{recursive:true});await this._updateLinkReferences(e,t,e,true);}saveItem(e){return e._id&&e.isDirty?(this.itemChangeProcessor.updateItemLinksAndAttributes(e,false,true),e.version||(e.version={major:0,minor:0,revision:1}),this.apiClient.updateItem({_id:e._id,name:e.name,attributes:e.attributes,userAttributes:e.userAttributes,links:e.links,tags:e.tags,contributors:e.contributors,description:e.description,shortDescription:e.shortDescription,categories:e.categories,license:e.license,version:e.version,allowConversation:e.allowConversation,visibility:e.visibility}).then((t=>(JSON.stringify(e.version)===JSON.stringify(t.version)?console.log(`Saved item ${e.name}. New version: ${e.version.major}.${e.version.minor}.${e.version.revision}`):console.log(`Saved item ${e.name}. Version ${e.version.major}.${e.version.minor}.${e.version.revision} -> ${t.version.major}.${t.version.minor}.${t.version.revision}`),t&&t.version&&(e.version=t.version),e.isDirty=false,this.itemChangeProcessor.updateItemLinksAndAttributes(e,true,false),e))).catch((function(t){throw console.error(`Error saving item ${e.name}`,t,e),t}))):null}async save(){console.log("Saving changes in loaded items...");const e=[];for(const t of this.loadedItems.values()){const a=this.saveItem(t);a&&e.push(a);}if(0!==e.length){let t=0;for(const a of e)a.then((function(a){l$1.$emit("itemRepo:itemSaved",{item:a,progress:++t,total:e.length});}));return Promise.all(e).then((function(){console.log("Saved successfully"),l$1.$emit("itemRepo:itemsSaved");})).catch((function(e){console.error("Error saving:",e);}))}console.log("No changes detected.");}async existsUnsavedChanges(){if(!this.activeItem)return false;for(const e of this.loadedItems.values())if(e._id&&e.isDirty)return true;return false}handleRename({id:e,newName:t}){for(const a of this.itemInstances.values())for(const n of a.values())n._id===e&&(n.name=t);}isItemKnown(e){return this.loadedItems.has(e)||this.itemInstances.has(e)||this.loadingItems.has(e)}invalidateId(e){this.loadedItems.delete(e),this.itemInstances.delete(e),this.loadingItems.delete(e);}}var Zi,Ji={exports:{}};
4612
+ */var ie=(ee||(ee=1,function(e,t){(function(){var a,i="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",s=32,o=128,l=256,u=1/0,c=9007199254740991,d=NaN,p=4294967295,h=[["ary",o],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",l]],f="[object Arguments]",m="[object Array]",y="[object Boolean]",g="[object Date]",b="[object Error]",v="[object Function]",_="[object GeneratorFunction]",w="[object Map]",A="[object Number]",k="[object Object]",S="[object Promise]",N="[object RegExp]",T="[object Set]",M="[object String]",x="[object Symbol]",V="[object WeakMap]",C="[object ArrayBuffer]",I="[object DataView]",F="[object Float32Array]",E="[object Float64Array]",R="[object Int8Array]",L="[object Int16Array]",P="[object Int32Array]",B="[object Uint8Array]",O="[object Uint8ClampedArray]",$="[object Uint16Array]",j="[object Uint32Array]",U=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Y=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,G=RegExp(Y.source),q=RegExp(H.source),Z=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ae=RegExp(te.source),ie=/^\s+/,ne=/\s/,re=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,oe=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Ae="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Ne="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",Me="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xe="['’]",Ve="["+we+"]",Ce="["+Me+"]",Ie="["+Ae+"]",Fe="\\d+",Ee="["+ke+"]",De="["+Se+"]",Re="[^"+we+Me+Fe+ke+Se+Ne+"]",Le="\\ud83c[\\udffb-\\udfff]",Pe="[^"+we+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Oe="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Ne+"]",je="\\u200d",Ue="(?:"+De+"|"+Re+")",ze="(?:"+$e+"|"+Re+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",Ye="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ie+"|"+Le+")?",Ge="["+Te+"]?",qe=Ge+He+"(?:"+je+"(?:"+[Pe,Be,Oe].join("|")+")"+Ge+He+")*",Ze="(?:"+[Ee,Be,Oe].join("|")+")"+qe,Je="(?:"+[Pe+Ie+"?",Ie,Be,Oe,Ve].join("|")+")",Ke=RegExp(xe,"g"),Xe=RegExp(Ie,"g"),Qe=RegExp(Le+"(?="+Le+")|"+Je+qe,"g"),et=RegExp([$e+"?"+De+"+"+We+"(?="+[Ce,$e,"$"].join("|")+")",ze+"+"+Ye+"(?="+[Ce,$e+Ue,"$"].join("|")+")",$e+"?"+Ue+"+"+We,$e+"+"+Ye,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fe,Ze].join("|"),"g"),tt=RegExp("["+je+we+Ae+Te+"]"),at=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],nt=-1,rt={};rt[F]=rt[E]=rt[R]=rt[L]=rt[P]=rt[B]=rt[O]=rt[$]=rt[j]=true,rt[f]=rt[m]=rt[C]=rt[y]=rt[I]=rt[g]=rt[b]=rt[v]=rt[w]=rt[A]=rt[k]=rt[N]=rt[T]=rt[M]=rt[V]=false;var st={};st[f]=st[m]=st[C]=st[I]=st[y]=st[g]=st[F]=st[E]=st[R]=st[L]=st[P]=st[w]=st[A]=st[k]=st[N]=st[T]=st[M]=st[x]=st[B]=st[O]=st[$]=st[j]=true,st[b]=st[v]=st[V]=false;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ut=parseInt,ct="object"==typeof D&&D&&D.Object===Object&&D,dt="object"==typeof self&&self&&self.Object===Object&&self,pt=ct||dt||Function("return this")(),ht=t&&!t.nodeType&&t,ft=ht&&e&&!e.nodeType&&e,mt=ft&&ft.exports===ht,yt=mt&&ct.process,gt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),bt=gt&&gt.isArrayBuffer,vt=gt&&gt.isDate,_t=gt&&gt.isMap,wt=gt&&gt.isRegExp,At=gt&&gt.isSet,kt=gt&&gt.isTypedArray;function St(e,t,a){switch(a.length){case 0:return e.call(t);case 1:return e.call(t,a[0]);case 2:return e.call(t,a[0],a[1]);case 3:return e.call(t,a[0],a[1],a[2])}return e.apply(t,a)}function Nt(e,t,a,i){for(var n=-1,r=null==e?0:e.length;++n<r;){var s=e[n];t(i,s,a(s),e);}return i}function Tt(e,t){for(var a=-1,i=null==e?0:e.length;++a<i&&false!==t(e[a],a,e););return e}function Mt(e,t){for(var a=null==e?0:e.length;a--&&false!==t(e[a],a,e););return e}function xt(e,t){for(var a=-1,i=null==e?0:e.length;++a<i;)if(!t(e[a],a,e))return false;return true}function Vt(e,t){for(var a=-1,i=null==e?0:e.length,n=0,r=[];++a<i;){var s=e[a];t(s,a,e)&&(r[n++]=s);}return r}function Ct(e,t){return !(null==e||!e.length)&&$t(e,t,0)>-1}function It(e,t,a){for(var i=-1,n=null==e?0:e.length;++i<n;)if(a(t,e[i]))return true;return false}function Ft(e,t){for(var a=-1,i=null==e?0:e.length,n=Array(i);++a<i;)n[a]=t(e[a],a,e);return n}function Et(e,t){for(var a=-1,i=t.length,n=e.length;++a<i;)e[n+a]=t[a];return e}function Dt(e,t,a,i){var n=-1,r=null==e?0:e.length;for(i&&r&&(a=e[++n]);++n<r;)a=t(a,e[n],n,e);return a}function Rt(e,t,a,i){var n=null==e?0:e.length;for(i&&n&&(a=e[--n]);n--;)a=t(a,e[n],n,e);return a}function Lt(e,t){for(var a=-1,i=null==e?0:e.length;++a<i;)if(t(e[a],a,e))return true;return false}var Pt=Wt("length");function Bt(e,t,a){var i;return a(e,(function(e,a,n){if(t(e,a,n))return i=a,false})),i}function Ot(e,t,a,i){for(var n=e.length,r=a+(i?1:-1);i?r--:++r<n;)if(t(e[r],r,e))return r;return -1}function $t(e,t,a){return t==t?function(e,t,a){for(var i=a-1,n=e.length;++i<n;)if(e[i]===t)return i;return -1}(e,t,a):Ot(e,Ut,a)}function jt(e,t,a,i){for(var n=a-1,r=e.length;++n<r;)if(i(e[n],t))return n;return -1}function Ut(e){return e!=e}function zt(e,t){var a=null==e?0:e.length;return a?Gt(e,t)/a:d}function Wt(e){return function(t){return null==t?a:t[e]}}function Yt(e){return function(t){return null==e?a:e[t]}}function Ht(e,t,a,i,n){return n(e,(function(e,n,r){a=i?(i=false,e):t(a,e,n,r);})),a}function Gt(e,t){for(var i,n=-1,r=e.length;++n<r;){var s=t(e[n]);s!==a&&(i=i===a?s:i+s);}return i}function qt(e,t){for(var a=-1,i=Array(e);++a<e;)i[a]=t(a);return i}function Zt(e){return e?e.slice(0,pa(e)+1).replace(ie,""):e}function Jt(e){return function(t){return e(t)}}function Kt(e,t){return Ft(t,(function(t){return e[t]}))}function Xt(e,t){return e.has(t)}function Qt(e,t){for(var a=-1,i=e.length;++a<i&&$t(t,e[a],0)>-1;);return a}function ea(e,t){for(var a=e.length;a--&&$t(t,e[a],0)>-1;);return a}var ta=Yt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),aa=Yt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function ia(e){return "\\"+ot[e]}function na(e){return tt.test(e)}function ra(e){var t=-1,a=Array(e.size);return e.forEach((function(e,i){a[++t]=[i,e];})),a}function sa(e,t){return function(a){return e(t(a))}}function oa(e,t){for(var a=-1,i=e.length,n=0,s=[];++a<i;){var o=e[a];o!==t&&o!==r||(e[a]=r,s[n++]=a);}return s}function la(e){var t=-1,a=Array(e.size);return e.forEach((function(e){a[++t]=e;})),a}function ua(e){var t=-1,a=Array(e.size);return e.forEach((function(e){a[++t]=[e,e];})),a}function ca(e){return na(e)?function(e){for(var t=Qe.lastIndex=0;Qe.test(e);)++t;return t}(e):Pt(e)}function da(e){return na(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.split("")}(e)}function pa(e){for(var t=e.length;t--&&ne.test(e.charAt(t)););return t}var ha=Yt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fa=function e(t){var D,ne=(t=null==t?pt:fa.defaults(pt.Object(),t,fa.pick(pt,it))).Array,we=t.Date,Ae=t.Error,ke=t.Function,Se=t.Math,Ne=t.Object,Te=t.RegExp,Me=t.String,xe=t.TypeError,Ve=ne.prototype,Ce=ke.prototype,Ie=Ne.prototype,Fe=t["__core-js_shared__"],Ee=Ce.toString,De=Ie.hasOwnProperty,Re=0,Le=(D=/[^.]+$/.exec(Fe&&Fe.keys&&Fe.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",Pe=Ie.toString,Be=Ee.call(Ne),Oe=pt._,$e=Te("^"+Ee.call(De).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=mt?t.Buffer:a,Ue=t.Symbol,ze=t.Uint8Array,We=je?je.allocUnsafe:a,Ye=sa(Ne.getPrototypeOf,Ne),He=Ne.create,Ge=Ie.propertyIsEnumerable,qe=Ve.splice,Ze=Ue?Ue.isConcatSpreadable:a,Je=Ue?Ue.iterator:a,Qe=Ue?Ue.toStringTag:a,tt=function(){try{var e=cr(Ne,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ct=we&&we.now!==pt.Date.now&&we.now,dt=t.setTimeout!==pt.setTimeout&&t.setTimeout,ht=Se.ceil,ft=Se.floor,yt=Ne.getOwnPropertySymbols,gt=je?je.isBuffer:a,Pt=t.isFinite,Yt=Ve.join,ma=sa(Ne.keys,Ne),ya=Se.max,ga=Se.min,ba=we.now,va=t.parseInt,_a=Se.random,wa=Ve.reverse,Aa=cr(t,"DataView"),ka=cr(t,"Map"),Sa=cr(t,"Promise"),Na=cr(t,"Set"),Ta=cr(t,"WeakMap"),Ma=cr(Ne,"create"),xa=Ta&&new Ta,Va={},Ca=Lr(Aa),Ia=Lr(ka),Fa=Lr(Sa),Ea=Lr(Na),Da=Lr(Ta),Ra=Ue?Ue.prototype:a,La=Ra?Ra.valueOf:a,Pa=Ra?Ra.toString:a;function Ba(e){if(Qs(e)&&!Us(e)&&!(e instanceof Ua)){if(e instanceof ja)return e;if(De.call(e,"__wrapped__"))return Pr(e)}return new ja(e)}var Oa=function(){function e(){}return function(t){if(!Xs(t))return {};if(He)return He(t);e.prototype=t;var i=new e;return e.prototype=a,i}}();function $a(){}function ja(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=a;}function Ua(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[];}function za(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var i=e[t];this.set(i[0],i[1]);}}function Wa(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var i=e[t];this.set(i[0],i[1]);}}function Ya(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var i=e[t];this.set(i[0],i[1]);}}function Ha(e){var t=-1,a=null==e?0:e.length;for(this.__data__=new Ya;++t<a;)this.add(e[t]);}function Ga(e){var t=this.__data__=new Wa(e);this.size=t.size;}function qa(e,t){var a=Us(e),i=!a&&js(e),n=!a&&!i&&Hs(e),r=!a&&!i&&!n&&oo(e),s=a||i||n||r,o=s?qt(e.length,Me):[],l=o.length;for(var u in e)!t&&!De.call(e,u)||s&&("length"==u||n&&("offset"==u||"parent"==u)||r&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||gr(u,l))||o.push(u);return o}function Za(e){var t=e.length;return t?e[Hi(0,t-1)]:a}function Ja(e,t){return Er(xn(e),ri(t,0,e.length))}function Ka(e){return Er(xn(e))}function Xa(e,t,i){(i!==a&&!Bs(e[t],i)||i===a&&!(t in e))&&ii(e,t,i);}function Qa(e,t,i){var n=e[t];De.call(e,t)&&Bs(n,i)&&(i!==a||t in e)||ii(e,t,i);}function ei(e,t){for(var a=e.length;a--;)if(Bs(e[a][0],t))return a;return -1}function ti(e,t,a,i){return ci(e,(function(e,n,r){t(i,e,a(e),r);})),i}function ai(e,t){return e&&Vn(t,Co(t),e)}function ii(e,t,a){"__proto__"==t&&tt?tt(e,t,{configurable:true,enumerable:true,value:a,writable:true}):e[t]=a;}function ni(e,t){for(var i=-1,n=t.length,r=ne(n),s=null==e;++i<n;)r[i]=s?a:No(e,t[i]);return r}function ri(e,t,i){return e==e&&(i!==a&&(e=e<=i?e:i),t!==a&&(e=e>=t?e:t)),e}function si(e,t,i,n,r,s){var o,l=1&t,u=2&t,c=4&t;if(i&&(o=r?i(e,n,r,s):i(e)),o!==a)return o;if(!Xs(e))return e;var d=Us(e);if(d){if(o=function(e){var t=e.length,a=new e.constructor(t);return t&&"string"==typeof e[0]&&De.call(e,"index")&&(a.index=e.index,a.input=e.input),a}(e),!l)return xn(e,o)}else {var p=hr(e),h=p==v||p==_;if(Hs(e))return An(e,l);if(p==k||p==f||h&&!r){if(o=u||h?{}:mr(e),!l)return u?function(e,t){return Vn(e,pr(e),t)}(e,function(e,t){return e&&Vn(t,Io(t),e)}(o,e)):function(e,t){return Vn(e,dr(e),t)}(e,ai(o,e))}else {if(!st[p])return r?e:{};o=function(e,t,a){var i,n=e.constructor;switch(t){case C:return kn(e);case y:case g:return new n(+e);case I:return function(e,t){var a=t?kn(e.buffer):e.buffer;return new e.constructor(a,e.byteOffset,e.byteLength)}(e,a);case F:case E:case R:case L:case P:case B:case O:case $:case j:return Sn(e,a);case w:return new n;case A:case M:return new n(e);case N:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case T:return new n;case x:return i=e,La?Ne(La.call(i)):{}}}(e,p,l);}}s||(s=new Ga);var m=s.get(e);if(m)return m;s.set(e,o),no(e)?e.forEach((function(a){o.add(si(a,t,i,a,e,s));})):eo(e)&&e.forEach((function(a,n){o.set(n,si(a,t,i,n,e,s));}));var b=d?a:(c?u?ir:ar:u?Io:Co)(e);return Tt(b||e,(function(a,n){b&&(a=e[n=a]),Qa(o,n,si(a,t,i,n,e,s));})),o}function oi(e,t,i){var n=i.length;if(null==e)return !n;for(e=Ne(e);n--;){var r=i[n],s=t[r],o=e[r];if(o===a&&!(r in e)||!s(o))return false}return true}function li(e,t,n){if("function"!=typeof e)throw new xe(i);return Vr((function(){e.apply(a,n);}),t)}function ui(e,t,a,i){var n=-1,r=Ct,s=true,o=e.length,l=[],u=t.length;if(!o)return l;a&&(t=Ft(t,Jt(a))),i?(r=It,s=false):t.length>=200&&(r=Xt,s=false,t=new Ha(t));e:for(;++n<o;){var c=e[n],d=null==a?c:a(c);if(c=i||0!==c?c:0,s&&d==d){for(var p=u;p--;)if(t[p]===d)continue e;l.push(c);}else r(t,d,i)||l.push(c);}return l}Ba.templateSettings={escape:Z,evaluate:J,interpolate:K,variable:"",imports:{_:Ba}},Ba.prototype=$a.prototype,Ba.prototype.constructor=Ba,ja.prototype=Oa($a.prototype),ja.prototype.constructor=ja,Ua.prototype=Oa($a.prototype),Ua.prototype.constructor=Ua,za.prototype.clear=function(){this.__data__=Ma?Ma(null):{},this.size=0;},za.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},za.prototype.get=function(e){var t=this.__data__;if(Ma){var i=t[e];return i===n?a:i}return De.call(t,e)?t[e]:a},za.prototype.has=function(e){var t=this.__data__;return Ma?t[e]!==a:De.call(t,e)},za.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Ma&&t===a?n:t,this},Wa.prototype.clear=function(){this.__data__=[],this.size=0;},Wa.prototype.delete=function(e){var t=this.__data__,a=ei(t,e);return !(a<0||(a==t.length-1?t.pop():qe.call(t,a,1),--this.size,0))},Wa.prototype.get=function(e){var t=this.__data__,i=ei(t,e);return i<0?a:t[i][1]},Wa.prototype.has=function(e){return ei(this.__data__,e)>-1},Wa.prototype.set=function(e,t){var a=this.__data__,i=ei(a,e);return i<0?(++this.size,a.push([e,t])):a[i][1]=t,this},Ya.prototype.clear=function(){this.size=0,this.__data__={hash:new za,map:new(ka||Wa),string:new za};},Ya.prototype.delete=function(e){var t=lr(this,e).delete(e);return this.size-=t?1:0,t},Ya.prototype.get=function(e){return lr(this,e).get(e)},Ya.prototype.has=function(e){return lr(this,e).has(e)},Ya.prototype.set=function(e,t){var a=lr(this,e),i=a.size;return a.set(e,t),this.size+=a.size==i?0:1,this},Ha.prototype.add=Ha.prototype.push=function(e){return this.__data__.set(e,n),this},Ha.prototype.has=function(e){return this.__data__.has(e)},Ga.prototype.clear=function(){this.__data__=new Wa,this.size=0;},Ga.prototype.delete=function(e){var t=this.__data__,a=t.delete(e);return this.size=t.size,a},Ga.prototype.get=function(e){return this.__data__.get(e)},Ga.prototype.has=function(e){return this.__data__.has(e)},Ga.prototype.set=function(e,t){var a=this.__data__;if(a instanceof Wa){var i=a.__data__;if(!ka||i.length<199)return i.push([e,t]),this.size=++a.size,this;a=this.__data__=new Ya(i);}return a.set(e,t),this.size=a.size,this};var ci=Fn(bi),di=Fn(vi,true);function pi(e,t){var a=true;return ci(e,(function(e,i,n){return a=!!t(e,i,n)})),a}function hi(e,t,i){for(var n=-1,r=e.length;++n<r;){var s=e[n],o=t(s);if(null!=o&&(l===a?o==o&&!so(o):i(o,l)))var l=o,u=s;}return u}function fi(e,t){var a=[];return ci(e,(function(e,i,n){t(e,i,n)&&a.push(e);})),a}function mi(e,t,a,i,n){var r=-1,s=e.length;for(a||(a=yr),n||(n=[]);++r<s;){var o=e[r];t>0&&a(o)?t>1?mi(o,t-1,a,i,n):Et(n,o):i||(n[n.length]=o);}return n}var yi=En(),gi=En(true);function bi(e,t){return e&&yi(e,t,Co)}function vi(e,t){return e&&gi(e,t,Co)}function _i(e,t){return Vt(t,(function(t){return Zs(e[t])}))}function wi(e,t){for(var i=0,n=(t=bn(t,e)).length;null!=e&&i<n;)e=e[Rr(t[i++])];return i&&i==n?e:a}function Ai(e,t,a){var i=t(e);return Us(e)?i:Et(i,a(e))}function ki(e){return null==e?e===a?"[object Undefined]":"[object Null]":Qe&&Qe in Ne(e)?function(e){var t=De.call(e,Qe),i=e[Qe];try{e[Qe]=a;var n=!0;}catch(e){}var r=Pe.call(e);return n&&(t?e[Qe]=i:delete e[Qe]),r}(e):function(e){return Pe.call(e)}(e)}function Si(e,t){return e>t}function Ni(e,t){return null!=e&&De.call(e,t)}function Ti(e,t){return null!=e&&t in Ne(e)}function Mi(e,t,i){for(var n=i?It:Ct,r=e[0].length,s=e.length,o=s,l=ne(s),u=1/0,c=[];o--;){var d=e[o];o&&t&&(d=Ft(d,Jt(t))),u=ga(d.length,u),l[o]=!i&&(t||r>=120&&d.length>=120)?new Ha(o&&d):a;}d=e[0];var p=-1,h=l[0];e:for(;++p<r&&c.length<u;){var f=d[p],m=t?t(f):f;if(f=i||0!==f?f:0,!(h?Xt(h,m):n(c,m,i))){for(o=s;--o;){var y=l[o];if(!(y?Xt(y,m):n(e[o],m,i)))continue e}h&&h.push(m),c.push(f);}}return c}function xi(e,t,i){var n=null==(e=Tr(e,t=bn(t,e)))?e:e[Rr(qr(t))];return null==n?a:St(n,e,i)}function Vi(e){return Qs(e)&&ki(e)==f}function Ci(e,t,i,n,r){return e===t||(null==e||null==t||!Qs(e)&&!Qs(t)?e!=e&&t!=t:function(e,t,i,n,r,s){var o=Us(e),l=Us(t),u=o?m:hr(e),c=l?m:hr(t),d=(u=u==f?k:u)==k,p=(c=c==f?k:c)==k,h=u==c;if(h&&Hs(e)){if(!Hs(t))return false;o=true,d=false;}if(h&&!d)return s||(s=new Ga),o||oo(e)?er(e,t,i,n,r,s):function(e,t,a,i,n,r,s){switch(a){case I:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return false;e=e.buffer,t=t.buffer;case C:return !(e.byteLength!=t.byteLength||!r(new ze(e),new ze(t)));case y:case g:case A:return Bs(+e,+t);case b:return e.name==t.name&&e.message==t.message;case N:case M:return e==t+"";case w:var o=ra;case T:var l=1&i;if(o||(o=la),e.size!=t.size&&!l)return false;var u=s.get(e);if(u)return u==t;i|=2,s.set(e,t);var c=er(o(e),o(t),i,n,r,s);return s.delete(e),c;case x:if(La)return La.call(e)==La.call(t)}return false}(e,t,u,i,n,r,s);if(!(1&i)){var v=d&&De.call(e,"__wrapped__"),_=p&&De.call(t,"__wrapped__");if(v||_){var S=v?e.value():e,V=_?t.value():t;return s||(s=new Ga),r(S,V,i,n,s)}}return !!h&&(s||(s=new Ga),function(e,t,i,n,r,s){var o=1&i,l=ar(e),u=l.length,c=ar(t),d=c.length;if(u!=d&&!o)return false;for(var p=u;p--;){var h=l[p];if(!(o?h in t:De.call(t,h)))return false}var f=s.get(e),m=s.get(t);if(f&&m)return f==t&&m==e;var y=true;s.set(e,t),s.set(t,e);for(var g=o;++p<u;){var b=e[h=l[p]],v=t[h];if(n)var _=o?n(v,b,h,t,e,s):n(b,v,h,e,t,s);if(!(_===a?b===v||r(b,v,i,n,s):_)){y=false;break}g||(g="constructor"==h);}if(y&&!g){var w=e.constructor,A=t.constructor;w==A||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof A&&A instanceof A||(y=false);}return s.delete(e),s.delete(t),y}(e,t,i,n,r,s))}(e,t,i,n,Ci,r))}function Ii(e,t,i,n){var r=i.length,s=r,o=!n;if(null==e)return !s;for(e=Ne(e);r--;){var l=i[r];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return false}for(;++r<s;){var u=(l=i[r])[0],c=e[u],d=l[1];if(o&&l[2]){if(c===a&&!(u in e))return false}else {var p=new Ga;if(n)var h=n(c,d,u,e,t,p);if(!(h===a?Ci(d,c,3,n,p):h))return false}}return true}function Fi(e){return !(!Xs(e)||(t=e,Le&&Le in t))&&(Zs(e)?$e:me).test(Lr(e));var t;}function Ei(e){return "function"==typeof e?e:null==e?al:"object"==typeof e?Us(e)?Oi(e[0],e[1]):Bi(e):dl(e)}function Di(e){if(!Ar(e))return ma(e);var t=[];for(var a in Ne(e))De.call(e,a)&&"constructor"!=a&&t.push(a);return t}function Ri(e){if(!Xs(e))return function(e){var t=[];if(null!=e)for(var a in Ne(e))t.push(a);return t}(e);var t=Ar(e),a=[];for(var i in e)("constructor"!=i||!t&&De.call(e,i))&&a.push(i);return a}function Li(e,t){return e<t}function Pi(e,t){var a=-1,i=Ws(e)?ne(e.length):[];return ci(e,(function(e,n,r){i[++a]=t(e,n,r);})),i}function Bi(e){var t=ur(e);return 1==t.length&&t[0][2]?Sr(t[0][0],t[0][1]):function(a){return a===e||Ii(a,e,t)}}function Oi(e,t){return vr(e)&&kr(t)?Sr(Rr(e),t):function(i){var n=No(i,e);return n===a&&n===t?To(i,e):Ci(t,n,3)}}function $i(e,t,i,n,r){e!==t&&yi(t,(function(s,o){if(r||(r=new Ga),Xs(s))!function(e,t,i,n,r,s,o){var l=Mr(e,i),u=Mr(t,i),c=o.get(u);if(c)Xa(e,i,c);else {var d=s?s(l,u,i+"",e,t,o):a,p=d===a;if(p){var h=Us(u),f=!h&&Hs(u),m=!h&&!f&&oo(u);d=u,h||f||m?Us(l)?d=l:Ys(l)?d=xn(l):f?(p=false,d=An(u,true)):m?(p=false,d=Sn(u,true)):d=[]:ao(u)||js(u)?(d=l,js(l)?d=yo(l):Xs(l)&&!Zs(l)||(d=mr(u))):p=false;}p&&(o.set(u,d),r(d,u,n,s,o),o.delete(u)),Xa(e,i,d);}}(e,t,o,i,$i,n,r);else {var l=n?n(Mr(e,o),s,o+"",e,t,r):a;l===a&&(l=s),Xa(e,o,l);}}),Io);}function ji(e,t){var i=e.length;if(i)return gr(t+=t<0?i:0,i)?e[t]:a}function Ui(e,t,a){t=t.length?Ft(t,(function(e){return Us(e)?function(t){return wi(t,1===e.length?e[0]:e)}:e})):[al];var i=-1;t=Ft(t,Jt(or()));var n=Pi(e,(function(e,a,n){var r=Ft(t,(function(t){return t(e)}));return {criteria:r,index:++i,value:e}}));return function(e,t){var a=e.length;for(e.sort(t);a--;)e[a]=e[a].value;return e}(n,(function(e,t){return function(e,t,a){for(var i=-1,n=e.criteria,r=t.criteria,s=n.length,o=a.length;++i<s;){var l=Nn(n[i],r[i]);if(l)return i>=o?l:l*("desc"==a[i]?-1:1)}return e.index-t.index}(e,t,a)}))}function zi(e,t,a){for(var i=-1,n=t.length,r={};++i<n;){var s=t[i],o=wi(e,s);a(o,s)&&Ki(r,bn(s,e),o);}return r}function Wi(e,t,a,i){var n=i?jt:$t,r=-1,s=t.length,o=e;for(e===t&&(t=xn(t)),a&&(o=Ft(e,Jt(a)));++r<s;)for(var l=0,u=t[r],c=a?a(u):u;(l=n(o,c,l,i))>-1;)o!==e&&qe.call(o,l,1),qe.call(e,l,1);return e}function Yi(e,t){for(var a=e?t.length:0,i=a-1;a--;){var n=t[a];if(a==i||n!==r){var r=n;gr(n)?qe.call(e,n,1):cn(e,n);}}return e}function Hi(e,t){return e+ft(_a()*(t-e+1))}function Gi(e,t){var a="";if(!e||t<1||t>c)return a;do{t%2&&(a+=e),(t=ft(t/2))&&(e+=e);}while(t);return a}function qi(e,t){return Cr(Nr(e,t,al),e+"")}function Zi(e){return Za(Oo(e))}function Ji(e,t){var a=Oo(e);return Er(a,ri(t,0,a.length))}function Ki(e,t,i,n){if(!Xs(e))return e;for(var r=-1,s=(t=bn(t,e)).length,o=s-1,l=e;null!=l&&++r<s;){var u=Rr(t[r]),c=i;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(r!=o){var d=l[u];(c=n?n(d,u,l):a)===a&&(c=Xs(d)?d:gr(t[r+1])?[]:{});}Qa(l,u,c),l=l[u];}return e}var Xi=xa?function(e,t){return xa.set(e,t),e}:al,Qi=tt?function(e,t){return tt(e,"toString",{configurable:true,enumerable:false,value:Qo(t),writable:true})}:al;function en(e){return Er(Oo(e))}function tn(e,t,a){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(a=a>n?n:a)<0&&(a+=n),n=t>a?0:a-t>>>0,t>>>=0;for(var r=ne(n);++i<n;)r[i]=e[i+t];return r}function an(e,t){var a;return ci(e,(function(e,i,n){return !(a=t(e,i,n))})),!!a}function nn(e,t,a){var i=0,n=null==e?i:e.length;if("number"==typeof t&&t==t&&n<=2147483647){for(;i<n;){var r=i+n>>>1,s=e[r];null!==s&&!so(s)&&(a?s<=t:s<t)?i=r+1:n=r;}return n}return rn(e,t,al,a)}function rn(e,t,i,n){var r=0,s=null==e?0:e.length;if(0===s)return 0;for(var o=(t=i(t))!=t,l=null===t,u=so(t),c=t===a;r<s;){var d=ft((r+s)/2),p=i(e[d]),h=p!==a,f=null===p,m=p==p,y=so(p);if(o)var g=n||m;else g=c?m&&(n||h):l?m&&h&&(n||!f):u?m&&h&&!f&&(n||!y):!f&&!y&&(n?p<=t:p<t);g?r=d+1:s=d;}return ga(s,4294967294)}function sn(e,t){for(var a=-1,i=e.length,n=0,r=[];++a<i;){var s=e[a],o=t?t(s):s;if(!a||!Bs(o,l)){var l=o;r[n++]=0===s?0:s;}}return r}function on(e){return "number"==typeof e?e:so(e)?d:+e}function ln(e){if("string"==typeof e)return e;if(Us(e))return Ft(e,ln)+"";if(so(e))return Pa?Pa.call(e):"";var t=e+"";return "0"==t&&1/e==-1/0?"-0":t}function un(e,t,a){var i=-1,n=Ct,r=e.length,s=true,o=[],l=o;if(a)s=false,n=It;else if(r>=200){var u=t?null:qn(e);if(u)return la(u);s=false,n=Xt,l=new Ha;}else l=t?[]:o;e:for(;++i<r;){var c=e[i],d=t?t(c):c;if(c=a||0!==c?c:0,s&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;t&&l.push(d),o.push(c);}else n(l,d,a)||(l!==o&&l.push(d),o.push(c));}return o}function cn(e,t){return null==(e=Tr(e,t=bn(t,e)))||delete e[Rr(qr(t))]}function dn(e,t,a,i){return Ki(e,t,a(wi(e,t)),i)}function pn(e,t,a,i){for(var n=e.length,r=i?n:-1;(i?r--:++r<n)&&t(e[r],r,e););return a?tn(e,i?0:r,i?r+1:n):tn(e,i?r+1:0,i?n:r)}function hn(e,t){var a=e;return a instanceof Ua&&(a=a.value()),Dt(t,(function(e,t){return t.func.apply(t.thisArg,Et([e],t.args))}),a)}function fn(e,t,a){var i=e.length;if(i<2)return i?un(e[0]):[];for(var n=-1,r=ne(i);++n<i;)for(var s=e[n],o=-1;++o<i;)o!=n&&(r[n]=ui(r[n]||s,e[o],t,a));return un(mi(r,1),t,a)}function mn(e,t,i){for(var n=-1,r=e.length,s=t.length,o={};++n<r;){var l=n<s?t[n]:a;i(o,e[n],l);}return o}function yn(e){return Ys(e)?e:[]}function gn(e){return "function"==typeof e?e:al}function bn(e,t){return Us(e)?e:vr(e,t)?[e]:Dr(go(e))}var vn=qi;function _n(e,t,i){var n=e.length;return i=i===a?n:i,!t&&i>=n?e:tn(e,t,i)}var wn=ot||function(e){return pt.clearTimeout(e)};function An(e,t){if(t)return e.slice();var a=e.length,i=We?We(a):new e.constructor(a);return e.copy(i),i}function kn(e){var t=new e.constructor(e.byteLength);return new ze(t).set(new ze(e)),t}function Sn(e,t){var a=t?kn(e.buffer):e.buffer;return new e.constructor(a,e.byteOffset,e.length)}function Nn(e,t){if(e!==t){var i=e!==a,n=null===e,r=e==e,s=so(e),o=t!==a,l=null===t,u=t==t,c=so(t);if(!l&&!c&&!s&&e>t||s&&o&&u&&!l&&!c||n&&o&&u||!i&&u||!r)return 1;if(!n&&!s&&!c&&e<t||c&&i&&r&&!n&&!s||l&&i&&r||!o&&r||!u)return -1}return 0}function Tn(e,t,a,i){for(var n=-1,r=e.length,s=a.length,o=-1,l=t.length,u=ya(r-s,0),c=ne(l+u),d=!i;++o<l;)c[o]=t[o];for(;++n<s;)(d||n<r)&&(c[a[n]]=e[n]);for(;u--;)c[o++]=e[n++];return c}function Mn(e,t,a,i){for(var n=-1,r=e.length,s=-1,o=a.length,l=-1,u=t.length,c=ya(r-o,0),d=ne(c+u),p=!i;++n<c;)d[n]=e[n];for(var h=n;++l<u;)d[h+l]=t[l];for(;++s<o;)(p||n<r)&&(d[h+a[s]]=e[n++]);return d}function xn(e,t){var a=-1,i=e.length;for(t||(t=ne(i));++a<i;)t[a]=e[a];return t}function Vn(e,t,i,n){var r=!i;i||(i={});for(var s=-1,o=t.length;++s<o;){var l=t[s],u=n?n(i[l],e[l],l,i,e):a;u===a&&(u=e[l]),r?ii(i,l,u):Qa(i,l,u);}return i}function Cn(e,t){return function(a,i){var n=Us(a)?Nt:ti,r=t?t():{};return n(a,e,or(i,2),r)}}function In(e){return qi((function(t,i){var n=-1,r=i.length,s=r>1?i[r-1]:a,o=r>2?i[2]:a;for(s=e.length>3&&"function"==typeof s?(r--,s):a,o&&br(i[0],i[1],o)&&(s=r<3?a:s,r=1),t=Ne(t);++n<r;){var l=i[n];l&&e(t,l,n,s);}return t}))}function Fn(e,t){return function(a,i){if(null==a)return a;if(!Ws(a))return e(a,i);for(var n=a.length,r=t?n:-1,s=Ne(a);(t?r--:++r<n)&&false!==i(s[r],r,s););return a}}function En(e){return function(t,a,i){for(var n=-1,r=Ne(t),s=i(t),o=s.length;o--;){var l=s[e?o:++n];if(false===a(r[l],l,r))break}return t}}function Dn(e){return function(t){var i=na(t=go(t))?da(t):a,n=i?i[0]:t.charAt(0),r=i?_n(i,1).join(""):t.slice(1);return n[e]()+r}}function Rn(e){return function(t){return Dt(Jo(Uo(t).replace(Ke,"")),e,"")}}function Ln(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var a=Oa(e.prototype),i=e.apply(a,t);return Xs(i)?i:a}}function Pn(e){return function(t,i,n){var r=Ne(t);if(!Ws(t)){var s=or(i,3);t=Co(t),i=function(e){return s(r[e],e,r)};}var o=e(t,i,n);return o>-1?r[s?t[o]:o]:a}}function Bn(e){return tr((function(t){var n=t.length,r=n,s=ja.prototype.thru;for(e&&t.reverse();r--;){var o=t[r];if("function"!=typeof o)throw new xe(i);if(s&&!l&&"wrapper"==rr(o))var l=new ja([],true);}for(r=l?r:n;++r<n;){var u=rr(o=t[r]),c="wrapper"==u?nr(o):a;l=c&&_r(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?l[rr(c[0])].apply(l,c[3]):1==o.length&&_r(o)?l[u]():l.thru(o);}return function(){var e=arguments,a=e[0];if(l&&1==e.length&&Us(a))return l.plant(a).value();for(var i=0,r=n?t[i].apply(this,e):a;++i<n;)r=t[i].call(this,r);return r}}))}function On(e,t,i,n,r,s,l,u,c,d){var p=t&o,h=1&t,f=2&t,m=24&t,y=512&t,g=f?a:Ln(e);return function o(){for(var b=arguments.length,v=ne(b),_=b;_--;)v[_]=arguments[_];if(m)var w=sr(o),A=function(e,t){for(var a=e.length,i=0;a--;)e[a]===t&&++i;return i}(v,w);if(n&&(v=Tn(v,n,r,m)),s&&(v=Mn(v,s,l,m)),b-=A,m&&b<d){var k=oa(v,w);return Hn(e,t,On,o.placeholder,i,v,k,u,c,d-b)}var S=h?i:this,N=f?S[e]:e;return b=v.length,u?v=function(e,t){for(var i=e.length,n=ga(t.length,i),r=xn(e);n--;){var s=t[n];e[n]=gr(s,i)?r[s]:a;}return e}(v,u):y&&b>1&&v.reverse(),p&&c<b&&(v.length=c),this&&this!==pt&&this instanceof o&&(N=g||Ln(N)),N.apply(S,v)}}function $n(e,t){return function(a,i){return function(e,t,a,i){return bi(e,(function(e,n,r){t(i,a(e),n,r);})),i}(a,e,t(i),{})}}function jn(e,t){return function(i,n){var r;if(i===a&&n===a)return t;if(i!==a&&(r=i),n!==a){if(r===a)return n;"string"==typeof i||"string"==typeof n?(i=ln(i),n=ln(n)):(i=on(i),n=on(n)),r=e(i,n);}return r}}function Un(e){return tr((function(t){return t=Ft(t,Jt(or())),qi((function(a){var i=this;return e(t,(function(e){return St(e,i,a)}))}))}))}function zn(e,t){var i=(t=t===a?" ":ln(t)).length;if(i<2)return i?Gi(t,e):t;var n=Gi(t,ht(e/ca(t)));return na(t)?_n(da(n),0,e).join(""):n.slice(0,e)}function Wn(e){return function(t,i,n){return n&&"number"!=typeof n&&br(t,i,n)&&(i=n=a),t=po(t),i===a?(i=t,t=0):i=po(i),function(e,t,a,i){for(var n=-1,r=ya(ht((t-e)/(a||1)),0),s=ne(r);r--;)s[i?r:++n]=e,e+=a;return s}(t,i,n=n===a?t<i?1:-1:po(n),e)}}function Yn(e){return function(t,a){return "string"==typeof t&&"string"==typeof a||(t=mo(t),a=mo(a)),e(t,a)}}function Hn(e,t,i,n,r,o,l,u,c,d){var p=8&t;t|=p?s:64,4&(t&=~(p?64:s))||(t&=-4);var h=[e,t,r,p?o:a,p?l:a,p?a:o,p?a:l,u,c,d],f=i.apply(a,h);return _r(e)&&xr(f,h),f.placeholder=n,Ir(f,e,t)}function Gn(e){var t=Se[e];return function(e,a){if(e=mo(e),(a=null==a?0:ga(ho(a),292))&&Pt(e)){var i=(go(e)+"e").split("e");return +((i=(go(t(i[0]+"e"+(+i[1]+a)))+"e").split("e"))[0]+"e"+(+i[1]-a))}return t(e)}}var qn=Na&&1/la(new Na([,-0]))[1]==u?function(e){return new Na(e)}:ol;function Zn(e){return function(t){var a=hr(t);return a==w?ra(t):a==T?ua(t):function(e,t){return Ft(t,(function(t){return [t,e[t]]}))}(t,e(t))}}function Jn(e,t,n,u,c,d,p,h){var f=2&t;if(!f&&"function"!=typeof e)throw new xe(i);var m=u?u.length:0;if(m||(t&=-97,u=c=a),p=p===a?p:ya(ho(p),0),h=h===a?h:ho(h),m-=c?c.length:0,64&t){var y=u,g=c;u=c=a;}var b=f?a:nr(e),v=[e,t,n,u,c,y,g,d,p,h];if(b&&function(e,t){var a=e[1],i=t[1],n=a|i,s=n<131,u=i==o&&8==a||i==o&&a==l&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==a;if(!s&&!u)return e;1&i&&(e[2]=t[2],n|=1&a?0:4);var c=t[3];if(c){var d=e[3];e[3]=d?Tn(d,c,t[4]):c,e[4]=d?oa(e[3],r):t[4];}(c=t[5])&&(d=e[5],e[5]=d?Mn(d,c,t[6]):c,e[6]=d?oa(e[5],r):t[6]),(c=t[7])&&(e[7]=c),i&o&&(e[8]=null==e[8]?t[8]:ga(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=n;}(v,b),e=v[0],t=v[1],n=v[2],u=v[3],c=v[4],!(h=v[9]=v[9]===a?f?0:e.length:ya(v[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,i){var n=Ln(e);return function r(){for(var s=arguments.length,o=ne(s),l=s,u=sr(r);l--;)o[l]=arguments[l];var c=s<3&&o[0]!==u&&o[s-1]!==u?[]:oa(o,u);return (s-=c.length)<i?Hn(e,t,On,r.placeholder,a,o,c,a,a,i-s):St(this&&this!==pt&&this instanceof r?n:e,this,o)}}(e,t,h):t!=s&&33!=t||c.length?On.apply(a,v):function(e,t,a,i){var n=1&t,r=Ln(e);return function t(){for(var s=-1,o=arguments.length,l=-1,u=i.length,c=ne(u+o),d=this&&this!==pt&&this instanceof t?r:e;++l<u;)c[l]=i[l];for(;o--;)c[l++]=arguments[++s];return St(d,n?a:this,c)}}(e,t,n,u);else var _=function(e,t,a){var i=1&t,n=Ln(e);return function t(){return (this&&this!==pt&&this instanceof t?n:e).apply(i?a:this,arguments)}}(e,t,n);return Ir((b?Xi:xr)(_,v),e,t)}function Kn(e,t,i,n){return e===a||Bs(e,Ie[i])&&!De.call(n,i)?t:e}function Xn(e,t,i,n,r,s){return Xs(e)&&Xs(t)&&(s.set(t,e),$i(e,t,a,Xn,s),s.delete(t)),e}function Qn(e){return ao(e)?a:e}function er(e,t,i,n,r,s){var o=1&i,l=e.length,u=t.length;if(l!=u&&!(o&&u>l))return false;var c=s.get(e),d=s.get(t);if(c&&d)return c==t&&d==e;var p=-1,h=true,f=2&i?new Ha:a;for(s.set(e,t),s.set(t,e);++p<l;){var m=e[p],y=t[p];if(n)var g=o?n(y,m,p,t,e,s):n(m,y,p,e,t,s);if(g!==a){if(g)continue;h=false;break}if(f){if(!Lt(t,(function(e,t){if(!Xt(f,t)&&(m===e||r(m,e,i,n,s)))return f.push(t)}))){h=false;break}}else if(m!==y&&!r(m,y,i,n,s)){h=false;break}}return s.delete(e),s.delete(t),h}function tr(e){return Cr(Nr(e,a,zr),e+"")}function ar(e){return Ai(e,Co,dr)}function ir(e){return Ai(e,Io,pr)}var nr=xa?function(e){return xa.get(e)}:ol;function rr(e){for(var t=e.name+"",a=Va[t],i=De.call(Va,t)?a.length:0;i--;){var n=a[i],r=n.func;if(null==r||r==e)return n.name}return t}function sr(e){return (De.call(Ba,"placeholder")?Ba:e).placeholder}function or(){var e=Ba.iteratee||il;return e=e===il?Ei:e,arguments.length?e(arguments[0],arguments[1]):e}function lr(e,t){var a,i,n=e.__data__;return ("string"==(i=typeof(a=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==a:null===a)?n["string"==typeof t?"string":"hash"]:n.map}function ur(e){for(var t=Co(e),a=t.length;a--;){var i=t[a],n=e[i];t[a]=[i,n,kr(n)];}return t}function cr(e,t){var i=function(e,t){return null==e?a:e[t]}(e,t);return Fi(i)?i:a}var dr=yt?function(e){return null==e?[]:(e=Ne(e),Vt(yt(e),(function(t){return Ge.call(e,t)})))}:fl,pr=yt?function(e){for(var t=[];e;)Et(t,dr(e)),e=Ye(e);return t}:fl,hr=ki;function fr(e,t,a){for(var i=-1,n=(t=bn(t,e)).length,r=false;++i<n;){var s=Rr(t[i]);if(!(r=null!=e&&a(e,s)))break;e=e[s];}return r||++i!=n?r:!!(n=null==e?0:e.length)&&Ks(n)&&gr(s,n)&&(Us(e)||js(e))}function mr(e){return "function"!=typeof e.constructor||Ar(e)?{}:Oa(Ye(e))}function yr(e){return Us(e)||js(e)||!!(Ze&&e&&e[Ze])}function gr(e,t){var a=typeof e;return !!(t=null==t?c:t)&&("number"==a||"symbol"!=a&&ge.test(e))&&e>-1&&e%1==0&&e<t}function br(e,t,a){if(!Xs(a))return false;var i=typeof t;return !!("number"==i?Ws(a)&&gr(t,a.length):"string"==i&&t in a)&&Bs(a[t],e)}function vr(e,t){if(Us(e))return false;var a=typeof e;return !("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=e&&!so(e))||Q.test(e)||!X.test(e)||null!=t&&e in Ne(t)}function _r(e){var t=rr(e),a=Ba[t];if("function"!=typeof a||!(t in Ua.prototype))return false;if(e===a)return true;var i=nr(a);return !!i&&e===i[0]}(Aa&&hr(new Aa(new ArrayBuffer(1)))!=I||ka&&hr(new ka)!=w||Sa&&hr(Sa.resolve())!=S||Na&&hr(new Na)!=T||Ta&&hr(new Ta)!=V)&&(hr=function(e){var t=ki(e),i=t==k?e.constructor:a,n=i?Lr(i):"";if(n)switch(n){case Ca:return I;case Ia:return w;case Fa:return S;case Ea:return T;case Da:return V}return t});var wr=Fe?Zs:ml;function Ar(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ie)}function kr(e){return e==e&&!Xs(e)}function Sr(e,t){return function(i){return null!=i&&i[e]===t&&(t!==a||e in Ne(i))}}function Nr(e,t,i){return t=ya(t===a?e.length-1:t,0),function(){for(var a=arguments,n=-1,r=ya(a.length-t,0),s=ne(r);++n<r;)s[n]=a[t+n];n=-1;for(var o=ne(t+1);++n<t;)o[n]=a[n];return o[t]=i(s),St(e,this,o)}}function Tr(e,t){return t.length<2?e:wi(e,tn(t,0,-1))}function Mr(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var xr=Fr(Xi),Vr=dt||function(e,t){return pt.setTimeout(e,t)},Cr=Fr(Qi);function Ir(e,t,a){var i=t+"";return Cr(e,function(e,t){var a=t.length;if(!a)return e;var i=a-1;return t[i]=(a>1?"& ":"")+t[i],t=t.join(a>2?", ":" "),e.replace(re,"{\n/* [wrapped with "+t+"] */\n")}(i,function(e,t){return Tt(h,(function(a){var i="_."+a[0];t&a[1]&&!Ct(e,i)&&e.push(i);})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(oe):[]}(i),a)))}function Fr(e){var t=0,i=0;return function(){var n=ba(),r=16-(n-i);if(i=n,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(a,arguments)}}function Er(e,t){var i=-1,n=e.length,r=n-1;for(t=t===a?n:t;++i<t;){var s=Hi(i,r),o=e[s];e[s]=e[i],e[i]=o;}return e.length=t,e}var Dr=function(e){var t=Fs(e,(function(e){return 500===a.size&&a.clear(),e})),a=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,a,i,n){t.push(i?n.replace(ce,"$1"):a||e);})),t}));function Rr(e){if("string"==typeof e||so(e))return e;var t=e+"";return "0"==t&&1/e==-1/0?"-0":t}function Lr(e){if(null!=e){try{return Ee.call(e)}catch(e){}try{return e+""}catch(e){}}return ""}function Pr(e){if(e instanceof Ua)return e.clone();var t=new ja(e.__wrapped__,e.__chain__);return t.__actions__=xn(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Br=qi((function(e,t){return Ys(e)?ui(e,mi(t,1,Ys,true)):[]})),Or=qi((function(e,t){var i=qr(t);return Ys(i)&&(i=a),Ys(e)?ui(e,mi(t,1,Ys,true),or(i,2)):[]})),$r=qi((function(e,t){var i=qr(t);return Ys(i)&&(i=a),Ys(e)?ui(e,mi(t,1,Ys,true),a,i):[]}));function jr(e,t,a){var i=null==e?0:e.length;if(!i)return -1;var n=null==a?0:ho(a);return n<0&&(n=ya(i+n,0)),Ot(e,or(t,3),n)}function Ur(e,t,i){var n=null==e?0:e.length;if(!n)return -1;var r=n-1;return i!==a&&(r=ho(i),r=i<0?ya(n+r,0):ga(r,n-1)),Ot(e,or(t,3),r,true)}function zr(e){return null!=e&&e.length?mi(e,1):[]}function Wr(e){return e&&e.length?e[0]:a}var Yr=qi((function(e){var t=Ft(e,yn);return t.length&&t[0]===e[0]?Mi(t):[]})),Hr=qi((function(e){var t=qr(e),i=Ft(e,yn);return t===qr(i)?t=a:i.pop(),i.length&&i[0]===e[0]?Mi(i,or(t,2)):[]})),Gr=qi((function(e){var t=qr(e),i=Ft(e,yn);return (t="function"==typeof t?t:a)&&i.pop(),i.length&&i[0]===e[0]?Mi(i,a,t):[]}));function qr(e){var t=null==e?0:e.length;return t?e[t-1]:a}var Zr=qi(Jr);function Jr(e,t){return e&&e.length&&t&&t.length?Wi(e,t):e}var Kr=tr((function(e,t){var a=null==e?0:e.length,i=ni(e,t);return Yi(e,Ft(t,(function(e){return gr(e,a)?+e:e})).sort(Nn)),i}));function Xr(e){return null==e?e:wa.call(e)}var Qr=qi((function(e){return un(mi(e,1,Ys,true))})),es=qi((function(e){var t=qr(e);return Ys(t)&&(t=a),un(mi(e,1,Ys,true),or(t,2))})),ts=qi((function(e){var t=qr(e);return t="function"==typeof t?t:a,un(mi(e,1,Ys,true),a,t)}));function as(e){if(!e||!e.length)return [];var t=0;return e=Vt(e,(function(e){if(Ys(e))return t=ya(e.length,t),true})),qt(t,(function(t){return Ft(e,Wt(t))}))}function is(e,t){if(!e||!e.length)return [];var i=as(e);return null==t?i:Ft(i,(function(e){return St(t,a,e)}))}var ns=qi((function(e,t){return Ys(e)?ui(e,t):[]})),rs=qi((function(e){return fn(Vt(e,Ys))})),ss=qi((function(e){var t=qr(e);return Ys(t)&&(t=a),fn(Vt(e,Ys),or(t,2))})),os=qi((function(e){var t=qr(e);return t="function"==typeof t?t:a,fn(Vt(e,Ys),a,t)})),ls=qi(as),us=qi((function(e){var t=e.length,i=t>1?e[t-1]:a;return i="function"==typeof i?(e.pop(),i):a,is(e,i)}));function cs(e){var t=Ba(e);return t.__chain__=true,t}function ds(e,t){return t(e)}var ps=tr((function(e){var t=e.length,i=t?e[0]:0,n=this.__wrapped__,r=function(t){return ni(t,e)};return !(t>1||this.__actions__.length)&&n instanceof Ua&&gr(i)?((n=n.slice(i,+i+(t?1:0))).__actions__.push({func:ds,args:[r],thisArg:a}),new ja(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(a),e}))):this.thru(r)})),hs=Cn((function(e,t,a){De.call(e,a)?++e[a]:ii(e,a,1);})),fs=Pn(jr),ms=Pn(Ur);function ys(e,t){return (Us(e)?Tt:ci)(e,or(t,3))}function gs(e,t){return (Us(e)?Mt:di)(e,or(t,3))}var bs=Cn((function(e,t,a){De.call(e,a)?e[a].push(t):ii(e,a,[t]);})),vs=qi((function(e,t,a){var i=-1,n="function"==typeof t,r=Ws(e)?ne(e.length):[];return ci(e,(function(e){r[++i]=n?St(t,e,a):xi(e,t,a);})),r})),_s=Cn((function(e,t,a){ii(e,a,t);}));function ws(e,t){return (Us(e)?Ft:Pi)(e,or(t,3))}var As=Cn((function(e,t,a){e[a?0:1].push(t);}),(function(){return [[],[]]})),ks=qi((function(e,t){if(null==e)return [];var a=t.length;return a>1&&br(e,t[0],t[1])?t=[]:a>2&&br(t[0],t[1],t[2])&&(t=[t[0]]),Ui(e,mi(t,1),[])})),Ss=ct||function(){return pt.Date.now()};function Ns(e,t,i){return t=i?a:t,t=e&&null==t?e.length:t,Jn(e,o,a,a,a,a,t)}function Ts(e,t){var n;if("function"!=typeof t)throw new xe(i);return e=ho(e),function(){return --e>0&&(n=t.apply(this,arguments)),e<=1&&(t=a),n}}var Ms=qi((function(e,t,a){var i=1;if(a.length){var n=oa(a,sr(Ms));i|=s;}return Jn(e,i,t,a,n)})),xs=qi((function(e,t,a){var i=3;if(a.length){var n=oa(a,sr(xs));i|=s;}return Jn(t,i,e,a,n)}));function Vs(e,t,n){var r,s,o,l,u,c,d=0,p=false,h=false,f=true;if("function"!=typeof e)throw new xe(i);function m(t){var i=r,n=s;return r=s=a,d=t,l=e.apply(n,i)}function y(e){var i=e-c;return c===a||i>=t||i<0||h&&e-d>=o}function g(){var e=Ss();if(y(e))return b(e);u=Vr(g,function(e){var a=t-(e-c);return h?ga(a,o-(e-d)):a}(e));}function b(e){return u=a,f&&r?m(e):(r=s=a,l)}function v(){var e=Ss(),i=y(e);if(r=arguments,s=this,c=e,i){if(u===a)return function(e){return d=e,u=Vr(g,t),p?m(e):l}(c);if(h)return wn(u),u=Vr(g,t),m(c)}return u===a&&(u=Vr(g,t)),l}return t=mo(t)||0,Xs(n)&&(p=!!n.leading,o=(h="maxWait"in n)?ya(mo(n.maxWait)||0,t):o,f="trailing"in n?!!n.trailing:f),v.cancel=function(){u!==a&&wn(u),d=0,r=c=s=u=a;},v.flush=function(){return u===a?l:b(Ss())},v}var Cs=qi((function(e,t){return li(e,1,t)})),Is=qi((function(e,t,a){return li(e,mo(t)||0,a)}));function Fs(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(i);var a=function(){var i=arguments,n=t?t.apply(this,i):i[0],r=a.cache;if(r.has(n))return r.get(n);var s=e.apply(this,i);return a.cache=r.set(n,s)||r,s};return a.cache=new(Fs.Cache||Ya),a}function Es(e){if("function"!=typeof e)throw new xe(i);return function(){var t=arguments;switch(t.length){case 0:return !e.call(this);case 1:return !e.call(this,t[0]);case 2:return !e.call(this,t[0],t[1]);case 3:return !e.call(this,t[0],t[1],t[2])}return !e.apply(this,t)}}Fs.Cache=Ya;var Ds=vn((function(e,t){var a=(t=1==t.length&&Us(t[0])?Ft(t[0],Jt(or())):Ft(mi(t,1),Jt(or()))).length;return qi((function(i){for(var n=-1,r=ga(i.length,a);++n<r;)i[n]=t[n].call(this,i[n]);return St(e,this,i)}))})),Rs=qi((function(e,t){var i=oa(t,sr(Rs));return Jn(e,s,a,t,i)})),Ls=qi((function(e,t){var i=oa(t,sr(Ls));return Jn(e,64,a,t,i)})),Ps=tr((function(e,t){return Jn(e,l,a,a,a,t)}));function Bs(e,t){return e===t||e!=e&&t!=t}var Os=Yn(Si),$s=Yn((function(e,t){return e>=t})),js=Vi(function(){return arguments}())?Vi:function(e){return Qs(e)&&De.call(e,"callee")&&!Ge.call(e,"callee")},Us=ne.isArray,zs=bt?Jt(bt):function(e){return Qs(e)&&ki(e)==C};function Ws(e){return null!=e&&Ks(e.length)&&!Zs(e)}function Ys(e){return Qs(e)&&Ws(e)}var Hs=gt||ml,Gs=vt?Jt(vt):function(e){return Qs(e)&&ki(e)==g};function qs(e){if(!Qs(e))return false;var t=ki(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ao(e)}function Zs(e){if(!Xs(e))return false;var t=ki(e);return t==v||t==_||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Js(e){return "number"==typeof e&&e==ho(e)}function Ks(e){return "number"==typeof e&&e>-1&&e%1==0&&e<=c}function Xs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Qs(e){return null!=e&&"object"==typeof e}var eo=_t?Jt(_t):function(e){return Qs(e)&&hr(e)==w};function to(e){return "number"==typeof e||Qs(e)&&ki(e)==A}function ao(e){if(!Qs(e)||ki(e)!=k)return false;var t=Ye(e);if(null===t)return true;var a=De.call(t,"constructor")&&t.constructor;return "function"==typeof a&&a instanceof a&&Ee.call(a)==Be}var io=wt?Jt(wt):function(e){return Qs(e)&&ki(e)==N},no=At?Jt(At):function(e){return Qs(e)&&hr(e)==T};function ro(e){return "string"==typeof e||!Us(e)&&Qs(e)&&ki(e)==M}function so(e){return "symbol"==typeof e||Qs(e)&&ki(e)==x}var oo=kt?Jt(kt):function(e){return Qs(e)&&Ks(e.length)&&!!rt[ki(e)]},lo=Yn(Li),uo=Yn((function(e,t){return e<=t}));function co(e){if(!e)return [];if(Ws(e))return ro(e)?da(e):xn(e);if(Je&&e[Je])return function(e){for(var t,a=[];!(t=e.next()).done;)a.push(t.value);return a}(e[Je]());var t=hr(e);return (t==w?ra:t==T?la:Oo)(e)}function po(e){return e?(e=mo(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ho(e){var t=po(e),a=t%1;return t==t?a?t-a:t:0}function fo(e){return e?ri(ho(e),0,p):0}function mo(e){if("number"==typeof e)return e;if(so(e))return d;if(Xs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xs(t)?t+"":t;}if("string"!=typeof e)return 0===e?e:+e;e=Zt(e);var a=fe.test(e);return a||ye.test(e)?ut(e.slice(2),a?2:8):he.test(e)?d:+e}function yo(e){return Vn(e,Io(e))}function go(e){return null==e?"":ln(e)}var bo=In((function(e,t){if(Ar(t)||Ws(t))Vn(t,Co(t),e);else for(var a in t)De.call(t,a)&&Qa(e,a,t[a]);})),vo=In((function(e,t){Vn(t,Io(t),e);})),_o=In((function(e,t,a,i){Vn(t,Io(t),e,i);})),wo=In((function(e,t,a,i){Vn(t,Co(t),e,i);})),Ao=tr(ni),ko=qi((function(e,t){e=Ne(e);var i=-1,n=t.length,r=n>2?t[2]:a;for(r&&br(t[0],t[1],r)&&(n=1);++i<n;)for(var s=t[i],o=Io(s),l=-1,u=o.length;++l<u;){var c=o[l],d=e[c];(d===a||Bs(d,Ie[c])&&!De.call(e,c))&&(e[c]=s[c]);}return e})),So=qi((function(e){return e.push(a,Xn),St(Eo,a,e)}));function No(e,t,i){var n=null==e?a:wi(e,t);return n===a?i:n}function To(e,t){return null!=e&&fr(e,t,Ti)}var Mo=$n((function(e,t,a){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),e[t]=a;}),Qo(al)),xo=$n((function(e,t,a){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),De.call(e,t)?e[t].push(a):e[t]=[a];}),or),Vo=qi(xi);function Co(e){return Ws(e)?qa(e):Di(e)}function Io(e){return Ws(e)?qa(e,true):Ri(e)}var Fo=In((function(e,t,a){$i(e,t,a);})),Eo=In((function(e,t,a,i){$i(e,t,a,i);})),Do=tr((function(e,t){var a={};if(null==e)return a;var i=false;t=Ft(t,(function(t){return t=bn(t,e),i||(i=t.length>1),t})),Vn(e,ir(e),a),i&&(a=si(a,7,Qn));for(var n=t.length;n--;)cn(a,t[n]);return a})),Ro=tr((function(e,t){return null==e?{}:function(e,t){return zi(e,t,(function(t,a){return To(e,a)}))}(e,t)}));function Lo(e,t){if(null==e)return {};var a=Ft(ir(e),(function(e){return [e]}));return t=or(t),zi(e,a,(function(e,a){return t(e,a[0])}))}var Po=Zn(Co),Bo=Zn(Io);function Oo(e){return null==e?[]:Kt(e,Co(e))}var $o=Rn((function(e,t,a){return t=t.toLowerCase(),e+(a?jo(t):t)}));function jo(e){return Zo(go(e).toLowerCase())}function Uo(e){return (e=go(e))&&e.replace(be,ta).replace(Xe,"")}var zo=Rn((function(e,t,a){return e+(a?"-":"")+t.toLowerCase()})),Wo=Rn((function(e,t,a){return e+(a?" ":"")+t.toLowerCase()})),Yo=Dn("toLowerCase"),Ho=Rn((function(e,t,a){return e+(a?"_":"")+t.toLowerCase()})),Go=Rn((function(e,t,a){return e+(a?" ":"")+Zo(t)})),qo=Rn((function(e,t,a){return e+(a?" ":"")+t.toUpperCase()})),Zo=Dn("toUpperCase");function Jo(e,t,i){return e=go(e),(t=i?a:t)===a?function(e){return at.test(e)}(e)?function(e){return e.match(et)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Ko=qi((function(e,t){try{return St(e,a,t)}catch(e){return qs(e)?e:new Ae(e)}})),Xo=tr((function(e,t){return Tt(t,(function(t){t=Rr(t),ii(e,t,Ms(e[t],e));})),e}));function Qo(e){return function(){return e}}var el=Bn(),tl=Bn(true);function al(e){return e}function il(e){return Ei("function"==typeof e?e:si(e,1))}var nl=qi((function(e,t){return function(a){return xi(a,e,t)}})),rl=qi((function(e,t){return function(a){return xi(e,a,t)}}));function sl(e,t,a){var i=Co(t),n=_i(t,i);null!=a||Xs(t)&&(n.length||!i.length)||(a=t,t=e,e=this,n=_i(t,Co(t)));var r=!(Xs(a)&&"chain"in a&&!a.chain),s=Zs(e);return Tt(n,(function(a){var i=t[a];e[a]=i,s&&(e.prototype[a]=function(){var t=this.__chain__;if(r||t){var a=e(this.__wrapped__);return (a.__actions__=xn(this.__actions__)).push({func:i,args:arguments,thisArg:e}),a.__chain__=t,a}return i.apply(e,Et([this.value()],arguments))});})),e}function ol(){}var ll=Un(Ft),ul=Un(xt),cl=Un(Lt);function dl(e){return vr(e)?Wt(Rr(e)):function(e){return function(t){return wi(t,e)}}(e)}var pl=Wn(),hl=Wn(true);function fl(){return []}function ml(){return false}var yl,gl=jn((function(e,t){return e+t}),0),bl=Gn("ceil"),vl=jn((function(e,t){return e/t}),1),_l=Gn("floor"),wl=jn((function(e,t){return e*t}),1),Al=Gn("round"),kl=jn((function(e,t){return e-t}),0);return Ba.after=function(e,t){if("function"!=typeof t)throw new xe(i);return e=ho(e),function(){if(--e<1)return t.apply(this,arguments)}},Ba.ary=Ns,Ba.assign=bo,Ba.assignIn=vo,Ba.assignInWith=_o,Ba.assignWith=wo,Ba.at=Ao,Ba.before=Ts,Ba.bind=Ms,Ba.bindAll=Xo,Ba.bindKey=xs,Ba.castArray=function(){if(!arguments.length)return [];var e=arguments[0];return Us(e)?e:[e]},Ba.chain=cs,Ba.chunk=function(e,t,i){t=(i?br(e,t,i):t===a)?1:ya(ho(t),0);var n=null==e?0:e.length;if(!n||t<1)return [];for(var r=0,s=0,o=ne(ht(n/t));r<n;)o[s++]=tn(e,r,r+=t);return o},Ba.compact=function(e){for(var t=-1,a=null==e?0:e.length,i=0,n=[];++t<a;){var r=e[t];r&&(n[i++]=r);}return n},Ba.concat=function(){var e=arguments.length;if(!e)return [];for(var t=ne(e-1),a=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Et(Us(a)?xn(a):[a],mi(t,1))},Ba.cond=function(e){var t=null==e?0:e.length,a=or();return e=t?Ft(e,(function(e){if("function"!=typeof e[1])throw new xe(i);return [a(e[0]),e[1]]})):[],qi((function(a){for(var i=-1;++i<t;){var n=e[i];if(St(n[0],this,a))return St(n[1],this,a)}}))},Ba.conforms=function(e){return function(e){var t=Co(e);return function(a){return oi(a,e,t)}}(si(e,1))},Ba.constant=Qo,Ba.countBy=hs,Ba.create=function(e,t){var a=Oa(e);return null==t?a:ai(a,t)},Ba.curry=function e(t,i,n){var r=Jn(t,8,a,a,a,a,a,i=n?a:i);return r.placeholder=e.placeholder,r},Ba.curryRight=function e(t,i,n){var r=Jn(t,16,a,a,a,a,a,i=n?a:i);return r.placeholder=e.placeholder,r},Ba.debounce=Vs,Ba.defaults=ko,Ba.defaultsDeep=So,Ba.defer=Cs,Ba.delay=Is,Ba.difference=Br,Ba.differenceBy=Or,Ba.differenceWith=$r,Ba.drop=function(e,t,i){var n=null==e?0:e.length;return n?tn(e,(t=i||t===a?1:ho(t))<0?0:t,n):[]},Ba.dropRight=function(e,t,i){var n=null==e?0:e.length;return n?tn(e,0,(t=n-(t=i||t===a?1:ho(t)))<0?0:t):[]},Ba.dropRightWhile=function(e,t){return e&&e.length?pn(e,or(t,3),true,true):[]},Ba.dropWhile=function(e,t){return e&&e.length?pn(e,or(t,3),true):[]},Ba.fill=function(e,t,i,n){var r=null==e?0:e.length;return r?(i&&"number"!=typeof i&&br(e,t,i)&&(i=0,n=r),function(e,t,i,n){var r=e.length;for((i=ho(i))<0&&(i=-i>r?0:r+i),(n=n===a||n>r?r:ho(n))<0&&(n+=r),n=i>n?0:fo(n);i<n;)e[i++]=t;return e}(e,t,i,n)):[]},Ba.filter=function(e,t){return (Us(e)?Vt:fi)(e,or(t,3))},Ba.flatMap=function(e,t){return mi(ws(e,t),1)},Ba.flatMapDeep=function(e,t){return mi(ws(e,t),u)},Ba.flatMapDepth=function(e,t,i){return i=i===a?1:ho(i),mi(ws(e,t),i)},Ba.flatten=zr,Ba.flattenDeep=function(e){return null!=e&&e.length?mi(e,u):[]},Ba.flattenDepth=function(e,t){return null!=e&&e.length?mi(e,t=t===a?1:ho(t)):[]},Ba.flip=function(e){return Jn(e,512)},Ba.flow=el,Ba.flowRight=tl,Ba.fromPairs=function(e){for(var t=-1,a=null==e?0:e.length,i={};++t<a;){var n=e[t];i[n[0]]=n[1];}return i},Ba.functions=function(e){return null==e?[]:_i(e,Co(e))},Ba.functionsIn=function(e){return null==e?[]:_i(e,Io(e))},Ba.groupBy=bs,Ba.initial=function(e){return null!=e&&e.length?tn(e,0,-1):[]},Ba.intersection=Yr,Ba.intersectionBy=Hr,Ba.intersectionWith=Gr,Ba.invert=Mo,Ba.invertBy=xo,Ba.invokeMap=vs,Ba.iteratee=il,Ba.keyBy=_s,Ba.keys=Co,Ba.keysIn=Io,Ba.map=ws,Ba.mapKeys=function(e,t){var a={};return t=or(t,3),bi(e,(function(e,i,n){ii(a,t(e,i,n),e);})),a},Ba.mapValues=function(e,t){var a={};return t=or(t,3),bi(e,(function(e,i,n){ii(a,i,t(e,i,n));})),a},Ba.matches=function(e){return Bi(si(e,1))},Ba.matchesProperty=function(e,t){return Oi(e,si(t,1))},Ba.memoize=Fs,Ba.merge=Fo,Ba.mergeWith=Eo,Ba.method=nl,Ba.methodOf=rl,Ba.mixin=sl,Ba.negate=Es,Ba.nthArg=function(e){return e=ho(e),qi((function(t){return ji(t,e)}))},Ba.omit=Do,Ba.omitBy=function(e,t){return Lo(e,Es(or(t)))},Ba.once=function(e){return Ts(2,e)},Ba.orderBy=function(e,t,i,n){return null==e?[]:(Us(t)||(t=null==t?[]:[t]),Us(i=n?a:i)||(i=null==i?[]:[i]),Ui(e,t,i))},Ba.over=ll,Ba.overArgs=Ds,Ba.overEvery=ul,Ba.overSome=cl,Ba.partial=Rs,Ba.partialRight=Ls,Ba.partition=As,Ba.pick=Ro,Ba.pickBy=Lo,Ba.property=dl,Ba.propertyOf=function(e){return function(t){return null==e?a:wi(e,t)}},Ba.pull=Zr,Ba.pullAll=Jr,Ba.pullAllBy=function(e,t,a){return e&&e.length&&t&&t.length?Wi(e,t,or(a,2)):e},Ba.pullAllWith=function(e,t,i){return e&&e.length&&t&&t.length?Wi(e,t,a,i):e},Ba.pullAt=Kr,Ba.range=pl,Ba.rangeRight=hl,Ba.rearg=Ps,Ba.reject=function(e,t){return (Us(e)?Vt:fi)(e,Es(or(t,3)))},Ba.remove=function(e,t){var a=[];if(!e||!e.length)return a;var i=-1,n=[],r=e.length;for(t=or(t,3);++i<r;){var s=e[i];t(s,i,e)&&(a.push(s),n.push(i));}return Yi(e,n),a},Ba.rest=function(e,t){if("function"!=typeof e)throw new xe(i);return qi(e,t=t===a?t:ho(t))},Ba.reverse=Xr,Ba.sampleSize=function(e,t,i){return t=(i?br(e,t,i):t===a)?1:ho(t),(Us(e)?Ja:Ji)(e,t)},Ba.set=function(e,t,a){return null==e?e:Ki(e,t,a)},Ba.setWith=function(e,t,i,n){return n="function"==typeof n?n:a,null==e?e:Ki(e,t,i,n)},Ba.shuffle=function(e){return (Us(e)?Ka:en)(e)},Ba.slice=function(e,t,i){var n=null==e?0:e.length;return n?(i&&"number"!=typeof i&&br(e,t,i)?(t=0,i=n):(t=null==t?0:ho(t),i=i===a?n:ho(i)),tn(e,t,i)):[]},Ba.sortBy=ks,Ba.sortedUniq=function(e){return e&&e.length?sn(e):[]},Ba.sortedUniqBy=function(e,t){return e&&e.length?sn(e,or(t,2)):[]},Ba.split=function(e,t,i){return i&&"number"!=typeof i&&br(e,t,i)&&(t=i=a),(i=i===a?p:i>>>0)?(e=go(e))&&("string"==typeof t||null!=t&&!io(t))&&!(t=ln(t))&&na(e)?_n(da(e),0,i):e.split(t,i):[]},Ba.spread=function(e,t){if("function"!=typeof e)throw new xe(i);return t=null==t?0:ya(ho(t),0),qi((function(a){var i=a[t],n=_n(a,0,t);return i&&Et(n,i),St(e,this,n)}))},Ba.tail=function(e){var t=null==e?0:e.length;return t?tn(e,1,t):[]},Ba.take=function(e,t,i){return e&&e.length?tn(e,0,(t=i||t===a?1:ho(t))<0?0:t):[]},Ba.takeRight=function(e,t,i){var n=null==e?0:e.length;return n?tn(e,(t=n-(t=i||t===a?1:ho(t)))<0?0:t,n):[]},Ba.takeRightWhile=function(e,t){return e&&e.length?pn(e,or(t,3),false,true):[]},Ba.takeWhile=function(e,t){return e&&e.length?pn(e,or(t,3)):[]},Ba.tap=function(e,t){return t(e),e},Ba.throttle=function(e,t,a){var n=true,r=true;if("function"!=typeof e)throw new xe(i);return Xs(a)&&(n="leading"in a?!!a.leading:n,r="trailing"in a?!!a.trailing:r),Vs(e,t,{leading:n,maxWait:t,trailing:r})},Ba.thru=ds,Ba.toArray=co,Ba.toPairs=Po,Ba.toPairsIn=Bo,Ba.toPath=function(e){return Us(e)?Ft(e,Rr):so(e)?[e]:xn(Dr(go(e)))},Ba.toPlainObject=yo,Ba.transform=function(e,t,a){var i=Us(e),n=i||Hs(e)||oo(e);if(t=or(t,4),null==a){var r=e&&e.constructor;a=n?i?new r:[]:Xs(e)&&Zs(r)?Oa(Ye(e)):{};}return (n?Tt:bi)(e,(function(e,i,n){return t(a,e,i,n)})),a},Ba.unary=function(e){return Ns(e,1)},Ba.union=Qr,Ba.unionBy=es,Ba.unionWith=ts,Ba.uniq=function(e){return e&&e.length?un(e):[]},Ba.uniqBy=function(e,t){return e&&e.length?un(e,or(t,2)):[]},Ba.uniqWith=function(e,t){return t="function"==typeof t?t:a,e&&e.length?un(e,a,t):[]},Ba.unset=function(e,t){return null==e||cn(e,t)},Ba.unzip=as,Ba.unzipWith=is,Ba.update=function(e,t,a){return null==e?e:dn(e,t,gn(a))},Ba.updateWith=function(e,t,i,n){return n="function"==typeof n?n:a,null==e?e:dn(e,t,gn(i),n)},Ba.values=Oo,Ba.valuesIn=function(e){return null==e?[]:Kt(e,Io(e))},Ba.without=ns,Ba.words=Jo,Ba.wrap=function(e,t){return Rs(gn(t),e)},Ba.xor=rs,Ba.xorBy=ss,Ba.xorWith=os,Ba.zip=ls,Ba.zipObject=function(e,t){return mn(e||[],t||[],Qa)},Ba.zipObjectDeep=function(e,t){return mn(e||[],t||[],Ki)},Ba.zipWith=us,Ba.entries=Po,Ba.entriesIn=Bo,Ba.extend=vo,Ba.extendWith=_o,sl(Ba,Ba),Ba.add=gl,Ba.attempt=Ko,Ba.camelCase=$o,Ba.capitalize=jo,Ba.ceil=bl,Ba.clamp=function(e,t,i){return i===a&&(i=t,t=a),i!==a&&(i=(i=mo(i))==i?i:0),t!==a&&(t=(t=mo(t))==t?t:0),ri(mo(e),t,i)},Ba.clone=function(e){return si(e,4)},Ba.cloneDeep=function(e){return si(e,5)},Ba.cloneDeepWith=function(e,t){return si(e,5,t="function"==typeof t?t:a)},Ba.cloneWith=function(e,t){return si(e,4,t="function"==typeof t?t:a)},Ba.conformsTo=function(e,t){return null==t||oi(e,t,Co(t))},Ba.deburr=Uo,Ba.defaultTo=function(e,t){return null==e||e!=e?t:e},Ba.divide=vl,Ba.endsWith=function(e,t,i){e=go(e),t=ln(t);var n=e.length,r=i=i===a?n:ri(ho(i),0,n);return (i-=t.length)>=0&&e.slice(i,r)==t},Ba.eq=Bs,Ba.escape=function(e){return (e=go(e))&&q.test(e)?e.replace(H,aa):e},Ba.escapeRegExp=function(e){return (e=go(e))&&ae.test(e)?e.replace(te,"\\$&"):e},Ba.every=function(e,t,i){var n=Us(e)?xt:pi;return i&&br(e,t,i)&&(t=a),n(e,or(t,3))},Ba.find=fs,Ba.findIndex=jr,Ba.findKey=function(e,t){return Bt(e,or(t,3),bi)},Ba.findLast=ms,Ba.findLastIndex=Ur,Ba.findLastKey=function(e,t){return Bt(e,or(t,3),vi)},Ba.floor=_l,Ba.forEach=ys,Ba.forEachRight=gs,Ba.forIn=function(e,t){return null==e?e:yi(e,or(t,3),Io)},Ba.forInRight=function(e,t){return null==e?e:gi(e,or(t,3),Io)},Ba.forOwn=function(e,t){return e&&bi(e,or(t,3))},Ba.forOwnRight=function(e,t){return e&&vi(e,or(t,3))},Ba.get=No,Ba.gt=Os,Ba.gte=$s,Ba.has=function(e,t){return null!=e&&fr(e,t,Ni)},Ba.hasIn=To,Ba.head=Wr,Ba.identity=al,Ba.includes=function(e,t,a,i){e=Ws(e)?e:Oo(e),a=a&&!i?ho(a):0;var n=e.length;return a<0&&(a=ya(n+a,0)),ro(e)?a<=n&&e.indexOf(t,a)>-1:!!n&&$t(e,t,a)>-1},Ba.indexOf=function(e,t,a){var i=null==e?0:e.length;if(!i)return -1;var n=null==a?0:ho(a);return n<0&&(n=ya(i+n,0)),$t(e,t,n)},Ba.inRange=function(e,t,i){return t=po(t),i===a?(i=t,t=0):i=po(i),function(e,t,a){return e>=ga(t,a)&&e<ya(t,a)}(e=mo(e),t,i)},Ba.invoke=Vo,Ba.isArguments=js,Ba.isArray=Us,Ba.isArrayBuffer=zs,Ba.isArrayLike=Ws,Ba.isArrayLikeObject=Ys,Ba.isBoolean=function(e){return true===e||false===e||Qs(e)&&ki(e)==y},Ba.isBuffer=Hs,Ba.isDate=Gs,Ba.isElement=function(e){return Qs(e)&&1===e.nodeType&&!ao(e)},Ba.isEmpty=function(e){if(null==e)return true;if(Ws(e)&&(Us(e)||"string"==typeof e||"function"==typeof e.splice||Hs(e)||oo(e)||js(e)))return !e.length;var t=hr(e);if(t==w||t==T)return !e.size;if(Ar(e))return !Di(e).length;for(var a in e)if(De.call(e,a))return false;return true},Ba.isEqual=function(e,t){return Ci(e,t)},Ba.isEqualWith=function(e,t,i){var n=(i="function"==typeof i?i:a)?i(e,t):a;return n===a?Ci(e,t,a,i):!!n},Ba.isError=qs,Ba.isFinite=function(e){return "number"==typeof e&&Pt(e)},Ba.isFunction=Zs,Ba.isInteger=Js,Ba.isLength=Ks,Ba.isMap=eo,Ba.isMatch=function(e,t){return e===t||Ii(e,t,ur(t))},Ba.isMatchWith=function(e,t,i){return i="function"==typeof i?i:a,Ii(e,t,ur(t),i)},Ba.isNaN=function(e){return to(e)&&e!=+e},Ba.isNative=function(e){if(wr(e))throw new Ae("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Fi(e)},Ba.isNil=function(e){return null==e},Ba.isNull=function(e){return null===e},Ba.isNumber=to,Ba.isObject=Xs,Ba.isObjectLike=Qs,Ba.isPlainObject=ao,Ba.isRegExp=io,Ba.isSafeInteger=function(e){return Js(e)&&e>=-9007199254740991&&e<=c},Ba.isSet=no,Ba.isString=ro,Ba.isSymbol=so,Ba.isTypedArray=oo,Ba.isUndefined=function(e){return e===a},Ba.isWeakMap=function(e){return Qs(e)&&hr(e)==V},Ba.isWeakSet=function(e){return Qs(e)&&"[object WeakSet]"==ki(e)},Ba.join=function(e,t){return null==e?"":Yt.call(e,t)},Ba.kebabCase=zo,Ba.last=qr,Ba.lastIndexOf=function(e,t,i){var n=null==e?0:e.length;if(!n)return -1;var r=n;return i!==a&&(r=(r=ho(i))<0?ya(n+r,0):ga(r,n-1)),t==t?function(e,t,a){for(var i=a+1;i--;)if(e[i]===t)return i;return i}(e,t,r):Ot(e,Ut,r,true)},Ba.lowerCase=Wo,Ba.lowerFirst=Yo,Ba.lt=lo,Ba.lte=uo,Ba.max=function(e){return e&&e.length?hi(e,al,Si):a},Ba.maxBy=function(e,t){return e&&e.length?hi(e,or(t,2),Si):a},Ba.mean=function(e){return zt(e,al)},Ba.meanBy=function(e,t){return zt(e,or(t,2))},Ba.min=function(e){return e&&e.length?hi(e,al,Li):a},Ba.minBy=function(e,t){return e&&e.length?hi(e,or(t,2),Li):a},Ba.stubArray=fl,Ba.stubFalse=ml,Ba.stubObject=function(){return {}},Ba.stubString=function(){return ""},Ba.stubTrue=function(){return true},Ba.multiply=wl,Ba.nth=function(e,t){return e&&e.length?ji(e,ho(t)):a},Ba.noConflict=function(){return pt._===this&&(pt._=Oe),this},Ba.noop=ol,Ba.now=Ss,Ba.pad=function(e,t,a){e=go(e);var i=(t=ho(t))?ca(e):0;if(!t||i>=t)return e;var n=(t-i)/2;return zn(ft(n),a)+e+zn(ht(n),a)},Ba.padEnd=function(e,t,a){e=go(e);var i=(t=ho(t))?ca(e):0;return t&&i<t?e+zn(t-i,a):e},Ba.padStart=function(e,t,a){e=go(e);var i=(t=ho(t))?ca(e):0;return t&&i<t?zn(t-i,a)+e:e},Ba.parseInt=function(e,t,a){return a||null==t?t=0:t&&(t=+t),va(go(e).replace(ie,""),t||0)},Ba.random=function(e,t,i){if(i&&"boolean"!=typeof i&&br(e,t,i)&&(t=i=a),i===a&&("boolean"==typeof t?(i=t,t=a):"boolean"==typeof e&&(i=e,e=a)),e===a&&t===a?(e=0,t=1):(e=po(e),t===a?(t=e,e=0):t=po(t)),e>t){var n=e;e=t,t=n;}if(i||e%1||t%1){var r=_a();return ga(e+r*(t-e+lt("1e-"+((r+"").length-1))),t)}return Hi(e,t)},Ba.reduce=function(e,t,a){var i=Us(e)?Dt:Ht,n=arguments.length<3;return i(e,or(t,4),a,n,ci)},Ba.reduceRight=function(e,t,a){var i=Us(e)?Rt:Ht,n=arguments.length<3;return i(e,or(t,4),a,n,di)},Ba.repeat=function(e,t,i){return t=(i?br(e,t,i):t===a)?1:ho(t),Gi(go(e),t)},Ba.replace=function(){var e=arguments,t=go(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ba.result=function(e,t,i){var n=-1,r=(t=bn(t,e)).length;for(r||(r=1,e=a);++n<r;){var s=null==e?a:e[Rr(t[n])];s===a&&(n=r,s=i),e=Zs(s)?s.call(e):s;}return e},Ba.round=Al,Ba.runInContext=e,Ba.sample=function(e){return (Us(e)?Za:Zi)(e)},Ba.size=function(e){if(null==e)return 0;if(Ws(e))return ro(e)?ca(e):e.length;var t=hr(e);return t==w||t==T?e.size:Di(e).length},Ba.snakeCase=Ho,Ba.some=function(e,t,i){var n=Us(e)?Lt:an;return i&&br(e,t,i)&&(t=a),n(e,or(t,3))},Ba.sortedIndex=function(e,t){return nn(e,t)},Ba.sortedIndexBy=function(e,t,a){return rn(e,t,or(a,2))},Ba.sortedIndexOf=function(e,t){var a=null==e?0:e.length;if(a){var i=nn(e,t);if(i<a&&Bs(e[i],t))return i}return -1},Ba.sortedLastIndex=function(e,t){return nn(e,t,true)},Ba.sortedLastIndexBy=function(e,t,a){return rn(e,t,or(a,2),true)},Ba.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var a=nn(e,t,true)-1;if(Bs(e[a],t))return a}return -1},Ba.startCase=Go,Ba.startsWith=function(e,t,a){return e=go(e),a=null==a?0:ri(ho(a),0,e.length),t=ln(t),e.slice(a,a+t.length)==t},Ba.subtract=kl,Ba.sum=function(e){return e&&e.length?Gt(e,al):0},Ba.sumBy=function(e,t){return e&&e.length?Gt(e,or(t,2)):0},Ba.template=function(e,t,i){var n=Ba.templateSettings;i&&br(e,t,i)&&(t=a),e=go(e),t=_o({},t,n,Kn);var r,s,o=_o({},t.imports,n.imports,Kn),l=Co(o),u=Kt(o,l),c=0,d=t.interpolate||ve,p="__p += '",h=Te((t.escape||ve).source+"|"+d.source+"|"+(d===K?de:ve).source+"|"+(t.evaluate||ve).source+"|$","g"),f="//# sourceURL="+(De.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(h,(function(t,a,i,n,o,l){return i||(i=n),p+=e.slice(c,l).replace(_e,ia),a&&(r=true,p+="' +\n__e("+a+") +\n'"),o&&(s=true,p+="';\n"+o+";\n__p += '"),i&&(p+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),c=l+t.length,t})),p+="';\n";var m=De.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new Ae("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(s?p.replace(U,""):p).replace(z,"$1").replace(W,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var y=Ko((function(){return ke(l,f+"return "+p).apply(a,u)}));if(y.source=p,qs(y))throw y;return y},Ba.times=function(e,t){if((e=ho(e))<1||e>c)return [];var a=p,i=ga(e,p);t=or(t),e-=p;for(var n=qt(i,t);++a<e;)t(a);return n},Ba.toFinite=po,Ba.toInteger=ho,Ba.toLength=fo,Ba.toLower=function(e){return go(e).toLowerCase()},Ba.toNumber=mo,Ba.toSafeInteger=function(e){return e?ri(ho(e),-9007199254740991,c):0===e?e:0},Ba.toString=go,Ba.toUpper=function(e){return go(e).toUpperCase()},Ba.trim=function(e,t,i){if((e=go(e))&&(i||t===a))return Zt(e);if(!e||!(t=ln(t)))return e;var n=da(e),r=da(t);return _n(n,Qt(n,r),ea(n,r)+1).join("")},Ba.trimEnd=function(e,t,i){if((e=go(e))&&(i||t===a))return e.slice(0,pa(e)+1);if(!e||!(t=ln(t)))return e;var n=da(e);return _n(n,0,ea(n,da(t))+1).join("")},Ba.trimStart=function(e,t,i){if((e=go(e))&&(i||t===a))return e.replace(ie,"");if(!e||!(t=ln(t)))return e;var n=da(e);return _n(n,Qt(n,da(t))).join("")},Ba.truncate=function(e,t){var i=30,n="...";if(Xs(t)){var r="separator"in t?t.separator:r;i="length"in t?ho(t.length):i,n="omission"in t?ln(t.omission):n;}var s=(e=go(e)).length;if(na(e)){var o=da(e);s=o.length;}if(i>=s)return e;var l=i-ca(n);if(l<1)return n;var u=o?_n(o,0,l).join(""):e.slice(0,l);if(r===a)return u+n;if(o&&(l+=u.length-l),io(r)){if(e.slice(l).search(r)){var c,d=u;for(r.global||(r=Te(r.source,go(pe.exec(r))+"g")),r.lastIndex=0;c=r.exec(d);)var p=c.index;u=u.slice(0,p===a?l:p);}}else if(e.indexOf(ln(r),l)!=l){var h=u.lastIndexOf(r);h>-1&&(u=u.slice(0,h));}return u+n},Ba.unescape=function(e){return (e=go(e))&&G.test(e)?e.replace(Y,ha):e},Ba.uniqueId=function(e){var t=++Re;return go(e)+t},Ba.upperCase=qo,Ba.upperFirst=Zo,Ba.each=ys,Ba.eachRight=gs,Ba.first=Wr,sl(Ba,(yl={},bi(Ba,(function(e,t){De.call(Ba.prototype,t)||(yl[t]=e);})),yl),{chain:false}),Ba.VERSION="4.17.21",Tt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ba[e].placeholder=Ba;})),Tt(["drop","take"],(function(e,t){Ua.prototype[e]=function(i){i=i===a?1:ya(ho(i),0);var n=this.__filtered__&&!t?new Ua(this):this.clone();return n.__filtered__?n.__takeCount__=ga(i,n.__takeCount__):n.__views__.push({size:ga(i,p),type:e+(n.__dir__<0?"Right":"")}),n},Ua.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()};})),Tt(["filter","map","takeWhile"],(function(e,t){var a=t+1,i=1==a||3==a;Ua.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:or(e,3),type:a}),t.__filtered__=t.__filtered__||i,t};})),Tt(["head","last"],(function(e,t){var a="take"+(t?"Right":"");Ua.prototype[e]=function(){return this[a](1).value()[0]};})),Tt(["initial","tail"],(function(e,t){var a="drop"+(t?"":"Right");Ua.prototype[e]=function(){return this.__filtered__?new Ua(this):this[a](1)};})),Ua.prototype.compact=function(){return this.filter(al)},Ua.prototype.find=function(e){return this.filter(e).head()},Ua.prototype.findLast=function(e){return this.reverse().find(e)},Ua.prototype.invokeMap=qi((function(e,t){return "function"==typeof e?new Ua(this):this.map((function(a){return xi(a,e,t)}))})),Ua.prototype.reject=function(e){return this.filter(Es(or(e)))},Ua.prototype.slice=function(e,t){e=ho(e);var i=this;return i.__filtered__&&(e>0||t<0)?new Ua(i):(e<0?i=i.takeRight(-e):e&&(i=i.drop(e)),t!==a&&(i=(t=ho(t))<0?i.dropRight(-t):i.take(t-e)),i)},Ua.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ua.prototype.toArray=function(){return this.take(p)},bi(Ua.prototype,(function(e,t){var i=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),r=Ba[n?"take"+("last"==t?"Right":""):t],s=n||/^find/.test(t);r&&(Ba.prototype[t]=function(){var t=this.__wrapped__,o=n?[1]:arguments,l=t instanceof Ua,u=o[0],c=l||Us(t),d=function(e){var t=r.apply(Ba,Et([e],o));return n&&p?t[0]:t};c&&i&&"function"==typeof u&&1!=u.length&&(l=c=false);var p=this.__chain__,h=!!this.__actions__.length,f=s&&!p,m=l&&!h;if(!s&&c){t=m?t:new Ua(this);var y=e.apply(t,o);return y.__actions__.push({func:ds,args:[d],thisArg:a}),new ja(y,p)}return f&&m?e.apply(this,o):(y=this.thru(d),f?n?y.value()[0]:y.value():y)});})),Tt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ve[e],a=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);Ba.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var n=this.value();return t.apply(Us(n)?n:[],e)}return this[a]((function(a){return t.apply(Us(a)?a:[],e)}))};})),bi(Ua.prototype,(function(e,t){var a=Ba[t];if(a){var i=a.name+"";De.call(Va,i)||(Va[i]=[]),Va[i].push({name:t,func:a});}})),Va[On(a,2).name]=[{name:"wrapper",func:a}],Ua.prototype.clone=function(){var e=new Ua(this.__wrapped__);return e.__actions__=xn(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xn(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xn(this.__views__),e},Ua.prototype.reverse=function(){if(this.__filtered__){var e=new Ua(this);e.__dir__=-1,e.__filtered__=true;}else (e=this.clone()).__dir__*=-1;return e},Ua.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,a=Us(e),i=t<0,n=a?e.length:0,r=function(e,t,a){for(var i=-1,n=a.length;++i<n;){var r=a[i],s=r.size;switch(r.type){case "drop":e+=s;break;case "dropRight":t-=s;break;case "take":t=ga(t,e+s);break;case "takeRight":e=ya(e,t-s);}}return {start:e,end:t}}(0,n,this.__views__),s=r.start,o=r.end,l=o-s,u=i?o:s-1,c=this.__iteratees__,d=c.length,p=0,h=ga(l,this.__takeCount__);if(!a||!i&&n==l&&h==l)return hn(e,this.__actions__);var f=[];e:for(;l--&&p<h;){for(var m=-1,y=e[u+=t];++m<d;){var g=c[m],b=g.iteratee,v=g.type,_=b(y);if(2==v)y=_;else if(!_){if(1==v)continue e;break e}}f[p++]=y;}return f},Ba.prototype.at=ps,Ba.prototype.chain=function(){return cs(this)},Ba.prototype.commit=function(){return new ja(this.value(),this.__chain__)},Ba.prototype.next=function(){this.__values__===a&&(this.__values__=co(this.value()));var e=this.__index__>=this.__values__.length;return {done:e,value:e?a:this.__values__[this.__index__++]}},Ba.prototype.plant=function(e){for(var t,i=this;i instanceof $a;){var n=Pr(i);n.__index__=0,n.__values__=a,t?r.__wrapped__=n:t=n;var r=n;i=i.__wrapped__;}return r.__wrapped__=e,t},Ba.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ua){var t=e;return this.__actions__.length&&(t=new Ua(this)),(t=t.reverse()).__actions__.push({func:ds,args:[Xr],thisArg:a}),new ja(t,this.__chain__)}return this.thru(Xr)},Ba.prototype.toJSON=Ba.prototype.valueOf=Ba.prototype.value=function(){return hn(this.__wrapped__,this.__actions__)},Ba.prototype.first=Ba.prototype.head,Je&&(Ba.prototype[Je]=function(){return this}),Ba}();ft?((ft.exports=fa)._=fa,ht._=fa):pt._=fa;}).call(ae$1);}(te$1,te$1.exports)),te$1.exports);class ne extends Y{name="";displayName="";type=void 0;info;preload=true;loadingManagerRule="load";item;itemRepo;condition;conditionFields=[];conditionFieldNames=[];dependantFields=[];dependenciesInitialized=false;linkableTypes=[];collapsed=false;presets=[];datatype=null;defaultValue=null;minValue=null;maxValue=null;language=null;widget=null;length=null;labelType=null;blocks=[];connections=[];_id="";_internalValue;_internalOptions=[];_updateConditions=true;_hidden=false;get hidden(){return !(!this.condition||!this.dependenciesInitialized)&&(this._updateConditions&&(this._hidden=!this._calculateConditionBlock(this.condition),this._updateConditions=false),this._hidden)}get id(){return this._id}get options(){return this._internalOptions}set options(e){this._internalOptions=e,this.updateConditions();}get value(){return this._internalValue}set value(e){this._internalValue=e,this._processDependencies();}constructor(e,t=void 0,a=void 0,i=void 0,n=void 0,r=void 0){super(n),e instanceof W?(this._id=e.id,this.restoreFromSnapshot(e)):(p.assert(e,"Field has no name!"),p.assert(a,"Field has no type!"),this._id=p.createFieldID(),this.name=e,this.displayName=t||e,this.type=a,this._internalValue=i,this.item=n,this.itemRepo=r);}updateConditions(){this.condition&&this.dependenciesInitialized&&(this._updateConditions=true,l$1.$emit("field:hiddenChanged",this.id));}getId(){return this.id}resetValue(){this.value=this.defaultValue;}makeIdsUnique(e=new Map,t=false){if(e.has(this._id)||t){const t=p.createFieldID();e.set(this._id,t),this._id=t;}else e.set(this._id,this._id);for(const a of this.blocks)a.makeIdsUnique(e,t);return e}transformNodeIds(e){for(const t of this.blocks)t.transformNodeIds(e);"Attribute"===this.type&&"Node"===this.datatype&&this.value&&e.has(this.value)&&(this.value=e.get(this.value));}findBlock(e){for(const t of this.blocks){const a=t.findBlock(e);if(a)return a}return null}clone(e=void 0,t=false){let a=new ne(this.name,this.displayName,this.type);void 0===this._internalValue?a._internalValue=void 0:null===this._internalValue?a._internalValue=null:"Link"===this.type?a._internalValue=this._internalValue:a._internalValue=ie.cloneDeep(this._internalValue),a.info=this.info,a.preload=this.preload,a.loadingManagerRule=this.loadingManagerRule,a.item=this.item,a.ownerItem=this.ownerItem,a.itemRepo=this.itemRepo,a.condition=this.condition,a.conditionFields=this.conditionFields,a.conditionFieldNames=this.conditionFieldNames,a.dependantFields=this.dependantFields,a.collapsed=this.collapsed,a.presets=this.presets,a.labelType=this.labelType,a.datatype=this.datatype,a.defaultValue=this.defaultValue,a.minValue=this.minValue,a.maxValue=this.maxValue,a.options=this.options,a.language=this.language,a.widget=this.widget,a.length=this.length,a.linkableTypes=this.linkableTypes;for(const i of this.blocks){let n=i.clone(e,true,{},t);e&&(n=y$1.instance.proxyBlock(n,e)),a.blocks.push(n);}for(const t of this.connections){let i=t.clone();e&&(i=y$1.instance.proxyConnection(i,e)),a.connections.push(i);}return a}_processDependencies(){for(const e of this.dependantFields)e.updateConditions();}_getConditionField(e){for(const t of this.conditionFields)if(t&&t.name===e)return t;return null}_calculateConditionField(e,t){if(!e.startsWith("$")){let a;e.includes(".")?(a=e.split("."),e=a.splice(0,1)[0]):a=[];let i=e.endsWith("?");i&&(e=e.substring(0,e.length-1));const n=this._getConditionField(e);if(!n)return i||console.error("Field to resolve condition not found: "+e),false;let r=n.value;for(let t=0;t<a.length;t++){if(!r)return console.error(`Field path ${a.join(".")} not found in field ${e}!`),false;r=r[a[t]];}return "object"==typeof t?void 0!==t.$isset?t.$isset===!!r:void 0!==t.$not?t.$not!==r:(console.error("Condition value cannot be interpreted: ",t,this),false):n.value==t}switch(e){case "$isroot":return this.item._id===this.itemRepo.rootItemId===t;case "$parenttype":return console.log("$parenttype is not yet implemented!",this),false;case "$optionsexist":return (Array.isArray(this.options)&&this.options.length>0)===t;case "$featureenabled":return this.itemRepo.apiClient.isFeatureEnabled(t);default:return console.error("Computed value unknown: "+e,this),false}}_calculateConditionBlock(e){for(const t in e)if(e.hasOwnProperty(t)){const a=e[t];if("$or"===t)if(Array.isArray(a)){let e=false;for(const t of a)if(this._calculateConditionBlock(t)){e=true;break}if(!e)return false}else console.error("Condition contains $or but its value is not an array!");else if("$not"===t){if("object"!=typeof a)console.error("When using the $not operator, the value needs to be an object");else if(this._calculateConditionBlock(a))return false}else if(!this._calculateConditionField(t,a))return false}return true}refreshFieldDependencies(){for(const e of this.blocks)e.refreshFieldDependencies();}refreshDependantFields(e,t){const a=[];if(this.condition)for(let t of this.conditionFieldNames){const i=t.endsWith("?");i&&(t=t.substring(0,t.length-1));const n=e.get(t);n?a.push(n):i||console.warn("Condition field not found: "+t);}this.conditionFields=a,this.dependantFields=t||[],this.dependenciesInitialized=true;}setCondition(e){e?"object"==typeof e?this.condition=e:(console.error("Condition must be an object if set",e),this.condition=null):this.condition=null,this.conditionFieldNames=[],this.condition&&this._scanConditions(this.condition);}_scanConditions(e){for(let t in e)if(e.hasOwnProperty(t)){const a=e[t];if(Array.isArray(a))for(const e of a)this._scanConditions(e);else t.startsWith("$")||(t.includes(".")&&(t=t.split(".")[0]),this.conditionFieldNames.includes(t)||this.conditionFieldNames.push(t));}}forEachField(e){if(e(this),this.blocks)for(const t of this.blocks)t.forEachField(e);}setInfo(e){this.info=e;}setPreload(e){this.preload=e;}setLoadingManagerRule(e){this.loadingManagerRule=e;}setLinkableTypes(e){this.linkableTypes=e;}setDefaultValue(e){this.defaultValue=e,void 0!==this._internalValue&&null!==this._internalValue||(this._internalValue=e);}setMinValue(e){this.minValue=e;}setMaxValue(e){this.maxValue=e;}setOptions(e){this.options=e;}setDatatype(e){this.datatype=e;}setLanguage(e){this.language=e;}setLength(e){this.length=e;}setWidget(e){this.widget=e;}setBlocks(e){this.blocks=e;}setConnections(e){this.connections=e;}setCollapsed(e){this.collapsed=!!e;}setPresets(e){this.presets=e||[];}setLabelType(e){this.labelType=e||"info";}createSnapshot(e=false){p.assert(this.id,"Field has no ID. Cannot create snapshot");const t=[];for(const a of this.blocks)t.push(a.createSnapshot(e));const a=[];for(const e of this.connections)a.push(e.createSnapshot());return new W(this.id,"field",{name:this.name,displayName:this.displayName,type:this.type,value:this._internalValue,preload:this.preload,info:this.info,loadingManagerRule:this.loadingManagerRule,item:this.item,itemRepo:this.itemRepo,condition:this.condition,conditionFields:this.conditionFields,conditionFieldNames:this.conditionFieldNames,dependantFields:this.dependantFields,linkableTypes:this.linkableTypes,collapsed:this.collapsed,presets:this.presets,datatype:this.datatype,defaultValue:this.defaultValue,minValue:this.minValue,maxValue:this.maxValue,options:this.options,language:this.language,widget:this.widget,length:this.length,labelType:this.labelType,blocks:t,connections:a})}restoreFromSnapshot(e){e.id===this.id?(this.name=e.data.name,this.displayName=e.data.displayName,this.type=e.data.type,this._internalValue=e.data.value,this.info=e.data.info,this.preload=e.data.preload,this.loadingManagerRule=e.data.loadingManagerRule,this.item=e.data.item,this.ownerItem=e.data.item,this.itemRepo=e.data.itemRepo,this.condition=e.data.condition,this.conditionFields=e.data.conditionFields,this.conditionFieldNames=e.data.conditionFieldNames,this.dependantFields=e.data.dependantFields,this.linkableTypes=e.data.linkableTypes,this.collapsed=e.data.collapsed,this.presets=e.data.presets,this.datatype=e.data.datatype,this.defaultValue=e.data.defaultValue,this.minValue=e.data.minValue,this.maxValue=e.data.maxValue,this.options=e.data.options,this.language=e.data.language,this.widget=e.data.widget,this.length=e.data.length,this.labelType=e.data.labelType,this.blocks=[],this.connections=[],this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>y$1.instance.proxyBlock(new pe(e,t),this.ownerItem))),this._rollbackArray(this.connections,e.data.connections,((e,t)=>y$1.instance.proxyConnection(new H(e.data,t),this.ownerItem)))):console.error("Snapshot ID does not match! Cannot rollback!",this,e);}rollbackFromSnapshot(e){this.value=e.data.value,this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>y$1.instance.proxyBlock(new pe(e,t),this.ownerItem))),this._rollbackArray(this.connections,e.data.connections,((e,t)=>y$1.instance.proxyConnection(new H(e.data,t),this.ownerItem)));}}class re extends Y{id;name=void 0;displayName=void 0;value;type=void 0;datatype=void 0;linkableTypes=[];order=0;constructor(e=void 0,t=void 0,a=void 0){super(a),this.value=t,this.id=p.createItemOrBlockID(),this.name=e,this.displayName=e,this._updateDisplayName();}getId(){return this.id}setName(e){this.name=e,this._updateDisplayName();}setType(e){this.type=e;}setOrder(e){this.order=e;}clone(e=new Map){const t=new re;return t.ownerItem=this.ownerItem,t.value=e.get(this.value)??this.value,t.type=this.type,t.order=this.order,t.setName(this.name),t}clearDefinition(){this.type=void 0;}setDefinition(e){const t=e.type.toLowerCase();switch(t){case "boolean":case "bool":this.type="Attribute",this.datatype="Boolean",this.value=void 0!==this.value?this._toBoolean(this.value):this._toBoolean(e.defaultValue);break;case "float":this.type="Attribute",this.datatype="Float",this.value=void 0!==this.value?Number(this.value):Number(e.defaultValue);break;case "int":this.type="Attribute",this.datatype="Integer",this.value=void 0!==this.value?parseInt(this.value):parseInt(e.defaultValue);break;case "string":this.type="Attribute",this.datatype="String",this.value=void 0!==this.value&&null!==this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():"";break;case "vec2":this.type="Attribute",this.datatype="Vector2d";break;case "vec3":this.type="Attribute",this.datatype="Vector3d";break;case "vec4":this.type="Attribute",this.datatype="Vector4d";break;case "mat3":this.type="Attribute",this.datatype="Mat3";break;case "mat4":this.type="Attribute",this.datatype="Mat4";break;case "color":this.type="Attribute",this.datatype="Color";break;case "image":this.type="Link",this.linkableTypes=["Image"];break;default:console.error("Unknown script field type: "+t),this.type="Attribute",this.datatype="String",this.value=this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():"";}}_toBoolean(e){return null!=e&&(true===e||false===e?e:"false"!==e.toString().toLowerCase())}_updateDisplayName(){this.name?this.displayName=p.toUserFriendlyName(this.name):this.displayName="";}createSnapshot(){return new W(this.id,"customfield",{id:this.id,value:this.value})}rollbackFromSnapshot(e){this.value=e.data.value;}}class se extends C$1{links;instanceId;isDirty=false;fieldInstances;userFieldInstances;customFieldInstances;packageContent;packageType;public=false;readOnly=false;isPackaged=false;isGenerated=false;packageItem;isPreparedItem=true;resultingAcl;userData={};constructor(e){if(super(e),this.instanceId=p.createItemOrBlockID(),this.links=[],Array.isArray(e.links))for(const t of e.links)this.links.push({to:t.to,usage:t.usage,stopRecursion:t.stopRecursion,item:t.item});this.fieldInstances=[],this.userFieldInstances=[],this.customFieldInstances=y$1.instance.proxyCustomFieldsArray([],this),this.public=!!e.public,this.packageContent=e.packageContent,this.packageType=e.packageType,this.packageItem=e.packageItem,this.readOnly=!!e.readOnly,this.isPackaged=!!e.isPackaged,this.isGenerated=!!e.isGenerated,this.resultingAcl=JSON.parse(JSON.stringify(e.resultingAcl||[]));}createCustomFieldInstances(e){function t(e,t){for(const a of e)if(a.name===t)return a;return null}for(const a of this.customFieldInstances)t(e,a.name)||a.clearDefinition();let a=0;for(const i of e){let e=t(this.customFieldInstances,i.name);e||(e=new re(i.name,i.defaultValue,this),this.addCustomField(e)),e.setOrder(a++),e.setDefinition(i);}this.customFieldInstances.sort((function(e,t){return e.order-t.order}));}addCustomField(e){this.customFieldInstances.push(y$1.instance.proxyCustomField(e,this));}markDirty(){this.isDirty||(this.isDirty=true,l$1.$emit("itemRepo:itemBecameDirty",this._id));}makeIdsUnique(){const e=new Map;for(const t of this.fieldInstances)t.makeIdsUnique(e,true);this.packageContent&&this.packageContent.makeIdsUnique();}clone(e=false){let t=new se(this);const a=new Map;for(const i of this.fieldInstances){const n=i.clone(this,true);e&&n.makeIdsUnique(a,true),t.fieldInstances.push(n);}if(e)for(const e of t.fieldInstances)e.transformNodeIds(a);return t}findBlock(e){for(const t of this.fieldInstances){const a=t.findBlock(e);if(a)return a}return null}refreshFieldDependencies(){de$1.refreshFieldDependencies(this.fieldInstances);for(const e of this.fieldInstances)e.refreshFieldDependencies();}forEachItem(e){if(e(this),this.links)for(const t of this.links)t.item&&t.item.forEachItem(e);}forEachFieldInstance(e){if(this.fieldInstances)for(const t of this.fieldInstances)t.forEachField(e);}toString(){return `PreparedItem(${JSON.stringify({_id:this._id,name:this.name,type:this.type})})`}}function oe(e,t,a){if(e.admin||e.superadmin)return true;if(!Array.isArray(t))return true;for(const i of t)if(i.can.includes(a)){if(!i.user&&!i.group)return true;if(i.user&&i.user===e._id)return true;if(i.group)for(const t of e.groups){if("object"==typeof t&&t._id===i.group)return true;if(t===i.group)return true}}}function le(e,t,a){if(e.admin&&!a)return true;if(e.superadmin)return true;if(Array.isArray(e.permissions))if(Array.isArray(t)){for(const a of e.permissions)for(const e of t)if(a===e)return true}else for(const a of e.permissions)if(a===t)return true;return false}let ue$1 = class ue{fields;constructor(e){if(!Array.isArray(e))throw "Template fields need to be an array!";this.fields=e;}clone(){const e=[];for(const t of this.fields)e.push(t.clone());return new ue(e)}specialize(e){for(const t of this.fields) void 0!==e[t.name]&&(t.defaultValue=e[t.name]);return this}instantiate(e){if(e)return this.fields;{const e=[];for(const t of this.fields)e.push(t.clone());return e}}};class ce{templates=new Map;templatesByField=new Map;static _instance;static get instance(){return this._instance||(this._instance=new this)}_existsTemplate(e,t){for(const a of e)if(a.typeName===t)return true;return false}addTemplates(e,t,a){const i=`${e}_${t}`,n=this.templatesByField.get(i)||[];for(const e of a){const t=`${i}_${e.typeName}`;this.templates.set(t,e),this._existsTemplate(n,e.typeName)||n.push(e);}this.templatesByField.set(i,n);}getTemplate(e,t,a){const i=`${e}_${t}_${a}`;return this.templates.get(i)}getTemplates(e,t){const a=`${e}_${t}`;return this.templatesByField.get(a)||[]}}let de$1 = class de{itemRepo;itemFetcher;constructor(e){this.itemRepo=e,this.itemFetcher=function(e){return e};}setItemFetcher(e){this.itemFetcher=e;}setFieldsFromDatatypes(e){const t=F(e.type,true);e.fields=t?.fields||[],e.fieldSets=t?.fieldSets||[];}async prepare(e){return e instanceof se?(console.warn("Trying to prepare an already prepared item: ",e),e):this.itemRepo.undoManager.ignore((async()=>{const t=new se(e);return this.setFieldsFromDatatypes(t),t.fieldInstances=await this.createFieldInstances(t,t.fields,t.attributes,"","attributes",false),t.userFieldInstances=await this.createFieldInstances(t,t.userFields,t.userAttributes,"","userAttributes",false),t.customFieldInstances=await this.createCustomFieldInstances(t,t.userAttributes,"_"),t.allowConversation=!!t.allowConversation,t.packageContent&&(t.packageContent.name=t.name,await this.itemRepo.traverseItems((e=>{e.readOnly=true,e.isPackaged=true,e.packageItem=t;}),t.packageContent)),t.packageItem?(t.readOnly=true,t.isPackaged=true):(t.isPackaged=false,t.resultingAcl&&t.resultingAcl.length>0?t.readOnly=!oe(await this.itemRepo.apiClient.me(true),t.resultingAcl,"write"):t.readOnly=true),t}))}async createCustomFieldInstances(e,t,a=""){if(!e)throw new k("createCustomFieldInstances(): Item cannot be null!");if(!t)throw new k("createCustomFieldInstances(): attributes cannot be null!");const i=[];for(const n in t)if(!a.length||n.startsWith(a)){const r=n.substring(a.length);let s=new re(r,t[n],e);s.setType("Attribute"),i.push(y$1.instance.proxyCustomField(s,e));}if(e.links)for(const t of e.links)if(!a.length||t.usage.startsWith(a)){const n=t.usage.substring(a.length);let r,{id:s,linkItem:o,stopRecursion:l}=await this.fetchLinkValue(e,t.usage);o?r=o:l&&(r=s);let u=new re(n,r,e);u.setType("Link"),i.push(y$1.instance.proxyCustomField(u,e));}return i}async createFieldInstances(e,t,a,i,n,r=false){if(!e)throw new k("createFieldInstances(): Item cannot be null!");if(!t)throw new k("createFieldInstances(): Fields cannot be null!");const s=[],o=i.length?`${i}->`:i;for(let a=0;a<t.length;a++){const i=t[a];if("FieldSet"===i.type){const n=this.getFieldSet(e,i.name);n?(t.splice(a,1,...structuredClone(n.fields)),a+=n.fields.length-1):console.error("Fieldset not found: "+i.name);}}for(const i of t)switch(i.type){case "Separator":{const t=new ne("Separator",i.label,"Separator",null,e,this.itemRepo);t.setInfo(i.info),t.setCondition(i.if),t.setCollapsed(i.collapsed),t.setPresets(i.presets),s.push(t);break}case "Label":{const t=new ne("Label","","Label",i.text,e,this.itemRepo);t.setLabelType(i.labelType),t.setCondition(i.if),s.push(t);break}case "Link":{let t;if(!r){let{id:a,linkItem:n,stopRecursion:r}=await this.fetchLinkValue(e,i.usageAs);n?t=n:r&&(t=a);}let a=new ne(i.usageAs,i.displayName,i.type,t,e,this.itemRepo);a.setInfo(i.info),a.setCondition(i.if),a.setLinkableTypes(i.linkableTypes),void 0!==i.preload&&a.setPreload(i.preload),void 0!==i.loadingManager&&a.setLoadingManagerRule(i.loadingManager),s.push(y$1.instance.proxyItemField(a,e));break}case "Tree":{const t=`${o}${i.name}`,r=[];for(const s of i.childTypes){const i=new ue$1(await this.createFieldInstances(e,s.fields,a,t,n,true));r.push({typeName:s.typeName,displayName:s.displayName||s.typeName,template:i,inputs:[],outputs:[]});}r.sort((function(e,t){return e.displayName.localeCompare(t.displayName)})),ce.instance.addTemplates(e.type,i.name,r);const l=new pe(void 0,void 0,"","Root",void 0,e),u=await this.readBlocks(e,l,i.name,t,a,true,true,"Tree");l.blocks=y$1.instance.proxyBlockArray(u,l,e);let c=new ne(i.name,i.displayName,i.type,null,e,this.itemRepo);c.setInfo(i.info),c.setCondition(i.if),c.setBlocks([l]),s.push(c);break}case "List":{const t=`${o}${i.name}`,r=new ue$1(await this.createFieldInstances(e,i.fields,a,t,n,true)),l=[{typeName:"Entry",displayName:i.elementName,template:r,inputs:[],outputs:[]}];ce.instance.addTemplates(e.type,i.name,l);let u=new ne(i.name,i.displayName,i.type,null,e,this.itemRepo);const c=await this.readBlocks(e,void 0,i.name,t,a,true,true,"List"),d=y$1.instance.proxyListArray(c,u,e);u.setInfo(i.info),u.setCondition(i.if),u.setBlocks(d),s.push(u);break}case "NodeGraph":{const t=`${o}${i.name}`,r=[];for(const s of i.childTypes){const i=new ue$1(await this.createFieldInstances(e,s.fields,a,t,n,true));r.push({typeName:s.typeName,displayName:s.displayName||s.typeName,template:i,inputs:s.inputs||[],outputs:s.outputs||[]});}r.sort((function(e,t){return e.displayName.localeCompare(t.displayName)})),ce.instance.addTemplates(e.type,i.name,r);let l=await this.readBlocks(e,void 0,i.name,t,a,false,false,"NodeGraph"),u=this.readConnections(e,t,a),c=new ne(i.name,i.displayName,i.type,null,e,this.itemRepo);c.setInfo(i.info),c.setCondition(i.if),c.setBlocks(y$1.instance.proxyGraphBlockArray(l,e)),c.setConnections(y$1.instance.proxyConnectionArray(u,e)),s.push(c);break}case "Attribute":{let t;r||(t=e[n]?e[n][i.name]:void 0,void 0===t&&(t=i.defaultValue));let a=new ne(i.name,i.displayName,i.type,t,e,this.itemRepo);a.setInfo(i.info),a.setCondition(i.if),a.setDefaultValue(i.defaultValue),a.setMinValue(i.minValue),a.setMaxValue(i.maxValue),a.setOptions(i.options),a.setDatatype(i.datatype),a.setLanguage(i.language),a.setWidget(i.widget),a.setLength(i.length),s.push(y$1.instance.proxyItemField(a,e));break}}return s}getFieldSet(e,t){if(Array.isArray(e.fieldSets))for(const a of e.fieldSets)if(a.name===t)return a;return null}async fetchLinkValue(e,t){if(!e)throw new k("fetchLinkValue(): Item cannot be null!");for(const a of e.links)if(a.usage===t)return {id:a.to,linkItem:a.item?await this.itemFetcher(a.item):null,stopRecursion:a.stopRecursion};return {id:null,linkItem:null}}async readBlocks(e,t,a,i,n,r,s,o){if(!e)throw new k("readBlocks(): Item cannot be null!");const l=[];let u=0;for(;;){const c=`${i}[${u}]`;if(!this.existsBlockNamespace(e,n,c))break;{const i=`${c}#id`,u=e.attributes[i],d=`${c}#subnodeid`,p=e.attributes[d],h=`${c}#type`;let f,m,g=e.attributes[h];switch(o){case "NodeGraph":{const t=`${c}#posx`,a=`${c}#posy`;f=e.attributes[t]||0,m=e.attributes[a]||0;break}case "List":r=false,g="Entry";}const b=ce.instance.getTemplate(e.packageType||e.type,a,g);if(b){const i=b.typeName,d=b.displayName,h=new pe(u,t,i,i,d,e);p&&h.setSubNodeId(p);const g=await this.createFields(h,e,b.template,c,"NodeGraph"===o,n);if(h.setFields(g),"NodeGraph"===o&&(h.setPosition(f,m),h.setInputs(b.inputs),h.setOutputs(b.outputs)),r){const t=await this.readBlocks(e,h,a,c,n,r,s,o);h.blocks=y$1.instance.proxyBlockArray(t,h,e);}if(s){const t=await this.readScripts(e,h,c,n);h.scripts=y$1.instance.proxyScriptArray(t,h,e);}"NodeGraph"===o?l.push(y$1.instance.proxyGraphBlock(h,e)):l.push(y$1.instance.proxyBlock(h,e));}else console.error(`Block template not found: ${a}_${g}`);}u++;}return l}async readScripts(e,t,a,i){if(!e)throw new k("readScripts(): Item cannot be null!");const n=[];let r=0;for(;;){const s=`${a}#scripts[${r}]`;if(!this.existsScriptNamespace(e,i,s))break;{const a=i[`${s}#id`],r=`${s}#item`,o=`${s}->`,l=o.length;let{linkItem:u}=await this.fetchLinkValue(e,r);const c=new Q$1(a,t,e,u);n.push(c);const d=new Set;for(const t in i)if(i.hasOwnProperty(t)&&t.startsWith(o)){const a=t.substring(l);if(!a||a.includes("["))continue;const n=`${s}->${a}`;let r=i[t];const{id:o,linkItem:u}=await this.fetchLinkValue(e,n);if(u)r=u;else if(o&&null==r)r=o;else if(Array.isArray(r)){const t=[];for(let a=0;a<r.length;a++){const i=`${n}[${a}]`,s=await this.fetchLinkValue(e,i);s.linkItem?t.push(s.linkItem):s.id?t.push(s.id):t.push(r[a]);}r=t;}const p=new J(c,a,r,e);c.addField(p),d.add(a);}if(e.links)for(const t of e.links){if(!t.usage.startsWith(o))continue;const a=t.usage.substring(l);if(!a||a.includes("[")||a.includes("#"))continue;if(d.has(a))continue;const{linkItem:i,id:n}=await this.fetchLinkValue(e,t.usage),r=new J(c,a,i??n??null,e);c.addField(r),d.add(a);}}r++;}return n}existsScriptNamespace(e,t,a){if(!e)throw new k("existsScriptNamespace(): Item cannot be null!");return "Script"===t[`${a}#usage`]}readConnections(e,t,a){const i=[];let n=0;for(;;){const r=a[`${t}#connection[${n++}]`];if(!r)break;i.push(new H(r,e));}return i}existsBlockNamespace(e,t,a){if(!e)throw new k("existsBlockNamespace(): Item cannot be null!");const i=t[`${a}#usage`];if(i)return "Block"===i;for(const e in t)if(t.hasOwnProperty(e)&&e.startsWith(a))return true;for(const t of e.links)if(t.usage.startsWith(a))return true;return false}async createFields(e,t,a,i,n,r,s=false){let o=a.instantiate(s),l=[];for(const a of o)if(a.name){const s=`${i}->${a.name}`;switch(a.type){case "Link":if(i){let{id:e,linkItem:i,stopRecursion:n}=await this.fetchLinkValue(t,s);a.value=i||(n?e:null);}else a.value=a.defaultValue;break;case "List":{const e=await this.readBlocks(t,void 0,a.name,s,r,true,true,"List"),i=y$1.instance.proxyListArray(e,a,t);a.setBlocks(i);break}case "Attribute":i?(a.value=t.attributes[s],void 0===a.value&&(a.value=a.defaultValue)):a.value=a.defaultValue;}n?l.push(y$1.instance.proxyGraphBlockField(a,e,t)):l.push(y$1.instance.proxyBlockField(a,e,t));}return l}static refreshFieldDependencies(e){const t=new Map,a=new Map;for(const a of e)t.set(a.name,a);for(const i of e)if(Array.isArray(i.conditionFieldNames))for(const e of i.conditionFieldNames){const n=t.get(e);if(n){const e=a.get(n);e?e.push(i):a.set(n,[i]);}}for(const i of e)i.refreshDependantFields(t,a.get(i));}};class pe extends Y{id="";parent=void 0;type=void 0;name="";displayName="";fields=[];blocks=[];isSelected=false;isExpanded=true;scripts=[];subNodeId=void 0;inputs=[];outputs=[];posX=0;posY=0;_fieldsByName=new Map;_firstLinkField=void 0;constructor(e=void 0,t=void 0,a=void 0,i=void 0,n=void 0,r=void 0){super(r),e instanceof W?this.restoreFromSnapshot(e,t):(this.id=e||p.createItemOrBlockID(),this.parent=t,this.type=a,this.name=i||this.type||"",this.displayName=n||this.name);}getId(){return this.id}setSubNodeId(e){this.subNodeId=e;}getFirstLinkField(){if(void 0!==this._firstLinkField)return this._firstLinkField;for(const e of this.fields)if("Link"===e.type)return this._firstLinkField=e,e;return this._firstLinkField=null,null}findField(e){if(this._fieldsByName.has(e))return this._fieldsByName.get(e);for(const t of this.fields)if(t.name===e)return this._fieldsByName.set(e,t),t;return this._fieldsByName.set(e,null),null}getPositionInParent(){if(this.parent){let e=0;for(const t of this.parent.blocks){if(t.id===this.id)return e;e++;}}return -1}refreshFieldDependencies(){de$1.refreshFieldDependencies(this.fields);for(const e of this.fields)e.refreshFieldDependencies();for(const e of this.blocks)e.refreshFieldDependencies();}resetFieldValues(e=false){for(const e of this.fields)e.resetValue();if(e)for(const t of this.blocks)t.resetFieldValues(e);}makeIdsUnique(e=new Map,t=false){if(e.has(this.id)||t){const t=p.createItemOrBlockID();e.set(this.id,t),this.id=t;}else e.set(this.id,this.id);for(const a of this.fields)a.makeIdsUnique(e,t);for(const a of this.blocks)a.makeIdsUnique(e,t);for(const a of this.scripts)a.makeIdsUnique(e,t);return e}transformNodeIds(e){for(const t of this.fields)t.transformNodeIds(e);for(const t of this.blocks)t.transformNodeIds(e);for(const t of this.scripts)t.transformNodeIds(e);}clone(e,t=true,a={},i=false){const n=new pe;i&&(n.id=this.id),n.ownerItem=this.ownerItem,n.parent=this.parent,n.type=this.type,n.name=this.name,n.displayName=this.displayName,n.isSelected=false,n.isExpanded=true,n.inputs=this.inputs,n.outputs=this.outputs,n.subNodeId=this.subNodeId,n.posX=0,n.posY=0;for(const t of this.fields){let r=t.clone(e,i);void 0!==a[t.name]&&(r.value=a[t.name]),e&&(r=y$1.instance.proxyBlockField(r,n,e)),n.fields.push(r);}if(e&&(n.scripts=y$1.instance.proxyScriptArray(n.scripts,n,e)),t)for(const e of this.scripts){const t=e.clone();n.scripts.push(t);}const r=n.blocks;e&&(n.blocks=y$1.instance.proxyBlockArray(r,n,e));for(const a of this.blocks){let s=a.clone(e,t,{},i);s.parent=n,e&&(s=y$1.instance.proxyBlock(s,e)),r.push(s);}return n}getDescendantBlocks(e=[]){const t=this.blocks;return e.push(...t),t.forEach((t=>t.getDescendantBlocks(e))),e}setFields(e){this.fields=e;}setInputs(e){this.inputs=e;}setOutputs(e){this.outputs=e;}setPosition(e,t){this.posX=e,this.posY=t;}setSelected(e){this.isSelected=e;}setExpanded(e){this.isExpanded=e;}getRoot(){return this.parent?this.parent.getRoot():this}forEachField(e){if(this.fields)for(const t of this.fields)t.forEachField(e);if(this.blocks)for(const t of this.blocks)t.forEachField(e);}findBlock(e){if(this.id===e)return this;for(const t of this.blocks){const a=t.findBlock(e);if(a)return a}return null}removeBlock(e){this.blocks.removeObject(e);}addBlock(e,t){this.blocks.includes(e)||(void 0===t?this.blocks.push(e):this.blocks.splice(t,0,e));}moveBlock(e,t){e.parent.blocks.moveObjectToArray(e,e.parent.blocks,t);}moveToPosition(e){this.parent.moveBlock(this,e);}moveBlockToParent(e,t){this.parent.blocks.moveObjectToArray(this,e.blocks,t),this.parent=e;}moveToParent(e,t){if(this.findBlock(e))return void console.error("Cannot move block to a parent that is a child.");const a=this.getRoot();if(!a)return void console.error("Cannot find root block!");const i=a.findBlock(e);i?this.parent!==i?this.moveBlockToParent(i,t):console.warn(`Node is already in parent ${e}`):console.error(`Cannot find the new parent block: ${e}`);}getField(e){for(const t of this.fields)if(t.name===e)return t;return null}hasTag(e){const t=this.getField("Tags");return !(!t||!Array.isArray(t.value))&&t.value.includes(e)}hasOneTag(e){const t=this.getField("Tags");if(t&&Array.isArray(t.value))for(const a of e)if(t.value.includes(a))return true;return false}getNameFieldValue(){const e=this.getField("Name");return e?e.value:null}getActiveFieldValue(){const e=this.getField("Active");return !e||e.value}createSnapshot(e=false){const t=[];for(const a of this.fields)a.createSnapshot&&t.push(a.createSnapshot(e));const a=[];if(!e)for(const t of this.blocks)a.push(t.createSnapshot(e));const i=[];for(const e of this.scripts)i.push(e.createSnapshot());return new W(this.id,"block",{id:this.id,ownerItem:this.ownerItem,subNodeId:this.subNodeId,type:this.type,name:this.name,displayName:this.displayName,fields:t,blocks:a,isExpanded:this.isExpanded,scripts:i,inputs:this.inputs,outputs:this.outputs,posX:this.posX,posY:this.posY})}restoreFromSnapshot(e,t){this.id=e.data.id,this.parent=t,this.subNodeId=e.data.subNodeId,this.type=e.data.type,this.ownerItem=e.data.ownerItem,this.name=e.data.name,this.displayName=e.data.displayName,this.isSelected=false,this.isExpanded=e.data.isExpanded,this.inputs=e.data.inputs,this.outputs=e.data.outputs,this.posX=e.data.posX,this.posY=e.data.posY;const a=[];this._rollbackArray(a,e.data.fields,(e=>y$1.instance.proxyBlockField(new ne(e),this,this.ownerItem))),this.fields=a;const i=[];this._rollbackArray(i,e.data.blocks,((e,t)=>y$1.instance.proxyBlock(new pe(e,t),this.ownerItem))),this.blocks=y$1.instance.proxyBlockArray(i,this,this.ownerItem);const n=[];this._rollbackArray(n,e.data.scripts,((e,t)=>new Q$1(e,t,this.ownerItem))),this.scripts=y$1.instance.proxyScriptArray(n,this,this.ownerItem);}rollbackFromSnapshot(e,t=false){this._rollbackArray(this.fields,e.data.fields,(e=>y$1.instance.proxyBlockField(new ne(e),this,this.ownerItem))),this._rollbackArray(this.scripts,e.data.scripts,(e=>new Q$1(e,this,this.ownerItem))),t||this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>y$1.instance.proxyBlock(new pe(e,t),this.ownerItem)));}_getFieldByName(e,t){for(const a of t)if(a.id===e)return a;return null}}
4613
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function he(e){let t=e.length;for(;--t>=0;)e[t]=0;}const fe=256,me=286,ye$1=30,ge=15,be=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ve=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),_e=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),we=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ae$1=new Array(576);he(Ae$1);const ke=new Array(60);he(ke);const Se=new Array(512);he(Se);const Ne=new Array(256);he(Ne);const Te=new Array(29);he(Te);const Me=new Array(ye$1);function xe(e,t,a,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=e&&e.length;}let Ve,Ce,Ie;function Fe(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t;}he(Me);const Ee=e=>e<256?Se[e]:Se[256+(e>>>7)],De=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255;},Re=(e,t,a)=>{e.bi_valid>16-a?(e.bi_buf|=t<<e.bi_valid&65535,De(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=a-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=a);},Le=(e,t,a)=>{Re(e,a[2*t],a[2*t+1]);},Pe=(e,t)=>{let a=0;do{a|=1&e,e>>>=1,a<<=1;}while(--t>0);return a>>>1},Be=(e,t,a)=>{const i=new Array(16);let n,r,s=0;for(n=1;n<=ge;n++)s=s+a[n-1]<<1,i[n]=s;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=Pe(i[t]++,t));}},Oe=e=>{let t;for(t=0;t<me;t++)e.dyn_ltree[2*t]=0;for(t=0;t<ye$1;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0;},$e=e=>{e.bi_valid>8?De(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0;},je=(e,t,a,i)=>{const n=2*t,r=2*a;return e[n]<e[r]||e[n]===e[r]&&i[t]<=i[a]},Ue$1=(e,t,a)=>{const i=e.heap[a];let n=a<<1;for(;n<=e.heap_len&&(n<e.heap_len&&je(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!je(t,i,e.heap[n],e.depth));)e.heap[a]=e.heap[n],a=n,n<<=1;e.heap[a]=i;},ze=(e,t,a)=>{let i,n,r,s,o=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+o++],i+=(255&e.pending_buf[e.sym_buf+o++])<<8,n=e.pending_buf[e.sym_buf+o++],0===i?Le(e,n,t):(r=Ne[n],Le(e,r+fe+1,t),s=be[r],0!==s&&(n-=Te[r],Re(e,n,s)),i--,r=Ee(i),Le(e,r,a),s=ve[r],0!==s&&(i-=Me[r],Re(e,i,s)));}while(o<e.sym_next);Le(e,256,t);},We$1=(e,t)=>{const a=t.dyn_tree,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,r=t.stat_desc.elems;let s,o,l,u=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<r;s++)0!==a[2*s]?(e.heap[++e.heap_len]=u=s,e.depth[s]=0):a[2*s+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=u<2?++u:0,a[2*l]=1,e.depth[l]=0,e.opt_len--,n&&(e.static_len-=i[2*l+1]);for(t.max_code=u,s=e.heap_len>>1;s>=1;s--)Ue$1(e,a,s);l=r;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ue$1(e,a,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,a[2*l]=a[2*s]+a[2*o],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,a[2*s+1]=a[2*o+1]=l,e.heap[1]=l++,Ue$1(e,a,1);}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const a=t.dyn_tree,i=t.max_code,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,p,h,f,m=0;for(p=0;p<=ge;p++)e.bl_count[p]=0;for(a[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)c=e.heap[u],p=a[2*a[2*c+1]+1]+1,p>l&&(p=l,m++),a[2*c+1]=p,c>i||(e.bl_count[p]++,h=0,c>=o&&(h=s[c-o]),f=a[2*c],e.opt_len+=f*(p+h),r&&(e.static_len+=f*(n[2*c+1]+h)));if(0!==m){do{for(p=l-1;0===e.bl_count[p];)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[l]--,m-=2;}while(m>0);for(p=l;0!==p;p--)for(c=e.bl_count[p];0!==c;)d=e.heap[--u],d>i||(a[2*d+1]!==p&&(e.opt_len+=(p-a[2*d+1])*a[2*d],a[2*d+1]=p),c--);}})(e,t),Be(a,u,e.bl_count);},Ye=(e,t,a)=>{let i,n,r=-1,s=t[1],o=0,l=7,u=4;for(0===s&&(l=138,u=3),t[2*(a+1)+1]=65535,i=0;i<=a;i++)n=s,s=t[2*(i+1)+1],++o<l&&n===s||(o<u?e.bl_tree[2*n]+=o:0!==n?(n!==r&&e.bl_tree[2*n]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,r=n,0===s?(l=138,u=3):n===s?(l=6,u=3):(l=7,u=4));},He$1=(e,t,a)=>{let i,n,r=-1,s=t[1],o=0,l=7,u=4;for(0===s&&(l=138,u=3),i=0;i<=a;i++)if(n=s,s=t[2*(i+1)+1],!(++o<l&&n===s)){if(o<u)do{Le(e,n,e.bl_tree);}while(0!=--o);else 0!==n?(n!==r&&(Le(e,n,e.bl_tree),o--),Le(e,16,e.bl_tree),Re(e,o-3,2)):o<=10?(Le(e,17,e.bl_tree),Re(e,o-3,3)):(Le(e,18,e.bl_tree),Re(e,o-11,7));o=0,r=n,0===s?(l=138,u=3):n===s?(l=6,u=3):(l=7,u=4);}};let Ge=false;const qe$1=(e,t,a,i)=>{Re(e,0+(i?1:0),3),$e(e),De(e,a),De(e,~a),a&&e.pending_buf.set(e.window.subarray(t,t+a),e.pending),e.pending+=a;};var Ze$1=e=>{Ge||((()=>{let e,t,a,i,n;const r=new Array(16);for(a=0,i=0;i<28;i++)for(Te[i]=a,e=0;e<1<<be[i];e++)Ne[a++]=i;for(Ne[a-1]=i,n=0,i=0;i<16;i++)for(Me[i]=n,e=0;e<1<<ve[i];e++)Se[n++]=i;for(n>>=7;i<ye$1;i++)for(Me[i]=n<<7,e=0;e<1<<ve[i]-7;e++)Se[256+n++]=i;for(t=0;t<=ge;t++)r[t]=0;for(e=0;e<=143;)Ae$1[2*e+1]=8,e++,r[8]++;for(;e<=255;)Ae$1[2*e+1]=9,e++,r[9]++;for(;e<=279;)Ae$1[2*e+1]=7,e++,r[7]++;for(;e<=287;)Ae$1[2*e+1]=8,e++,r[8]++;for(Be(Ae$1,287,r),e=0;e<ye$1;e++)ke[2*e+1]=5,ke[2*e]=Pe(e,5);Ve=new xe(Ae$1,be,257,me,ge),Ce=new xe(ke,ve,0,ye$1,ge),Ie=new xe(new Array(0),_e,0,19,7);})(),Ge=true),e.l_desc=new Fe(e.dyn_ltree,Ve),e.d_desc=new Fe(e.dyn_dtree,Ce),e.bl_desc=new Fe(e.bl_tree,Ie),e.bi_buf=0,e.bi_valid=0,Oe(e);},Je$1=(e,t,a,i)=>{let n,r,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,a=4093624447;for(t=0;t<=31;t++,a>>>=1)if(1&a&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<fe;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),We$1(e,e.l_desc),We$1(e,e.d_desc),s=(e=>{let t;for(Ye(e,e.dyn_ltree,e.l_desc.max_code),Ye(e,e.dyn_dtree,e.d_desc.max_code),We$1(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*we[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=n&&(n=r)):n=r=a+5,a+4<=n&&-1!==t?qe$1(e,t,a,i):4===e.strategy||r===n?(Re(e,2+(i?1:0),3),ze(e,Ae$1,ke)):(Re(e,4+(i?1:0),3),((e,t,a,i)=>{let n;for(Re(e,t-257,5),Re(e,a-1,5),Re(e,i-4,4),n=0;n<i;n++)Re(e,e.bl_tree[2*we[n]+1],3);He$1(e,e.dyn_ltree,t-1),He$1(e,e.dyn_dtree,a-1);})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),ze(e,e.dyn_ltree,e.dyn_dtree)),Oe(e),i&&$e(e);},Ke={_tr_init:Ze$1,_tr_stored_block:qe$1,_tr_flush_block:Je$1,_tr_tally:(e,t,a)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=a,0===t?e.dyn_ltree[2*a]++:(e.matches++,t--,e.dyn_ltree[2*(Ne[a]+fe+1)]++,e.dyn_dtree[2*Ee(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Re(e,2,3),Le(e,256,Ae$1),(e=>{16===e.bi_valid?(De(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8);})(e);}};var Xe=(e,t,a,i)=>{let n=65535&e,r=e>>>16&65535,s=0;for(;0!==a;){s=a>2e3?2e3:a,a-=s;do{n=n+t[i++]|0,r=r+n|0;}while(--s);n%=65521,r%=65521;}return n|r<<16};const Qe$1=new Uint32Array((()=>{let e,t=[];for(var a=0;a<256;a++){e=a;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[a]=e;}return t})());var et$2=(e,t,a,i)=>{const n=Qe$1,r=i+a;e^=-1;for(let a=i;a<r;a++)e=e>>>8^n[255&(e^t[a])];return ~e},tt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},at={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:it$1,_tr_stored_block:nt,_tr_flush_block:rt,_tr_tally:st,_tr_align:ot}=Ke,{Z_NO_FLUSH:lt,Z_PARTIAL_FLUSH:ut,Z_FULL_FLUSH:ct,Z_FINISH:dt$1,Z_BLOCK:pt,Z_OK:ht$1,Z_STREAM_END:ft,Z_STREAM_ERROR:mt,Z_DATA_ERROR:yt,Z_BUF_ERROR:gt$1,Z_DEFAULT_COMPRESSION:bt,Z_FILTERED:vt,Z_HUFFMAN_ONLY:_t,Z_RLE:wt,Z_FIXED:At,Z_DEFAULT_STRATEGY:kt,Z_UNKNOWN:St,Z_DEFLATED:Nt}=at,Tt=258,Mt=262,xt$1=42,Vt=113,Ct=666,It=(e,t)=>(e.msg=tt[t],t),Ft$1=e=>2*e-(e>4?9:0),Et$1=e=>{let t=e.length;for(;--t>=0;)e[t]=0;},Dt=e=>{let t,a,i,n=e.w_size;t=e.hash_size,i=t;do{a=e.head[--i],e.head[i]=a>=n?a-n:0;}while(--t);t=n,i=t;do{a=e.prev[--i],e.prev[i]=a>=n?a-n:0;}while(--t)};let Rt=(e,t,a)=>(t<<e.hash_shift^a)&e.hash_mask;const Lt=e=>{const t=e.state;let a=t.pending;a>e.avail_out&&(a=e.avail_out),0!==a&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+a),e.next_out),e.next_out+=a,t.pending_out+=a,e.total_out+=a,e.avail_out-=a,t.pending-=a,0===t.pending&&(t.pending_out=0));},Pt=(e,t)=>{rt(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Lt(e.strm);},Bt=(e,t)=>{e.pending_buf[e.pending++]=t;},Ot=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t;},$t=(e,t,a,i)=>{let n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),a),1===e.state.wrap?e.adler=Xe(e.adler,t,n,a):2===e.state.wrap&&(e.adler=et$2(e.adler,t,n,a)),e.next_in+=n,e.total_in+=n,n)},jt=(e,t)=>{let a,i,n=e.max_chain_length,r=e.strstart,s=e.prev_length,o=e.nice_match;const l=e.strstart>e.w_size-Mt?e.strstart-(e.w_size-Mt):0,u=e.window,c=e.w_mask,d=e.prev,p=e.strstart+Tt;let h=u[r+s-1],f=u[r+s];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(a=t,u[a+s]===f&&u[a+s-1]===h&&u[a]===u[r]&&u[++a]===u[r+1]){r+=2,a++;do{}while(u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&r<p);if(i=Tt-(p-r),r=p-Tt,i>s){if(e.match_start=t,s=i,i>=o)break;h=u[r+s-1],f=u[r+s];}}}while((t=d[t&c])>l&&0!=--n);return s<=e.lookahead?s:e.lookahead},Ut=e=>{const t=e.w_size;let a,i,n;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Mt)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Dt(e),i+=t),0===e.strm.avail_in)break;if(a=$t(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=a,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=Rt(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=Rt(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Mt&&0!==e.strm.avail_in)},zt=(e,t)=>{let a,i,n,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,o=e.strm.avail_in;do{if(a=65535,n=e.bi_valid+42>>3,e.strm.avail_out<n)break;if(n=e.strm.avail_out-n,i=e.strstart-e.block_start,a>i+e.strm.avail_in&&(a=i+e.strm.avail_in),a>n&&(a=n),a<r&&(0===a&&t!==dt$1||t===lt||a!==i+e.strm.avail_in))break;s=t===dt$1&&a===i+e.strm.avail_in?1:0,nt(e,0,0,s),e.pending_buf[e.pending-4]=a,e.pending_buf[e.pending-3]=a>>8,e.pending_buf[e.pending-2]=~a,e.pending_buf[e.pending-1]=~a>>8,Lt(e.strm),i&&(i>a&&(i=a),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,a-=i),a&&($t(e.strm,e.strm.output,e.strm.next_out,a),e.strm.next_out+=a,e.strm.avail_out-=a,e.strm.total_out+=a);}while(0===s);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==lt&&t!==dt$1&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(n=e.window_size-e.strstart,e.strm.avail_in>n&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&($t(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water<e.strstart&&(e.high_water=e.strstart),n=e.bi_valid+42>>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,r=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=r||(i||t===dt$1)&&t!==lt&&0===e.strm.avail_in&&i<=n)&&(a=i>n?n:i,s=t===dt$1&&0===e.strm.avail_in&&a===i?1:0,nt(e,e.block_start,a,s),e.block_start+=a,Lt(e.strm)),s?3:1)},Wt=(e,t)=>{let a,i;for(;;){if(e.lookahead<Mt){if(Ut(e),e.lookahead<Mt&&t===lt)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=Rt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==a&&e.strstart-a<=e.w_size-Mt&&(e.match_length=jt(e,a)),e.match_length>=3)if(i=st(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Rt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;}while(0!=--e.match_length);e.strstart++;}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Rt(e,e.ins_h,e.window[e.strstart+1]);else i=st(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Pt(e,false),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===dt$1?(Pt(e,true),0===e.strm.avail_out?3:4):e.sym_next&&(Pt(e,false),0===e.strm.avail_out)?1:2},Yt=(e,t)=>{let a,i,n;for(;;){if(e.lookahead<Mt){if(Ut(e),e.lookahead<Mt&&t===lt)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=Rt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==a&&e.prev_length<e.max_lazy_match&&e.strstart-a<=e.w_size-Mt&&(e.match_length=jt(e,a),e.match_length<=5&&(e.strategy===vt||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=st(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=Rt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(Pt(e,false),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=st(e,0,e.window[e.strstart-1]),i&&Pt(e,false),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--;}return e.match_available&&(i=st(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===dt$1?(Pt(e,true),0===e.strm.avail_out?3:4):e.sym_next&&(Pt(e,false),0===e.strm.avail_out)?1:2};function Ht(e,t,a,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=a,this.max_chain=i,this.func=n;}const Gt=[new Ht(0,0,0,0,zt),new Ht(4,4,8,4,Wt),new Ht(4,5,16,8,Wt),new Ht(4,6,32,32,Wt),new Ht(4,4,16,16,Yt),new Ht(8,16,32,32,Yt),new Ht(8,16,128,128,Yt),new Ht(8,32,128,256,Yt),new Ht(32,128,258,1024,Yt),new Ht(32,258,258,4096,Yt)];function qt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Nt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Et$1(this.dyn_ltree),Et$1(this.dyn_dtree),Et$1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Et$1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Et$1(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}const Zt=e=>{if(!e)return 1;const t=e.state;return !t||t.strm!==e||t.status!==xt$1&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Vt&&t.status!==Ct?1:0},Jt=e=>{if(Zt(e))return It(e,mt);e.total_in=e.total_out=0,e.data_type=St;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?xt$1:Vt,e.adler=2===t.wrap?0:1,t.last_flush=-2,it$1(t),ht$1},Kt=e=>{const t=Jt(e);var a;return t===ht$1&&((a=e.state).window_size=2*a.w_size,Et$1(a.head),a.max_lazy_match=Gt[a.level].max_lazy,a.good_match=Gt[a.level].good_length,a.nice_match=Gt[a.level].nice_length,a.max_chain_length=Gt[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),t},Xt=(e,t,a,i,n,r)=>{if(!e)return mt;let s=1;if(t===bt&&(t=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),n<1||n>9||a!==Nt||i<8||i>15||t<0||t>9||r<0||r>At||8===i&&1!==s)return It(e,mt);8===i&&(i=9);const o=new qt;return e.state=o,o.strm=e,o.status=xt$1,o.wrap=s,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=t,o.strategy=r,o.method=a,Kt(e)};var Qt=(e,t)=>{if(Zt(e)||t>pt||t<0)return e?It(e,mt):mt;const a=e.state;if(!e.output||0!==e.avail_in&&!e.input||a.status===Ct&&t!==dt$1)return It(e,0===e.avail_out?gt$1:mt);const i=a.last_flush;if(a.last_flush=t,0!==a.pending){if(Lt(e),0===e.avail_out)return a.last_flush=-1,ht$1}else if(0===e.avail_in&&Ft$1(t)<=Ft$1(i)&&t!==dt$1)return It(e,gt$1);if(a.status===Ct&&0!==e.avail_in)return It(e,gt$1);if(a.status===xt$1&&0===a.wrap&&(a.status=Vt),a.status===xt$1){let t=Nt+(a.w_bits-8<<4)<<8,i=-1;if(i=a.strategy>=_t||a.level<2?0:a.level<6?1:6===a.level?2:3,t|=i<<6,0!==a.strstart&&(t|=32),t+=31-t%31,Ot(a,t),0!==a.strstart&&(Ot(a,e.adler>>>16),Ot(a,65535&e.adler)),e.adler=1,a.status=Vt,Lt(e),0!==a.pending)return a.last_flush=-1,ht$1}if(57===a.status)if(e.adler=0,Bt(a,31),Bt(a,139),Bt(a,8),a.gzhead)Bt(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),Bt(a,255&a.gzhead.time),Bt(a,a.gzhead.time>>8&255),Bt(a,a.gzhead.time>>16&255),Bt(a,a.gzhead.time>>24&255),Bt(a,9===a.level?2:a.strategy>=_t||a.level<2?4:0),Bt(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(Bt(a,255&a.gzhead.extra.length),Bt(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=et$2(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(Bt(a,0),Bt(a,0),Bt(a,0),Bt(a,0),Bt(a,0),Bt(a,9===a.level?2:a.strategy>=_t||a.level<2?4:0),Bt(a,3),a.status=Vt,Lt(e),0!==a.pending)return a.last_flush=-1,ht$1;if(69===a.status){if(a.gzhead.extra){let t=a.pending,i=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+i>a.pending_buf_size;){let n=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+n),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>t&&(e.adler=et$2(e.adler,a.pending_buf,a.pending-t,t)),a.gzindex+=n,Lt(e),0!==a.pending)return a.last_flush=-1,ht$1;t=0,i-=n;}let n=new Uint8Array(a.gzhead.extra);a.pending_buf.set(n.subarray(a.gzindex,a.gzindex+i),a.pending),a.pending+=i,a.gzhead.hcrc&&a.pending>t&&(e.adler=et$2(e.adler,a.pending_buf,a.pending-t,t)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){let t,i=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>i&&(e.adler=et$2(e.adler,a.pending_buf,a.pending-i,i)),Lt(e),0!==a.pending)return a.last_flush=-1,ht$1;i=0;}t=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,Bt(a,t);}while(0!==t);a.gzhead.hcrc&&a.pending>i&&(e.adler=et$2(e.adler,a.pending_buf,a.pending-i,i)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){let t,i=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>i&&(e.adler=et$2(e.adler,a.pending_buf,a.pending-i,i)),Lt(e),0!==a.pending)return a.last_flush=-1,ht$1;i=0;}t=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,Bt(a,t);}while(0!==t);a.gzhead.hcrc&&a.pending>i&&(e.adler=et$2(e.adler,a.pending_buf,a.pending-i,i));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(Lt(e),0!==a.pending))return a.last_flush=-1,ht$1;Bt(a,255&e.adler),Bt(a,e.adler>>8&255),e.adler=0;}if(a.status=Vt,Lt(e),0!==a.pending)return a.last_flush=-1,ht$1}if(0!==e.avail_in||0!==a.lookahead||t!==lt&&a.status!==Ct){let i=0===a.level?zt(a,t):a.strategy===_t?((e,t)=>{let a;for(;;){if(0===e.lookahead&&(Ut(e),0===e.lookahead)){if(t===lt)return 1;break}if(e.match_length=0,a=st(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,a&&(Pt(e,false),0===e.strm.avail_out))return 1}return e.insert=0,t===dt$1?(Pt(e,true),0===e.strm.avail_out?3:4):e.sym_next&&(Pt(e,false),0===e.strm.avail_out)?1:2})(a,t):a.strategy===wt?((e,t)=>{let a,i,n,r;const s=e.window;for(;;){if(e.lookahead<=Tt){if(Ut(e),e.lookahead<=Tt&&t===lt)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,i=s[n],i===s[++n]&&i===s[++n]&&i===s[++n])){r=e.strstart+Tt;do{}while(i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&n<r);e.match_length=Tt-(r-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead);}if(e.match_length>=3?(a=st(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(a=st(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),a&&(Pt(e,false),0===e.strm.avail_out))return 1}return e.insert=0,t===dt$1?(Pt(e,true),0===e.strm.avail_out?3:4):e.sym_next&&(Pt(e,false),0===e.strm.avail_out)?1:2})(a,t):Gt[a.level].func(a,t);if(3!==i&&4!==i||(a.status=Ct),1===i||3===i)return 0===e.avail_out&&(a.last_flush=-1),ht$1;if(2===i&&(t===ut?ot(a):t!==pt&&(nt(a,0,0,false),t===ct&&(Et$1(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),Lt(e),0===e.avail_out))return a.last_flush=-1,ht$1}return t!==dt$1?ht$1:a.wrap<=0?ft:(2===a.wrap?(Bt(a,255&e.adler),Bt(a,e.adler>>8&255),Bt(a,e.adler>>16&255),Bt(a,e.adler>>24&255),Bt(a,255&e.total_in),Bt(a,e.total_in>>8&255),Bt(a,e.total_in>>16&255),Bt(a,e.total_in>>24&255)):(Ot(a,e.adler>>>16),Ot(a,65535&e.adler)),Lt(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?ht$1:ft)},ea={deflateInit:(e,t)=>Xt(e,t,Nt,15,8,kt),deflateInit2:Xt,deflateReset:Kt,deflateResetKeep:Jt,deflateSetHeader:(e,t)=>Zt(e)||2!==e.state.wrap?mt:(e.state.gzhead=t,ht$1),deflate:Qt,deflateEnd:e=>{if(Zt(e))return mt;const t=e.state.status;return e.state=null,t===Vt?It(e,yt):ht$1},deflateSetDictionary:(e,t)=>{let a=t.length;if(Zt(e))return mt;const i=e.state,n=i.wrap;if(2===n||1===n&&i.status!==xt$1||i.lookahead)return mt;if(1===n&&(e.adler=Xe(e.adler,t,a,0)),i.wrap=0,a>=i.w_size){0===n&&(Et$1(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(a-i.w_size,a),0),t=e,a=i.w_size;}const r=e.avail_in,s=e.next_in,o=e.input;for(e.avail_in=a,e.next_in=0,e.input=t,Ut(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Rt(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++;}while(--t);i.strstart=e,i.lookahead=2,Ut(i);}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=s,e.input=o,e.avail_in=r,i.wrap=n,ht$1},deflateInfo:"pako deflate (from Nodeca project)"};const ta=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var aa=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const a=t.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const t in a)ta(a,t)&&(e[t]=a[t]);}}return e},ia=e=>{let t=0;for(let a=0,i=e.length;a<i;a++)t+=e[a].length;const a=new Uint8Array(t);for(let t=0,i=0,n=e.length;t<n;t++){let n=e[t];a.set(n,i),i+=n.length;}return a};let na=true;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(e){na=false;}const ra=new Uint8Array(256);for(let e=0;e<256;e++)ra[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;ra[254]=ra[254]=1;var sa=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return (new TextEncoder).encode(e);let t,a,i,n,r,s=e.length,o=0;for(n=0;n<s;n++)a=e.charCodeAt(n),55296==(64512&a)&&n+1<s&&(i=e.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(t=new Uint8Array(o),r=0,n=0;r<o;n++)a=e.charCodeAt(n),55296==(64512&a)&&n+1<s&&(i=e.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),a<128?t[r++]=a:a<2048?(t[r++]=192|a>>>6,t[r++]=128|63&a):a<65536?(t[r++]=224|a>>>12,t[r++]=128|a>>>6&63,t[r++]=128|63&a):(t[r++]=240|a>>>18,t[r++]=128|a>>>12&63,t[r++]=128|a>>>6&63,t[r++]=128|63&a);return t},oa=(e,t)=>{const a=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return (new TextDecoder).decode(e.subarray(0,t));let i,n;const r=new Array(2*a);for(n=0,i=0;i<a;){let t=e[i++];if(t<128){r[n++]=t;continue}let s=ra[t];if(s>4)r[n++]=65533,i+=s-1;else {for(t&=2===s?31:3===s?15:7;s>1&&i<a;)t=t<<6|63&e[i++],s--;s>1?r[n++]=65533:t<65536?r[n++]=t:(t-=65536,r[n++]=55296|t>>10&1023,r[n++]=56320|1023&t);}}return ((e,t)=>{if(t<65534&&e.subarray&&na)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let a="";for(let i=0;i<t;i++)a+=String.fromCharCode(e[i]);return a})(r,n)},la=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let a=t-1;for(;a>=0&&128==(192&e[a]);)a--;return a<0||0===a?t:a+ra[e[a]]>t?a:t};var ua=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};const ca=Object.prototype.toString,{Z_NO_FLUSH:da,Z_SYNC_FLUSH:pa,Z_FULL_FLUSH:ha,Z_FINISH:fa,Z_OK:ma,Z_STREAM_END:ya,Z_DEFAULT_COMPRESSION:ga,Z_DEFAULT_STRATEGY:ba,Z_DEFLATED:va}=at;function _a$2(e){this.options=aa({level:ga,method:va,chunkSize:16384,windowBits:15,memLevel:8,strategy:ba},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=false,this.chunks=[],this.strm=new ua,this.strm.avail_out=0;let a=ea.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(a!==ma)throw new Error(tt[a]);if(t.header&&ea.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?sa(t.dictionary):"[object ArrayBuffer]"===ca.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,a=ea.deflateSetDictionary(this.strm,e),a!==ma)throw new Error(tt[a]);this._dict_set=true;}}function wa(e,t){const a=new _a$2(t);if(a.push(e,true),a.err)throw a.msg||tt[a.err];return a.result}_a$2.prototype.push=function(e,t){const a=this.strm,i=this.options.chunkSize;let n,r;if(this.ended)return false;for(r=t===~~t?t:true===t?fa:da,"string"==typeof e?a.input=sa(e):"[object ArrayBuffer]"===ca.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(r===pa||r===ha)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else {if(n=ea.deflate(a,r),n===ya)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=ea.deflateEnd(this.strm),this.onEnd(n),this.ended=true,n===ma;if(0!==a.avail_out){if(r>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output);}return true},_a$2.prototype.onData=function(e){this.chunks.push(e);},_a$2.prototype.onEnd=function(e){e===ma&&(this.result=ia(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg;};var Aa=function(e,t){return (t=t||{}).raw=true,wa(e,t)},ka=function(e,t){return (t=t||{}).gzip=true,wa(e,t)},Sa={Deflate:_a$2,deflate:wa,deflateRaw:Aa,gzip:ka};const Na=16209;var Ta=function(e,t){let a,i,n,r,s,o,l,u,c,d,p,h,f,m,y,g,b,v,_,w,A,k,S,N;const T=e.state;a=e.next_in,S=e.input,i=a+(e.avail_in-5),n=e.next_out,N=e.output,r=n-(t-e.avail_out),s=n+(e.avail_out-257),o=T.dmax,l=T.wsize,u=T.whave,c=T.wnext,d=T.window,p=T.hold,h=T.bits,f=T.lencode,m=T.distcode,y=(1<<T.lenbits)-1,g=(1<<T.distbits)-1;e:do{h<15&&(p+=S[a++]<<h,h+=8,p+=S[a++]<<h,h+=8),b=f[p&y];t:for(;;){if(v=b>>>24,p>>>=v,h-=v,v=b>>>16&255,0===v)N[n++]=65535&b;else {if(!(16&v)){if(64&v){if(32&v){T.mode=16191;break e}e.msg="invalid literal/length code",T.mode=Na;break e}b=f[(65535&b)+(p&(1<<v)-1)];continue t}for(_=65535&b,v&=15,v&&(h<v&&(p+=S[a++]<<h,h+=8),_+=p&(1<<v)-1,p>>>=v,h-=v),h<15&&(p+=S[a++]<<h,h+=8,p+=S[a++]<<h,h+=8),b=m[p&g];;){if(v=b>>>24,p>>>=v,h-=v,v=b>>>16&255,16&v){if(w=65535&b,v&=15,h<v&&(p+=S[a++]<<h,h+=8,h<v&&(p+=S[a++]<<h,h+=8)),w+=p&(1<<v)-1,w>o){e.msg="invalid distance too far back",T.mode=Na;break e}if(p>>>=v,h-=v,v=n-r,w>v){if(v=w-v,v>u&&T.sane){e.msg="invalid distance too far back",T.mode=Na;break e}if(A=0,k=d,0===c){if(A+=l-v,v<_){_-=v;do{N[n++]=d[A++];}while(--v);A=n-w,k=N;}}else if(c<v){if(A+=l+c-v,v-=c,v<_){_-=v;do{N[n++]=d[A++];}while(--v);if(A=0,c<_){v=c,_-=v;do{N[n++]=d[A++];}while(--v);A=n-w,k=N;}}}else if(A+=c-v,v<_){_-=v;do{N[n++]=d[A++];}while(--v);A=n-w,k=N;}for(;_>2;)N[n++]=k[A++],N[n++]=k[A++],N[n++]=k[A++],_-=3;_&&(N[n++]=k[A++],_>1&&(N[n++]=k[A++]));}else {A=n-w;do{N[n++]=N[A++],N[n++]=N[A++],N[n++]=N[A++],_-=3;}while(_>2);_&&(N[n++]=N[A++],_>1&&(N[n++]=N[A++]));}break}if(64&v){e.msg="invalid distance code",T.mode=Na;break e}b=m[(65535&b)+(p&(1<<v)-1)];}}break}}while(a<i&&n<s);_=h>>3,a-=_,h-=_<<3,p&=(1<<h)-1,e.next_in=a,e.next_out=n,e.avail_in=a<i?i-a+5:5-(a-i),e.avail_out=n<s?s-n+257:257-(n-s),T.hold=p,T.bits=h;};const Ma=15,xa=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Va=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ca=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ia=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Fa=(e,t,a,i,n,r,s,o)=>{const l=o.bits;let u,c,d,p,h,f,m=0,y=0,g=0,b=0,v=0,_=0,w=0,A=0,k=0,S=0,N=null;const T=new Uint16Array(16),M=new Uint16Array(16);let x,V,C,I=null;for(m=0;m<=Ma;m++)T[m]=0;for(y=0;y<i;y++)T[t[a+y]]++;for(v=l,b=Ma;b>=1&&0===T[b];b--);if(v>b&&(v=b),0===b)return n[r++]=20971520,n[r++]=20971520,o.bits=1,0;for(g=1;g<b&&0===T[g];g++);for(v<g&&(v=g),A=1,m=1;m<=Ma;m++)if(A<<=1,A-=T[m],A<0)return -1;if(A>0&&(0===e||1!==b))return -1;for(M[1]=0,m=1;m<Ma;m++)M[m+1]=M[m]+T[m];for(y=0;y<i;y++)0!==t[a+y]&&(s[M[t[a+y]]++]=y);if(0===e?(N=I=s,f=20):1===e?(N=xa,I=Va,f=257):(N=Ca,I=Ia,f=0),S=0,y=0,m=g,h=r,_=v,w=0,d=-1,k=1<<v,p=k-1,1===e&&k>852||2===e&&k>592)return 1;for(;;){x=m-w,s[y]+1<f?(V=0,C=s[y]):s[y]>=f?(V=I[s[y]-f],C=N[s[y]-f]):(V=96,C=0),u=1<<m-w,c=1<<_,g=c;do{c-=u,n[h+(S>>w)+c]=x<<24|V<<16|C;}while(0!==c);for(u=1<<m-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,y++,0==--T[m]){if(m===b)break;m=t[a+s[y]];}if(m>v&&(S&p)!==d){for(0===w&&(w=v),h+=g,_=m-w,A=1<<_;_+w<b&&(A-=T[_+w],!(A<=0));)_++,A<<=1;if(k+=1<<_,1===e&&k>852||2===e&&k>592)return 1;d=S&p,n[d]=v<<24|_<<16|h-r;}}return 0!==S&&(n[h+S]=m-w<<24|64<<16),o.bits=v,0};const{Z_FINISH:Ea,Z_BLOCK:Da,Z_TREES:Ra,Z_OK:La,Z_STREAM_END:Pa,Z_NEED_DICT:Ba,Z_STREAM_ERROR:Oa,Z_DATA_ERROR:$a,Z_MEM_ERROR:ja,Z_BUF_ERROR:Ua,Z_DEFLATED:za}=at,Wa=16180,Ya=16190,Ha=16191,Ga=16192,qa=16194,Za=16199,Ja=16200,Ka=16206,Xa=16209,Qa=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function ei(){this.strm=null,this.mode=0,this.last=false,this.wrap=0,this.havedict=false,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}const ti=e=>{if(!e)return 1;const t=e.state;return !t||t.strm!==e||t.mode<Wa||t.mode>16211?1:0},ai=e=>{if(ti(e))return Oa;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Wa,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,La},ii=e=>{if(ti(e))return Oa;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,ai(e)},ni=(e,t)=>{let a;if(ti(e))return Oa;const i=e.state;return t<0?(a=0,t=-t):(a=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Oa:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=a,i.wbits=t,ii(e))},ri$1=(e,t)=>{if(!e)return Oa;const a=new ei;e.state=a,a.strm=e,a.window=null,a.mode=Wa;const i=ni(e,t);return i!==La&&(e.state=null),i};let si,oi$1,li=true;const ui=e=>{if(li){si=new Int32Array(512),oi$1=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Fa(1,e.lens,0,288,si,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Fa(2,e.lens,0,32,oi$1,0,e.work,{bits:5}),li=false;}e.lencode=si,e.lenbits=9,e.distcode=oi$1,e.distbits=5;},ci$1=(e,t,a,i)=>{let n;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),i>=r.wsize?(r.window.set(t.subarray(a-r.wsize,a),0),r.wnext=0,r.whave=r.wsize):(n=r.wsize-r.wnext,n>i&&(n=i),r.window.set(t.subarray(a-i,a-i+n),r.wnext),(i-=n)?(r.window.set(t.subarray(a-i,a),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=n))),0};var di=(e,t)=>{let a,i,n,r,s,o,l,u,c,d,p,h,f,m,y,g,b,v,_,w,A,k,S=0;const N=new Uint8Array(4);let T,M;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ti(e)||!e.output||!e.input&&0!==e.avail_in)return Oa;a=e.state,a.mode===Ha&&(a.mode=Ga),s=e.next_out,n=e.output,l=e.avail_out,r=e.next_in,i=e.input,o=e.avail_in,u=a.hold,c=a.bits,d=o,p=l,k=La;e:for(;;)switch(a.mode){case Wa:if(0===a.wrap){a.mode=Ga;break}for(;c<16;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if(2&a.wrap&&35615===u){0===a.wbits&&(a.wbits=15),a.check=0,N[0]=255&u,N[1]=u>>>8&255,a.check=et$2(a.check,N,2,0),u=0,c=0,a.mode=16181;break}if(a.head&&(a.head.done=false),!(1&a.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",a.mode=Xa;break}if((15&u)!==za){e.msg="unknown compression method",a.mode=Xa;break}if(u>>>=4,c-=4,A=8+(15&u),0===a.wbits&&(a.wbits=A),A>15||A>a.wbits){e.msg="invalid window size",a.mode=Xa;break}a.dmax=1<<a.wbits,a.flags=0,e.adler=a.check=1,a.mode=512&u?16189:Ha,u=0,c=0;break;case 16181:for(;c<16;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if(a.flags=u,(255&a.flags)!==za){e.msg="unknown compression method",a.mode=Xa;break}if(57344&a.flags){e.msg="unknown header flags set",a.mode=Xa;break}a.head&&(a.head.text=u>>8&1),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=et$2(a.check,N,2,0)),u=0,c=0,a.mode=16182;case 16182:for(;c<32;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}a.head&&(a.head.time=u),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,N[2]=u>>>16&255,N[3]=u>>>24&255,a.check=et$2(a.check,N,4,0)),u=0,c=0,a.mode=16183;case 16183:for(;c<16;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}a.head&&(a.head.xflags=255&u,a.head.os=u>>8),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=et$2(a.check,N,2,0)),u=0,c=0,a.mode=16184;case 16184:if(1024&a.flags){for(;c<16;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}a.length=u,a.head&&(a.head.extra_len=u),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=et$2(a.check,N,2,0)),u=0,c=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(h=a.length,h>o&&(h=o),h&&(a.head&&(A=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(r,r+h),A)),512&a.flags&&4&a.wrap&&(a.check=et$2(a.check,i,h,r)),o-=h,r+=h,a.length-=h),a.length))break e;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break e;h=0;do{A=i[r+h++],a.head&&A&&a.length<65536&&(a.head.name+=String.fromCharCode(A));}while(A&&h<o);if(512&a.flags&&4&a.wrap&&(a.check=et$2(a.check,i,h,r)),o-=h,r+=h,A)break e}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break e;h=0;do{A=i[r+h++],a.head&&A&&a.length<65536&&(a.head.comment+=String.fromCharCode(A));}while(A&&h<o);if(512&a.flags&&4&a.wrap&&(a.check=et$2(a.check,i,h,r)),o-=h,r+=h,A)break e}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;c<16;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if(4&a.wrap&&u!==(65535&a.check)){e.msg="header crc mismatch",a.mode=Xa;break}u=0,c=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=true),e.adler=a.check=0,a.mode=Ha;break;case 16189:for(;c<32;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}e.adler=a.check=Qa(u),u=0,c=0,a.mode=Ya;case Ya:if(0===a.havedict)return e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,Ba;e.adler=a.check=1,a.mode=Ha;case Ha:if(t===Da||t===Ra)break e;case Ga:if(a.last){u>>>=7&c,c-=7&c,a.mode=Ka;break}for(;c<3;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}switch(a.last=1&u,u>>>=1,c-=1,3&u){case 0:a.mode=16193;break;case 1:if(ui(a),a.mode=Za,t===Ra){u>>>=2,c-=2;break e}break;case 2:a.mode=16196;break;case 3:e.msg="invalid block type",a.mode=Xa;}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",a.mode=Xa;break}if(a.length=65535&u,u=0,c=0,a.mode=qa,t===Ra)break e;case qa:a.mode=16195;case 16195:if(h=a.length,h){if(h>o&&(h=o),h>l&&(h=l),0===h)break e;n.set(i.subarray(r,r+h),s),o-=h,r+=h,l-=h,s+=h,a.length-=h;break}a.mode=Ha;break;case 16196:for(;c<14;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if(a.nlen=257+(31&u),u>>>=5,c-=5,a.ndist=1+(31&u),u>>>=5,c-=5,a.ncode=4+(15&u),u>>>=4,c-=4,a.nlen>286||a.ndist>30){e.msg="too many length or distance symbols",a.mode=Xa;break}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;c<3;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}a.lens[x[a.have++]]=7&u,u>>>=3,c-=3;}for(;a.have<19;)a.lens[x[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,T={bits:a.lenbits},k=Fa(0,a.lens,0,19,a.lencode,0,a.work,T),a.lenbits=T.bits,k){e.msg="invalid code lengths set",a.mode=Xa;break}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;S=a.lencode[u&(1<<a.lenbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if(b<16)u>>>=y,c-=y,a.lens[a.have++]=b;else {if(16===b){for(M=y+2;c<M;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if(u>>>=y,c-=y,0===a.have){e.msg="invalid bit length repeat",a.mode=Xa;break}A=a.lens[a.have-1],h=3+(3&u),u>>>=2,c-=2;}else if(17===b){for(M=y+3;c<M;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}u>>>=y,c-=y,A=0,h=3+(7&u),u>>>=3,c-=3;}else {for(M=y+7;c<M;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}u>>>=y,c-=y,A=0,h=11+(127&u),u>>>=7,c-=7;}if(a.have+h>a.nlen+a.ndist){e.msg="invalid bit length repeat",a.mode=Xa;break}for(;h--;)a.lens[a.have++]=A;}}if(a.mode===Xa)break;if(0===a.lens[256]){e.msg="invalid code -- missing end-of-block",a.mode=Xa;break}if(a.lenbits=9,T={bits:a.lenbits},k=Fa(1,a.lens,0,a.nlen,a.lencode,0,a.work,T),a.lenbits=T.bits,k){e.msg="invalid literal/lengths set",a.mode=Xa;break}if(a.distbits=6,a.distcode=a.distdyn,T={bits:a.distbits},k=Fa(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,T),a.distbits=T.bits,k){e.msg="invalid distances set",a.mode=Xa;break}if(a.mode=Za,t===Ra)break e;case Za:a.mode=Ja;case Ja:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,Ta(e,p),s=e.next_out,n=e.output,l=e.avail_out,r=e.next_in,i=e.input,o=e.avail_in,u=a.hold,c=a.bits,a.mode===Ha&&(a.back=-1);break}for(a.back=0;S=a.lencode[u&(1<<a.lenbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if(g&&!(240&g)){for(v=y,_=g,w=b;S=a.lencode[w+((u&(1<<v+_)-1)>>v)],y=S>>>24,g=S>>>16&255,b=65535&S,!(v+y<=c);){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}u>>>=v,c-=v,a.back+=v;}if(u>>>=y,c-=y,a.back+=y,a.length=b,0===g){a.mode=16205;break}if(32&g){a.back=-1,a.mode=Ha;break}if(64&g){e.msg="invalid literal/length code",a.mode=Xa;break}a.extra=15&g,a.mode=16201;case 16201:if(a.extra){for(M=a.extra;c<M;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}a.length+=u&(1<<a.extra)-1,u>>>=a.extra,c-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;S=a.distcode[u&(1<<a.distbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if(!(240&g)){for(v=y,_=g,w=b;S=a.distcode[w+((u&(1<<v+_)-1)>>v)],y=S>>>24,g=S>>>16&255,b=65535&S,!(v+y<=c);){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}u>>>=v,c-=v,a.back+=v;}if(u>>>=y,c-=y,a.back+=y,64&g){e.msg="invalid distance code",a.mode=Xa;break}a.offset=b,a.extra=15&g,a.mode=16203;case 16203:if(a.extra){for(M=a.extra;c<M;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}a.offset+=u&(1<<a.extra)-1,u>>>=a.extra,c-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){e.msg="invalid distance too far back",a.mode=Xa;break}a.mode=16204;case 16204:if(0===l)break e;if(h=p-l,a.offset>h){if(h=a.offset-h,h>a.whave&&a.sane){e.msg="invalid distance too far back",a.mode=Xa;break}h>a.wnext?(h-=a.wnext,f=a.wsize-h):f=a.wnext-h,h>a.length&&(h=a.length),m=a.window;}else m=n,f=s-a.offset,h=a.length;h>l&&(h=l),l-=h,a.length-=h;do{n[s++]=m[f++];}while(--h);0===a.length&&(a.mode=Ja);break;case 16205:if(0===l)break e;n[s++]=a.length,l--,a.mode=Ja;break;case Ka:if(a.wrap){for(;c<32;){if(0===o)break e;o--,u|=i[r++]<<c,c+=8;}if(p-=l,e.total_out+=p,a.total+=p,4&a.wrap&&p&&(e.adler=a.check=a.flags?et$2(a.check,n,p,s-p):Xe(a.check,n,p,s-p)),p=l,4&a.wrap&&(a.flags?u:Qa(u))!==a.check){e.msg="incorrect data check",a.mode=Xa;break}u=0,c=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;c<32;){if(0===o)break e;o--,u+=i[r++]<<c,c+=8;}if(4&a.wrap&&u!==(4294967295&a.total)){e.msg="incorrect length check",a.mode=Xa;break}u=0,c=0;}a.mode=16208;case 16208:k=Pa;break e;case Xa:k=$a;break e;case 16210:return ja;default:return Oa}return e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,(a.wsize||p!==e.avail_out&&a.mode<Xa&&(a.mode<Ka||t!==Ea))&&ci$1(e,e.output,e.next_out,p-e.avail_out),d-=e.avail_in,p-=e.avail_out,e.total_in+=d,e.total_out+=p,a.total+=p,4&a.wrap&&p&&(e.adler=a.check=a.flags?et$2(a.check,n,p,e.next_out-p):Xe(a.check,n,p,e.next_out-p)),e.data_type=a.bits+(a.last?64:0)+(a.mode===Ha?128:0)+(a.mode===Za||a.mode===qa?256:0),(0===d&&0===p||t===Ea)&&k===La&&(k=Ua),k},pi={inflateReset:ii,inflateReset2:ni,inflateResetKeep:ai,inflateInit:e=>ri$1(e,15),inflateInit2:ri$1,inflate:di,inflateEnd:e=>{if(ti(e))return Oa;let t=e.state;return t.window&&(t.window=null),e.state=null,La},inflateGetHeader:(e,t)=>{if(ti(e))return Oa;const a=e.state;return 2&a.wrap?(a.head=t,t.done=false,La):Oa},inflateSetDictionary:(e,t)=>{const a=t.length;let i,n,r;return ti(e)?Oa:(i=e.state,0!==i.wrap&&i.mode!==Ya?Oa:i.mode===Ya&&(n=1,n=Xe(n,t,a,0),n!==i.check)?$a:(r=ci$1(e,t,a,a),r?(i.mode=16210,ja):(i.havedict=1,La)))},inflateInfo:"pako inflate (from Nodeca project)"};var hi=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=false;};const fi=Object.prototype.toString,{Z_NO_FLUSH:mi,Z_FINISH:yi$1,Z_OK:gi,Z_STREAM_END:bi,Z_NEED_DICT:vi,Z_STREAM_ERROR:_i$1,Z_DATA_ERROR:wi,Z_MEM_ERROR:Ai}=at;function ki(e){this.options=aa({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=false,this.chunks=[],this.strm=new ua,this.strm.avail_out=0;let a=pi.inflateInit2(this.strm,t.windowBits);if(a!==gi)throw new Error(tt[a]);if(this.header=new hi,pi.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=sa(t.dictionary):"[object ArrayBuffer]"===fi.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(a=pi.inflateSetDictionary(this.strm,t.dictionary),a!==gi)))throw new Error(tt[a])}function Si$1(e,t){const a=new ki(t);if(a.push(e),a.err)throw a.msg||tt[a.err];return a.result}ki.prototype.push=function(e,t){const a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let r,s,o;if(this.ended)return false;for(s=t===~~t?t:true===t?yi$1:mi,"[object ArrayBuffer]"===fi.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),r=pi.inflate(a,s),r===vi&&n&&(r=pi.inflateSetDictionary(a,n),r===gi?r=pi.inflate(a,s):r===wi&&(r=vi));a.avail_in>0&&r===bi&&a.state.wrap>0&&0!==e[a.next_in];)pi.inflateReset(a),r=pi.inflate(a,s);switch(r){case _i$1:case wi:case vi:case Ai:return this.onEnd(r),this.ended=true,false}if(o=a.avail_out,a.next_out&&(0===a.avail_out||r===bi))if("string"===this.options.to){let e=la(a.output,a.next_out),t=a.next_out-e,n=oa(a.output,e);a.next_out=t,a.avail_out=i-t,t&&a.output.set(a.output.subarray(e,e+t),0),this.onData(n);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(r!==gi||0!==o){if(r===bi)return r=pi.inflateEnd(this.strm),this.onEnd(r),this.ended=true,true;if(0===a.avail_in)break}}return true},ki.prototype.onData=function(e){this.chunks.push(e);},ki.prototype.onEnd=function(e){e===gi&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ia(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg;};var Ni=function(e,t){return (t=t||{}).raw=true,Si$1(e,t)},Ti={Inflate:ki,inflate:Si$1,inflateRaw:Ni,ungzip:Si$1};const{Deflate:Mi$1,deflate:xi,deflateRaw:Vi,gzip:Ci$1}=Sa,{Inflate:Ii,inflate:Fi,inflateRaw:Ei,ungzip:Di}=Ti;var Ri={Deflate:Mi$1,deflate:xi,deflateRaw:Vi,gzip:Ci$1,Inflate:Ii,inflate:Fi,inflateRaw:Ei,ungzip:Di,constants:at},Li="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Pi=[],Bi=[],Oi$1="undefined"!=typeof Uint8Array?Uint8Array:Array,$i=false;function ji(){$i=true;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)Pi[t]=e[t],Bi[e.charCodeAt(t)]=t;Bi["-".charCodeAt(0)]=62,Bi["_".charCodeAt(0)]=63;}function Ui$1(e,t,a){for(var i,n,r=[],s=t;s<a;s+=3)i=(e[s]<<16)+(e[s+1]<<8)+e[s+2],r.push(Pi[(n=i)>>18&63]+Pi[n>>12&63]+Pi[n>>6&63]+Pi[63&n]);return r.join("")}function zi(e){var t;$i||ji();for(var a=e.length,i=a%3,n="",r=[],s=16383,o=0,l=a-i;o<l;o+=s)r.push(Ui$1(e,o,o+s>l?l:o+s));return 1===i?(t=e[a-1],n+=Pi[t>>2],n+=Pi[t<<4&63],n+="=="):2===i&&(t=(e[a-2]<<8)+e[a-1],n+=Pi[t>>10],n+=Pi[t>>4&63],n+=Pi[t<<2&63],n+="="),r.push(n),r.join("")}function Wi(e,t,a,i,n){var r,s,o=8*n-i-1,l=(1<<o)-1,u=l>>1,c=-7,d=a?n-1:0,p=a?-1:1,h=e[t+d];for(d+=p,r=h&(1<<-c)-1,h>>=-c,c+=o;c>0;r=256*r+e[t+d],d+=p,c-=8);for(s=r&(1<<-c)-1,r>>=-c,c+=i;c>0;s=256*s+e[t+d],d+=p,c-=8);if(0===r)r=1-u;else {if(r===l)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,i),r-=u;}return (h?-1:1)*s*Math.pow(2,r-i)}function Yi(e,t,a,i,n,r){var s,o,l,u=8*r-n-1,c=(1<<u)-1,d=c>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:r-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=c?(o=0,s=c):s+d>=1?(o=(t*l-1)*Math.pow(2,n),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;e[a+h]=255&o,h+=f,o/=256,n-=8);for(s=s<<n|o,u+=n;u>0;e[a+h]=255&s,h+=f,s/=256,u-=8);e[a+h-f]|=128*m;}var Hi={}.toString,Gi=Array.isArray||function(e){return "[object Array]"==Hi.call(e)};function qi(){return Ji.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Zi(e,t){if(qi()<t)throw new RangeError("Invalid typed array length");return Ji.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Ji.prototype:(null===e&&(e=new Ji(t)),e.length=t),e}function Ji(e,t,a){if(!(Ji.TYPED_ARRAY_SUPPORT||this instanceof Ji))return new Ji(e,t,a);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Qi(this,e)}return Ki(this,e,t,a)}function Ki(e,t,a,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return "undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,a,i){if(t.byteLength,a<0||t.byteLength<a)throw new RangeError("'offset' is out of bounds");if(t.byteLength<a+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===a&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,a):new Uint8Array(t,a,i);Ji.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Ji.prototype:e=en$1(e,t);return e}(e,t,a,i):"string"==typeof t?function(e,t,a){"string"==typeof a&&""!==a||(a="utf8");if(!Ji.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');var i=0|nn$1(t,a);e=Zi(e,i);var n=e.write(t,a);n!==i&&(e=e.slice(0,n));return e}(e,t,a):function(e,t){if(an$1(t)){var a=0|tn(t.length);return 0===(e=Zi(e,a)).length||t.copy(e,0,0,a),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return "number"!=typeof t.length||(i=t.length)!=i?Zi(e,0):en$1(e,t);if("Buffer"===t.type&&Gi(t.data))return en$1(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Xi(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Qi(e,t){if(Xi(t),e=Zi(e,t<0?0:0|tn(t)),!Ji.TYPED_ARRAY_SUPPORT)for(var a=0;a<t;++a)e[a]=0;return e}function en$1(e,t){var a=t.length<0?0:0|tn(t.length);e=Zi(e,a);for(var i=0;i<a;i+=1)e[i]=255&t[i];return e}function tn(e){if(e>=qi())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+qi().toString(16)+" bytes");return 0|e}function an$1(e){return !(null==e||!e._isBuffer)}function nn$1(e,t){if(an$1(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var a=e.length;if(0===a)return 0;for(var i=false;;)switch(t){case "ascii":case "latin1":case "binary":return a;case "utf8":case "utf-8":case void 0:return In(e).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*a;case "hex":return a>>>1;case "base64":return Fn$2(e).length;default:if(i)return In(e).length;t=(""+t).toLowerCase(),i=true;}}function rn$1(e,t,a){var i=false;if((void 0===t||t<0)&&(t=0),t>this.length)return "";if((void 0===a||a>this.length)&&(a=this.length),a<=0)return "";if((a>>>=0)<=(t>>>=0))return "";for(e||(e="utf8");;)switch(e){case "hex":return _n(this,t,a);case "utf8":case "utf-8":return yn$1(this,t,a);case "ascii":return bn$1(this,t,a);case "latin1":case "binary":return vn(this,t,a);case "base64":return mn$1(this,t,a);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return wn$1(this,t,a);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=true;}}function sn$1(e,t,a){var i=e[t];e[t]=e[a],e[a]=i;}function on$1(e,t,a,i,n){if(0===e.length)return -1;if("string"==typeof a?(i=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,isNaN(a)&&(a=n?0:e.length-1),a<0&&(a=e.length+a),a>=e.length){if(n)return -1;a=e.length-1;}else if(a<0){if(!n)return -1;a=0;}if("string"==typeof t&&(t=Ji.from(t,i)),an$1(t))return 0===t.length?-1:ln(e,t,a,i,n);if("number"==typeof t)return t&=255,Ji.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,a):Uint8Array.prototype.lastIndexOf.call(e,t,a):ln(e,[t],a,i,n);throw new TypeError("val must be string, number or Buffer")}function ln(e,t,a,i,n){var r,s=1,o=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return -1;s=2,o/=2,l/=2,a/=2;}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var c=-1;for(r=a;r<o;r++)if(u(e,r)===u(t,-1===c?0:r-c)){if(-1===c&&(c=r),r-c+1===l)return c*s}else -1!==c&&(r-=r-c),c=-1;}else for(a+l>o&&(a=o-l),r=a;r>=0;r--){for(var d=true,p=0;p<l;p++)if(u(e,r+p)!==u(t,p)){d=false;break}if(d)return r}return -1}function un(e,t,a,i){a=Number(a)||0;var n=e.length-a;i?(i=Number(i))>n&&(i=n):i=n;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");i>r/2&&(i=r/2);for(var s=0;s<i;++s){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))return s;e[a+s]=o;}return s}function cn$1(e,t,a,i){return En(In(t,e.length-a),e,a,i)}function dn$1(e,t,a,i){return En(function(e){for(var t=[],a=0;a<e.length;++a)t.push(255&e.charCodeAt(a));return t}(t),e,a,i)}function pn$1(e,t,a,i){return dn$1(e,t,a,i)}function hn(e,t,a,i){return En(Fn$2(t),e,a,i)}function fn(e,t,a,i){return En(function(e,t){for(var a,i,n,r=[],s=0;s<e.length&&!((t-=2)<0);++s)i=(a=e.charCodeAt(s))>>8,n=a%256,r.push(n),r.push(i);return r}(t,e.length-a),e,a,i)}function mn$1(e,t,a){return 0===t&&a===e.length?zi(e):zi(e.slice(t,a))}function yn$1(e,t,a){a=Math.min(e.length,a);for(var i=[],n=t;n<a;){var r,s,o,l,u=e[n],c=null,d=u>239?4:u>223?3:u>191?2:1;if(n+d<=a)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(r=e[n+1]))&&(l=(31&u)<<6|63&r)>127&&(c=l);break;case 3:r=e[n+1],s=e[n+2],128==(192&r)&&128==(192&s)&&(l=(15&u)<<12|(63&r)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:r=e[n+1],s=e[n+2],o=e[n+3],128==(192&r)&&128==(192&s)&&128==(192&o)&&(l=(15&u)<<18|(63&r)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(c=l);}null===c?(c=65533,d=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=d;}return function(e){var t=e.length;if(t<=gn)return String.fromCharCode.apply(String,e);var a="",i=0;for(;i<t;)a+=String.fromCharCode.apply(String,e.slice(i,i+=gn));return a}(i)}Ji.TYPED_ARRAY_SUPPORT=void 0===Li.TYPED_ARRAY_SUPPORT||Li.TYPED_ARRAY_SUPPORT,qi(),Ji.poolSize=8192,Ji._augment=function(e){return e.__proto__=Ji.prototype,e},Ji.from=function(e,t,a){return Ki(null,e,t,a)},Ji.TYPED_ARRAY_SUPPORT&&(Ji.prototype.__proto__=Uint8Array.prototype,Ji.__proto__=Uint8Array),Ji.alloc=function(e,t,a){return function(e,t,a,i){return Xi(t),t<=0?Zi(e,t):void 0!==a?"string"==typeof i?Zi(e,t).fill(a,i):Zi(e,t).fill(a):Zi(e,t)}(null,e,t,a)},Ji.allocUnsafe=function(e){return Qi(null,e)},Ji.allocUnsafeSlow=function(e){return Qi(null,e)},Ji.isBuffer=function(e){return null!=e&&(!!e._isBuffer||Dn$1(e)||function(e){return "function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Dn$1(e.slice(0,0))}(e))},Ji.compare=function(e,t){if(!an$1(e)||!an$1(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var a=e.length,i=t.length,n=0,r=Math.min(a,i);n<r;++n)if(e[n]!==t[n]){a=e[n],i=t[n];break}return a<i?-1:i<a?1:0},Ji.isEncoding=function(e){switch(String(e).toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "latin1":case "binary":case "base64":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return true;default:return false}},Ji.concat=function(e,t){if(!Gi(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Ji.alloc(0);var a;if(void 0===t)for(t=0,a=0;a<e.length;++a)t+=e[a].length;var i=Ji.allocUnsafe(t),n=0;for(a=0;a<e.length;++a){var r=e[a];if(!an$1(r))throw new TypeError('"list" argument must be an Array of Buffers');r.copy(i,n),n+=r.length;}return i},Ji.byteLength=nn$1,Ji.prototype._isBuffer=true,Ji.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)sn$1(this,t,t+1);return this},Ji.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)sn$1(this,t,t+3),sn$1(this,t+1,t+2);return this},Ji.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)sn$1(this,t,t+7),sn$1(this,t+1,t+6),sn$1(this,t+2,t+5),sn$1(this,t+3,t+4);return this},Ji.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?yn$1(this,0,e):rn$1.apply(this,arguments)},Ji.prototype.equals=function(e){if(!an$1(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Ji.compare(this,e)},Ji.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Ji.prototype.compare=function(e,t,a,i,n){if(!an$1(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===a&&(a=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||a>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=a)return 0;if(i>=n)return -1;if(t>=a)return 1;if(this===e)return 0;for(var r=(n>>>=0)-(i>>>=0),s=(a>>>=0)-(t>>>=0),o=Math.min(r,s),l=this.slice(i,n),u=e.slice(t,a),c=0;c<o;++c)if(l[c]!==u[c]){r=l[c],s=u[c];break}return r<s?-1:s<r?1:0},Ji.prototype.includes=function(e,t,a){return -1!==this.indexOf(e,t,a)},Ji.prototype.indexOf=function(e,t,a){return on$1(this,e,t,a,true)},Ji.prototype.lastIndexOf=function(e,t,a){return on$1(this,e,t,a,false)},Ji.prototype.write=function(e,t,a,i){if(void 0===t)i="utf8",a=this.length,t=0;else if(void 0===a&&"string"==typeof t)i=t,a=this.length,t=0;else {if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(a)?(a|=0,void 0===i&&(i="utf8")):(i=a,a=void 0);}var n=this.length-t;if((void 0===a||a>n)&&(a=n),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var r=false;;)switch(i){case "hex":return un(this,e,t,a);case "utf8":case "utf-8":return cn$1(this,e,t,a);case "ascii":return dn$1(this,e,t,a);case "latin1":case "binary":return pn$1(this,e,t,a);case "base64":return hn(this,e,t,a);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return fn(this,e,t,a);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),r=true;}},Ji.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var gn=4096;function bn$1(e,t,a){var i="";a=Math.min(e.length,a);for(var n=t;n<a;++n)i+=String.fromCharCode(127&e[n]);return i}function vn(e,t,a){var i="";a=Math.min(e.length,a);for(var n=t;n<a;++n)i+=String.fromCharCode(e[n]);return i}function _n(e,t,a){var i=e.length;(!t||t<0)&&(t=0),(!a||a<0||a>i)&&(a=i);for(var n="",r=t;r<a;++r)n+=Cn$1(e[r]);return n}function wn$1(e,t,a){for(var i=e.slice(t,a),n="",r=0;r<i.length;r+=2)n+=String.fromCharCode(i[r]+256*i[r+1]);return n}function An(e,t,a){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>a)throw new RangeError("Trying to access beyond buffer length")}function kn(e,t,a,i,n,r){if(!an$1(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<r)throw new RangeError('"value" argument is out of bounds');if(a+i>e.length)throw new RangeError("Index out of range")}function Sn(e,t,a,i){t<0&&(t=65535+t+1);for(var n=0,r=Math.min(e.length-a,2);n<r;++n)e[a+n]=(t&255<<8*(i?n:1-n))>>>8*(i?n:1-n);}function Nn(e,t,a,i){t<0&&(t=4294967295+t+1);for(var n=0,r=Math.min(e.length-a,4);n<r;++n)e[a+n]=t>>>8*(i?n:3-n)&255;}function Tn(e,t,a,i,n,r){if(a+i>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function Mn(e,t,a,i,n){return n||Tn(e,0,a,4),Yi(e,t,a,i,23,4),a+4}function xn$1(e,t,a,i,n){return n||Tn(e,0,a,8),Yi(e,t,a,i,52,8),a+8}Ji.prototype.slice=function(e,t){var a,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),Ji.TYPED_ARRAY_SUPPORT)(a=this.subarray(e,t)).__proto__=Ji.prototype;else {var n=t-e;a=new Ji(n,void 0);for(var r=0;r<n;++r)a[r]=this[r+e];}return a},Ji.prototype.readUIntLE=function(e,t,a){e|=0,t|=0,a||An(e,t,this.length);for(var i=this[e],n=1,r=0;++r<t&&(n*=256);)i+=this[e+r]*n;return i},Ji.prototype.readUIntBE=function(e,t,a){e|=0,t|=0,a||An(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},Ji.prototype.readUInt8=function(e,t){return t||An(e,1,this.length),this[e]},Ji.prototype.readUInt16LE=function(e,t){return t||An(e,2,this.length),this[e]|this[e+1]<<8},Ji.prototype.readUInt16BE=function(e,t){return t||An(e,2,this.length),this[e]<<8|this[e+1]},Ji.prototype.readUInt32LE=function(e,t){return t||An(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Ji.prototype.readUInt32BE=function(e,t){return t||An(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Ji.prototype.readIntLE=function(e,t,a){e|=0,t|=0,a||An(e,t,this.length);for(var i=this[e],n=1,r=0;++r<t&&(n*=256);)i+=this[e+r]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},Ji.prototype.readIntBE=function(e,t,a){e|=0,t|=0,a||An(e,t,this.length);for(var i=t,n=1,r=this[e+--i];i>0&&(n*=256);)r+=this[e+--i]*n;return r>=(n*=128)&&(r-=Math.pow(2,8*t)),r},Ji.prototype.readInt8=function(e,t){return t||An(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Ji.prototype.readInt16LE=function(e,t){t||An(e,2,this.length);var a=this[e]|this[e+1]<<8;return 32768&a?4294901760|a:a},Ji.prototype.readInt16BE=function(e,t){t||An(e,2,this.length);var a=this[e+1]|this[e]<<8;return 32768&a?4294901760|a:a},Ji.prototype.readInt32LE=function(e,t){return t||An(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Ji.prototype.readInt32BE=function(e,t){return t||An(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Ji.prototype.readFloatLE=function(e,t){return t||An(e,4,this.length),Wi(this,e,true,23,4)},Ji.prototype.readFloatBE=function(e,t){return t||An(e,4,this.length),Wi(this,e,false,23,4)},Ji.prototype.readDoubleLE=function(e,t){return t||An(e,8,this.length),Wi(this,e,true,52,8)},Ji.prototype.readDoubleBE=function(e,t){return t||An(e,8,this.length),Wi(this,e,false,52,8)},Ji.prototype.writeUIntLE=function(e,t,a,i){(e=+e,t|=0,a|=0,i)||kn(this,e,t,a,Math.pow(2,8*a)-1,0);var n=1,r=0;for(this[t]=255&e;++r<a&&(n*=256);)this[t+r]=e/n&255;return t+a},Ji.prototype.writeUIntBE=function(e,t,a,i){(e=+e,t|=0,a|=0,i)||kn(this,e,t,a,Math.pow(2,8*a)-1,0);var n=a-1,r=1;for(this[t+n]=255&e;--n>=0&&(r*=256);)this[t+n]=e/r&255;return t+a},Ji.prototype.writeUInt8=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,1,255,0),Ji.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Ji.prototype.writeUInt16LE=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,2,65535,0),Ji.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Sn(this,e,t,true),t+2},Ji.prototype.writeUInt16BE=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,2,65535,0),Ji.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Sn(this,e,t,false),t+2},Ji.prototype.writeUInt32LE=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,4,4294967295,0),Ji.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Nn(this,e,t,true),t+4},Ji.prototype.writeUInt32BE=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,4,4294967295,0),Ji.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Nn(this,e,t,false),t+4},Ji.prototype.writeIntLE=function(e,t,a,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*a-1);kn(this,e,t,a,n-1,-n);}var r=0,s=1,o=0;for(this[t]=255&e;++r<a&&(s*=256);)e<0&&0===o&&0!==this[t+r-1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+a},Ji.prototype.writeIntBE=function(e,t,a,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*a-1);kn(this,e,t,a,n-1,-n);}var r=a-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+a},Ji.prototype.writeInt8=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,1,127,-128),Ji.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Ji.prototype.writeInt16LE=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,2,32767,-32768),Ji.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Sn(this,e,t,true),t+2},Ji.prototype.writeInt16BE=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,2,32767,-32768),Ji.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Sn(this,e,t,false),t+2},Ji.prototype.writeInt32LE=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,4,2147483647,-2147483648),Ji.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Nn(this,e,t,true),t+4},Ji.prototype.writeInt32BE=function(e,t,a){return e=+e,t|=0,a||kn(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Ji.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Nn(this,e,t,false),t+4},Ji.prototype.writeFloatLE=function(e,t,a){return Mn(this,e,t,true,a)},Ji.prototype.writeFloatBE=function(e,t,a){return Mn(this,e,t,false,a)},Ji.prototype.writeDoubleLE=function(e,t,a){return xn$1(this,e,t,true,a)},Ji.prototype.writeDoubleBE=function(e,t,a){return xn$1(this,e,t,false,a)},Ji.prototype.copy=function(e,t,a,i){if(a||(a=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<a&&(i=a),i===a)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-a&&(i=e.length-t+a);var n,r=i-a;if(this===e&&a<t&&t<i)for(n=r-1;n>=0;--n)e[n+t]=this[n+a];else if(r<1e3||!Ji.TYPED_ARRAY_SUPPORT)for(n=0;n<r;++n)e[n+t]=this[n+a];else Uint8Array.prototype.set.call(e,this.subarray(a,a+r),t);return r},Ji.prototype.fill=function(e,t,a,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,a=this.length):"string"==typeof a&&(i=a,a=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n);}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!Ji.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else "number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<a)throw new RangeError("Out of range index");if(a<=t)return this;var r;if(t>>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(r=t;r<a;++r)this[r]=e;else {var s=an$1(e)?e:In(new Ji(e,i).toString()),o=s.length;for(r=0;r<a-t;++r)this[r+t]=s[r%o];}return this};var Vn$1=/[^+\/0-9A-Za-z-_]/g;function Cn$1(e){return e<16?"0"+e.toString(16):e.toString(16)}function In(e,t){var a;t=t||1/0;for(var i=e.length,n=null,r=[],s=0;s<i;++s){if((a=e.charCodeAt(s))>55295&&a<57344){if(!n){if(a>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&r.push(239,191,189);continue}n=a;continue}if(a<56320){(t-=3)>-1&&r.push(239,191,189),n=a;continue}a=65536+(n-55296<<10|a-56320);}else n&&(t-=3)>-1&&r.push(239,191,189);if(n=null,a<128){if((t-=1)<0)break;r.push(a);}else if(a<2048){if((t-=2)<0)break;r.push(a>>6|192,63&a|128);}else if(a<65536){if((t-=3)<0)break;r.push(a>>12|224,a>>6&63|128,63&a|128);}else {if(!(a<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128);}}return r}function Fn$2(e){return function(e){var t,a,i,n,r,s;$i||ji();var o=e.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");r="="===e[o-2]?2:"="===e[o-1]?1:0,s=new Oi$1(3*o/4-r),i=r>0?o-4:o;var l=0;for(t=0,a=0;t<i;t+=4,a+=3)n=Bi[e.charCodeAt(t)]<<18|Bi[e.charCodeAt(t+1)]<<12|Bi[e.charCodeAt(t+2)]<<6|Bi[e.charCodeAt(t+3)],s[l++]=n>>16&255,s[l++]=n>>8&255,s[l++]=255&n;return 2===r?(n=Bi[e.charCodeAt(t)]<<2|Bi[e.charCodeAt(t+1)]>>4,s[l++]=255&n):1===r&&(n=Bi[e.charCodeAt(t)]<<10|Bi[e.charCodeAt(t+1)]<<4|Bi[e.charCodeAt(t+2)]>>2,s[l++]=n>>8&255,s[l++]=255&n),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Vn$1,"")).length<2)return "";for(;e.length%4!=0;)e+="=";return e}(e))}function En(e,t,a,i){for(var n=0;n<i&&!(n+a>=t.length||n>=e.length);++n)t[n+a]=e[n];return n}function Dn$1(e){return !!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}const Rn={files:{},items:{},folders:{}};function Ln(e){return Rn.files[e]}function Pn(){return Rn.folders}function Bn(e){return Rn.folders[e]}function On(e,t){for(const a of Object.values(Rn.folders))if(a.name===e&&a.parent===t)return a}function $n(e,t){for(const a of Object.values(Rn.items))if(a.name===e&&a.folder._id===t)return a}function jn(){return Rn.items}function Un$1(e){return Rn.items[e]}function zn(e,t){Rn.items[e]=t.rootItem;for(const[e,a]of Object.entries(t.metadata)){if(t.files[e]&&(Rn.files[e]={blob:new Blob([new Uint8Array(t.files[e])],{type:a.mimeType}),hash:a.hash,itemName:a.name,itemType:a.type,mimeType:a.mimeType}),a.attachments)for(const i of a.attachments){const a=Yn(e,i.name,i.queryParam,i.index);Rn.files[a]={blob:new Blob([new Uint8Array(t.files[a])],{type:i.mimeType}),hash:i.hash,itemName:i.name,itemType:i.type,mimeType:i.mimeType};}Rn.items[e]=a;}for(const a of Object.values(t.folders))a._id=e+":"+a._id,a.parent=e+":"+a.parent,Rn.folders[a._id]=a;}async function Wn(e,t){const a=Ji.from(await e.arrayBuffer());let i=0;i+=8;const n=a.readInt32LE(8);i+=4;const r=new TextDecoder,s=a.subarray(i,i+n);i+=n;const o=JSON.parse(r.decode(s));o.root=t+"/"+o.root;let l=0;const u=Ri.ungzip(a.subarray(i)),c=Ji.from(u),d=c.subarray(l,l+o.metadataSize);l+=o.metadataSize;const p=JSON.parse(r.decode(d)),h={};Object.entries(p).forEach((([e,a])=>{const i=t+"/"+e;a._id=i,h[i]=a,a.folder._id=t+":"+a.folder._id;for(const e of a.links)e.to=t+"/"+e.to;}));const f=c.subarray(l,l+o.foldersSize);l+=o.foldersSize;const m=JSON.parse(r.decode(f)),y={};for(const[,e]of Object.entries(h))if(e.filesize&&(y[e._id]={start:l+(e.packageFileOffset||0),end:l+(e.packageFileOffset||0)+e.filesize}),e.attachments)for(const t of e.attachments)y[Yn(e._id,t.name,t.queryParam,t.index)]={start:l+(t.packageFileOffset||0),end:l+(t.packageFileOffset||0)+t.filesize};const g={};for(const[e,t]of Object.entries(y)){const a=c.subarray(t.start,t.end);g[e]=a;}const b=h[o.root],v=[],_=e=>{v.push(e._id);for(const t of e.links)t.item=structuredClone(h[t.to]),_(t.item);};return _(b),{rootItem:b,metadata:h,folders:m,files:g}}function Yn(e,t,a,i){return `${e}_${t}`+(null!=a?`_${a}`:"")+(null!=i?`_${i}`:"")}function Hn(e,t,a,i){return Array.isArray(e.attachments)?e.attachments.filter((e=>e.name===t&&(void 0===i||e.index===i))).reduce(((e,t)=>Math.abs(t.queryParam-(a??0))<Math.abs(e.queryParam-(a??0))?t:e),{queryParam:1/0}):null}function Gn(e,t,a,i){const n=Un$1(e);if(n){const r=Hn(n,t,a,i);if(!r)return null;return Ln(Yn(e,r.name,r.queryParam,r.index))}}var qn=Object.freeze({__proto__:null,addPackageToCache:zn,createAttachmentID:Yn,findFolder:On,findItem:$n,getAttachmentFromPackageCache:Gn,getFileFromCache:Ln,getFolder:Bn,getFolders:Pn,getItemFromCache:Un$1,getItems:jn,parsePackage:Wn,queryAttachments:Hn});class Zn{id=p.createGUID();items=[]}class Jn{itemRepo;undoEvents=[];redoEvents=[];maxUndoCount=100;enabled=true;snapshots=new Map;_undoRedoPromise=Promise.resolve();constructor(e,t=100){this.itemRepo=e,this.maxUndoCount=t,y$1.instance.setUndoManager(this),l$1.$on("undoManager:undo",(e=>this.undo(e))),l$1.$on("undoManager:redo",(e=>this.redo(e)));}clear(){this.undoEvents=[],this.redoEvents=[],this.snapshots.clear(),l$1.$emit("undoManager:undoStepsChanged",0),l$1.$emit("undoManager:redoStepsChanged",0);}createSnapshot(){const e=new Zn;for(const t of this.itemRepo.itemInstances.values())for(const a of t.values())e.items.push({_id:a._id,instanceId:a.instanceId,data:this._grabSnapshot(a)});return this.snapshots.set(e.id,e),e.id}rollbackFromSnapshot(e){const t=this.snapshots.get(e);if(!t)throw new k("Snapshot not found");for(const e of t.items){const t=this.itemRepo.itemInstances.get(e._id);if(t){const a=t.get(e.instanceId);a?this._rollbackFromSnapshot(a,e.data):console.error(`[SNAPSHOT] - Trying to rollback snapshot for item but did not find the instance: ${e._id} -> ${e.instanceId}`);}else console.error(`[SNAPSHOT] - Trying to rollback snapshot for item but did not find the item map: ${e._id}`);}this.snapshots.delete(e);}_grabSnapshot(e){const t=[];for(const a of e.fieldInstances)try{t.push(a.createSnapshot());}catch(e){const t=`[SNAPSHOT] - Could not grab snapshot of field ${a.name}`;throw console.error(t,e),new Error(e.toString())}const a=[];for(const t of e.customFieldInstances)try{a.push(t.createSnapshot());}catch(e){const a=`[SNAPSHOT] - Could not grab snapshot of custom field ${t.name}`;throw console.error(a,e),new Error(e.toString())}return new W(e._id,"item",{fieldInstances:t,customFieldInstances:a})}_getFieldInstance(e,t){for(const a of e.fieldInstances)if(a.getId()===t)return a;return null}_getCustomFieldInstance(e,t){for(const a of e.customFieldInstances)if(a.getId()===t)return a;return null}_rollbackFromSnapshot(e,t){for(const a of t.data.fieldInstances){const t=this._getFieldInstance(e,a.id);t?t.rollbackFromSnapshot(a):console.warn("[SNAPSHOT] - Could not find field instance in snapshot: "+a.id);}for(const a of t.data.customFieldInstances){const t=this._getCustomFieldInstance(e,a.id);t?t.rollbackFromSnapshot(a):console.warn("[SNAPSHOT] - Could not find custom field instance in snapshot: "+a.id);}}getEnabled(){return this.enabled}setEnabled(e){this.enabled=!!e;}ignore(e){const t=this.enabled;let a=false;try{t&&this.setEnabled(!1);const i=e();if(i&&i.then)return a=!0,i.finally((()=>{t&&this.setEnabled(!0);}))}finally{t&&!a&&this.setEnabled(true);}}undo(e){return this._undoRedoPromise=this._undoRedoPromise.then((()=>this._performUndo(e))),this._undoRedoPromise}redo(e){return this._undoRedoPromise=this._undoRedoPromise.then((()=>this._performRedo(e))),this._undoRedoPromise}async _performUndo(e){if(this.enabled&&this.undoEvents.length){for(e=e||1;this.undoEvents.length>0&&e>0;){const t=this.spliceLastEventBundle(this.undoEvents).reverse();for(const e of t)await e.undo(),this.redoEvents.push(e);e--;}l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()),l$1.$emit("undoManager:redoStepsChanged",this.getNumberOfRedoBundles());}}async _performRedo(e){if(this.enabled&&this.redoEvents.length){for(e=e||1;this.redoEvents.length>0&&e>0;){const t=this.spliceLastEventBundle(this.redoEvents).reverse();for(const e of t)await e.redo(),this.undoEvents.push(e);e--;}l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()),l$1.$emit("undoManager:redoStepsChanged",this.getNumberOfRedoBundles());}}getUndoSteps(){return this.undoEvents.map((function(e){return {type:e.type,itemId:e.itemId,prop:e.prop}}))}getRedoSteps(){return this.redoEvents.map((e=>({type:e.type,itemId:e.itemId,prop:e.prop})))}event(e){if(this.enabled){if(this.redoEvents=[],l$1.$emit("undoManager:redoStepsChanged",0),this.assignBundleIndexToEvent(e),0!==this.undoEvents.length){let t=false;for(let a=this.undoEvents.length-1;a>=0;a--){const i=this.undoEvents[a];if(!e.isWithinMergeDeltaOf(i,300))break;const n=i.merge(e,300);if(n){t=true,this.undoEvents.splice(a,1),this.undoEvents.push(n);break}}t||(this.undoEvents.push(e),l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()));}else this.undoEvents.push(e),l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles());if(this.getNumberOfUndoBundles()>this.maxUndoCount){this.spliceFirstEventBundle(this.undoEvents);for(const e of this.undoEvents)e.bundleIndex-=1;l$1.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles());}}}getNumberOfUndoBundles(){return 0===this.undoEvents.length?0:this.undoEvents.at(-1).bundleIndex+1}getNumberOfRedoBundles(){if(0===this.redoEvents.length)return 0;const e=this.getNumberOfUndoBundles()-1;return this.redoEvents.at(0).bundleIndex-e}spliceLastEventBundle(e){if(0===e.length)return [];const t=e.at(-1).bundleIndex;let a=e.length-1;for(let i=e.length-1;i>=0&&e[i].bundleIndex===t;i--)a=i;return e.splice(a)}spliceFirstEventBundle(e){if(0===e.length)return [];const t=e.at(0).bundleIndex;for(let a=1;a<e.length;a++)if(e[a].bundleIndex!==t)return e.splice(0,a);return e.splice(0)}assignBundleIndexToEvent(e){if(0===this.undoEvents.length)return void(e.bundleIndex=0);const t=this.undoEvents.at(-1),a=Math.abs(e.createdAt-t.createdAt);e.bundleIndex=a>300?t.bundleIndex+1:t.bundleIndex;}}class Kn{updateItemLinksAndAttributes(e,t,a){try{const i=[],n={},r={};this.getLinksAndAttributes(e,i,n,r,t,a),e.attributes=n,e.userAttributes=r,e.links=i;}catch(e){throw console.error(e),new T$1(e)}}getLinksAndAttributes(e,t,a,i,n,r){e.fieldInstances.length&&this.retrieveLinksAndAttributesFromFieldInstances(e.fieldInstances,t,a,n,r),e.userFieldInstances.length&&this.retrieveLinksAndAttributesFromFieldInstances(e.userFieldInstances,t,i,n,r),e.customFieldInstances.length&&(console.log(e.customFieldInstances),this.retrieveLinksAndAttributesFromFieldInstances(e.customFieldInstances,t,i,n,r,"_"));}retrieveLinksAndAttributesFromFieldInstances(e,t,a,i,n,r=""){for(const s of e)switch(s.type){case "Link":if(s.value&&t){if(n&&s.hidden)continue;i?t.push({usage:r+s.name,to:s.value._id,item:s.value}):t.push({usage:r+s.name,to:s.value._id});}break;case "Attribute":a&&(a[r+s.name]=s.value);break;case "List":s.blocks&&this.traverseListFieldInstances(s.blocks,t,a,r+s.name,i);break;case "Tree":if(s.blocks){const e=s.blocks[0];e.blocks&&this.traverseTreeFieldInstance(e.blocks,t,a,r+s.name,i);}break;case "NodeGraph":if(s.blocks&&this.traverseTreeFieldInstance(s.blocks,t,a,r+s.name,i),a&&Array.isArray(s.connections)){let e=0;for(const t of s.connections){a[`${r}${s.name}#connection[${e++}]`]={srcNode:t.srcNode,srcSlot:t.srcSlot,destNode:t.destNode,destSlot:t.destSlot};}}}}traverseTreeFieldInstance(e,t,a,i,n){let r=0;for(const s of e){const e=`${i}[${r}]`,o=e+"#type",l=e+"#subnodeid",u=e+"#id",c=e+"#posx",d=e+"#posy";a&&(a[e+"#usage"]="Block",a[o]=s.type,a[u]=s.id,void 0!==s.subNodeId&&(a[l]=s.subNodeId),void 0!==s.posX&&(a[c]=s.posX||0),void 0!==s.posY&&(a[d]=s.posY||0));for(const i of s.fields){const r=`${e}->${i.name}`;switch(i.type){case "Link":i.value&&t&&(n?t.push({usage:r,to:i.value._id,item:i.value}):t.push({usage:r,to:i.value._id}));break;case "List":i.blocks&&this.traverseListFieldInstances(i.blocks,t,a,r,n);break;case "Attribute":a&&(a[r]=i.value);}}s.scripts&&this.processScripts(s.scripts,t,a,e,n),s.blocks&&this.traverseTreeFieldInstance(s.blocks,t,a,e,n),r++;}}traverseListFieldInstances(e,t,a,i,n){let r=0;for(const s of e){const e=`${i}[${r}]`;for(const i of s.fields){const r=`${e}->${i.name}`;switch(i.type){case "Link":if(i.value&&t){const e={usage:r,to:"object"==typeof i.value?i.value._id:i.value,item:null};n&&"object"===i.value&&(e.item=i.value),t.push(e);}break;case "Attribute":a&&(a[r]=i.value);}}r++;}}processScripts(e,t,a,i,n){let r=0;for(const s of e){const e=`${i}#scripts[${r}]`,o=e+"#id",l=e+"#item";a&&(a[e+"#usage"]="Script",a[o]=s.id),t&&s.item.value&&(n?t.push({usage:l,to:s.item.value._id,item:s.item.value}):t.push({usage:l,to:s.item.value._id}));for(const i of s.fields){const r=`${e}->${i.name}`;switch(i.type){case "Link":i.value&&(t&&(n?t.push({usage:r,to:i.value._id,item:i.value}):t.push({usage:r,to:i.value._id})),a&&(a[r]=i.value._id));break;case "LinkArray":if(Array.isArray(i.value)&&t){const e=[];i.value.forEach(((a,i)=>{if(!a)return;const s="string"==typeof a?a:a._id;s&&(e.push(s),n?t.push({usage:`${r}[${i}]`,to:s,item:"object"==typeof a?a:void 0}):t.push({usage:`${r}[${i}]`,to:s}));})),a&&(a[r]=e);}break;default:a&&(a[r]=i.value);}}r++;}}}class Xn{apiClient;activeItem=void 0;rootItemId=void 0;loadingItems=new Map;loadedItems=new Map;itemInstances=new Map;resolvedPaths=new Map;jail;apiGateway;itemCache;undoManager=new Jn(this);itemPreparator=new de$1(this);itemChangeProcessor=new Kn;usePublicApi;constructor(e,t){this.apiClient=t,this.apiGateway=new U(t),this.itemCache=new z(this.apiGateway),this.usePublicApi=!!e,this.jail={active:false,mountedFolders:[]},l$1.$on("item:rename",(e=>this.handleRename(e)));}_logGroup(e){}_logGroupEnd(){}_log(e){}getLoadedItems(){return Array.from(this.loadedItems.values())}getItemInstances(){return this.itemInstances}findLoadedItem(e){return this.loadedItems.get(e)}_handleError(e,t){throw console.error(e),new T$1("ItemRepo: "+t)}getUndoManager(){return this.undoManager}async createFieldsForItem(e,t,a,i=false){return this.itemPreparator.createFields(e,a,t,"",false,a.attributes,i)}async createScriptsForItem(e,t=[],a,i=true){const n=[];for(const i of t){if(!i.item)continue;const t=await this.loadItem(i.item);if(!t)continue;const r=new Q$1(void 0,e,a,t);n.push(r);for(const e of i.fields){let t=e.value;e.linkto&&(t=e.linkto);const i=new J(r,e.name,t,a);r.addField(i);}}e.scripts=i?y$1.instance.proxyScriptArray(n,e,a):n;}clear(){this.rootItemId=void 0,this.activeItem=void 0,this.loadedItems.clear(),this.resolvedPaths.clear(),this.itemInstances.clear(),this.loadingItems.clear();const e=this.apiClient.getCollab();e&&e.endCollaboration();}removeBlock(e,t){t.blocks.removeObject(e),e.parent=void 0;}traverseBlockPairs(e,t,a){a(e,t);for(let i=0;i<e.blocks.length&&i<t.blocks.length;i++)this.traverseBlockPairs(e.blocks[i],t.blocks[i],a);}copyScripts(e,t,a=false,i={}){const n=new Map;this.traverseBlockPairs(e,t,((e,t)=>n.set(e.getId(),t.getId())));const r=[];return this.traverseBlockPairs(e,t,((e,t)=>{for(const s of e.scripts){const e=s.clone(n,i);a&&(e.deferInitCall=true),t.scripts.push(e),r.push(e);}})),r}updateScriptFieldReferences(e,t){const a=new Map;this.traverseBlockPairs(e,t,((e,t)=>{a.set(e.id,t.id);})),this.updateScriptFieldReferencesFromMap(a,t);}updateScriptFieldReferencesFromMap(e,t){this.traverseBlocks((t=>{for(const a of t.scripts)for(const t of a.fields)e.has(t.value)&&(t.value=e.get(t.value));}),[t]);}async createNewBlock(e,t,a,i){const n=new pe(void 0,t,e.typeName,void 0,void 0,a);i&&n.setSubNodeId(i);const r=await this.createFieldsForItem(n,e.template,a);return n.setFields(r),n.blocks=y$1.instance.proxyBlockArray(n.blocks,n,a),await this.createScriptsForItem(n,void 0,a),this.addBlockToParent(n,t,a)}addBlockToParent(e,t,a){e.parent=t;const i=y$1.instance.proxyBlock(e,a);return t.blocks.push(i),i}async createNewListEntry(e,t,a){const i=new pe(void 0,void 0,e.typeName,void 0,void 0,a),n=await this.createFieldsForItem(i,e.template,a);return i.setFields(n),i.blocks=y$1.instance.proxyListArray(i.blocks,t,a),y$1.instance.proxyBlock(i,a)}async createNewGraphNode(e,t,a,i,n){const r=new pe(void 0,void 0,e.typeName,void 0,e.displayName,n),s=await this.itemPreparator.createFields(r,n,e.template,"",true,n.attributes);return r.setFields(s),r.setInputs(e.inputs),r.setOutputs(e.outputs),r.setPosition(a,i),r.blocks=y$1.instance.proxyGraphBlockArray(r.blocks,t),this.addNodeToGraph(r,t,n),r}addNodeToGraph(e,t,a){const i=y$1.instance.proxyGraphBlock(e,a);t.blocks.push(i);}removeGraphNode(e,t){const a=[];for(const i of e.connections)i.srcNode!==t.id&&i.destNode!==t.id||a.push(i);for(const t of a)e.connections.removeObject(t);e.blocks.removeObject(t);}addGraphLink(e,t,a,i,n,r){e.connections.push(new H({srcNode:t,srcSlot:a,destNode:i,destSlot:n},r));}removeGraphLink(e,t,a,i,n){for(const r of e.connections)if(r.srcNode===t&&r.srcSlot===a&&r.destNode===i&&r.destSlot===n)return void e.connections.removeObject(r)}createNewScript(e,t=-1,a){t=t>=0?t:e.scripts.length;const i=new Q$1(void 0,e,a);return e.scripts.splice(t,0,i),i}removeScript(e,t){t.scripts.removeObject(e);}findBlock(e){for(const t of this.itemInstances.values())for(const a of t.values()){const t=a.findBlock(e);if(t)return t}return null}async loadPackage(e,t){const a=await p.downloadFile(e,((e,a,i)=>{t&&t({phase:"Loading",percent:e,bytesTotal:a,bytesLoaded:i});})),i=await a.data,n=this.apiClient.getCollab();n&&n.endCollaboration();const r=new se({_id:"root",name:"Root package",type:"Package",links:[],attributes:{},fields:[],readOnly:true,isPackaged:false}),s=await Wn(i,r._id);zn(r._id,structuredClone(s));const o=Object.values(s.metadata).reverse();for(const e of o)e._id===s.rootItem._id&&(r.packageContent=e,r.packageType=e.type);return await this._linkAndPrepareItems(o),r.packageContent=this.loadedItems.get(s.rootItem._id),this.activeItem=r,r}createPackageItemUrl(e){const t=Ln(e);return t?URL.createObjectURL(t.blob):null}revokePackageItemUrl(e){URL.revokeObjectURL(e);}async _loadPackageContentRecursively(e,t){t("Loading from cache",0);const a=await this.apiClient.itemCache.addItemToCache(e._id,void 0,e.hash,(function(e,a,i){t("Loading from cloud",.9*e,i,a);})),i=await(await fetch(a.objectUrl)).blob();t("Unpacking",90);const n=await Wn(i,e._id);zn(e._id,structuredClone(n));const r=Object.values(n.metadata).reverse();for(const t of r)t._id===n.rootItem._id&&(e.packageContent=t,e.packageType=t.type);return r}createNewItemInstance(e){const t=this.loadedItems.get(e);if(!t)return console.error(`Tried creating new instance of item, but it was not found: ${e}`),null;const a=t.clone(true);return this._addItemInstance(a),a}_addLoadedItem(e){this.loadedItems.set(e._id,e),this._addItemInstance(e);}_addItemInstance(e){let t=this.itemInstances.get(e._id);t||(t=new Map,this.itemInstances.set(e._id,t)),t.set(e.instanceId,e);}async loadItemByRelativePath(e,t,a={}){try{const i=Un$1(e);let n;if(i){const e=t.split("/"),a=e.pop();let r=Bn(i.folder._id);for(const t of e)if(r=".."===t?Bn(r.parent):On(t,r._id),!r)return;const s=$n(a,r._id);n=s?._id;}else n=await this.resolveRelativePath(t,e);return this.loadItem(n,a)}catch(e){this._handleError(e,`Unable to load item by relative path: ${t}: ${e}`);}}async _loadItemFromApi(e,t={}){let a;if(this.apiGateway.start(),t.recursive)if(this.usePublicApi)a=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e,true),a.forEach((e=>e.public=true));else try{a=await this.apiGateway.call("_loadItemFromApi","getItemAggregatedRecursive",e,{withAttachmentInfo:!0,noFields:!0});}catch{a=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e,true),a.forEach((e=>e.public=true));}else {let t;if(this.usePublicApi)t=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e),t.public=true;else try{t=await this.apiGateway.call("_loadItemFromApi","getItemAggregated",e,{noFields:!0});}catch{t=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e),t.public=true;}a=[t];}return this.apiGateway.end(),a}_relinkItems(e,t){for(const a of e){if(Array.isArray(a.links))for(const e of a.links)e.item=t.get(e.to),e.item||e.stopRecursion||console.warn(`Missing link in item '${a.name}' (${a._id}) to: ${e.to} with usage ${e.usage}`);a.packageContent&&(a.packageContent=t.get(a.packageContent._id));}}createItem(e,t){const a={_id:p.createGeneratedItemId(),name:`Generated ${e}`,type:e,attributes:t||{},links:[],fields:[],fieldInstances:[],userFieldInstances:[],isGenerated:true};return this.itemPreparator.prepare(a)}getLoadedItem(e){return this.loadedItems.get(e)}async loadItem(e,t={}){let a,i,n;if(n=this.loadedItems.get(e),n)return n;if(n=this.loadingItems.get(e),n)return n;try{const r=new Promise(((e,t)=>{a=e,i=t;}));return this.loadingItems.set(e,r),n=await this._loadItemInternal(e,t),a(n),!this.activeItem&&n&&(this.rootItemId=e,this.activeItem=n,t.withCollaboration,await l$1.$emit("itemRepo:itemLoaded",n)),n}catch(t){return this._handleError(t,`Unable to load item ${e}: ${t}`),void i(void 0)}finally{this.loadingItems.delete(e);}}async _loadItemInternal(e,t={}){const a=(e,a,i=0,n=0)=>{"function"==typeof t.progressCallback&&t.progressCallback({phase:e,percent:a,bytesTotal:i,bytesLoaded:n});};a("Fetching metadata",1);let i=await this._loadItemFromApi(e,t);if(i=i.filter((e=>!this.loadedItems.has(e._id))),0===i.length)return console.log("After loading the item, it turns out we have them all already loaded! This should not happen!"),this.loadedItems.get(e);const n=i[0]._id;for(const e of i)if("Package"===e.type){const t=await this._loadPackageContentRecursively(e,a);for(const e of t)i.push(e);}a("Preparing data",100),await this._linkAndPrepareItems(i);return this.loadedItems.get(n)}async _linkAndPrepareItems(e){const t=new Map;for(const a of e)t.set(a._id,a);const a=new Map([...this.loadedItems,...t]);this._relinkItems(e,a);const i=[],n=()=>{const e=t.values().next().value;return t.delete(e._id),this._log(`- Fetched next item ${e.name} (${e._id})`),e},r=async e=>{this._logGroup(`- Preparing item ${e.name} (${e._id})`);const t=await this.itemPreparator.prepare(e);return i.push(t),this._addLoadedItem(t),this._logGroupEnd(),t};for(this.itemPreparator.setItemFetcher((async e=>{this._logGroup(`- Requesting item ${e.name} (${e._id})`);let a=this.loadedItems.get(e._id);if(a)return this._log("- Already prepared. Returning."),this._logGroupEnd(),a;const i=t.get(e._id);return i?(t.delete(e._id),this._log("- Don't have it yet. Preparing..."),a=await r(i),this._log("- Now prepared. Returning."),this._logGroupEnd(),a):(console.error("ItemFetcher: Could not find requested item: "+e._id,t,this.loadedItems),null)}));t.size>0;){let e=n();await r(e);}return this._relinkItems(i,this.loadedItems),i}async resolveRelativePath(e,t=null){if(!(t=t||this.activeItem?._id||null))return null;const a=`${t}#${e}`;let i;return i=this.resolvedPaths.has(a)?this.resolvedPaths.get(a):this.usePublicApi?await this.apiClient.publicResolveRelativeItem(t,e):await this.apiClient.resolveRelativeItem(t,e),this.resolvedPaths.set(a,i),i}async traverseItems(e,t=void 0){if("function"!=typeof e)return;const a=this,i=new Map;await async function t(n){if(!n)return;if(i.has(n._id))return;i.set(n._id,true);const r=e(n);if(r&&r.then&&await r,Array.isArray(n.links))for(const e of n.links)if(e.item)await t(e.item);else if(e.to)try{const i=await a.loadItem(e.to);await t(i);}catch{console.warn(`Could not load additional item ${e.to} so cannot traverse it. Probably dead link!`);}}(t||this.activeItem);}async traverseBlocks(e,t){for(const a of t){const t=e(a);t&&t.then&&await t,Array.isArray(a.blocks)&&a.blocks?.length&&await this.traverseBlocks(e,a.blocks);}}async traverseFieldInstances(e,t){const a=this;t=t||this.activeItem?.fieldInstances||[];for(const i of t){const t=e(i);t&&t.then&&await t,Array.isArray(i.blocks)&&await this.traverseBlocks((async function(t){Array.isArray(t.fields)&&t.fields?.length&&await a.traverseFieldInstances(e,t.fields);}),i.blocks);}}async _updateLinkReferences(e,t,a,i){t?await this.traverseItems((async n=>{if(Array.isArray(n.fieldInstances)&&n.fieldInstances.length){await this.traverseFieldInstances((async a=>{"Link"===a.type&&a.value&&a.value._id===e&&(i&&(a.value=null),a.value=t);}),n.fieldInstances);for(const a of n.fieldInstances)Array.isArray(a.blocks)&&await this.traverseBlocks((async a=>{if(Array.isArray(a.scripts))for(const n of a.scripts)n.item?.value?._id===e&&(i&&(n.item.value=void 0),n.item.value=t);}),a.blocks);}if(n.links)for(const r of n.links)r.to===e&&(i&&(r.to=null,r.item=null),r.to=a,r.item=t);})):console.warn(`Aborting link update: Could not load item ${a}`);}async replaceLink(e,t){if(this.getLoadedItem(e)){const a=await this.loadItem(t,{recursive:true});await this._updateLinkReferences(e,a,t,false);}}async forceUpdateLink(e){const t=await this.loadItem(e,{recursive:true});await this._updateLinkReferences(e,t,e,true);}saveItem(e){return e._id&&e.isDirty?(this.itemChangeProcessor.updateItemLinksAndAttributes(e,false,true),e.version||(e.version={major:0,minor:0,revision:1}),this.apiClient.updateItem({_id:e._id,name:e.name,attributes:e.attributes,userAttributes:e.userAttributes,links:e.links,tags:e.tags,contributors:e.contributors,description:e.description,shortDescription:e.shortDescription,categories:e.categories,license:e.license,version:e.version,allowConversation:e.allowConversation,visibility:e.visibility}).then((t=>(JSON.stringify(e.version)===JSON.stringify(t.version)?console.log(`Saved item ${e.name}. New version: ${e.version.major}.${e.version.minor}.${e.version.revision}`):console.log(`Saved item ${e.name}. Version ${e.version.major}.${e.version.minor}.${e.version.revision} -> ${t.version.major}.${t.version.minor}.${t.version.revision}`),t&&t.version&&(e.version=t.version),e.isDirty=false,this.itemChangeProcessor.updateItemLinksAndAttributes(e,true,false),e))).catch((function(t){throw console.error(`Error saving item ${e.name}`,t,e),t}))):null}async save(){console.log("Saving changes in loaded items...");const e=[];for(const t of this.loadedItems.values()){const a=this.saveItem(t);a&&e.push(a);}if(0!==e.length){let t=0;for(const a of e)a.then((function(a){l$1.$emit("itemRepo:itemSaved",{item:a,progress:++t,total:e.length});}));return Promise.all(e).then((function(){console.log("Saved successfully"),l$1.$emit("itemRepo:itemsSaved");})).catch((function(e){console.error("Error saving:",e);}))}console.log("No changes detected.");}async existsUnsavedChanges(){if(!this.activeItem)return false;for(const e of this.loadedItems.values())if(e._id&&e.isDirty)return true;return false}handleRename({id:e,newName:t}){for(const a of this.itemInstances.values())for(const i of a.values())i._id===e&&(i.name=t);}isItemKnown(e){return this.loadedItems.has(e)||this.itemInstances.has(e)||this.loadingItems.has(e)}invalidateId(e){this.loadedItems.delete(e),this.itemInstances.delete(e),this.loadingItems.delete(e);}}var Qn,er={exports:{}};
4614
4614
  /*!
4615
4615
  localForage -- Offline Storage, Improved
4616
4616
  Version 1.10.0
4617
4617
  https://localforage.github.io/localForage
4618
4618
  (c) 2013-2017 Mozilla, Apache License 2.0
4619
- */var Ki=(Zi||(Zi=1,Ji.exports=function e(t,a,n){function i(s,o){if(!a[s]){if(!t[s]){if(!o&&L)return L(s);if(r)return r(s,true);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=a[s]={exports:{}};t[s][0].call(u.exports,(function(e){var a=t[s][1][e];return i(a||e)}),u,u.exports,e,t,a,n);}return a[s].exports}for(var r=L,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,a){(function(e){var a,n,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var r=0,s=new i(c),o=e.document.createTextNode("");s.observe(o,{characterData:true}),a=function(){o.data=r=++r%2;};}else if(e.setImmediate||void 0===e.MessageChannel)a="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null;},e.document.documentElement.appendChild(t);}:function(){setTimeout(c,0);};else {var l=new e.MessageChannel;l.port1.onmessage=c,a=function(){l.port2.postMessage(0);};}var u=[];function c(){var e,t;n=true;for(var a=u.length;a;){for(t=u,u=[],e=-1;++e<a;)t[e]();a=u.length;}n=false;}function d(e){1!==u.push(e)||n||a();}t.exports=d;}).call(this,void 0!==D?D:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{}],2:[function(e,t,a){var n=e(1);function i(){}var r={},s=["REJECTED"],o=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==i&&h(this,e);}function c(e,t,a){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof a&&(this.onRejected=a,this.callRejected=this.otherCallRejected);}function d(e,t,a){n((function(){var n;try{n=t(a);}catch(t){return r.reject(e,t)}n===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,n);}));}function p(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments);}}function h(e,t){var a=false;function n(t){a||(a=true,r.reject(e,t));}function i(t){a||(a=true,r.resolve(e,t));}function s(){t(i,n);}var o=f(s);"error"===o.status&&n(o.value);}function f(e,t){var a={};try{a.value=e(t),a.status="success";}catch(e){a.status="error",a.value=e;}return a}function m(e){return e instanceof this?e:r.resolve(new this(i),e)}function y(e){var t=new this(i);return r.reject(t,e)}function g(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var a=e.length,n=false;if(!a)return this.resolve([]);for(var s=new Array(a),o=0,l=-1,u=new this(i);++l<a;)c(e[l],l);return u;function c(e,i){function l(e){s[i]=e,++o!==a||n||(n=true,r.resolve(u,s));}t.resolve(e).then(l,(function(e){n||(n=true,r.reject(u,e));}));}}function b(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var a=e.length,n=false;if(!a)return this.resolve([]);for(var s=-1,o=new this(i);++s<a;)l(e[s]);return o;function l(e){t.resolve(e).then((function(e){n||(n=true,r.resolve(o,e));}),(function(e){n||(n=true,r.reject(o,e));}));}}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===o||"function"!=typeof t&&this.state===s)return this;var a=new this.constructor(i);return this.state!==l?d(a,this.state===o?e:t,this.outcome):this.queue.push(new c(a,e,t)),a},c.prototype.callFulfilled=function(e){r.resolve(this.promise,e);},c.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e);},c.prototype.callRejected=function(e){r.reject(this.promise,e);},c.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e);},r.resolve=function(e,t){var a=f(p,t);if("error"===a.status)return r.reject(e,a.value);var n=a.value;if(n)h(e,n);else {e.state=o,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t);}return e},r.reject=function(e,t){e.state=s,e.outcome=t;for(var a=-1,n=e.queue.length;++a<n;)e.queue[a].callRejected(t);return e},u.resolve=m,u.reject=y,u.all=g,u.race=b;},{1:1}],3:[function(e,t,a){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2));}).call(this,void 0!==D?D:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{2:2}],4:[function(e,t,a){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var s=r();function o(){try{if(!s||!s.open)return !1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return (!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return false}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var a=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)a.append(e[n]);return a.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var u=Promise;function c(e,t){t&&e.then((function(e){t(null,e);}),(function(e){t(e);}));}function d(e,t,a){"function"==typeof t&&e.then(t),"function"==typeof a&&e.catch(a);}function p(e){return "string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function h(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var f="local-forage-detect-blob-support",m=void 0,y={},g=Object.prototype.toString,b="readonly",v="readwrite";function w(e){for(var t=e.length,a=new ArrayBuffer(t),n=new Uint8Array(a),i=0;i<t;i++)n[i]=e.charCodeAt(i);return a}function _(e){return new u((function(t){var a=e.transaction(f,v),n=l([""]);a.objectStore(f).put(n,"key"),a.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(false);},a.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),a=navigator.userAgent.match(/Edge\//);t(a||!e||parseInt(e[1],10)>=43);};})).catch((function(){return false}))}function A(e){return "boolean"==typeof m?u.resolve(m):_(e).then((function(e){return m=e}))}function k(e){var t=y[e.name],a={};a.promise=new u((function(e,t){a.resolve=e,a.reject=t;})),t.deferredOperations.push(a),t.dbReady?t.dbReady=t.dbReady.then((function(){return a.promise})):t.dbReady=a.promise;}function S(e){var t=y[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function N(e,t){var a=y[e.name].deferredOperations.pop();if(a)return a.reject(t),a.promise}function T(e,t){return new u((function(a,n){if(y[e.name]=y[e.name]||L(),e.db){if(!t)return a(e.db);k(e),e.db.close();}var i=[e.name];t&&i.push(e.version);var r=s.open.apply(s,i);t&&(r.onupgradeneeded=function(t){var a=r.result;try{a.createObjectStore(e.storeName),t.oldVersion<=1&&a.createObjectStore(f);}catch(a){if("ConstraintError"!==a.name)throw a;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.');}}),r.onerror=function(e){e.preventDefault(),n(r.error);},r.onsuccess=function(){var t=r.result;t.onversionchange=function(e){e.target.close();},a(t),S(e);};}))}function M(e){return T(e,false)}function x(e){return T(e,true)}function C(e,t){if(!e.db)return true;var a=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||a){if(a){var r=e.db.version+1;r>e.version&&(e.version=r);}return true}return false}function V(e){return new u((function(t,a){var n=new FileReader;n.onerror=a,n.onloadend=function(a){var n=btoa(a.target.result||"");t({__local_forage_encoded_blob:true,data:n,type:e.type});},n.readAsBinaryString(e);}))}function I(e){return l([w(atob(e.data))],{type:e.type})}function E(e){return e&&e.__local_forage_encoded_blob}function F(e){var t=this,a=t._initReady().then((function(){var e=y[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return d(a,e,e),a}function D(e){k(e);for(var t=y[e.name],a=t.forages,n=0;n<a.length;n++){var i=a[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null);}return e.db=null,M(e).then((function(t){return e.db=t,C(e)?x(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<a.length;i++)a[i]._dbInfo.db=n;})).catch((function(t){throw N(e,t),t}))}function R(e,t,a,n){ void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);a(null,i);}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return u.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),x(e)})).then((function(){return D(e).then((function(){R(e,t,a,n-1);}))})).catch(a);a(i);}}function L(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function P(e){var t=this,a={db:null};if(e)for(var n in e)a[n]=e[n];var i=y[a.name];i||(i=L(),y[a.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=F);var r=[];function s(){return u.resolve()}for(var o=0;o<i.forages.length;o++){var l=i.forages[o];l!==t&&r.push(l._initReady().catch(s));}var c=i.forages.slice(0);return u.all(r).then((function(){return a.db=i.db,M(a)})).then((function(e){return a.db=e,C(a,t._defaultConfig.version)?x(a):e})).then((function(e){a.db=i.db=e,t._dbInfo=a;for(var n=0;n<c.length;n++){var r=c[n];r!==t&&(r._dbInfo.db=a.db,r._dbInfo.version=a.version);}}))}function B(e,t){var a=this;e=p(e);var n=new u((function(t,n){a.ready().then((function(){R(a._dbInfo,b,(function(i,r){if(i)return n(i);try{var s=r.objectStore(a._dbInfo.storeName).get(e);s.onsuccess=function(){var e=s.result;void 0===e&&(e=null),E(e)&&(e=I(e)),t(e);},s.onerror=function(){n(s.error);};}catch(e){n(e);}}));})).catch(n);}));return c(n,t),n}function O(e,t){var a=this,n=new u((function(t,n){a.ready().then((function(){R(a._dbInfo,b,(function(i,r){if(i)return n(i);try{var s=r.objectStore(a._dbInfo.storeName).openCursor(),o=1;s.onsuccess=function(){var a=s.result;if(a){var n=a.value;E(n)&&(n=I(n));var i=e(n,a.key,o++);void 0!==i?t(i):a.continue();}else t();},s.onerror=function(){n(s.error);};}catch(e){n(e);}}));})).catch(n);}));return c(n,t),n}function $(e,t,a){var n=this;e=p(e);var i=new u((function(a,i){var r;n.ready().then((function(){return r=n._dbInfo,"[object Blob]"===g.call(t)?A(r.db).then((function(e){return e?t:V(t)})):t})).then((function(t){R(n._dbInfo,v,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var l=o.put(t,e);s.oncomplete=function(){void 0===t&&(t=null),a(t);},s.onabort=s.onerror=function(){var e=l.error?l.error:l.transaction.error;i(e);};}catch(e){i(e);}}));})).catch(i);}));return c(i,a),i}function U(e,t){var a=this;e=p(e);var n=new u((function(t,n){a.ready().then((function(){R(a._dbInfo,v,(function(i,r){if(i)return n(i);try{var s=r.objectStore(a._dbInfo.storeName).delete(e);r.oncomplete=function(){t();},r.onerror=function(){n(s.error);},r.onabort=function(){var e=s.error?s.error:s.transaction.error;n(e);};}catch(e){n(e);}}));})).catch(n);}));return c(n,t),n}function j(e){var t=this,a=new u((function(e,a){t.ready().then((function(){R(t._dbInfo,v,(function(n,i){if(n)return a(n);try{var r=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e();},i.onabort=i.onerror=function(){var e=r.error?r.error:r.transaction.error;a(e);};}catch(e){a(e);}}));})).catch(a);}));return c(a,e),a}function z(e){var t=this,a=new u((function(e,a){t.ready().then((function(){R(t._dbInfo,b,(function(n,i){if(n)return a(n);try{var r=i.objectStore(t._dbInfo.storeName).count();r.onsuccess=function(){e(r.result);},r.onerror=function(){a(r.error);};}catch(e){a(e);}}));})).catch(a);}));return c(a,e),a}function W(e,t){var a=this,n=new u((function(t,n){e<0?t(null):a.ready().then((function(){R(a._dbInfo,b,(function(i,r){if(i)return n(i);try{var s=r.objectStore(a._dbInfo.storeName),o=!1,l=s.openKeyCursor();l.onsuccess=function(){var a=l.result;a?0===e||o?t(a.key):(o=!0,a.advance(e)):t(null);},l.onerror=function(){n(l.error);};}catch(e){n(e);}}));})).catch(n);}));return c(n,t),n}function Y(e){var t=this,a=new u((function(e,a){t.ready().then((function(){R(t._dbInfo,b,(function(n,i){if(n)return a(n);try{var r=i.objectStore(t._dbInfo.storeName).openKeyCursor(),s=[];r.onsuccess=function(){var t=r.result;t?(s.push(t.key),t.continue()):e(s);},r.onerror=function(){a(r.error);};}catch(e){a(e);}}));})).catch(a);}));return c(a,e),a}function H(e,t){t=h.apply(this,arguments);var a=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||a.name,e.storeName=e.storeName||a.storeName);var n,i=this;if(e.name){var r=e.name===a.name&&i._dbInfo.db?u.resolve(i._dbInfo.db):M(e).then((function(t){var a=y[e.name],n=a.forages;a.db=t;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=t;return t}));n=e.storeName?r.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var a=t.version+1;k(e);var n=y[e.name],i=n.forages;t.close();for(var r=0;r<i.length;r++){var o=i[r];o._dbInfo.db=null,o._dbInfo.version=a;}var l=new u((function(t,n){var i=s.open(e.name,a);i.onerror=function(e){i.result.close(),n(e);},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName);},i.onsuccess=function(){var e=i.result;e.close(),t(e);};}));return l.then((function(e){n.db=e;for(var t=0;t<i.length;t++){var a=i[t];a._dbInfo.db=e,S(a._dbInfo);}})).catch((function(t){throw (N(e,t)||u.resolve()).catch((function(){})),t}))}})):r.then((function(t){k(e);var a=y[e.name],n=a.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;var r=new u((function(t,a){var n=s.deleteDatabase(e.name);n.onerror=function(){var e=n.result;e&&e.close(),a(n.error);},n.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed');},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e);};}));return r.then((function(e){a.db=e;for(var t=0;t<n.length;t++)S(n[t]._dbInfo);})).catch((function(t){throw (N(e,t)||u.resolve()).catch((function(){})),t}))}));}else n=u.reject("Invalid arguments");return c(n,t),n}var G={_driver:"asyncStorage",_initStorage:P,_support:o(),iterate:O,getItem:B,setItem:$,removeItem:U,clear:j,length:z,key:W,keys:Y,dropInstance:H};function q(){return "function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J="~~local_forage_type~",K=/^~~local_forage_type~([^~]+)~/,X="__lfsc__:",Q=X.length,ee="arbf",te="blob",ae="si08",ne="ui08",ie="uic8",re="si16",se="si32",oe="ur16",le="ui32",ue="fl32",ce="fl64",de=Q+ee.length,pe=Object.prototype.toString;function he(e){var t,a,n,i,r,s=.75*e.length,o=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var u=new ArrayBuffer(s),c=new Uint8Array(u);for(t=0;t<o;t+=4)a=Z.indexOf(e[t]),n=Z.indexOf(e[t+1]),i=Z.indexOf(e[t+2]),r=Z.indexOf(e[t+3]),c[l++]=a<<2|n>>4,c[l++]=(15&n)<<4|i>>2,c[l++]=(3&i)<<6|63&r;return u}function fe(e){var t,a=new Uint8Array(e),n="";for(t=0;t<a.length;t+=3)n+=Z[a[t]>>2],n+=Z[(3&a[t])<<4|a[t+1]>>4],n+=Z[(15&a[t+1])<<2|a[t+2]>>6],n+=Z[63&a[t+2]];return a.length%3==2?n=n.substring(0,n.length-1)+"=":a.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function me(e,t){var a="";if(e&&(a=pe.call(e)),e&&("[object ArrayBuffer]"===a||e.buffer&&"[object ArrayBuffer]"===pe.call(e.buffer))){var n,i=X;e instanceof ArrayBuffer?(n=e,i+=ee):(n=e.buffer,"[object Int8Array]"===a?i+=ae:"[object Uint8Array]"===a?i+=ne:"[object Uint8ClampedArray]"===a?i+=ie:"[object Int16Array]"===a?i+=re:"[object Uint16Array]"===a?i+=oe:"[object Int32Array]"===a?i+=se:"[object Uint32Array]"===a?i+=le:"[object Float32Array]"===a?i+=ue:"[object Float64Array]"===a?i+=ce:t(new Error("Failed to get type for BinaryArray"))),t(i+fe(n));}else if("[object Blob]"===a){var r=new FileReader;r.onload=function(){var a=J+e.type+"~"+fe(this.result);t(X+te+a);},r.readAsArrayBuffer(e);}else try{t(JSON.stringify(e));}catch(a){console.error("Couldn't convert value into a JSON string: ",e),t(null,a);}}function ye(e){if(e.substring(0,Q)!==X)return JSON.parse(e);var t,a=e.substring(de),n=e.substring(Q,de);if(n===te&&K.test(a)){var i=a.match(K);t=i[1],a=a.substring(i[0].length);}var r=he(a);switch(n){case ee:return r;case te:return l([r],{type:t});case ae:return new Int8Array(r);case ne:return new Uint8Array(r);case ie:return new Uint8ClampedArray(r);case re:return new Int16Array(r);case oe:return new Uint16Array(r);case se:return new Int32Array(r);case le:return new Uint32Array(r);case ue:return new Float32Array(r);case ce:return new Float64Array(r);default:throw new Error("Unkown type: "+n)}}var ge={serialize:me,deserialize:ye,stringToBuffer:he,bufferToString:fe};function be(e,t,a,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],a,n);}function ve(e){var t=this,a={db:null};if(e)for(var n in e)a[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new u((function(e,n){try{a.db=openDatabase(a.name,String(a.version),a.description,a.size);}catch(e){return n(e)}a.db.transaction((function(i){be(i,a,(function(){t._dbInfo=a,e();}),(function(e,t){n(t);}));}),n);}));return a.serializer=ge,i}function we(e,t,a,n,i,r){e.executeSql(a,n,i,(function(e,s){s.code===s.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,o){o.rows.length?r(e,s):be(e,t,(function(){e.executeSql(a,n,i,r);}),r);}),r):r(e,s);}),r);}function _e(e,t){var a=this;e=p(e);var n=new u((function(t,n){a.ready().then((function(){var i=a._dbInfo;i.db.transaction((function(a){we(a,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,a){var n=a.rows.length?a.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n);}),(function(e,t){n(t);}));}));})).catch(n);}));return c(n,t),n}function Ae(e,t){var a=this,n=new u((function(t,n){a.ready().then((function(){var i=a._dbInfo;i.db.transaction((function(a){we(a,i,"SELECT * FROM "+i.storeName,[],(function(a,n){for(var r=n.rows,s=r.length,o=0;o<s;o++){var l=r.item(o),u=l.value;if(u&&(u=i.serializer.deserialize(u)),void 0!==(u=e(u,l.key,o+1)))return void t(u)}t();}),(function(e,t){n(t);}));}));})).catch(n);}));return c(n,t),n}function ke(e,t,a,n){var i=this;e=p(e);var r=new u((function(r,s){i.ready().then((function(){ void 0===t&&(t=null);var o=t,l=i._dbInfo;l.serializer.serialize(t,(function(t,u){u?s(u):l.db.transaction((function(a){we(a,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){r(o);}),(function(e,t){s(t);}));}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void r(ke.apply(i,[e,o,a,n-1]));s(t);}}));}));})).catch(s);}));return c(r,a),r}function Se(e,t,a){return ke.apply(this,[e,t,a,1])}function Ne(e,t){var a=this;e=p(e);var n=new u((function(t,n){a.ready().then((function(){var i=a._dbInfo;i.db.transaction((function(a){we(a,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t();}),(function(e,t){n(t);}));}));})).catch(n);}));return c(n,t),n}function Te(e){var t=this,a=new u((function(e,a){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"DELETE FROM "+n.storeName,[],(function(){e();}),(function(e,t){a(t);}));}));})).catch(a);}));return c(a,e),a}function Me(e){var t=this,a=new u((function(e,a){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,a){var n=a.rows.item(0).c;e(n);}),(function(e,t){a(t);}));}));})).catch(a);}));return c(a,e),a}function xe(e,t){var a=this,n=new u((function(t,n){a.ready().then((function(){var i=a._dbInfo;i.db.transaction((function(a){we(a,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,a){var n=a.rows.length?a.rows.item(0).key:null;t(n);}),(function(e,t){n(t);}));}));})).catch(n);}));return c(n,t),n}function Ce(e){var t=this,a=new u((function(e,a){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT key FROM "+n.storeName,[],(function(t,a){for(var n=[],i=0;i<a.rows.length;i++)n.push(a.rows.item(i).key);e(n);}),(function(e,t){a(t);}));}));})).catch(a);}));return c(a,e),a}function Ve(e){return new u((function(t,a){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(a,n){for(var i=[],r=0;r<n.rows.length;r++)i.push(n.rows.item(r).name);t({db:e,storeNames:i});}),(function(e,t){a(t);}));}),(function(e){a(e);}));}))}function Ie(e,t){t=h.apply(this,arguments);var a=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||a.name,e.storeName=e.storeName||a.storeName);var n,i=this;return c(n=e.name?new u((function(t){var n;n=e.name===a.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(Ve(n));})).then((function(e){return new u((function(t,a){e.db.transaction((function(n){function i(e){return new u((function(t,a){n.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t();}),(function(e,t){a(t);}));}))}for(var r=[],s=0,o=e.storeNames.length;s<o;s++)r.push(i(e.storeNames[s]));u.all(r).then((function(){t();})).catch((function(e){a(e);}));}),(function(e){a(e);}));}))})):u.reject("Invalid arguments"),t),n}var Ee={_driver:"webSQLStorage",_initStorage:ve,_support:q(),iterate:Ae,getItem:_e,setItem:Se,removeItem:Ne,clear:Te,length:Me,key:xe,keys:Ce,dropInstance:Ie};function Fe(){try{return "undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return false}}function De(e,t){var a=e.name+"/";return e.storeName!==t.storeName&&(a+=e.storeName+"/"),a}function Re(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return true}}function Le(){return !Re()||localStorage.length>0}function Pe(e){var t=this,a={};if(e)for(var n in e)a[n]=e[n];return a.keyPrefix=De(e,t._defaultConfig),Le()?(t._dbInfo=a,a.serializer=ge,u.resolve()):u.reject()}function Be(e){var t=this,a=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var n=localStorage.key(a);0===n.indexOf(e)&&localStorage.removeItem(n);}}));return c(a,e),a}function Oe(e,t){var a=this;e=p(e);var n=a.ready().then((function(){var t=a._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return c(n,t),n}function $e(e,t){var a=this,n=a.ready().then((function(){for(var t=a._dbInfo,n=t.keyPrefix,i=n.length,r=localStorage.length,s=1,o=0;o<r;o++){var l=localStorage.key(o);if(0===l.indexOf(n)){var u=localStorage.getItem(l);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,l.substring(i),s++)))return u}}}));return c(n,t),n}function Ue(e,t){var a=this,n=a.ready().then((function(){var t,n=a._dbInfo;try{t=localStorage.key(e);}catch(e){t=null;}return t&&(t=t.substring(n.keyPrefix.length)),t}));return c(n,t),n}function je(e){var t=this,a=t.ready().then((function(){for(var e=t._dbInfo,a=localStorage.length,n=[],i=0;i<a;i++){var r=localStorage.key(i);0===r.indexOf(e.keyPrefix)&&n.push(r.substring(e.keyPrefix.length));}return n}));return c(a,e),a}function ze(e){var t=this.keys().then((function(e){return e.length}));return c(t,e),t}function We(e,t){var a=this;e=p(e);var n=a.ready().then((function(){var t=a._dbInfo;localStorage.removeItem(t.keyPrefix+e);}));return c(n,t),n}function Ye(e,t,a){var n=this;e=p(e);var i=n.ready().then((function(){ void 0===t&&(t=null);var a=t;return new u((function(i,r){var s=n._dbInfo;s.serializer.serialize(t,(function(t,n){if(n)r(n);else try{localStorage.setItem(s.keyPrefix+e,t),i(a);}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||r(e),r(e);}}));}))}));return c(i,a),i}function He(e,t){if(t=h.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var a=this.config();e.name=e.name||a.name,e.storeName=e.storeName||a.storeName;}var n,i=this;return n=e.name?new u((function(t){e.storeName?t(De(e,i._defaultConfig)):t(e.name+"/");})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var a=localStorage.key(t);0===a.indexOf(e)&&localStorage.removeItem(a);}})):u.reject("Invalid arguments"),c(n,t),n}var Ge={_driver:"localStorageWrapper",_initStorage:Pe,_support:Fe(),iterate:$e,getItem:Oe,setItem:Ye,removeItem:We,clear:Be,length:ze,key:Ue,keys:je,dropInstance:He},qe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ze=function(e,t){for(var a=e.length,n=0;n<a;){if(qe(e[n],t))return true;n++;}return false},Je=Array.isArray||function(e){return "[object Array]"===Object.prototype.toString.call(e)},Ke={},Xe={},Qe={INDEXEDDB:G,WEBSQL:Ee,LOCALSTORAGE:Ge},et=[Qe.INDEXEDDB._driver,Qe.WEBSQL._driver,Qe.LOCALSTORAGE._driver],tt=["dropInstance"],at=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),nt={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function it(e,t){e[t]=function(){var a=arguments;return e.ready().then((function(){return e[t].apply(e,a)}))};}function rt(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var a in t)t.hasOwnProperty(a)&&(Je(t[a])?arguments[0][a]=t[a].slice():arguments[0][a]=t[a]);}return arguments[0]}var st=function(){function e(t){for(var a in i(this,e),Qe)if(Qe.hasOwnProperty(a)){var n=Qe[a],r=n._driver;this[a]=r,Ke[r]||this.defineDriver(n);}this._defaultConfig=rt({},nt),this._config=rt({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=false,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}));}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t];}return !("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return "string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,a){var n=new u((function(t,a){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void a(i);for(var r=at.concat("_initStorage"),s=0,o=r.length;s<o;s++){var l=r[s];if((!Ze(tt,l)||e[l])&&"function"!=typeof e[l])return void a(i)}var d=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),a=u.reject(t);return c(a,arguments[arguments.length-1]),a}},a=0,n=tt.length;a<n;a++){var i=tt[a];e[i]||(e[i]=t(i));}};d();var p=function(a){Ke[n]&&console.info("Redefining LocalForage driver: "+n),Ke[n]=e,Xe[n]=a,t();};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(p,a):p(!!e._support):p(!0);}catch(e){a(e);}}));return d(n,t,a),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,a){var n=Ke[e]?u.resolve(Ke[e]):u.reject(new Error("Driver not found."));return d(n,t,a),n},e.prototype.getSerializer=function(e){var t=u.resolve(ge);return d(t,e),t},e.prototype.ready=function(e){var t=this,a=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return d(a,e,e),a},e.prototype.setDriver=function(e,t,a){var n=this;Je(e)||(e=[e]);var i=this._getSupportedDrivers(e);function r(){n._config.driver=n.driver();}function s(e){return n._extend(e),r(),n._ready=n._initStorage(n._config),n._ready}function o(e){return function(){var t=0;function a(){for(;t<e.length;){var i=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(s).catch(a)}r();var o=new Error("No available storage method found.");return n._driverSet=u.reject(o),n._driverSet}return a()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return u.resolve()})):u.resolve();return this._driverSet=l.then((function(){var e=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then((function(e){n._driver=e._driver,r(),n._wrapLibraryMethodsWithReady(),n._initDriver=o(i);}))})).catch((function(){r();var e=new Error("No available storage method found.");return n._driverSet=u.reject(e),n._driverSet})),d(this._driverSet,t,a),this._driverSet},e.prototype.supports=function(e){return !!Xe[e]},e.prototype._extend=function(e){rt(this,e);},e.prototype._getSupportedDrivers=function(e){for(var t=[],a=0,n=e.length;a<n;a++){var i=e[a];this.supports(i)&&t.push(i);}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=at.length;e<t;e++)it(this,at[e]);},e.prototype.createInstance=function(t){return new e(t)},e}(),ot=new st;t.exports=ot;},{3:3}]},{},[4])(4)),Ji.exports),Xi=R$9(Ki);class Qi{databaseName;collectionName;size;_store;constructor(e,t,a){Xi.config({driver:Xi.INDEXEDDB}),this.databaseName=e||"lumino-cache",this.collectionName=t||"data",this.size=a,this._store=Xi.createInstance({name:this.databaseName,storeName:this.collectionName});}async init(){}async _keys(){return this._store.keys()}async _set(e,t){return this._store.setItem(e,t)}async _clear(){return this._store.clear()}async _get(e){return this._store.getItem(e)}async _remove(e){return this._store.removeItem(e)}}function er(e){let t,a,n,i;e.onmessage=async r=>{const s=r.data;try{switch(s.type){case "init":{n=s.databaseName,i=s.collectionName,t=await navigator.storage.getDirectory();const r=await t.getDirectoryHandle(n,{create:!0});a=await r.getDirectoryHandle(i,{create:!0}),e.postMessage({type:s.type,database:n,collection:i,success:!0});break}case "write":{if(!a)throw new Error("OPFS Worker: not initialized yet!");const t=await a.getFileHandle(s.filename,{create:!0}),r=await t.createSyncAccessHandle();let o;if("string"==typeof s.content){o=(new TextEncoder).encode(s.content).buffer;}else if(s.content instanceof ArrayBuffer)o=s.content;else {if(!(s.content instanceof Blob))throw new Error("OPFS Worker: Unsupported content type: "+typeof s.content);o=await s.content.arrayBuffer();}r.truncate(o.byteLength),r.write(o,{at:0}),await r.flush(),r.close(),e.postMessage({type:s.type,database:n,collection:i,success:!0});break}}}catch(t){e.postMessage({type:s.type,success:false,database:n,collection:i,error:t.message});}};}class tr{databaseName;collectionName;size;_worker;_storage;_root;constructor(e,t,a){this.databaseName=e||"lumino-cache",this.collectionName=t||"data",this.size=a;}async init(){if("object"==typeof globalThis.navigator&&"storage"in globalThis.navigator&&"function"==typeof globalThis.navigator.storage.getDirectory){this._storage=await navigator.storage.getDirectory();const e=await this._storage.getDirectoryHandle(this.databaseName,{create:true});let t,a;this._root=await e.getDirectoryHandle(this.collectionName,{create:true}),this._worker=new Worker(URL.createObjectURL(new Blob(["(",er.toString(),")(self)"],{type:"application/javascript"})),{type:"module"});let n=new Promise(((e,n)=>{t=e,a=n;}));return this._worker.onmessage=e=>{const n=e.data;n.success||console.error("OPFS Worker failed:",n),"init"===n.type&&(n.success?t():a(n.error));},this._worker.postMessage({type:"init",databaseName:this.databaseName,collectionName:this.collectionName}),n}}async _keys(){if(!this._root)return [];const e=[];for await(const t of this._root.values())e.push(t.name);return e}async _set(e,t){if(!this._root)return;let a;if(t instanceof Blob)a=t;else if("object"==typeof t){const e=JSON.stringify(t,null,2);a=new Blob([e],{type:"application/json"});}else a=new Blob([t],{type:"text/plain"});const n=await this._root.getFileHandle(e,{create:true});if("function"==typeof n.createWritable){const e=await n.createWritable();await e.write(a),await e.close();}else this._worker.postMessage({type:"write",filename:e,content:a});}async _clear(){if(!this._root)return;const e=[];for await(const t of this._root.values())e.push(this._root.removeEntry(t.name));return Promise.all(e)}async _get(e,t){if(!this._root)return null;let a;try{const t=await this._root.getFileHandle(e);a=await t.getFile();}catch(e){return null}switch(t=t||a.type){case "text/plain":return a.text();case "application/json":{const e=await a.text();try{return JSON.parse(e)}catch(t){return console.error("Content was loaded from cache but could not be json parsed: ",e),null}}default:return a}}async _remove(e){if(this._root)return this._root.removeEntry(e)}}class ar{databaseName;collectionName;size;type;_impl;constructor(e,t,a=0,n=1){switch(this.databaseName=e||"lumino",this.collectionName=t||"data",this.size=1048576*(n||1),this.type=a,this.type){case 0:this._impl=new Qi(this.databaseName,this.collectionName,this.size);break;case 1:this._impl=new tr(this.databaseName,this.collectionName,this.size);break;default:throw "Invalid storage type: "+a}}async init(){return this._impl.init()}async _keys(){return this._impl._keys()}fixKey(e){return e.replaceAll("/","_")}async _set(e,t){return this._impl._set(this.fixKey(e),t)}async _clear(){return this._impl._clear()}async _get(e,t){return this._impl._get(this.fixKey(e),t)}async _remove(e){return this._impl._remove(this.fixKey(e))}}var nr,ir,rr,sr,or$1,lr,ur,cr,dr,pr,hr,fr,mr,yr,gr,br,vr,wr,_r,Ar,kr,Sr,Nr,Tr,Mr,xr,Cr,Vr;function Ir(){if(ir)return nr;return ir=1,nr=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function Er(){if(lr)return or$1;lr=1;var e=function(){if(sr)return rr;sr=1;var e="object"==typeof D&&D&&D.Object===Object&&D;return rr=e}(),t="object"==typeof self&&self&&self.Object===Object&&self,a=e||t||Function("return this")();return or$1=a}function Fr(){if(fr)return hr;fr=1;var e=function(){if(pr)return dr;pr=1;var e=/\s/;return dr=function(t){for(var a=t.length;a--&&e.test(t.charAt(a)););return a}}(),t=/^\s+/;return hr=function(a){return a?a.slice(0,e(a)+1).replace(t,""):a}}function Dr(){if(yr)return mr;yr=1;var e=Er().Symbol;return mr=e}function Rr(){if(Ar)return _r;Ar=1;var e=Dr(),t=function(){if(br)return gr;br=1;var e=Dr(),t=Object.prototype,a=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;return gr=function(e){var t=a.call(e,i),r=e[i];try{e[i]=void 0;var s=!0;}catch(e){}var o=n.call(e);return s&&(t?e[i]=r:delete e[i]),o}}(),a=function(){if(wr)return vr;wr=1;var e=Object.prototype.toString;return vr=function(t){return e.call(t)}}(),n=e?e.toStringTag:void 0;return _r=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":n&&n in Object(e)?t(e):a(e)}}function Lr(){if(Tr)return Nr;Tr=1;var e=Rr(),t=Sr?kr:(Sr=1,kr=function(e){return null!=e&&"object"==typeof e});return Nr=function(a){return "symbol"==typeof a||t(a)&&"[object Symbol]"==e(a)}}var Pr=function(){if(Vr)return Cr;Vr=1;var e=Ir(),t=function(){if(cr)return ur;cr=1;var e=Er();return ur=function(){return e.Date.now()}}(),a=function(){if(xr)return Mr;xr=1;var e=Fr(),t=Ir(),a=Lr(),n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,r=/^0o[0-7]+$/i,s=parseInt;return Mr=function(o){if("number"==typeof o)return o;if(a(o))return NaN;if(t(o)){var l="function"==typeof o.valueOf?o.valueOf():o;o=t(l)?l+"":l;}if("string"!=typeof o)return 0===o?o:+o;o=e(o);var u=i.test(o);return u||r.test(o)?s(o.slice(2),u?2:8):n.test(o)?NaN:+o}}(),n=Math.max,i=Math.min;return Cr=function(r,s,o){var l,u,c,d,p,h,f=0,m=false,y=false,g=true;if("function"!=typeof r)throw new TypeError("Expected a function");function b(e){var t=l,a=u;return l=u=void 0,f=e,d=r.apply(a,t)}function v(e){var t=e-h;return void 0===h||t>=s||t<0||y&&e-f>=c}function w(){var e=t();if(v(e))return _(e);p=setTimeout(w,function(e){var t=s-(e-h);return y?i(t,c-(e-f)):t}(e));}function _(e){return p=void 0,g&&l?b(e):(l=u=void 0,d)}function A(){var e=t(),a=v(e);if(l=arguments,u=this,h=e,a){if(void 0===p)return function(e){return f=e,p=setTimeout(w,s),m?b(e):d}(h);if(y)return clearTimeout(p),p=setTimeout(w,s),b(h)}return void 0===p&&(p=setTimeout(w,s)),d}return s=a(s)||0,e(o)&&(m=!!o.leading,c=(y="maxWait"in o)?n(a(o.maxWait)||0,s):c,g="trailing"in o?!!o.trailing:g),A.cancel=function(){ void 0!==p&&clearTimeout(p),f=0,l=h=u=p=void 0;},A.flush=function(){return void 0===p?d:_(t())},A}}(),Br=R$9(Pr);class Or extends ar{apiClient;cache=new Map;urlToIdMap=new Map;logging=false;ready=false;usePublicApi=false;quota=0;size=0;usePersistentStorage=false;saveIndex;constructor(e,t,a,n){if(super("lumino","items",1),!a)throw "A lumino client needs to be passed.";this.apiClient=a,this.usePublicApi=e,this.quota=1048576*(n||1024),this.usePersistentStorage=t;this.saveIndex=Br((()=>{const e=[];for(const t of this.cache.values())e.push({id:t.id,time:t.time.valueOf(),size:t.size,hash:t.hash,itemType:t.itemType,mimeType:t.mimeType,itemName:t.itemName});this._set("index",e).then((function(){})).catch((function(e){console.error("Error saving cache index: "+e);}));}),1e3);}async init(){return await super.init(),this.initFromStorage()}getQuota(){return this.quota}setQuota(e){this.quota=e,this.checkQuota();}getCount(){return this.cache.size}getSize(){return this.size}async initFromStorage(){if(this.usePersistentStorage){const e=await this._get("index","application/json");if(e&&Array.isArray(e))for(const t of e)t.time=U(t.time),this.cache.set(t.id,t),this.size+=t.size;else await this._clear(),this.saveIndex();}this.ready=true,l$1.$emit("itemCache:cacheReady"),l$1.$emit("itemCache:cacheChange"),l$1.$on("item:rename",(e=>this.handleRename(e)));}async addToStorage(e,t){if(this.usePersistentStorage){const a={id:e.id,time:U(e.time.toDate()),size:e.size,hash:e.hash,itemType:e.itemType,mimeType:e.mimeType,itemName:e.itemName};await this._set(`blob_${e.id}`,t),this.cache.set(e.id,a),this.saveIndex();}this.size+=e.size;}waitUntilReady(){const e=this;return new Promise(((t,a)=>{try{e.ready?t():l$1.$on("itemCache:cacheReady",(()=>{t();}));}catch(e){a(e);}}))}findObject(e){return this.cache.get(e)}getEntries(){return this.cache.values()}clear(){for(const e of this.cache.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);this.cache.clear(),l$1.$emit("itemCache:cacheChange"),this.usePersistentStorage&&this._clear().then((function(){console.log("Cache storage cleared.");})).catch((function(e){console.error(e);}));}clearMemory(){for(let e of this.cache.values())e.objectUrl&&(URL.revokeObjectURL(e.objectUrl),delete e.objectUrl);l$1.$emit("itemCache:cacheChange");}checkQuota(e=0){let t=this.size+e;if(t>this.quota){const e=[...this.cache.entries()].sort((function(e,t){return e[1].time.valueOf()-t[1].time.valueOf()}));let a=0;for(;t>this.quota&&a<e.length;){const n=e[a][1];n.objectUrl||(t-=n.size,this.removeObjectFromCache(n.id)),a++;}}}removeObjectFromCache(e){const t=this.cache.get(e);t&&(t.objectUrl&&URL.revokeObjectURL(t.objectUrl),this.cache.delete(e),this.size-=t.size,this.usePersistentStorage&&(this._remove(`blob_${t.id}`).then((function(){console.log(`Removed blob for ${e} from cache`);})).catch((function(t){console.error(`Error removing blob for ${e} from cache: ${t}`);})),this.saveIndex()));}getIdFromUrl(e){return this.urlToIdMap.has(e)?this.urlToIdMap.get(e):null}getById(e){const t=this.findObject(e);return t?(this.logging&&console.log("Retrieving from cache: "+e),t.time=U(),t):(this.logging&&console.error("Object not in cache: "+e),null)}getObjectUrl(e){const t=this.getIdFromUrl(e);if(!t)return console.error("Could not find URL in cache: "+e),"";const a=this.getById(t);return a?a.objectUrl:(console.error("Could not find Id in cache: "+t),"")}async getBufferById(e){const t=await this.getBlobById(e);return t?await new Response(t).arrayBuffer():null}async getBlobById(e){const t=this.getById(e);return t?await fetch(t.objectUrl).then((e=>e.blob())):null}async loadFromStorage(e){if(e.objectUrl)return true;let t=null;return !!this.usePersistentStorage&&(t=await this._get(`blob_${e.id}`),!!t&&(e.objectUrl=URL.createObjectURL(t),e.time=U(),this.saveIndex(),l$1.$emit("itemCache:cacheChange"),true))}getCacheKey(e,t){return t&&"item"!==t.type?e+"_lod"+t.index:e}_getLodLevelUrl(e,t){let a;return a=t&&"item"!==t.type?this.apiClient.getAttachmentDownloadUrl(e,"lod",t.index):this.apiClient.getDownloadUrl(e),a}async loadItem(e,t,a){let n=0;for(;;)try{let n;if(this.usePublicApi)n=t&&"item"!==t.type?await this.apiClient.downloadPublicAttachment(e,"lod",t.index,void 0,a):await this.apiClient.publicDownloadItem(e,a);else try{n=t&&"item"!==t.type?await this.apiClient.downloadAttachment(e,"lod",t.index,void 0,a):await this.apiClient.downloadItem(e,a);}catch{n=t&&"item"!==t.type?await this.apiClient.downloadPublicAttachment(e,"lod",t.index,void 0,a):await this.apiClient.publicDownloadItem(e,a);}return n}catch(t){if(console.log(t),n++,!(n<3))return l$1.$emit("client:fatalError",`Failed to download item ${e}`),null;console.debug(`Failed attempts to download item ${e}: ${n}. Trying again...`);}}async addItemToCache(e,t,a,n){try{const i=this.getCacheKey(e,t),r=this.findObject(i);if(r&&(a||!this.apiClient.getItemHash||this.usePublicApi||(a=await this.apiClient.getItemHash(e)),a&&r.hash===a&&(this.logging&&console.log("Item already in cache: "+e),await this.loadFromStorage(r))))return r.url||(r.url=this._getLodLevelUrl(e,t)),this.urlToIdMap.set(r.url,i),this.cache.set(i,r),r;n&&n(0);let s=await this.loadItem(e,t,n);if(!s)return console.error("Was not able to load object into cache: "+i),null;n&&n(100);const o=this._getLodLevelUrl(e,t),u=URL.createObjectURL(s.blob),c={id:i,url:o,time:U(),objectUrl:u,size:s.blob.size,hash:s.hash,itemType:s.itemType,mimeType:s.mimeType,itemName:s.itemName};return this.checkQuota(c.size),await this.addToStorage(c,s.blob),this.cache.set(i,c),this.urlToIdMap.set(o,i),this.saveIndex(),l$1.$emit("itemCache:cacheChange"),this.logging&&console.log("Added item to cache: ",c),c}catch(e){return console.error(e),null}}getObjectCount(){return this.cache.size}getObjectSize(){let e=0;for(const t of this.cache.values())e+=t.size;return e}handleRename({id:e,newName:t}){const a=this.cache.get(e);a&&(a.itemName=t,this.saveIndex(),l$1.$emit("itemCache:cacheChange"));}}class $r extends ar{apiClient;ready=false;maxNumItems=1e4;constructor(e){if(super("lumino","folders",1),!e)throw "A lumino client needs to be passed.";this.apiClient=e;}async init(){await super.init(),await this.checkStorage(),this.ready=true;}clear(){return this._clear()}async checkStorage(){const e=await this._keys();let t=e.length-this.maxNumItems;if(t>0){t=Math.floor(this.maxNumItems/2);const a=[];for(let n=0;n<t;n++)a.push(this._remove(e[n]));await Promise.all(a);}}async getFolderListing(e){return this.ready?this._get(e,"application/json"):null}async getItemListing(e){if(!this.ready)return null;const t=await this._get("items_"+e,"application/json");if(!t)return null;const a=await this.getFolderListing(e);return a&&a.parent&&new Date(t.cachedAt).getTime()>new Date(a.parent.updatedAt).getTime()?t.data:null}async getFolderACLs(e,t){if(!this.ready)return null;const a=await this._get("acl_"+e,"application/json");return a&&Date.now()-a.cachedAt<t?(delete a.cachedAt,a):null}async refreshCacheForFolder(e){const t=await this.getFolderListing(e);await this.addFolderListing(e,t);}async addFolderListing(e,t){this.ready&&(await this._set(e,{...t,cachedAt:new Date}),await this.checkStorage());}async addItemListing(e,t){this.ready&&(await this._set("items_"+e,{data:t,cachedAt:new Date}),await this.checkStorage());}async addACL(e,t){this.ready&&(await this._set("acl_"+e,{...t,cachedAt:new Date}),await this.checkStorage());}}class Ur extends ar{apiClient;constructor(e){if(super("lumino","thumbs",1),!e)throw "A lumino client needs to be passed.";this.apiClient=e;}clear(){this._clear();}async _loadThumbnail(e,t){try{return await this.apiClient.getThumbnail(e,t)}catch{try{return await this.apiClient.getPublicThumbnail(e,t)}catch{return null}}}async get(e,t,a,n){if(!t)throw "Cannot retrieve item thumbnail from cache without knowing size!";let i=await this._get(e,"application/json");if(i&&i.hash===a&&i.timestamp===n){for(const e of i.thumbnails)if(e.size===t){if(e.data)return e.data;i.thumbnails.removeObject(e);break}let a=await this._loadThumbnail(t,e);return a&&(i.thumbnails.push({size:t,data:a}),await this._set(e,i)),a}let r=await this._loadThumbnail(t,e);if(a||n){let s=[];r&&s.push({size:t,data:r}),i={id:e,hash:a,timestamp:n,thumbnails:s},await this._set(e,i);}return r}}class jr{apiClient;cache=new Map;constructor(e){this.apiClient=e,this.cache=new Map;}async resolve(e){let t=this.cache.get(e);if(!t)try{t=this.apiClient.getUserPublicInfo(e,this.apiClient.requestClientId,32),this.cache.set(e,t);}catch(e){console.error(e);}return t}}class zr{apiClient;cache=new Map;constructor(e){this.apiClient=e;}async resolve(e){let t=this.cache.get(e);if(!t)try{t=this.apiClient.getGroupPublicInfo(e,this.apiClient.requestClientId,32),this.cache.set(e,t);}catch(e){console.error(e);}return t}}class Wr{apiClient;cache=new Map;constructor(e){this.apiClient=e;}async get(e,t,a,n,i=false){const r=`${e}_${t}_${a}${ void 0===n?"":`_${n}`}`,s=this.cache.get(r);if(s)return s;try{const s=new Promise((async r=>{try{let s;s=i?await this.apiClient.downloadPublicAttachment(e,t,a,n,void 0):await this.apiClient.downloadAttachmentPOP(e,t,a,n,void 0);r(URL.createObjectURL(s.blob));}catch(e){r(null);}}));return this.cache.set(r,s),s}catch(e){return console.warn(`Attachment ${r} not available.`),null}}invalidateAttachment(e,t,a,n){let i=`${e}_${t}`;null!=a&&(i+=`_${a}`);for(const e of this.cache.keys()){const t=null==n||e.endsWith(`_${n}`);e.startsWith(i)&&t&&this.cache.delete(e);}}}class Yr{apiClient;itemRepo;jobManager;items=[];hasExternalResources=false;totalSize=0;affectedFolderIds=new Set;constructor(e){this.apiClient=e,this.itemRepo=e.getItemRepo(),this.jobManager=e.getJobManager();}_updateQuota(){this.apiClient.eventBus.$emit("quota:update");}async getPreviousVersions(e,t){const a=[];t=t||"published";const n=await this.apiClient.createFolder({name:t,parent:e,returnIfExists:true}),i=await this.apiClient.getFoldersInFolderList(n,{folderAsItemType:"Package"});for(const e of i.children)e.item&&a.push({itemId:e.item._id,folderId:e._id,version:e.name,name:e.item.name,filesize:0|e.item.filesize,visibility:e.item.visibility});return a}async verify(e){const t=this,a=new Map,n=new Map;e=e?await this.itemRepo.loadItem(e._id,{recursive:true}):this.itemRepo.activeItem;const i=await r(e.folder);async function r(e){try{if(e){const a=e._id?e._id:e;if(n.has(a))return n.get(a);{const e=(await t.apiClient.getFolderPath(a)).path;return n.set(a,e),e}}return "/"}catch{return ""}}await this.itemRepo.traverseItems((async function(e){const t={_id:e._id,name:e.name,type:e.type,size:e.totalSize,path:await r(e.folder),item:e,external:false};t.path.startsWith(i)?t.path=t.path.slice(i.length):t.external=true,a.set(e._id,t);})),this.items=Array.from(a.values()),this.hasExternalResources=false,this.totalSize=0;for(const e of this.items)e.external&&(this.hasExternalResources=true),this.totalSize+=e.size;return !this.hasExternalResources}getItems(){return this.items}async unpackToProject(e,t,a,n){a&&(t=await this.apiClient.createFolder({name:a,parent:t,returnIfExists:true}));const i=await this.apiClient.getItem(e);i.folder===t&&await this.apiClient.renameItem(e,i.name+" (Unpackaged)");const r=await this.apiClient.createFolder({name:i.name,parent:t,fixNameCollisions:true}),s=await this.jobManager.execute("JS:Unpackage",[{_id:e,isFolder:false}],[{name:"Destination Folder",value:r},{name:"Make Destination Visible",value:false}],n);if(this._updateQuota(),3===s.state){const t=s.log.trim().split(";");if(2!==t.length||"UNPACKAGED"!==t[0])throw new N$1("Unpacking failed. Did not get unpackaged item id!");const a=t[1].trim();return await this.apiClient.renameItem(a,i.name),await this.itemRepo.replaceLink(e,a),a}if(2===s.state)throw new N$1("Unpacking failed: "+s.error)}async copyItemToProject(e,t,a,n){return (await this.copyItemsToProject([{_id:e,isFolder:false}],t,a,n))[0].newId}async copyItemsToProject(e,t,a,n){a=a||"packages",t=await this.apiClient.createFolder({name:a,parent:t,returnIfExists:true}),this.affectedFolderIds.add(t);const i=[];if(e.length){const a=await this.jobManager.execute("JS:CloneItem",e,[{name:"Deep Clone",value:false},{name:"Destination Folder",value:t},{name:"Exclude Types",value:""},{name:"Make Private",value:true}],n);if(this._updateQuota(),3===a.state){if(!a.log.trim().length)throw new N$1("Copy job returned no results.");{const e=a.log.split("\n").reverse();for(const t of e){const e=t.trim().split(";");if(3===e.length){const t=e[1],a=e[2];await this.itemRepo.replaceLink(t,a),i.push({oldId:t,newId:a});}}}}else if(2===a.state)throw new N$1("Copying of items failed: "+a.error)}return i}async copyToProject(e,t,a){const n=[];for(const e of this.items)e.external&&n.push({_id:e._id,isFolder:false});return this.copyItemsToProject(n,e,t,a)}async unpublish(e){await this.apiClient.makeItemPrivate(e,false,false);}async publish(e,t,a,n,i,r,s,o){const l=e.version;n=n||`published/${l.major}.${l.minor}.${l.revision}`,i=void 0===i||i,r=void 0===r||r,this.affectedFolderIds.add(a);let u,c=a;if(n){const e=n.split("/");for(const t of e)c=await this.apiClient.createFolder({name:t,parent:c,returnIfExists:true}),this.affectedFolderIds.add(c),u||(u=c);}const d=(await this.apiClient.getFoldersInFolderList(a)).children.map((e=>e._id)).filter((e=>e!==u)).join(","),p=await this.jobManager.execute("JS:CreatePackage",[{_id:e._id,isFolder:false}],[{name:"Folders To Include",value:d},{name:"Destination Folder",value:c},{name:"Item Name",value:t},{name:"Make Public",value:!!i},{name:"Copy External",value:!!r},{name:"Always Create New Package",value:!!s},{name:"Make Cloneable",value:!!o}]);if(this._updateQuota(),2===p.state)throw new N$1("Packaging failed: "+p.error);this.apiClient.eventBus.$emit("folder:changed",Array.from(this.affectedFolderIds.values()));}}class Hr{id;job;nextCheckMs;constructor(e,t,a){this.id=e,this.job=a,this.nextCheckMs=t;}}class Gr{apiClient;jobs=new Map;constructor(e){this.apiClient=e;}getJobs(){return Array.from(this.jobs.values())}async execute(e,t,a,n=void 0,i=void 0){const r=this;return new Promise((async(s,o)=>{try{const o=async()=>{try{u.job=await r.apiClient.getJobState(l);let e=!1;switch(u.job.state){case 0:case 1:try{n&&n(u.job);}catch(e){console.error("Error calling progress callback: ",e);}break;case 2:case 3:console.log("Job is done."),e=!0,s(u.job);}e?r.jobs.delete(l):(u.nextCheckMs=Math.min(2*u.nextCheckMs,8e3),setTimeout(o,u.nextCheckMs));}catch(e){console.error("Error fetching job state: "+e);}},l=await r.apiClient.createJob({type:e,elements:t,parameters:a,requiredParameters:i}),u=new Hr(l,1e3);r.jobs.set(l,u),setTimeout(o,u.nextCheckMs);}catch(e){o(e);}}))}}const qr={mp3:{name:"Mpeg Audio Layer 3",itemType:"Audio",itemTypeCollection:"Audio Collection",collectionEntryName:"AudioItems",folderName:"audio",defaultAction:"Use",actions:["Skip","Use"]},hdr:{name:"HDR Image",itemType:"HDR Image",folderName:"envmaps",defaultAction:"Use",actions:["Skip","Use"]},glb:{name:"Gltf Binary",itemType:"Mesh",itemTypeCollection:"Mesh Collection",collectionEntryName:"MeshItems",folderName:"meshes",defaultAction:"Use",actions:["Skip","Use"]},png:{name:"Portable Network Graphics",itemType:"Image",folderName:"textures",defaultAction:"Use",actions:["Skip","Use"]},jpg:{name:"JPEG",itemType:"Image",folderName:"textures",defaultAction:"Use",actions:["Skip","Use"]},jpeg:{name:"JPEG",itemType:"Image",folderName:"textures",defaultAction:"Use",actions:["Skip","Use"]},lua:{name:"Lua",itemType:"Script",folderName:"scripts",defaultAction:"Use",actions:["Skip","Use"]},ttf:{name:"True Type Font",itemType:"Font",folderName:"fonts",defaultAction:"Use",actions:["Skip","Use"]},otf:{name:"Open Type Font",itemType:"Font",folderName:"fonts",defaultAction:"Use",actions:["Skip","Use"]},unknown:{name:"Unsupported",itemType:"Unknown",defaultAction:"Skip",actions:["Skip"],invisible:true}},Zr={Audio:"audio","Audio Collection":"audio","HDR Image":"envmaps",Mesh:"meshes","Mesh Collection":"",Script:"scripts",Material:"materials","Background Shader":"background shaders","Pixel Shader":"pixel shaders","Vertex Shader":"vertex shaders",Image:"textures",Scene:"prefabs",Font:"fonts"};function Jr(e,t){let a=qr[t];a||(a=qr.unknown),e.size=e.blob?e.blob.size:0,e.type=a.name,e.collectionType=a.itemTypeCollection,e.collectionEntryName=a.collectionEntryName,e.action=a.defaultAction,e.actions=a.actions,e.folderName=a.folderName,e.itemType=a.itemType,e.name=function(e,t){let a=e.lastIndexOf(".");return e.substring(0,a<0?e.length:a)+"."+t}(e.name,t);}class Kr{name;blob;processing=false;progress=0;size=0;type;collectionType;collectionEntryName;action;actions;folderName;itemType;constructor(e,t,a){this.name=e,this.blob=t,Jr(this,a);}}class Xr{apiClient;itemRepo;jobManager;items=[];mainItem;totalSize=0;oldMainItemId;originalItemIds=[];affectedFolderIds=new Set;packageId;converter;supportedExtensions;hasExternalResources=false;constructor(e){this.apiClient=e,this.itemRepo=e.getItemRepo(),this.jobManager=e.getJobManager();const t=[];for(const e in qr)qr[e].invisible||t.push(`.${e.toUpperCase()}`);this.supportedExtensions=t.sort(((e,t)=>e.localeCompare(t)));}_updateQuota(){this.apiClient.eventBus.$emit("quota:update");}_addAffectedFolder(e){"object"==typeof e&&e._id?this.affectedFolderIds.add(e._id):"string"==typeof e?this.affectedFolderIds.add(e):console.error("Invalid affected folder to add: ",e);}getAffectedFolderIds(){return Array.from(this.affectedFolderIds.values())}getSupportedExtensions(){return this.supportedExtensions}setConverter(e){this.converter=e;}setItems(e){this.items=e;}async scan(e){const t=this,a=new Map,n=new Map;this.mainItem=await this.itemRepo.loadItem(e,{recursive:true}),this.oldMainItemId=this.mainItem._id;const i=await r(this.mainItem.folder);async function r(e){try{if(e){const a=e._id?e._id:e;if(n.has(a))return n.get(a);{const e=(await t.apiClient.getFolderPath(a)).path;return n.set(a,e),e}}return "/"}catch(e){return console.error(e),""}}await this.itemRepo.traverseItems((async function(e){const n={_id:e._id,name:e.name,type:e.type,size:e.totalSize,path:await r(e.folder),item:e,external:false};n.path.startsWith(i)?n.path=n.path.slice(i.length):n.external=true,t._addAffectedFolder(e.folder),a.set(e._id,n);}),this.mainItem),this.items=Array.from(a.values()),this.originalItemIds=this.items.map((e=>e._id)),this.hasExternalResources=false,this.totalSize=0;for(const e of this.items)e.external&&(this.hasExternalResources=true),this.totalSize+=e.size;return this.items}getItems(){return this.items}async saveMainItemChanges(){const e=this.mainItem;await this.apiClient.updateItem({_id:e._id,name:e.name,shortDescription:e.shortDescription,description:e.description,tags:e.tags,categories:e.categories,visibility:e.visibility,contributors:e.contributors,version:e.version});}async createAssetFolder(e,t){let a=e;const n=t.split("/");this._addAffectedFolder(e);for(const e of n)a=await this.apiClient.createFolder({name:e,parent:a,returnIfExists:true}),this._addAffectedFolder(a);const i=await this.apiClient.getItemsInFolderList(a,true);if(i&&i.length)throw new Error("Asset folder already exists and is not empty!");return a}createStandardAssetFolderPath(e){let t=Zr[e.type];return t||(t=e.type.toLowerCase()+"s"),`assets/${t}/${e.name}`}async executeActions(){if(!this.converter)throw new Error("No converter is configured. Cannot execute actions on items.");return this.converter(this.items,Jr)}async createAsset(e,t=false,a){const n=[];for(const e of this.items)n.push(e._id);if(this._addAffectedFolder(e),n.length)if(t){await this.apiClient.moveItems({items:n,dest:e})!==n.length&&console.warn("Not all items could be moved. Most likely due to permissions."),this.mainItem.folder=e;}else {const t=await this.jobManager.execute("JS:CloneItem",[{_id:this.mainItem._id,isFolder:false}],[{name:"Deep Clone",value:true},{name:"Destination Folder",value:e},{name:"Exclude Types",value:""}],a);if(3===t.state){const a=t.log.split("\n").reverse()[0].split(";");this.mainItem={...this.mainItem,_id:a[2],folder:e};}else if(2===t.state)throw new N$1("Copying of items failed: "+t.error)}"Main"!==this.mainItem.name&&(this.mainItem.originalName=this.mainItem.name,this.mainItem.name="Main",await this.apiClient.renameItem(this.mainItem._id,this.mainItem.name));const i=await this.apiClient.getItem(this.mainItem._id);return i.flags||(i.flags=[]),i.flags.includes("original")||i.flags.push("original"),await this.apiClient.updateItem(i),this._updateQuota(),this.mainItem._id}async createPackage(e,t=false,a=false){let n,i=this.mainItem.folder;if(this._addAffectedFolder(i),void 0===e){const t=this.mainItem.version||{major:1,minor:0,revision:0};e=`published/${t.major}.${t.minor}.${t.revision}`;}if(void 0===t&&(t=true),e){const t=e.split("/");for(const e of t)i=await this.apiClient.createFolder({name:e,parent:i,returnIfExists:true}),this._addAffectedFolder(i),n||(n=i);}const r=(await this.apiClient.getFoldersInFolderList(this.mainItem.folder)).children.map((e=>e._id)).filter((e=>e!==n)).join(","),s=await this.jobManager.execute("JS:CreatePackage",[{_id:this.mainItem._id,isFolder:false}],[{name:"Folders To Include",value:r},{name:"Destination Folder",value:i},{name:"Item Name",value:this.mainItem.originalName||this.mainItem.name},{name:"Make Public",value:!!t},{name:"Copy External",value:!!a}]);if(this._updateQuota(),2===s.state)throw new N$1("Packaging failed: "+s.error);const o=s.log.split("\n").reverse()[0].split(";");this.packageId=o[2];}async replaceReferences(){await this.itemRepo.replaceLink(this.oldMainItemId,this.packageId);}async deleteOriginalItems(){await this.apiClient.deleteItem(this.originalItemIds);}sendFolderRefreshEvent(){this.apiClient.eventBus.$emit("folder:changed",this.getAffectedFolderIds());}async processUploads(e){const t=[];for(const a of e)if("application/zip"===a.type||"application/x-zip-compressed"===a.type){const e=new r$1;try{const n=[];(await e.loadAsync(a)).forEach(((e,a)=>{const i=a.name.split("/").pop();if(!i.startsWith(".")){const e=i.split(".").pop(),r=a.async("blob");n.push(r),r.then((function(n){const i=new Kr(a.name,n,e);t.push(i);}));}})),await Promise.all(n);}catch(e){console.error("Error reading the ZIP file:",e);}}else {const e=a.name.split(".").pop(),n=new Kr(a.name,a,e);t.push(n);}return t}detectAssets(e){let t,a,n,i=0;for(const r of e)if("Use"===r.action)if(void 0===t)t=r.itemType,a=r.collectionType,n=r.folderName,i++;else {if(t!==r.itemType)return {valid:false,reason:"Mixed item types found. To create an asset, upload a single type of file for example only meshes."};i++;}return 0===i?{valid:false,reason:"There are no files we can use to create an asset."}:i>1&&!a?{valid:false,reason:"Cannot create collections of this type."}:{valid:true,assetType:i>1?a:t,itemCount:i,folderName:n}}_filterUploadFiles(e){let t=[];for(const a of e)"Use"===a.action&&t.push(a);return t}createNewItem(){return {name:"New asset",type:"",description:"",shortDescription:"",tags:[],flags:["original"],categories:[],license:"CC0",allowConversation:true,version:{major:1,minor:0,revision:0}}}async createAssetFromFiles(e,t,a,n=false,i=false){const r=this.detectAssets(e);if(r.assetType!==a.type)throw new Error("Asset type not valid for these items.");if(!r.valid)throw new Error(r.reason||"No valid asset detected.");let s=await this.apiClient.createFolder({name:r.folderName,parent:t,returnIfExists:true}),o=await this.apiClient.createFolder({name:a.name,parent:s,returnIfExists:true}),l=false;if(0===(await this.apiClient.getItemsInFolderList(o)).length){(await this.apiClient.getFoldersInFolderList(o)).children.length&&(l=true);}else l=true;if(l){if(!n)throw new Error("Cannot create asset, target folder is not empty!");await this.apiClient.deleteFolder(o),o=await this.apiClient.createFolder({name:a.name,parent:s});}let u,c=this._filterUploadFiles(e);if(1===c.length){const e=c[0];e.processing=true,e.progress=0,u=await this.apiClient.uploadAndCreate(o,e.blob,e.name,{nameOverride:"Main",flags:"original"},(function(t){e.progress=t;})),this._updateQuota(),e.action="Skip";}else {let e=await this.apiClient.createFolder({name:"resources",parent:o}),t={},a=[],n=0;for(const i of c){i.processing=true,i.progress=0;const r=await this.apiClient.uploadAndCreate(e,i.blob,i.name,void 0,(function(e){i.progress=e;}));this._updateQuota(),i.action="Skip",t[`${i.collectionEntryName}[${n}]->Name`]="",a.push({usage:`MeshItems[${n}]->Mesh`,to:r}),n++;}u=await this.apiClient.createItem({type:r.assetType,name:"Main",flags:["original"],folder:o,fixNameCollisions:true,attributes:t,links:a});}return a._id=u,a.folder=o,this.mainItem=a,i?{assetItemId:u,assetTypeFolderId:s,assetFolderId:o}:u}}class Qr{apiClient;itemRepo;constructor(e){this.apiClient=e,this.itemRepo=e.getItemRepo();}grab(e,t,a,n){n=n||{};const i=[];for(const r of a){const a=this._serializeBlockFields(r),s=this._serializeScripts(r),o={type:"block",item:e._id,field:t.name,path:"",block:{id:r.id,type:r.type||"Group",fields:a,scripts:s,children:[]}};n.omitPath||(o.path=this._getBlockPath(r)),n.withChildren&&(o.block.children=this.grab(e,t,r.blocks||[],{withChildren:true,returnArray:true})),i.push(o);}if(n.returnArray)return i;const r={type:"serializedBlocks",data:i};return n.noStringify?r:JSON.stringify(r,null,2)}async put(e,t,a,n={}){e=this.validateMessage(e);const i=[];for(const r of e.data){const e=await this._putBlock(r,t,a,n);e&&i.push(e);}return i}validateMessage(e){if("string"==typeof e&&(e=JSON.parse(e)),"serializedBlocks"!==e.type)throw new Error("Data must be a serialized block message. Format is wrong.");if(!Array.isArray(e.data))throw new Error("The contained data is not an array.");return e}async clone(e,t,a,n,i={}){const r=this.grab(n,t,[e],{withChildren:true,noStringify:true});return this.put(r,t,a,i)}_updateScriptFieldReferences(e,t){const a=new Map,n=(e,t)=>{a.set(e.block.id,t.id);const i=e.block.children||[],r=t.blocks||[];for(let e=0;e<i.length;e++)n(i[e],r[e]);};n(e,t),this.itemRepo.updateScriptFieldReferencesFromMap(a,t);}async _putBlock(e,t,a,n={},i=false){if(!e.block||!e.block.type||!e.block.fields)return null;const r=e.block,s=this._findItemById(e.item)??this.itemRepo.activeItem;let o=a;o||(o=this._findParentBlock(s,e.field,e.path));const l={};if(Array.isArray(r.fields))for(const e of r.fields){const{name:t,type:a,value:i,linkto:r}=e;if("Separator"!==a)if(n.fieldOverrides&&t in n.fieldOverrides)l[t]=n.fieldOverrides[t];else if(r){const e=this.itemRepo.getLoadedItem(r);l[t]=e||await this.itemRepo.loadItem(r);}else l[t]=i;}const u=n.dontCopyScripts?[]:[...r.scripts],c=await this._createUnproxifiedBlock(r.type,l,u,t,s),d={...n,parentPosition:void 0,fieldOverrides:void 0};if(!c)return console.warn(`Could not create block of type ${r.type}. Skipping.`),null;if(Array.isArray(r.children))for(const e of r.children)await this._putBlock(e,t,c,d,true);if(i&&o)return "number"==typeof n.parentPosition?o.blocks.splice(n.parentPosition,0,c):o.blocks.push(c),c.parent=o,c;n.dontCopyScripts||this._updateScriptFieldReferences(e,c);return this._proxifyAndAttachTree(c,o,s,n.parentPosition)}async _createUnproxifiedBlock(e,t,a,n,i){let r=se.instance.getTemplate(i.packageType||i.type,n.name,e);if(!r)return null;if(t){const e=r.template.clone().specialize(t);r={displayName:r.displayName,typeName:r.typeName,template:e,inputs:r.inputs,outputs:r.outputs};}const s=new le(void 0,void 0,r.typeName,void 0,r.displayName,i),o=await this.itemRepo.createFieldsForItem(s,r.template,i,true);return s.setFields(o),s.blocks=[],await this.itemRepo.createScriptsForItem(s,a,i,false),s}_proxifyAndAttachTree(e,t,a,n){const i=e=>{if(Array.isArray(e.blocks)&&e.blocks.length)for(const t of e.blocks)i(t);const t=e.blocks.map((e=>y$1.instance.proxyBlock(e,a)));e.blocks=y$1.instance.proxyBlockArray(t,e,a),e.scripts=y$1.instance.proxyScriptArray(e.scripts,e,a);};i(e),e.parent=t;const r=y$1.instance.proxyBlock(e,a);return "number"==typeof n?t.blocks.splice(n,0,r):t.blocks.push(r),r}_findItemById(e){return this.itemRepo.findLoadedItem(e)}_findItemField(e,t){if(!e.fieldInstances)return null;for(const a of e.fieldInstances)if(a.name===t)return a;return null}_findParentBlock(e,t,a){const n=this._findItemField(e,t);if(!n)return null;const i=a.split("/");let r=n.blocks,s=null;for(const e of i)s=r[e],r=s.blocks;return s}_getBlockIndex(e){if(!e.parent)return 0;let t=0;for(const a of e.parent.blocks){if(e.id===a.id)return t;t++;}throw new Error("Could not find block in parent block array!")}_getBlockPath(e){const t=[];let a=e;for(;a;)t.push(this._getBlockIndex(a)),a=a.parent;return "/"+t.reverse().join("/")}_serializeBlockFields(e){const t=[];if(!Array.isArray(e.fields))return t;for(const a of e.fields)switch(a.type){case "Link":t.push({name:a.name,linkto:a.value?._id});break;case "Attribute":t.push({name:a.name,value:a.value});break;case "Separator":t.push({name:a.name,type:"Separator"});}return t}_serializeScripts(e){const t=[];if(!Array.isArray(e.scripts))return t;for(const a of e.scripts){const e=[],n={item:a.item?.value?._id,fields:e};for(const t of a.fields)e.push({name:t.name,value:t.value});t.push(n);}return t}}function es(){throw new Error("setTimeout has not been defined")}function ts(){throw new Error("clearTimeout has not been defined")}Array.prototype.pushAll||(Array.prototype.pushAll=function(e){for(const t of e)this.push(t);}),Array.prototype.removeObject||(Array.prototype.removeObject=function(e){const t=this.indexOf(e);return t>-1&&(this.splice(t,1),true)}),Array.prototype.moveObjectToArray||(Array.prototype.moveObjectToArray=function(e,t,a){const n=this.indexOf(e);if(n>-1){return (0, this.moveToArray)(n,t,a)}return false}),Array.prototype.removeByFilterFunc||(Array.prototype.removeByFilterFunc=function(e){let t=0;for(let a=0;a<this.length;a++)e(this[a])&&(this.splice(a,1),a--,t++);return t}),Array.prototype.clone||(Array.prototype.clone=function(){const e=[];for(const t of this)e.push(t);return e});var as=es,ns=ts;function is(e){if(as===setTimeout)return setTimeout(e,0);if((as===es||!as)&&setTimeout)return as=setTimeout,setTimeout(e,0);try{return as(e,0)}catch(t){try{return as.call(null,e,0)}catch(t){return as.call(this,e,0)}}}"function"==typeof Fn$2.setTimeout&&(as=setTimeout),"function"==typeof Fn$2.clearTimeout&&(ns=clearTimeout);var rs,ss=[],os=false,ls=-1;function us(){os&&rs&&(os=false,rs.length?ss=rs.concat(ss):ls=-1,ss.length&&cs());}function cs(){if(!os){var e=is(us);os=true;for(var t=ss.length;t;){for(rs=ss,ss=[];++ls<t;)rs&&rs[ls].run();ls=-1,t=ss.length;}rs=null,os=false,function(e){if(ns===clearTimeout)return clearTimeout(e);if((ns===ts||!ns)&&clearTimeout)return ns=clearTimeout,clearTimeout(e);try{return ns(e)}catch(t){try{return ns.call(null,e)}catch(t){return ns.call(this,e)}}}(e);}}function ds(e,t){this.fun=e,this.array=t;}ds.prototype.run=function(){this.fun.apply(null,this.array);};function ps(){}var hs=ps,fs=ps,ms=ps,ys=ps,gs=ps,bs=ps,vs=ps;var ws=Fn$2.performance||{},_s=ws.now||ws.mozNow||ws.msNow||ws.oNow||ws.webkitNow||function(){return (new Date).getTime()};var As=new Date;var ks={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)t[a-1]=arguments[a];ss.push(new ds(e,t)),1!==ss.length||os||is(cs);},title:"browser",browser:true,env:{},argv:[],version:"",versions:{},on:hs,addListener:fs,once:ms,off:ys,removeListener:gs,removeAllListeners:bs,emit:vs,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return "/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*_s.call(ws),a=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(a-=e[0],(n-=e[1])<0&&(a--,n+=1e9)),[a,n]},platform:"browser",release:{},config:{},uptime:function(){return (new Date-As)/1e3}};const Ss=()=>new Map,Ns=e=>{const t=Ss();return e.forEach(((e,a)=>{t.set(a,e);})),t},Ts=(e,t,a)=>{let n=e.get(t);return void 0===n&&e.set(t,n=a()),n},Ms=()=>new Set,xs=e=>e[e.length-1],Cs=(e,t)=>{for(let a=0;a<t.length;a++)e.push(t[a]);},Vs=Array.from,Is=Array.isArray;class Es{constructor(){this._observers=Ss();}on(e,t){return Ts(this._observers,e,Ms).add(t),t}once(e,t){const a=(...n)=>{this.off(e,a),t(...n);};this.on(e,a);}off(e,t){const a=this._observers.get(e);void 0!==a&&(a.delete(t),0===a.size&&this._observers.delete(e));}emit(e,t){return Vs((this._observers.get(e)||Ss()).values()).forEach((e=>e(...t)))}destroy(){this._observers=Ss();}}class Fs{constructor(){this._observers=Ss();}on(e,t){Ts(this._observers,e,Ms).add(t);}once(e,t){const a=(...n)=>{this.off(e,a),t(...n);};this.on(e,a);}off(e,t){const a=this._observers.get(e);void 0!==a&&(a.delete(t),0===a.size&&this._observers.delete(e));}emit(e,t){return Vs((this._observers.get(e)||Ss()).values()).forEach((e=>e(...t)))}destroy(){this._observers=Ss();}}const Ds=Math.floor,Rs=Math.abs,Ls=(e,t)=>e<t?e:t,Ps=(e,t)=>e>t?e:t,Bs=Math.pow,Os=e=>0!==e?e<0:1/e<0,$s=64,Us=128,js$1=127,zs=Number.MAX_SAFE_INTEGER,Ws=Number.isInteger||(e=>"number"==typeof e&&isFinite(e)&&Ds(e)===e),Ys=String.fromCharCode,Hs=/^\s*/g,Gs=/([A-Z])/g,qs=(e,t)=>(e=>e.replace(Hs,""))(e.replace(Gs,(e=>`${t}${(e=>e.toLowerCase())(e)}`))),Zs="undefined"!=typeof TextEncoder?new TextEncoder:null,Js=Zs?e=>Zs.encode(e):e=>{const t=unescape(encodeURIComponent(e)),a=t.length,n=new Uint8Array(a);for(let e=0;e<a;e++)n[e]=t.codePointAt(e);return n};let Ks="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:true,ignoreBOM:true});Ks&&1===Ks.decode(new Uint8Array).length&&(Ks=null);class Xs{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[];}}const Qs=()=>new Xs,eo=e=>{let t=e.cpos;for(let a=0;a<e.bufs.length;a++)t+=e.bufs[a].length;return t},to=e=>{const t=new Uint8Array(eo(e));let a=0;for(let n=0;n<e.bufs.length;n++){const i=e.bufs[n];t.set(i,a),a+=i.length;}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),a),t},ao=(e,t)=>{const a=e.cbuf.length;e.cpos===a&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(2*a),e.cpos=0),e.cbuf[e.cpos++]=t;},no=ao,io=(e,t)=>{for(;t>js$1;)ao(e,Us|js$1&t),t=Ds(t/128);ao(e,js$1&t);},ro=(e,t)=>{const a=Os(t);for(a&&(t=-t),ao(e,(t>63?Us:0)|(a?$s:0)|63&t),t=Ds(t/64);t>0;)ao(e,(t>js$1?Us:0)|js$1&t),t=Ds(t/128);},so=new Uint8Array(3e4),oo=so.length/3,lo=Zs&&Zs.encodeInto?(e,t)=>{if(t.length<oo){const a=Zs.encodeInto(t,so).written||0;io(e,a);for(let t=0;t<a;t++)ao(e,so[t]);}else co(e,Js(t));}:(e,t)=>{const a=unescape(encodeURIComponent(t)),n=a.length;io(e,n);for(let t=0;t<n;t++)ao(e,a.codePointAt(t));},uo=(e,t)=>{const a=e.cbuf.length,n=e.cpos,i=Ls(a-n,t.length),r=t.length-i;e.cbuf.set(t.subarray(0,i),n),e.cpos+=i,r>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Ps(2*a,r)),e.cbuf.set(t.subarray(i)),e.cpos=r);},co=(e,t)=>{io(e,t.byteLength),uo(e,t);},po=(e,t)=>{((e,t)=>{const a=e.cbuf.length;a-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(2*Ps(a,t)),e.cpos=0);})(e,t);const a=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,a},ho=new DataView(new ArrayBuffer(4)),fo=(e,t)=>{switch(typeof t){case "string":ao(e,119),lo(e,t);break;case "number":Ws(t)&&Rs(t)<=2147483647?(ao(e,125),ro(e,t)):(a=t,ho.setFloat32(0,a),ho.getFloat32(0)===a?(ao(e,124),((e,t)=>{po(e,4).setFloat32(0,t,false);})(e,t)):(ao(e,123),((e,t)=>{po(e,8).setFloat64(0,t,false);})(e,t)));break;case "bigint":ao(e,122),((e,t)=>{po(e,8).setBigInt64(0,t,false);})(e,t);break;case "object":if(null===t)ao(e,126);else if(Is(t)){ao(e,117),io(e,t.length);for(let a=0;a<t.length;a++)fo(e,t[a]);}else if(t instanceof Uint8Array)ao(e,116),co(e,t);else {ao(e,118);const a=Object.keys(t);io(e,a.length);for(let n=0;n<a.length;n++){const i=a[n];lo(e,i),fo(e,t[i]);}}break;case "boolean":ao(e,t?120:121);break;default:ao(e,127);}var a;};class mo extends Xs{constructor(e){super(),this.w=e,this.s=null,this.count=0;}write(e){this.s===e?this.count++:(this.count>0&&io(this,this.count-1),this.count=1,this.w(this,e),this.s=e);}}const yo=e=>{e.count>0&&(ro(e.encoder,1===e.count?e.s:-e.s),e.count>1&&io(e.encoder,e.count-2));};class go{constructor(){this.encoder=new Xs,this.s=0,this.count=0;}write(e){this.s===e?this.count++:(yo(this),this.count=1,this.s=e);}toUint8Array(){return yo(this),to(this.encoder)}}const bo=e=>{if(e.count>0){const t=2*e.diff+(1===e.count?0:1);ro(e.encoder,t),e.count>1&&io(e.encoder,e.count-2);}};class vo{constructor(){this.encoder=new Xs,this.s=0,this.count=0,this.diff=0;}write(e){this.diff===e-this.s?(this.s=e,this.count++):(bo(this),this.count=1,this.diff=e-this.s,this.s=e);}toUint8Array(){return bo(this),to(this.encoder)}}class wo{constructor(){this.sarr=[],this.s="",this.lensE=new go;}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length);}toUint8Array(){const e=new Xs;return this.sarr.push(this.s),this.s="",lo(e,this.sarr.join("")),uo(e,this.lensE.toUint8Array()),to(e)}}const _o=e=>new Error(e),Ao=()=>{throw _o("Method unimplemented")},ko=()=>{throw _o("Unexpected case")},So=_o("Unexpected end of array"),No=_o("Integer out of Range");class To{constructor(e){this.arr=e,this.pos=0;}}const Mo=e=>new To(e),xo=e=>((e,t)=>{const a=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,a})(e,Vo(e)),Co=e=>e.arr[e.pos++],Vo=e=>{let t=0,a=1;const n=e.arr.length;for(;e.pos<n;){const n=e.arr[e.pos++];if(t+=(n&js$1)*a,a*=128,n<Us)return t;if(t>zs)throw No}throw So},Io=e=>{let t=e.arr[e.pos++],a=63&t,n=64;const i=(t&$s)>0?-1:1;if(!(t&Us))return i*a;const r=e.arr.length;for(;e.pos<r;){if(t=e.arr[e.pos++],a+=(t&js$1)*n,n*=128,t<Us)return i*a;if(a>zs)throw No}throw So},Eo=Ks?e=>Ks.decode(xo(e)):e=>{let t=Vo(e);if(0===t)return "";{let a=String.fromCodePoint(Co(e));if(--t<100)for(;t--;)a+=String.fromCodePoint(Co(e));else for(;t>0;){const n=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+n);e.pos+=n,a+=String.fromCodePoint.apply(null,i),t-=n;}return decodeURIComponent(escape(a))}},Fo=(e,t)=>{const a=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,a},Do=[e=>{},e=>null,Io,e=>Fo(e,4).getFloat32(0,false),e=>Fo(e,8).getFloat64(0,false),e=>Fo(e,8).getBigInt64(0,false),e=>false,e=>true,Eo,e=>{const t=Vo(e),a={};for(let n=0;n<t;n++){a[Eo(e)]=Ro(e);}return a},e=>{const t=Vo(e),a=[];for(let n=0;n<t;n++)a.push(Ro(e));return a},xo],Ro=e=>Do[127-Co(e)](e);class Lo extends To{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0;}read(){var e;return 0===this.count&&(this.s=this.reader(this),(e=this).pos!==e.arr.length?this.count=Vo(this)+1:this.count=-1),this.count--,this.s}}class Po extends To{constructor(e){super(e),this.s=0,this.count=0;}read(){if(0===this.count){this.s=Io(this);const e=Os(this.s);this.count=1,e&&(this.s=-this.s,this.count=Vo(this)+2);}return this.count--,this.s}}class Bo extends To{constructor(e){super(e),this.s=0,this.count=0,this.diff=0;}read(){if(0===this.count){const e=Io(this),t=1&e;this.diff=Ds(e/2),this.count=1,t&&(this.count=Vo(this)+2);}return this.s+=this.diff,this.count--,this.s}}class Oo{constructor(e){this.decoder=new Po(e),this.str=Eo(this.decoder),this.spos=0;}read(){const e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}const $o=crypto.getRandomValues.bind(crypto),Uo=()=>$o(new Uint32Array(1))[0],jo=[1e7]+-1e3+-4e3+-8e3+-1e11,zo=()=>jo.replace(/[018]/g,(e=>(e^Uo()&15>>e/4).toString(16))),Wo=Date.now,Yo=e=>new Promise(e);Promise.all.bind(Promise);const Ho=e=>void 0===e?null:e;let Go=new class{constructor(){this.map=new Map;}setItem(e,t){this.map.set(e,t);}getItem(e){return this.map.get(e)}},qo=true;try{"undefined"!=typeof localStorage&&localStorage&&(Go=localStorage,qo=!1);}catch(e){}const Zo=Go,Jo=Object.assign,Ko=Object.keys,Xo=e=>Ko(e).length,Qo=e=>Ko(e).length,el=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),tl=Object.freeze,al=e=>{for(const t in e){const a=e[t];"object"!=typeof a&&"function"!=typeof a||al(e[t]);}return tl(e)},nl=Symbol("Equality"),il=(e,t,a=0)=>{try{for(;a<e.length;a++)e[a](...t);}finally{a<e.length&&il(e,t,a+1);}},rl=e=>e,sl=(e,t)=>{if(e===t)return true;if(null==e||null==t||e.constructor!==t.constructor)return false;if(null!=e[nl])return e[nl](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return false;for(let a=0;a<e.length;a++)if(e[a]!==t[a])return false;break;case Set:if(e.size!==t.size)return false;for(const a of e)if(!t.has(a))return false;break;case Map:if(e.size!==t.size)return false;for(const a of e.keys())if(!t.has(a)||!sl(e.get(a),t.get(a)))return false;break;case Object:if(Xo(e)!==Xo(t))return false;for(const a in e)if(!el(e,a)||!sl(e[a],t[a]))return false;break;case Array:if(e.length!==t.length)return false;for(let a=0;a<e.length;a++)if(!sl(e[a],t[a]))return false;break;default:return false}return true},ol=void 0!==ks&&ks.release&&/node|io\.js/.test(ks.release.name)&&"[object process]"===Object.prototype.toString.call(void 0!==ks?ks:0),ll="undefined"!=typeof window&&"undefined"!=typeof document&&!ol;let ul;const cl=e=>(()=>{if(void 0===ul)if(ol){ul=Ss();const e=ks.argv;let t=null;for(let a=0;a<e.length;a++){const n=e[a];"-"===n[0]?(null!==t&&ul.set(t,""),t=n):null!==t&&(ul.set(t,n),t=null);}null!==t&&ul.set(t,"");}else "object"==typeof location?(ul=Ss(),(location.search||"?").slice(1).split("&").forEach((e=>{if(0!==e.length){const[t,a]=e.split("=");ul.set(`--${qs(t,"-")}`,a),ul.set(`-${qs(t,"-")}`,a);}}))):ul=Ss();return ul})().has(e),dl=e=>Ho(ol?ks.env[e.toUpperCase().replaceAll("-","_")]:Zo.getItem(e)),pl=e=>cl("--"+e)||null!==dl(e);pl("production");var hl;const fl$2=ol&&(hl=ks.env.FORCE_COLOR,["true","1","2"].includes(hl))||!cl("--no-colors")&&!pl("no-color")&&(!ol||ks.stdout.isTTY)&&(!ol||cl("--color")||null!==dl("COLORTERM")||(dl("TERM")||"").includes("color")),ml=e=>new Uint8Array(e),yl=ll?e=>{let t="";for(let a=0;a<e.byteLength;a++)t+=Ys(e[a]);return btoa(t)}:e=>Gn.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),gl=ll?e=>{const t=atob(e),a=ml(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);return a}:e=>{const t=Gn.from(e,"base64");return ((e,t,a)=>new Uint8Array(e,t,a))(t.buffer,t.byteOffset,t.byteLength)};class bl{constructor(e,t){this.left=e,this.right=t;}}const vl=(e,t)=>new bl(e,t);"undefined"!=typeof DOMParser&&new DOMParser;const wl=Symbol,_l=wl(),Al=wl(),kl=wl(),Sl=wl(),Nl=wl(),Tl=wl(),Ml=wl(),xl=wl(),Cl=wl(),Vl={[_l]:vl("font-weight","bold"),[Al]:vl("font-weight","normal"),[kl]:vl("color","blue"),[Nl]:vl("color","green"),[Sl]:vl("color","grey"),[Tl]:vl("color","red"),[Ml]:vl("color","purple"),[xl]:vl("color","orange"),[Cl]:vl("color","black")},Il=fl$2?e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());const t=[],a=[],n=Ss();let i=[],r=0;for(;r<e.length;r++){const i=e[r],s=Vl[i];if(void 0!==s)n.set(s.left,s.right);else {if(void 0===i)break;if(i.constructor!==String&&i.constructor!==Number)break;{const e=((e,t)=>{const a=[];for(const[n,i]of e)a.push(t(i,n));return a})(n,((e,t)=>`${t}:${e};`)).join("");r>0||e.length>0?(t.push("%c"+i),a.push(e)):t.push(i);}}}for(r>0&&(i=a,i.unshift(t.join("")));r<e.length;r++){const t=e[r];t instanceof Symbol||i.push(t);}return i}:e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());const t=[],a=[];let n=0;for(;n<e.length;n++){const a=e[n];if(void 0===a)break;if(a.constructor===String||a.constructor===Number)t.push(a);else if(a.constructor===Object)break}for(n>0&&a.push(t.join(""));n<e.length;n++){const t=e[n];t instanceof Symbol||a.push(t);}return a},El=Ms(),Fl=e=>({[Symbol.iterator](){return this},next:e}),Dl=(e,t)=>Fl((()=>{const{done:a,value:n}=e.next();return {done:a,value:a?void 0:t(n)}}));class Rl{constructor(e,t){this.clock=e,this.len=t;}}class Ll{constructor(){this.clients=new Map;}}const Pl=(e,t,a)=>t.clients.forEach(((t,n)=>{const i=e.doc.store.clients.get(n);if(null!=i){const n=i[i.length-1],r=n.id.clock+n.length;for(let n=0,s=t[n];n<t.length&&s.clock<r;s=t[++n])Mu(e,i,s.clock,s.len,a);}})),Bl=(e,t)=>{const a=e.clients.get(t.client);return void 0!==a&&null!==((e,t)=>{let a=0,n=e.length-1;for(;a<=n;){const i=Ds((a+n)/2),r=e[i],s=r.clock;if(s<=t){if(t<s+r.len)return i;a=i+1;}else n=i-1;}return null})(a,t.clock)},Ol=e=>{e.clients.forEach((e=>{let t,a;for(e.sort(((e,t)=>e.clock-t.clock)),t=1,a=1;t<e.length;t++){const n=e[a-1],i=e[t];n.clock+n.len>=i.clock?n.len=Ps(n.len,i.clock+i.len-n.clock):(a<t&&(e[a]=i),a++);}e.length=a;}));},$l=(e,t,a,n)=>{Ts(e.clients,t,(()=>[])).push(new Rl(a,n));},Ul=e=>{const t=new Ll;return e.clients.forEach(((e,a)=>{const n=[];for(let t=0;t<e.length;t++){const a=e[t];if(a.deleted){const i=a.id.clock;let r=a.length;if(t+1<e.length)for(let a=e[t+1];t+1<e.length&&a.deleted;a=e[1+ ++t])r+=a.length;n.push(new Rl(i,r));}}n.length>0&&t.clients.set(a,n);})),t},jl=(e,t)=>{io(e.restEncoder,t.clients.size),Vs(t.clients.entries()).sort(((e,t)=>t[0]-e[0])).forEach((([t,a])=>{e.resetDsCurVal(),io(e.restEncoder,t);const n=a.length;io(e.restEncoder,n);for(let t=0;t<n;t++){const n=a[t];e.writeDsClock(n.clock),e.writeDsLen(n.len);}}));},zl=e=>{const t=new Ll,a=Vo(e.restDecoder);for(let n=0;n<a;n++){e.resetDsCurVal();const a=Vo(e.restDecoder),n=Vo(e.restDecoder);if(n>0){const i=Ts(t.clients,a,(()=>[]));for(let t=0;t<n;t++)i.push(new Rl(e.readDsClock(),e.readDsLen()));}}return t},Wl=(e,t,a)=>{const n=new Ll,i=Vo(e.restDecoder);for(let r=0;r<i;r++){e.resetDsCurVal();const i=Vo(e.restDecoder),r=Vo(e.restDecoder),s=a.clients.get(i)||[],o=wu(a,i);for(let a=0;a<r;a++){const a=e.readDsClock(),r=a+e.readDsLen();if(a<o){o<r&&$l(n,i,o,r-o);let e=Au(s,a),l=s[e];for(!l.deleted&&l.id.clock<a&&(s.splice(e+1,0,cd(t,l,a-l.id.clock)),e++);e<s.length&&(l=s[e++],l.id.clock<r);)l.deleted||(r<l.id.clock+l.length&&s.splice(e,0,cd(t,l,r-l.id.clock)),l.delete(t));}else $l(n,i,a,r-a);}}if(n.clients.size>0){const e=new eu;return io(e.restEncoder,0),jl(e,n),e.toUint8Array()}return null},Yl=Uo;class Hl extends Es{constructor({guid:e=zo(),collectionid:t=null,gc:a=true,gcFilter:n=()=>true,meta:i=null,autoLoad:r=false,shouldLoad:s=true}={}){super(),this.gc=a,this.gcFilter=n,this.clientID=Yl(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new bu,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=s,this.autoLoad=r,this.meta=i,this.isLoaded=false,this.isSynced=false,this.isDestroyed=false,this.whenLoaded=Yo((e=>{this.on("load",(()=>{this.isLoaded=true,e(this);}));}));const o=()=>Yo((e=>{const t=a=>{ void 0!==a&&true!==a||(this.off("sync",t),e());};this.on("sync",t);}));this.on("sync",(e=>{ false===e&&this.isSynced&&(this.whenSynced=o()),this.isSynced=void 0===e||true===e,this.isSynced&&!this.isLoaded&&this.emit("load",[this]);})),this.whenSynced=o();}load(){const e=this._item;null===e||this.shouldLoad||Fu(e.parent.doc,(e=>{e.subdocsLoaded.add(this);}),null,true),this.shouldLoad=true;}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Vs(this.subdocs).map((e=>e.guid)))}transact(e,t=null){return Fu(this,e,t)}get(e,t=ec$2){const a=Ts(this.share,e,(()=>{const e=new t;return e._integrate(this,null),e})),n=a.constructor;if(t!==ec$2&&n!==t){if(n===ec$2){const n=new t;n._map=a._map,a._map.forEach((e=>{for(;null!==e;e=e.left)e.parent=n;})),n._start=a._start;for(let e=n._start;null!==e;e=e.right)e.parent=n;return n._length=a._length,this.share.set(e,n),n._integrate(this,null),n}throw new Error(`Type with the name ${e} has already been defined with a different constructor`)}return a}getArray(e=""){return this.get(e,bc)}getText(e=""){return this.get(e,Lc)}getMap(e=""){return this.get(e,wc)}getXmlElement(e=""){return this.get(e,Oc)}getXmlFragment(e=""){return this.get(e,Bc)}toJSON(){const e={};return this.share.forEach(((t,a)=>{e[a]=t.toJSON();})),e}destroy(){this.isDestroyed=true,Vs(this.subdocs).forEach((e=>e.destroy()));const e=this._item;if(null!==e){this._item=null;const t=e.content;t.doc=new Hl({guid:this.guid,...t.opts,shouldLoad:false}),t.doc._item=e,Fu(e.parent.doc,(a=>{const n=t.doc;e.deleted||a.subdocsAdded.add(n),a.subdocsRemoved.add(this);}),null,true);}this.emit("destroyed",[true]),this.emit("destroy",[this]),super.destroy();}}class Gl{constructor(e){this.restDecoder=e;}resetDsCurVal(){}readDsClock(){return Vo(this.restDecoder)}readDsLen(){return Vo(this.restDecoder)}}class ql extends Gl{readLeftID(){return mu(Vo(this.restDecoder),Vo(this.restDecoder))}readRightID(){return mu(Vo(this.restDecoder),Vo(this.restDecoder))}readClient(){return Vo(this.restDecoder)}readInfo(){return Co(this.restDecoder)}readString(){return Eo(this.restDecoder)}readParentInfo(){return 1===Vo(this.restDecoder)}readTypeRef(){return Vo(this.restDecoder)}readLen(){return Vo(this.restDecoder)}readAny(){return Ro(this.restDecoder)}readBuf(){return (e=>{const t=ml(e.byteLength);return t.set(e),t})(xo(this.restDecoder))}readJSON(){return JSON.parse(Eo(this.restDecoder))}readKey(){return Eo(this.restDecoder)}}class Zl{constructor(e){this.dsCurrVal=0,this.restDecoder=e;}resetDsCurVal(){this.dsCurrVal=0;}readDsClock(){return this.dsCurrVal+=Vo(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Vo(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Jl extends Zl{constructor(e){super(e),this.keys=[],Vo(e),this.keyClockDecoder=new Bo(xo(e)),this.clientDecoder=new Po(xo(e)),this.leftClockDecoder=new Bo(xo(e)),this.rightClockDecoder=new Bo(xo(e)),this.infoDecoder=new Lo(xo(e),Co),this.stringDecoder=new Oo(xo(e)),this.parentInfoDecoder=new Lo(xo(e),Co),this.typeRefDecoder=new Po(xo(e)),this.lenDecoder=new Po(xo(e));}readLeftID(){return new hu(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new hu(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return 1===this.parentInfoDecoder.read()}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Ro(this.restDecoder)}readBuf(){return xo(this.restDecoder)}readJSON(){return Ro(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const e=this.stringDecoder.read();return this.keys.push(e),e}}}class Kl{constructor(){this.restEncoder=Qs();}toUint8Array(){return to(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){io(this.restEncoder,e);}writeDsLen(e){io(this.restEncoder,e);}}class Xl extends Kl{writeLeftID(e){io(this.restEncoder,e.client),io(this.restEncoder,e.clock);}writeRightID(e){io(this.restEncoder,e.client),io(this.restEncoder,e.clock);}writeClient(e){io(this.restEncoder,e);}writeInfo(e){no(this.restEncoder,e);}writeString(e){lo(this.restEncoder,e);}writeParentInfo(e){io(this.restEncoder,e?1:0);}writeTypeRef(e){io(this.restEncoder,e);}writeLen(e){io(this.restEncoder,e);}writeAny(e){fo(this.restEncoder,e);}writeBuf(e){co(this.restEncoder,e);}writeJSON(e){lo(this.restEncoder,JSON.stringify(e));}writeKey(e){lo(this.restEncoder,e);}}class Ql{constructor(){this.restEncoder=Qs(),this.dsCurrVal=0;}toUint8Array(){return to(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0;}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,io(this.restEncoder,t);}writeDsLen(e){0===e&&ko(),io(this.restEncoder,e-1),this.dsCurrVal+=e;}}class eu extends Ql{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new vo,this.clientEncoder=new go,this.leftClockEncoder=new vo,this.rightClockEncoder=new vo,this.infoEncoder=new mo(no),this.stringEncoder=new wo,this.parentInfoEncoder=new mo(no),this.typeRefEncoder=new go,this.lenEncoder=new go;}toUint8Array(){const e=Qs();return io(e,0),co(e,this.keyClockEncoder.toUint8Array()),co(e,this.clientEncoder.toUint8Array()),co(e,this.leftClockEncoder.toUint8Array()),co(e,this.rightClockEncoder.toUint8Array()),co(e,to(this.infoEncoder)),co(e,this.stringEncoder.toUint8Array()),co(e,to(this.parentInfoEncoder)),co(e,this.typeRefEncoder.toUint8Array()),co(e,this.lenEncoder.toUint8Array()),uo(e,to(this.restEncoder)),to(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock);}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock);}writeClient(e){this.clientEncoder.write(e);}writeInfo(e){this.infoEncoder.write(e);}writeString(e){this.stringEncoder.write(e);}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0);}writeTypeRef(e){this.typeRefEncoder.write(e);}writeLen(e){this.lenEncoder.write(e);}writeAny(e){fo(this.restEncoder,e);}writeBuf(e){co(this.restEncoder,e);}writeJSON(e){fo(this.restEncoder,e);}writeKey(e){const t=this.keyMap.get(e);void 0===t?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t);}}const tu=(e,t,a)=>{const n=new Map;a.forEach(((e,a)=>{wu(t,a)>e&&n.set(a,e);})),vu(t).forEach(((e,t)=>{a.has(t)||n.set(t,0);})),io(e.restEncoder,n.size),Vs(n.entries()).sort(((e,t)=>t[0]-e[0])).forEach((([a,n])=>{((e,t,a,n)=>{n=Ps(n,t[0].id.clock);const i=Au(t,n);io(e.restEncoder,t.length-i),e.writeClient(a),io(e.restEncoder,n);const r=t[i];r.write(e,n-r.id.clock);for(let a=i+1;a<t.length;a++)t[a].write(e,0);})(e,t.clients.get(a),a,n);}));},au=(e,t,a,n=new Jl(e))=>Fu(t,(e=>{e.local=!1;let t=!1;const a=e.doc,i=a.store,r=((e,t)=>{const a=Ss(),n=Vo(e.restDecoder);for(let i=0;i<n;i++){const n=Vo(e.restDecoder),i=new Array(n),r=e.readClient();let s=Vo(e.restDecoder);a.set(r,{i:0,refs:i});for(let a=0;a<n;a++){const n=e.readInfo();switch(31&n){case 0:{const t=e.readLen();i[a]=new Wc(mu(r,s),t),s+=t;break}case 10:{const t=Vo(e.restDecoder);i[a]=new fd$2(mu(r,s),t),s+=t;break}default:{const o=!(192&n),l=new dd(mu(r,s),null,(n&Us)===Us?e.readLeftID():null,null,(n&$s)===$s?e.readRightID():null,o?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,!o||32&~n?null:e.readString(),pd(e,n));i[a]=l,s+=l.length;}}}}return a})(n,a),s=((e,t,a)=>{const n=[];let i=Vs(a.keys()).sort(((e,t)=>e-t));if(0===i.length)return null;const r=()=>{if(0===i.length)return null;let e=a.get(i[i.length-1]);for(;e.refs.length===e.i;){if(i.pop(),!(i.length>0))return null;e=a.get(i[i.length-1]);}return e};let s=r();if(null===s)return null;const o=new bu,l=new Map,u=(e,t)=>{const a=l.get(e);(null==a||a>t)&&l.set(e,t);};let c=s.refs[s.i++];const d=new Map,p=()=>{for(const e of n){const t=e.id.client,n=a.get(t);n?(n.i--,o.clients.set(t,n.refs.slice(n.i)),a.delete(t),n.i=0,n.refs=[]):o.clients.set(t,[e]),i=i.filter((e=>e!==t));}n.length=0;};for(;;){if(c.constructor!==fd$2){const i=Ts(d,c.id.client,(()=>wu(t,c.id.client)))-c.id.clock;if(i<0)n.push(c),u(c.id.client,c.id.clock-1),p();else {const r=c.getMissing(e,t);if(null!==r){n.push(c);const e=a.get(r)||{refs:[],i:0};if(e.refs.length!==e.i){c=e.refs[e.i++];continue}u(r,wu(t,r)),p();}else (0===i||i<c.length)&&(c.integrate(e,i),d.set(c.id.client,c.id.clock+c.length));}}if(n.length>0)c=n.pop();else if(null!==s&&s.i<s.refs.length)c=s.refs[s.i++];else {if(s=r(),null===s)break;c=s.refs[s.i++];}}if(o.clients.size>0){const e=new eu;return tu(e,o,new Map),io(e.restEncoder,0),{missing:l,update:e.toUint8Array()}}return null})(e,i,r),o=i.pendingStructs;if(o){for(const[e,a]of o.missing)if(a<wu(i,e)){t=!0;break}if(s){for(const[e,t]of s.missing){const a=o.missing.get(e);(null==a||a>t)&&o.missing.set(e,t);}o.update=Bu([o.update,s.update]);}}else i.pendingStructs=s;const l=Wl(n,e,i);if(i.pendingDs){const t=new Jl(Mo(i.pendingDs));Vo(t.restDecoder);const a=Wl(t,e,i);i.pendingDs=l&&a?Bu([l,a]):l||a;}else i.pendingDs=l;if(t){const t=i.pendingStructs.update;i.pendingStructs=null,nu(e.doc,t);}}),a,false),nu=(e,t,a,n=Jl)=>{const i=Mo(t);au(i,e,a,new n(i));},iu=(e,t=new Uint8Array([0]),a=new eu)=>{((e,t,a=new Map)=>{tu(e,t.store,a),jl(e,Ul(t.store));})(a,e,ru(t));const n=[a.toUint8Array()];if(e.store.pendingDs&&n.push(e.store.pendingDs),e.store.pendingStructs&&n.push(Ou(e.store.pendingStructs.update,t)),n.length>1){if(a.constructor===Xl)return Lu(n.map(((e,t)=>0===t?e:zu(e))));if(a.constructor===eu)return Bu(n)}return n[0]},ru=e=>(e=>{const t=new Map,a=Vo(e.restDecoder);for(let n=0;n<a;n++){const a=Vo(e.restDecoder),n=Vo(e.restDecoder);t.set(a,n);}return t})(new Gl(Mo(e))),su=(e,t)=>(io(e.restEncoder,t.size),Vs(t.entries()).sort(((e,t)=>t[0]-e[0])).forEach((([t,a])=>{io(e.restEncoder,t),io(e.restEncoder,a);})),e),ou=(e,t=new Ql)=>(e instanceof Map?su(t,e):((e,t)=>{su(e,vu(t.store));})(t,e),t.toUint8Array());class lu{constructor(){this.l=[];}}const uu=()=>new lu,cu=(e,t)=>e.l.push(t),du=(e,t)=>{const a=e.l,n=a.length;e.l=a.filter((e=>t!==e)),n===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.");},pu=(e,t,a)=>il(e.l,[t,a]);class hu{constructor(e,t){this.client=e,this.clock=t;}}const fu=(e,t)=>e===t||null!==e&&null!==t&&e.client===t.client&&e.clock===t.clock,mu=(e,t)=>new hu(e,t),yu=(e,t)=>void 0===t?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Bl(t.ds,e.id),gu=(e,t)=>{const a=Ts(e.meta,gu,Ms),n=e.doc.store;a.has(t)||(t.sv.forEach(((t,a)=>{t<wu(n,a)&&Nu(e,mu(a,t));})),Pl(e,t.ds,(e=>{})),a.add(t));};class bu{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null;}}const vu=e=>{const t=new Map;return e.clients.forEach(((e,a)=>{const n=e[e.length-1];t.set(a,n.id.clock+n.length);})),t},wu=(e,t)=>{const a=e.clients.get(t);if(void 0===a)return 0;const n=a[a.length-1];return n.id.clock+n.length},_u=(e,t)=>{let a=e.clients.get(t.id.client);if(void 0===a)a=[],e.clients.set(t.id.client,a);else {const e=a[a.length-1];if(e.id.clock+e.length!==t.id.clock)throw ko()}a.push(t);},Au=(e,t)=>{let a=0,n=e.length-1,i=e[n],r=i.id.clock;if(r===t)return n;let s=Ds(t/(r+i.length-1)*n);for(;a<=n;){if(i=e[s],r=i.id.clock,r<=t){if(t<r+i.length)return s;a=s+1;}else n=s-1;s=Ds((a+n)/2);}throw ko()},ku=(e,t)=>{const a=e.clients.get(t.client);return a[Au(a,t.clock)]},Su=(e,t,a)=>{const n=Au(t,a),i=t[n];return i.id.clock<a&&i instanceof dd?(t.splice(n+1,0,cd(e,i,a-i.id.clock)),n+1):n},Nu=(e,t)=>{const a=e.doc.store.clients.get(t.client);return a[Su(e,a,t.clock)]},Tu=(e,t,a)=>{const n=t.clients.get(a.client),i=Au(n,a.clock),r=n[i];return a.clock!==r.id.clock+r.length-1&&r.constructor!==Wc&&n.splice(i+1,0,cd(e,r,a.clock-r.id.clock+1)),r},Mu=(e,t,a,n,i)=>{if(0===n)return;const r=a+n;let s,o=Su(e,t,a);do{s=t[o++],r<s.id.clock+s.length&&Su(e,t,r),i(s);}while(o<t.length&&t[o].id.clock<r)};class xu{constructor(e,t,a){this.doc=e,this.deleteSet=new Ll,this.beforeState=vu(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=a,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=false;}}const Cu=(e,t)=>!(0===t.deleteSet.clients.size&&!((e,t)=>{for(const[a,n]of e)if(t(n,a))return true;return false})(t.afterState,((e,a)=>t.beforeState.get(a)!==e)))&&(Ol(t.deleteSet),((e,t)=>{tu(e,t.doc.store,t.beforeState);})(e,t),jl(e,t.deleteSet),true),Vu=(e,t,a)=>{const n=t._item;(null===n||n.id.clock<(e.beforeState.get(n.id.client)||0)&&!n.deleted)&&Ts(e.changed,t,Ms).add(a);},Iu=(e,t)=>{let a=e[t],n=e[t-1],i=t;for(;i>0&&(n.deleted===a.deleted&&n.constructor===a.constructor&&n.mergeWith(a));a=n,n=e[--i-1])a instanceof dd&&null!==a.parentSub&&a.parent._map.get(a.parentSub)===a&&a.parent._map.set(a.parentSub,n);const r=t-i;return r&&e.splice(t+1-r,r),r},Eu=(e,t)=>{if(t<e.length){const a=e[t],n=a.doc,i=n.store,r=a.deleteSet,s=a._mergeStructs;try{Ol(r),a.afterState=vu(a.doc.store),n.emit("beforeObserverCalls",[a,n]);const e=[];a.changed.forEach(((t,n)=>e.push((()=>{null!==n._item&&n._item.deleted||n._callObserver(a,t);})))),e.push((()=>{a.changedParentTypes.forEach(((e,t)=>{t._dEH.l.length>0&&(null===t._item||!t._item.deleted)&&((e=e.filter((e=>null===e.target._item||!e.target._item.deleted))).forEach((e=>{e.currentTarget=t,e._path=null;})),e.sort(((e,t)=>e.path.length-t.path.length)),pu(t._dEH,e,a));}));})),e.push((()=>n.emit("afterTransaction",[a,n]))),il(e,[]),a._needFormattingCleanup&&Fc(a);}finally{n.gc&&((e,t,a)=>{for(const[n,i]of e.clients.entries()){const e=t.clients.get(n);for(let n=i.length-1;n>=0;n--){const r=i[n],s=r.clock+r.len;for(let n=Au(e,r.clock),i=e[n];n<e.length&&i.id.clock<s;i=e[++n]){const i=e[n];if(r.clock+r.len<=i.id.clock)break;i instanceof dd&&i.deleted&&!i.keep&&a(i)&&i.gc(t,false);}}}})(r,i,n.gcFilter),((e,t)=>{e.clients.forEach(((e,a)=>{const n=t.clients.get(a);for(let t=e.length-1;t>=0;t--){const a=e[t];for(let e=Ls(n.length-1,1+Au(n,a.clock+a.len-1)),t=n[e];e>0&&t.id.clock>=a.clock;t=n[e])e-=1+Iu(n,e);}}));})(r,i),a.afterState.forEach(((e,t)=>{const n=a.beforeState.get(t)||0;if(n!==e){const e=i.clients.get(t),a=Ps(Au(e,n),1);for(let t=e.length-1;t>=a;)t-=1+Iu(e,t);}}));for(let e=s.length-1;e>=0;e--){const{client:t,clock:a}=s[e].id,n=i.clients.get(t),r=Au(n,a);r+1<n.length&&Iu(n,r+1)>1||r>0&&Iu(n,r);}if(a.local||a.afterState.get(n.clientID)===a.beforeState.get(n.clientID)||(((...e)=>{console.log(...Il(e)),El.forEach((t=>t.print(e)));})(xl,_l,"[yjs] ",Al,Tl,"Changed the client-id because another client seems to be using it."),n.clientID=Yl()),n.emit("afterTransactionCleanup",[a,n]),n._observers.has("update")){const e=new Xl;Cu(e,a)&&n.emit("update",[e.toUint8Array(),a.origin,n,a]);}if(n._observers.has("updateV2")){const e=new eu;Cu(e,a)&&n.emit("updateV2",[e.toUint8Array(),a.origin,n,a]);}const{subdocsAdded:o,subdocsLoaded:l,subdocsRemoved:u}=a;(o.size>0||u.size>0||l.size>0)&&(o.forEach((e=>{e.clientID=n.clientID,null==e.collectionid&&(e.collectionid=n.collectionid),n.subdocs.add(e);})),u.forEach((e=>n.subdocs.delete(e))),n.emit("subdocs",[{loaded:l,added:o,removed:u},n,a]),u.forEach((e=>e.destroy()))),e.length<=t+1?(n._transactionCleanups=[],n.emit("afterAllTransactions",[n,e])):Eu(e,t+1);}}},Fu=(e,t,a=null,n=true)=>{const i=e._transactionCleanups;let r=false,s=null;null===e._transaction&&(r=true,e._transaction=new xu(e,a,n),i.push(e._transaction),1===i.length&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=t(e._transaction);}finally{if(r){const t=e._transaction===i[0];e._transaction=null,t&&Eu(i,0);}}return s};class Du{constructor(e,t){this.gen=function*(e){const t=Vo(e.restDecoder);for(let a=0;a<t;a++){const t=Vo(e.restDecoder),a=e.readClient();let n=Vo(e.restDecoder);for(let i=0;i<t;i++){const t=e.readInfo();if(10===t){const t=Vo(e.restDecoder);yield new fd$2(mu(a,n),t),n+=t;}else if(31&t){const i=!(192&t),r=new dd(mu(a,n),null,(t&Us)===Us?e.readLeftID():null,null,(t&$s)===$s?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,!i||32&~t?null:e.readString(),pd(e,t));yield r,n+=r.length;}else {const t=e.readLen();yield new Wc(mu(a,n),t),n+=t;}}}}(e),this.curr=null,this.done=false,this.filterSkips=t,this.next();}next(){do{this.curr=this.gen.next().value||null;}while(this.filterSkips&&null!==this.curr&&this.curr.constructor===fd$2);return this.curr}}class Ru{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[];}}const Lu=e=>Bu(e,ql,Xl),Pu=(e,t)=>{if(e.constructor===Wc){const{client:a,clock:n}=e.id;return new Wc(mu(a,n+t),e.length-t)}if(e.constructor===fd$2){const{client:a,clock:n}=e.id;return new fd$2(mu(a,n+t),e.length-t)}{const a=e,{client:n,clock:i}=a.id;return new dd(mu(n,i+t),null,mu(n,i+t-1),null,a.rightOrigin,a.parent,a.parentSub,a.content.splice(t))}},Bu=(e,t=Jl,a=eu)=>{if(1===e.length)return e[0];const n=e.map((e=>new t(Mo(e))));let i=n.map((e=>new Du(e,true))),r=null;const s=new a,o=new Ru(s);for(;i=i.filter((e=>null!==e.curr)),i.sort(((e,t)=>{if(e.curr.id.client===t.curr.id.client){const a=e.curr.id.clock-t.curr.id.clock;return 0===a?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===fd$2?1:-1:a}return t.curr.id.client-e.curr.id.client})),0!==i.length;){const e=i[0],t=e.curr.id.client;if(null!==r){let a=e.curr,n=false;for(;null!==a&&a.id.clock+a.length<=r.struct.id.clock+r.struct.length&&a.id.client>=r.struct.id.client;)a=e.next(),n=true;if(null===a||a.id.client!==t||n&&a.id.clock>r.struct.id.clock+r.struct.length)continue;if(t!==r.struct.id.client)Uu(o,r.struct,r.offset),r={struct:a,offset:0},e.next();else if(r.struct.id.clock+r.struct.length<a.id.clock)if(r.struct.constructor===fd$2)r.struct.length=a.id.clock+a.length-r.struct.id.clock;else {Uu(o,r.struct,r.offset);const e=a.id.clock-r.struct.id.clock-r.struct.length;r={struct:new fd$2(mu(t,r.struct.id.clock+r.struct.length),e),offset:0};}else {const t=r.struct.id.clock+r.struct.length-a.id.clock;t>0&&(r.struct.constructor===fd$2?r.struct.length-=t:a=Pu(a,t)),r.struct.mergeWith(a)||(Uu(o,r.struct,r.offset),r={struct:a,offset:0},e.next());}}else r={struct:e.curr,offset:0},e.next();for(let a=e.curr;null!==a&&a.id.client===t&&a.id.clock===r.struct.id.clock+r.struct.length&&a.constructor!==fd$2;a=e.next())Uu(o,r.struct,r.offset),r={struct:a,offset:0};}null!==r&&(Uu(o,r.struct,r.offset),r=null),ju(o);const l=(e=>{const t=new Ll;for(let a=0;a<e.length;a++)e[a].clients.forEach(((n,i)=>{if(!t.clients.has(i)){const r=n.slice();for(let t=a+1;t<e.length;t++)Cs(r,e[t].clients.get(i)||[]);t.clients.set(i,r);}}));return Ol(t),t})(n.map((e=>zl(e))));return jl(s,l),s.toUint8Array()},Ou=(e,t,a=Jl,n=eu)=>{const i=ru(t),r=new n,s=new Ru(r),o=new a(Mo(e)),l=new Du(o,false);for(;l.curr;){const e=l.curr,t=e.id.client,a=i.get(t)||0;if(l.curr.constructor!==fd$2)if(e.id.clock+e.length>a)for(Uu(s,e,Ps(a-e.id.clock,0)),l.next();l.curr&&l.curr.id.client===t;)Uu(s,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===t&&l.curr.id.clock+l.curr.length<=a;)l.next();else l.next();}ju(s);const u=zl(o);return jl(r,u),r.toUint8Array()},$u=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:to(e.encoder.restEncoder)}),e.encoder.restEncoder=Qs(),e.written=0);},Uu=(e,t,a)=>{e.written>0&&e.currClient!==t.id.client&&$u(e),0===e.written&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),io(e.encoder.restEncoder,t.id.clock+a)),t.write(e.encoder,a),e.written++;},ju=e=>{$u(e);const t=e.encoder.restEncoder;io(t,e.clientStructs.length);for(let a=0;a<e.clientStructs.length;a++){const n=e.clientStructs[a];io(t,n.written),uo(t,n.restEncoder);}},zu=e=>((e,t,a,n)=>{const i=new a(Mo(e)),r=new Du(i,false),s=new n,o=new Ru(s);for(let e=r.curr;null!==e;e=r.next())Uu(o,t(e),0);ju(o);const l=zl(i);return jl(s,l),s.toUint8Array()})(e,rl,Jl,Xl),Wu="You must not compute changes after the event-handler fired.";class Yu{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null;}get path(){return this._path||(this._path=Hu(this.currentTarget,this.target))}deletes(e){return Bl(this.transaction.deleteSet,e.id)}get keys(){if(null===this._keys){if(0===this.transaction.doc._transactionCleanups.length)throw _o(Wu);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach((a=>{if(null!==a){const n=t._map.get(a);let i,r;if(this.adds(n)){let e=n.left;for(;null!==e&&this.adds(e);)e=e.left;if(this.deletes(n)){if(null===e||!this.deletes(e))return;i="delete",r=xs(e.content.getContent());}else null!==e&&this.deletes(e)?(i="update",r=xs(e.content.getContent())):(i="add",r=void 0);}else {if(!this.deletes(n))return;i="delete",r=xs(n.content.getContent());}e.set(a,{action:i,oldValue:r});}})),this._keys=e;}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(null===e){if(0===this.transaction.doc._transactionCleanups.length)throw _o(Wu);const t=this.target,a=Ms(),n=Ms(),i=[];e={added:a,deleted:n,delta:i,keys:this.keys};if(this.transaction.changed.get(t).has(null)){let e=null;const r=()=>{e&&i.push(e);};for(let i=t._start;null!==i;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&(null!==e&&void 0!==e.delete||(r(),e={delete:0}),e.delete+=i.length,n.add(i)):this.adds(i)?(null!==e&&void 0!==e.insert||(r(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),a.add(i)):(null!==e&&void 0!==e.retain||(r(),e={retain:0}),e.retain+=i.length);null!==e&&void 0===e.retain&&r();}this._changes=e;}return e}}const Hu=(e,t)=>{const a=[];for(;null!==t._item&&t!==e;){if(null!==t._item.parentSub)a.unshift(t._item.parentSub);else {let e=0,n=t._item.parent._start;for(;n!==t._item&&null!==n;)!n.deleted&&n.countable&&(e+=n.length),n=n.right;a.unshift(e);}t=t._item.parent;}return a},Gu=()=>{((...e)=>{console.warn(...Il(e)),e.unshift(xl),El.forEach((t=>t.print(e)));})("Invalid access: Add Yjs type to a document before reading data.");};let qu=0;class Zu{constructor(e,t){e.marker=true,this.p=e,this.index=t,this.timestamp=qu++;}}const Ju=(e,t,a)=>{e.p.marker=false,e.p=t,t.marker=true,e.index=a,e.timestamp=qu++;},Ku=(e,t)=>{if(null===e._start||0===t||null===e._searchMarker)return null;const a=0===e._searchMarker.length?null:e._searchMarker.reduce(((e,a)=>Rs(t-e.index)<Rs(t-a.index)?e:a));let n=e._start,i=0;for(null!==a&&(n=a.p,i=a.index,(e=>{e.timestamp=qu++;})(a));null!==n.right&&i<t;){if(!n.deleted&&n.countable){if(t<i+n.length)break;i+=n.length;}n=n.right;}for(;null!==n.left&&i>t;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);for(;null!==n.left&&n.left.id.client===n.id.client&&n.left.id.clock+n.left.length===n.id.clock;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);return null!==a&&Rs(a.index-i)<n.parent.length/80?(Ju(a,n,i),a):((e,t,a)=>{if(e.length>=80){const n=e.reduce(((e,t)=>e.timestamp<t.timestamp?e:t));return Ju(n,t,a),n}{const n=new Zu(t,a);return e.push(n),n}})(e._searchMarker,n,i)},Xu=(e,t,a)=>{for(let n=e.length-1;n>=0;n--){const i=e[n];if(a>0){let t=i.p;for(t.marker=false;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(null===t||true===t.marker){e.splice(n,1);continue}i.p=t,t.marker=true;}(t<i.index||a>0&&t===i.index)&&(i.index=Ps(t,i.index+a));}},Qu=(e,t,a)=>{const n=e,i=t.changedParentTypes;for(;Ts(i,e,(()=>[])).push(a),null!==e._item;)e=e._item.parent;pu(n._eH,a,t);};let ec$2 = class ec{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=uu(),this._dEH=uu(),this._searchMarker=null;}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t;}_copy(){throw Ao()}clone(){throw Ao()}_write(e){}get _first(){let e=this._start;for(;null!==e&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0);}observe(e){cu(this._eH,e);}observeDeep(e){cu(this._dEH,e);}unobserve(e){du(this._eH,e);}unobserveDeep(e){du(this._dEH,e);}toJSON(){}};const tc=(e,t,a)=>{e.doc??Gu(),t<0&&(t=e._length+t),a<0&&(a=e._length+a);let n=a-t;const i=[];let r=e._start;for(;null!==r&&n>0;){if(r.countable&&!r.deleted){const e=r.content.getContent();if(e.length<=t)t-=e.length;else {for(let a=t;a<e.length&&n>0;a++)i.push(e[a]),n--;t=0;}}r=r.right;}return i},ac=e=>{e.doc??Gu();const t=[];let a=e._start;for(;null!==a;){if(a.countable&&!a.deleted){const e=a.content.getContent();for(let a=0;a<e.length;a++)t.push(e[a]);}a=a.right;}return t},nc=(e,t)=>{let a=0,n=e._start;for(e.doc??Gu();null!==n;){if(n.countable&&!n.deleted){const i=n.content.getContent();for(let n=0;n<i.length;n++)t(i[n],a++,e);}n=n.right;}},ic=(e,t)=>{const a=[];return nc(e,((n,i)=>{a.push(t(n,i,e));})),a},rc=e=>{let t=e._start,a=null,n=0;return {[Symbol.iterator](){return this},next:()=>{if(null===a){for(;null!==t&&t.deleted;)t=t.right;if(null===t)return {done:true,value:void 0};a=t.content.getContent(),n=0,t=t.right;}const e=a[n++];return a.length<=n&&(a=null),{done:false,value:e}}}},sc=(e,t)=>{e.doc??Gu();const a=Ku(e,t);let n=e._start;for(null!==a&&(n=a.p,t-=a.index);null!==n;n=n.right)if(!n.deleted&&n.countable){if(t<n.length)return n.content.getContent()[t];t-=n.length;}},oc=(e,t,a,n)=>{let i=a;const r=e.doc,s=r.clientID,o=r.store,l=null===a?t._start:a.right;let u=[];const c=()=>{u.length>0&&(i=new dd(mu(s,wu(o,s)),i,i&&i.lastId,l,l&&l.id,t,null,new Qc(u)),i.integrate(e,0),u=[]);};n.forEach((a=>{if(null===a)u.push(a);else switch(a.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(a);break;default:switch(c(),a.constructor){case Uint8Array:case ArrayBuffer:i=new dd(mu(s,wu(o,s)),i,i&&i.lastId,l,l&&l.id,t,null,new Yc(new Uint8Array(a))),i.integrate(e,0);break;case Hl:i=new dd(mu(s,wu(o,s)),i,i&&i.lastId,l,l&&l.id,t,null,new qc(a)),i.integrate(e,0);break;default:if(!(a instanceof ec$2))throw new Error("Unexpected content type in insert operation");i=new dd(mu(s,wu(o,s)),i,i&&i.lastId,l,l&&l.id,t,null,new ud(a)),i.integrate(e,0);}}})),c();},lc=()=>_o("Length exceeded!"),uc=(e,t,a,n)=>{if(a>t._length)throw lc();if(0===a)return t._searchMarker&&Xu(t._searchMarker,a,n.length),oc(e,t,null,n);const i=a,r=Ku(t,a);let s=t._start;for(null!==r&&(s=r.p,0===(a-=r.index)&&(s=s.prev,a+=s&&s.countable&&!s.deleted?s.length:0));null!==s;s=s.right)if(!s.deleted&&s.countable){if(a<=s.length){a<s.length&&Nu(e,mu(s.id.client,s.id.clock+a));break}a-=s.length;}return t._searchMarker&&Xu(t._searchMarker,i,n.length),oc(e,t,s,n)},cc=(e,t,a,n)=>{if(0===n)return;const i=a,r=n,s=Ku(t,a);let o=t._start;for(null!==s&&(o=s.p,a-=s.index);null!==o&&a>0;o=o.right)!o.deleted&&o.countable&&(a<o.length&&Nu(e,mu(o.id.client,o.id.clock+a)),a-=o.length);for(;n>0&&null!==o;)o.deleted||(n<o.length&&Nu(e,mu(o.id.client,o.id.clock+n)),o.delete(e),n-=o.length),o=o.right;if(n>0)throw lc();t._searchMarker&&Xu(t._searchMarker,i,-r+n);},dc=(e,t,a)=>{const n=t._map.get(a);void 0!==n&&n.delete(e);},pc=(e,t,a,n)=>{const i=t._map.get(a)||null,r=e.doc,s=r.clientID;let o;if(null==n)o=new Qc([n]);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:o=new Qc([n]);break;case Uint8Array:o=new Yc(n);break;case Hl:o=new qc(n);break;default:if(!(n instanceof ec$2))throw new Error("Unexpected content type");o=new ud(n);}new dd(mu(s,wu(r.store,s)),i,i&&i.lastId,null,null,t,a,o).integrate(e,0);},hc=(e,t)=>{e.doc??Gu();const a=e._map.get(t);return void 0===a||a.deleted?void 0:a.content.getContent()[a.length-1]},fc=e=>{const t={};return e.doc??Gu(),e._map.forEach(((e,a)=>{e.deleted||(t[a]=e.content.getContent()[e.length-1]);})),t},mc=(e,t)=>{e.doc??Gu();const a=e._map.get(t);return void 0!==a&&!a.deleted},yc=e=>{return e.doc??Gu(),t=e._map.entries(),a=e=>!e[1].deleted,Fl((()=>{let e;do{e=t.next();}while(!e.done&&!a(e.value));return e}));var t,a;};class gc extends Yu{}class bc extends ec$2{constructor(){super(),this._prelimContent=[],this._searchMarker=[];}static from(e){const t=new bc;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null;}_copy(){return new bc}clone(){const e=new bc;return e.insert(0,this.toArray().map((e=>e instanceof ec$2?e.clone():e))),e}get length(){return this.doc??Gu(),this._length}_callObserver(e,t){super._callObserver(e,t),Qu(this,e,new gc(this,e));}insert(e,t){null!==this.doc?Fu(this.doc,(a=>{uc(a,this,e,t);})):this._prelimContent.splice(e,0,...t);}push(e){null!==this.doc?Fu(this.doc,(t=>{((e,t,a)=>{let n=(t._searchMarker||[]).reduce(((e,t)=>t.index>e.index?t:e),{index:0,p:t._start}).p;if(n)for(;n.right;)n=n.right;oc(e,t,n,a);})(t,this,e);})):this._prelimContent.push(...e);}unshift(e){this.insert(0,e);}delete(e,t=1){null!==this.doc?Fu(this.doc,(a=>{cc(a,this,e,t);})):this._prelimContent.splice(e,t);}get(e){return sc(this,e)}toArray(){return ac(this)}slice(e=0,t=this.length){return tc(this,e,t)}toJSON(){return this.map((e=>e instanceof ec$2?e.toJSON():e))}map(e){return ic(this,e)}forEach(e){nc(this,e);}[Symbol.iterator](){return rc(this)}_write(e){e.writeTypeRef(ad);}}class vc extends Yu{constructor(e,t,a){super(e,t),this.keysChanged=a;}}class wc extends ec$2{constructor(e){super(),this._prelimContent=null,this._prelimContent=void 0===e?new Map:new Map(e);}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach(((e,t)=>{this.set(t,e);})),this._prelimContent=null;}_copy(){return new wc}clone(){const e=new wc;return this.forEach(((t,a)=>{e.set(a,t instanceof ec$2?t.clone():t);})),e}_callObserver(e,t){Qu(this,e,new vc(this,e,t));}toJSON(){this.doc??Gu();const e={};return this._map.forEach(((t,a)=>{if(!t.deleted){const n=t.content.getContent()[t.length-1];e[a]=n instanceof ec$2?n.toJSON():n;}})),e}get size(){return [...yc(this)].length}keys(){return Dl(yc(this),(e=>e[0]))}values(){return Dl(yc(this),(e=>e[1].content.getContent()[e[1].length-1]))}entries(){return Dl(yc(this),(e=>[e[0],e[1].content.getContent()[e[1].length-1]]))}forEach(e){this.doc??Gu(),this._map.forEach(((t,a)=>{t.deleted||e(t.content.getContent()[t.length-1],a,this);}));}[Symbol.iterator](){return this.entries()}delete(e){null!==this.doc?Fu(this.doc,(t=>{dc(t,this,e);})):this._prelimContent.delete(e);}set(e,t){return null!==this.doc?Fu(this.doc,(a=>{pc(a,this,e,t);})):this._prelimContent.set(e,t),t}get(e){return hc(this,e)}has(e){return mc(this,e)}clear(){null!==this.doc?Fu(this.doc,(e=>{this.forEach((function(t,a,n){dc(e,n,a);}));})):this._prelimContent.clear();}_write(e){e.writeTypeRef(nd);}}const _c=(e,t)=>e===t||"object"==typeof e&&"object"==typeof t&&e&&t&&((e,t)=>e===t||Qo(e)===Qo(t)&&((e,t)=>{for(const a in e)if(!t(e[a],a))return false;return true})(e,((e,a)=>(void 0!==e||el(t,a))&&t[a]===e)))(e,t);class Ac{constructor(e,t,a,n){this.left=e,this.right=t,this.index=a,this.currentAttributes=n;}forward(){if(null===this.right&&ko(),this.right.content.constructor===Jc)this.right.deleted||Tc(this.currentAttributes,this.right.content);else this.right.deleted||(this.index+=this.right.length);this.left=this.right,this.right=this.right.right;}}const kc=(e,t,a)=>{for(;null!==t.right&&a>0;){if(t.right.content.constructor===Jc)t.right.deleted||Tc(t.currentAttributes,t.right.content);else t.right.deleted||(a<t.right.length&&Nu(e,mu(t.right.id.client,t.right.id.clock+a)),t.index+=t.right.length,a-=t.right.length);t.left=t.right,t.right=t.right.right;}return t},Sc=(e,t,a,n)=>{const i=new Map,r=n?Ku(t,a):null;if(r){const t=new Ac(r.p.left,r.p,r.index,i);return kc(e,t,a-r.index)}{const n=new Ac(null,t._start,0,i);return kc(e,n,a)}},Nc=(e,t,a,n)=>{for(;null!==a.right&&(true===a.right.deleted||a.right.content.constructor===Jc&&_c(n.get(a.right.content.key),a.right.content.value));)a.right.deleted||n.delete(a.right.content.key),a.forward();const i=e.doc,r=i.clientID;n.forEach(((n,s)=>{const o=a.left,l=a.right,u=new dd(mu(r,wu(i.store,r)),o,o&&o.lastId,l,l&&l.id,t,null,new Jc(s,n));u.integrate(e,0),a.right=u,a.forward();}));},Tc=(e,t)=>{const{key:a,value:n}=t;null===n?e.delete(a):e.set(a,n);},Mc=(e,t)=>{for(;null!==e.right&&(e.right.deleted||e.right.content.constructor===Jc&&_c(t[e.right.content.key]??null,e.right.content.value));)e.forward();},xc=(e,t,a,n)=>{const i=e.doc,r=i.clientID,s=new Map;for(const o in n){const l=n[o],u=a.currentAttributes.get(o)??null;if(!_c(u,l)){s.set(o,u);const{left:n,right:c}=a;a.right=new dd(mu(r,wu(i.store,r)),n,n&&n.lastId,c,c&&c.id,t,null,new Jc(o,l)),a.right.integrate(e,0),a.forward();}}return s},Cc=(e,t,a,n,i)=>{a.currentAttributes.forEach(((e,t)=>{ void 0===i[t]&&(i[t]=null);}));const r=e.doc,s=r.clientID;Mc(a,i);const o=xc(e,t,a,i),l=n.constructor===String?new ed(n):n instanceof ec$2?new ud(n):new Zc(n);let{left:u,right:c,index:d}=a;t._searchMarker&&Xu(t._searchMarker,a.index,l.getLength()),c=new dd(mu(s,wu(r.store,s)),u,u&&u.lastId,c,c&&c.id,t,null,l),c.integrate(e,0),a.right=c,a.index=d,a.forward(),Nc(e,t,a,o);},Vc=(e,t,a,n,i)=>{const r=e.doc,s=r.clientID;Mc(a,i);const o=xc(e,t,a,i);e:for(;null!==a.right&&(n>0||o.size>0&&(a.right.deleted||a.right.content.constructor===Jc));){if(!a.right.deleted)switch(a.right.content.constructor){case Jc:{const{key:t,value:r}=a.right.content,s=i[t];if(void 0!==s){if(_c(s,r))o.delete(t);else {if(0===n)break e;o.set(t,r);}a.right.delete(e);}else a.currentAttributes.set(t,r);break}default:n<a.right.length&&Nu(e,mu(a.right.id.client,a.right.id.clock+n)),n-=a.right.length;}a.forward();}if(n>0){let i="";for(;n>0;n--)i+="\n";a.right=new dd(mu(s,wu(r.store,s)),a.left,a.left&&a.left.lastId,a.right,a.right&&a.right.id,t,null,new ed(i)),a.right.integrate(e,0),a.forward();}Nc(e,t,a,o);},Ic=(e,t,a,n,i)=>{let r=t;const s=Ss();for(;r&&(!r.countable||r.deleted);){if(!r.deleted&&r.content.constructor===Jc){const e=r.content;s.set(e.key,e);}r=r.right;}let o=0,l=false;for(;t!==r;){if(a===t&&(l=true),!t.deleted){const a=t.content;switch(a.constructor){case Jc:{const{key:r,value:u}=a,c=n.get(r)??null;s.get(r)===a&&c!==u||(t.delete(e),o++,l||(i.get(r)??null)!==u||c===u||(null===c?i.delete(r):i.set(r,c))),l||t.deleted||Tc(i,a);break}}}t=t.right;}return o},Ec=e=>{let t=0;return Fu(e.doc,(a=>{let n=e._start,i=e._start,r=Ss();const s=Ns(r);for(;i;){if(!1===i.deleted)if(i.content.constructor===Jc)Tc(s,i.content);else t+=Ic(a,n,i,r,s),r=Ns(s),n=i;i=i.right;}})),t},Fc=e=>{const t=new Set,a=e.doc;for(const[n,i]of e.afterState.entries()){const r=e.beforeState.get(n)||0;i!==r&&Mu(e,a.store.clients.get(n),r,i,(e=>{e.deleted||e.content.constructor!==Jc||e.constructor===Wc||t.add(e.parent);}));}Fu(a,(a=>{Pl(e,e.deleteSet,(e=>{if(e instanceof Wc||!e.parent._hasFormatting||t.has(e.parent))return;const n=e.parent;e.content.constructor===Jc?t.add(n):((e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const a=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Jc){const n=t.content.key;a.has(n)?t.delete(e):a.add(n);}t=t.left;}})(a,e);}));for(const e of t)Ec(e);}));},Dc=(e,t,a)=>{const n=a,i=Ns(t.currentAttributes),r=t.right;for(;a>0&&null!==t.right;){if(false===t.right.deleted)switch(t.right.content.constructor){case ud:case Zc:case ed:a<t.right.length&&Nu(e,mu(t.right.id.client,t.right.id.clock+a)),a-=t.right.length,t.right.delete(e);}t.forward();}r&&Ic(e,r,t.right,i,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&Xu(s._searchMarker,t.index,-n+a),t};class Rc extends Yu{constructor(e,t,a){super(e,t),this.childListChanged=false,this.keysChanged=new Set,a.forEach((e=>{null===e?this.childListChanged=true:this.keysChanged.add(e);}));}get changes(){if(null===this._changes){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e;}return this._changes}get delta(){if(null===this._delta){const e=this.target.doc,t=[];Fu(e,(e=>{const a=new Map,n=new Map;let i=this.target._start,r=null;const s={};let o="",l=0,u=0;const c=()=>{if(null!==r){let e=null;switch(r){case "delete":u>0&&(e={delete:u}),u=0;break;case "insert":("object"==typeof o||o.length>0)&&(e={insert:o},a.size>0&&(e.attributes={},a.forEach(((t,a)=>{null!==t&&(e.attributes[a]=t);})))),o="";break;case "retain":l>0&&(e={retain:l},(e=>{for(const t in e)return !1;return !0})(s)||(e.attributes=Jo({},s))),l=0;}e&&t.push(e),r=null;}};for(;null!==i;){switch(i.content.constructor){case ud:case Zc:this.adds(i)?this.deletes(i)||(c(),r="insert",o=i.content.getContent()[0],c()):this.deletes(i)?("delete"!==r&&(c(),r="delete"),u+=1):i.deleted||("retain"!==r&&(c(),r="retain"),l+=1);break;case ed:this.adds(i)?this.deletes(i)||("insert"!==r&&(c(),r="insert"),o+=i.content.str):this.deletes(i)?("delete"!==r&&(c(),r="delete"),u+=i.length):i.deleted||("retain"!==r&&(c(),r="retain"),l+=i.length);break;case Jc:{const{key:t,value:o}=i.content;if(this.adds(i)){if(!this.deletes(i)){const l=a.get(t)??null;_c(l,o)?null!==o&&i.delete(e):("retain"===r&&c(),_c(o,n.get(t)??null)?delete s[t]:s[t]=o);}}else if(this.deletes(i)){n.set(t,o);const e=a.get(t)??null;_c(e,o)||("retain"===r&&c(),s[t]=e);}else if(!i.deleted){n.set(t,o);const a=s[t];void 0!==a&&(_c(a,o)?null!==a&&i.delete(e):("retain"===r&&c(),null===o?delete s[t]:s[t]=o));}i.deleted||("insert"===r&&c(),Tc(a,i.content));break}}i=i.right;}for(c();t.length>0;){const e=t[t.length-1];if(void 0===e.retain||void 0!==e.attributes)break;t.pop();}})),this._delta=t;}return this._delta}}class Lc extends ec$2{constructor(e){super(),this._pending=void 0!==e?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=false;}get length(){return this.doc??Gu(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach((e=>e()));}catch(e){console.error(e);}this._pending=null;}_copy(){return new Lc}clone(){const e=new Lc;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const a=new Rc(this,e,t);Qu(this,e,a),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=true);}toString(){this.doc??Gu();let e="",t=this._start;for(;null!==t;)!t.deleted&&t.countable&&t.content.constructor===ed&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=true}={}){null!==this.doc?Fu(this.doc,(a=>{const n=new Ac(null,this._start,0,new Map);for(let i=0;i<e.length;i++){const r=e[i];if(void 0!==r.insert){const s=t||"string"!=typeof r.insert||i!==e.length-1||null!==n.right||"\n"!==r.insert.slice(-1)?r.insert:r.insert.slice(0,-1);("string"!=typeof s||s.length>0)&&Cc(a,this,n,s,r.attributes||{});}else void 0!==r.retain?Vc(a,this,n,r.retain,r.attributes||{}):void 0!==r.delete&&Dc(a,n,r.delete);}})):this._pending.push((()=>this.applyDelta(e)));}toDelta(e,t,a){this.doc??Gu();const n=[],i=new Map,r=this.doc;let s="",o=this._start;function l(){if(s.length>0){const e={};let t=false;i.forEach(((a,n)=>{t=true,e[n]=a;}));const a={insert:s};t&&(a.attributes=e),n.push(a),s="";}}const u=()=>{for(;null!==o;){if(yu(o,e)||void 0!==t&&yu(o,t))switch(o.content.constructor){case ed:{const n=i.get("ychange");void 0===e||yu(o,e)?void 0===t||yu(o,t)?void 0!==n&&(l(),i.delete("ychange")):void 0!==n&&n.user===o.id.client&&"added"===n.type||(l(),i.set("ychange",a?a("added",o.id):{type:"added"})):void 0!==n&&n.user===o.id.client&&"removed"===n.type||(l(),i.set("ychange",a?a("removed",o.id):{type:"removed"})),s+=o.content.str;break}case ud:case Zc:{l();const e={insert:o.content.getContent()[0]};if(i.size>0){const t={};e.attributes=t,i.forEach(((e,a)=>{t[a]=e;}));}n.push(e);break}case Jc:yu(o,e)&&(l(),Tc(i,o.content));}o=o.right;}l();};return e||t?Fu(r,(a=>{e&&gu(a,e),t&&gu(a,t),u();}),"cleanup"):u(),n}insert(e,t,a){if(t.length<=0)return;const n=this.doc;null!==n?Fu(n,(n=>{const i=Sc(n,this,e,!a);a||(a={},i.currentAttributes.forEach(((e,t)=>{a[t]=e;}))),Cc(n,this,i,t,a);})):this._pending.push((()=>this.insert(e,t,a)));}insertEmbed(e,t,a){const n=this.doc;null!==n?Fu(n,(n=>{const i=Sc(n,this,e,!a);Cc(n,this,i,t,a||{});})):this._pending.push((()=>this.insertEmbed(e,t,a||{})));}delete(e,t){if(0===t)return;const a=this.doc;null!==a?Fu(a,(a=>{Dc(a,Sc(a,this,e,!0),t);})):this._pending.push((()=>this.delete(e,t)));}format(e,t,a){if(0===t)return;const n=this.doc;null!==n?Fu(n,(n=>{const i=Sc(n,this,e,!1);null!==i.right&&Vc(n,this,i,t,a);})):this._pending.push((()=>this.format(e,t,a)));}removeAttribute(e){null!==this.doc?Fu(this.doc,(t=>{dc(t,this,e);})):this._pending.push((()=>this.removeAttribute(e)));}setAttribute(e,t){null!==this.doc?Fu(this.doc,(a=>{pc(a,this,e,t);})):this._pending.push((()=>this.setAttribute(e,t)));}getAttribute(e){return hc(this,e)}getAttributes(){return fc(this)}_write(e){e.writeTypeRef(id);}}class Pc{constructor(e,t=()=>true){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=true,e.doc??Gu();}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(null!==e&&(!this._firstCall||e.deleted||!this._filter(t)))do{if(t=e.content.type,e.deleted||t.constructor!==Oc&&t.constructor!==Bc||null===t._start)for(;null!==e;){const t=e.next;if(null!==t){e=t;break}e=e.parent===this._root?null:e.parent._item;}else e=t._start;}while(null!==e&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=false,null===e?{value:void 0,done:true}:(this._currentNode=e,{value:e.content.type,done:false})}}class Bc extends ec$2{constructor(){super(),this._prelimContent=[];}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null;}_copy(){return new Bc}clone(){const e=new Bc;return e.insert(0,this.toArray().map((e=>e instanceof ec$2?e.clone():e))),e}get length(){return this.doc??Gu(),null===this._prelimContent?this._length:this._prelimContent.length}createTreeWalker(e){return new Pc(this,e)}querySelector(e){e=e.toUpperCase();const t=new Pc(this,(t=>t.nodeName&&t.nodeName.toUpperCase()===e)).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),Vs(new Pc(this,(t=>t.nodeName&&t.nodeName.toUpperCase()===e)))}_callObserver(e,t){Qu(this,e,new $c(this,t,e));}toString(){return ic(this,(e=>e.toString())).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},a){const n=e.createDocumentFragment();return void 0!==a&&a._createAssociation(n,this),nc(this,(i=>{n.insertBefore(i.toDOM(e,t,a),null);})),n}insert(e,t){null!==this.doc?Fu(this.doc,(a=>{uc(a,this,e,t);})):this._prelimContent.splice(e,0,...t);}insertAfter(e,t){if(null!==this.doc)Fu(this.doc,(a=>{const n=e&&e instanceof ec$2?e._item:e;oc(a,this,n,t);}));else {const a=this._prelimContent,n=null===e?0:a.findIndex((t=>t===e))+1;if(0===n&&null!==e)throw _o("Reference item not found");a.splice(n,0,...t);}}delete(e,t=1){null!==this.doc?Fu(this.doc,(a=>{cc(a,this,e,t);})):this._prelimContent.splice(e,t);}toArray(){return ac(this)}push(e){this.insert(this.length,e);}unshift(e){this.insert(0,e);}get(e){return sc(this,e)}slice(e=0,t=this.length){return tc(this,e,t)}forEach(e){nc(this,e);}_write(e){e.writeTypeRef(sd);}}class Oc extends Bc{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map;}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach(((e,t)=>{this.setAttribute(t,e);})),this._prelimAttrs=null;}_copy(){return new Oc(this.nodeName)}clone(){const e=new Oc(this.nodeName);return ((e,t)=>{for(const a in e)t(e[a],a);})(this.getAttributes(),((t,a)=>{"string"==typeof t&&e.setAttribute(a,t);})),e.insert(0,this.toArray().map((e=>e instanceof ec$2?e.clone():e))),e}toString(){const e=this.getAttributes(),t=[],a=[];for(const t in e)a.push(t);a.sort();const n=a.length;for(let i=0;i<n;i++){const n=a[i];t.push(n+'="'+e[n]+'"');}const i=this.nodeName.toLocaleLowerCase();return `<${i}${t.length>0?" "+t.join(" "):""}>${super.toString()}</${i}>`}removeAttribute(e){null!==this.doc?Fu(this.doc,(t=>{dc(t,this,e);})):this._prelimAttrs.delete(e);}setAttribute(e,t){null!==this.doc?Fu(this.doc,(a=>{pc(a,this,e,t);})):this._prelimAttrs.set(e,t);}getAttribute(e){return hc(this,e)}hasAttribute(e){return mc(this,e)}getAttributes(e){return e?((e,t)=>{const a={};return e._map.forEach(((e,n)=>{let i=e;for(;null!==i&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;null!==i&&yu(i,t)&&(a[n]=i.content.getContent()[i.length-1]);})),a})(this,e):fc(this)}toDOM(e=document,t={},a){const n=e.createElement(this.nodeName),i=this.getAttributes();for(const e in i){const t=i[e];"string"==typeof t&&n.setAttribute(e,t);}return nc(this,(i=>{n.appendChild(i.toDOM(e,t,a));})),void 0!==a&&a._createAssociation(n,this),n}_write(e){e.writeTypeRef(rd),e.writeKey(this.nodeName);}}class $c extends Yu{constructor(e,t,a){super(e,a),this.childListChanged=false,this.attributesChanged=new Set,t.forEach((e=>{null===e?this.childListChanged=true:this.attributesChanged.add(e);}));}}class Uc extends wc{constructor(e){super(),this.hookName=e;}_copy(){return new Uc(this.hookName)}clone(){const e=new Uc(this.hookName);return this.forEach(((t,a)=>{e.set(a,t);})),e}toDOM(e=document,t={},a){const n=t[this.hookName];let i;return i=void 0!==n?n.createDom(this):document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),void 0!==a&&a._createAssociation(i,this),i}_write(e){e.writeTypeRef(od),e.writeKey(this.hookName);}}class jc extends Lc{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new jc}clone(){const e=new jc;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,a){const n=e.createTextNode(this.toString());return void 0!==a&&a._createAssociation(n,this),n}toString(){return this.toDelta().map((e=>{const t=[];for(const a in e.attributes){const n=[];for(const t in e.attributes[a])n.push({key:t,value:e.attributes[a][t]});n.sort(((e,t)=>e.key<t.key?-1:1)),t.push({nodeName:a,attrs:n});}t.sort(((e,t)=>e.nodeName<t.nodeName?-1:1));let a="";for(let e=0;e<t.length;e++){const n=t[e];a+=`<${n.nodeName}`;for(let e=0;e<n.attrs.length;e++){const t=n.attrs[e];a+=` ${t.key}="${t.value}"`;}a+=">";}a+=e.insert;for(let e=t.length-1;e>=0;e--)a+=`</${t[e].nodeName}>`;return a})).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(ld);}}class zc{constructor(e,t){this.id=e,this.length=t;}get deleted(){throw Ao()}mergeWith(e){return false}write(e,t,a){throw Ao()}integrate(e,t){throw Ao()}}class Wc extends zc{get deleted(){return true}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,true)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),_u(e.doc.store,this);}write(e,t){e.writeInfo(0),e.writeLen(this.length-t);}getMissing(e,t){return null}}class Yc{constructor(e){this.content=e;}getLength(){return 1}getContent(){return [this.content]}isCountable(){return true}copy(){return new Yc(this.content)}splice(e){throw Ao()}mergeWith(e){return false}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content);}getRef(){return 3}}class Hc{constructor(e){this.len=e;}getLength(){return this.len}getContent(){return []}isCountable(){return false}copy(){return new Hc(this.len)}splice(e){const t=new Hc(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,true}integrate(e,t){$l(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted();}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t);}getRef(){return 1}}const Gc=(e,t)=>new Hl({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||false});class qc{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=false),e.autoLoad&&(t.autoLoad=true),null!==e.meta&&(t.meta=e.meta);}getLength(){return 1}getContent(){return [this.doc]}isCountable(){return true}copy(){return new qc(Gc(this.doc.guid,this.opts))}splice(e){throw Ao()}mergeWith(e){return false}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc);}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc);}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts);}getRef(){return 9}}class Zc{constructor(e){this.embed=e;}getLength(){return 1}getContent(){return [this.embed]}isCountable(){return true}copy(){return new Zc(this.embed)}splice(e){throw Ao()}mergeWith(e){return false}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed);}getRef(){return 5}}class Jc{constructor(e,t){this.key=e,this.value=t;}getLength(){return 1}getContent(){return []}isCountable(){return false}copy(){return new Jc(this.key,this.value)}splice(e){throw Ao()}mergeWith(e){return false}integrate(e,t){const a=t.parent;a._searchMarker=null,a._hasFormatting=true;}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value);}getRef(){return 6}}class Kc{constructor(e){this.arr=e;}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return true}copy(){return new Kc(this.arr)}splice(e){const t=new Kc(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),true}integrate(e,t){}delete(e){}gc(e){}write(e,t){const a=this.arr.length;e.writeLen(a-t);for(let n=t;n<a;n++){const t=this.arr[n];e.writeString(void 0===t?"undefined":JSON.stringify(t));}}getRef(){return 2}}const Xc="development"===dl("node_env");class Qc{constructor(e){this.arr=e,Xc&&al(e);}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return true}copy(){return new Qc(this.arr)}splice(e){const t=new Qc(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),true}integrate(e,t){}delete(e){}gc(e){}write(e,t){const a=this.arr.length;e.writeLen(a-t);for(let n=t;n<a;n++){const t=this.arr[n];e.writeAny(t);}}getRef(){return 8}}class ed{constructor(e){this.str=e;}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return true}copy(){return new ed(this.str)}splice(e){const t=new ed(this.str.slice(e));this.str=this.str.slice(0,e);const a=this.str.charCodeAt(e-1);return a>=55296&&a<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,true}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(0===t?this.str:this.str.slice(t));}getRef(){return 4}}const td$2=[e=>new bc,e=>new wc,e=>new Lc,e=>new Oc(e.readKey()),e=>new Bc,e=>new Uc(e.readKey()),e=>new jc],ad=0,nd=1,id=2,rd=3,sd=4,od=5,ld=6;class ud{constructor(e){this.type=e;}getLength(){return 1}getContent(){return [this.type]}isCountable(){return true}copy(){return new ud(this.type._copy())}splice(e){throw Ao()}mergeWith(e){return false}integrate(e,t){this.type._integrate(e.doc,t);}delete(e){let t=this.type._start;for(;null!==t;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach((t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e);})),e.changed.delete(this.type);}gc(e){let t=this.type._start;for(;null!==t;)t.gc(e,true),t=t.right;this.type._start=null,this.type._map.forEach((t=>{for(;null!==t;)t.gc(e,true),t=t.left;})),this.type._map=new Map;}write(e,t){this.type._write(e);}getRef(){return 7}}const cd=(e,t,a)=>{const{client:n,clock:i}=t.id,r=new dd(mu(n,i+a),t,mu(n,i+a-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(a));return t.deleted&&r.markDeleted(),t.keep&&(r.keep=true),null!==t.redone&&(r.redone=mu(t.redone.client,t.redone.clock+a)),t.right=r,null!==r.right&&(r.right.left=r),e._mergeStructs.push(r),null!==r.parentSub&&null===r.right&&r.parent._map.set(r.parentSub,r),t.length=a,r};class dd extends zc{constructor(e,t,a,n,i,r,s,o){super(e,o.getLength()),this.origin=a,this.left=t,this.right=n,this.rightOrigin=i,this.parent=r,this.parentSub=s,this.redone=null,this.content=o,this.info=this.content.isCountable()?2:0;}set marker(e){(8&this.info)>0!==e&&(this.info^=8);}get marker(){return (8&this.info)>0}get keep(){return (1&this.info)>0}set keep(e){this.keep!==e&&(this.info^=1);}get countable(){return (2&this.info)>0}get deleted(){return (4&this.info)>0}set deleted(e){this.deleted!==e&&(this.info^=4);}markDeleted(){this.info|=4;}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=wu(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=wu(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===hu&&this.id.client!==this.parent.client&&this.parent.clock>=wu(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Tu(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Nu(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Wc||this.right&&this.right.constructor===Wc)this.parent=null;else if(this.parent){if(this.parent.constructor===hu){const e=ku(t,this.parent);e.constructor===Wc?this.parent=null:this.parent=e.content.type;}}else this.left&&this.left.constructor===dd?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===dd&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=Tu(e,e.doc.store,mu(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||null!==this.right.left)||this.left&&this.left.right!==this.right){let t,a=this.left;if(null!==a)t=a.right;else if(null!==this.parentSub)for(t=this.parent._map.get(this.parentSub)||null;null!==t&&null!==t.left;)t=t.left;else t=this.parent._start;const n=new Set,i=new Set;for(;null!==t&&t!==this.right;){if(i.add(t),n.add(t),fu(this.origin,t.origin)){if(t.id.client<this.id.client)a=t,n.clear();else if(fu(this.rightOrigin,t.rightOrigin))break}else {if(null===t.origin||!i.has(ku(e.doc.store,t.origin)))break;n.has(ku(e.doc.store,t.origin))||(a=t,n.clear());}t=t.right;}this.left=a;}if(null!==this.left){const e=this.left.right;this.right=e,this.left.right=this;}else {let e;if(null!==this.parentSub)for(e=this.parent._map.get(this.parentSub)||null;null!==e&&null!==e.left;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e;}null!==this.right?this.right.left=this:null!==this.parentSub&&(this.parent._map.set(this.parentSub,this),null!==this.left&&this.left.delete(e)),null===this.parentSub&&this.countable&&!this.deleted&&(this.parent._length+=this.length),_u(e.doc.store,this),this.content.integrate(e,this),Vu(e,this.parent,this.parentSub),(null!==this.parent._item&&this.parent._item.deleted||null!==this.parentSub&&null!==this.right)&&this.delete(e);}else new Wc(this.id,this.length).integrate(e,0);}get next(){let e=this.right;for(;null!==e&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;null!==e&&e.deleted;)e=e.left;return e}get lastId(){return 1===this.length?this.id:mu(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&fu(e.origin,this.lastId)&&this.right===e&&fu(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&null===this.redone&&null===e.redone&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach((t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length));})),e.keep&&(this.keep=true),this.right=e.right,null!==this.right&&(this.right.left=this),this.length+=e.length,true}return false}delete(e){if(!this.deleted){const t=this.parent;this.countable&&null===this.parentSub&&(t._length-=this.length),this.markDeleted(),$l(e.deleteSet,this.id.client,this.id.clock,this.length),Vu(e,t,this.parentSub),this.content.delete(e);}}gc(e,t){if(!this.deleted)throw ko();this.content.gc(e),t?((e,t,a)=>{const n=e.clients.get(t.id.client);n[Au(n,t.id.clock)]=a;})(e,this,new Wc(this.id,this.length)):this.content=new Hc(this.length);}write(e,t){const a=t>0?mu(this.id.client,this.id.clock+t-1):this.origin,n=this.rightOrigin,i=this.parentSub,r=31&this.content.getRef()|(null===a?0:Us)|(null===n?0:$s)|(null===i?0:32);if(e.writeInfo(r),null!==a&&e.writeLeftID(a),null!==n&&e.writeRightID(n),null===a&&null===n){const t=this.parent;if(void 0!==t._item){const a=t._item;if(null===a){const a=(e=>{for(const[t,a]of e.doc.share.entries())if(a===e)return t;throw ko()})(t);e.writeParentInfo(true),e.writeString(a);}else e.writeParentInfo(false),e.writeLeftID(a.id);}else t.constructor===String?(e.writeParentInfo(true),e.writeString(t)):t.constructor===hu?(e.writeParentInfo(false),e.writeLeftID(t)):ko();null!==i&&e.writeString(i);}this.content.write(e,t);}}const pd=(e,t)=>hd[31&t](e),hd=[()=>{ko();},e=>new Hc(e.readLen()),e=>{const t=e.readLen(),a=[];for(let n=0;n<t;n++){const t=e.readString();"undefined"===t?a.push(void 0):a.push(JSON.parse(t));}return new Kc(a)},e=>new Yc(e.readBuf()),e=>new ed(e.readString()),e=>new Zc(e.readJSON()),e=>new Jc(e.readKey(),e.readJSON()),e=>new ud(td$2[e.readTypeRef()](e)),e=>{const t=e.readLen(),a=[];for(let n=0;n<t;n++)a.push(e.readAny());return new Qc(a)},e=>new qc(Gc(e.readString(),e.readAny())),()=>{ko();}];let fd$2 = class fd extends zc{get deleted(){return true}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,true)}integrate(e,t){ko();}write(e,t){e.writeInfo(10),io(e.restEncoder,this.length-t);}getMissing(e,t){return null}};const md="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},yd="__ $YJS$ __";true===md[yd]&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),md[yd]=true;const gd=new Map;const bd="undefined"==typeof BroadcastChannel?class{constructor(e){var t;this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&null!==this.onmessage&&this.onmessage({data:gl(t.newValue||"")}),t=this._onChange,qo||addEventListener("storage",t);}postMessage(e){Zo.setItem(this.room,yl(new Uint8Array(e)));}close(){var e;e=this._onChange,qo||removeEventListener("storage",e);}}:BroadcastChannel,vd=e=>Ts(gd,e,(()=>{const t=Ms(),a=new bd(e);return a.onmessage=e=>t.forEach((t=>t(e.data,"broadcastchannel"))),{bc:a,subs:t}})),wd=(e,t,a=null)=>{const n=vd(e);n.bc.postMessage(t),n.subs.forEach((e=>e(t,a)));},_d=(e,t)=>{io(e,0);const a=(e=>ou(e,new Kl))(t);co(e,a);},Ad=(e,t,a)=>{io(e,1),co(e,((e,t)=>iu(e,t,new Xl))(t,a));},kd=(e,t,a)=>{try{((e,t,a)=>{nu(e,t,a,ql);})(t,xo(e),a);}catch(e){console.error("Caught error while handling a Yjs update",e);}},Sd=kd,Nd=(e,t,a,n)=>{const i=Vo(e);switch(i){case 0:((e,t,a)=>{Ad(t,a,xo(e));})(e,t,a);break;case 1:kd(e,a,n);break;case 2:Sd(e,a,n);break;default:throw new Error("Unknown message type")}return i},Td=3e4;class Md extends Fs{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval((()=>{const e=Wo();null!==this.getLocalState()&&15e3<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const t=[];this.meta.forEach(((a,n)=>{n!==this.clientID&&Td<=e-a.lastUpdated&&this.states.has(n)&&t.push(n);})),t.length>0&&xd(this,t,"timeout");}),Ds(3e3)),e.on("destroy",(()=>{this.destroy();})),this.setLocalState({});}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval);}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const t=this.clientID,a=this.meta.get(t),n=void 0===a?0:a.clock+1,i=this.states.get(t);null===e?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:n,lastUpdated:Wo()});const r=[],s=[],o=[],l=[];null===e?l.push(t):null==i?null!=e&&r.push(t):(s.push(t),sl(i,e)||o.push(t)),(r.length>0||o.length>0||l.length>0)&&this.emit("change",[{added:r,updated:o,removed:l},"local"]),this.emit("update",[{added:r,updated:s,removed:l},"local"]);}setLocalStateField(e,t){const a=this.getLocalState();null!==a&&this.setLocalState({...a,[e]:t});}getStates(){return this.states}}const xd=(e,t,a)=>{const n=[];for(let a=0;a<t.length;a++){const i=t[a];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){const t=e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:Wo()});}n.push(i);}}n.length>0&&(e.emit("change",[{added:[],updated:[],removed:n},a]),e.emit("update",[{added:[],updated:[],removed:n},a]));},Cd=(e,t,a=e.states)=>{const n=t.length,i=Qs();io(i,n);for(let r=0;r<n;r++){const n=t[r],s=a.get(n)||null,o=e.meta.get(n).clock;io(i,n),io(i,o),lo(i,JSON.stringify(s));}return to(i)},Vd=[];Vd[0]=(e,t,a,n,i)=>{io(e,0);const r=Nd(t,e,a.doc,a);n&&1===r&&!a.synced&&(a.synced=true);},Vd[3]=(e,t,a,n,i)=>{io(e,1),co(e,Cd(a.awareness,Array.from(a.awareness.getStates().keys())));},Vd[1]=(e,t,a,n,i)=>{((e,t,a)=>{const n=Mo(t),i=Wo(),r=[],s=[],o=[],l=[],u=Vo(n);for(let t=0;t<u;t++){const t=Vo(n);let a=Vo(n);const u=JSON.parse(Eo(n)),c=e.meta.get(t),d=e.states.get(t),p=void 0===c?0:c.clock;(p<a||p===a&&null===u&&e.states.has(t))&&(null===u?t===e.clientID&&null!=e.getLocalState()?a++:e.states.delete(t):e.states.set(t,u),e.meta.set(t,{clock:a,lastUpdated:i}),void 0===c&&null!==u?r.push(t):void 0!==c&&null===u?l.push(t):null!==u&&(sl(u,d)||o.push(t),s.push(t)));}(r.length>0||o.length>0||l.length>0)&&e.emit("change",[{added:r,updated:o,removed:l},a]),(r.length>0||s.length>0||l.length>0)&&e.emit("update",[{added:r,updated:s,removed:l},a]);})(a.awareness,xo(t),a);},Vd[2]=(e,t,a,n,i)=>{((e,t,a)=>{0===Vo(e)&&a(t,Eo(e));})(t,a.doc,((e,t)=>Id(a,t)));};const Id=(e,t)=>console.warn(`Permission denied to access ${e.url}.\n${t}`),Ed=(e,t,a)=>{const n=Mo(t),i=Qs(),r=Vo(n),s=e.messageHandlers[r];return s?s(i,n,e,a,r):console.error("Unable to compute message"),i},Fd=(e,t,a)=>{t===e.ws&&(e.emit("connection-close",[a,e]),e.ws=null,t.close(),e.wsconnecting=false,e.wsconnected?(e.wsconnected=false,e.synced=false,xd(e.awareness,Array.from(e.awareness.getStates().keys()).filter((t=>t!==e.doc.clientID)),e),e.emit("status",[{status:"disconnected"}])):e.wsUnsuccessfulReconnects++,setTimeout(Dd,Ls(100*Bs(2,e.wsUnsuccessfulReconnects),e.maxBackoffTime),e));},Dd=e=>{if(e.shouldConnect&&null===e.ws){const t=new e._WS(e.url,e.protocols);t.binaryType="arraybuffer",e.ws=t,e.wsconnecting=true,e.wsconnected=false,e.synced=false,t.onmessage=a=>{e.wsLastMessageReceived=Wo();const n=Ed(e,new Uint8Array(a.data),true);eo(n)>1&&t.send(to(n));},t.onerror=t=>{e.emit("connection-error",[t,e]);},t.onclose=a=>{Fd(e,t,a);},t.onopen=()=>{e.wsLastMessageReceived=Wo(),e.wsconnecting=false,e.wsconnected=true,e.wsUnsuccessfulReconnects=0,e.emit("status",[{status:"connected"}]);const a=Qs();if(io(a,0),_d(a,e.doc),t.send(to(a)),null!==e.awareness.getLocalState()){const a=Qs();io(a,1),co(a,Cd(e.awareness,[e.doc.clientID])),t.send(to(a));}},e.emit("status",[{status:"connecting"}]);}},Rd=(e,t)=>{const a=e.ws;e.wsconnected&&a&&a.readyState===a.OPEN&&a.send(t),e.bcconnected&&wd(e.bcChannel,t,e);};class Ld extends Es{constructor(e,t,a,{connect:n=true,awareness:i=new Md(a),params:r={},protocols:s=[],WebSocketPolyfill:o=WebSocket,resyncInterval:l=-1,maxBackoffTime:u=2500,disableBc:c=false}={}){for(super();"/"===e[e.length-1];)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+"/"+t,this.maxBackoffTime=u,this.params=r,this.protocols=s,this.roomname=t,this.doc=a,this._WS=o,this.awareness=i,this.wsconnected=false,this.wsconnecting=false,this.bcconnected=false,this.disableBc=c,this.wsUnsuccessfulReconnects=0,this.messageHandlers=Vd.slice(),this._synced=false,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=n,this._resyncInterval=0,l>0&&(this._resyncInterval=setInterval((()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const e=Qs();io(e,0),_d(e,a),this.ws.send(to(e));}}),l)),this._bcSubscriber=(e,t)=>{if(t!==this){const t=Ed(this,new Uint8Array(e),false);eo(t)>1&&wd(this.bcChannel,to(t),this);}},this._updateHandler=(e,t)=>{if(t!==this){const t=Qs();io(t,0),((e,t)=>{io(e,2),co(e,t);})(t,e),Rd(this,to(t));}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:e,updated:t,removed:a},n)=>{const r=e.concat(t).concat(a),s=Qs();io(s,1),co(s,Cd(i,r)),Rd(this,to(s));},this._exitHandler=()=>{xd(this.awareness,[a.clientID],"app closed");},ol&&void 0!==ks&&ks.on("exit",this._exitHandler),i.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval((()=>{this.wsconnected&&3e4<Wo()-this.wsLastMessageReceived&&Fd(this,this.ws,null);}),3e3),n&&this.connect();}get url(){const e=(e=>((e,t)=>{const a=[];for(const n in e)a.push(t(e[n],n));return a})(e,((e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`)).join("&"))(this.params);return this.serverUrl+"/"+this.roomname+(0===e.length?"":"?"+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]));}destroy(){0!==this._resyncInterval&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),ol&&void 0!==ks&&ks.off("exit",this._exitHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy();}connectBc(){if(this.disableBc)return;var e,t;this.bcconnected||(e=this.bcChannel,t=this._bcSubscriber,vd(e).subs.add(t),this.bcconnected=true);const a=Qs();io(a,0),_d(a,this.doc),wd(this.bcChannel,to(a),this);const n=Qs();io(n,0),Ad(n,this.doc),wd(this.bcChannel,to(n),this);const i=Qs();io(i,3),wd(this.bcChannel,to(i),this);const r=Qs();io(r,1),co(r,Cd(this.awareness,[this.doc.clientID])),wd(this.bcChannel,to(r),this);}disconnectBc(){const e=Qs();io(e,1),co(e,Cd(this.awareness,[this.doc.clientID],new Map)),Rd(this,to(e)),this.bcconnected&&(((e,t)=>{const a=vd(e),n=a.subs.delete(t);n&&0===a.subs.size&&(a.bc.close(),gd.delete(e));})(this.bcChannel,this._bcSubscriber),this.bcconnected=false);}disconnect(){this.shouldConnect=false,this.disconnectBc(),null!==this.ws&&Fd(this,this.ws,null);}connect(){this.shouldConnect=true,this.wsconnected||null!==this.ws||(Dd(this),this.connectBc());}}class Pd extends Hl{}class Bd{apiClient;collabDocument;yWebsocketProvider;item;awareness;users=[];avatars=new Map;constructor(e){this.apiClient=e,this.collabDocument=new Pd;}isActive(){return void 0!==this.yWebsocketProvider}getAwarenessStates(){return this.awareness?this.awareness.getStates():new Map}getUsersList(){return this.users}_getUser(e){for(const t of this.users)if(e===t.key)return t;return null}getLocalState(){if(!this.awareness)throw new Error("No awareness available. Cannot get state field.");return this.awareness.getLocalState()}setLocalStateField(e,t){if(!this.awareness)throw new Error("No awareness available. Cannot set state field.");this.awareness.setLocalStateField(e,t);}async _updateUsersList(){const e=this.getAwarenessStates(),t=await this.apiClient.me(true);for(const[a,n]of e.entries()){if(!this._getUser(a)){let e=this.avatars.get(n.user.id);if(!e){e=(await this.apiClient.getAvatar(n.user.id,32)).avatar,this.avatars.set(n.user.id,e);}this.users.push({key:a,id:n.user.id,name:n.user.name,color:n.user.color,avatar:e,itsMe:n.user.id===t._id});}}const a=[];for(const t of this.users)e.has(t.key)&&a.push(t);this.users=a;}async startCollaboration(e){try{if(!this.apiClient.isDevOrLocalhost())return !1;this.endCollaboration(),this.item=e;const t=this.apiClient.getCollabUrl(),a=`${this.item.type}.${this.item._id}`;let n=1e3;this.yWebsocketProvider=new Ld(t,a,this.collabDocument,{connect:!1}),this.yWebsocketProvider.on("status",(e=>{console.log(`[Collab] ${e.status}`),"disconnected"===e.status&&this.yWebsocketProvider&&(this.yWebsocketProvider.disconnect(),setTimeout(r,n));})),this.yWebsocketProvider.on("sync",(e=>{console.log(`[Collab] synced: ${e}`);})),this.awareness=this.yWebsocketProvider.awareness,this.awareness.on("change",(async e=>{await this._updateUsersList(),l$1.$emit("collab:awareness:changed",{users:this.users,states:this.getAwarenessStates(),changes:e});}));const i=await this.apiClient.me(!0);this.awareness.setLocalStateField("user",{id:i._id,name:i.name,color:p.colorFromString(i.name)});const r=async()=>{if(!this.yWebsocketProvider)return void console.warn("[Collab] Cannot connect without websocket provider!");console.log("[Collab] reconnecting...");const e=await this.apiClient.getCollabToken();this.yWebsocketProvider.params.token=e,this.yWebsocketProvider.connect();};return await r(),l$1.$emit("collab:started"),!0}catch(e){return console.error("Error starting collaboration: ",e),false}}endCollaboration(){this.yWebsocketProvider&&(console.log("Ending collaboration."),l$1.$emit("collab:ended"),this.yWebsocketProvider.destroy(),this.yWebsocketProvider=void 0,this.awareness=void 0),this.collabDocument=new Pd,this.item=void 0;}}class Od{apiClient;constructor(e){this.apiClient=e;}async testCopyItems(e,t){const a=await this.apiClient.getItemsInFolderList(t,true),n=await this.apiClient.getFoldersInFolderList(t),i=new Map;for(const e of n.children)i.set(e.name,null);for(const e of a)i.set(e.name,e._id);const r=this.apiClient.getItemRepo(),s=[];for(const t of e){let e,a,n=false;t.isFolder?a=await this.apiClient.getFolder(t._id):(a=r.getLoadedItem(t._id),a||(a=await this.apiClient.getItem(t._id))),e=a?.name,n=i.has(e),s.push({_id:t._id,isFolder:t.isFolder,data:a,name:e,conflicted:n,conflictedItemId:i.get(e)});}return s}async copyItems(e,t,a=false,n=false){const i=e.filter((e=>!e.isFolder)).map((e=>e._id)),r=await this.apiClient.copyItems(i,t,a,n),s=this.apiClient.getItemRepo();for(let t of r){const a=e.filter((e=>e._id===t.original));a.length>0&&(t.replaced=a[0].conflictedItemId),await s.replaceLink(t.original,t.clone);}return await this.apiClient.eventBus.$emit("folder:changed",t),await this.apiClient.eventBus.$emit("items:copied",r),r}}class $d{apiClient;jobManager;constructor(e){this.apiClient=e,this.jobManager=e.getJobManager();}async executeExport(e,t,a,n){const i=await this.jobManager.execute("EXPORT:ExportGame",[{_id:e,isFolder:false}],[{name:"Destination Folder",value:a},{name:"EngineVersion",value:n}],void 0,{os:t});if(await this.apiClient.eventBus.$emit("quota:update"),2===i.state)throw new N$1("Export failed: "+i.error);await this.apiClient.eventBus.$emit("folder:changed",[a]);}}(axiosRetry.default?axiosRetry.default:axiosRetry)(axios,{retries:3,retryCondition:e=>e.message.includes("net::ERR_NETWORK_CHANGED")});const Ud={Draft:0,Private:1,NotListed:2,Public:3},jd=[{id:"prod",name:"Production",ssl:true,apiHost:"api.lumino.cloud",viewerHost:"viewer.lumino.cloud",collabHost:"collab.lumino.cloud"},{id:"dev",name:"Development",ssl:true,apiHost:"api-dev.lumino.cloud",viewerHost:"viewer-dev.lumino.cloud",collabHost:"collab-dev.lumino.cloud"},{id:"local",name:"Local",ssl:false,apiHost:"localhost:8081",viewerHost:"localhost:8090",collabHost:"localhost:8200"}];class zd extends o$1{accessToken;apiToken;options;forcePublicApi;usePublicApi;usePersistentStorage;storageSizeMib;requestClientId;apiUrl;wsUrl;viewerUrl;collabUrl;itemRepo;itemCache;folderCache;thumbCache;userCache;groupCache;attachmentCache;jobManager;serializer;collab;itemCopier;executableExporter;eventBus;env;api;ws=null;cachedMe;profiler;wsLastPing=null;last2faCode="";constructor(e={}){super(),e=e||{},this.options=Object.assign({environment:"auto",wsAutoReconnect:true,wsAutoConnect:false,forcePublicApi:false,debug:false,accessToken:null,apiToken:null,usePersistentStorage:true,storageSizeMib:10240,requestClientId:null,withCollaboration:false},e),this.accessToken=this.options.accessToken,this.apiToken=this.options.apiToken,this.forcePublicApi=this.options.forcePublicApi,this.usePublicApi=!this.accessToken&&!this.apiToken,this.usePersistentStorage=this.options.usePersistentStorage,this.storageSizeMib=this.options.storageSizeMib,this.requestClientId=this.options.requestClientId,this.cachedMe=null,this.itemRepo=new qi(this.usePublicApi,this),this.itemCache=new Or(this.usePublicApi,this.usePersistentStorage,this,this.storageSizeMib),this.folderCache=new $r(this),this.thumbCache=new Ur(this),this.userCache=new jr(this),this.groupCache=new zr(this),this.attachmentCache=new Wr(this),this.jobManager=new Gr(this),this.serializer=new Qr(this),this.itemCopier=new Od(this),this.executableExporter=new $d(this),this.eventBus=l$1,this.profiler=null,this.options.withCollaboration&&(this.collab=new Bd(this)),this.switchEnvironment(this.options.environment),this.setDebugMode(this.options.debug);}detectEnvironment(){const e=this.isOnLocalhost(),t=this.isDevPlatform();return e?this.getEnvironmentById("local"):t?this.getEnvironmentById("dev"):this.getEnvironmentById("prod")}getEnvironmentById(e){return "auto"===e?this.detectEnvironment():jd.find((t=>t.id===e))}getEnvironments(){return jd}switchEnvironment(e){let a=this.getEnvironmentById(e);if(!a)throw new Error(`Unknown environment: ${e}`);console.log(`ApiClient switched to env: ${a.name}`);const n=a.ssl?"https":"http",i=a.ssl?"wss":"ws";this.apiUrl=`${n}://${a.apiHost}`,this.wsUrl=`${i}://${a.apiHost}/api/ws`,this.viewerUrl=`${n}://${a.viewerHost}`,this.collabUrl=`${n}://${a.collabHost}`,this.api=axios.create({baseURL:this.apiUrl}),this.ws=null,this.wsLastPing=null;}async initCaches(){return Promise.all([this.itemCache.init(),this.folderCache.init(),this.thumbCache.init()])}clearCaches(){this.itemCache.clear(),this.folderCache.clear(),this.thumbCache.clear();}isDevPlatform(){return "object"==typeof window&&"location"in window&&(window.location.href.includes("dev.lumino.cloud")||window.location.href.includes("taste.lemonate.io"))}isOnLocalhost(){return "object"==typeof window&&"location"in window&&window.location.href.includes("localhost")}isDevOrLocalhost(){return this.isOnLocalhost()||this.isDevPlatform()}async clearIndexedDb(e){return new Promise(((t,a)=>{const n=indexedDB.deleteDatabase(e);n.onsuccess=()=>{t();},n.onerror=e=>{a("An error occured while deleting a IndexedDB database.");},n.onblocked=()=>{a(`Database deletion is blocked. Please close all connections to "${e}".`);};}))}async logout(){return this.clearCaches(),this.clearIndexedDb("lumino")}setDebugMode(e){this.options.debug=!!e,this.eventBus.setDebugMode(this.options.debug);}websocketConnect(e){const t=this;if(this.ws){if(!e)return void console.warn("Websocket is already connected!");this.websocketDisconnect();}this.ws=new n$2(this.wsUrl),this.ws.onerror=function(e){console.error("Websocket error",e),t.$emit("client:websocketError",e);},this.ws.onopen=function(){t.$emit("client:websocketOpen"),t.accessToken&&t.websocketSend(JSON.stringify({type:"auth",subscriptions:["item","folder","job","user","notification"],token:t.accessToken}));},this.ws.onclose=function(){t.$emit("client:websocketClosed"),t.options.wsAutoReconnect&&t.websocketConnect(true);},this.ws.onmessage=function(e){try{const a=JSON.parse(e.data);switch(a.type){case "ping":t.wsLastPing=new Date,t.ws&&t.ws.send(JSON.stringify({type:"ping"}));break;case "authenticated":t.$emit("client:websocketAuthenticated");break;case "Item":case "Folder":case "Notification":case "Job":case "User":l$1.$emit("client:elementUpdate",a);break;default:console.warn("Unknown websocket message: ",a);}}catch(e){console.error("Websocket error:",e);}};}websocketDisconnect(){this.ws&&(this.ws.close(),this.ws=null);}websocketSend(e){this.ws?1===this.ws.readyState?this.ws.send(e):console.error("Websocket is not in READY state. Currently in state "+this.ws.readyState):console.error("Websocket is not created");}getItemCopier(){return this.itemCopier}getExecutableExporter(){return this.executableExporter}getCollab(){return this.collab}getCollabUrl(){return this.collabUrl}getPublisher(){return new Yr(this)}getAssetCreator(){return new Xr(this)}getJobManager(){return this.jobManager}getThumbCache(){return this.thumbCache}getItemCache(){return this.itemCache}getItemRepo(){return this.itemRepo}getRootVisibility(){return this.itemRepo.activeItem?this.itemRepo.activeItem.visibility:Ud.Private}getEventBus(){return this.eventBus}getSerializer(){return this.serializer}setForcePublicApi(e){this.forcePublicApi=e,this._updateUsePublicApi();}_updateUsePublicApi(){this.usePublicApi=this.forcePublicApi||!this.apiToken&&!this.accessToken,this.itemRepo.usePublicApi=this.usePublicApi,this.itemCache.usePublicApi=this.usePublicApi;}setApiToken(e){this.apiToken=e,this._updateUsePublicApi();}setAccessToken(e){this.accessToken=e,this._updateUsePublicApi(),this.accessToken&&this.options.wsAutoConnect&&this.websocketConnect();}getApiToken(){return this.apiToken}getAccessToken(){return this.accessToken}setApiBaseUrl(e){this.apiUrl=e,this.api=axios.create({baseURL:this.apiUrl});}setWsBaseUrl(e){this.wsUrl=e,this.accessToken&&this.options.wsAutoConnect&&(this.websocketDisconnect(),this.websocketConnect());}setRequestClientId(e){this.requestClientId=e;}getApiBaseUrl(){return this.apiUrl}getWsBaseUrl(){return this.wsUrl}getViewerBaseUrl(){return this.viewerUrl}setProfiler(e){if(!e||"function"!=typeof e.start)throw new Error("Profiler needs to be an object providing a start function.");this.profiler=e;}async login2FA(e,t,a){return console.log("Running Login..."),this.execute("post","/api/auth/login2fa",{account:e,password:t,client:a}).then((e=>{this.last2faCode=e,this.eventBus.$emit("login.2facode",e);}))}async confirm2FA(e,t){return this.execute("post","/api/auth/confirm2fa",{account:e,code:t})}isAuthenticated(){return !!this.accessToken||!!this.apiToken}isFeatureEnabled(e){return !!this.cachedMe&&this.cachedMe.features.includes(e)}async resolveUserOrGroupInfoForItem(e){return e.quotaUser?this.userCache.resolve(e.quotaUser):e.quotaGroup?this.groupCache.resolve(e.quotaGroup):e.createdBy?this.userCache.resolve(e.createdBy):{name:"?",initials:"?",avatar:null}}_startOp(e){const t=this,a={id:p.createGUID(),name:e,startTimeMs:performance.now(),runningMs:0,percent:0,reportProgress:function(e){a.percent=e;},interval:null,finish:function(){if(a.interval&&clearInterval(a.interval),a.runningMs>1e3)try{t.$emit("client:longRunningOpFinished",a.id);}catch(e){console.error(e);}}};return a.interval=setInterval((function(){if(a.runningMs=performance.now()-a.startTimeMs,a.runningMs>1e3)try{t.$emit("client:longRunningOp",a.id,a.name,a.percent);}catch(e){console.error(e);}}),100),a}_createOpName(e,t){try{const a=t.split("/");switch(e.toLowerCase()){case "get":e="Fetching";break;case "post":e="Creating";break;case "put":e="Updating";break;case "delete":e="Deleting";}a.shift(),a.shift();const n=a.shift();let i=a.join("/");return i.length&&(i=` [${i}]`),`${e} ${n} data ${i}`}catch{return `${e} ${t}`}}addAuthenticationHeaders(e){this.accessToken&&(e["x-access-token"]=this.accessToken),this.apiToken&&(e["x-api-token"]=this.apiToken),this.requestClientId&&(e["x-request-client"]=this.requestClientId);}async execute(e,t,a,n){let i=this,r={};(n=n||{}).headers?r=n.headers:a&&"object"==typeof a&&"getHeaders"in a&&"function"==typeof a.getHeaders&&(r=a.getHeaders()),this.addAuthenticationHeaders(r);const s=this.profiler?this.profiler.start("ApiClient",`${e} ${t}`):null,o=this._startOp(n.opName||i._createOpName(e,t));return this.api({method:e,url:t,data:a,responseType:n.responseType,headers:r,signal:n.controller?n.controller.signal:void 0,onUploadProgress:function(e){if(e.total){const t=Math.min(100,Math.round(100*e.loaded/e.total));o.reportProgress(t),i.$emit("client:progress",{type:"upload",percent:t}),"function"==typeof n.progressCallback&&n.progressCallback(t,e.loaded,e.total);}},onDownloadProgress:function(e){if(e.total){const t=Math.min(100,Math.round(100*e.loaded/e.total));o.reportProgress(t),i.$emit("client:progress",{type:"download",percent:t}),"function"==typeof n.progressCallback&&n.progressCallback(t,e.loaded,e.total);}}}).then((e=>{if(s&&s.done(),o.finish(),i.$emit("client:progress",{type:"done"}),e.headers["content-type"].startsWith("application/json")){if("success"===e.data.result){let t;return t=n.withNext?{data:e.data.data,next:e.data.next}:e.data.data,n.emitOnSuccess&&this.eventBus.$emit(n.emitOnSuccess,t),t}throw e.data.redirect&&this.$emit("client:redirect",e.data.redirect),e.data.error?e.data.error:"API response seems to be json but does not contain result type!"}return n.emitOnSuccess&&this.eventBus.$emit(n.emitOnSuccess),{blob:new Blob([e.data],{type:e.headers["content-type"]}),hash:e.headers["sha256-hash"],itemName:e.headers["lumino-itemname"],itemType:e.headers["lumino-itemtype"],mimeType:e.headers["content-type"]}})).catch((e=>{if(s&&s.done(),o.finish(),i.$emit("client:progress",{type:"done"}),e.response){if(401===e.response.status)throw this.$emit("client:unauthorized"),new x$2("Access denied. Please login again.");if(413===e.response.status)throw new M;if(e.response.data&&e.response.data.error)throw new Error(e.response.data.error)}throw e}))}_createFormData(e,t){let a=new i$3;if("function"==typeof File&&e instanceof Blob)a.append("file",e,t);else {const n=new Blob([e]);try{a.append("file",n,t);}catch{a=new i$3,a.append("file",e,t);}}return a}async me(e){return e&&this.cachedMe||(this.cachedMe=await this.execute("get","/api/auth/me")),this.cachedMe}async getHomeFolder(){return this.execute("get","/api/auth/homefolder")}async myClients(){return this.execute("get","/api/auth/myclients")}async getCollabToken(){return this.execute("get","/api/auth/collabtoken")}async checkCollabToken(e){return this.execute("post","/api/auth/collabtoken",{token:e})}async register(e){return this.execute("post","/api/auth/register",e)}async deleteMyAccount(e){return this.execute("post","/api/auth/deletemyaccount",{password:e})}async confirmEmail(e){return this.execute("get","/api/auth/confirmemail/"+e)}async confirmEmailChange(e){return this.execute("get","/api/auth/confirmchangedemail/"+e)}async forgotPassword(e,t){return this.execute("post","/api/auth/forgotpassword",{account:e,client:t})}async setNewPassword(e,t){return this.execute("post","/api/auth/setnewpassword",{token:e,password:t})}async accountExists(e){return this.execute("post","/api/auth/accountExists",e)}async getItemsInFolderList(e,t=false){if(e&&!t){const t=await this.folderCache.getItemListing(e);if(t)return t}const a=await this.execute("get","/api/item/infolder/"+(e||"0"));return await this.folderCache.addItemListing(e,a),a}async getItem(e,t){const a=[];t&&(t.returnClonedFrom&&a.push("returnClonedFrom=true"),t.withThumbnails&&a.push("withThumbnails=true"));let n="";return a.length&&(n=`?${a.join("&")}`),this.execute("get",`/api/item/${e}${n}`)}getItemAggregatedPOP(e,t){return this.usePublicApi?this.getItemPublicAggregated(e,t):this.getItemAggregated(e,t)}async getItemPublicAggregated(e,t){const a=Bi(e);if(a)return a;const n=[];t&&(t.withFieldInstances&&n.push("withFieldInstances"),t.withAttachmentInfo&&n.push("withAttachmentInfo"),t.noAttributes&&n.push("noAttributes"),t.noUserAttributes&&n.push("noUserAttributes"),t.noFields&&n.push("noFields"),t.noThumbnails&&n.push("noThumbnails"),t.noLinks&&n.push("noLinks"));let i="";return n.length&&(i=`?${n.join("&")}`),Bi(e)?Bi(e):this.execute("get","/api/item/publicaggregate/"+e+i)}async getItemAggregated(e,t){const a=Bi(e);if(a)return a;const n=[];t&&(t.withFieldInstances&&n.push("withFieldInstances"),t.withAttachmentInfo&&n.push("withAttachmentInfo"),t.noAttributes&&n.push("noAttributes"),t.noUserAttributes&&n.push("noUserAttributes"),t.noFields&&n.push("noFields"),t.noThumbnails&&n.push("noThumbnails"),t.noLinks&&n.push("noLinks"));let i="";return n.length&&(i=`?${n.join("&")}`),Bi(e)?Bi(e):this.execute("get",`/api/item/aggregate/${e}${i}`)}async getItemAggregatedRecursive(e,t){const a=[];t&&(t.withFieldInstances&&a.push("withFieldInstances"),t.withAttachmentInfo&&a.push("withAttachmentInfo"),t.noAttributes&&a.push("noAttributes"),t.noUserAttributes&&a.push("noUserAttributes"),t.noFields&&a.push("noFields"),t.noThumbnails&&a.push("noThumbnails"));let n="";return a.length&&(n=`?${a.join("&")}`),this.execute("get",`/api/item/aggregaterecursive/${e}${n}`)}async getItemPublicRecursive(e,t){return this.execute("get","/api/item/publicrecursive/"+e+(t?"?withFeatures":""))}async getItemPublic(e,t){return this.execute("get","/api/item/public/"+e+(t?"?returnClonedFrom=true":""))}async getItemHistory(e){return this.execute("get","/api/item/history/"+e)}async copyItems(e,t,a,n){return this.execute("post","/api/item/copy",{sourceItemIds:e,destFolderId:t,deepCopy:a,overwrite:n})}async createItem(e){return this.execute("post","/api/item",e)}async updateItem(e){return this.execute("put","/api/item",e)}async deleteItem(e){return this.execute("delete","/api/item",{id:e})}async renameItem(e,t){return this.updateItem({_id:e,name:t})}async queryPublicItemsList(e){return this.execute("post","/api/item/publicquery",e)}async queryItemsListPOP(e){return this.usePublicApi?this.queryPublicItemsList(e):this.queryItemsList(e)}async queryItemsList(e){return this.execute("post","/api/item/query",e)}async queryItemsListAsExcel(e){e.exportAsExcel=true;const t=await this.execute("post","/api/item/query",e,{responseType:"arraybuffer"}),a=window.URL.createObjectURL(t.blob),n=document.createElement("a");n.href=a,n.setAttribute("download","export.xlsx"),n.click();}async moveItems(e){return this.execute("post","/api/item/move",e)}async downloadItem(e,t){const a=Ei(e);return a||this.execute("get",`/api/item/download/${e}`,null,{responseType:"arraybuffer",progressCallback:t,opName:`Downloading item ${e}`})}async publicDownloadItem(e,t){const a=Ei(e);return a||this.execute("get",`/api/item/publicdownload/${e}`,null,{responseType:"arraybuffer",progressCallback:t})}async getItemHash(e){const t=Bi(e);return t?t.hash:this.execute("get",`/api/item/hash/${e}`)}async requestSecureDownload(e){return this.execute("get","/api/item/requestsecuredownload/"+e)}async getThumbnail(e,t){return this.execute("get",`/api/item/thumbnail/${e}/${t}`)}async uploadThumbnail(e,t,a,n,i,r){const s=this._createFormData(a,n);return this.execute("post",`/api/item/thumbnail/${t}/${e}`,s,{progressCallback:i,controller:r})}async getPublicThumbnail(e,t){return this.execute("get",`/api/item/publicthumbnail/${e}/${t}`)}async makeItemPublic(e,t,a){return this.execute("put","/api/item/makepublic",{id:e,recursive:t,inSubfolders:a})}async setVisibility(e,t,a,n){return this.execute("put","/api/item/setvisibility",{id:e,visibility:t,recursive:a,inSubfolders:n})}async makeItemPrivate(e,t,a){return this.execute("put","/api/item/makeprivate",{id:e,recursive:t,inSubfolders:a})}async setOmitLodGeneration(e,t){return this.execute("get",`/api/item/setOmitLodGeneration/${e}/${t}`)}async setOmitThumbnailGeneration(e,t){return this.execute("get",`/api/item/setOmitThumbnailGeneration/${e}/${t}`)}async setOmitPreviewGeneration(e,t){return this.execute("get",`/api/item/setOmitPreviewGeneration/${e}/${t}`)}async uploadAndCreate(e,t,a,n,i,r){const s=this._createFormData(t,a);let o=`/api/item/uploadAndCreate/${e}`,l={};return n&&("object"==typeof n?(n.autoDestructIn&&(o+="?autoDestructIn="+n.autoDestructIn),n.visibility&&(o+="?visibility="+n.visibility),n.flags&&(o+="?flags="+n.flags),n.overwrite&&(o+="?overwrite="+(n.overwrite?"true":"false")),n.nameOverride&&(l["x-override-name"]=n.nameOverride)):o+="?autoDestructIn="+n),this.execute("post",o,s,{progressCallback:i,controller:r,headers:l})}async upload(e,t,a,n,i,r){const s=[];r&&(r.omitHandleDependencyChange&&s.push("omitHandleDependencyChange=true"),r.keepThumbnails&&s.push("keepThumbnails=true"));let o="";s.length&&(o=`?${s.join("&")}`);const l=this._createFormData(t,a);return this.execute("post",`/api/item/upload/${e}${o}`,l,{progressCallback:n,controller:i})}resetPreview(e){const t=this.execute("delete",`/api/item/attachment/${e}/preview`),a=this.execute("get",`/api/item/setOmitPreviewGeneration/${e}/false`);return Promise.all([t,a])}clearPreview(e){const t=this.execute("delete",`/api/item/attachment/${e}/preview`),a=this.execute("get",`/api/item/setOmitPreviewGeneration/${e}/true`);return Promise.all([t,a])}async clearThumbnail(e){return this.execute("get",`/api/item/clearThumbnail/${e}`)}async resetThumbnail(e){return this.execute("get",`/api/item/resetThumbnail/${e}`)}async downloadAttachmentPOP(e,t,a,n,i){return this.usePublicApi?this.downloadPublicAttachment(e,t,a,n,i):this.downloadAttachment(e,t,a,n,i)}_getAttachmentUrlPath(e,t,a,n,i){return `/api/item/${i?"public":""}attachment/${e}/${t}${null!=a?`/${a}`:"/undefined"}${null!=n?`/${n}`:""}`}async downloadAttachment(e,t,a,n=0,i){const r=zi(e,t,a,n);return r||this.execute("get",this._getAttachmentUrlPath(e,t,a,n),null,{responseType:"arraybuffer",progressCallback:i})}async downloadPublicAttachment(e,t,a,n,i){const r=zi(e,t,a,n);return r||this.execute("get",this._getAttachmentUrlPath(e,t,a,n,true),null,{responseType:"arraybuffer",progressCallback:i})}async uploadAttachment(e,t,a,n,i,r,s,o){const l=this._createFormData(i,r);return this.execute("post",this._getAttachmentUrlPath(e,t,a,n),l,{progressCallback:s,controller:o})}async deleteAttachment(e,t,a,n){return this.attachmentCache.invalidateAttachment(e,t,a,n),this.execute("delete",this._getAttachmentUrlPath(e,t,a,n))}setPerceptiveHashOnAttachment(e,t,a){return this.execute("get",`/api/item/setPerceptiveHashAttachment/${e}/${t}/${a}`)}setPerceptiveHash(e,t){return this.execute("get",`/api/item/setPerceptiveHash/${e}/${t}`)}async getItemClient(e){return this.execute("get",`/api/item/getClient/${e}`)}async getItemAcl(e){return this.execute("get",`/api/item/acl/${e}`)}async getItemsLinking(e){return this.execute("get",`/api/item/linking/${e}`)}async setAttributes(e,t){return this.execute("put","/api/item/setAttributes",{id:e,attributes:t})}async getItemSyncList(e){const t=U(e).format("YYYYMMDDHHmmss");return this.execute("get",`/api/item/synclist/${t}`)}async increaseViews(e){return this.execute("get",`/api/item/increaseViews/${e}`)}async getViews(e){return this.execute("get",`/api/item/views/${e}`)}async getPublicItemCounts(e){return this.execute("get",`/api/item/publiccounts/${e}`)}async getItemCounts(e){return this.execute("get",`/api/item/counts/${e}`)}async likeItem(e){return this.execute("get",`/api/item/like/${e}`)}async unlikeItem(e){return this.execute("get",`/api/item/unlike/${e}`)}async doILike(e){return this.execute("get",`/api/item/doILike/${e}`)}async setItemAutoDestruct(e,t){const a=U(t).format("YYYYMMDDHHmmss");return this.execute("get",`/api/item/setAutoDestruct/${e}/${a}`)}async clearItemAutoDestruct(e){return this.execute("get",`/api/item/clearAutoDestruct/${e}`)}async resolveRelativeItem(e,t){const a=Bi(e);if(!a)return this.execute("post","/api/item/resolve/"+e,{path:t});t.startsWith("/")&&(t=t.substring(1));const n=t.split("/"),i=n.pop();let r=a.folder._id;for(const e of n){let t=false;for(const[a,n]of Object.entries(Fi()))if(n.parent===r&&n.name===e){r=a,t=true;break}if(!t)break}for(const e of Object.values(Pi()))if(e.folder._id===r&&e.name===i)return e._id;return console.error(`Could not resolve path ${t} for item ${e}`),null}async publicResolveRelativeItem(e,t){const a=Bi(e);if(!a)return this.execute("post","/api/item/publicResolve/"+e,{path:t});t.startsWith("/")&&(t=t.substring(1));const n=t.split("/"),i=n.pop();let r=Di(a.folder._id);for(const e of n)if(".."===e)r=Di(r.parent);else {const t=Ri(e,r._id);if(!t)throw new Error("Can't find folder while loading folder from package");r=t;}const s=Li(i,r._id);if(s)return s._id;throw new Error("Can't load item from package.")}async rewireItems(e){return this.execute("post","/api/item/rewire",{items:e})}async getFolder(e){return this.execute("get","/api/folder/"+e)}async getFullFolderTree(e){return this.execute("get",`/api/folder/fulltree/${e||"0"}`)}async getFoldersInFolderList(e,t){e=e||"0";const a=[];let n="";if(t){if(t.resolveNames&&!t.folderAsItemType&&"0"!==e){if(n=await this.folderCache.getFolderListing(e),n&&Date.now()-new Date(n.cachedAt).getTime()<1e4)return n;n&&n.parent&&a.push(`lastUpdatedAt=${n.parent.updatedAt}`);}t.resolveNames&&a.push("resolve"),t.folderAsItemType&&a.push(`folderAsItemType=${t.folderAsItemType}`),t.folderAsItemName&&a.push(`folderAsItemName=${t.folderAsItemName}`),t.folderAsItemFlag&&a.push(`folderAsItemFlag=${t.folderAsItemFlag}`),t.withStats&&a.push("withStats=true"),t.returnLatestPackage&&a.push("returnLatestPackage=true");}let i="";a.length&&(i="?"+a.join("&"));const r=await this.execute("get",`/api/folder/infolder/${e}${i}`);if(true===r.notModified)return n;if(!t||t.resolveNames&&!t.folderAsItemType){const t=await this.getFolderAclList([e,...r.children.map((e=>e._id))]);for(const e of t)await this.folderCache.addACL(e.id,e.acl);return await this.folderCache.addFolderListing(e,r),r}return r}async updateFolderCache(e){const t=[];for(const a of e){if(!a)continue;const e=await this.folderCache.getFolderListing(a);e&&e.parent?t.push({id:a,lastUpdatedAt:e.parent.updatedAt}):t.push({id:a});}const a=await this.execute("post","/api/folder/infolderquery",{folders:t});for(const e of a) true===e.data.notModified?await this.folderCache.refreshCacheForFolder(e.id):await this.folderCache.addFolderListing(e.id,e.data);}async createFolder(e){return this.execute("post","/api/folder",e)}async updateFolder(e){return this.execute("put","/api/folder",e)}async deleteFolder(e){return this.execute("delete","/api/folder",{id:e})}async renameFolder(e,t){return this.updateFolder({_id:e,name:t})}async moveFolders(e){return this.execute("post","/api/folder/move",e)}async getFolderPath(e){return e?("object"==typeof e&&(e=e._id),this.execute("get","/api/folder/path/"+e)):{path:"/",elements:[]}}async resolveFolderPath(e){return "/"===(e=e.trim())?null:this.execute("post","/api/folder/resolve",{path:e})}async getFolderClient(e){return this.execute("get",`/api/folder/getClient/${e}`)}async getFolderAcl(e){const t=await this.folderCache.getFolderACLs(e||"0",1e4);if(t&&e)return t;{const t=await this.execute("get",`/api/folder/acl/${e||"0"}`);return await this.folderCache.addACL(e||"0",t),t}}async getFolderAclList(e){return this.execute("post","/api/folder/aclquery",{ids:e})}async getUser(e){return this.execute("get","/api/user/"+e)}async getUsersList(){return this.execute("get","/api/user")}async createUser(e){return this.execute("post","/api/user",e)}async queryUser(e,t,a){return this.execute("post","/api/user/query",{searchQuery:e,groupID:t,cursor:a},{withNext:true})}async updateUser(e){return this.execute("put","/api/user",e)}async deleteUser(e){return this.execute("delete","/api/user",{id:e})}async updateMyProfile(e){return this.execute("put","/api/user/myprofile",e)}async switchClient(e){return this.execute("get",`/api/user/switchclient/${e}`)}async activateUser(e,t){return this.execute("post","/api/user/activate",{token:t,password:e})}async getUsersToApprove(){return this.execute("get","/api/user/approvals")}async approveUserRegistration(e){return this.execute("get",`/api/user/approveuserregistration/${e}`)}async rejectUserRegistration(e){return this.execute("get",`/api/user/rejectuserregistration/${e}`)}async uploadAvatar(e){const t=new i$3;if(e instanceof Blob)t.append("file",e);else {const a=new Blob([new Uint8Array(e)]);t.append("file",a,"avatar.jpg");}return this.execute("post","/api/user/uploadAvatar",t)}async clearAvatar(){return this.execute("get","/api/user/clearAvatar")}async getAvatar(e,t){return this.execute("get",`/api/user/avatar/${t}/${e}`)}async getUserPublicInfo(e,t,a){return this.execute("get",`/api/user/publicinfo/${e}/${t}/${a}`)}async getUserAttribute(e){return this.execute("get",`/api/user/attribute/${e}`)}async clearUserAttribute(e){return this.execute("delete",`/api/user/attribute/${e}`)}async setUserAttribute(e,t){return this.execute("post",`/api/user/attribute/${e}`,t)}async getGroup(e){return this.execute("get","/api/group/"+e)}async getGroupFolder(e){return this.execute("get","/api/group/folder/"+e)}async getGroupsList(){return this.execute("get","/api/group")}async createGroup(e){return this.execute("post","/api/group",e)}async queryGroup(e,t){return this.execute("post","/api/group/query",{searchQuery:e,cursor:t},{withNext:true})}async updateGroup(e){return this.execute("put","/api/group",e)}async deleteGroup(e){return this.execute("delete","/api/group",{id:e})}async getGroupQuotaInfo(e){return this.execute("get","/api/group/quota/"+e)}async getGroupPublicInfo(e,t,a){return this.execute("get",`/api/group/publicinfo/${e}/${t}/${a}`)}async getGroupUsers(e){return this.execute("get","/api/group/users/"+e)}async uploadGroupAvatar(e,t){const a=new i$3;if(t instanceof Blob)a.append("file",t);else {const e=new Blob([new Uint8Array(t)]);a.append("file",e,"avatar.jpg");}return this.execute("post","/api/group/"+e+"/uploadAvatar",a)}async getClientsList(){return this.execute("get","/api/client")}async getClient(e){return this.execute("get",`/api/client/${e}`)}async createClient(e){return this.execute("post","/api/client",e)}async queryClient(e,t){return this.execute("post","/api/client/query",{searchQuery:e,cursor:t},{withNext:true})}async updateClient(e){return this.execute("put","/api/client",e)}async deleteClient(e){return this.execute("delete","/api/client",{id:e})}async getClientMetrics(e,t,a){return this.execute("get",`/api/client/metrics/${t}/${a}/${e}`)}async joinClient(e){return this.execute("get",`/api/client/join/${e}`)}async leaveClient(e){return this.execute("get",`/api/client/leave/${e}`)}async myClient(){return this.execute("get","/api/client/my")}async saveMyClient(e){return this.execute("put","/api/client/my",e)}async getPublicCategories(e){return this.execute("get",`/api/client/publiccategories/${e}`)}async getCategories(){return this.execute("get","/api/client/categories")}async getCategoriesInClient(e){return this.execute("get",`/api/client/categories/${e}`)}async updateCategoriesInClient(e,t){return this.execute("post",`/api/client/categories/${e}`,t)}async getLicenses(){return this.execute("get","/api/license")}async getLicensesInClient(e){return this.execute("get",`/api/license/inclient/${e}`)}async getLicense(e){return this.execute("get",`/api/license/${e}`)}async createLicense(e){return this.execute("post","/api/license",e)}async updateLicense(e){return this.execute("put","/api/license",e)}async deleteLicense(e,t){return this.execute("delete","/api/license",{_id:e,client:t})}async getPublicLicenses(e){return this.execute("get",`/api/license/publiclist/${e}`)}async getPublicLicense(e){return this.execute("get",`/api/license/public/${e}`)}async getDatatypesList(){return this.execute("get","/api/datatype")}async getPublicDatatypesList(e){return this.execute("get",`/api/datatype/public/${e}`)}async getDatatypesListOnClient(){return this.execute("get","/api/datatype/onclient")}async getDatatypesListOnClientForAll(){return this.execute("get","/api/datatype/onclientforall")}async getAllDatatypesList(){return this.execute("get","/api/datatype/all")}async getDatatype(e){return this.execute("get",`/api/datatype/${e}`)}async createDatatype(e){return this.execute("post","/api/datatype",e)}async updateDatatype(e){return this.execute("put","/api/datatype",e)}async deleteDatatype(e){return this.execute("delete","/api/datatype",{id:e})}async getMyNotifications(e){return this.execute("get","/api/notification"+(e?`?maxCount=${e}`:""))}async markNotificationAsRead(e){return this.execute("get",`/api/notification/markasread/${e}`)}async markAllNotificationsAsRead(){return this.execute("get","/api/notification/markallasread")}async createJob(e){return this.execute("post","/api/job",e,{emitOnSuccess:"job:created"})}async getManualJobTypes(){return this.execute("get","/api/job/manualtypes")}async getManualJobTypesOnClient(){return this.execute("get","/api/job/manualtypes/onclient")}async getManualJobTypesOnClientForAll(){return this.execute("get","/api/job/manualtypes/onclientforall")}async getAllManualJobTypes(){return this.execute("get","/api/job/manualtypes/all")}async getAllManualJobTypesForClient(e){return this.execute("get",`/api/job/manualtypes/all/${e}`)}async getClientJobTypes(){return this.execute("get","/api/job/clientTypes")}async getMyJobs(){return this.execute("get","/api/job/mine")}async getJobs(){return this.execute("get","/api/job")}async getJobsAggregated(){return this.execute("get","/api/job/aggregated")}async getJobsTimeframe(e,t){return this.execute("get",`/api/job/all/${e}/${t}`)}async getJob(e){return this.execute("get",`/api/job/${e}`)}async getJobState(e){return this.execute("get",`/api/job/state/${e}`)}async getAgents(){return this.execute("get","/api/jobagent")}async getAgentsAggregated(){return this.execute("get","/api/jobagent/aggregated")}async enableJobAgent(e){return this.execute("get",`/api/jobagent/enable/${e}`)}async disableJobAgent(e){return this.execute("get",`/api/jobagent/disable/${e}`)}async restartJobAgent(e){return this.execute("get",`/api/jobagent/restart/${e}`)}async getPermissionsList(){return this.execute("get","/api/permission")}async getPlugins(){return this.execute("get","/api/plugin")}async getPlans(){return this.execute("get","/api/plan")}async getPlan(e){return this.execute("get",`/api/plan/${e}`)}async createPlan(e){return this.execute("post","/api/plan",e)}async updatePlan(e){return this.execute("put","/api/plan",e)}async deletePlan(e){return this.execute("delete","/api/plan",{id:e})}async getWorkflows(){return this.execute("get","/api/workflow")}async getWorkflow(e){return this.execute("get",`/api/workflow/${e}`)}async createWorkflow(e){return this.execute("post","/api/workflow",e)}async updateWorkflow(e){return this.execute("put","/api/workflow",e)}async deleteWorkflow(e){return this.execute("delete","/api/workflow",{id:e})}async startWorkflow(e){return this.execute("post","/api/workflow/start",e)}async getAccessTokens(){return this.execute("get","/api/accesstoken")}async getClientAccessTokens(){return this.execute("get","/api/accesstoken/client")}async createAccessToken(e){return this.execute("post","/api/accesstoken",e)}async createClientAccessToken(e){return this.execute("post","/api/accesstoken/client",e)}async deleteAccessToken(e){return this.execute("delete","/api/accesstoken",{id:e})}async deleteClientAccessToken(e){return this.execute("delete","/api/accesstoken/client",{id:e})}async enableAccessToken(e){return this.execute("get",`/api/accesstoken/enable/${e}`)}async disableAccessToken(e){return this.execute("get",`/api/accesstoken/disable/${e}`)}async getApiTokens(){return this.execute("get","/api/apitoken")}async createApiToken(e){return this.execute("post","/api/apitoken",e)}async deleteApiToken(e){return this.execute("delete","/api/apitoken",{id:e})}async getMyClientInvoices(){return this.execute("get","/api/invoice")}async getMyUserInvoices(){return this.execute("get","/api/invoice/my")}async getClientInvoices(e){return this.execute("get",`/api/invoice/client/${e}`)}async downloadInvoice(e,t){const a=await this.execute("get",`/api/invoice/download/${e}`,null,{responseType:"arraybuffer"}),n=window.URL.createObjectURL(a.blob),i=document.createElement("a");i.href=n,i.setAttribute("download",t||"invoice.pdf"),document.body.appendChild(i),i.click();}async regenerateInvoice(e){return this.execute("get",`/api/invoice/regenerate/${e}`)}async getInvoicesForMonth(e,t){return this.execute("get",`/api/invoice/month/${t}/${e}`)}async refundInvoice(e,t,a){return this.execute("post","/api/invoice/refund",{invoice:e,amount:t,reason:a})}async paymentStartCheckout(e,t){return this.execute("post","/api/payment/checkout",{successUrl:e,cancelUrl:t})}async paymentStartUserCheckout(e,t){return this.execute("post","/api/payment/usercheckout",{successUrl:e,cancelUrl:t})}async getSupportedCurrencies(){return this.execute("get","/api/payment/supportedCurrencies")}async getPurchasables(){return this.execute("get","/api/purchasable")}async getPurchasable(e){return this.execute("get",`/api/purchasable/${e}`)}async createPurchasable(e){return this.execute("post","/api/purchasable",e)}async updatePurchasable(e){return this.execute("put","/api/purchasable",e)}async deletePurchasable(e){return this.execute("delete","/api/purchasable",{id:e})}async getPublicPurchasables(e){return this.execute("get",`/api/purchasable/public/${e}`)}async getPurchases(){return this.execute("get","/api/purchase")}async getMyActivePurchases(){return this.execute("get","/api/purchase/active")}async purchase(e){return this.execute("post","/api/purchase",e)}async changePurchaseProduct(e,t,a){return this.execute("post","/api/purchase/change",{purchaseID:e,purchasableID:t,optionID:a})}async cancelPurchase(e){return this.execute("delete","/api/purchase",{id:e})}async uncancelPurchase(e){return this.execute("post","/api/purchase/uncancel",{id:e})}async getSecureSessionPayload(e,t){return this.execute("get","/api/payment/secureSessionPayload?purchasableID="+e+"&optionID="+t)}async queryPurchases(e,t,a,n,i,r){return this.execute("post","/api/purchase/query",{startDate:e,endDate:t,email:a,invoice:n,cursor:i,limit:r})}async getAttributeTemplates(){return this.execute("get","/api/attributetemplate")}async getAttributeTemplate(e){return this.execute("get",`/api/attributetemplate/${e}`)}async createAttributeTemplate(e){return this.execute("post","/api/attributetemplate",e)}async updateAttributeTemplate(e){return this.execute("put","/api/attributetemplate",e)}async deleteAttributeTemplate(e){return this.execute("delete","/api/attributetemplate",{id:e})}async getStorages(){return this.execute("get","/api/storage")}async getConversation(e){return this.execute("get",`/api/conversation/${e}`)}async getPublicConversation(e){return this.execute("get",`/api/conversation/public/${e}`)}async createConversation(e,t){return this.execute("post","/api/conversation",{parentId:e,parentType:t})}async postConversationMessage(e,t,a){return this.execute("post","/api/conversation/post",{id:e,text:t,replyTo:a})}async editConversationMessage(e,t){return this.execute("put","/api/conversation/post",{id:e,text:t})}async deleteConversationMessage(e){return this.execute("delete","/api/conversation/post",{id:e})}async subscribeToConversation(e){return this.execute("post","/api/conversation/subscribe",{id:e})}async unsubscribeFromConversation(e){return this.execute("post","/api/conversation/unsubscribe",{id:e})}async likeConversationEntry(e){return this.execute("post","/api/conversation/like",{id:e})}async unlikeConversationEntry(e){return this.execute("post","/api/conversation/unlike",{id:e})}async command(e){return this.execute("post","/api/command",e)}async getMailTemplates(){return this.execute("get","/api/mailtemplate")}async getMailTemplate(e){return this.execute("get",`/api/mailtemplate/${e}`)}async createMailTemplate(e){return this.execute("post","/api/mailtemplate",e)}async updateMailTemplate(e){return this.execute("put","/api/mailtemplate",e)}async deleteMailTemplate(e){return this.execute("delete","/api/mailtemplate",{id:e})}async addMailTemplateImage(e,t,a){const n=this._createFormData(a,"image.jpg");return this.execute("post",`/api/mailtemplate/image/${e}/${t}`,n)}async deleteMailTemplateImage(e,t){return this.execute("delete",`/api/mailtemplate/image/${e}/${t}`)}async getMailTemplateNames(){return this.execute("get","/api/mailtemplate/names")}async getMailQuery(e,t,a,n){return this.execute("post","/api/email/query",{templateName:e,dateStart:t,dateEnd:a,success:n},{withNext:true})}async getMail(e){return this.execute("get","/api/email/get?token="+e)}async getInvoiceTemplates(){return this.execute("get","/api/invoicetemplate")}async getInvoiceTemplate(e){return this.execute("get",`/api/invoicetemplate/${e}`)}async createInvoiceTemplate(e){return this.execute("post","/api/invoicetemplate",e)}async updateInvoiceTemplate(e){return this.execute("put","/api/invoicetemplate",e)}async deleteInvoiceTemplate(e){return this.execute("delete","/api/invoicetemplate",{id:e})}async addInvoiceTemplateImage(e,t,a){const n=this._createFormData(a,"image.jpg");return this.execute("post",`/api/invoicetemplate/image/${e}/${t}`,n)}async deleteInvoiceTemplateImage(e,t){return this.execute("delete",`/api/invoicetemplate/image/${e}/${t}`)}async getItemTemplatesList(){return this.execute("get","/api/itemtemplate/list")}async getItemTemplates(){return this.execute("get","/api/itemtemplate")}async createItemTemplate(e){return this.execute("post","/api/itemtemplate",e)}async updateItemTemplate(e){return this.execute("put","/api/itemtemplate",e)}async deleteItemTemplate(e){return this.execute("delete","/api/itemtemplate",{id:e})}async getFeatures(){return this.execute("get","/api/feature")}async getFeaturesOnClient(){return this.execute("get","/api/feature/onclient")}async getFeaturesOnClientForAll(){return this.execute("get","/api/feature/onclientforall")}async getAllFeatures(){return this.execute("get","/api/feature/all")}async getBlogs(){return this.execute("get","/api/blog")}async getBlog(e){return this.execute("get","/api/blog/"+e)}async getPublicBlog(e){return this.execute("get","/api/blog/"+e+"/public")}async createBlog(e,t,a,n){return this.execute("post","/api/blog",{name:e,public:t,commentsEnabled:a,editors:n})}async saveBlog(e,t,a,n,i){return this.execute("put","/api/blog",{_id:e,name:t,public:a,commentsEnabled:n,editors:i})}async deleteBlog(e){return this.execute("delete","/api/blog",{_id:e})}async getBlogOverview(e){return this.execute("get","/api/blog/"+e+"/overview")}async queryBlog(e,t,a,n,i,r,s){return this.execute("post","/api/blog/"+e+"/query",{tag:t,text:a,limit:n,previousArticle:i,searchTag:r,sortBy:s})}async getArticles(e){return this.execute("get","/api/blog/"+e+"/article")}async getArticle(e,t){return this.execute("get","/api/blog/"+e+"/article/"+t)}async getArticleBySlug(e,t){return this.execute("get","/api/blog/article/"+e+"/"+t)}async createArticle(e,t,a){return this.execute("post","/api/blog/"+e+"/article",{title:t,slug:a})}async saveArticle(e,t,a,n,i,r,s,o){return this.execute("put","/api/blog/"+e+"/article",{_id:t,title:a,slug:n,content:o,tags:r,public:i,author:s})}async deleteArticle(e,t){return this.execute("delete","/api/blog/"+e+"/article",{_id:t})}async getNewsletters(){return this.execute("get","/api/newsletter")}async createNewsletter(e,t){return this.execute("post","/api/newsletter",{name:e,editors:t})}async getNewsletter(e){return this.execute("get","/api/newsletter/"+e)}async updateNewsletter(e,t,a,n){return this.execute("put","/api/newsletter/"+e,{name:t,sender:a,editors:n})}async deleteNewsletter(e){return this.execute("delete","/api/newsletter/"+e)}async joinNewsletter(e,t){return this.execute("post","/api/newsletter/join",{id:e,email:t})}async confirmNewsletter(e){return this.execute("post","/api/newsletter/confirm",{token:e})}async unsubscribeFromNewsletter(e){return this.execute("post","/api/newsletter/unsubscribe",{token:e})}async getNewsletterBlocks(){return this.execute("get","/api/newsletterblock")}async getNewsletterBlock(e){return this.execute("get","/api/newsletterblock/"+e)}async createNewsletterBlock(e){return this.execute("post","/api/newsletterblock",{name:e})}async updateNewsletterBlock(e,t,a,n,i,r){return this.execute("put","/api/newsletterblock/"+e,{name:t,inputs:a,html:n,css:i,acceptsChildren:r})}async deleteNewsletterBlock(e){return this.execute("delete","/api/newsletterblock/"+e)}async getNewsletterMails(e){return this.execute("get","/api/newslettermail/"+e)}async getNewsletterMail(e,t){return this.execute("get","/api/newslettermail/"+e+"/"+t)}async createNewsletterMail(e,t){return this.execute("post","/api/newslettermail/"+e,{title:t})}async updateNewsletterMail(e,t,a,n,i){return this.execute("put","/api/newslettermail/"+e+"/"+t,{title:a,blocks:n,parentBlock:i})}async generatePreviewNewsletterMail(e,t){return this.execute("post","/api/newslettermail/render",{blocks:e,parentBlock:t})}async sendTestNewsletter(e,t,a){return this.execute("post","/api/newslettermail/"+e+"/"+t+"/sendTest",{email:a})}async sendOutNewsletter(e,t){return this.execute("post","/api/newslettermail/"+e+"/"+t+"/send",{})}async getPages(){return this.execute("get","/api/page")}async createPage(e,t){return this.execute("post","/api/page",{title:e,slug:t})}async getPage(e){return this.execute("get","/api/page/"+e)}async updatePage(e,t,a,n,i){return this.execute("put","/api/page",{_id:e,title:t,slug:a,public:n,content:i})}async deletePage(e){return this.execute("delete","/api/page",{_id:e})}async getPublicPage(e,t){return this.execute("get","/api/page/public/"+e+"/"+t)}async setItemFlag(e,t,a,n,i,r){return this.execute("post","/api/itemflag",{item:e,isStaffPick:t,featureWeight:a,isGame:n,replaceIndex:i,internalRating:r})}getDownloadUrl(e){return `${this.getApiBaseUrl()}/api/item/download/${e}`}getAttachmentDownloadUrl(e,t,a,n){return `${this.getApiBaseUrl()}${this._getAttachmentUrlPath(e,t,a,n)}`}getPublicAttachmentDownloadUrl(e,t,a,n){return `${this.getApiBaseUrl()}${this._getAttachmentUrlPath(e,t,a,n,true)}`}getPublicDownloadUrl(e){return `${this.getApiBaseUrl()}/api/item/publicdownload/${e}`}async postFeedback(e){return this.execute("post","/api/feedback",{text:e})}}class Wd{linkableItemsCache;apiGateway;itemCache;usePublicApi;constructor(e,t,a=false){this.linkableItemsCache=new Map,this.apiGateway=e,this.itemCache=t,this.usePublicApi=a;}clear(){this.linkableItemsCache.clear();}resolveItem(e,t){for(const a of t)if(a._id===e)return a;return null}async loadLinkableItems(e,t){if(!e)throw "loadLinkableItems(): Item cannot be null!";let a=[];if(t.linkableTypes&&t.linkableTypes.length){if(!this.usePublicApi){const n=t.linkableTypes.join("#")+(e.folder?e.folder._id:"");if(this.linkableItemsCache.has(n))return this.linkableItemsCache.get(n);const i=[...t.linkableTypes];i.includes("Package")||i.push("Package");const r={types:i,folder:e.folder?e.folder._id:null};a=(await this.apiGateway.call("LinkableItemsCache::loadLinkableItems","queryItemsList",r)).filter((e=>"Package"!==e.type||t.linkableTypes.includes(e.packageType)));for(const n of e.links)if(null==this.resolveItem(n.to,a))try{const e=await this.itemCache.getItem(n.to);t.linkableTypes.includes(e.type)&&a.push(e);}catch(e){console.error(`Link item ${n.to} not found. Dead link? (${e})`);}this.linkableItemsCache.set(n,a);}}else {for(const t of e.links){const e=await this.itemCache.getItem(t.to);a.push(e);}const n=t.name+"#CurrentLinks";this.linkableItemsCache.set(n,a);}return a}}
4619
+ */var tr=(Qn||(Qn=1,er.exports=function e(t,a,i){function n(s,o){if(!a[s]){if(!t[s]){if(!o&&L)return L(s);if(r)return r(s,true);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=a[s]={exports:{}};t[s][0].call(u.exports,(function(e){var a=t[s][1][e];return n(a||e)}),u,u.exports,e,t,a,i);}return a[s].exports}for(var r=L,s=0;s<i.length;s++)n(i[s]);return n}({1:[function(e,t,a){(function(e){var a,i,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var r=0,s=new n(c),o=e.document.createTextNode("");s.observe(o,{characterData:true}),a=function(){o.data=r=++r%2;};}else if(e.setImmediate||void 0===e.MessageChannel)a="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null;},e.document.documentElement.appendChild(t);}:function(){setTimeout(c,0);};else {var l=new e.MessageChannel;l.port1.onmessage=c,a=function(){l.port2.postMessage(0);};}var u=[];function c(){var e,t;i=true;for(var a=u.length;a;){for(t=u,u=[],e=-1;++e<a;)t[e]();a=u.length;}i=false;}function d(e){1!==u.push(e)||i||a();}t.exports=d;}).call(this,void 0!==D?D:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{}],2:[function(e,t,a){var i=e(1);function n(){}var r={},s=["REJECTED"],o=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==n&&h(this,e);}function c(e,t,a){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof a&&(this.onRejected=a,this.callRejected=this.otherCallRejected);}function d(e,t,a){i((function(){var i;try{i=t(a);}catch(t){return r.reject(e,t)}i===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,i);}));}function p(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments);}}function h(e,t){var a=false;function i(t){a||(a=true,r.reject(e,t));}function n(t){a||(a=true,r.resolve(e,t));}function s(){t(n,i);}var o=f(s);"error"===o.status&&i(o.value);}function f(e,t){var a={};try{a.value=e(t),a.status="success";}catch(e){a.status="error",a.value=e;}return a}function m(e){return e instanceof this?e:r.resolve(new this(n),e)}function y(e){var t=new this(n);return r.reject(t,e)}function g(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var a=e.length,i=false;if(!a)return this.resolve([]);for(var s=new Array(a),o=0,l=-1,u=new this(n);++l<a;)c(e[l],l);return u;function c(e,n){function l(e){s[n]=e,++o!==a||i||(i=true,r.resolve(u,s));}t.resolve(e).then(l,(function(e){i||(i=true,r.reject(u,e));}));}}function b(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var a=e.length,i=false;if(!a)return this.resolve([]);for(var s=-1,o=new this(n);++s<a;)l(e[s]);return o;function l(e){t.resolve(e).then((function(e){i||(i=true,r.resolve(o,e));}),(function(e){i||(i=true,r.reject(o,e));}));}}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===o||"function"!=typeof t&&this.state===s)return this;var a=new this.constructor(n);return this.state!==l?d(a,this.state===o?e:t,this.outcome):this.queue.push(new c(a,e,t)),a},c.prototype.callFulfilled=function(e){r.resolve(this.promise,e);},c.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e);},c.prototype.callRejected=function(e){r.reject(this.promise,e);},c.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e);},r.resolve=function(e,t){var a=f(p,t);if("error"===a.status)return r.reject(e,a.value);var i=a.value;if(i)h(e,i);else {e.state=o,e.outcome=t;for(var n=-1,s=e.queue.length;++n<s;)e.queue[n].callFulfilled(t);}return e},r.reject=function(e,t){e.state=s,e.outcome=t;for(var a=-1,i=e.queue.length;++a<i;)e.queue[a].callRejected(t);return e},u.resolve=m,u.reject=y,u.all=g,u.race=b;},{1:1}],3:[function(e,t,a){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2));}).call(this,void 0!==D?D:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{2:2}],4:[function(e,t,a){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var s=r();function o(){try{if(!s||!s.open)return !1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return (!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return false}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(n){if("TypeError"!==n.name)throw n;for(var a=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)a.append(e[i]);return a.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var u=Promise;function c(e,t){t&&e.then((function(e){t(null,e);}),(function(e){t(e);}));}function d(e,t,a){"function"==typeof t&&e.then(t),"function"==typeof a&&e.catch(a);}function p(e){return "string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function h(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var f="local-forage-detect-blob-support",m=void 0,y={},g=Object.prototype.toString,b="readonly",v="readwrite";function _(e){for(var t=e.length,a=new ArrayBuffer(t),i=new Uint8Array(a),n=0;n<t;n++)i[n]=e.charCodeAt(n);return a}function w(e){return new u((function(t){var a=e.transaction(f,v),i=l([""]);a.objectStore(f).put(i,"key"),a.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(false);},a.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),a=navigator.userAgent.match(/Edge\//);t(a||!e||parseInt(e[1],10)>=43);};})).catch((function(){return false}))}function A(e){return "boolean"==typeof m?u.resolve(m):w(e).then((function(e){return m=e}))}function k(e){var t=y[e.name],a={};a.promise=new u((function(e,t){a.resolve=e,a.reject=t;})),t.deferredOperations.push(a),t.dbReady?t.dbReady=t.dbReady.then((function(){return a.promise})):t.dbReady=a.promise;}function S(e){var t=y[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function N(e,t){var a=y[e.name].deferredOperations.pop();if(a)return a.reject(t),a.promise}function T(e,t){return new u((function(a,i){if(y[e.name]=y[e.name]||L(),e.db){if(!t)return a(e.db);k(e),e.db.close();}var n=[e.name];t&&n.push(e.version);var r=s.open.apply(s,n);t&&(r.onupgradeneeded=function(t){var a=r.result;try{a.createObjectStore(e.storeName),t.oldVersion<=1&&a.createObjectStore(f);}catch(a){if("ConstraintError"!==a.name)throw a;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.');}}),r.onerror=function(e){e.preventDefault(),i(r.error);},r.onsuccess=function(){var t=r.result;t.onversionchange=function(e){e.target.close();},a(t),S(e);};}))}function M(e){return T(e,false)}function x(e){return T(e,true)}function V(e,t){if(!e.db)return true;var a=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,n=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),n||a){if(a){var r=e.db.version+1;r>e.version&&(e.version=r);}return true}return false}function C(e){return new u((function(t,a){var i=new FileReader;i.onerror=a,i.onloadend=function(a){var i=btoa(a.target.result||"");t({__local_forage_encoded_blob:true,data:i,type:e.type});},i.readAsBinaryString(e);}))}function I(e){return l([_(atob(e.data))],{type:e.type})}function F(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,a=t._initReady().then((function(){var e=y[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return d(a,e,e),a}function D(e){k(e);for(var t=y[e.name],a=t.forages,i=0;i<a.length;i++){var n=a[i];n._dbInfo.db&&(n._dbInfo.db.close(),n._dbInfo.db=null);}return e.db=null,M(e).then((function(t){return e.db=t,V(e)?x(e):t})).then((function(i){e.db=t.db=i;for(var n=0;n<a.length;n++)a[n]._dbInfo.db=i;})).catch((function(t){throw N(e,t),t}))}function R(e,t,a,i){ void 0===i&&(i=1);try{var n=e.db.transaction(e.storeName,t);a(null,n);}catch(n){if(i>0&&(!e.db||"InvalidStateError"===n.name||"NotFoundError"===n.name))return u.resolve().then((function(){if(!e.db||"NotFoundError"===n.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),x(e)})).then((function(){return D(e).then((function(){R(e,t,a,i-1);}))})).catch(a);a(n);}}function L(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function P(e){var t=this,a={db:null};if(e)for(var i in e)a[i]=e[i];var n=y[a.name];n||(n=L(),y[a.name]=n),n.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E);var r=[];function s(){return u.resolve()}for(var o=0;o<n.forages.length;o++){var l=n.forages[o];l!==t&&r.push(l._initReady().catch(s));}var c=n.forages.slice(0);return u.all(r).then((function(){return a.db=n.db,M(a)})).then((function(e){return a.db=e,V(a,t._defaultConfig.version)?x(a):e})).then((function(e){a.db=n.db=e,t._dbInfo=a;for(var i=0;i<c.length;i++){var r=c[i];r!==t&&(r._dbInfo.db=a.db,r._dbInfo.version=a.version);}}))}function B(e,t){var a=this;e=p(e);var i=new u((function(t,i){a.ready().then((function(){R(a._dbInfo,b,(function(n,r){if(n)return i(n);try{var s=r.objectStore(a._dbInfo.storeName).get(e);s.onsuccess=function(){var e=s.result;void 0===e&&(e=null),F(e)&&(e=I(e)),t(e);},s.onerror=function(){i(s.error);};}catch(e){i(e);}}));})).catch(i);}));return c(i,t),i}function O(e,t){var a=this,i=new u((function(t,i){a.ready().then((function(){R(a._dbInfo,b,(function(n,r){if(n)return i(n);try{var s=r.objectStore(a._dbInfo.storeName).openCursor(),o=1;s.onsuccess=function(){var a=s.result;if(a){var i=a.value;F(i)&&(i=I(i));var n=e(i,a.key,o++);void 0!==n?t(n):a.continue();}else t();},s.onerror=function(){i(s.error);};}catch(e){i(e);}}));})).catch(i);}));return c(i,t),i}function $(e,t,a){var i=this;e=p(e);var n=new u((function(a,n){var r;i.ready().then((function(){return r=i._dbInfo,"[object Blob]"===g.call(t)?A(r.db).then((function(e){return e?t:C(t)})):t})).then((function(t){R(i._dbInfo,v,(function(r,s){if(r)return n(r);try{var o=s.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var l=o.put(t,e);s.oncomplete=function(){void 0===t&&(t=null),a(t);},s.onabort=s.onerror=function(){var e=l.error?l.error:l.transaction.error;n(e);};}catch(e){n(e);}}));})).catch(n);}));return c(n,a),n}function j(e,t){var a=this;e=p(e);var i=new u((function(t,i){a.ready().then((function(){R(a._dbInfo,v,(function(n,r){if(n)return i(n);try{var s=r.objectStore(a._dbInfo.storeName).delete(e);r.oncomplete=function(){t();},r.onerror=function(){i(s.error);},r.onabort=function(){var e=s.error?s.error:s.transaction.error;i(e);};}catch(e){i(e);}}));})).catch(i);}));return c(i,t),i}function U(e){var t=this,a=new u((function(e,a){t.ready().then((function(){R(t._dbInfo,v,(function(i,n){if(i)return a(i);try{var r=n.objectStore(t._dbInfo.storeName).clear();n.oncomplete=function(){e();},n.onabort=n.onerror=function(){var e=r.error?r.error:r.transaction.error;a(e);};}catch(e){a(e);}}));})).catch(a);}));return c(a,e),a}function z(e){var t=this,a=new u((function(e,a){t.ready().then((function(){R(t._dbInfo,b,(function(i,n){if(i)return a(i);try{var r=n.objectStore(t._dbInfo.storeName).count();r.onsuccess=function(){e(r.result);},r.onerror=function(){a(r.error);};}catch(e){a(e);}}));})).catch(a);}));return c(a,e),a}function W(e,t){var a=this,i=new u((function(t,i){e<0?t(null):a.ready().then((function(){R(a._dbInfo,b,(function(n,r){if(n)return i(n);try{var s=r.objectStore(a._dbInfo.storeName),o=!1,l=s.openKeyCursor();l.onsuccess=function(){var a=l.result;a?0===e||o?t(a.key):(o=!0,a.advance(e)):t(null);},l.onerror=function(){i(l.error);};}catch(e){i(e);}}));})).catch(i);}));return c(i,t),i}function Y(e){var t=this,a=new u((function(e,a){t.ready().then((function(){R(t._dbInfo,b,(function(i,n){if(i)return a(i);try{var r=n.objectStore(t._dbInfo.storeName).openKeyCursor(),s=[];r.onsuccess=function(){var t=r.result;t?(s.push(t.key),t.continue()):e(s);},r.onerror=function(){a(r.error);};}catch(e){a(e);}}));})).catch(a);}));return c(a,e),a}function H(e,t){t=h.apply(this,arguments);var a=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||a.name,e.storeName=e.storeName||a.storeName);var i,n=this;if(e.name){var r=e.name===a.name&&n._dbInfo.db?u.resolve(n._dbInfo.db):M(e).then((function(t){var a=y[e.name],i=a.forages;a.db=t;for(var n=0;n<i.length;n++)i[n]._dbInfo.db=t;return t}));i=e.storeName?r.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var a=t.version+1;k(e);var i=y[e.name],n=i.forages;t.close();for(var r=0;r<n.length;r++){var o=n[r];o._dbInfo.db=null,o._dbInfo.version=a;}var l=new u((function(t,i){var n=s.open(e.name,a);n.onerror=function(e){n.result.close(),i(e);},n.onupgradeneeded=function(){n.result.deleteObjectStore(e.storeName);},n.onsuccess=function(){var e=n.result;e.close(),t(e);};}));return l.then((function(e){i.db=e;for(var t=0;t<n.length;t++){var a=n[t];a._dbInfo.db=e,S(a._dbInfo);}})).catch((function(t){throw (N(e,t)||u.resolve()).catch((function(){})),t}))}})):r.then((function(t){k(e);var a=y[e.name],i=a.forages;t.close();for(var n=0;n<i.length;n++)i[n]._dbInfo.db=null;var r=new u((function(t,a){var i=s.deleteDatabase(e.name);i.onerror=function(){var e=i.result;e&&e.close(),a(i.error);},i.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed');},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e);};}));return r.then((function(e){a.db=e;for(var t=0;t<i.length;t++)S(i[t]._dbInfo);})).catch((function(t){throw (N(e,t)||u.resolve()).catch((function(){})),t}))}));}else i=u.reject("Invalid arguments");return c(i,t),i}var G={_driver:"asyncStorage",_initStorage:P,_support:o(),iterate:O,getItem:B,setItem:$,removeItem:j,clear:U,length:z,key:W,keys:Y,dropInstance:H};function q(){return "function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J="~~local_forage_type~",K=/^~~local_forage_type~([^~]+)~/,X="__lfsc__:",Q=X.length,ee="arbf",te="blob",ae="si08",ie="ui08",ne="uic8",re="si16",se="si32",oe="ur16",le="ui32",ue="fl32",ce="fl64",de=Q+ee.length,pe=Object.prototype.toString;function he(e){var t,a,i,n,r,s=.75*e.length,o=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var u=new ArrayBuffer(s),c=new Uint8Array(u);for(t=0;t<o;t+=4)a=Z.indexOf(e[t]),i=Z.indexOf(e[t+1]),n=Z.indexOf(e[t+2]),r=Z.indexOf(e[t+3]),c[l++]=a<<2|i>>4,c[l++]=(15&i)<<4|n>>2,c[l++]=(3&n)<<6|63&r;return u}function fe(e){var t,a=new Uint8Array(e),i="";for(t=0;t<a.length;t+=3)i+=Z[a[t]>>2],i+=Z[(3&a[t])<<4|a[t+1]>>4],i+=Z[(15&a[t+1])<<2|a[t+2]>>6],i+=Z[63&a[t+2]];return a.length%3==2?i=i.substring(0,i.length-1)+"=":a.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}function me(e,t){var a="";if(e&&(a=pe.call(e)),e&&("[object ArrayBuffer]"===a||e.buffer&&"[object ArrayBuffer]"===pe.call(e.buffer))){var i,n=X;e instanceof ArrayBuffer?(i=e,n+=ee):(i=e.buffer,"[object Int8Array]"===a?n+=ae:"[object Uint8Array]"===a?n+=ie:"[object Uint8ClampedArray]"===a?n+=ne:"[object Int16Array]"===a?n+=re:"[object Uint16Array]"===a?n+=oe:"[object Int32Array]"===a?n+=se:"[object Uint32Array]"===a?n+=le:"[object Float32Array]"===a?n+=ue:"[object Float64Array]"===a?n+=ce:t(new Error("Failed to get type for BinaryArray"))),t(n+fe(i));}else if("[object Blob]"===a){var r=new FileReader;r.onload=function(){var a=J+e.type+"~"+fe(this.result);t(X+te+a);},r.readAsArrayBuffer(e);}else try{t(JSON.stringify(e));}catch(a){console.error("Couldn't convert value into a JSON string: ",e),t(null,a);}}function ye(e){if(e.substring(0,Q)!==X)return JSON.parse(e);var t,a=e.substring(de),i=e.substring(Q,de);if(i===te&&K.test(a)){var n=a.match(K);t=n[1],a=a.substring(n[0].length);}var r=he(a);switch(i){case ee:return r;case te:return l([r],{type:t});case ae:return new Int8Array(r);case ie:return new Uint8Array(r);case ne:return new Uint8ClampedArray(r);case re:return new Int16Array(r);case oe:return new Uint16Array(r);case se:return new Int32Array(r);case le:return new Uint32Array(r);case ue:return new Float32Array(r);case ce:return new Float64Array(r);default:throw new Error("Unkown type: "+i)}}var ge={serialize:me,deserialize:ye,stringToBuffer:he,bufferToString:fe};function be(e,t,a,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],a,i);}function ve(e){var t=this,a={db:null};if(e)for(var i in e)a[i]="string"!=typeof e[i]?e[i].toString():e[i];var n=new u((function(e,i){try{a.db=openDatabase(a.name,String(a.version),a.description,a.size);}catch(e){return i(e)}a.db.transaction((function(n){be(n,a,(function(){t._dbInfo=a,e();}),(function(e,t){i(t);}));}),i);}));return a.serializer=ge,n}function _e(e,t,a,i,n,r){e.executeSql(a,i,n,(function(e,s){s.code===s.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,o){o.rows.length?r(e,s):be(e,t,(function(){e.executeSql(a,i,n,r);}),r);}),r):r(e,s);}),r);}function we(e,t){var a=this;e=p(e);var i=new u((function(t,i){a.ready().then((function(){var n=a._dbInfo;n.db.transaction((function(a){_e(a,n,"SELECT * FROM "+n.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,a){var i=a.rows.length?a.rows.item(0).value:null;i&&(i=n.serializer.deserialize(i)),t(i);}),(function(e,t){i(t);}));}));})).catch(i);}));return c(i,t),i}function Ae(e,t){var a=this,i=new u((function(t,i){a.ready().then((function(){var n=a._dbInfo;n.db.transaction((function(a){_e(a,n,"SELECT * FROM "+n.storeName,[],(function(a,i){for(var r=i.rows,s=r.length,o=0;o<s;o++){var l=r.item(o),u=l.value;if(u&&(u=n.serializer.deserialize(u)),void 0!==(u=e(u,l.key,o+1)))return void t(u)}t();}),(function(e,t){i(t);}));}));})).catch(i);}));return c(i,t),i}function ke(e,t,a,i){var n=this;e=p(e);var r=new u((function(r,s){n.ready().then((function(){ void 0===t&&(t=null);var o=t,l=n._dbInfo;l.serializer.serialize(t,(function(t,u){u?s(u):l.db.transaction((function(a){_e(a,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){r(o);}),(function(e,t){s(t);}));}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void r(ke.apply(n,[e,o,a,i-1]));s(t);}}));}));})).catch(s);}));return c(r,a),r}function Se(e,t,a){return ke.apply(this,[e,t,a,1])}function Ne(e,t){var a=this;e=p(e);var i=new u((function(t,i){a.ready().then((function(){var n=a._dbInfo;n.db.transaction((function(a){_e(a,n,"DELETE FROM "+n.storeName+" WHERE key = ?",[e],(function(){t();}),(function(e,t){i(t);}));}));})).catch(i);}));return c(i,t),i}function Te(e){var t=this,a=new u((function(e,a){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){_e(t,i,"DELETE FROM "+i.storeName,[],(function(){e();}),(function(e,t){a(t);}));}));})).catch(a);}));return c(a,e),a}function Me(e){var t=this,a=new u((function(e,a){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){_e(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],(function(t,a){var i=a.rows.item(0).c;e(i);}),(function(e,t){a(t);}));}));})).catch(a);}));return c(a,e),a}function xe(e,t){var a=this,i=new u((function(t,i){a.ready().then((function(){var n=a._dbInfo;n.db.transaction((function(a){_e(a,n,"SELECT key FROM "+n.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,a){var i=a.rows.length?a.rows.item(0).key:null;t(i);}),(function(e,t){i(t);}));}));})).catch(i);}));return c(i,t),i}function Ve(e){var t=this,a=new u((function(e,a){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){_e(t,i,"SELECT key FROM "+i.storeName,[],(function(t,a){for(var i=[],n=0;n<a.rows.length;n++)i.push(a.rows.item(n).key);e(i);}),(function(e,t){a(t);}));}));})).catch(a);}));return c(a,e),a}function Ce(e){return new u((function(t,a){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(a,i){for(var n=[],r=0;r<i.rows.length;r++)n.push(i.rows.item(r).name);t({db:e,storeNames:n});}),(function(e,t){a(t);}));}),(function(e){a(e);}));}))}function Ie(e,t){t=h.apply(this,arguments);var a=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||a.name,e.storeName=e.storeName||a.storeName);var i,n=this;return c(i=e.name?new u((function(t){var i;i=e.name===a.name?n._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(Ce(i));})).then((function(e){return new u((function(t,a){e.db.transaction((function(i){function n(e){return new u((function(t,a){i.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t();}),(function(e,t){a(t);}));}))}for(var r=[],s=0,o=e.storeNames.length;s<o;s++)r.push(n(e.storeNames[s]));u.all(r).then((function(){t();})).catch((function(e){a(e);}));}),(function(e){a(e);}));}))})):u.reject("Invalid arguments"),t),i}var Fe={_driver:"webSQLStorage",_initStorage:ve,_support:q(),iterate:Ae,getItem:we,setItem:Se,removeItem:Ne,clear:Te,length:Me,key:xe,keys:Ve,dropInstance:Ie};function Ee(){try{return "undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return false}}function De(e,t){var a=e.name+"/";return e.storeName!==t.storeName&&(a+=e.storeName+"/"),a}function Re(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return true}}function Le(){return !Re()||localStorage.length>0}function Pe(e){var t=this,a={};if(e)for(var i in e)a[i]=e[i];return a.keyPrefix=De(e,t._defaultConfig),Le()?(t._dbInfo=a,a.serializer=ge,u.resolve()):u.reject()}function Be(e){var t=this,a=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var i=localStorage.key(a);0===i.indexOf(e)&&localStorage.removeItem(i);}}));return c(a,e),a}function Oe(e,t){var a=this;e=p(e);var i=a.ready().then((function(){var t=a._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i}));return c(i,t),i}function $e(e,t){var a=this,i=a.ready().then((function(){for(var t=a._dbInfo,i=t.keyPrefix,n=i.length,r=localStorage.length,s=1,o=0;o<r;o++){var l=localStorage.key(o);if(0===l.indexOf(i)){var u=localStorage.getItem(l);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,l.substring(n),s++)))return u}}}));return c(i,t),i}function je(e,t){var a=this,i=a.ready().then((function(){var t,i=a._dbInfo;try{t=localStorage.key(e);}catch(e){t=null;}return t&&(t=t.substring(i.keyPrefix.length)),t}));return c(i,t),i}function Ue(e){var t=this,a=t.ready().then((function(){for(var e=t._dbInfo,a=localStorage.length,i=[],n=0;n<a;n++){var r=localStorage.key(n);0===r.indexOf(e.keyPrefix)&&i.push(r.substring(e.keyPrefix.length));}return i}));return c(a,e),a}function ze(e){var t=this.keys().then((function(e){return e.length}));return c(t,e),t}function We(e,t){var a=this;e=p(e);var i=a.ready().then((function(){var t=a._dbInfo;localStorage.removeItem(t.keyPrefix+e);}));return c(i,t),i}function Ye(e,t,a){var i=this;e=p(e);var n=i.ready().then((function(){ void 0===t&&(t=null);var a=t;return new u((function(n,r){var s=i._dbInfo;s.serializer.serialize(t,(function(t,i){if(i)r(i);else try{localStorage.setItem(s.keyPrefix+e,t),n(a);}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||r(e),r(e);}}));}))}));return c(n,a),n}function He(e,t){if(t=h.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var a=this.config();e.name=e.name||a.name,e.storeName=e.storeName||a.storeName;}var i,n=this;return i=e.name?new u((function(t){e.storeName?t(De(e,n._defaultConfig)):t(e.name+"/");})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var a=localStorage.key(t);0===a.indexOf(e)&&localStorage.removeItem(a);}})):u.reject("Invalid arguments"),c(i,t),i}var Ge={_driver:"localStorageWrapper",_initStorage:Pe,_support:Ee(),iterate:$e,getItem:Oe,setItem:Ye,removeItem:We,clear:Be,length:ze,key:je,keys:Ue,dropInstance:He},qe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ze=function(e,t){for(var a=e.length,i=0;i<a;){if(qe(e[i],t))return true;i++;}return false},Je=Array.isArray||function(e){return "[object Array]"===Object.prototype.toString.call(e)},Ke={},Xe={},Qe={INDEXEDDB:G,WEBSQL:Fe,LOCALSTORAGE:Ge},et=[Qe.INDEXEDDB._driver,Qe.WEBSQL._driver,Qe.LOCALSTORAGE._driver],tt=["dropInstance"],at=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),it={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function nt(e,t){e[t]=function(){var a=arguments;return e.ready().then((function(){return e[t].apply(e,a)}))};}function rt(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var a in t)t.hasOwnProperty(a)&&(Je(t[a])?arguments[0][a]=t[a].slice():arguments[0][a]=t[a]);}return arguments[0]}var st=function(){function e(t){for(var a in n(this,e),Qe)if(Qe.hasOwnProperty(a)){var i=Qe[a],r=i._driver;this[a]=r,Ke[r]||this.defineDriver(i);}this._defaultConfig=rt({},it),this._config=rt({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=false,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}));}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":i(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t];}return !("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return "string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,a){var i=new u((function(t,a){try{var i=e._driver,n=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void a(n);for(var r=at.concat("_initStorage"),s=0,o=r.length;s<o;s++){var l=r[s];if((!Ze(tt,l)||e[l])&&"function"!=typeof e[l])return void a(n)}var d=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),a=u.reject(t);return c(a,arguments[arguments.length-1]),a}},a=0,i=tt.length;a<i;a++){var n=tt[a];e[n]||(e[n]=t(n));}};d();var p=function(a){Ke[i]&&console.info("Redefining LocalForage driver: "+i),Ke[i]=e,Xe[i]=a,t();};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(p,a):p(!!e._support):p(!0);}catch(e){a(e);}}));return d(i,t,a),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,a){var i=Ke[e]?u.resolve(Ke[e]):u.reject(new Error("Driver not found."));return d(i,t,a),i},e.prototype.getSerializer=function(e){var t=u.resolve(ge);return d(t,e),t},e.prototype.ready=function(e){var t=this,a=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return d(a,e,e),a},e.prototype.setDriver=function(e,t,a){var i=this;Je(e)||(e=[e]);var n=this._getSupportedDrivers(e);function r(){i._config.driver=i.driver();}function s(e){return i._extend(e),r(),i._ready=i._initStorage(i._config),i._ready}function o(e){return function(){var t=0;function a(){for(;t<e.length;){var n=e[t];return t++,i._dbInfo=null,i._ready=null,i.getDriver(n).then(s).catch(a)}r();var o=new Error("No available storage method found.");return i._driverSet=u.reject(o),i._driverSet}return a()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return u.resolve()})):u.resolve();return this._driverSet=l.then((function(){var e=n[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then((function(e){i._driver=e._driver,r(),i._wrapLibraryMethodsWithReady(),i._initDriver=o(n);}))})).catch((function(){r();var e=new Error("No available storage method found.");return i._driverSet=u.reject(e),i._driverSet})),d(this._driverSet,t,a),this._driverSet},e.prototype.supports=function(e){return !!Xe[e]},e.prototype._extend=function(e){rt(this,e);},e.prototype._getSupportedDrivers=function(e){for(var t=[],a=0,i=e.length;a<i;a++){var n=e[a];this.supports(n)&&t.push(n);}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=at.length;e<t;e++)nt(this,at[e]);},e.prototype.createInstance=function(t){return new e(t)},e}(),ot=new st;t.exports=ot;},{3:3}]},{},[4])(4)),er.exports),ar=R$9(tr);class ir{databaseName;collectionName;size;_store;constructor(e,t,a){ar.config({driver:ar.INDEXEDDB}),this.databaseName=e||"lumino-cache",this.collectionName=t||"data",this.size=a,this._store=ar.createInstance({name:this.databaseName,storeName:this.collectionName});}async init(){}async _keys(){return this._store.keys()}async _set(e,t){return this._store.setItem(e,t)}async _clear(){return this._store.clear()}async _get(e){return this._store.getItem(e)}async _remove(e){return this._store.removeItem(e)}}function nr(e){let t,a,i,n;e.onmessage=async r=>{const s=r.data;try{switch(s.type){case "init":{i=s.databaseName,n=s.collectionName,t=await navigator.storage.getDirectory();const r=await t.getDirectoryHandle(i,{create:!0});a=await r.getDirectoryHandle(n,{create:!0}),e.postMessage({type:s.type,database:i,collection:n,success:!0});break}case "write":{if(!a)throw new Error("OPFS Worker: not initialized yet!");const t=await a.getFileHandle(s.filename,{create:!0}),r=await t.createSyncAccessHandle();let o;if("string"==typeof s.content){o=(new TextEncoder).encode(s.content).buffer;}else if(s.content instanceof ArrayBuffer)o=s.content;else {if(!(s.content instanceof Blob))throw new Error("OPFS Worker: Unsupported content type: "+typeof s.content);o=await s.content.arrayBuffer();}r.truncate(o.byteLength),r.write(o,{at:0}),await r.flush(),r.close(),e.postMessage({type:s.type,database:i,collection:n,success:!0});break}}}catch(t){e.postMessage({type:s.type,success:false,database:i,collection:n,error:t.message});}};}class rr{databaseName;collectionName;size;_worker;_storage;_root;constructor(e,t,a){this.databaseName=e||"lumino-cache",this.collectionName=t||"data",this.size=a;}async init(){if("object"==typeof globalThis.navigator&&"storage"in globalThis.navigator&&"function"==typeof globalThis.navigator.storage.getDirectory){this._storage=await navigator.storage.getDirectory();const e=await this._storage.getDirectoryHandle(this.databaseName,{create:true});let t,a;this._root=await e.getDirectoryHandle(this.collectionName,{create:true}),this._worker=new Worker(URL.createObjectURL(new Blob(["(",nr.toString(),")(self)"],{type:"application/javascript"})),{type:"module"});let i=new Promise(((e,i)=>{t=e,a=i;}));return this._worker.onmessage=e=>{const i=e.data;i.success||console.error("OPFS Worker failed:",i),"init"===i.type&&(i.success?t():a(i.error));},this._worker.postMessage({type:"init",databaseName:this.databaseName,collectionName:this.collectionName}),i}}async _keys(){if(!this._root)return [];const e=[];for await(const t of this._root.values())e.push(t.name);return e}async _set(e,t){if(!this._root)return;let a;if(t instanceof Blob)a=t;else if("object"==typeof t){const e=JSON.stringify(t,null,2);a=new Blob([e],{type:"application/json"});}else a=new Blob([t],{type:"text/plain"});const i=await this._root.getFileHandle(e,{create:true});if("function"==typeof i.createWritable){const e=await i.createWritable();await e.write(a),await e.close();}else this._worker.postMessage({type:"write",filename:e,content:a});}async _clear(){if(!this._root)return;const e=[];for await(const t of this._root.values())e.push(this._root.removeEntry(t.name));return Promise.all(e)}async _get(e,t){if(!this._root)return null;let a;try{const t=await this._root.getFileHandle(e);a=await t.getFile();}catch(e){return null}switch(t=t||a.type){case "text/plain":return a.text();case "application/json":{const e=await a.text();try{return JSON.parse(e)}catch(t){return console.error("Content was loaded from cache but could not be json parsed: ",e),null}}default:return a}}async _remove(e){if(this._root)return this._root.removeEntry(e)}}class sr{databaseName;collectionName;size;type;_impl;constructor(e,t,a=0,i=1){switch(this.databaseName=e||"lumino",this.collectionName=t||"data",this.size=1048576*(i||1),this.type=a,this.type){case 0:this._impl=new ir(this.databaseName,this.collectionName,this.size);break;case 1:this._impl=new rr(this.databaseName,this.collectionName,this.size);break;default:throw "Invalid storage type: "+a}}async init(){return this._impl.init()}async _keys(){return this._impl._keys()}fixKey(e){return e.replaceAll("/","_")}async _set(e,t){return this._impl._set(this.fixKey(e),t)}async _clear(){return this._impl._clear()}async _get(e,t){return this._impl._get(this.fixKey(e),t)}async _remove(e){return this._impl._remove(this.fixKey(e))}}var or$1,lr,ur,cr,dr,pr,hr,fr,mr,yr,gr,br,vr,_r,wr,Ar,kr,Sr,Nr,Tr,Mr,xr,Vr,Cr,Ir,Fr,Er,Dr;function Rr(){if(lr)return or$1;return lr=1,or$1=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function Lr(){if(pr)return dr;pr=1;var e=function(){if(cr)return ur;cr=1;var e="object"==typeof D&&D&&D.Object===Object&&D;return ur=e}(),t="object"==typeof self&&self&&self.Object===Object&&self,a=e||t||Function("return this")();return dr=a}function Pr(){if(br)return gr;br=1;var e=function(){if(yr)return mr;yr=1;var e=/\s/;return mr=function(t){for(var a=t.length;a--&&e.test(t.charAt(a)););return a}}(),t=/^\s+/;return gr=function(a){return a?a.slice(0,e(a)+1).replace(t,""):a}}function Br(){if(_r)return vr;_r=1;var e=Lr().Symbol;return vr=e}function Or(){if(Tr)return Nr;Tr=1;var e=Br(),t=function(){if(Ar)return wr;Ar=1;var e=Br(),t=Object.prototype,a=t.hasOwnProperty,i=t.toString,n=e?e.toStringTag:void 0;return wr=function(e){var t=a.call(e,n),r=e[n];try{e[n]=void 0;var s=!0;}catch(e){}var o=i.call(e);return s&&(t?e[n]=r:delete e[n]),o}}(),a=function(){if(Sr)return kr;Sr=1;var e=Object.prototype.toString;return kr=function(t){return e.call(t)}}(),i=e?e.toStringTag:void 0;return Nr=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?t(e):a(e)}}function $r(){if(Cr)return Vr;Cr=1;var e=Or(),t=xr?Mr:(xr=1,Mr=function(e){return null!=e&&"object"==typeof e});return Vr=function(a){return "symbol"==typeof a||t(a)&&"[object Symbol]"==e(a)}}var jr=function(){if(Dr)return Er;Dr=1;var e=Rr(),t=function(){if(fr)return hr;fr=1;var e=Lr();return hr=function(){return e.Date.now()}}(),a=function(){if(Fr)return Ir;Fr=1;var e=Pr(),t=Rr(),a=$r(),i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,r=/^0o[0-7]+$/i,s=parseInt;return Ir=function(o){if("number"==typeof o)return o;if(a(o))return NaN;if(t(o)){var l="function"==typeof o.valueOf?o.valueOf():o;o=t(l)?l+"":l;}if("string"!=typeof o)return 0===o?o:+o;o=e(o);var u=n.test(o);return u||r.test(o)?s(o.slice(2),u?2:8):i.test(o)?NaN:+o}}(),i=Math.max,n=Math.min;return Er=function(r,s,o){var l,u,c,d,p,h,f=0,m=false,y=false,g=true;if("function"!=typeof r)throw new TypeError("Expected a function");function b(e){var t=l,a=u;return l=u=void 0,f=e,d=r.apply(a,t)}function v(e){var t=e-h;return void 0===h||t>=s||t<0||y&&e-f>=c}function _(){var e=t();if(v(e))return w(e);p=setTimeout(_,function(e){var t=s-(e-h);return y?n(t,c-(e-f)):t}(e));}function w(e){return p=void 0,g&&l?b(e):(l=u=void 0,d)}function A(){var e=t(),a=v(e);if(l=arguments,u=this,h=e,a){if(void 0===p)return function(e){return f=e,p=setTimeout(_,s),m?b(e):d}(h);if(y)return clearTimeout(p),p=setTimeout(_,s),b(h)}return void 0===p&&(p=setTimeout(_,s)),d}return s=a(s)||0,e(o)&&(m=!!o.leading,c=(y="maxWait"in o)?i(a(o.maxWait)||0,s):c,g="trailing"in o?!!o.trailing:g),A.cancel=function(){ void 0!==p&&clearTimeout(p),f=0,l=h=u=p=void 0;},A.flush=function(){return void 0===p?d:w(t())},A}}(),Ur=R$9(jr);class zr extends sr{apiClient;cache=new Map;urlToIdMap=new Map;logging=false;ready=false;usePublicApi=false;quota=0;size=0;usePersistentStorage=false;saveIndex;constructor(e,t,a,i){if(super("lumino","items",1),!a)throw "A lumino client needs to be passed.";this.apiClient=a,this.usePublicApi=e,this.quota=1048576*(i||1024),this.usePersistentStorage=t;this.saveIndex=Ur((()=>{const e=[];for(const t of this.cache.values())e.push({id:t.id,time:t.time.valueOf(),size:t.size,hash:t.hash,itemType:t.itemType,mimeType:t.mimeType,itemName:t.itemName});this._set("index",e).then((function(){})).catch((function(e){console.error("Error saving cache index: "+e);}));}),1e3);}async init(){return await super.init(),this.initFromStorage()}getQuota(){return this.quota}setQuota(e){this.quota=e,this.checkQuota();}getCount(){return this.cache.size}getSize(){return this.size}async initFromStorage(){if(this.usePersistentStorage){const e=await this._get("index","application/json");if(e&&Array.isArray(e))for(const t of e)t.time=j(t.time),this.cache.set(t.id,t),this.size+=t.size;else await this._clear(),this.saveIndex();}this.ready=true,l$1.$emit("itemCache:cacheReady"),l$1.$emit("itemCache:cacheChange"),l$1.$on("item:rename",(e=>this.handleRename(e)));}async addToStorage(e,t){if(this.usePersistentStorage){const a={id:e.id,time:j(e.time.toDate()),size:e.size,hash:e.hash,itemType:e.itemType,mimeType:e.mimeType,itemName:e.itemName};await this._set(`blob_${e.id}`,t),this.cache.set(e.id,a),this.saveIndex();}this.size+=e.size;}waitUntilReady(){const e=this;return new Promise(((t,a)=>{try{e.ready?t():l$1.$on("itemCache:cacheReady",(()=>{t();}));}catch(e){a(e);}}))}findObject(e){return this.cache.get(e)}getEntries(){return this.cache.values()}clear(){for(const e of this.cache.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);this.cache.clear(),l$1.$emit("itemCache:cacheChange"),this.usePersistentStorage&&this._clear().then((function(){console.log("Cache storage cleared.");})).catch((function(e){console.error(e);}));}clearMemory(){for(let e of this.cache.values())e.objectUrl&&(URL.revokeObjectURL(e.objectUrl),delete e.objectUrl);l$1.$emit("itemCache:cacheChange");}checkQuota(e=0){let t=this.size+e;if(t>this.quota){const e=[...this.cache.entries()].sort((function(e,t){return e[1].time.valueOf()-t[1].time.valueOf()}));let a=0;for(;t>this.quota&&a<e.length;){const i=e[a][1];i.objectUrl||(t-=i.size,this.removeObjectFromCache(i.id)),a++;}}}removeObjectFromCache(e){const t=this.cache.get(e);t&&(t.objectUrl&&URL.revokeObjectURL(t.objectUrl),this.cache.delete(e),this.size-=t.size,this.usePersistentStorage&&(this._remove(`blob_${t.id}`).then((function(){console.log(`Removed blob for ${e} from cache`);})).catch((function(t){console.error(`Error removing blob for ${e} from cache: ${t}`);})),this.saveIndex()));}getIdFromUrl(e){return this.urlToIdMap.has(e)?this.urlToIdMap.get(e):null}getById(e){const t=this.findObject(e);return t?(this.logging&&console.log("Retrieving from cache: "+e),t.time=j(),t):(this.logging&&console.error("Object not in cache: "+e),null)}getObjectUrl(e){const t=this.getIdFromUrl(e);if(!t)return console.error("Could not find URL in cache: "+e),"";const a=this.getById(t);return a?a.objectUrl:(console.error("Could not find Id in cache: "+t),"")}async getBufferById(e){const t=await this.getBlobById(e);return t?await new Response(t).arrayBuffer():null}async getBlobById(e){const t=this.getById(e);return t?await fetch(t.objectUrl).then((e=>e.blob())):null}async loadFromStorage(e){if(e.objectUrl)return true;let t=null;return !!this.usePersistentStorage&&(t=await this._get(`blob_${e.id}`),!!t&&(e.objectUrl=URL.createObjectURL(t),e.time=j(),this.saveIndex(),l$1.$emit("itemCache:cacheChange"),true))}getCacheKey(e,t){return t&&"item"!==t.type?e+"_lod"+t.index:e}_getLodLevelUrl(e,t){let a;return a=t&&"item"!==t.type?this.apiClient.getAttachmentDownloadUrl(e,"lod",t.index):this.apiClient.getDownloadUrl(e),a}async loadItem(e,t,a){let i=0;for(;;)try{let i;if(this.usePublicApi)i=t&&"item"!==t.type?await this.apiClient.downloadPublicAttachment(e,"lod",t.index,void 0,a):await this.apiClient.publicDownloadItem(e,a);else try{i=t&&"item"!==t.type?await this.apiClient.downloadAttachment(e,"lod",t.index,void 0,a):await this.apiClient.downloadItem(e,a);}catch{i=t&&"item"!==t.type?await this.apiClient.downloadPublicAttachment(e,"lod",t.index,void 0,a):await this.apiClient.publicDownloadItem(e,a);}return i}catch(t){if(console.log(t),i++,!(i<3))return l$1.$emit("client:fatalError",`Failed to download item ${e}`),null;console.debug(`Failed attempts to download item ${e}: ${i}. Trying again...`);}}async addItemToCache(e,t,a,i){try{const n=this.getCacheKey(e,t),r=this.findObject(n);if(r&&(a||!this.apiClient.getItemHash||this.usePublicApi||(a=await this.apiClient.getItemHash(e)),a&&r.hash===a&&(this.logging&&console.log("Item already in cache: "+e),await this.loadFromStorage(r))))return r.url||(r.url=this._getLodLevelUrl(e,t)),this.urlToIdMap.set(r.url,n),this.cache.set(n,r),r;i&&i(0);let s=await this.loadItem(e,t,i);if(!s)return console.error("Was not able to load object into cache: "+n),null;i&&i(100);const o=this._getLodLevelUrl(e,t),u=URL.createObjectURL(s.blob),c={id:n,url:o,time:j(),objectUrl:u,size:s.blob.size,hash:s.hash,itemType:s.itemType,mimeType:s.mimeType,itemName:s.itemName};return this.checkQuota(c.size),await this.addToStorage(c,s.blob),this.cache.set(n,c),this.urlToIdMap.set(o,n),this.saveIndex(),l$1.$emit("itemCache:cacheChange"),this.logging&&console.log("Added item to cache: ",c),c}catch(e){return console.error(e),null}}getObjectCount(){return this.cache.size}getObjectSize(){let e=0;for(const t of this.cache.values())e+=t.size;return e}handleRename({id:e,newName:t}){const a=this.cache.get(e);a&&(a.itemName=t,this.saveIndex(),l$1.$emit("itemCache:cacheChange"));}}class Wr extends sr{apiClient;ready=false;maxNumItems=1e4;constructor(e){if(super("lumino","folders",1),!e)throw "A lumino client needs to be passed.";this.apiClient=e;}async init(){await super.init(),await this.checkStorage(),this.ready=true;}clear(){return this._clear()}async checkStorage(){const e=await this._keys();let t=e.length-this.maxNumItems;if(t>0){t=Math.floor(this.maxNumItems/2);const a=[];for(let i=0;i<t;i++)a.push(this._remove(e[i]));await Promise.all(a);}}async getFolderListing(e){return this.ready?this._get(e,"application/json"):null}async getItemListing(e){if(!this.ready)return null;const t=await this._get("items_"+e,"application/json");if(!t)return null;const a=await this.getFolderListing(e);return a&&a.parent&&new Date(t.cachedAt).getTime()>new Date(a.parent.updatedAt).getTime()?t.data:null}async getFolderACLs(e,t){if(!this.ready)return null;const a=await this._get("acl_"+e,"application/json");return a&&Date.now()-a.cachedAt<t?(delete a.cachedAt,a):null}async refreshCacheForFolder(e){const t=await this.getFolderListing(e);await this.addFolderListing(e,t);}async addFolderListing(e,t){this.ready&&(await this._set(e,{...t,cachedAt:new Date}),await this.checkStorage());}async addItemListing(e,t){this.ready&&(await this._set("items_"+e,{data:t,cachedAt:new Date}),await this.checkStorage());}async addACL(e,t){this.ready&&(await this._set("acl_"+e,{...t,cachedAt:new Date}),await this.checkStorage());}}class Yr extends sr{apiClient;constructor(e){if(super("lumino","thumbs",1),!e)throw "A lumino client needs to be passed.";this.apiClient=e;}clear(){this._clear();}async _loadThumbnail(e,t){try{return await this.apiClient.getThumbnail(e,t)}catch{try{return await this.apiClient.getPublicThumbnail(e,t)}catch{return null}}}async get(e,t,a,i){if(!t)throw "Cannot retrieve item thumbnail from cache without knowing size!";let n=await this._get(e,"application/json");if(n&&n.hash===a&&n.timestamp===i){for(const e of n.thumbnails)if(e.size===t){if(e.data)return e.data;n.thumbnails.removeObject(e);break}let a=await this._loadThumbnail(t,e);return a&&(n.thumbnails.push({size:t,data:a}),await this._set(e,n)),a}let r=await this._loadThumbnail(t,e);if(a||i){let s=[];r&&s.push({size:t,data:r}),n={id:e,hash:a,timestamp:i,thumbnails:s},await this._set(e,n);}return r}}class Hr{apiClient;cache=new Map;constructor(e){this.apiClient=e,this.cache=new Map;}async resolve(e){let t=this.cache.get(e);if(!t)try{t=this.apiClient.getUserPublicInfo(e,this.apiClient.requestClientId,32),this.cache.set(e,t);}catch(e){console.error(e);}return t}}class Gr{apiClient;cache=new Map;constructor(e){this.apiClient=e;}async resolve(e){let t=this.cache.get(e);if(!t)try{t=this.apiClient.getGroupPublicInfo(e,this.apiClient.requestClientId,32),this.cache.set(e,t);}catch(e){console.error(e);}return t}}class qr{apiClient;cache=new Map;constructor(e){this.apiClient=e;}async get(e,t,a,i,n=false){const r=`${e}_${t}_${a}${ void 0===i?"":`_${i}`}`,s=this.cache.get(r);if(s)return s;try{const s=new Promise((async r=>{try{let s;s=n?await this.apiClient.downloadPublicAttachment(e,t,a,i,void 0):await this.apiClient.downloadAttachmentPOP(e,t,a,i,void 0);r(URL.createObjectURL(s.blob));}catch(e){r(null);}}));return this.cache.set(r,s),s}catch(e){return console.warn(`Attachment ${r} not available.`),null}}invalidateAttachment(e,t,a,i){let n=`${e}_${t}`;null!=a&&(n+=`_${a}`);for(const e of this.cache.keys()){const t=null==i||e.endsWith(`_${i}`);e.startsWith(n)&&t&&this.cache.delete(e);}}}class Zr{apiClient;itemRepo;jobManager;items=[];hasExternalResources=false;totalSize=0;affectedFolderIds=new Set;constructor(e){this.apiClient=e,this.itemRepo=e.getItemRepo(),this.jobManager=e.getJobManager();}_updateQuota(){this.apiClient.eventBus.$emit("quota:update");}async getPreviousVersions(e,t){const a=[];t=t||"published";const i=await this.apiClient.createFolder({name:t,parent:e,returnIfExists:true}),n=await this.apiClient.getFoldersInFolderList(i,{folderAsItemType:"Package"});for(const e of n.children)e.item&&a.push({itemId:e.item._id,folderId:e._id,version:e.name,name:e.item.name,filesize:0|e.item.filesize,visibility:e.item.visibility});return a}async verify(e){const t=this,a=new Map,i=new Map;e=e?await this.itemRepo.loadItem(e._id,{recursive:true}):this.itemRepo.activeItem;const n=await r(e.folder);async function r(e){try{if(e){const a=e._id?e._id:e;if(i.has(a))return i.get(a);{const e=(await t.apiClient.getFolderPath(a)).path;return i.set(a,e),e}}return "/"}catch{return ""}}await this.itemRepo.traverseItems((async function(e){const t={_id:e._id,name:e.name,type:e.type,size:e.totalSize,path:await r(e.folder),item:e,external:false};t.path.startsWith(n)?t.path=t.path.slice(n.length):t.external=true,a.set(e._id,t);})),this.items=Array.from(a.values()),this.hasExternalResources=false,this.totalSize=0;for(const e of this.items)e.external&&(this.hasExternalResources=true),this.totalSize+=e.size;return !this.hasExternalResources}getItems(){return this.items}async unpackToProject(e,t,a,i){a&&(t=await this.apiClient.createFolder({name:a,parent:t,returnIfExists:true}));const n=await this.apiClient.getItem(e);n.folder===t&&await this.apiClient.renameItem(e,n.name+" (Unpackaged)");const r=await this.apiClient.createFolder({name:n.name,parent:t,fixNameCollisions:true}),s=await this.jobManager.execute("JS:Unpackage",[{_id:e,isFolder:false}],[{name:"Destination Folder",value:r},{name:"Make Destination Visible",value:false}],i);if(this._updateQuota(),3===s.state){const t=s.log.trim().split(";");if(2!==t.length||"UNPACKAGED"!==t[0])throw new N$1("Unpacking failed. Did not get unpackaged item id!");const a=t[1].trim();return await this.apiClient.renameItem(a,n.name),await this.itemRepo.replaceLink(e,a),a}if(2===s.state)throw new N$1("Unpacking failed: "+s.error)}async copyItemToProject(e,t,a,i){return (await this.copyItemsToProject([{_id:e,isFolder:false}],t,a,i))[0].newId}async copyItemsToProject(e,t,a,i){a=a||"packages",t=await this.apiClient.createFolder({name:a,parent:t,returnIfExists:true}),this.affectedFolderIds.add(t);const n=[];if(e.length){const a=await this.jobManager.execute("JS:CloneItem",e,[{name:"Deep Clone",value:false},{name:"Destination Folder",value:t},{name:"Exclude Types",value:""},{name:"Make Private",value:true}],i);if(this._updateQuota(),3===a.state){if(!a.log.trim().length)throw new N$1("Copy job returned no results.");{const e=a.log.split("\n").reverse();for(const t of e){const e=t.trim().split(";");if(3===e.length){const t=e[1],a=e[2];await this.itemRepo.replaceLink(t,a),n.push({oldId:t,newId:a});}}}}else if(2===a.state)throw new N$1("Copying of items failed: "+a.error)}return n}async copyToProject(e,t,a){const i=[];for(const e of this.items)e.external&&i.push({_id:e._id,isFolder:false});return this.copyItemsToProject(i,e,t,a)}async unpublish(e){await this.apiClient.makeItemPrivate(e,false,false);}async publish(e,t,a,i,n,r,s,o){const l=e.version;i=i||`published/${l.major}.${l.minor}.${l.revision}`,n=void 0===n||n,r=void 0===r||r,this.affectedFolderIds.add(a);let u,c=a;if(i){const e=i.split("/");for(const t of e)c=await this.apiClient.createFolder({name:t,parent:c,returnIfExists:true}),this.affectedFolderIds.add(c),u||(u=c);}const d=(await this.apiClient.getFoldersInFolderList(a)).children.map((e=>e._id)).filter((e=>e!==u)).join(","),p=await this.jobManager.execute("JS:CreatePackage",[{_id:e._id,isFolder:false}],[{name:"Folders To Include",value:d},{name:"Destination Folder",value:c},{name:"Item Name",value:t},{name:"Make Public",value:!!n},{name:"Copy External",value:!!r},{name:"Always Create New Package",value:!!s},{name:"Make Cloneable",value:!!o}]);if(this._updateQuota(),2===p.state)throw new N$1("Packaging failed: "+p.error);this.apiClient.eventBus.$emit("folder:changed",Array.from(this.affectedFolderIds.values()));}}class Jr{id;job;nextCheckMs;constructor(e,t,a){this.id=e,this.job=a,this.nextCheckMs=t;}}class Kr{apiClient;jobs=new Map;constructor(e){this.apiClient=e;}getJobs(){return Array.from(this.jobs.values())}async execute(e,t,a,i=void 0,n=void 0){const r=this;return new Promise((async(s,o)=>{try{const o=async()=>{try{u.job=await r.apiClient.getJobState(l);let e=!1;switch(u.job.state){case 0:case 1:try{i&&i(u.job);}catch(e){console.error("Error calling progress callback: ",e);}break;case 2:case 3:console.log("Job is done."),e=!0,s(u.job);}e?r.jobs.delete(l):(u.nextCheckMs=Math.min(2*u.nextCheckMs,8e3),setTimeout(o,u.nextCheckMs));}catch(e){console.error("Error fetching job state: "+e);}},l=await r.apiClient.createJob({type:e,elements:t,parameters:a,requiredParameters:n}),u=new Jr(l,1e3);r.jobs.set(l,u),setTimeout(o,u.nextCheckMs);}catch(e){o(e);}}))}}const Xr={mp3:{name:"Mpeg Audio Layer 3",itemType:"Audio",itemTypeCollection:"Audio Collection",collectionEntryName:"AudioItems",folderName:"audio",defaultAction:"Use",actions:["Skip","Use"]},hdr:{name:"HDR Image",itemType:"HDR Image",folderName:"envmaps",defaultAction:"Use",actions:["Skip","Use"]},glb:{name:"Gltf Binary",itemType:"Mesh",itemTypeCollection:"Mesh Collection",collectionEntryName:"MeshItems",folderName:"meshes",defaultAction:"Use",actions:["Skip","Use"]},png:{name:"Portable Network Graphics",itemType:"Image",folderName:"textures",defaultAction:"Use",actions:["Skip","Use"]},jpg:{name:"JPEG",itemType:"Image",folderName:"textures",defaultAction:"Use",actions:["Skip","Use"]},jpeg:{name:"JPEG",itemType:"Image",folderName:"textures",defaultAction:"Use",actions:["Skip","Use"]},lua:{name:"Lua",itemType:"Script",folderName:"scripts",defaultAction:"Use",actions:["Skip","Use"]},ttf:{name:"True Type Font",itemType:"Font",folderName:"fonts",defaultAction:"Use",actions:["Skip","Use"]},otf:{name:"Open Type Font",itemType:"Font",folderName:"fonts",defaultAction:"Use",actions:["Skip","Use"]},unknown:{name:"Unsupported",itemType:"Unknown",defaultAction:"Skip",actions:["Skip"],invisible:true}},Qr={Audio:"audio","Audio Collection":"audio","HDR Image":"envmaps",Mesh:"meshes","Mesh Collection":"",Script:"scripts",Material:"materials","Background Shader":"background shaders","Pixel Shader":"pixel shaders","Vertex Shader":"vertex shaders",Image:"textures",Scene:"prefabs",Font:"fonts"};function es(e,t){let a=Xr[t];a||(a=Xr.unknown),e.size=e.blob?e.blob.size:0,e.type=a.name,e.collectionType=a.itemTypeCollection,e.collectionEntryName=a.collectionEntryName,e.action=a.defaultAction,e.actions=a.actions,e.folderName=a.folderName,e.itemType=a.itemType,e.name=function(e,t){let a=e.lastIndexOf(".");return e.substring(0,a<0?e.length:a)+"."+t}(e.name,t);}class ts{name;blob;processing=false;progress=0;size=0;type;collectionType;collectionEntryName;action;actions;folderName;itemType;constructor(e,t,a){this.name=e,this.blob=t,es(this,a);}}class as{apiClient;itemRepo;jobManager;items=[];mainItem;totalSize=0;oldMainItemId;originalItemIds=[];affectedFolderIds=new Set;packageId;converter;supportedExtensions;hasExternalResources=false;constructor(e){this.apiClient=e,this.itemRepo=e.getItemRepo(),this.jobManager=e.getJobManager();const t=[];for(const e in Xr)Xr[e].invisible||t.push(`.${e.toUpperCase()}`);this.supportedExtensions=t.sort(((e,t)=>e.localeCompare(t)));}_updateQuota(){this.apiClient.eventBus.$emit("quota:update");}_addAffectedFolder(e){"object"==typeof e&&e._id?this.affectedFolderIds.add(e._id):"string"==typeof e?this.affectedFolderIds.add(e):console.error("Invalid affected folder to add: ",e);}getAffectedFolderIds(){return Array.from(this.affectedFolderIds.values())}getSupportedExtensions(){return this.supportedExtensions}setConverter(e){this.converter=e;}setItems(e){this.items=e;}async scan(e){const t=this,a=new Map,i=new Map;this.mainItem=await this.itemRepo.loadItem(e,{recursive:true}),this.oldMainItemId=this.mainItem._id;const n=await r(this.mainItem.folder);async function r(e){try{if(e){const a=e._id?e._id:e;if(i.has(a))return i.get(a);{const e=(await t.apiClient.getFolderPath(a)).path;return i.set(a,e),e}}return "/"}catch(e){return console.error(e),""}}await this.itemRepo.traverseItems((async function(e){const i={_id:e._id,name:e.name,type:e.type,size:e.totalSize,path:await r(e.folder),item:e,external:false};i.path.startsWith(n)?i.path=i.path.slice(n.length):i.external=true,t._addAffectedFolder(e.folder),a.set(e._id,i);}),this.mainItem),this.items=Array.from(a.values()),this.originalItemIds=this.items.map((e=>e._id)),this.hasExternalResources=false,this.totalSize=0;for(const e of this.items)e.external&&(this.hasExternalResources=true),this.totalSize+=e.size;return this.items}getItems(){return this.items}async saveMainItemChanges(){const e=this.mainItem;await this.apiClient.updateItem({_id:e._id,name:e.name,shortDescription:e.shortDescription,description:e.description,tags:e.tags,categories:e.categories,visibility:e.visibility,contributors:e.contributors,version:e.version});}async createAssetFolder(e,t){let a=e;const i=t.split("/");this._addAffectedFolder(e);for(const e of i)a=await this.apiClient.createFolder({name:e,parent:a,returnIfExists:true}),this._addAffectedFolder(a);const n=await this.apiClient.getItemsInFolderList(a,true);if(n&&n.length)throw new Error("Asset folder already exists and is not empty!");return a}createStandardAssetFolderPath(e){let t=Qr[e.type];return t||(t=e.type.toLowerCase()+"s"),`assets/${t}/${e.name}`}async executeActions(){if(!this.converter)throw new Error("No converter is configured. Cannot execute actions on items.");return this.converter(this.items,es)}async createAsset(e,t=false,a){const i=[];for(const e of this.items)i.push(e._id);if(this._addAffectedFolder(e),i.length)if(t){await this.apiClient.moveItems({items:i,dest:e})!==i.length&&console.warn("Not all items could be moved. Most likely due to permissions."),this.mainItem.folder=e;}else {const t=await this.jobManager.execute("JS:CloneItem",[{_id:this.mainItem._id,isFolder:false}],[{name:"Deep Clone",value:true},{name:"Destination Folder",value:e},{name:"Exclude Types",value:""}],a);if(3===t.state){const a=t.log.split("\n").reverse()[0].split(";");this.mainItem={...this.mainItem,_id:a[2],folder:e};}else if(2===t.state)throw new N$1("Copying of items failed: "+t.error)}"Main"!==this.mainItem.name&&(this.mainItem.originalName=this.mainItem.name,this.mainItem.name="Main",await this.apiClient.renameItem(this.mainItem._id,this.mainItem.name));const n=await this.apiClient.getItem(this.mainItem._id);return n.flags||(n.flags=[]),n.flags.includes("original")||n.flags.push("original"),await this.apiClient.updateItem(n),this._updateQuota(),this.mainItem._id}async createPackage(e,t=false,a=false){let i,n=this.mainItem.folder;if(this._addAffectedFolder(n),void 0===e){const t=this.mainItem.version||{major:1,minor:0,revision:0};e=`published/${t.major}.${t.minor}.${t.revision}`;}if(void 0===t&&(t=true),e){const t=e.split("/");for(const e of t)n=await this.apiClient.createFolder({name:e,parent:n,returnIfExists:true}),this._addAffectedFolder(n),i||(i=n);}const r=(await this.apiClient.getFoldersInFolderList(this.mainItem.folder)).children.map((e=>e._id)).filter((e=>e!==i)).join(","),s=await this.jobManager.execute("JS:CreatePackage",[{_id:this.mainItem._id,isFolder:false}],[{name:"Folders To Include",value:r},{name:"Destination Folder",value:n},{name:"Item Name",value:this.mainItem.originalName||this.mainItem.name},{name:"Make Public",value:!!t},{name:"Copy External",value:!!a}]);if(this._updateQuota(),2===s.state)throw new N$1("Packaging failed: "+s.error);const o=s.log.split("\n").reverse()[0].split(";");this.packageId=o[2];}async replaceReferences(){await this.itemRepo.replaceLink(this.oldMainItemId,this.packageId);}async deleteOriginalItems(){await this.apiClient.deleteItem(this.originalItemIds);}sendFolderRefreshEvent(){this.apiClient.eventBus.$emit("folder:changed",this.getAffectedFolderIds());}async processUploads(e){const t=[];for(const a of e)if("application/zip"===a.type||"application/x-zip-compressed"===a.type){const e=new r$1;try{const i=[];(await e.loadAsync(a)).forEach(((e,a)=>{const n=a.name.split("/").pop();if(!n.startsWith(".")){const e=n.split(".").pop(),r=a.async("blob");i.push(r),r.then((function(i){const n=new ts(a.name,i,e);t.push(n);}));}})),await Promise.all(i);}catch(e){console.error("Error reading the ZIP file:",e);}}else {const e=a.name.split(".").pop(),i=new ts(a.name,a,e);t.push(i);}return t}detectAssets(e){let t,a,i,n=0;for(const r of e)if("Use"===r.action)if(void 0===t)t=r.itemType,a=r.collectionType,i=r.folderName,n++;else {if(t!==r.itemType)return {valid:false,reason:"Mixed item types found. To create an asset, upload a single type of file for example only meshes."};n++;}return 0===n?{valid:false,reason:"There are no files we can use to create an asset."}:n>1&&!a?{valid:false,reason:"Cannot create collections of this type."}:{valid:true,assetType:n>1?a:t,itemCount:n,folderName:i}}_filterUploadFiles(e){let t=[];for(const a of e)"Use"===a.action&&t.push(a);return t}createNewItem(){return {name:"New asset",type:"",description:"",shortDescription:"",tags:[],flags:["original"],categories:[],license:"CC0",allowConversation:true,version:{major:1,minor:0,revision:0}}}async createAssetFromFiles(e,t,a,i=false,n=false){const r=this.detectAssets(e);if(r.assetType!==a.type)throw new Error("Asset type not valid for these items.");if(!r.valid)throw new Error(r.reason||"No valid asset detected.");let s=await this.apiClient.createFolder({name:r.folderName,parent:t,returnIfExists:true}),o=await this.apiClient.createFolder({name:a.name,parent:s,returnIfExists:true}),l=false;if(0===(await this.apiClient.getItemsInFolderList(o)).length){(await this.apiClient.getFoldersInFolderList(o)).children.length&&(l=true);}else l=true;if(l){if(!i)throw new Error("Cannot create asset, target folder is not empty!");await this.apiClient.deleteFolder(o),o=await this.apiClient.createFolder({name:a.name,parent:s});}let u,c=this._filterUploadFiles(e);if(1===c.length){const e=c[0];e.processing=true,e.progress=0,u=await this.apiClient.uploadAndCreate(o,e.blob,e.name,{nameOverride:"Main",flags:"original"},(function(t){e.progress=t;})),this._updateQuota(),e.action="Skip";}else {let e=await this.apiClient.createFolder({name:"resources",parent:o}),t={},a=[],i=0;for(const n of c){n.processing=true,n.progress=0;const r=await this.apiClient.uploadAndCreate(e,n.blob,n.name,void 0,(function(e){n.progress=e;}));this._updateQuota(),n.action="Skip",t[`${n.collectionEntryName}[${i}]->Name`]="",a.push({usage:`MeshItems[${i}]->Mesh`,to:r}),i++;}u=await this.apiClient.createItem({type:r.assetType,name:"Main",flags:["original"],folder:o,fixNameCollisions:true,attributes:t,links:a});}return a._id=u,a.folder=o,this.mainItem=a,n?{assetItemId:u,assetTypeFolderId:s,assetFolderId:o}:u}}class is{apiClient;itemRepo;constructor(e){this.apiClient=e,this.itemRepo=e.getItemRepo();}grab(e,t,a,i){i=i||{};const n=[];for(const r of a){const a=this._serializeBlockFields(r),s=this._serializeScripts(r),o={type:"block",item:e._id,field:t.name,path:"",block:{id:r.id,type:r.type||"Group",fields:a,scripts:s,children:[]}};i.omitPath||(o.path=this._getBlockPath(r)),i.withChildren&&(o.block.children=this.grab(e,t,r.blocks||[],{withChildren:true,returnArray:true})),n.push(o);}if(i.returnArray)return n;const r={type:"serializedBlocks",data:n};return i.noStringify?r:JSON.stringify(r,null,2)}async put(e,t,a,i={}){e=this.validateMessage(e);const n=[];for(const r of e.data){const e=await this._putBlock(r,t,a,i);e&&n.push(e);}return n}validateMessage(e){if("string"==typeof e&&(e=JSON.parse(e)),"serializedBlocks"!==e.type)throw new Error("Data must be a serialized block message. Format is wrong.");if(!Array.isArray(e.data))throw new Error("The contained data is not an array.");return e}async clone(e,t,a,i,n={}){const r=this.grab(i,t,[e],{withChildren:true,noStringify:true});return this.put(r,t,a,n)}_updateScriptFieldReferences(e,t){const a=new Map,i=(e,t)=>{a.set(e.block.id,t.id);const n=e.block.children||[],r=t.blocks||[];for(let e=0;e<n.length;e++)i(n[e],r[e]);};i(e,t),this.itemRepo.updateScriptFieldReferencesFromMap(a,t);}async _putBlock(e,t,a,i={},n=false){if(!e.block||!e.block.type||!e.block.fields)return null;const r=e.block,s=this._findItemById(e.item)??this.itemRepo.activeItem;let o=a;o||(o=this._findParentBlock(s,e.field,e.path));const l={};if(Array.isArray(r.fields))for(const e of r.fields){const{name:t,type:a,value:n,linkto:r}=e;if("Separator"!==a)if(i.fieldOverrides&&t in i.fieldOverrides)l[t]=i.fieldOverrides[t];else if(r){const e=this.itemRepo.getLoadedItem(r);l[t]=e||await this.itemRepo.loadItem(r);}else l[t]=n;}const u=i.dontCopyScripts?[]:[...r.scripts],c=await this._createUnproxifiedBlock(r.type,l,u,t,s),d={...i,parentPosition:void 0,fieldOverrides:void 0};if(!c)return console.warn(`Could not create block of type ${r.type}. Skipping.`),null;if(Array.isArray(r.children))for(const e of r.children)await this._putBlock(e,t,c,d,true);if(n&&o)return "number"==typeof i.parentPosition?o.blocks.splice(i.parentPosition,0,c):o.blocks.push(c),c.parent=o,c;i.dontCopyScripts||this._updateScriptFieldReferences(e,c);return this._proxifyAndAttachTree(c,o,s,i.parentPosition)}async _createUnproxifiedBlock(e,t,a,i,n){let r=ce.instance.getTemplate(n.packageType||n.type,i.name,e);if(!r)return null;if(t){const e=r.template.clone().specialize(t);r={displayName:r.displayName,typeName:r.typeName,template:e,inputs:r.inputs,outputs:r.outputs};}const s=new pe(void 0,void 0,r.typeName,void 0,r.displayName,n),o=await this.itemRepo.createFieldsForItem(s,r.template,n,true);return s.setFields(o),s.blocks=[],await this.itemRepo.createScriptsForItem(s,a,n,false),s}_proxifyAndAttachTree(e,t,a,i){const n=e=>{if(Array.isArray(e.blocks)&&e.blocks.length)for(const t of e.blocks)n(t);const t=e.blocks.map((e=>y$1.instance.proxyBlock(e,a)));e.blocks=y$1.instance.proxyBlockArray(t,e,a),e.scripts=y$1.instance.proxyScriptArray(e.scripts,e,a);};n(e),e.parent=t;const r=y$1.instance.proxyBlock(e,a);return "number"==typeof i?t.blocks.splice(i,0,r):t.blocks.push(r),r}_findItemById(e){return this.itemRepo.findLoadedItem(e)}_findItemField(e,t){if(!e.fieldInstances)return null;for(const a of e.fieldInstances)if(a.name===t)return a;return null}_findParentBlock(e,t,a){const i=this._findItemField(e,t);if(!i)return null;const n=a.split("/");let r=i.blocks,s=null;for(const e of n)s=r[e],r=s.blocks;return s}_getBlockIndex(e){if(!e.parent)return 0;let t=0;for(const a of e.parent.blocks){if(e.id===a.id)return t;t++;}throw new Error("Could not find block in parent block array!")}_getBlockPath(e){const t=[];let a=e;for(;a;)t.push(this._getBlockIndex(a)),a=a.parent;return "/"+t.reverse().join("/")}_serializeBlockFields(e){const t=[];if(!Array.isArray(e.fields))return t;for(const a of e.fields)switch(a.type){case "Link":t.push({name:a.name,linkto:a.value?._id});break;case "Attribute":t.push({name:a.name,value:a.value});break;case "Separator":t.push({name:a.name,type:"Separator"});}return t}_serializeScripts(e){const t=[];if(!Array.isArray(e.scripts))return t;for(const a of e.scripts){const e=[],i={item:a.item?.value?._id,fields:e};for(const t of a.fields)switch(t.type){case "Link":e.push({name:t.name,linkto:t.value?._id});break;case "LinkArray":e.push({name:t.name,value:Array.isArray(t.value)?t.value.map((e=>e?._id??e)):[]});break;default:e.push({name:t.name,value:t.value});}t.push(i);}return t}}function ns(){throw new Error("setTimeout has not been defined")}function rs(){throw new Error("clearTimeout has not been defined")}Array.prototype.pushAll||(Array.prototype.pushAll=function(e){for(const t of e)this.push(t);}),Array.prototype.removeObject||(Array.prototype.removeObject=function(e){const t=this.indexOf(e);return t>-1&&(this.splice(t,1),true)}),Array.prototype.moveObjectToArray||(Array.prototype.moveObjectToArray=function(e,t,a){const i=this.indexOf(e);if(i>-1){return (0, this.moveToArray)(i,t,a)}return false}),Array.prototype.removeByFilterFunc||(Array.prototype.removeByFilterFunc=function(e){let t=0;for(let a=0;a<this.length;a++)e(this[a])&&(this.splice(a,1),a--,t++);return t}),Array.prototype.clone||(Array.prototype.clone=function(){const e=[];for(const t of this)e.push(t);return e});var ss=ns,os=rs;function ls(e){if(ss===setTimeout)return setTimeout(e,0);if((ss===ns||!ss)&&setTimeout)return ss=setTimeout,setTimeout(e,0);try{return ss(e,0)}catch(t){try{return ss.call(null,e,0)}catch(t){return ss.call(this,e,0)}}}"function"==typeof Li.setTimeout&&(ss=setTimeout),"function"==typeof Li.clearTimeout&&(os=clearTimeout);var us,cs=[],ds=false,ps=-1;function hs(){ds&&us&&(ds=false,us.length?cs=us.concat(cs):ps=-1,cs.length&&fs());}function fs(){if(!ds){var e=ls(hs);ds=true;for(var t=cs.length;t;){for(us=cs,cs=[];++ps<t;)us&&us[ps].run();ps=-1,t=cs.length;}us=null,ds=false,function(e){if(os===clearTimeout)return clearTimeout(e);if((os===rs||!os)&&clearTimeout)return os=clearTimeout,clearTimeout(e);try{return os(e)}catch(t){try{return os.call(null,e)}catch(t){return os.call(this,e)}}}(e);}}function ms(e,t){this.fun=e,this.array=t;}ms.prototype.run=function(){this.fun.apply(null,this.array);};function ys(){}var gs=ys,bs=ys,vs=ys,_s=ys,ws=ys,As=ys,ks=ys;var Ss=Li.performance||{},Ns=Ss.now||Ss.mozNow||Ss.msNow||Ss.oNow||Ss.webkitNow||function(){return (new Date).getTime()};var Ts=new Date;var Ms={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)t[a-1]=arguments[a];cs.push(new ms(e,t)),1!==cs.length||ds||ls(fs);},title:"browser",browser:true,env:{},argv:[],version:"",versions:{},on:gs,addListener:bs,once:vs,off:_s,removeListener:ws,removeAllListeners:As,emit:ks,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return "/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Ns.call(Ss),a=Math.floor(t),i=Math.floor(t%1*1e9);return e&&(a-=e[0],(i-=e[1])<0&&(a--,i+=1e9)),[a,i]},platform:"browser",release:{},config:{},uptime:function(){return (new Date-Ts)/1e3}};const xs=()=>new Map,Vs=e=>{const t=xs();return e.forEach(((e,a)=>{t.set(a,e);})),t},Cs=(e,t,a)=>{let i=e.get(t);return void 0===i&&e.set(t,i=a()),i},Is=()=>new Set,Fs=e=>e[e.length-1],Es=(e,t)=>{for(let a=0;a<t.length;a++)e.push(t[a]);},Ds=Array.from,Rs=Array.isArray;class Ls{constructor(){this._observers=xs();}on(e,t){return Cs(this._observers,e,Is).add(t),t}once(e,t){const a=(...i)=>{this.off(e,a),t(...i);};this.on(e,a);}off(e,t){const a=this._observers.get(e);void 0!==a&&(a.delete(t),0===a.size&&this._observers.delete(e));}emit(e,t){return Ds((this._observers.get(e)||xs()).values()).forEach((e=>e(...t)))}destroy(){this._observers=xs();}}class Ps{constructor(){this._observers=xs();}on(e,t){Cs(this._observers,e,Is).add(t);}once(e,t){const a=(...i)=>{this.off(e,a),t(...i);};this.on(e,a);}off(e,t){const a=this._observers.get(e);void 0!==a&&(a.delete(t),0===a.size&&this._observers.delete(e));}emit(e,t){return Ds((this._observers.get(e)||xs()).values()).forEach((e=>e(...t)))}destroy(){this._observers=xs();}}const Bs=Math.floor,Os=Math.abs,$s=(e,t)=>e<t?e:t,js$1=(e,t)=>e>t?e:t,Us=Math.pow,zs=e=>0!==e?e<0:1/e<0,Ws=64,Ys=128,Hs=127,Gs=Number.MAX_SAFE_INTEGER,qs=Number.isInteger||(e=>"number"==typeof e&&isFinite(e)&&Bs(e)===e),Zs=String.fromCharCode,Js=/^\s*/g,Ks=/([A-Z])/g,Xs=(e,t)=>(e=>e.replace(Js,""))(e.replace(Ks,(e=>`${t}${(e=>e.toLowerCase())(e)}`))),Qs="undefined"!=typeof TextEncoder?new TextEncoder:null,eo=Qs?e=>Qs.encode(e):e=>{const t=unescape(encodeURIComponent(e)),a=t.length,i=new Uint8Array(a);for(let e=0;e<a;e++)i[e]=t.codePointAt(e);return i};let to="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:true,ignoreBOM:true});to&&1===to.decode(new Uint8Array).length&&(to=null);class ao{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[];}}const io=()=>new ao,no=e=>{let t=e.cpos;for(let a=0;a<e.bufs.length;a++)t+=e.bufs[a].length;return t},ro=e=>{const t=new Uint8Array(no(e));let a=0;for(let i=0;i<e.bufs.length;i++){const n=e.bufs[i];t.set(n,a),a+=n.length;}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),a),t},so=(e,t)=>{const a=e.cbuf.length;e.cpos===a&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(2*a),e.cpos=0),e.cbuf[e.cpos++]=t;},oo=so,lo=(e,t)=>{for(;t>Hs;)so(e,Ys|Hs&t),t=Bs(t/128);so(e,Hs&t);},uo=(e,t)=>{const a=zs(t);for(a&&(t=-t),so(e,(t>63?Ys:0)|(a?Ws:0)|63&t),t=Bs(t/64);t>0;)so(e,(t>Hs?Ys:0)|Hs&t),t=Bs(t/128);},co=new Uint8Array(3e4),po=co.length/3,ho=Qs&&Qs.encodeInto?(e,t)=>{if(t.length<po){const a=Qs.encodeInto(t,co).written||0;lo(e,a);for(let t=0;t<a;t++)so(e,co[t]);}else mo(e,eo(t));}:(e,t)=>{const a=unescape(encodeURIComponent(t)),i=a.length;lo(e,i);for(let t=0;t<i;t++)so(e,a.codePointAt(t));},fo=(e,t)=>{const a=e.cbuf.length,i=e.cpos,n=$s(a-i,t.length),r=t.length-n;e.cbuf.set(t.subarray(0,n),i),e.cpos+=n,r>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(js$1(2*a,r)),e.cbuf.set(t.subarray(n)),e.cpos=r);},mo=(e,t)=>{lo(e,t.byteLength),fo(e,t);},yo=(e,t)=>{((e,t)=>{const a=e.cbuf.length;a-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(2*js$1(a,t)),e.cpos=0);})(e,t);const a=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,a},go=new DataView(new ArrayBuffer(4)),bo=(e,t)=>{switch(typeof t){case "string":so(e,119),ho(e,t);break;case "number":qs(t)&&Os(t)<=2147483647?(so(e,125),uo(e,t)):(a=t,go.setFloat32(0,a),go.getFloat32(0)===a?(so(e,124),((e,t)=>{yo(e,4).setFloat32(0,t,false);})(e,t)):(so(e,123),((e,t)=>{yo(e,8).setFloat64(0,t,false);})(e,t)));break;case "bigint":so(e,122),((e,t)=>{yo(e,8).setBigInt64(0,t,false);})(e,t);break;case "object":if(null===t)so(e,126);else if(Rs(t)){so(e,117),lo(e,t.length);for(let a=0;a<t.length;a++)bo(e,t[a]);}else if(t instanceof Uint8Array)so(e,116),mo(e,t);else {so(e,118);const a=Object.keys(t);lo(e,a.length);for(let i=0;i<a.length;i++){const n=a[i];ho(e,n),bo(e,t[n]);}}break;case "boolean":so(e,t?120:121);break;default:so(e,127);}var a;};class vo extends ao{constructor(e){super(),this.w=e,this.s=null,this.count=0;}write(e){this.s===e?this.count++:(this.count>0&&lo(this,this.count-1),this.count=1,this.w(this,e),this.s=e);}}const _o=e=>{e.count>0&&(uo(e.encoder,1===e.count?e.s:-e.s),e.count>1&&lo(e.encoder,e.count-2));};class wo{constructor(){this.encoder=new ao,this.s=0,this.count=0;}write(e){this.s===e?this.count++:(_o(this),this.count=1,this.s=e);}toUint8Array(){return _o(this),ro(this.encoder)}}const Ao=e=>{if(e.count>0){const t=2*e.diff+(1===e.count?0:1);uo(e.encoder,t),e.count>1&&lo(e.encoder,e.count-2);}};class ko{constructor(){this.encoder=new ao,this.s=0,this.count=0,this.diff=0;}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Ao(this),this.count=1,this.diff=e-this.s,this.s=e);}toUint8Array(){return Ao(this),ro(this.encoder)}}class So{constructor(){this.sarr=[],this.s="",this.lensE=new wo;}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length);}toUint8Array(){const e=new ao;return this.sarr.push(this.s),this.s="",ho(e,this.sarr.join("")),fo(e,this.lensE.toUint8Array()),ro(e)}}const No=e=>new Error(e),To=()=>{throw No("Method unimplemented")},Mo=()=>{throw No("Unexpected case")},xo=No("Unexpected end of array"),Vo=No("Integer out of Range");class Co{constructor(e){this.arr=e,this.pos=0;}}const Io=e=>new Co(e),Fo=e=>((e,t)=>{const a=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,a})(e,Do(e)),Eo=e=>e.arr[e.pos++],Do=e=>{let t=0,a=1;const i=e.arr.length;for(;e.pos<i;){const i=e.arr[e.pos++];if(t+=(i&Hs)*a,a*=128,i<Ys)return t;if(t>Gs)throw Vo}throw xo},Ro=e=>{let t=e.arr[e.pos++],a=63&t,i=64;const n=(t&Ws)>0?-1:1;if(!(t&Ys))return n*a;const r=e.arr.length;for(;e.pos<r;){if(t=e.arr[e.pos++],a+=(t&Hs)*i,i*=128,t<Ys)return n*a;if(a>Gs)throw Vo}throw xo},Lo=to?e=>to.decode(Fo(e)):e=>{let t=Do(e);if(0===t)return "";{let a=String.fromCodePoint(Eo(e));if(--t<100)for(;t--;)a+=String.fromCodePoint(Eo(e));else for(;t>0;){const i=t<1e4?t:1e4,n=e.arr.subarray(e.pos,e.pos+i);e.pos+=i,a+=String.fromCodePoint.apply(null,n),t-=i;}return decodeURIComponent(escape(a))}},Po=(e,t)=>{const a=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,a},Bo=[e=>{},e=>null,Ro,e=>Po(e,4).getFloat32(0,false),e=>Po(e,8).getFloat64(0,false),e=>Po(e,8).getBigInt64(0,false),e=>false,e=>true,Lo,e=>{const t=Do(e),a={};for(let i=0;i<t;i++){a[Lo(e)]=Oo(e);}return a},e=>{const t=Do(e),a=[];for(let i=0;i<t;i++)a.push(Oo(e));return a},Fo],Oo=e=>Bo[127-Eo(e)](e);class $o extends Co{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0;}read(){var e;return 0===this.count&&(this.s=this.reader(this),(e=this).pos!==e.arr.length?this.count=Do(this)+1:this.count=-1),this.count--,this.s}}class jo extends Co{constructor(e){super(e),this.s=0,this.count=0;}read(){if(0===this.count){this.s=Ro(this);const e=zs(this.s);this.count=1,e&&(this.s=-this.s,this.count=Do(this)+2);}return this.count--,this.s}}class Uo extends Co{constructor(e){super(e),this.s=0,this.count=0,this.diff=0;}read(){if(0===this.count){const e=Ro(this),t=1&e;this.diff=Bs(e/2),this.count=1,t&&(this.count=Do(this)+2);}return this.s+=this.diff,this.count--,this.s}}class zo{constructor(e){this.decoder=new jo(e),this.str=Lo(this.decoder),this.spos=0;}read(){const e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}const Wo=crypto.getRandomValues.bind(crypto),Yo=()=>Wo(new Uint32Array(1))[0],Ho=[1e7]+-1e3+-4e3+-8e3+-1e11,Go=()=>Ho.replace(/[018]/g,(e=>(e^Yo()&15>>e/4).toString(16))),qo=Date.now,Zo=e=>new Promise(e);Promise.all.bind(Promise);const Jo=e=>void 0===e?null:e;let Ko=new class{constructor(){this.map=new Map;}setItem(e,t){this.map.set(e,t);}getItem(e){return this.map.get(e)}},Xo=true;try{"undefined"!=typeof localStorage&&localStorage&&(Ko=localStorage,Xo=!1);}catch(e){}const Qo=Ko,el=Object.assign,tl=Object.keys,al=e=>tl(e).length,il=e=>tl(e).length,nl=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),rl=Object.freeze,sl=e=>{for(const t in e){const a=e[t];"object"!=typeof a&&"function"!=typeof a||sl(e[t]);}return rl(e)},ol=Symbol("Equality"),ll=(e,t,a=0)=>{try{for(;a<e.length;a++)e[a](...t);}finally{a<e.length&&ll(e,t,a+1);}},ul=e=>e,cl=(e,t)=>{if(e===t)return true;if(null==e||null==t||e.constructor!==t.constructor)return false;if(null!=e[ol])return e[ol](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return false;for(let a=0;a<e.length;a++)if(e[a]!==t[a])return false;break;case Set:if(e.size!==t.size)return false;for(const a of e)if(!t.has(a))return false;break;case Map:if(e.size!==t.size)return false;for(const a of e.keys())if(!t.has(a)||!cl(e.get(a),t.get(a)))return false;break;case Object:if(al(e)!==al(t))return false;for(const a in e)if(!nl(e,a)||!cl(e[a],t[a]))return false;break;case Array:if(e.length!==t.length)return false;for(let a=0;a<e.length;a++)if(!cl(e[a],t[a]))return false;break;default:return false}return true},dl=void 0!==Ms&&Ms.release&&/node|io\.js/.test(Ms.release.name)&&"[object process]"===Object.prototype.toString.call(void 0!==Ms?Ms:0),pl="undefined"!=typeof window&&"undefined"!=typeof document&&!dl;let hl;const fl$2=e=>(()=>{if(void 0===hl)if(dl){hl=xs();const e=Ms.argv;let t=null;for(let a=0;a<e.length;a++){const i=e[a];"-"===i[0]?(null!==t&&hl.set(t,""),t=i):null!==t&&(hl.set(t,i),t=null);}null!==t&&hl.set(t,"");}else "object"==typeof location?(hl=xs(),(location.search||"?").slice(1).split("&").forEach((e=>{if(0!==e.length){const[t,a]=e.split("=");hl.set(`--${Xs(t,"-")}`,a),hl.set(`-${Xs(t,"-")}`,a);}}))):hl=xs();return hl})().has(e),ml=e=>Jo(dl?Ms.env[e.toUpperCase().replaceAll("-","_")]:Qo.getItem(e)),yl=e=>fl$2("--"+e)||null!==ml(e);yl("production");var gl;const bl=dl&&(gl=Ms.env.FORCE_COLOR,["true","1","2"].includes(gl))||!fl$2("--no-colors")&&!yl("no-color")&&(!dl||Ms.stdout.isTTY)&&(!dl||fl$2("--color")||null!==ml("COLORTERM")||(ml("TERM")||"").includes("color")),vl=e=>new Uint8Array(e),_l=pl?e=>{let t="";for(let a=0;a<e.byteLength;a++)t+=Zs(e[a]);return btoa(t)}:e=>Ji.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),wl=pl?e=>{const t=atob(e),a=vl(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);return a}:e=>{const t=Ji.from(e,"base64");return ((e,t,a)=>new Uint8Array(e,t,a))(t.buffer,t.byteOffset,t.byteLength)};class Al{constructor(e,t){this.left=e,this.right=t;}}const kl=(e,t)=>new Al(e,t);"undefined"!=typeof DOMParser&&new DOMParser;const Sl=Symbol,Nl=Sl(),Tl=Sl(),Ml=Sl(),xl=Sl(),Vl=Sl(),Cl=Sl(),Il=Sl(),Fl=Sl(),El=Sl(),Dl={[Nl]:kl("font-weight","bold"),[Tl]:kl("font-weight","normal"),[Ml]:kl("color","blue"),[Vl]:kl("color","green"),[xl]:kl("color","grey"),[Cl]:kl("color","red"),[Il]:kl("color","purple"),[Fl]:kl("color","orange"),[El]:kl("color","black")},Rl=bl?e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());const t=[],a=[],i=xs();let n=[],r=0;for(;r<e.length;r++){const n=e[r],s=Dl[n];if(void 0!==s)i.set(s.left,s.right);else {if(void 0===n)break;if(n.constructor!==String&&n.constructor!==Number)break;{const e=((e,t)=>{const a=[];for(const[i,n]of e)a.push(t(n,i));return a})(i,((e,t)=>`${t}:${e};`)).join("");r>0||e.length>0?(t.push("%c"+n),a.push(e)):t.push(n);}}}for(r>0&&(n=a,n.unshift(t.join("")));r<e.length;r++){const t=e[r];t instanceof Symbol||n.push(t);}return n}:e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());const t=[],a=[];let i=0;for(;i<e.length;i++){const a=e[i];if(void 0===a)break;if(a.constructor===String||a.constructor===Number)t.push(a);else if(a.constructor===Object)break}for(i>0&&a.push(t.join(""));i<e.length;i++){const t=e[i];t instanceof Symbol||a.push(t);}return a},Ll=Is(),Pl=e=>({[Symbol.iterator](){return this},next:e}),Bl=(e,t)=>Pl((()=>{const{done:a,value:i}=e.next();return {done:a,value:a?void 0:t(i)}}));class Ol{constructor(e,t){this.clock=e,this.len=t;}}class $l{constructor(){this.clients=new Map;}}const jl=(e,t,a)=>t.clients.forEach(((t,i)=>{const n=e.doc.store.clients.get(i);if(null!=n){const i=n[n.length-1],r=i.id.clock+i.length;for(let i=0,s=t[i];i<t.length&&s.clock<r;s=t[++i])Iu(e,n,s.clock,s.len,a);}})),Ul=(e,t)=>{const a=e.clients.get(t.client);return void 0!==a&&null!==((e,t)=>{let a=0,i=e.length-1;for(;a<=i;){const n=Bs((a+i)/2),r=e[n],s=r.clock;if(s<=t){if(t<s+r.len)return n;a=n+1;}else i=n-1;}return null})(a,t.clock)},zl=e=>{e.clients.forEach((e=>{let t,a;for(e.sort(((e,t)=>e.clock-t.clock)),t=1,a=1;t<e.length;t++){const i=e[a-1],n=e[t];i.clock+i.len>=n.clock?i.len=js$1(i.len,n.clock+n.len-i.clock):(a<t&&(e[a]=n),a++);}e.length=a;}));},Wl=(e,t,a,i)=>{Cs(e.clients,t,(()=>[])).push(new Ol(a,i));},Yl=e=>{const t=new $l;return e.clients.forEach(((e,a)=>{const i=[];for(let t=0;t<e.length;t++){const a=e[t];if(a.deleted){const n=a.id.clock;let r=a.length;if(t+1<e.length)for(let a=e[t+1];t+1<e.length&&a.deleted;a=e[1+ ++t])r+=a.length;i.push(new Ol(n,r));}}i.length>0&&t.clients.set(a,i);})),t},Hl=(e,t)=>{lo(e.restEncoder,t.clients.size),Ds(t.clients.entries()).sort(((e,t)=>t[0]-e[0])).forEach((([t,a])=>{e.resetDsCurVal(),lo(e.restEncoder,t);const i=a.length;lo(e.restEncoder,i);for(let t=0;t<i;t++){const i=a[t];e.writeDsClock(i.clock),e.writeDsLen(i.len);}}));},Gl=e=>{const t=new $l,a=Do(e.restDecoder);for(let i=0;i<a;i++){e.resetDsCurVal();const a=Do(e.restDecoder),i=Do(e.restDecoder);if(i>0){const n=Cs(t.clients,a,(()=>[]));for(let t=0;t<i;t++)n.push(new Ol(e.readDsClock(),e.readDsLen()));}}return t},ql=(e,t,a)=>{const i=new $l,n=Do(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();const n=Do(e.restDecoder),r=Do(e.restDecoder),s=a.clients.get(n)||[],o=Su(a,n);for(let a=0;a<r;a++){const a=e.readDsClock(),r=a+e.readDsLen();if(a<o){o<r&&Wl(i,n,o,r-o);let e=Tu(s,a),l=s[e];for(!l.deleted&&l.id.clock<a&&(s.splice(e+1,0,fd$2(t,l,a-l.id.clock)),e++);e<s.length&&(l=s[e++],l.id.clock<r);)l.deleted||(r<l.id.clock+l.length&&s.splice(e,0,fd$2(t,l,r-l.id.clock)),l.delete(t));}else Wl(i,n,a,r-a);}}if(i.clients.size>0){const e=new nu;return lo(e.restEncoder,0),Hl(e,i),e.toUint8Array()}return null},Zl=Yo;class Jl extends Ls{constructor({guid:e=Go(),collectionid:t=null,gc:a=true,gcFilter:i=()=>true,meta:n=null,autoLoad:r=false,shouldLoad:s=true}={}){super(),this.gc=a,this.gcFilter=i,this.clientID=Zl(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Au,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=s,this.autoLoad=r,this.meta=n,this.isLoaded=false,this.isSynced=false,this.isDestroyed=false,this.whenLoaded=Zo((e=>{this.on("load",(()=>{this.isLoaded=true,e(this);}));}));const o=()=>Zo((e=>{const t=a=>{ void 0!==a&&true!==a||(this.off("sync",t),e());};this.on("sync",t);}));this.on("sync",(e=>{ false===e&&this.isSynced&&(this.whenSynced=o()),this.isSynced=void 0===e||true===e,this.isSynced&&!this.isLoaded&&this.emit("load",[this]);})),this.whenSynced=o();}load(){const e=this._item;null===e||this.shouldLoad||Pu(e.parent.doc,(e=>{e.subdocsLoaded.add(this);}),null,true),this.shouldLoad=true;}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Ds(this.subdocs).map((e=>e.guid)))}transact(e,t=null){return Pu(this,e,t)}get(e,t=nc){const a=Cs(this.share,e,(()=>{const e=new t;return e._integrate(this,null),e})),i=a.constructor;if(t!==nc&&i!==t){if(i===nc){const i=new t;i._map=a._map,a._map.forEach((e=>{for(;null!==e;e=e.left)e.parent=i;})),i._start=a._start;for(let e=i._start;null!==e;e=e.right)e.parent=i;return i._length=a._length,this.share.set(e,i),i._integrate(this,null),i}throw new Error(`Type with the name ${e} has already been defined with a different constructor`)}return a}getArray(e=""){return this.get(e,Ac)}getText(e=""){return this.get(e,$c)}getMap(e=""){return this.get(e,Sc)}getXmlElement(e=""){return this.get(e,zc)}getXmlFragment(e=""){return this.get(e,Uc)}toJSON(){const e={};return this.share.forEach(((t,a)=>{e[a]=t.toJSON();})),e}destroy(){this.isDestroyed=true,Ds(this.subdocs).forEach((e=>e.destroy()));const e=this._item;if(null!==e){this._item=null;const t=e.content;t.doc=new Jl({guid:this.guid,...t.opts,shouldLoad:false}),t.doc._item=e,Pu(e.parent.doc,(a=>{const i=t.doc;e.deleted||a.subdocsAdded.add(i),a.subdocsRemoved.add(this);}),null,true);}this.emit("destroyed",[true]),this.emit("destroy",[this]),super.destroy();}}class Kl{constructor(e){this.restDecoder=e;}resetDsCurVal(){}readDsClock(){return Do(this.restDecoder)}readDsLen(){return Do(this.restDecoder)}}class Xl extends Kl{readLeftID(){return vu(Do(this.restDecoder),Do(this.restDecoder))}readRightID(){return vu(Do(this.restDecoder),Do(this.restDecoder))}readClient(){return Do(this.restDecoder)}readInfo(){return Eo(this.restDecoder)}readString(){return Lo(this.restDecoder)}readParentInfo(){return 1===Do(this.restDecoder)}readTypeRef(){return Do(this.restDecoder)}readLen(){return Do(this.restDecoder)}readAny(){return Oo(this.restDecoder)}readBuf(){return (e=>{const t=vl(e.byteLength);return t.set(e),t})(Fo(this.restDecoder))}readJSON(){return JSON.parse(Lo(this.restDecoder))}readKey(){return Lo(this.restDecoder)}}class Ql{constructor(e){this.dsCurrVal=0,this.restDecoder=e;}resetDsCurVal(){this.dsCurrVal=0;}readDsClock(){return this.dsCurrVal+=Do(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Do(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class eu extends Ql{constructor(e){super(e),this.keys=[],Do(e),this.keyClockDecoder=new Uo(Fo(e)),this.clientDecoder=new jo(Fo(e)),this.leftClockDecoder=new Uo(Fo(e)),this.rightClockDecoder=new Uo(Fo(e)),this.infoDecoder=new $o(Fo(e),Eo),this.stringDecoder=new zo(Fo(e)),this.parentInfoDecoder=new $o(Fo(e),Eo),this.typeRefDecoder=new jo(Fo(e)),this.lenDecoder=new jo(Fo(e));}readLeftID(){return new gu(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new gu(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return 1===this.parentInfoDecoder.read()}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Oo(this.restDecoder)}readBuf(){return Fo(this.restDecoder)}readJSON(){return Oo(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const e=this.stringDecoder.read();return this.keys.push(e),e}}}class tu{constructor(){this.restEncoder=io();}toUint8Array(){return ro(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){lo(this.restEncoder,e);}writeDsLen(e){lo(this.restEncoder,e);}}class au extends tu{writeLeftID(e){lo(this.restEncoder,e.client),lo(this.restEncoder,e.clock);}writeRightID(e){lo(this.restEncoder,e.client),lo(this.restEncoder,e.clock);}writeClient(e){lo(this.restEncoder,e);}writeInfo(e){oo(this.restEncoder,e);}writeString(e){ho(this.restEncoder,e);}writeParentInfo(e){lo(this.restEncoder,e?1:0);}writeTypeRef(e){lo(this.restEncoder,e);}writeLen(e){lo(this.restEncoder,e);}writeAny(e){bo(this.restEncoder,e);}writeBuf(e){mo(this.restEncoder,e);}writeJSON(e){ho(this.restEncoder,JSON.stringify(e));}writeKey(e){ho(this.restEncoder,e);}}class iu{constructor(){this.restEncoder=io(),this.dsCurrVal=0;}toUint8Array(){return ro(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0;}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,lo(this.restEncoder,t);}writeDsLen(e){0===e&&Mo(),lo(this.restEncoder,e-1),this.dsCurrVal+=e;}}class nu extends iu{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new ko,this.clientEncoder=new wo,this.leftClockEncoder=new ko,this.rightClockEncoder=new ko,this.infoEncoder=new vo(oo),this.stringEncoder=new So,this.parentInfoEncoder=new vo(oo),this.typeRefEncoder=new wo,this.lenEncoder=new wo;}toUint8Array(){const e=io();return lo(e,0),mo(e,this.keyClockEncoder.toUint8Array()),mo(e,this.clientEncoder.toUint8Array()),mo(e,this.leftClockEncoder.toUint8Array()),mo(e,this.rightClockEncoder.toUint8Array()),mo(e,ro(this.infoEncoder)),mo(e,this.stringEncoder.toUint8Array()),mo(e,ro(this.parentInfoEncoder)),mo(e,this.typeRefEncoder.toUint8Array()),mo(e,this.lenEncoder.toUint8Array()),fo(e,ro(this.restEncoder)),ro(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock);}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock);}writeClient(e){this.clientEncoder.write(e);}writeInfo(e){this.infoEncoder.write(e);}writeString(e){this.stringEncoder.write(e);}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0);}writeTypeRef(e){this.typeRefEncoder.write(e);}writeLen(e){this.lenEncoder.write(e);}writeAny(e){bo(this.restEncoder,e);}writeBuf(e){mo(this.restEncoder,e);}writeJSON(e){bo(this.restEncoder,e);}writeKey(e){const t=this.keyMap.get(e);void 0===t?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t);}}const ru=(e,t,a)=>{const i=new Map;a.forEach(((e,a)=>{Su(t,a)>e&&i.set(a,e);})),ku(t).forEach(((e,t)=>{a.has(t)||i.set(t,0);})),lo(e.restEncoder,i.size),Ds(i.entries()).sort(((e,t)=>t[0]-e[0])).forEach((([a,i])=>{((e,t,a,i)=>{i=js$1(i,t[0].id.clock);const n=Tu(t,i);lo(e.restEncoder,t.length-n),e.writeClient(a),lo(e.restEncoder,i);const r=t[n];r.write(e,i-r.id.clock);for(let a=n+1;a<t.length;a++)t[a].write(e,0);})(e,t.clients.get(a),a,i);}));},su=(e,t,a,i=new eu(e))=>Pu(t,(e=>{e.local=!1;let t=!1;const a=e.doc,n=a.store,r=((e,t)=>{const a=xs(),i=Do(e.restDecoder);for(let n=0;n<i;n++){const i=Do(e.restDecoder),n=new Array(i),r=e.readClient();let s=Do(e.restDecoder);a.set(r,{i:0,refs:n});for(let a=0;a<i;a++){const i=e.readInfo();switch(31&i){case 0:{const t=e.readLen();n[a]=new qc(vu(r,s),t),s+=t;break}case 10:{const t=Do(e.restDecoder);n[a]=new bd(vu(r,s),t),s+=t;break}default:{const o=!(192&i),l=new md(vu(r,s),null,(i&Ys)===Ys?e.readLeftID():null,null,(i&Ws)===Ws?e.readRightID():null,o?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,!o||32&~i?null:e.readString(),yd(e,i));n[a]=l,s+=l.length;}}}}return a})(i,a),s=((e,t,a)=>{const i=[];let n=Ds(a.keys()).sort(((e,t)=>e-t));if(0===n.length)return null;const r=()=>{if(0===n.length)return null;let e=a.get(n[n.length-1]);for(;e.refs.length===e.i;){if(n.pop(),!(n.length>0))return null;e=a.get(n[n.length-1]);}return e};let s=r();if(null===s)return null;const o=new Au,l=new Map,u=(e,t)=>{const a=l.get(e);(null==a||a>t)&&l.set(e,t);};let c=s.refs[s.i++];const d=new Map,p=()=>{for(const e of i){const t=e.id.client,i=a.get(t);i?(i.i--,o.clients.set(t,i.refs.slice(i.i)),a.delete(t),i.i=0,i.refs=[]):o.clients.set(t,[e]),n=n.filter((e=>e!==t));}i.length=0;};for(;;){if(c.constructor!==bd){const n=Cs(d,c.id.client,(()=>Su(t,c.id.client)))-c.id.clock;if(n<0)i.push(c),u(c.id.client,c.id.clock-1),p();else {const r=c.getMissing(e,t);if(null!==r){i.push(c);const e=a.get(r)||{refs:[],i:0};if(e.refs.length!==e.i){c=e.refs[e.i++];continue}u(r,Su(t,r)),p();}else (0===n||n<c.length)&&(c.integrate(e,n),d.set(c.id.client,c.id.clock+c.length));}}if(i.length>0)c=i.pop();else if(null!==s&&s.i<s.refs.length)c=s.refs[s.i++];else {if(s=r(),null===s)break;c=s.refs[s.i++];}}if(o.clients.size>0){const e=new nu;return ru(e,o,new Map),lo(e.restEncoder,0),{missing:l,update:e.toUint8Array()}}return null})(e,n,r),o=n.pendingStructs;if(o){for(const[e,a]of o.missing)if(a<Su(n,e)){t=!0;break}if(s){for(const[e,t]of s.missing){const a=o.missing.get(e);(null==a||a>t)&&o.missing.set(e,t);}o.update=Uu([o.update,s.update]);}}else n.pendingStructs=s;const l=ql(i,e,n);if(n.pendingDs){const t=new eu(Io(n.pendingDs));Do(t.restDecoder);const a=ql(t,e,n);n.pendingDs=l&&a?Uu([l,a]):l||a;}else n.pendingDs=l;if(t){const t=n.pendingStructs.update;n.pendingStructs=null,ou(e.doc,t);}}),a,false),ou=(e,t,a,i=eu)=>{const n=Io(t);su(n,e,a,new i(n));},lu=(e,t=new Uint8Array([0]),a=new nu)=>{((e,t,a=new Map)=>{ru(e,t.store,a),Hl(e,Yl(t.store));})(a,e,uu(t));const i=[a.toUint8Array()];if(e.store.pendingDs&&i.push(e.store.pendingDs),e.store.pendingStructs&&i.push(zu(e.store.pendingStructs.update,t)),i.length>1){if(a.constructor===au)return $u(i.map(((e,t)=>0===t?e:Gu(e))));if(a.constructor===nu)return Uu(i)}return i[0]},uu=e=>(e=>{const t=new Map,a=Do(e.restDecoder);for(let i=0;i<a;i++){const a=Do(e.restDecoder),i=Do(e.restDecoder);t.set(a,i);}return t})(new Kl(Io(e))),cu=(e,t)=>(lo(e.restEncoder,t.size),Ds(t.entries()).sort(((e,t)=>t[0]-e[0])).forEach((([t,a])=>{lo(e.restEncoder,t),lo(e.restEncoder,a);})),e),du=(e,t=new iu)=>(e instanceof Map?cu(t,e):((e,t)=>{cu(e,ku(t.store));})(t,e),t.toUint8Array());class pu{constructor(){this.l=[];}}const hu=()=>new pu,fu=(e,t)=>e.l.push(t),mu=(e,t)=>{const a=e.l,i=a.length;e.l=a.filter((e=>t!==e)),i===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.");},yu=(e,t,a)=>ll(e.l,[t,a]);class gu{constructor(e,t){this.client=e,this.clock=t;}}const bu=(e,t)=>e===t||null!==e&&null!==t&&e.client===t.client&&e.clock===t.clock,vu=(e,t)=>new gu(e,t),_u=(e,t)=>void 0===t?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Ul(t.ds,e.id),wu=(e,t)=>{const a=Cs(e.meta,wu,Is),i=e.doc.store;a.has(t)||(t.sv.forEach(((t,a)=>{t<Su(i,a)&&Vu(e,vu(a,t));})),jl(e,t.ds,(e=>{})),a.add(t));};class Au{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null;}}const ku=e=>{const t=new Map;return e.clients.forEach(((e,a)=>{const i=e[e.length-1];t.set(a,i.id.clock+i.length);})),t},Su=(e,t)=>{const a=e.clients.get(t);if(void 0===a)return 0;const i=a[a.length-1];return i.id.clock+i.length},Nu=(e,t)=>{let a=e.clients.get(t.id.client);if(void 0===a)a=[],e.clients.set(t.id.client,a);else {const e=a[a.length-1];if(e.id.clock+e.length!==t.id.clock)throw Mo()}a.push(t);},Tu=(e,t)=>{let a=0,i=e.length-1,n=e[i],r=n.id.clock;if(r===t)return i;let s=Bs(t/(r+n.length-1)*i);for(;a<=i;){if(n=e[s],r=n.id.clock,r<=t){if(t<r+n.length)return s;a=s+1;}else i=s-1;s=Bs((a+i)/2);}throw Mo()},Mu=(e,t)=>{const a=e.clients.get(t.client);return a[Tu(a,t.clock)]},xu=(e,t,a)=>{const i=Tu(t,a),n=t[i];return n.id.clock<a&&n instanceof md?(t.splice(i+1,0,fd$2(e,n,a-n.id.clock)),i+1):i},Vu=(e,t)=>{const a=e.doc.store.clients.get(t.client);return a[xu(e,a,t.clock)]},Cu=(e,t,a)=>{const i=t.clients.get(a.client),n=Tu(i,a.clock),r=i[n];return a.clock!==r.id.clock+r.length-1&&r.constructor!==qc&&i.splice(n+1,0,fd$2(e,r,a.clock-r.id.clock+1)),r},Iu=(e,t,a,i,n)=>{if(0===i)return;const r=a+i;let s,o=xu(e,t,a);do{s=t[o++],r<s.id.clock+s.length&&xu(e,t,r),n(s);}while(o<t.length&&t[o].id.clock<r)};class Fu{constructor(e,t,a){this.doc=e,this.deleteSet=new $l,this.beforeState=ku(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=a,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=false;}}const Eu=(e,t)=>!(0===t.deleteSet.clients.size&&!((e,t)=>{for(const[a,i]of e)if(t(i,a))return true;return false})(t.afterState,((e,a)=>t.beforeState.get(a)!==e)))&&(zl(t.deleteSet),((e,t)=>{ru(e,t.doc.store,t.beforeState);})(e,t),Hl(e,t.deleteSet),true),Du=(e,t,a)=>{const i=t._item;(null===i||i.id.clock<(e.beforeState.get(i.id.client)||0)&&!i.deleted)&&Cs(e.changed,t,Is).add(a);},Ru=(e,t)=>{let a=e[t],i=e[t-1],n=t;for(;n>0&&(i.deleted===a.deleted&&i.constructor===a.constructor&&i.mergeWith(a));a=i,i=e[--n-1])a instanceof md&&null!==a.parentSub&&a.parent._map.get(a.parentSub)===a&&a.parent._map.set(a.parentSub,i);const r=t-n;return r&&e.splice(t+1-r,r),r},Lu=(e,t)=>{if(t<e.length){const a=e[t],i=a.doc,n=i.store,r=a.deleteSet,s=a._mergeStructs;try{zl(r),a.afterState=ku(a.doc.store),i.emit("beforeObserverCalls",[a,i]);const e=[];a.changed.forEach(((t,i)=>e.push((()=>{null!==i._item&&i._item.deleted||i._callObserver(a,t);})))),e.push((()=>{a.changedParentTypes.forEach(((e,t)=>{t._dEH.l.length>0&&(null===t._item||!t._item.deleted)&&((e=e.filter((e=>null===e.target._item||!e.target._item.deleted))).forEach((e=>{e.currentTarget=t,e._path=null;})),e.sort(((e,t)=>e.path.length-t.path.length)),yu(t._dEH,e,a));}));})),e.push((()=>i.emit("afterTransaction",[a,i]))),ll(e,[]),a._needFormattingCleanup&&Pc(a);}finally{i.gc&&((e,t,a)=>{for(const[i,n]of e.clients.entries()){const e=t.clients.get(i);for(let i=n.length-1;i>=0;i--){const r=n[i],s=r.clock+r.len;for(let i=Tu(e,r.clock),n=e[i];i<e.length&&n.id.clock<s;n=e[++i]){const n=e[i];if(r.clock+r.len<=n.id.clock)break;n instanceof md&&n.deleted&&!n.keep&&a(n)&&n.gc(t,false);}}}})(r,n,i.gcFilter),((e,t)=>{e.clients.forEach(((e,a)=>{const i=t.clients.get(a);for(let t=e.length-1;t>=0;t--){const a=e[t];for(let e=$s(i.length-1,1+Tu(i,a.clock+a.len-1)),t=i[e];e>0&&t.id.clock>=a.clock;t=i[e])e-=1+Ru(i,e);}}));})(r,n),a.afterState.forEach(((e,t)=>{const i=a.beforeState.get(t)||0;if(i!==e){const e=n.clients.get(t),a=js$1(Tu(e,i),1);for(let t=e.length-1;t>=a;)t-=1+Ru(e,t);}}));for(let e=s.length-1;e>=0;e--){const{client:t,clock:a}=s[e].id,i=n.clients.get(t),r=Tu(i,a);r+1<i.length&&Ru(i,r+1)>1||r>0&&Ru(i,r);}if(a.local||a.afterState.get(i.clientID)===a.beforeState.get(i.clientID)||(((...e)=>{console.log(...Rl(e)),Ll.forEach((t=>t.print(e)));})(Fl,Nl,"[yjs] ",Tl,Cl,"Changed the client-id because another client seems to be using it."),i.clientID=Zl()),i.emit("afterTransactionCleanup",[a,i]),i._observers.has("update")){const e=new au;Eu(e,a)&&i.emit("update",[e.toUint8Array(),a.origin,i,a]);}if(i._observers.has("updateV2")){const e=new nu;Eu(e,a)&&i.emit("updateV2",[e.toUint8Array(),a.origin,i,a]);}const{subdocsAdded:o,subdocsLoaded:l,subdocsRemoved:u}=a;(o.size>0||u.size>0||l.size>0)&&(o.forEach((e=>{e.clientID=i.clientID,null==e.collectionid&&(e.collectionid=i.collectionid),i.subdocs.add(e);})),u.forEach((e=>i.subdocs.delete(e))),i.emit("subdocs",[{loaded:l,added:o,removed:u},i,a]),u.forEach((e=>e.destroy()))),e.length<=t+1?(i._transactionCleanups=[],i.emit("afterAllTransactions",[i,e])):Lu(e,t+1);}}},Pu=(e,t,a=null,i=true)=>{const n=e._transactionCleanups;let r=false,s=null;null===e._transaction&&(r=true,e._transaction=new Fu(e,a,i),n.push(e._transaction),1===n.length&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=t(e._transaction);}finally{if(r){const t=e._transaction===n[0];e._transaction=null,t&&Lu(n,0);}}return s};class Bu{constructor(e,t){this.gen=function*(e){const t=Do(e.restDecoder);for(let a=0;a<t;a++){const t=Do(e.restDecoder),a=e.readClient();let i=Do(e.restDecoder);for(let n=0;n<t;n++){const t=e.readInfo();if(10===t){const t=Do(e.restDecoder);yield new bd(vu(a,i),t),i+=t;}else if(31&t){const n=!(192&t),r=new md(vu(a,i),null,(t&Ys)===Ys?e.readLeftID():null,null,(t&Ws)===Ws?e.readRightID():null,n?e.readParentInfo()?e.readString():e.readLeftID():null,!n||32&~t?null:e.readString(),yd(e,t));yield r,i+=r.length;}else {const t=e.readLen();yield new qc(vu(a,i),t),i+=t;}}}}(e),this.curr=null,this.done=false,this.filterSkips=t,this.next();}next(){do{this.curr=this.gen.next().value||null;}while(this.filterSkips&&null!==this.curr&&this.curr.constructor===bd);return this.curr}}class Ou{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[];}}const $u=e=>Uu(e,Xl,au),ju=(e,t)=>{if(e.constructor===qc){const{client:a,clock:i}=e.id;return new qc(vu(a,i+t),e.length-t)}if(e.constructor===bd){const{client:a,clock:i}=e.id;return new bd(vu(a,i+t),e.length-t)}{const a=e,{client:i,clock:n}=a.id;return new md(vu(i,n+t),null,vu(i,n+t-1),null,a.rightOrigin,a.parent,a.parentSub,a.content.splice(t))}},Uu=(e,t=eu,a=nu)=>{if(1===e.length)return e[0];const i=e.map((e=>new t(Io(e))));let n=i.map((e=>new Bu(e,true))),r=null;const s=new a,o=new Ou(s);for(;n=n.filter((e=>null!==e.curr)),n.sort(((e,t)=>{if(e.curr.id.client===t.curr.id.client){const a=e.curr.id.clock-t.curr.id.clock;return 0===a?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===bd?1:-1:a}return t.curr.id.client-e.curr.id.client})),0!==n.length;){const e=n[0],t=e.curr.id.client;if(null!==r){let a=e.curr,i=false;for(;null!==a&&a.id.clock+a.length<=r.struct.id.clock+r.struct.length&&a.id.client>=r.struct.id.client;)a=e.next(),i=true;if(null===a||a.id.client!==t||i&&a.id.clock>r.struct.id.clock+r.struct.length)continue;if(t!==r.struct.id.client)Yu(o,r.struct,r.offset),r={struct:a,offset:0},e.next();else if(r.struct.id.clock+r.struct.length<a.id.clock)if(r.struct.constructor===bd)r.struct.length=a.id.clock+a.length-r.struct.id.clock;else {Yu(o,r.struct,r.offset);const e=a.id.clock-r.struct.id.clock-r.struct.length;r={struct:new bd(vu(t,r.struct.id.clock+r.struct.length),e),offset:0};}else {const t=r.struct.id.clock+r.struct.length-a.id.clock;t>0&&(r.struct.constructor===bd?r.struct.length-=t:a=ju(a,t)),r.struct.mergeWith(a)||(Yu(o,r.struct,r.offset),r={struct:a,offset:0},e.next());}}else r={struct:e.curr,offset:0},e.next();for(let a=e.curr;null!==a&&a.id.client===t&&a.id.clock===r.struct.id.clock+r.struct.length&&a.constructor!==bd;a=e.next())Yu(o,r.struct,r.offset),r={struct:a,offset:0};}null!==r&&(Yu(o,r.struct,r.offset),r=null),Hu(o);const l=(e=>{const t=new $l;for(let a=0;a<e.length;a++)e[a].clients.forEach(((i,n)=>{if(!t.clients.has(n)){const r=i.slice();for(let t=a+1;t<e.length;t++)Es(r,e[t].clients.get(n)||[]);t.clients.set(n,r);}}));return zl(t),t})(i.map((e=>Gl(e))));return Hl(s,l),s.toUint8Array()},zu=(e,t,a=eu,i=nu)=>{const n=uu(t),r=new i,s=new Ou(r),o=new a(Io(e)),l=new Bu(o,false);for(;l.curr;){const e=l.curr,t=e.id.client,a=n.get(t)||0;if(l.curr.constructor!==bd)if(e.id.clock+e.length>a)for(Yu(s,e,js$1(a-e.id.clock,0)),l.next();l.curr&&l.curr.id.client===t;)Yu(s,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===t&&l.curr.id.clock+l.curr.length<=a;)l.next();else l.next();}Hu(s);const u=Gl(o);return Hl(r,u),r.toUint8Array()},Wu=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:ro(e.encoder.restEncoder)}),e.encoder.restEncoder=io(),e.written=0);},Yu=(e,t,a)=>{e.written>0&&e.currClient!==t.id.client&&Wu(e),0===e.written&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),lo(e.encoder.restEncoder,t.id.clock+a)),t.write(e.encoder,a),e.written++;},Hu=e=>{Wu(e);const t=e.encoder.restEncoder;lo(t,e.clientStructs.length);for(let a=0;a<e.clientStructs.length;a++){const i=e.clientStructs[a];lo(t,i.written),fo(t,i.restEncoder);}},Gu=e=>((e,t,a,i)=>{const n=new a(Io(e)),r=new Bu(n,false),s=new i,o=new Ou(s);for(let e=r.curr;null!==e;e=r.next())Yu(o,t(e),0);Hu(o);const l=Gl(n);return Hl(s,l),s.toUint8Array()})(e,ul,eu,au),qu="You must not compute changes after the event-handler fired.";class Zu{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null;}get path(){return this._path||(this._path=Ju(this.currentTarget,this.target))}deletes(e){return Ul(this.transaction.deleteSet,e.id)}get keys(){if(null===this._keys){if(0===this.transaction.doc._transactionCleanups.length)throw No(qu);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach((a=>{if(null!==a){const i=t._map.get(a);let n,r;if(this.adds(i)){let e=i.left;for(;null!==e&&this.adds(e);)e=e.left;if(this.deletes(i)){if(null===e||!this.deletes(e))return;n="delete",r=Fs(e.content.getContent());}else null!==e&&this.deletes(e)?(n="update",r=Fs(e.content.getContent())):(n="add",r=void 0);}else {if(!this.deletes(i))return;n="delete",r=Fs(i.content.getContent());}e.set(a,{action:n,oldValue:r});}})),this._keys=e;}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(null===e){if(0===this.transaction.doc._transactionCleanups.length)throw No(qu);const t=this.target,a=Is(),i=Is(),n=[];e={added:a,deleted:i,delta:n,keys:this.keys};if(this.transaction.changed.get(t).has(null)){let e=null;const r=()=>{e&&n.push(e);};for(let n=t._start;null!==n;n=n.right)n.deleted?this.deletes(n)&&!this.adds(n)&&(null!==e&&void 0!==e.delete||(r(),e={delete:0}),e.delete+=n.length,i.add(n)):this.adds(n)?(null!==e&&void 0!==e.insert||(r(),e={insert:[]}),e.insert=e.insert.concat(n.content.getContent()),a.add(n)):(null!==e&&void 0!==e.retain||(r(),e={retain:0}),e.retain+=n.length);null!==e&&void 0===e.retain&&r();}this._changes=e;}return e}}const Ju=(e,t)=>{const a=[];for(;null!==t._item&&t!==e;){if(null!==t._item.parentSub)a.unshift(t._item.parentSub);else {let e=0,i=t._item.parent._start;for(;i!==t._item&&null!==i;)!i.deleted&&i.countable&&(e+=i.length),i=i.right;a.unshift(e);}t=t._item.parent;}return a},Ku=()=>{((...e)=>{console.warn(...Rl(e)),e.unshift(Fl),Ll.forEach((t=>t.print(e)));})("Invalid access: Add Yjs type to a document before reading data.");};let Xu=0;class Qu{constructor(e,t){e.marker=true,this.p=e,this.index=t,this.timestamp=Xu++;}}const ec$2=(e,t,a)=>{e.p.marker=false,e.p=t,t.marker=true,e.index=a,e.timestamp=Xu++;},tc=(e,t)=>{if(null===e._start||0===t||null===e._searchMarker)return null;const a=0===e._searchMarker.length?null:e._searchMarker.reduce(((e,a)=>Os(t-e.index)<Os(t-a.index)?e:a));let i=e._start,n=0;for(null!==a&&(i=a.p,n=a.index,(e=>{e.timestamp=Xu++;})(a));null!==i.right&&n<t;){if(!i.deleted&&i.countable){if(t<n+i.length)break;n+=i.length;}i=i.right;}for(;null!==i.left&&n>t;)i=i.left,!i.deleted&&i.countable&&(n-=i.length);for(;null!==i.left&&i.left.id.client===i.id.client&&i.left.id.clock+i.left.length===i.id.clock;)i=i.left,!i.deleted&&i.countable&&(n-=i.length);return null!==a&&Os(a.index-n)<i.parent.length/80?(ec$2(a,i,n),a):((e,t,a)=>{if(e.length>=80){const i=e.reduce(((e,t)=>e.timestamp<t.timestamp?e:t));return ec$2(i,t,a),i}{const i=new Qu(t,a);return e.push(i),i}})(e._searchMarker,i,n)},ac=(e,t,a)=>{for(let i=e.length-1;i>=0;i--){const n=e[i];if(a>0){let t=n.p;for(t.marker=false;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(n.index-=t.length);if(null===t||true===t.marker){e.splice(i,1);continue}n.p=t,t.marker=true;}(t<n.index||a>0&&t===n.index)&&(n.index=js$1(t,n.index+a));}},ic=(e,t,a)=>{const i=e,n=t.changedParentTypes;for(;Cs(n,e,(()=>[])).push(a),null!==e._item;)e=e._item.parent;yu(i._eH,a,t);};class nc{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=hu(),this._dEH=hu(),this._searchMarker=null;}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t;}_copy(){throw To()}clone(){throw To()}_write(e){}get _first(){let e=this._start;for(;null!==e&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0);}observe(e){fu(this._eH,e);}observeDeep(e){fu(this._dEH,e);}unobserve(e){mu(this._eH,e);}unobserveDeep(e){mu(this._dEH,e);}toJSON(){}}const rc=(e,t,a)=>{e.doc??Ku(),t<0&&(t=e._length+t),a<0&&(a=e._length+a);let i=a-t;const n=[];let r=e._start;for(;null!==r&&i>0;){if(r.countable&&!r.deleted){const e=r.content.getContent();if(e.length<=t)t-=e.length;else {for(let a=t;a<e.length&&i>0;a++)n.push(e[a]),i--;t=0;}}r=r.right;}return n},sc=e=>{e.doc??Ku();const t=[];let a=e._start;for(;null!==a;){if(a.countable&&!a.deleted){const e=a.content.getContent();for(let a=0;a<e.length;a++)t.push(e[a]);}a=a.right;}return t},oc=(e,t)=>{let a=0,i=e._start;for(e.doc??Ku();null!==i;){if(i.countable&&!i.deleted){const n=i.content.getContent();for(let i=0;i<n.length;i++)t(n[i],a++,e);}i=i.right;}},lc=(e,t)=>{const a=[];return oc(e,((i,n)=>{a.push(t(i,n,e));})),a},uc=e=>{let t=e._start,a=null,i=0;return {[Symbol.iterator](){return this},next:()=>{if(null===a){for(;null!==t&&t.deleted;)t=t.right;if(null===t)return {done:true,value:void 0};a=t.content.getContent(),i=0,t=t.right;}const e=a[i++];return a.length<=i&&(a=null),{done:false,value:e}}}},cc=(e,t)=>{e.doc??Ku();const a=tc(e,t);let i=e._start;for(null!==a&&(i=a.p,t-=a.index);null!==i;i=i.right)if(!i.deleted&&i.countable){if(t<i.length)return i.content.getContent()[t];t-=i.length;}},dc=(e,t,a,i)=>{let n=a;const r=e.doc,s=r.clientID,o=r.store,l=null===a?t._start:a.right;let u=[];const c=()=>{u.length>0&&(n=new md(vu(s,Su(o,s)),n,n&&n.lastId,l,l&&l.id,t,null,new id(u)),n.integrate(e,0),u=[]);};i.forEach((a=>{if(null===a)u.push(a);else switch(a.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(a);break;default:switch(c(),a.constructor){case Uint8Array:case ArrayBuffer:n=new md(vu(s,Su(o,s)),n,n&&n.lastId,l,l&&l.id,t,null,new Zc(new Uint8Array(a))),n.integrate(e,0);break;case Jl:n=new md(vu(s,Su(o,s)),n,n&&n.lastId,l,l&&l.id,t,null,new Xc(a)),n.integrate(e,0);break;default:if(!(a instanceof nc))throw new Error("Unexpected content type in insert operation");n=new md(vu(s,Su(o,s)),n,n&&n.lastId,l,l&&l.id,t,null,new hd(a)),n.integrate(e,0);}}})),c();},pc=()=>No("Length exceeded!"),hc=(e,t,a,i)=>{if(a>t._length)throw pc();if(0===a)return t._searchMarker&&ac(t._searchMarker,a,i.length),dc(e,t,null,i);const n=a,r=tc(t,a);let s=t._start;for(null!==r&&(s=r.p,0===(a-=r.index)&&(s=s.prev,a+=s&&s.countable&&!s.deleted?s.length:0));null!==s;s=s.right)if(!s.deleted&&s.countable){if(a<=s.length){a<s.length&&Vu(e,vu(s.id.client,s.id.clock+a));break}a-=s.length;}return t._searchMarker&&ac(t._searchMarker,n,i.length),dc(e,t,s,i)},fc=(e,t,a,i)=>{if(0===i)return;const n=a,r=i,s=tc(t,a);let o=t._start;for(null!==s&&(o=s.p,a-=s.index);null!==o&&a>0;o=o.right)!o.deleted&&o.countable&&(a<o.length&&Vu(e,vu(o.id.client,o.id.clock+a)),a-=o.length);for(;i>0&&null!==o;)o.deleted||(i<o.length&&Vu(e,vu(o.id.client,o.id.clock+i)),o.delete(e),i-=o.length),o=o.right;if(i>0)throw pc();t._searchMarker&&ac(t._searchMarker,n,-r+i);},mc=(e,t,a)=>{const i=t._map.get(a);void 0!==i&&i.delete(e);},yc=(e,t,a,i)=>{const n=t._map.get(a)||null,r=e.doc,s=r.clientID;let o;if(null==i)o=new id([i]);else switch(i.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:o=new id([i]);break;case Uint8Array:o=new Zc(i);break;case Jl:o=new Xc(i);break;default:if(!(i instanceof nc))throw new Error("Unexpected content type");o=new hd(i);}new md(vu(s,Su(r.store,s)),n,n&&n.lastId,null,null,t,a,o).integrate(e,0);},gc=(e,t)=>{e.doc??Ku();const a=e._map.get(t);return void 0===a||a.deleted?void 0:a.content.getContent()[a.length-1]},bc=e=>{const t={};return e.doc??Ku(),e._map.forEach(((e,a)=>{e.deleted||(t[a]=e.content.getContent()[e.length-1]);})),t},vc=(e,t)=>{e.doc??Ku();const a=e._map.get(t);return void 0!==a&&!a.deleted},_c=e=>{return e.doc??Ku(),t=e._map.entries(),a=e=>!e[1].deleted,Pl((()=>{let e;do{e=t.next();}while(!e.done&&!a(e.value));return e}));var t,a;};class wc extends Zu{}class Ac extends nc{constructor(){super(),this._prelimContent=[],this._searchMarker=[];}static from(e){const t=new Ac;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null;}_copy(){return new Ac}clone(){const e=new Ac;return e.insert(0,this.toArray().map((e=>e instanceof nc?e.clone():e))),e}get length(){return this.doc??Ku(),this._length}_callObserver(e,t){super._callObserver(e,t),ic(this,e,new wc(this,e));}insert(e,t){null!==this.doc?Pu(this.doc,(a=>{hc(a,this,e,t);})):this._prelimContent.splice(e,0,...t);}push(e){null!==this.doc?Pu(this.doc,(t=>{((e,t,a)=>{let i=(t._searchMarker||[]).reduce(((e,t)=>t.index>e.index?t:e),{index:0,p:t._start}).p;if(i)for(;i.right;)i=i.right;dc(e,t,i,a);})(t,this,e);})):this._prelimContent.push(...e);}unshift(e){this.insert(0,e);}delete(e,t=1){null!==this.doc?Pu(this.doc,(a=>{fc(a,this,e,t);})):this._prelimContent.splice(e,t);}get(e){return cc(this,e)}toArray(){return sc(this)}slice(e=0,t=this.length){return rc(this,e,t)}toJSON(){return this.map((e=>e instanceof nc?e.toJSON():e))}map(e){return lc(this,e)}forEach(e){oc(this,e);}[Symbol.iterator](){return uc(this)}_write(e){e.writeTypeRef(sd);}}class kc extends Zu{constructor(e,t,a){super(e,t),this.keysChanged=a;}}class Sc extends nc{constructor(e){super(),this._prelimContent=null,this._prelimContent=void 0===e?new Map:new Map(e);}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach(((e,t)=>{this.set(t,e);})),this._prelimContent=null;}_copy(){return new Sc}clone(){const e=new Sc;return this.forEach(((t,a)=>{e.set(a,t instanceof nc?t.clone():t);})),e}_callObserver(e,t){ic(this,e,new kc(this,e,t));}toJSON(){this.doc??Ku();const e={};return this._map.forEach(((t,a)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[a]=i instanceof nc?i.toJSON():i;}})),e}get size(){return [..._c(this)].length}keys(){return Bl(_c(this),(e=>e[0]))}values(){return Bl(_c(this),(e=>e[1].content.getContent()[e[1].length-1]))}entries(){return Bl(_c(this),(e=>[e[0],e[1].content.getContent()[e[1].length-1]]))}forEach(e){this.doc??Ku(),this._map.forEach(((t,a)=>{t.deleted||e(t.content.getContent()[t.length-1],a,this);}));}[Symbol.iterator](){return this.entries()}delete(e){null!==this.doc?Pu(this.doc,(t=>{mc(t,this,e);})):this._prelimContent.delete(e);}set(e,t){return null!==this.doc?Pu(this.doc,(a=>{yc(a,this,e,t);})):this._prelimContent.set(e,t),t}get(e){return gc(this,e)}has(e){return vc(this,e)}clear(){null!==this.doc?Pu(this.doc,(e=>{this.forEach((function(t,a,i){mc(e,i,a);}));})):this._prelimContent.clear();}_write(e){e.writeTypeRef(od);}}const Nc=(e,t)=>e===t||"object"==typeof e&&"object"==typeof t&&e&&t&&((e,t)=>e===t||il(e)===il(t)&&((e,t)=>{for(const a in e)if(!t(e[a],a))return false;return true})(e,((e,a)=>(void 0!==e||nl(t,a))&&t[a]===e)))(e,t);class Tc{constructor(e,t,a,i){this.left=e,this.right=t,this.index=a,this.currentAttributes=i;}forward(){if(null===this.right&&Mo(),this.right.content.constructor===ed)this.right.deleted||Cc(this.currentAttributes,this.right.content);else this.right.deleted||(this.index+=this.right.length);this.left=this.right,this.right=this.right.right;}}const Mc=(e,t,a)=>{for(;null!==t.right&&a>0;){if(t.right.content.constructor===ed)t.right.deleted||Cc(t.currentAttributes,t.right.content);else t.right.deleted||(a<t.right.length&&Vu(e,vu(t.right.id.client,t.right.id.clock+a)),t.index+=t.right.length,a-=t.right.length);t.left=t.right,t.right=t.right.right;}return t},xc=(e,t,a,i)=>{const n=new Map,r=i?tc(t,a):null;if(r){const t=new Tc(r.p.left,r.p,r.index,n);return Mc(e,t,a-r.index)}{const i=new Tc(null,t._start,0,n);return Mc(e,i,a)}},Vc=(e,t,a,i)=>{for(;null!==a.right&&(true===a.right.deleted||a.right.content.constructor===ed&&Nc(i.get(a.right.content.key),a.right.content.value));)a.right.deleted||i.delete(a.right.content.key),a.forward();const n=e.doc,r=n.clientID;i.forEach(((i,s)=>{const o=a.left,l=a.right,u=new md(vu(r,Su(n.store,r)),o,o&&o.lastId,l,l&&l.id,t,null,new ed(s,i));u.integrate(e,0),a.right=u,a.forward();}));},Cc=(e,t)=>{const{key:a,value:i}=t;null===i?e.delete(a):e.set(a,i);},Ic=(e,t)=>{for(;null!==e.right&&(e.right.deleted||e.right.content.constructor===ed&&Nc(t[e.right.content.key]??null,e.right.content.value));)e.forward();},Fc=(e,t,a,i)=>{const n=e.doc,r=n.clientID,s=new Map;for(const o in i){const l=i[o],u=a.currentAttributes.get(o)??null;if(!Nc(u,l)){s.set(o,u);const{left:i,right:c}=a;a.right=new md(vu(r,Su(n.store,r)),i,i&&i.lastId,c,c&&c.id,t,null,new ed(o,l)),a.right.integrate(e,0),a.forward();}}return s},Ec=(e,t,a,i,n)=>{a.currentAttributes.forEach(((e,t)=>{ void 0===n[t]&&(n[t]=null);}));const r=e.doc,s=r.clientID;Ic(a,n);const o=Fc(e,t,a,n),l=i.constructor===String?new nd(i):i instanceof nc?new hd(i):new Qc(i);let{left:u,right:c,index:d}=a;t._searchMarker&&ac(t._searchMarker,a.index,l.getLength()),c=new md(vu(s,Su(r.store,s)),u,u&&u.lastId,c,c&&c.id,t,null,l),c.integrate(e,0),a.right=c,a.index=d,a.forward(),Vc(e,t,a,o);},Dc=(e,t,a,i,n)=>{const r=e.doc,s=r.clientID;Ic(a,n);const o=Fc(e,t,a,n);e:for(;null!==a.right&&(i>0||o.size>0&&(a.right.deleted||a.right.content.constructor===ed));){if(!a.right.deleted)switch(a.right.content.constructor){case ed:{const{key:t,value:r}=a.right.content,s=n[t];if(void 0!==s){if(Nc(s,r))o.delete(t);else {if(0===i)break e;o.set(t,r);}a.right.delete(e);}else a.currentAttributes.set(t,r);break}default:i<a.right.length&&Vu(e,vu(a.right.id.client,a.right.id.clock+i)),i-=a.right.length;}a.forward();}if(i>0){let n="";for(;i>0;i--)n+="\n";a.right=new md(vu(s,Su(r.store,s)),a.left,a.left&&a.left.lastId,a.right,a.right&&a.right.id,t,null,new nd(n)),a.right.integrate(e,0),a.forward();}Vc(e,t,a,o);},Rc=(e,t,a,i,n)=>{let r=t;const s=xs();for(;r&&(!r.countable||r.deleted);){if(!r.deleted&&r.content.constructor===ed){const e=r.content;s.set(e.key,e);}r=r.right;}let o=0,l=false;for(;t!==r;){if(a===t&&(l=true),!t.deleted){const a=t.content;switch(a.constructor){case ed:{const{key:r,value:u}=a,c=i.get(r)??null;s.get(r)===a&&c!==u||(t.delete(e),o++,l||(n.get(r)??null)!==u||c===u||(null===c?n.delete(r):n.set(r,c))),l||t.deleted||Cc(n,a);break}}}t=t.right;}return o},Lc=e=>{let t=0;return Pu(e.doc,(a=>{let i=e._start,n=e._start,r=xs();const s=Vs(r);for(;n;){if(!1===n.deleted)if(n.content.constructor===ed)Cc(s,n.content);else t+=Rc(a,i,n,r,s),r=Vs(s),i=n;n=n.right;}})),t},Pc=e=>{const t=new Set,a=e.doc;for(const[i,n]of e.afterState.entries()){const r=e.beforeState.get(i)||0;n!==r&&Iu(e,a.store.clients.get(i),r,n,(e=>{e.deleted||e.content.constructor!==ed||e.constructor===qc||t.add(e.parent);}));}Pu(a,(a=>{jl(e,e.deleteSet,(e=>{if(e instanceof qc||!e.parent._hasFormatting||t.has(e.parent))return;const i=e.parent;e.content.constructor===ed?t.add(i):((e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const a=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===ed){const i=t.content.key;a.has(i)?t.delete(e):a.add(i);}t=t.left;}})(a,e);}));for(const e of t)Lc(e);}));},Bc=(e,t,a)=>{const i=a,n=Vs(t.currentAttributes),r=t.right;for(;a>0&&null!==t.right;){if(false===t.right.deleted)switch(t.right.content.constructor){case hd:case Qc:case nd:a<t.right.length&&Vu(e,vu(t.right.id.client,t.right.id.clock+a)),a-=t.right.length,t.right.delete(e);}t.forward();}r&&Rc(e,r,t.right,n,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&ac(s._searchMarker,t.index,-i+a),t};class Oc extends Zu{constructor(e,t,a){super(e,t),this.childListChanged=false,this.keysChanged=new Set,a.forEach((e=>{null===e?this.childListChanged=true:this.keysChanged.add(e);}));}get changes(){if(null===this._changes){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e;}return this._changes}get delta(){if(null===this._delta){const e=this.target.doc,t=[];Pu(e,(e=>{const a=new Map,i=new Map;let n=this.target._start,r=null;const s={};let o="",l=0,u=0;const c=()=>{if(null!==r){let e=null;switch(r){case "delete":u>0&&(e={delete:u}),u=0;break;case "insert":("object"==typeof o||o.length>0)&&(e={insert:o},a.size>0&&(e.attributes={},a.forEach(((t,a)=>{null!==t&&(e.attributes[a]=t);})))),o="";break;case "retain":l>0&&(e={retain:l},(e=>{for(const t in e)return !1;return !0})(s)||(e.attributes=el({},s))),l=0;}e&&t.push(e),r=null;}};for(;null!==n;){switch(n.content.constructor){case hd:case Qc:this.adds(n)?this.deletes(n)||(c(),r="insert",o=n.content.getContent()[0],c()):this.deletes(n)?("delete"!==r&&(c(),r="delete"),u+=1):n.deleted||("retain"!==r&&(c(),r="retain"),l+=1);break;case nd:this.adds(n)?this.deletes(n)||("insert"!==r&&(c(),r="insert"),o+=n.content.str):this.deletes(n)?("delete"!==r&&(c(),r="delete"),u+=n.length):n.deleted||("retain"!==r&&(c(),r="retain"),l+=n.length);break;case ed:{const{key:t,value:o}=n.content;if(this.adds(n)){if(!this.deletes(n)){const l=a.get(t)??null;Nc(l,o)?null!==o&&n.delete(e):("retain"===r&&c(),Nc(o,i.get(t)??null)?delete s[t]:s[t]=o);}}else if(this.deletes(n)){i.set(t,o);const e=a.get(t)??null;Nc(e,o)||("retain"===r&&c(),s[t]=e);}else if(!n.deleted){i.set(t,o);const a=s[t];void 0!==a&&(Nc(a,o)?null!==a&&n.delete(e):("retain"===r&&c(),null===o?delete s[t]:s[t]=o));}n.deleted||("insert"===r&&c(),Cc(a,n.content));break}}n=n.right;}for(c();t.length>0;){const e=t[t.length-1];if(void 0===e.retain||void 0!==e.attributes)break;t.pop();}})),this._delta=t;}return this._delta}}class $c extends nc{constructor(e){super(),this._pending=void 0!==e?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=false;}get length(){return this.doc??Ku(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach((e=>e()));}catch(e){console.error(e);}this._pending=null;}_copy(){return new $c}clone(){const e=new $c;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const a=new Oc(this,e,t);ic(this,e,a),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=true);}toString(){this.doc??Ku();let e="",t=this._start;for(;null!==t;)!t.deleted&&t.countable&&t.content.constructor===nd&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=true}={}){null!==this.doc?Pu(this.doc,(a=>{const i=new Tc(null,this._start,0,new Map);for(let n=0;n<e.length;n++){const r=e[n];if(void 0!==r.insert){const s=t||"string"!=typeof r.insert||n!==e.length-1||null!==i.right||"\n"!==r.insert.slice(-1)?r.insert:r.insert.slice(0,-1);("string"!=typeof s||s.length>0)&&Ec(a,this,i,s,r.attributes||{});}else void 0!==r.retain?Dc(a,this,i,r.retain,r.attributes||{}):void 0!==r.delete&&Bc(a,i,r.delete);}})):this._pending.push((()=>this.applyDelta(e)));}toDelta(e,t,a){this.doc??Ku();const i=[],n=new Map,r=this.doc;let s="",o=this._start;function l(){if(s.length>0){const e={};let t=false;n.forEach(((a,i)=>{t=true,e[i]=a;}));const a={insert:s};t&&(a.attributes=e),i.push(a),s="";}}const u=()=>{for(;null!==o;){if(_u(o,e)||void 0!==t&&_u(o,t))switch(o.content.constructor){case nd:{const i=n.get("ychange");void 0===e||_u(o,e)?void 0===t||_u(o,t)?void 0!==i&&(l(),n.delete("ychange")):void 0!==i&&i.user===o.id.client&&"added"===i.type||(l(),n.set("ychange",a?a("added",o.id):{type:"added"})):void 0!==i&&i.user===o.id.client&&"removed"===i.type||(l(),n.set("ychange",a?a("removed",o.id):{type:"removed"})),s+=o.content.str;break}case hd:case Qc:{l();const e={insert:o.content.getContent()[0]};if(n.size>0){const t={};e.attributes=t,n.forEach(((e,a)=>{t[a]=e;}));}i.push(e);break}case ed:_u(o,e)&&(l(),Cc(n,o.content));}o=o.right;}l();};return e||t?Pu(r,(a=>{e&&wu(a,e),t&&wu(a,t),u();}),"cleanup"):u(),i}insert(e,t,a){if(t.length<=0)return;const i=this.doc;null!==i?Pu(i,(i=>{const n=xc(i,this,e,!a);a||(a={},n.currentAttributes.forEach(((e,t)=>{a[t]=e;}))),Ec(i,this,n,t,a);})):this._pending.push((()=>this.insert(e,t,a)));}insertEmbed(e,t,a){const i=this.doc;null!==i?Pu(i,(i=>{const n=xc(i,this,e,!a);Ec(i,this,n,t,a||{});})):this._pending.push((()=>this.insertEmbed(e,t,a||{})));}delete(e,t){if(0===t)return;const a=this.doc;null!==a?Pu(a,(a=>{Bc(a,xc(a,this,e,!0),t);})):this._pending.push((()=>this.delete(e,t)));}format(e,t,a){if(0===t)return;const i=this.doc;null!==i?Pu(i,(i=>{const n=xc(i,this,e,!1);null!==n.right&&Dc(i,this,n,t,a);})):this._pending.push((()=>this.format(e,t,a)));}removeAttribute(e){null!==this.doc?Pu(this.doc,(t=>{mc(t,this,e);})):this._pending.push((()=>this.removeAttribute(e)));}setAttribute(e,t){null!==this.doc?Pu(this.doc,(a=>{yc(a,this,e,t);})):this._pending.push((()=>this.setAttribute(e,t)));}getAttribute(e){return gc(this,e)}getAttributes(){return bc(this)}_write(e){e.writeTypeRef(ld);}}class jc{constructor(e,t=()=>true){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=true,e.doc??Ku();}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(null!==e&&(!this._firstCall||e.deleted||!this._filter(t)))do{if(t=e.content.type,e.deleted||t.constructor!==zc&&t.constructor!==Uc||null===t._start)for(;null!==e;){const t=e.next;if(null!==t){e=t;break}e=e.parent===this._root?null:e.parent._item;}else e=t._start;}while(null!==e&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=false,null===e?{value:void 0,done:true}:(this._currentNode=e,{value:e.content.type,done:false})}}class Uc extends nc{constructor(){super(),this._prelimContent=[];}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null;}_copy(){return new Uc}clone(){const e=new Uc;return e.insert(0,this.toArray().map((e=>e instanceof nc?e.clone():e))),e}get length(){return this.doc??Ku(),null===this._prelimContent?this._length:this._prelimContent.length}createTreeWalker(e){return new jc(this,e)}querySelector(e){e=e.toUpperCase();const t=new jc(this,(t=>t.nodeName&&t.nodeName.toUpperCase()===e)).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),Ds(new jc(this,(t=>t.nodeName&&t.nodeName.toUpperCase()===e)))}_callObserver(e,t){ic(this,e,new Wc(this,t,e));}toString(){return lc(this,(e=>e.toString())).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},a){const i=e.createDocumentFragment();return void 0!==a&&a._createAssociation(i,this),oc(this,(n=>{i.insertBefore(n.toDOM(e,t,a),null);})),i}insert(e,t){null!==this.doc?Pu(this.doc,(a=>{hc(a,this,e,t);})):this._prelimContent.splice(e,0,...t);}insertAfter(e,t){if(null!==this.doc)Pu(this.doc,(a=>{const i=e&&e instanceof nc?e._item:e;dc(a,this,i,t);}));else {const a=this._prelimContent,i=null===e?0:a.findIndex((t=>t===e))+1;if(0===i&&null!==e)throw No("Reference item not found");a.splice(i,0,...t);}}delete(e,t=1){null!==this.doc?Pu(this.doc,(a=>{fc(a,this,e,t);})):this._prelimContent.splice(e,t);}toArray(){return sc(this)}push(e){this.insert(this.length,e);}unshift(e){this.insert(0,e);}get(e){return cc(this,e)}slice(e=0,t=this.length){return rc(this,e,t)}forEach(e){oc(this,e);}_write(e){e.writeTypeRef(cd);}}class zc extends Uc{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map;}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach(((e,t)=>{this.setAttribute(t,e);})),this._prelimAttrs=null;}_copy(){return new zc(this.nodeName)}clone(){const e=new zc(this.nodeName);return ((e,t)=>{for(const a in e)t(e[a],a);})(this.getAttributes(),((t,a)=>{"string"==typeof t&&e.setAttribute(a,t);})),e.insert(0,this.toArray().map((e=>e instanceof nc?e.clone():e))),e}toString(){const e=this.getAttributes(),t=[],a=[];for(const t in e)a.push(t);a.sort();const i=a.length;for(let n=0;n<i;n++){const i=a[n];t.push(i+'="'+e[i]+'"');}const n=this.nodeName.toLocaleLowerCase();return `<${n}${t.length>0?" "+t.join(" "):""}>${super.toString()}</${n}>`}removeAttribute(e){null!==this.doc?Pu(this.doc,(t=>{mc(t,this,e);})):this._prelimAttrs.delete(e);}setAttribute(e,t){null!==this.doc?Pu(this.doc,(a=>{yc(a,this,e,t);})):this._prelimAttrs.set(e,t);}getAttribute(e){return gc(this,e)}hasAttribute(e){return vc(this,e)}getAttributes(e){return e?((e,t)=>{const a={};return e._map.forEach(((e,i)=>{let n=e;for(;null!==n&&(!t.sv.has(n.id.client)||n.id.clock>=(t.sv.get(n.id.client)||0));)n=n.left;null!==n&&_u(n,t)&&(a[i]=n.content.getContent()[n.length-1]);})),a})(this,e):bc(this)}toDOM(e=document,t={},a){const i=e.createElement(this.nodeName),n=this.getAttributes();for(const e in n){const t=n[e];"string"==typeof t&&i.setAttribute(e,t);}return oc(this,(n=>{i.appendChild(n.toDOM(e,t,a));})),void 0!==a&&a._createAssociation(i,this),i}_write(e){e.writeTypeRef(ud),e.writeKey(this.nodeName);}}class Wc extends Zu{constructor(e,t,a){super(e,a),this.childListChanged=false,this.attributesChanged=new Set,t.forEach((e=>{null===e?this.childListChanged=true:this.attributesChanged.add(e);}));}}class Yc extends Sc{constructor(e){super(),this.hookName=e;}_copy(){return new Yc(this.hookName)}clone(){const e=new Yc(this.hookName);return this.forEach(((t,a)=>{e.set(a,t);})),e}toDOM(e=document,t={},a){const i=t[this.hookName];let n;return n=void 0!==i?i.createDom(this):document.createElement(this.hookName),n.setAttribute("data-yjs-hook",this.hookName),void 0!==a&&a._createAssociation(n,this),n}_write(e){e.writeTypeRef(dd),e.writeKey(this.hookName);}}class Hc extends $c{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Hc}clone(){const e=new Hc;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,a){const i=e.createTextNode(this.toString());return void 0!==a&&a._createAssociation(i,this),i}toString(){return this.toDelta().map((e=>{const t=[];for(const a in e.attributes){const i=[];for(const t in e.attributes[a])i.push({key:t,value:e.attributes[a][t]});i.sort(((e,t)=>e.key<t.key?-1:1)),t.push({nodeName:a,attrs:i});}t.sort(((e,t)=>e.nodeName<t.nodeName?-1:1));let a="";for(let e=0;e<t.length;e++){const i=t[e];a+=`<${i.nodeName}`;for(let e=0;e<i.attrs.length;e++){const t=i.attrs[e];a+=` ${t.key}="${t.value}"`;}a+=">";}a+=e.insert;for(let e=t.length-1;e>=0;e--)a+=`</${t[e].nodeName}>`;return a})).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(pd);}}class Gc{constructor(e,t){this.id=e,this.length=t;}get deleted(){throw To()}mergeWith(e){return false}write(e,t,a){throw To()}integrate(e,t){throw To()}}class qc extends Gc{get deleted(){return true}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,true)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Nu(e.doc.store,this);}write(e,t){e.writeInfo(0),e.writeLen(this.length-t);}getMissing(e,t){return null}}class Zc{constructor(e){this.content=e;}getLength(){return 1}getContent(){return [this.content]}isCountable(){return true}copy(){return new Zc(this.content)}splice(e){throw To()}mergeWith(e){return false}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content);}getRef(){return 3}}class Jc{constructor(e){this.len=e;}getLength(){return this.len}getContent(){return []}isCountable(){return false}copy(){return new Jc(this.len)}splice(e){const t=new Jc(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,true}integrate(e,t){Wl(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted();}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t);}getRef(){return 1}}const Kc=(e,t)=>new Jl({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||false});class Xc{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=false),e.autoLoad&&(t.autoLoad=true),null!==e.meta&&(t.meta=e.meta);}getLength(){return 1}getContent(){return [this.doc]}isCountable(){return true}copy(){return new Xc(Kc(this.doc.guid,this.opts))}splice(e){throw To()}mergeWith(e){return false}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc);}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc);}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts);}getRef(){return 9}}class Qc{constructor(e){this.embed=e;}getLength(){return 1}getContent(){return [this.embed]}isCountable(){return true}copy(){return new Qc(this.embed)}splice(e){throw To()}mergeWith(e){return false}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed);}getRef(){return 5}}class ed{constructor(e,t){this.key=e,this.value=t;}getLength(){return 1}getContent(){return []}isCountable(){return false}copy(){return new ed(this.key,this.value)}splice(e){throw To()}mergeWith(e){return false}integrate(e,t){const a=t.parent;a._searchMarker=null,a._hasFormatting=true;}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value);}getRef(){return 6}}let td$2 = class td{constructor(e){this.arr=e;}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return true}copy(){return new td(this.arr)}splice(e){const t=new td(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),true}integrate(e,t){}delete(e){}gc(e){}write(e,t){const a=this.arr.length;e.writeLen(a-t);for(let i=t;i<a;i++){const t=this.arr[i];e.writeString(void 0===t?"undefined":JSON.stringify(t));}}getRef(){return 2}};const ad="development"===ml("node_env");class id{constructor(e){this.arr=e,ad&&sl(e);}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return true}copy(){return new id(this.arr)}splice(e){const t=new id(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),true}integrate(e,t){}delete(e){}gc(e){}write(e,t){const a=this.arr.length;e.writeLen(a-t);for(let i=t;i<a;i++){const t=this.arr[i];e.writeAny(t);}}getRef(){return 8}}class nd{constructor(e){this.str=e;}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return true}copy(){return new nd(this.str)}splice(e){const t=new nd(this.str.slice(e));this.str=this.str.slice(0,e);const a=this.str.charCodeAt(e-1);return a>=55296&&a<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,true}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(0===t?this.str:this.str.slice(t));}getRef(){return 4}}const rd=[e=>new Ac,e=>new Sc,e=>new $c,e=>new zc(e.readKey()),e=>new Uc,e=>new Yc(e.readKey()),e=>new Hc],sd=0,od=1,ld=2,ud=3,cd=4,dd=5,pd=6;class hd{constructor(e){this.type=e;}getLength(){return 1}getContent(){return [this.type]}isCountable(){return true}copy(){return new hd(this.type._copy())}splice(e){throw To()}mergeWith(e){return false}integrate(e,t){this.type._integrate(e.doc,t);}delete(e){let t=this.type._start;for(;null!==t;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach((t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e);})),e.changed.delete(this.type);}gc(e){let t=this.type._start;for(;null!==t;)t.gc(e,true),t=t.right;this.type._start=null,this.type._map.forEach((t=>{for(;null!==t;)t.gc(e,true),t=t.left;})),this.type._map=new Map;}write(e,t){this.type._write(e);}getRef(){return 7}}const fd$2=(e,t,a)=>{const{client:i,clock:n}=t.id,r=new md(vu(i,n+a),t,vu(i,n+a-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(a));return t.deleted&&r.markDeleted(),t.keep&&(r.keep=true),null!==t.redone&&(r.redone=vu(t.redone.client,t.redone.clock+a)),t.right=r,null!==r.right&&(r.right.left=r),e._mergeStructs.push(r),null!==r.parentSub&&null===r.right&&r.parent._map.set(r.parentSub,r),t.length=a,r};class md extends Gc{constructor(e,t,a,i,n,r,s,o){super(e,o.getLength()),this.origin=a,this.left=t,this.right=i,this.rightOrigin=n,this.parent=r,this.parentSub=s,this.redone=null,this.content=o,this.info=this.content.isCountable()?2:0;}set marker(e){(8&this.info)>0!==e&&(this.info^=8);}get marker(){return (8&this.info)>0}get keep(){return (1&this.info)>0}set keep(e){this.keep!==e&&(this.info^=1);}get countable(){return (2&this.info)>0}get deleted(){return (4&this.info)>0}set deleted(e){this.deleted!==e&&(this.info^=4);}markDeleted(){this.info|=4;}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Su(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Su(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===gu&&this.id.client!==this.parent.client&&this.parent.clock>=Su(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Cu(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Vu(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===qc||this.right&&this.right.constructor===qc)this.parent=null;else if(this.parent){if(this.parent.constructor===gu){const e=Mu(t,this.parent);e.constructor===qc?this.parent=null:this.parent=e.content.type;}}else this.left&&this.left.constructor===md?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===md&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=Cu(e,e.doc.store,vu(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||null!==this.right.left)||this.left&&this.left.right!==this.right){let t,a=this.left;if(null!==a)t=a.right;else if(null!==this.parentSub)for(t=this.parent._map.get(this.parentSub)||null;null!==t&&null!==t.left;)t=t.left;else t=this.parent._start;const i=new Set,n=new Set;for(;null!==t&&t!==this.right;){if(n.add(t),i.add(t),bu(this.origin,t.origin)){if(t.id.client<this.id.client)a=t,i.clear();else if(bu(this.rightOrigin,t.rightOrigin))break}else {if(null===t.origin||!n.has(Mu(e.doc.store,t.origin)))break;i.has(Mu(e.doc.store,t.origin))||(a=t,i.clear());}t=t.right;}this.left=a;}if(null!==this.left){const e=this.left.right;this.right=e,this.left.right=this;}else {let e;if(null!==this.parentSub)for(e=this.parent._map.get(this.parentSub)||null;null!==e&&null!==e.left;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e;}null!==this.right?this.right.left=this:null!==this.parentSub&&(this.parent._map.set(this.parentSub,this),null!==this.left&&this.left.delete(e)),null===this.parentSub&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Nu(e.doc.store,this),this.content.integrate(e,this),Du(e,this.parent,this.parentSub),(null!==this.parent._item&&this.parent._item.deleted||null!==this.parentSub&&null!==this.right)&&this.delete(e);}else new qc(this.id,this.length).integrate(e,0);}get next(){let e=this.right;for(;null!==e&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;null!==e&&e.deleted;)e=e.left;return e}get lastId(){return 1===this.length?this.id:vu(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&bu(e.origin,this.lastId)&&this.right===e&&bu(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&null===this.redone&&null===e.redone&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach((t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length));})),e.keep&&(this.keep=true),this.right=e.right,null!==this.right&&(this.right.left=this),this.length+=e.length,true}return false}delete(e){if(!this.deleted){const t=this.parent;this.countable&&null===this.parentSub&&(t._length-=this.length),this.markDeleted(),Wl(e.deleteSet,this.id.client,this.id.clock,this.length),Du(e,t,this.parentSub),this.content.delete(e);}}gc(e,t){if(!this.deleted)throw Mo();this.content.gc(e),t?((e,t,a)=>{const i=e.clients.get(t.id.client);i[Tu(i,t.id.clock)]=a;})(e,this,new qc(this.id,this.length)):this.content=new Jc(this.length);}write(e,t){const a=t>0?vu(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,n=this.parentSub,r=31&this.content.getRef()|(null===a?0:Ys)|(null===i?0:Ws)|(null===n?0:32);if(e.writeInfo(r),null!==a&&e.writeLeftID(a),null!==i&&e.writeRightID(i),null===a&&null===i){const t=this.parent;if(void 0!==t._item){const a=t._item;if(null===a){const a=(e=>{for(const[t,a]of e.doc.share.entries())if(a===e)return t;throw Mo()})(t);e.writeParentInfo(true),e.writeString(a);}else e.writeParentInfo(false),e.writeLeftID(a.id);}else t.constructor===String?(e.writeParentInfo(true),e.writeString(t)):t.constructor===gu?(e.writeParentInfo(false),e.writeLeftID(t)):Mo();null!==n&&e.writeString(n);}this.content.write(e,t);}}const yd=(e,t)=>gd[31&t](e),gd=[()=>{Mo();},e=>new Jc(e.readLen()),e=>{const t=e.readLen(),a=[];for(let i=0;i<t;i++){const t=e.readString();"undefined"===t?a.push(void 0):a.push(JSON.parse(t));}return new td$2(a)},e=>new Zc(e.readBuf()),e=>new nd(e.readString()),e=>new Qc(e.readJSON()),e=>new ed(e.readKey(),e.readJSON()),e=>new hd(rd[e.readTypeRef()](e)),e=>{const t=e.readLen(),a=[];for(let i=0;i<t;i++)a.push(e.readAny());return new id(a)},e=>new Xc(Kc(e.readString(),e.readAny())),()=>{Mo();}];class bd extends Gc{get deleted(){return true}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,true)}integrate(e,t){Mo();}write(e,t){e.writeInfo(10),lo(e.restEncoder,this.length-t);}getMissing(e,t){return null}}const vd="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},_d="__ $YJS$ __";true===vd[_d]&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),vd[_d]=true;const wd=new Map;const Ad="undefined"==typeof BroadcastChannel?class{constructor(e){var t;this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&null!==this.onmessage&&this.onmessage({data:wl(t.newValue||"")}),t=this._onChange,Xo||addEventListener("storage",t);}postMessage(e){Qo.setItem(this.room,_l(new Uint8Array(e)));}close(){var e;e=this._onChange,Xo||removeEventListener("storage",e);}}:BroadcastChannel,kd=e=>Cs(wd,e,(()=>{const t=Is(),a=new Ad(e);return a.onmessage=e=>t.forEach((t=>t(e.data,"broadcastchannel"))),{bc:a,subs:t}})),Sd=(e,t,a=null)=>{const i=kd(e);i.bc.postMessage(t),i.subs.forEach((e=>e(t,a)));},Nd=(e,t)=>{lo(e,0);const a=(e=>du(e,new tu))(t);mo(e,a);},Td=(e,t,a)=>{lo(e,1),mo(e,((e,t)=>lu(e,t,new au))(t,a));},Md=(e,t,a)=>{try{((e,t,a)=>{ou(e,t,a,Xl);})(t,Fo(e),a);}catch(e){console.error("Caught error while handling a Yjs update",e);}},xd=Md,Vd=(e,t,a,i)=>{const n=Do(e);switch(n){case 0:((e,t,a)=>{Td(t,a,Fo(e));})(e,t,a);break;case 1:Md(e,a,i);break;case 2:xd(e,a,i);break;default:throw new Error("Unknown message type")}return n},Cd=3e4;class Id extends Ps{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval((()=>{const e=qo();null!==this.getLocalState()&&15e3<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const t=[];this.meta.forEach(((a,i)=>{i!==this.clientID&&Cd<=e-a.lastUpdated&&this.states.has(i)&&t.push(i);})),t.length>0&&Fd(this,t,"timeout");}),Bs(3e3)),e.on("destroy",(()=>{this.destroy();})),this.setLocalState({});}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval);}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const t=this.clientID,a=this.meta.get(t),i=void 0===a?0:a.clock+1,n=this.states.get(t);null===e?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:i,lastUpdated:qo()});const r=[],s=[],o=[],l=[];null===e?l.push(t):null==n?null!=e&&r.push(t):(s.push(t),cl(n,e)||o.push(t)),(r.length>0||o.length>0||l.length>0)&&this.emit("change",[{added:r,updated:o,removed:l},"local"]),this.emit("update",[{added:r,updated:s,removed:l},"local"]);}setLocalStateField(e,t){const a=this.getLocalState();null!==a&&this.setLocalState({...a,[e]:t});}getStates(){return this.states}}const Fd=(e,t,a)=>{const i=[];for(let a=0;a<t.length;a++){const n=t[a];if(e.states.has(n)){if(e.states.delete(n),n===e.clientID){const t=e.meta.get(n);e.meta.set(n,{clock:t.clock+1,lastUpdated:qo()});}i.push(n);}}i.length>0&&(e.emit("change",[{added:[],updated:[],removed:i},a]),e.emit("update",[{added:[],updated:[],removed:i},a]));},Ed=(e,t,a=e.states)=>{const i=t.length,n=io();lo(n,i);for(let r=0;r<i;r++){const i=t[r],s=a.get(i)||null,o=e.meta.get(i).clock;lo(n,i),lo(n,o),ho(n,JSON.stringify(s));}return ro(n)},Dd=[];Dd[0]=(e,t,a,i,n)=>{lo(e,0);const r=Vd(t,e,a.doc,a);i&&1===r&&!a.synced&&(a.synced=true);},Dd[3]=(e,t,a,i,n)=>{lo(e,1),mo(e,Ed(a.awareness,Array.from(a.awareness.getStates().keys())));},Dd[1]=(e,t,a,i,n)=>{((e,t,a)=>{const i=Io(t),n=qo(),r=[],s=[],o=[],l=[],u=Do(i);for(let t=0;t<u;t++){const t=Do(i);let a=Do(i);const u=JSON.parse(Lo(i)),c=e.meta.get(t),d=e.states.get(t),p=void 0===c?0:c.clock;(p<a||p===a&&null===u&&e.states.has(t))&&(null===u?t===e.clientID&&null!=e.getLocalState()?a++:e.states.delete(t):e.states.set(t,u),e.meta.set(t,{clock:a,lastUpdated:n}),void 0===c&&null!==u?r.push(t):void 0!==c&&null===u?l.push(t):null!==u&&(cl(u,d)||o.push(t),s.push(t)));}(r.length>0||o.length>0||l.length>0)&&e.emit("change",[{added:r,updated:o,removed:l},a]),(r.length>0||s.length>0||l.length>0)&&e.emit("update",[{added:r,updated:s,removed:l},a]);})(a.awareness,Fo(t),a);},Dd[2]=(e,t,a,i,n)=>{((e,t,a)=>{0===Do(e)&&a(t,Lo(e));})(t,a.doc,((e,t)=>Rd(a,t)));};const Rd=(e,t)=>console.warn(`Permission denied to access ${e.url}.\n${t}`),Ld=(e,t,a)=>{const i=Io(t),n=io(),r=Do(i),s=e.messageHandlers[r];return s?s(n,i,e,a,r):console.error("Unable to compute message"),n},Pd=(e,t,a)=>{t===e.ws&&(e.emit("connection-close",[a,e]),e.ws=null,t.close(),e.wsconnecting=false,e.wsconnected?(e.wsconnected=false,e.synced=false,Fd(e.awareness,Array.from(e.awareness.getStates().keys()).filter((t=>t!==e.doc.clientID)),e),e.emit("status",[{status:"disconnected"}])):e.wsUnsuccessfulReconnects++,setTimeout(Bd,$s(100*Us(2,e.wsUnsuccessfulReconnects),e.maxBackoffTime),e));},Bd=e=>{if(e.shouldConnect&&null===e.ws){const t=new e._WS(e.url,e.protocols);t.binaryType="arraybuffer",e.ws=t,e.wsconnecting=true,e.wsconnected=false,e.synced=false,t.onmessage=a=>{e.wsLastMessageReceived=qo();const i=Ld(e,new Uint8Array(a.data),true);no(i)>1&&t.send(ro(i));},t.onerror=t=>{e.emit("connection-error",[t,e]);},t.onclose=a=>{Pd(e,t,a);},t.onopen=()=>{e.wsLastMessageReceived=qo(),e.wsconnecting=false,e.wsconnected=true,e.wsUnsuccessfulReconnects=0,e.emit("status",[{status:"connected"}]);const a=io();if(lo(a,0),Nd(a,e.doc),t.send(ro(a)),null!==e.awareness.getLocalState()){const a=io();lo(a,1),mo(a,Ed(e.awareness,[e.doc.clientID])),t.send(ro(a));}},e.emit("status",[{status:"connecting"}]);}},Od=(e,t)=>{const a=e.ws;e.wsconnected&&a&&a.readyState===a.OPEN&&a.send(t),e.bcconnected&&Sd(e.bcChannel,t,e);};class $d extends Ls{constructor(e,t,a,{connect:i=true,awareness:n=new Id(a),params:r={},protocols:s=[],WebSocketPolyfill:o=WebSocket,resyncInterval:l=-1,maxBackoffTime:u=2500,disableBc:c=false}={}){for(super();"/"===e[e.length-1];)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+"/"+t,this.maxBackoffTime=u,this.params=r,this.protocols=s,this.roomname=t,this.doc=a,this._WS=o,this.awareness=n,this.wsconnected=false,this.wsconnecting=false,this.bcconnected=false,this.disableBc=c,this.wsUnsuccessfulReconnects=0,this.messageHandlers=Dd.slice(),this._synced=false,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=i,this._resyncInterval=0,l>0&&(this._resyncInterval=setInterval((()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const e=io();lo(e,0),Nd(e,a),this.ws.send(ro(e));}}),l)),this._bcSubscriber=(e,t)=>{if(t!==this){const t=Ld(this,new Uint8Array(e),false);no(t)>1&&Sd(this.bcChannel,ro(t),this);}},this._updateHandler=(e,t)=>{if(t!==this){const t=io();lo(t,0),((e,t)=>{lo(e,2),mo(e,t);})(t,e),Od(this,ro(t));}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:e,updated:t,removed:a},i)=>{const r=e.concat(t).concat(a),s=io();lo(s,1),mo(s,Ed(n,r)),Od(this,ro(s));},this._exitHandler=()=>{Fd(this.awareness,[a.clientID],"app closed");},dl&&void 0!==Ms&&Ms.on("exit",this._exitHandler),n.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval((()=>{this.wsconnected&&3e4<qo()-this.wsLastMessageReceived&&Pd(this,this.ws,null);}),3e3),i&&this.connect();}get url(){const e=(e=>((e,t)=>{const a=[];for(const i in e)a.push(t(e[i],i));return a})(e,((e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`)).join("&"))(this.params);return this.serverUrl+"/"+this.roomname+(0===e.length?"":"?"+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]));}destroy(){0!==this._resyncInterval&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),dl&&void 0!==Ms&&Ms.off("exit",this._exitHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy();}connectBc(){if(this.disableBc)return;var e,t;this.bcconnected||(e=this.bcChannel,t=this._bcSubscriber,kd(e).subs.add(t),this.bcconnected=true);const a=io();lo(a,0),Nd(a,this.doc),Sd(this.bcChannel,ro(a),this);const i=io();lo(i,0),Td(i,this.doc),Sd(this.bcChannel,ro(i),this);const n=io();lo(n,3),Sd(this.bcChannel,ro(n),this);const r=io();lo(r,1),mo(r,Ed(this.awareness,[this.doc.clientID])),Sd(this.bcChannel,ro(r),this);}disconnectBc(){const e=io();lo(e,1),mo(e,Ed(this.awareness,[this.doc.clientID],new Map)),Od(this,ro(e)),this.bcconnected&&(((e,t)=>{const a=kd(e),i=a.subs.delete(t);i&&0===a.subs.size&&(a.bc.close(),wd.delete(e));})(this.bcChannel,this._bcSubscriber),this.bcconnected=false);}disconnect(){this.shouldConnect=false,this.disconnectBc(),null!==this.ws&&Pd(this,this.ws,null);}connect(){this.shouldConnect=true,this.wsconnected||null!==this.ws||(Bd(this),this.connectBc());}}class jd extends Jl{}class Ud{apiClient;collabDocument;yWebsocketProvider;item;awareness;users=[];avatars=new Map;constructor(e){this.apiClient=e,this.collabDocument=new jd;}isActive(){return void 0!==this.yWebsocketProvider}getAwarenessStates(){return this.awareness?this.awareness.getStates():new Map}getUsersList(){return this.users}_getUser(e){for(const t of this.users)if(e===t.key)return t;return null}getLocalState(){if(!this.awareness)throw new Error("No awareness available. Cannot get state field.");return this.awareness.getLocalState()}setLocalStateField(e,t){if(!this.awareness)throw new Error("No awareness available. Cannot set state field.");this.awareness.setLocalStateField(e,t);}async _updateUsersList(){const e=this.getAwarenessStates(),t=await this.apiClient.me(true);for(const[a,i]of e.entries()){if(!this._getUser(a)){let e=this.avatars.get(i.user.id);if(!e){e=(await this.apiClient.getAvatar(i.user.id,32)).avatar,this.avatars.set(i.user.id,e);}this.users.push({key:a,id:i.user.id,name:i.user.name,color:i.user.color,avatar:e,itsMe:i.user.id===t._id});}}const a=[];for(const t of this.users)e.has(t.key)&&a.push(t);this.users=a;}async startCollaboration(e){try{if(!this.apiClient.isDevOrLocalhost())return !1;this.endCollaboration(),this.item=e;const t=this.apiClient.getCollabUrl(),a=`${this.item.type}.${this.item._id}`;let i=1e3;this.yWebsocketProvider=new $d(t,a,this.collabDocument,{connect:!1}),this.yWebsocketProvider.on("status",(e=>{console.log(`[Collab] ${e.status}`),"disconnected"===e.status&&this.yWebsocketProvider&&(this.yWebsocketProvider.disconnect(),setTimeout(r,i));})),this.yWebsocketProvider.on("sync",(e=>{console.log(`[Collab] synced: ${e}`);})),this.awareness=this.yWebsocketProvider.awareness,this.awareness.on("change",(async e=>{await this._updateUsersList(),l$1.$emit("collab:awareness:changed",{users:this.users,states:this.getAwarenessStates(),changes:e});}));const n=await this.apiClient.me(!0);this.awareness.setLocalStateField("user",{id:n._id,name:n.name,color:p.colorFromString(n.name)});const r=async()=>{if(!this.yWebsocketProvider)return void console.warn("[Collab] Cannot connect without websocket provider!");console.log("[Collab] reconnecting...");const e=await this.apiClient.getCollabToken();this.yWebsocketProvider.params.token=e,this.yWebsocketProvider.connect();};return await r(),l$1.$emit("collab:started"),!0}catch(e){return console.error("Error starting collaboration: ",e),false}}endCollaboration(){this.yWebsocketProvider&&(console.log("Ending collaboration."),l$1.$emit("collab:ended"),this.yWebsocketProvider.destroy(),this.yWebsocketProvider=void 0,this.awareness=void 0),this.collabDocument=new jd,this.item=void 0;}}class zd{apiClient;constructor(e){this.apiClient=e;}async testCopyItems(e,t){const a=await this.apiClient.getItemsInFolderList(t,true),i=await this.apiClient.getFoldersInFolderList(t),n=new Map;for(const e of i.children)n.set(e.name,null);for(const e of a)n.set(e.name,e._id);const r=this.apiClient.getItemRepo(),s=[];for(const t of e){let e,a,i=false;t.isFolder?a=await this.apiClient.getFolder(t._id):(a=r.getLoadedItem(t._id),a||(a=await this.apiClient.getItem(t._id))),e=a?.name,i=n.has(e),s.push({_id:t._id,isFolder:t.isFolder,data:a,name:e,conflicted:i,conflictedItemId:n.get(e)});}return s}async copyItems(e,t,a=false,i=false){const n=e.filter((e=>!e.isFolder)).map((e=>e._id)),r=await this.apiClient.copyItems(n,t,a,i),s=this.apiClient.getItemRepo();for(let t of r){const a=e.filter((e=>e._id===t.original));a.length>0&&(t.replaced=a[0].conflictedItemId),await s.replaceLink(t.original,t.clone);}return await this.apiClient.eventBus.$emit("folder:changed",t),await this.apiClient.eventBus.$emit("items:copied",r),r}}class Wd{apiClient;jobManager;constructor(e){this.apiClient=e,this.jobManager=e.getJobManager();}async executeExport(e,t,a,i){const n=await this.jobManager.execute("EXPORT:ExportGame",[{_id:e,isFolder:false}],[{name:"Destination Folder",value:a},{name:"EngineVersion",value:i}],void 0,{os:t});if(await this.apiClient.eventBus.$emit("quota:update"),2===n.state)throw new N$1("Export failed: "+n.error);await this.apiClient.eventBus.$emit("folder:changed",[a]);}}(axiosRetry.default?axiosRetry.default:axiosRetry)(axios,{retries:3,retryCondition:e=>e.message.includes("net::ERR_NETWORK_CHANGED")});const Yd={Draft:0,Private:1,NotListed:2,Public:3},Hd=[{id:"prod",name:"Production",ssl:true,apiHost:"api.lumino.cloud",viewerHost:"viewer.lumino.cloud",collabHost:"collab.lumino.cloud"},{id:"dev",name:"Development",ssl:true,apiHost:"api-dev.lumino.cloud",viewerHost:"viewer-dev.lumino.cloud",collabHost:"collab-dev.lumino.cloud"},{id:"local",name:"Local",ssl:false,apiHost:"localhost:8081",viewerHost:"localhost:8090",collabHost:"localhost:8200"}];class Gd extends o$1{accessToken;apiToken;options;forcePublicApi;usePublicApi;usePersistentStorage;storageSizeMib;requestClientId;apiUrl;wsUrl;viewerUrl;collabUrl;itemRepo;itemCache;folderCache;thumbCache;userCache;groupCache;attachmentCache;jobManager;serializer;collab;itemCopier;executableExporter;eventBus;env;api;ws=null;cachedMe;profiler;wsLastPing=null;last2faCode="";constructor(e={}){super(),e=e||{},this.options=Object.assign({environment:"auto",wsAutoReconnect:true,wsAutoConnect:false,forcePublicApi:false,debug:false,accessToken:null,apiToken:null,usePersistentStorage:true,storageSizeMib:10240,requestClientId:null,withCollaboration:false},e),this.accessToken=this.options.accessToken,this.apiToken=this.options.apiToken,this.forcePublicApi=this.options.forcePublicApi,this.usePublicApi=!this.accessToken&&!this.apiToken,this.usePersistentStorage=this.options.usePersistentStorage,this.storageSizeMib=this.options.storageSizeMib,this.requestClientId=this.options.requestClientId,this.cachedMe=null,this.itemRepo=new Xn(this.usePublicApi,this),this.itemCache=new zr(this.usePublicApi,this.usePersistentStorage,this,this.storageSizeMib),this.folderCache=new Wr(this),this.thumbCache=new Yr(this),this.userCache=new Hr(this),this.groupCache=new Gr(this),this.attachmentCache=new qr(this),this.jobManager=new Kr(this),this.serializer=new is(this),this.itemCopier=new zd(this),this.executableExporter=new Wd(this),this.eventBus=l$1,this.profiler=null,this.options.withCollaboration&&(this.collab=new Ud(this)),this.switchEnvironment(this.options.environment),this.setDebugMode(this.options.debug);}detectEnvironment(){const e=this.isOnLocalhost(),t=this.isDevPlatform();return e?this.getEnvironmentById("local"):t?this.getEnvironmentById("dev"):this.getEnvironmentById("prod")}getEnvironmentById(e){return "auto"===e?this.detectEnvironment():Hd.find((t=>t.id===e))}getEnvironments(){return Hd}switchEnvironment(e){let a=this.getEnvironmentById(e);if(!a)throw new Error(`Unknown environment: ${e}`);console.log(`ApiClient switched to env: ${a.name}`);const i=a.ssl?"https":"http",n=a.ssl?"wss":"ws";this.apiUrl=`${i}://${a.apiHost}`,this.wsUrl=`${n}://${a.apiHost}/api/ws`,this.viewerUrl=`${i}://${a.viewerHost}`,this.collabUrl=`${i}://${a.collabHost}`,this.api=axios.create({baseURL:this.apiUrl}),this.ws=null,this.wsLastPing=null;}async initCaches(){return Promise.all([this.itemCache.init(),this.folderCache.init(),this.thumbCache.init()])}clearCaches(){this.itemCache.clear(),this.folderCache.clear(),this.thumbCache.clear();}isDevPlatform(){return "object"==typeof window&&"location"in window&&(window.location.href.includes("dev.lumino.cloud")||window.location.href.includes("taste.lemonate.io"))}isOnLocalhost(){return "object"==typeof window&&"location"in window&&window.location.href.includes("localhost")}isDevOrLocalhost(){return this.isOnLocalhost()||this.isDevPlatform()}async clearIndexedDb(e){return new Promise(((t,a)=>{const i=indexedDB.deleteDatabase(e);i.onsuccess=()=>{t();},i.onerror=e=>{a("An error occured while deleting a IndexedDB database.");},i.onblocked=()=>{a(`Database deletion is blocked. Please close all connections to "${e}".`);};}))}async logout(){return this.clearCaches(),this.clearIndexedDb("lumino")}setDebugMode(e){this.options.debug=!!e,this.eventBus.setDebugMode(this.options.debug);}websocketConnect(e){const t=this;if(this.ws){if(!e)return void console.warn("Websocket is already connected!");this.websocketDisconnect();}this.ws=new i$3(this.wsUrl),this.ws.onerror=function(e){console.error("Websocket error",e),t.$emit("client:websocketError",e);},this.ws.onopen=function(){t.$emit("client:websocketOpen"),t.accessToken&&t.websocketSend(JSON.stringify({type:"auth",subscriptions:["item","folder","job","user","notification"],token:t.accessToken}));},this.ws.onclose=function(){t.$emit("client:websocketClosed"),t.options.wsAutoReconnect&&t.websocketConnect(true);},this.ws.onmessage=function(e){try{const a=JSON.parse(e.data);switch(a.type){case "ping":t.wsLastPing=new Date,t.ws&&t.ws.send(JSON.stringify({type:"ping"}));break;case "authenticated":t.$emit("client:websocketAuthenticated");break;case "Item":case "Folder":case "Notification":case "Job":case "User":l$1.$emit("client:elementUpdate",a);break;default:console.warn("Unknown websocket message: ",a);}}catch(e){console.error("Websocket error:",e);}};}websocketDisconnect(){this.ws&&(this.ws.close(),this.ws=null);}websocketSend(e){this.ws?1===this.ws.readyState?this.ws.send(e):console.error("Websocket is not in READY state. Currently in state "+this.ws.readyState):console.error("Websocket is not created");}getItemCopier(){return this.itemCopier}getExecutableExporter(){return this.executableExporter}getCollab(){return this.collab}getCollabUrl(){return this.collabUrl}getPublisher(){return new Zr(this)}getAssetCreator(){return new as(this)}getJobManager(){return this.jobManager}getThumbCache(){return this.thumbCache}getItemCache(){return this.itemCache}getItemRepo(){return this.itemRepo}getRootVisibility(){return this.itemRepo.activeItem?this.itemRepo.activeItem.visibility:Yd.Private}getEventBus(){return this.eventBus}getSerializer(){return this.serializer}setForcePublicApi(e){this.forcePublicApi=e,this._updateUsePublicApi();}_updateUsePublicApi(){this.usePublicApi=this.forcePublicApi||!this.apiToken&&!this.accessToken,this.itemRepo.usePublicApi=this.usePublicApi,this.itemCache.usePublicApi=this.usePublicApi;}setApiToken(e){this.apiToken=e,this._updateUsePublicApi();}setAccessToken(e){this.accessToken=e,this._updateUsePublicApi(),this.accessToken&&this.options.wsAutoConnect&&this.websocketConnect();}getApiToken(){return this.apiToken}getAccessToken(){return this.accessToken}setApiBaseUrl(e){this.apiUrl=e,this.api=axios.create({baseURL:this.apiUrl});}setWsBaseUrl(e){this.wsUrl=e,this.accessToken&&this.options.wsAutoConnect&&(this.websocketDisconnect(),this.websocketConnect());}setRequestClientId(e){this.requestClientId=e;}getApiBaseUrl(){return this.apiUrl}getWsBaseUrl(){return this.wsUrl}getViewerBaseUrl(){return this.viewerUrl}setProfiler(e){if(!e||"function"!=typeof e.start)throw new Error("Profiler needs to be an object providing a start function.");this.profiler=e;}async login2FA(e,t,a){return console.log("Running Login..."),this.execute("post","/api/auth/login2fa",{account:e,password:t,client:a}).then((e=>{this.last2faCode=e,this.eventBus.$emit("login.2facode",e);}))}async confirm2FA(e,t){return this.execute("post","/api/auth/confirm2fa",{account:e,code:t})}isAuthenticated(){return !!this.accessToken||!!this.apiToken}isFeatureEnabled(e){return !!this.cachedMe&&this.cachedMe.features.includes(e)}async resolveUserOrGroupInfoForItem(e){return e.quotaUser?this.userCache.resolve(e.quotaUser):e.quotaGroup?this.groupCache.resolve(e.quotaGroup):e.createdBy?this.userCache.resolve(e.createdBy):{name:"?",initials:"?",avatar:null}}_startOp(e){const t=this,a={id:p.createGUID(),name:e,startTimeMs:performance.now(),runningMs:0,percent:0,reportProgress:function(e){a.percent=e;},interval:null,finish:function(){if(a.interval&&clearInterval(a.interval),a.runningMs>1e3)try{t.$emit("client:longRunningOpFinished",a.id);}catch(e){console.error(e);}}};return a.interval=setInterval((function(){if(a.runningMs=performance.now()-a.startTimeMs,a.runningMs>1e3)try{t.$emit("client:longRunningOp",a.id,a.name,a.percent);}catch(e){console.error(e);}}),100),a}_createOpName(e,t){try{const a=t.split("/");switch(e.toLowerCase()){case "get":e="Fetching";break;case "post":e="Creating";break;case "put":e="Updating";break;case "delete":e="Deleting";}a.shift(),a.shift();const i=a.shift();let n=a.join("/");return n.length&&(n=` [${n}]`),`${e} ${i} data ${n}`}catch{return `${e} ${t}`}}addAuthenticationHeaders(e){this.accessToken&&(e["x-access-token"]=this.accessToken),this.apiToken&&(e["x-api-token"]=this.apiToken),this.requestClientId&&(e["x-request-client"]=this.requestClientId);}async execute(e,t,a,i){let n=this,r={};(i=i||{}).headers?r=i.headers:a&&"object"==typeof a&&"getHeaders"in a&&"function"==typeof a.getHeaders&&(r=a.getHeaders()),this.addAuthenticationHeaders(r);const s=this.profiler?this.profiler.start("ApiClient",`${e} ${t}`):null,o=this._startOp(i.opName||n._createOpName(e,t));return this.api({method:e,url:t,data:a,responseType:i.responseType,headers:r,signal:i.controller?i.controller.signal:void 0,onUploadProgress:function(e){if(e.total){const t=Math.min(100,Math.round(100*e.loaded/e.total));o.reportProgress(t),n.$emit("client:progress",{type:"upload",percent:t}),"function"==typeof i.progressCallback&&i.progressCallback(t,e.loaded,e.total);}},onDownloadProgress:function(e){if(e.total){const t=Math.min(100,Math.round(100*e.loaded/e.total));o.reportProgress(t),n.$emit("client:progress",{type:"download",percent:t}),"function"==typeof i.progressCallback&&i.progressCallback(t,e.loaded,e.total);}}}).then((e=>{if(s&&s.done(),o.finish(),n.$emit("client:progress",{type:"done"}),e.headers["content-type"].startsWith("application/json")){if("success"===e.data.result){let t;return t=i.withNext?{data:e.data.data,next:e.data.next}:e.data.data,i.emitOnSuccess&&this.eventBus.$emit(i.emitOnSuccess,t),t}throw e.data.redirect&&this.$emit("client:redirect",e.data.redirect),e.data.error?e.data.error:"API response seems to be json but does not contain result type!"}return i.emitOnSuccess&&this.eventBus.$emit(i.emitOnSuccess),{blob:new Blob([e.data],{type:e.headers["content-type"]}),hash:e.headers["sha256-hash"],itemName:e.headers["lumino-itemname"],itemType:e.headers["lumino-itemtype"],mimeType:e.headers["content-type"]}})).catch((e=>{if(s&&s.done(),o.finish(),n.$emit("client:progress",{type:"done"}),e.response){if(401===e.response.status)throw this.$emit("client:unauthorized"),new x$2("Access denied. Please login again.");if(413===e.response.status)throw new M;if(e.response.data&&e.response.data.error)throw new Error(e.response.data.error)}throw e}))}_createFormData(e,t){let a=new n$2;if("function"==typeof File&&e instanceof Blob)a.append("file",e,t);else {const i=new Blob([e]);try{a.append("file",i,t);}catch{a=new n$2,a.append("file",e,t);}}return a}async me(e){return e&&this.cachedMe||(this.cachedMe=await this.execute("get","/api/auth/me")),this.cachedMe}async getHomeFolder(){return this.execute("get","/api/auth/homefolder")}async myClients(){return this.execute("get","/api/auth/myclients")}async getCollabToken(){return this.execute("get","/api/auth/collabtoken")}async checkCollabToken(e){return this.execute("post","/api/auth/collabtoken",{token:e})}async register(e){return this.execute("post","/api/auth/register",e)}async deleteMyAccount(e){return this.execute("post","/api/auth/deletemyaccount",{password:e})}async confirmEmail(e){return this.execute("get","/api/auth/confirmemail/"+e)}async confirmEmailChange(e){return this.execute("get","/api/auth/confirmchangedemail/"+e)}async forgotPassword(e,t){return this.execute("post","/api/auth/forgotpassword",{account:e,client:t})}async setNewPassword(e,t){return this.execute("post","/api/auth/setnewpassword",{token:e,password:t})}async accountExists(e){return this.execute("post","/api/auth/accountExists",e)}async getItemsInFolderList(e,t=false){if(e&&!t){const t=await this.folderCache.getItemListing(e);if(t)return t}const a=await this.execute("get","/api/item/infolder/"+(e||"0"));return await this.folderCache.addItemListing(e,a),a}async getItem(e,t){const a=[];t&&(t.returnClonedFrom&&a.push("returnClonedFrom=true"),t.withThumbnails&&a.push("withThumbnails=true"));let i="";return a.length&&(i=`?${a.join("&")}`),this.execute("get",`/api/item/${e}${i}`)}getItemAggregatedPOP(e,t){return this.usePublicApi?this.getItemPublicAggregated(e,t):this.getItemAggregated(e,t)}async getItemPublicAggregated(e,t){const a=Un$1(e);if(a)return a;const i=[];t&&(t.withFieldInstances&&i.push("withFieldInstances"),t.withAttachmentInfo&&i.push("withAttachmentInfo"),t.noAttributes&&i.push("noAttributes"),t.noUserAttributes&&i.push("noUserAttributes"),t.noFields&&i.push("noFields"),t.noThumbnails&&i.push("noThumbnails"),t.noLinks&&i.push("noLinks"));let n="";return i.length&&(n=`?${i.join("&")}`),Un$1(e)?Un$1(e):this.execute("get","/api/item/publicaggregate/"+e+n)}async getItemAggregated(e,t){const a=Un$1(e);if(a)return a;const i=[];t&&(t.withFieldInstances&&i.push("withFieldInstances"),t.withAttachmentInfo&&i.push("withAttachmentInfo"),t.noAttributes&&i.push("noAttributes"),t.noUserAttributes&&i.push("noUserAttributes"),t.noFields&&i.push("noFields"),t.noThumbnails&&i.push("noThumbnails"),t.noLinks&&i.push("noLinks"));let n="";return i.length&&(n=`?${i.join("&")}`),Un$1(e)?Un$1(e):this.execute("get",`/api/item/aggregate/${e}${n}`)}async getItemAggregatedRecursive(e,t){const a=[];t&&(t.withFieldInstances&&a.push("withFieldInstances"),t.withAttachmentInfo&&a.push("withAttachmentInfo"),t.noAttributes&&a.push("noAttributes"),t.noUserAttributes&&a.push("noUserAttributes"),t.noFields&&a.push("noFields"),t.noThumbnails&&a.push("noThumbnails"));let i="";return a.length&&(i=`?${a.join("&")}`),this.execute("get",`/api/item/aggregaterecursive/${e}${i}`)}async getItemPublicRecursive(e,t){return this.execute("get","/api/item/publicrecursive/"+e+(t?"?withFeatures":""))}async getItemPublic(e,t){return this.execute("get","/api/item/public/"+e+(t?"?returnClonedFrom=true":""))}async getItemHistory(e){return this.execute("get","/api/item/history/"+e)}async copyItems(e,t,a,i){return this.execute("post","/api/item/copy",{sourceItemIds:e,destFolderId:t,deepCopy:a,overwrite:i})}async createItem(e){return this.execute("post","/api/item",e)}async updateItem(e){return this.execute("put","/api/item",e)}async deleteItem(e){return this.execute("delete","/api/item",{id:e})}async renameItem(e,t){return this.updateItem({_id:e,name:t})}async queryPublicItemsList(e){return this.execute("post","/api/item/publicquery",e)}async queryItemsListPOP(e){return this.usePublicApi?this.queryPublicItemsList(e):this.queryItemsList(e)}async queryItemsList(e){return this.execute("post","/api/item/query",e)}async queryItemsListAsExcel(e){e.exportAsExcel=true;const t=await this.execute("post","/api/item/query",e,{responseType:"arraybuffer"}),a=window.URL.createObjectURL(t.blob),i=document.createElement("a");i.href=a,i.setAttribute("download","export.xlsx"),i.click();}async moveItems(e){return this.execute("post","/api/item/move",e)}async downloadItem(e,t){const a=Ln(e);return a||this.execute("get",`/api/item/download/${e}`,null,{responseType:"arraybuffer",progressCallback:t,opName:`Downloading item ${e}`})}async publicDownloadItem(e,t){const a=Ln(e);return a||this.execute("get",`/api/item/publicdownload/${e}`,null,{responseType:"arraybuffer",progressCallback:t})}async getItemHash(e){const t=Un$1(e);return t?t.hash:this.execute("get",`/api/item/hash/${e}`)}async requestSecureDownload(e){return this.execute("get","/api/item/requestsecuredownload/"+e)}async getThumbnail(e,t){return this.execute("get",`/api/item/thumbnail/${e}/${t}`)}async uploadThumbnail(e,t,a,i,n,r){const s=this._createFormData(a,i);return this.execute("post",`/api/item/thumbnail/${t}/${e}`,s,{progressCallback:n,controller:r})}async getPublicThumbnail(e,t){return this.execute("get",`/api/item/publicthumbnail/${e}/${t}`)}async makeItemPublic(e,t,a){return this.execute("put","/api/item/makepublic",{id:e,recursive:t,inSubfolders:a})}async setVisibility(e,t,a,i){return this.execute("put","/api/item/setvisibility",{id:e,visibility:t,recursive:a,inSubfolders:i})}async makeItemPrivate(e,t,a){return this.execute("put","/api/item/makeprivate",{id:e,recursive:t,inSubfolders:a})}async setOmitLodGeneration(e,t){return this.execute("get",`/api/item/setOmitLodGeneration/${e}/${t}`)}async setOmitThumbnailGeneration(e,t){return this.execute("get",`/api/item/setOmitThumbnailGeneration/${e}/${t}`)}async setOmitPreviewGeneration(e,t){return this.execute("get",`/api/item/setOmitPreviewGeneration/${e}/${t}`)}async uploadAndCreate(e,t,a,i,n,r){const s=this._createFormData(t,a);let o=`/api/item/uploadAndCreate/${e}`,l={};return i&&("object"==typeof i?(i.autoDestructIn&&(o+="?autoDestructIn="+i.autoDestructIn),i.visibility&&(o+="?visibility="+i.visibility),i.flags&&(o+="?flags="+i.flags),i.overwrite&&(o+="?overwrite="+(i.overwrite?"true":"false")),i.nameOverride&&(l["x-override-name"]=i.nameOverride)):o+="?autoDestructIn="+i),this.execute("post",o,s,{progressCallback:n,controller:r,headers:l})}async upload(e,t,a,i,n,r){const s=[];r&&(r.omitHandleDependencyChange&&s.push("omitHandleDependencyChange=true"),r.keepThumbnails&&s.push("keepThumbnails=true"));let o="";s.length&&(o=`?${s.join("&")}`);const l=this._createFormData(t,a);return this.execute("post",`/api/item/upload/${e}${o}`,l,{progressCallback:i,controller:n})}resetPreview(e){const t=this.execute("delete",`/api/item/attachment/${e}/preview`),a=this.execute("get",`/api/item/setOmitPreviewGeneration/${e}/false`);return Promise.all([t,a])}clearPreview(e){const t=this.execute("delete",`/api/item/attachment/${e}/preview`),a=this.execute("get",`/api/item/setOmitPreviewGeneration/${e}/true`);return Promise.all([t,a])}async clearThumbnail(e){return this.execute("get",`/api/item/clearThumbnail/${e}`)}async resetThumbnail(e){return this.execute("get",`/api/item/resetThumbnail/${e}`)}async downloadAttachmentPOP(e,t,a,i,n){return this.usePublicApi?this.downloadPublicAttachment(e,t,a,i,n):this.downloadAttachment(e,t,a,i,n)}_getAttachmentUrlPath(e,t,a,i,n){return `/api/item/${n?"public":""}attachment/${e}/${t}${null!=a?`/${a}`:"/undefined"}${null!=i?`/${i}`:""}`}async downloadAttachment(e,t,a,i=0,n){const r=Gn(e,t,a,i);return r||this.execute("get",this._getAttachmentUrlPath(e,t,a,i),null,{responseType:"arraybuffer",progressCallback:n})}async downloadPublicAttachment(e,t,a,i,n){const r=Gn(e,t,a,i);return r||this.execute("get",this._getAttachmentUrlPath(e,t,a,i,true),null,{responseType:"arraybuffer",progressCallback:n})}async uploadAttachment(e,t,a,i,n,r,s,o){const l=this._createFormData(n,r);return this.execute("post",this._getAttachmentUrlPath(e,t,a,i),l,{progressCallback:s,controller:o})}async deleteAttachment(e,t,a,i){return this.attachmentCache.invalidateAttachment(e,t,a,i),this.execute("delete",this._getAttachmentUrlPath(e,t,a,i))}setPerceptiveHashOnAttachment(e,t,a){return this.execute("get",`/api/item/setPerceptiveHashAttachment/${e}/${t}/${a}`)}setPerceptiveHash(e,t){return this.execute("get",`/api/item/setPerceptiveHash/${e}/${t}`)}async getItemClient(e){return this.execute("get",`/api/item/getClient/${e}`)}async getItemAcl(e){return this.execute("get",`/api/item/acl/${e}`)}async getItemsLinking(e){return this.execute("get",`/api/item/linking/${e}`)}async setAttributes(e,t){return this.execute("put","/api/item/setAttributes",{id:e,attributes:t})}async getItemSyncList(e){const t=j(e).format("YYYYMMDDHHmmss");return this.execute("get",`/api/item/synclist/${t}`)}async increaseViews(e){return this.execute("get",`/api/item/increaseViews/${e}`)}async getViews(e){return this.execute("get",`/api/item/views/${e}`)}async getPublicItemCounts(e){return this.execute("get",`/api/item/publiccounts/${e}`)}async getItemCounts(e){return this.execute("get",`/api/item/counts/${e}`)}async likeItem(e){return this.execute("get",`/api/item/like/${e}`)}async unlikeItem(e){return this.execute("get",`/api/item/unlike/${e}`)}async doILike(e){return this.execute("get",`/api/item/doILike/${e}`)}async setItemAutoDestruct(e,t){const a=j(t).format("YYYYMMDDHHmmss");return this.execute("get",`/api/item/setAutoDestruct/${e}/${a}`)}async clearItemAutoDestruct(e){return this.execute("get",`/api/item/clearAutoDestruct/${e}`)}async resolveRelativeItem(e,t){const a=Un$1(e);if(!a)return this.execute("post","/api/item/resolve/"+e,{path:t});t.startsWith("/")&&(t=t.substring(1));const i=t.split("/"),n=i.pop();let r=a.folder._id;for(const e of i){let t=false;for(const[a,i]of Object.entries(Pn()))if(i.parent===r&&i.name===e){r=a,t=true;break}if(!t)break}for(const e of Object.values(jn()))if(e.folder._id===r&&e.name===n)return e._id;return console.error(`Could not resolve path ${t} for item ${e}`),null}async publicResolveRelativeItem(e,t){const a=Un$1(e);if(!a)return this.execute("post","/api/item/publicResolve/"+e,{path:t});t.startsWith("/")&&(t=t.substring(1));const i=t.split("/"),n=i.pop();let r=Bn(a.folder._id);for(const e of i)if(".."===e)r=Bn(r.parent);else {const t=On(e,r._id);if(!t)throw new Error("Can't find folder while loading folder from package");r=t;}const s=$n(n,r._id);if(s)return s._id;throw new Error("Can't load item from package.")}async rewireItems(e){return this.execute("post","/api/item/rewire",{items:e})}async getFolder(e){return this.execute("get","/api/folder/"+e)}async getFullFolderTree(e){return this.execute("get",`/api/folder/fulltree/${e||"0"}`)}async getFoldersInFolderList(e,t){e=e||"0";const a=[];let i="";if(t){if(t.resolveNames&&!t.folderAsItemType&&"0"!==e){if(i=await this.folderCache.getFolderListing(e),i&&Date.now()-new Date(i.cachedAt).getTime()<1e4)return i;i&&i.parent&&a.push(`lastUpdatedAt=${i.parent.updatedAt}`);}t.resolveNames&&a.push("resolve"),t.folderAsItemType&&a.push(`folderAsItemType=${t.folderAsItemType}`),t.folderAsItemName&&a.push(`folderAsItemName=${t.folderAsItemName}`),t.folderAsItemFlag&&a.push(`folderAsItemFlag=${t.folderAsItemFlag}`),t.withStats&&a.push("withStats=true"),t.returnLatestPackage&&a.push("returnLatestPackage=true");}let n="";a.length&&(n="?"+a.join("&"));const r=await this.execute("get",`/api/folder/infolder/${e}${n}`);if(true===r.notModified)return i;if(!t||t.resolveNames&&!t.folderAsItemType){const t=await this.getFolderAclList([e,...r.children.map((e=>e._id))]);for(const e of t)await this.folderCache.addACL(e.id,e.acl);return await this.folderCache.addFolderListing(e,r),r}return r}async updateFolderCache(e){const t=[];for(const a of e){if(!a)continue;const e=await this.folderCache.getFolderListing(a);e&&e.parent?t.push({id:a,lastUpdatedAt:e.parent.updatedAt}):t.push({id:a});}const a=await this.execute("post","/api/folder/infolderquery",{folders:t});for(const e of a) true===e.data.notModified?await this.folderCache.refreshCacheForFolder(e.id):await this.folderCache.addFolderListing(e.id,e.data);}async createFolder(e){return this.execute("post","/api/folder",e)}async updateFolder(e){return this.execute("put","/api/folder",e)}async deleteFolder(e){return this.execute("delete","/api/folder",{id:e})}async renameFolder(e,t){return this.updateFolder({_id:e,name:t})}async moveFolders(e){return this.execute("post","/api/folder/move",e)}async getFolderPath(e){return e?("object"==typeof e&&(e=e._id),this.execute("get","/api/folder/path/"+e)):{path:"/",elements:[]}}async resolveFolderPath(e){return "/"===(e=e.trim())?null:this.execute("post","/api/folder/resolve",{path:e})}async getFolderClient(e){return this.execute("get",`/api/folder/getClient/${e}`)}async getFolderAcl(e){const t=await this.folderCache.getFolderACLs(e||"0",1e4);if(t&&e)return t;{const t=await this.execute("get",`/api/folder/acl/${e||"0"}`);return await this.folderCache.addACL(e||"0",t),t}}async getFolderAclList(e){return this.execute("post","/api/folder/aclquery",{ids:e})}async getUser(e){return this.execute("get","/api/user/"+e)}async getUsersList(){return this.execute("get","/api/user")}async createUser(e){return this.execute("post","/api/user",e)}async queryUser(e,t,a){return this.execute("post","/api/user/query",{searchQuery:e,groupID:t,cursor:a},{withNext:true})}async updateUser(e){return this.execute("put","/api/user",e)}async deleteUser(e){return this.execute("delete","/api/user",{id:e})}async updateMyProfile(e){return this.execute("put","/api/user/myprofile",e)}async switchClient(e){return this.execute("get",`/api/user/switchclient/${e}`)}async activateUser(e,t){return this.execute("post","/api/user/activate",{token:t,password:e})}async getUsersToApprove(){return this.execute("get","/api/user/approvals")}async approveUserRegistration(e){return this.execute("get",`/api/user/approveuserregistration/${e}`)}async rejectUserRegistration(e){return this.execute("get",`/api/user/rejectuserregistration/${e}`)}async uploadAvatar(e){const t=new n$2;if(e instanceof Blob)t.append("file",e);else {const a=new Blob([new Uint8Array(e)]);t.append("file",a,"avatar.jpg");}return this.execute("post","/api/user/uploadAvatar",t)}async clearAvatar(){return this.execute("get","/api/user/clearAvatar")}async getAvatar(e,t){return this.execute("get",`/api/user/avatar/${t}/${e}`)}async getUserPublicInfo(e,t,a){return this.execute("get",`/api/user/publicinfo/${e}/${t}/${a}`)}async getUserAttribute(e){return this.execute("get",`/api/user/attribute/${e}`)}async clearUserAttribute(e){return this.execute("delete",`/api/user/attribute/${e}`)}async setUserAttribute(e,t){return this.execute("post",`/api/user/attribute/${e}`,t)}async getGroup(e){return this.execute("get","/api/group/"+e)}async getGroupFolder(e){return this.execute("get","/api/group/folder/"+e)}async getGroupsList(){return this.execute("get","/api/group")}async createGroup(e){return this.execute("post","/api/group",e)}async queryGroup(e,t){return this.execute("post","/api/group/query",{searchQuery:e,cursor:t},{withNext:true})}async updateGroup(e){return this.execute("put","/api/group",e)}async deleteGroup(e){return this.execute("delete","/api/group",{id:e})}async getGroupQuotaInfo(e){return this.execute("get","/api/group/quota/"+e)}async getGroupPublicInfo(e,t,a){return this.execute("get",`/api/group/publicinfo/${e}/${t}/${a}`)}async getGroupUsers(e){return this.execute("get","/api/group/users/"+e)}async uploadGroupAvatar(e,t){const a=new n$2;if(t instanceof Blob)a.append("file",t);else {const e=new Blob([new Uint8Array(t)]);a.append("file",e,"avatar.jpg");}return this.execute("post","/api/group/"+e+"/uploadAvatar",a)}async getClientsList(){return this.execute("get","/api/client")}async getClient(e){return this.execute("get",`/api/client/${e}`)}async createClient(e){return this.execute("post","/api/client",e)}async queryClient(e,t){return this.execute("post","/api/client/query",{searchQuery:e,cursor:t},{withNext:true})}async updateClient(e){return this.execute("put","/api/client",e)}async deleteClient(e){return this.execute("delete","/api/client",{id:e})}async getClientMetrics(e,t,a){return this.execute("get",`/api/client/metrics/${t}/${a}/${e}`)}async joinClient(e){return this.execute("get",`/api/client/join/${e}`)}async leaveClient(e){return this.execute("get",`/api/client/leave/${e}`)}async myClient(){return this.execute("get","/api/client/my")}async saveMyClient(e){return this.execute("put","/api/client/my",e)}async getPublicCategories(e){return this.execute("get",`/api/client/publiccategories/${e}`)}async getCategories(){return this.execute("get","/api/client/categories")}async getCategoriesInClient(e){return this.execute("get",`/api/client/categories/${e}`)}async updateCategoriesInClient(e,t){return this.execute("post",`/api/client/categories/${e}`,t)}async getLicenses(){return this.execute("get","/api/license")}async getLicensesInClient(e){return this.execute("get",`/api/license/inclient/${e}`)}async getLicense(e){return this.execute("get",`/api/license/${e}`)}async createLicense(e){return this.execute("post","/api/license",e)}async updateLicense(e){return this.execute("put","/api/license",e)}async deleteLicense(e,t){return this.execute("delete","/api/license",{_id:e,client:t})}async getPublicLicenses(e){return this.execute("get",`/api/license/publiclist/${e}`)}async getPublicLicense(e){return this.execute("get",`/api/license/public/${e}`)}async getDatatypesList(){return this.execute("get","/api/datatype")}async getPublicDatatypesList(e){return this.execute("get",`/api/datatype/public/${e}`)}async getDatatypesListOnClient(){return this.execute("get","/api/datatype/onclient")}async getDatatypesListOnClientForAll(){return this.execute("get","/api/datatype/onclientforall")}async getAllDatatypesList(){return this.execute("get","/api/datatype/all")}async getDatatype(e){return this.execute("get",`/api/datatype/${e}`)}async createDatatype(e){return this.execute("post","/api/datatype",e)}async updateDatatype(e){return this.execute("put","/api/datatype",e)}async deleteDatatype(e){return this.execute("delete","/api/datatype",{id:e})}async getMyNotifications(e){return this.execute("get","/api/notification"+(e?`?maxCount=${e}`:""))}async markNotificationAsRead(e){return this.execute("get",`/api/notification/markasread/${e}`)}async markAllNotificationsAsRead(){return this.execute("get","/api/notification/markallasread")}async createJob(e){return this.execute("post","/api/job",e,{emitOnSuccess:"job:created"})}async getManualJobTypes(){return this.execute("get","/api/job/manualtypes")}async getManualJobTypesOnClient(){return this.execute("get","/api/job/manualtypes/onclient")}async getManualJobTypesOnClientForAll(){return this.execute("get","/api/job/manualtypes/onclientforall")}async getAllManualJobTypes(){return this.execute("get","/api/job/manualtypes/all")}async getAllManualJobTypesForClient(e){return this.execute("get",`/api/job/manualtypes/all/${e}`)}async getClientJobTypes(){return this.execute("get","/api/job/clientTypes")}async getMyJobs(){return this.execute("get","/api/job/mine")}async getJobs(){return this.execute("get","/api/job")}async getJobsAggregated(){return this.execute("get","/api/job/aggregated")}async getJobsTimeframe(e,t){return this.execute("get",`/api/job/all/${e}/${t}`)}async getJob(e){return this.execute("get",`/api/job/${e}`)}async getJobState(e){return this.execute("get",`/api/job/state/${e}`)}async getAgents(){return this.execute("get","/api/jobagent")}async getAgentsAggregated(){return this.execute("get","/api/jobagent/aggregated")}async enableJobAgent(e){return this.execute("get",`/api/jobagent/enable/${e}`)}async disableJobAgent(e){return this.execute("get",`/api/jobagent/disable/${e}`)}async restartJobAgent(e){return this.execute("get",`/api/jobagent/restart/${e}`)}async getPermissionsList(){return this.execute("get","/api/permission")}async getPlugins(){return this.execute("get","/api/plugin")}async getPlans(){return this.execute("get","/api/plan")}async getPlan(e){return this.execute("get",`/api/plan/${e}`)}async createPlan(e){return this.execute("post","/api/plan",e)}async updatePlan(e){return this.execute("put","/api/plan",e)}async deletePlan(e){return this.execute("delete","/api/plan",{id:e})}async getWorkflows(){return this.execute("get","/api/workflow")}async getWorkflow(e){return this.execute("get",`/api/workflow/${e}`)}async createWorkflow(e){return this.execute("post","/api/workflow",e)}async updateWorkflow(e){return this.execute("put","/api/workflow",e)}async deleteWorkflow(e){return this.execute("delete","/api/workflow",{id:e})}async startWorkflow(e){return this.execute("post","/api/workflow/start",e)}async getAccessTokens(){return this.execute("get","/api/accesstoken")}async getClientAccessTokens(){return this.execute("get","/api/accesstoken/client")}async createAccessToken(e){return this.execute("post","/api/accesstoken",e)}async createClientAccessToken(e){return this.execute("post","/api/accesstoken/client",e)}async deleteAccessToken(e){return this.execute("delete","/api/accesstoken",{id:e})}async deleteClientAccessToken(e){return this.execute("delete","/api/accesstoken/client",{id:e})}async enableAccessToken(e){return this.execute("get",`/api/accesstoken/enable/${e}`)}async disableAccessToken(e){return this.execute("get",`/api/accesstoken/disable/${e}`)}async getApiTokens(){return this.execute("get","/api/apitoken")}async createApiToken(e){return this.execute("post","/api/apitoken",e)}async deleteApiToken(e){return this.execute("delete","/api/apitoken",{id:e})}async getMyClientInvoices(){return this.execute("get","/api/invoice")}async getMyUserInvoices(){return this.execute("get","/api/invoice/my")}async getClientInvoices(e){return this.execute("get",`/api/invoice/client/${e}`)}async downloadInvoice(e,t){const a=await this.execute("get",`/api/invoice/download/${e}`,null,{responseType:"arraybuffer"}),i=window.URL.createObjectURL(a.blob),n=document.createElement("a");n.href=i,n.setAttribute("download",t||"invoice.pdf"),document.body.appendChild(n),n.click();}async regenerateInvoice(e){return this.execute("get",`/api/invoice/regenerate/${e}`)}async getInvoicesForMonth(e,t){return this.execute("get",`/api/invoice/month/${t}/${e}`)}async refundInvoice(e,t,a){return this.execute("post","/api/invoice/refund",{invoice:e,amount:t,reason:a})}async paymentStartCheckout(e,t){return this.execute("post","/api/payment/checkout",{successUrl:e,cancelUrl:t})}async paymentStartUserCheckout(e,t){return this.execute("post","/api/payment/usercheckout",{successUrl:e,cancelUrl:t})}async getSupportedCurrencies(){return this.execute("get","/api/payment/supportedCurrencies")}async getPurchasables(){return this.execute("get","/api/purchasable")}async getPurchasable(e){return this.execute("get",`/api/purchasable/${e}`)}async createPurchasable(e){return this.execute("post","/api/purchasable",e)}async updatePurchasable(e){return this.execute("put","/api/purchasable",e)}async deletePurchasable(e){return this.execute("delete","/api/purchasable",{id:e})}async getPublicPurchasables(e){return this.execute("get",`/api/purchasable/public/${e}`)}async getPurchases(){return this.execute("get","/api/purchase")}async getMyActivePurchases(){return this.execute("get","/api/purchase/active")}async purchase(e){return this.execute("post","/api/purchase",e)}async changePurchaseProduct(e,t,a){return this.execute("post","/api/purchase/change",{purchaseID:e,purchasableID:t,optionID:a})}async cancelPurchase(e){return this.execute("delete","/api/purchase",{id:e})}async uncancelPurchase(e){return this.execute("post","/api/purchase/uncancel",{id:e})}async getSecureSessionPayload(e,t){return this.execute("get","/api/payment/secureSessionPayload?purchasableID="+e+"&optionID="+t)}async queryPurchases(e,t,a,i,n,r){return this.execute("post","/api/purchase/query",{startDate:e,endDate:t,email:a,invoice:i,cursor:n,limit:r})}async getAttributeTemplates(){return this.execute("get","/api/attributetemplate")}async getAttributeTemplate(e){return this.execute("get",`/api/attributetemplate/${e}`)}async createAttributeTemplate(e){return this.execute("post","/api/attributetemplate",e)}async updateAttributeTemplate(e){return this.execute("put","/api/attributetemplate",e)}async deleteAttributeTemplate(e){return this.execute("delete","/api/attributetemplate",{id:e})}async getStorages(){return this.execute("get","/api/storage")}async getConversation(e){return this.execute("get",`/api/conversation/${e}`)}async getPublicConversation(e){return this.execute("get",`/api/conversation/public/${e}`)}async createConversation(e,t){return this.execute("post","/api/conversation",{parentId:e,parentType:t})}async postConversationMessage(e,t,a){return this.execute("post","/api/conversation/post",{id:e,text:t,replyTo:a})}async editConversationMessage(e,t){return this.execute("put","/api/conversation/post",{id:e,text:t})}async deleteConversationMessage(e){return this.execute("delete","/api/conversation/post",{id:e})}async subscribeToConversation(e){return this.execute("post","/api/conversation/subscribe",{id:e})}async unsubscribeFromConversation(e){return this.execute("post","/api/conversation/unsubscribe",{id:e})}async likeConversationEntry(e){return this.execute("post","/api/conversation/like",{id:e})}async unlikeConversationEntry(e){return this.execute("post","/api/conversation/unlike",{id:e})}async command(e){return this.execute("post","/api/command",e)}async getMailTemplates(){return this.execute("get","/api/mailtemplate")}async getMailTemplate(e){return this.execute("get",`/api/mailtemplate/${e}`)}async createMailTemplate(e){return this.execute("post","/api/mailtemplate",e)}async updateMailTemplate(e){return this.execute("put","/api/mailtemplate",e)}async deleteMailTemplate(e){return this.execute("delete","/api/mailtemplate",{id:e})}async addMailTemplateImage(e,t,a){const i=this._createFormData(a,"image.jpg");return this.execute("post",`/api/mailtemplate/image/${e}/${t}`,i)}async deleteMailTemplateImage(e,t){return this.execute("delete",`/api/mailtemplate/image/${e}/${t}`)}async getMailTemplateNames(){return this.execute("get","/api/mailtemplate/names")}async getMailQuery(e,t,a,i){return this.execute("post","/api/email/query",{templateName:e,dateStart:t,dateEnd:a,success:i},{withNext:true})}async getMail(e){return this.execute("get","/api/email/get?token="+e)}async getInvoiceTemplates(){return this.execute("get","/api/invoicetemplate")}async getInvoiceTemplate(e){return this.execute("get",`/api/invoicetemplate/${e}`)}async createInvoiceTemplate(e){return this.execute("post","/api/invoicetemplate",e)}async updateInvoiceTemplate(e){return this.execute("put","/api/invoicetemplate",e)}async deleteInvoiceTemplate(e){return this.execute("delete","/api/invoicetemplate",{id:e})}async addInvoiceTemplateImage(e,t,a){const i=this._createFormData(a,"image.jpg");return this.execute("post",`/api/invoicetemplate/image/${e}/${t}`,i)}async deleteInvoiceTemplateImage(e,t){return this.execute("delete",`/api/invoicetemplate/image/${e}/${t}`)}async getItemTemplatesList(){return this.execute("get","/api/itemtemplate/list")}async getItemTemplates(){return this.execute("get","/api/itemtemplate")}async createItemTemplate(e){return this.execute("post","/api/itemtemplate",e)}async updateItemTemplate(e){return this.execute("put","/api/itemtemplate",e)}async deleteItemTemplate(e){return this.execute("delete","/api/itemtemplate",{id:e})}async getFeatures(){return this.execute("get","/api/feature")}async getFeaturesOnClient(){return this.execute("get","/api/feature/onclient")}async getFeaturesOnClientForAll(){return this.execute("get","/api/feature/onclientforall")}async getAllFeatures(){return this.execute("get","/api/feature/all")}async getBlogs(){return this.execute("get","/api/blog")}async getBlog(e){return this.execute("get","/api/blog/"+e)}async getPublicBlog(e){return this.execute("get","/api/blog/"+e+"/public")}async createBlog(e,t,a,i){return this.execute("post","/api/blog",{name:e,public:t,commentsEnabled:a,editors:i})}async saveBlog(e,t,a,i,n){return this.execute("put","/api/blog",{_id:e,name:t,public:a,commentsEnabled:i,editors:n})}async deleteBlog(e){return this.execute("delete","/api/blog",{_id:e})}async getBlogOverview(e){return this.execute("get","/api/blog/"+e+"/overview")}async queryBlog(e,t,a,i,n,r,s){return this.execute("post","/api/blog/"+e+"/query",{tag:t,text:a,limit:i,previousArticle:n,searchTag:r,sortBy:s})}async getArticles(e){return this.execute("get","/api/blog/"+e+"/article")}async getArticle(e,t){return this.execute("get","/api/blog/"+e+"/article/"+t)}async getArticleBySlug(e,t){return this.execute("get","/api/blog/article/"+e+"/"+t)}async createArticle(e,t,a){return this.execute("post","/api/blog/"+e+"/article",{title:t,slug:a})}async saveArticle(e,t,a,i,n,r,s,o){return this.execute("put","/api/blog/"+e+"/article",{_id:t,title:a,slug:i,content:o,tags:r,public:n,author:s})}async deleteArticle(e,t){return this.execute("delete","/api/blog/"+e+"/article",{_id:t})}async getNewsletters(){return this.execute("get","/api/newsletter")}async createNewsletter(e,t){return this.execute("post","/api/newsletter",{name:e,editors:t})}async getNewsletter(e){return this.execute("get","/api/newsletter/"+e)}async updateNewsletter(e,t,a,i){return this.execute("put","/api/newsletter/"+e,{name:t,sender:a,editors:i})}async deleteNewsletter(e){return this.execute("delete","/api/newsletter/"+e)}async joinNewsletter(e,t){return this.execute("post","/api/newsletter/join",{id:e,email:t})}async confirmNewsletter(e){return this.execute("post","/api/newsletter/confirm",{token:e})}async unsubscribeFromNewsletter(e){return this.execute("post","/api/newsletter/unsubscribe",{token:e})}async getNewsletterBlocks(){return this.execute("get","/api/newsletterblock")}async getNewsletterBlock(e){return this.execute("get","/api/newsletterblock/"+e)}async createNewsletterBlock(e){return this.execute("post","/api/newsletterblock",{name:e})}async updateNewsletterBlock(e,t,a,i,n,r){return this.execute("put","/api/newsletterblock/"+e,{name:t,inputs:a,html:i,css:n,acceptsChildren:r})}async deleteNewsletterBlock(e){return this.execute("delete","/api/newsletterblock/"+e)}async getNewsletterMails(e){return this.execute("get","/api/newslettermail/"+e)}async getNewsletterMail(e,t){return this.execute("get","/api/newslettermail/"+e+"/"+t)}async createNewsletterMail(e,t){return this.execute("post","/api/newslettermail/"+e,{title:t})}async updateNewsletterMail(e,t,a,i,n){return this.execute("put","/api/newslettermail/"+e+"/"+t,{title:a,blocks:i,parentBlock:n})}async generatePreviewNewsletterMail(e,t){return this.execute("post","/api/newslettermail/render",{blocks:e,parentBlock:t})}async sendTestNewsletter(e,t,a){return this.execute("post","/api/newslettermail/"+e+"/"+t+"/sendTest",{email:a})}async sendOutNewsletter(e,t){return this.execute("post","/api/newslettermail/"+e+"/"+t+"/send",{})}async getPages(){return this.execute("get","/api/page")}async createPage(e,t){return this.execute("post","/api/page",{title:e,slug:t})}async getPage(e){return this.execute("get","/api/page/"+e)}async updatePage(e,t,a,i,n){return this.execute("put","/api/page",{_id:e,title:t,slug:a,public:i,content:n})}async deletePage(e){return this.execute("delete","/api/page",{_id:e})}async getPublicPage(e,t){return this.execute("get","/api/page/public/"+e+"/"+t)}async setItemFlag(e,t,a,i,n,r){return this.execute("post","/api/itemflag",{item:e,isStaffPick:t,featureWeight:a,isGame:i,replaceIndex:n,internalRating:r})}getDownloadUrl(e){return `${this.getApiBaseUrl()}/api/item/download/${e}`}getAttachmentDownloadUrl(e,t,a,i){return `${this.getApiBaseUrl()}${this._getAttachmentUrlPath(e,t,a,i)}`}getPublicAttachmentDownloadUrl(e,t,a,i){return `${this.getApiBaseUrl()}${this._getAttachmentUrlPath(e,t,a,i,true)}`}getPublicDownloadUrl(e){return `${this.getApiBaseUrl()}/api/item/publicdownload/${e}`}async postFeedback(e){return this.execute("post","/api/feedback",{text:e})}}class qd{linkableItemsCache;apiGateway;itemCache;usePublicApi;constructor(e,t,a=false){this.linkableItemsCache=new Map,this.apiGateway=e,this.itemCache=t,this.usePublicApi=a;}clear(){this.linkableItemsCache.clear();}resolveItem(e,t){for(const a of t)if(a._id===e)return a;return null}async loadLinkableItems(e,t){if(!e)throw "loadLinkableItems(): Item cannot be null!";let a=[];if(t.linkableTypes&&t.linkableTypes.length){if(!this.usePublicApi){const i=t.linkableTypes.join("#")+(e.folder?e.folder._id:"");if(this.linkableItemsCache.has(i))return this.linkableItemsCache.get(i);const n=[...t.linkableTypes];n.includes("Package")||n.push("Package");const r={types:n,folder:e.folder?e.folder._id:null};a=(await this.apiGateway.call("LinkableItemsCache::loadLinkableItems","queryItemsList",r)).filter((e=>"Package"!==e.type||t.linkableTypes.includes(e.packageType)));for(const i of e.links)if(null==this.resolveItem(i.to,a))try{const e=await this.itemCache.getItem(i.to);t.linkableTypes.includes(e.type)&&a.push(e);}catch(e){console.error(`Link item ${i.to} not found. Dead link? (${e})`);}this.linkableItemsCache.set(i,a);}}else {for(const t of e.links){const e=await this.itemCache.getItem(t.to);a.push(e);}const i=t.name+"#CurrentLinks";this.linkableItemsCache.set(i,a);}return a}}
4620
4620
 
4621
4621
  /**
4622
4622
  * @license
@@ -133473,10 +133473,10 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
133473
133473
  const field = this.findItemFieldByName(name, item.item);
133474
133474
  if (field) {
133475
133475
  const itemRepo = item.engine.itemRepo;
133476
- newField = new ee(name, field.displayName, field.type, defaultValue, item.item, itemRepo);
133476
+ newField = new ne(name, field.displayName, field.type, defaultValue, item.item, itemRepo);
133477
133477
  }
133478
133478
  else {
133479
- newField = new ee(name, undefined, "Attribute", defaultValue);
133479
+ newField = new ne(name, undefined, "Attribute", defaultValue);
133480
133480
  }
133481
133481
  item.fieldInstances.push(newField);
133482
133482
  return newField;
@@ -134370,7 +134370,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
134370
134370
  }
134371
134371
  }
134372
134372
 
134373
- var engine$1 = "26.6.1";
134373
+ var engine$1 = "26.6.3";
134374
134374
  var bullet = "3.26";
134375
134375
  var lua = "5.4.3";
134376
134376
  var packageVersionInfo = {
@@ -208493,9 +208493,9 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
208493
208493
  constructor(block, parent, scene, engine, position, sceneGraph) {
208494
208494
  super(engine);
208495
208495
  tools.assert(sceneGraph, 'Scenegraph to add to needs to be specified');
208496
- tools.assert(!block || block instanceof le, "block must be of type Block!");
208496
+ tools.assert(!block || block instanceof pe, "block must be of type Block!");
208497
208497
  tools.assert(!block || Array.isArray(block.fields), `Field instances for block is not an array! ${block}`);
208498
- this.block = block || new le();
208498
+ this.block = block || new pe();
208499
208499
  this.state = SgItemState.Constructed;
208500
208500
  this.fieldMap = new Map(); // quick lookup of fields by name
208501
208501
  this.parent = parent;
@@ -209077,7 +209077,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
209077
209077
  if (type === "Script") {
209078
209078
  const item = await this.itemRepo.loadItem(droppedItem.id, { recursive: true });
209079
209079
  if (item) {
209080
- const script = new Z(undefined, targetBlock, this.sceneGraph.getOwnerItem(), item);
209080
+ const script = new Q$1(undefined, targetBlock, this.sceneGraph.getOwnerItem(), item);
209081
209081
  targetBlock.scripts.splice(targetBlock.scripts.length, 0, script);
209082
209082
  return true;
209083
209083
  }
@@ -226646,7 +226646,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
226646
226646
  return null;
226647
226647
  }
226648
226648
  async createBlock(type, fields, parent) {
226649
- let template = se.instance.getTemplate("Scene", "Scenegraph", type);
226649
+ let template = ce.instance.getTemplate("Scene", "Scenegraph", type);
226650
226650
  if (!template) {
226651
226651
  console.error(`Unknown type ${type}. Cannot create!`);
226652
226652
  return null;
@@ -226756,7 +226756,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
226756
226756
  */
226757
226757
  setFieldsOnSgItem(sgItem) {
226758
226758
  const type = sgItem.getType();
226759
- const sceneDatatype = E$1("Scene", true);
226759
+ const sceneDatatype = F("Scene", true);
226760
226760
  const scenegraphFields = sceneDatatype.fields.find(field => field.name === "Scenegraph");
226761
226761
  const fieldSets = sceneDatatype.fieldSets;
226762
226762
  const childType = scenegraphFields.childTypes.find(childType => childType.typeName === type);
@@ -226769,10 +226769,10 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
226769
226769
  }
226770
226770
  }
226771
226771
  else if (field.type === "Link") {
226772
- sgItem.block.fields.push(new ee(field.usageAs, undefined, "Link", null));
226772
+ sgItem.block.fields.push(new ne(field.usageAs, undefined, "Link", null));
226773
226773
  }
226774
226774
  else if (field.type === "Attribute") {
226775
- sgItem.block.fields.push(new ee(field.name, undefined, "Attribute", field.defaultValue));
226775
+ sgItem.block.fields.push(new ne(field.name, undefined, "Attribute", field.defaultValue));
226776
226776
  }
226777
226777
  }
226778
226778
  for (const field of fields) {
@@ -232049,12 +232049,35 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
232049
232049
  if (block.fields && block.fields.length) {
232050
232050
  this._initFromFields(block.fields);
232051
232051
  }
232052
+ if (block.scripts && block.scripts.length) {
232053
+ this._initFromScripts(block.scripts);
232054
+ }
232052
232055
  if (block.blocks && block.blocks.length) {
232053
232056
  this._initFromBlocks(block.blocks);
232054
232057
  }
232055
232058
  }
232056
232059
  }
232057
232060
  }
232061
+ _initFromScripts(scripts) {
232062
+ for (const script of scripts) {
232063
+ if (!script.fields)
232064
+ continue;
232065
+ for (const field of script.fields) {
232066
+ if (field.type === 'Link' && field.value) {
232067
+ const preparedItem = typeof field.value === 'string' ? { _id: field.value } : field.value;
232068
+ if (preparedItem._id)
232069
+ this._initFromItem(preparedItem);
232070
+ }
232071
+ else if (field.type === 'LinkArray' && Array.isArray(field.value)) {
232072
+ for (const linkValue of field.value) {
232073
+ const preparedItem = typeof linkValue === 'string' ? { _id: linkValue } : linkValue;
232074
+ if (preparedItem && preparedItem._id)
232075
+ this._initFromItem(preparedItem);
232076
+ }
232077
+ }
232078
+ }
232079
+ }
232080
+ }
232058
232081
  isItemLoaded(id) {
232059
232082
  return this.itemsMap.has(id);
232060
232083
  }
@@ -232872,6 +232895,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
232872
232895
  scriptItem = undefined;
232873
232896
  scriptId = undefined;
232874
232897
  injectedFieldsMap = {};
232898
+ referenceId = undefined;
232875
232899
  callDepth = 0;
232876
232900
  callMutex = new Mutex();
232877
232901
  enableMutex = new Mutex();
@@ -232928,14 +232952,25 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
232928
232952
  setNode(node) {
232929
232953
  this.injectedFieldsMap["node"] = { type: 'String', value: node };
232930
232954
  }
232955
+ setReferenceId(referenceId) {
232956
+ this.referenceId = referenceId;
232957
+ }
232958
+ getReferenceId() {
232959
+ return this.referenceId || this.scriptId || '';
232960
+ }
232931
232961
  setInjectedFields(fields) {
232932
232962
  for (const field of fields) {
232933
- if (!this.injectedFieldsMap[field.name]) {
232934
- this.injectedFieldsMap[field.name] = {
232935
- type: field.datatype,
232936
- value: field.value
232937
- };
232938
- }
232963
+ if (!field.name || field.type === 'Separator')
232964
+ continue;
232965
+ const entryType = field.type === 'Link' || field.type === 'LinkArray'
232966
+ ? field.type
232967
+ : field.datatype;
232968
+ if (field.name === 'node' && this.injectedFieldsMap['node'])
232969
+ continue;
232970
+ this.injectedFieldsMap[field.name] = {
232971
+ type: entryType,
232972
+ value: field.value
232973
+ };
232939
232974
  }
232940
232975
  }
232941
232976
  getInjectedFields() {
@@ -233462,6 +233497,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
233462
233497
  const name = script.getName();
233463
233498
  const item = script.getItem();
233464
233499
  const runner = new ScriptRunner(this.engine);
233500
+ runner.setReferenceId(instanceId);
233465
233501
  runner.setNode(node);
233466
233502
  runner.setInjectedFields(meta.fields);
233467
233503
  const scriptId = await runner.loadCode(script);
@@ -236151,11 +236187,11 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
236151
236187
 
236152
236188
  var lua_api_audio = "\nlocal _internal = require('engine/_internal');\n\n--- @module audio\nlocal audio = {}\n\n---Get an FFT analysis from the audio engine. It returns an array of 256 samples\n---@function getAnalysis\nfunction audio.getAnalysis()\n return _internal.sendMessage('audio.getAnalysis')\nend\n\nreturn audio\n";
236153
236189
 
236154
- var lua_api_behaviour = "local SceneObject = require('engine/sceneobject')\nlocal Canvas = require('engine/canvas')\nlocal JE = require('engine/json/jsonencoder')()\n\nlocal _behavioursMapByNodeId = {}\nlocal _behavioursMapByScriptId = {}\nlocal _behavioursMapByExecutionOrder = {}\nlocal _executionIndex = 1\n\nlocal Behaviour = Class.new()\n\n-- Put the class in the global scope (Behaviour is the old deprecated name)\n_G.Behaviour = Behaviour\n_G.Entity = Behaviour\n\n--- Constructor hook called when a new Behaviour is created.\n---@private\nfunction Behaviour:__new()\n self._isBehaviour = true\n self._type = \"Behaviour\"\n self._nodeId = nil\n self._scriptName = \"\"\n self._executionIndex = _executionIndex\n self._isActive = true\n self._isInitialized = false\n\n _executionIndex = _executionIndex + 1\n\n -- Adds a default node property\n self:addProperty(\"node\", Property.Node)\nend\n\n--- Destructor hook called before the Behaviour is destroyed.\n---@private\nfunction Behaviour:__destroy()\n print(\"__destroy called for: \", self._nodeId)\nend\n\n--- Get all behaviours attached to a specific node ID.\n---@param nodeId string The ID of the scene graph node\n---@return table A table containing all behaviours attached to the node\nfunction Behaviour.getByNodeId(nodeId)\n local result = {}\n local nodeBehaviours = _behavioursMapByNodeId[nodeId]\n if nodeBehaviours then\n for k,v in pairs(nodeBehaviours) do\n table.insert(result, v.behaviour)\n end\n end\n return result\nend\n\n--- Get a single behaviour attached to a node ID with a specific script name.\n---@param nodeId string The ID of the scene graph node\n---@param scriptName string The script name of the behaviour\n---@return Behaviour|nil The behaviour if found, or nil\nfunction Behaviour.getByNodeIdAndScriptName(nodeId, scriptName)\n local nodeEntities = _behavioursMapByNodeId[nodeId]\n if nodeEntities then\n for k,v in pairs(nodeEntities) do\n if v.scriptName == scriptName then\n return v.behaviour\n end\n end\n end\n return nil\nend\n\n--- Returns the node ID this Behaviour is attached to.\n---@return string|nil Node ID of the attached scene object\nfunction Behaviour:getNodeId()\n return self._nodeId\nend\n\n--- Returns the script name of this Behaviour.\n---@return string Script name\nfunction Behaviour:getScriptName()\n return self._scriptName\nend\n\n--- Returns a table of all properties defined on the behaviour class.\n---@return table A table with fields: name, defaultValue, type, order\nfunction Behaviour:getProperties()\n local props = {}\n local class = self.getClass()\n\n for k,v in pairs(class) do\n if type(v) == 'table' and v._isProperty then\n table.insert(props, { name=k, defaultValue=v.value, type=v.datatype, order=v.order, info=v.info })\n end\n end\n\n for k,v in pairs(class.properties) do\n if type(v) == 'table' and v._isProperty then\n table.insert(props, { name=k, defaultValue=v.value, type=v.datatype, order=v.order, info=v.info })\n end\n end\n\n return props\nend\n\n--- When a script is destroyed, we need to call this to clear the behaviour out of the list\n---@private\nfunction Behaviour:_disposeBehaviour()\n local scripts = _behavioursMapByNodeId[self._nodeId]\n if scripts then\n scripts[self._scriptId] = nil\n end\n\n _behavioursMapByScriptId[self._scriptId] = nil\n _behavioursMapByExecutionOrder[self._executionIndex] = nil\nend\n\n--- Internal setter for a property\n---@private\n---@param name string Property name\n---@param value any Value to set\nfunction Behaviour:_setProperty(name, value)\n self[name] = value\nend\n\n--- Internal method to attach a scene node to this Behaviour\n---@private\n---@param msg table Contains fields: value=nodeId, scriptName, scriptId\nfunction Behaviour:_setNode(msg)\n __assertTrace(type(msg) == 'table', \"_setNode() called with nil or a non-table.\")\n\n if self.node then\n error(\"Node is already set on behaviour!\")\n end\n\n local nodeId = msg.value\n __assertTrace(type(nodeId) == 'string', \"_setNode() needs a nodeId of type string.\")\n\n local node = SceneObject.findById(nodeId)\n __assertTrace(node, \"_setNode() node not found\")\n\n local scriptName = msg.scriptName\n __assertTrace(scriptName, \"_setNode() needs a scriptName\")\n\n local scriptId = msg.scriptId\n __assertTrace(scriptId, \"_setNode() needs a scriptId\")\n\n self.node = node\n self._nodeId = nodeId\n self._scriptName = msg.scriptName\n self._scriptId = scriptId\n\n _behavioursMapByScriptId[scriptId] = self\n _behavioursMapByExecutionOrder[self._executionIndex] = self\n\n if not _behavioursMapByNodeId[nodeId] then\n _behavioursMapByNodeId[nodeId] = {}\n end\n _behavioursMapByNodeId[nodeId][scriptId] = {\n node = node,\n scriptName = scriptName,\n behaviour = self\n }\nend\n\n--- Return the properties of this Behaviour as JSON\n---@private\n---@return string JSON string of properties\nfunction Behaviour:_getPropsJson()\n return JE(self:getProperties())\nend\n\n--- Returns the active state of the behaviour. If the owner item is inactive, so are all attached behaviours\n---@return boolean true, if active, othersise false\nfunction Behaviour:isActive()\n return self._isActive\nend\n\n--- Returns the initialized state of the behaviour. If true, init ran through or there is no init\n---@return boolean true, if initialized, othersise false\nfunction Behaviour:isInitialized()\n return self._isInitialized\nend\n\n--- Clears all registered behaviours (used internally). They are expected to be empty anyway due to scripts\n--- cleaning up behind themselves. This function will assert this\n---@private\nfunction Behaviour._clearBehaviours()\n -- Clear in-place to avoid any stale references to the _behaviours table object\n -- preventing Lua GC from reclaiming behaviour instances.\n for nodeId, nodeBehaviours in pairs(_behavioursMapByNodeId) do\n -- nodeBehaviours is a keyed table (scriptId -> { ... })\n if nodeBehaviours and next(nodeBehaviours) ~= nil then\n -- This warning is useful when scripts forget to dispose their behaviours,\n -- but the check previously used `#nodeBehaviours` which is incorrect for keyed tables.\n print(\"WARNING: Some behaviours did not get cleaned properly. This is an engine bug!\")\n -- Keep clearing anyway to enable GC.\n end\n\n if nodeBehaviours then\n for scriptId in pairs(nodeBehaviours) do\n nodeBehaviours[scriptId] = nil\n end\n end\n\n _behavioursMapByNodeId[nodeId] = nil\n end\n\n -- Also clear the second map that has the behaviours by their script ID directly and the execution order map\n _behavioursMapByScriptId = {}\n _behavioursMapByExecutionOrder = {}\n _executionIndex = 1\nend\n\nfunction Behaviour:_init()\n if type(self.init) == 'function' then\n local ok, err = pcall(self.init, self)\n if not ok then\n print(self._scriptName .. \":init() failed:\", err)\n end\n end\n self._isInitialized = true\n self._isActive = true\nend\n\nfunction Behaviour:_ondisable()\n self._isActive = false\n if type(self.ondisable) == 'function' then\n local ok, err = pcall(self.ondisable, self)\n if not ok then\n print(self._scriptName .. \":ondisable() failed:\", err)\n end\n end\nend\n\nfunction Behaviour:_onenable()\n self._isActive = true\n if type(self.onenable) == 'function' then\n local ok, err = pcall(self.onenable, self)\n if not ok then\n print(self._scriptName .. \":onenable() failed:\", err)\n end\n end\nend\n\nfunction Behaviour:_ondestroy()\n if type(self.ondestroy) == 'function' then\n local ok, err = pcall(self.ondestroy, self)\n if not ok then\n print(self._scriptName .. \":ondestroy() failed:\", err)\n end\n end\n self._isActive = false\n self._isInitialized = false\nend\n\nfunction Behaviour._callHookOnAll(hookName, deltaTime, deltaTimeSmooth)\n local callcount = 0\n\n for _, behaviour in pairs(_behavioursMapByExecutionOrder) do\n local hookFunc = behaviour[hookName]\n if behaviour._isActive and behaviour._isInitialized and type(hookFunc) == 'function' then\n callcount = callcount + 1\n local ok, err = pcall(hookFunc, behaviour, deltaTime, deltaTimeSmooth)\n if not ok then\n print(behaviour._scriptName .. \":\" .. hookName .. \"() failed:\", err)\n end\n end\n end\n\n return callcount\nend\n\nfunction Behaviour._updateAll(deltaTime, deltaTimeSmooth)\n local callcount = 0\n\n callcount = callcount + Behaviour._callHookOnAll(\"preUpdate\", deltaTime, deltaTimeSmooth)\n callcount = callcount + Behaviour._callHookOnAll(\"update\", deltaTime, deltaTimeSmooth)\n callcount = callcount + Behaviour._callHookOnAll(\"lateUpdate\", deltaTime, deltaTimeSmooth)\n\n return callcount\nend\n\nfunction Behaviour._renderAll()\n\n if Canvas.autoClear then\n Canvas.clear()\n end\n\n local callcount = 0\n\n callcount = Behaviour._callHookOnAll(\"prerender\")\n callcount = Behaviour._callHookOnAll(\"render\")\n\n Canvas.commit()\n\n return callcount\nend\n\nfunction Behaviour._renderguiAll()\n return Behaviour._callHookOnAll(\"rendergui\")\nend\n\nfunction Behaviour._setActive(nodes)\n for scriptId, active in pairs(nodes) do\n local behaviour = _behavioursMapByScriptId[scriptId]\n if behaviour then\n behaviour._isActive = active\n else\n print(\"ERROR: Behaviour._setActive() cannot find script: \" .. scriptId)\n end\n end\nend\n\nfunction Behaviour._debugStats()\n local nodeCount = 0\n local behaviourCount = 0\n for _, nodeBehaviours in pairs(_behavioursMapByNodeId) do\n nodeCount = nodeCount + 1\n if nodeBehaviours then\n for _ in pairs(nodeBehaviours) do\n behaviourCount = behaviourCount + 1\n end\n end\n end\n\n return {\n nodeCount = nodeCount,\n behaviourCount = behaviourCount\n }\nend\n\nreturn Behaviour\n";
236190
+ var lua_api_behaviour = "local SceneObject = require('engine/sceneobject')\nlocal Canvas = require('engine/canvas')\nlocal JE = require('engine/json/jsonencoder')()\n\nlocal _behavioursMapByNodeId = {}\nlocal _behavioursMapByScriptId = {}\nlocal _behavioursMapByExecutionOrder = {}\nlocal _executionIndex = 1\n\nlocal Behaviour = Class.new()\n\n-- Put the class in the global scope (Behaviour is the old deprecated name)\n_G.Behaviour = Behaviour\n_G.Entity = Behaviour\n\n--- Constructor hook called when a new Behaviour is created.\n---@private\nfunction Behaviour:__new()\n self._isBehaviour = true\n self._type = \"Behaviour\"\n self._nodeId = nil\n self._scriptName = \"\"\n self._executionIndex = _executionIndex\n self._isActive = true\n self._isInitialized = false\n\n _executionIndex = _executionIndex + 1\n\n -- Adds a default node property\n self:addProperty(\"node\", Property.Node)\nend\n\n--- Destructor hook called before the Behaviour is destroyed.\n---@private\nfunction Behaviour:__destroy()\n print(\"__destroy called for: \", self._nodeId)\nend\n\n--- Get all behaviours attached to a specific node ID.\n---@param nodeId string The ID of the scene graph node\n---@return table A table containing all behaviours attached to the node\nfunction Behaviour.getByNodeId(nodeId)\n local result = {}\n local nodeBehaviours = _behavioursMapByNodeId[nodeId]\n if nodeBehaviours then\n for k,v in pairs(nodeBehaviours) do\n table.insert(result, v.behaviour)\n end\n end\n return result\nend\n\n--- Get a single behaviour attached to a node ID with a specific script name.\n---@param nodeId string The ID of the scene graph node\n---@param scriptName string The script name of the behaviour\n---@return Behaviour|nil The behaviour if found, or nil\nfunction Behaviour.getByNodeIdAndScriptName(nodeId, scriptName)\n local nodeEntities = _behavioursMapByNodeId[nodeId]\n if nodeEntities then\n for k,v in pairs(nodeEntities) do\n if v.scriptName == scriptName then\n return v.behaviour\n end\n end\n end\n return nil\nend\n\n--- Returns the node ID this Behaviour is attached to.\n---@return string|nil Node ID of the attached scene object\nfunction Behaviour:getNodeId()\n return self._nodeId\nend\n\n--- Returns the script name of this Behaviour.\n---@return string Script name\nfunction Behaviour:getScriptName()\n return self._scriptName\nend\n\n--- Returns a table of all properties defined on the behaviour class.\n---@return table A table with fields: name, defaultValue, type, order\nfunction Behaviour:getProperties()\n local propsByName = {}\n local class = self.getClass()\n\n local function addPropertyEntry(name, prop)\n propsByName[name] = {\n name = name,\n defaultValue = prop.value,\n type = prop.datatype,\n order = prop.order,\n info = prop.info,\n minValue = prop.minValue,\n maxValue = prop.maxValue,\n conditions = prop.conditions,\n collapsed = prop.collapsed,\n allowedTypes = prop.allowedTypes,\n }\n end\n\n local SKIP_CLASS_KEYS = {\n metatable = true,\n properties = true,\n super = true,\n new = true,\n getClass = true,\n addProperty = true,\n }\n\n local function collectFromClass(cls)\n if not cls then\n return\n end\n\n collectFromClass(cls.super)\n\n for k, v in pairs(cls.properties) do\n if type(v) == 'table' and v._isProperty then\n addPropertyEntry(k, v)\n end\n end\n\n -- Legacy API: properties assigned directly on the class, e.g. TestEntity.testNode = Property.new(...)\n for k, v in pairs(cls) do\n if type(k) == 'string' and not SKIP_CLASS_KEYS[k] and type(v) == 'table' and v._isProperty and not propsByName[k] then\n addPropertyEntry(k, v)\n end\n end\n end\n\n collectFromClass(class)\n\n local props = {}\n for _, v in pairs(propsByName) do\n table.insert(props, v)\n end\n\n return props\nend\n\n--- When a script is destroyed, we need to call this to clear the behaviour out of the list\n---@private\nfunction Behaviour:_disposeBehaviour()\n local scripts = _behavioursMapByNodeId[self._nodeId]\n if scripts then\n scripts[self._scriptId] = nil\n end\n\n _behavioursMapByScriptId[self._scriptId] = nil\n _behavioursMapByExecutionOrder[self._executionIndex] = nil\nend\n\n--- Internal setter for a property\n---@private\n---@param name string Property name\n---@param value any Value to set\nfunction Behaviour:_setProperty(name, value)\n self[name] = value\nend\n\n--- Internal method to attach a scene node to this Behaviour\n---@private\n---@param msg table Contains fields: value=nodeId, scriptName, scriptId\nfunction Behaviour:_setNode(msg)\n __assertTrace(type(msg) == 'table', \"_setNode() called with nil or a non-table.\")\n\n if self.node then\n error(\"Node is already set on behaviour!\")\n end\n\n local nodeId = msg.value\n __assertTrace(type(nodeId) == 'string', \"_setNode() needs a nodeId of type string.\")\n\n local node = SceneObject.findById(nodeId)\n __assertTrace(node, \"_setNode() node not found\")\n\n local scriptName = msg.scriptName\n __assertTrace(scriptName, \"_setNode() needs a scriptName\")\n\n local scriptId = msg.scriptId\n __assertTrace(scriptId, \"_setNode() needs a scriptId\")\n\n self.node = node\n self._nodeId = nodeId\n self._scriptName = msg.scriptName\n self._scriptId = scriptId\n\n _behavioursMapByScriptId[scriptId] = self\n _behavioursMapByExecutionOrder[self._executionIndex] = self\n\n if not _behavioursMapByNodeId[nodeId] then\n _behavioursMapByNodeId[nodeId] = {}\n end\n _behavioursMapByNodeId[nodeId][scriptId] = {\n node = node,\n scriptName = scriptName,\n behaviour = self\n }\nend\n\n--- Return the properties of this Behaviour as JSON\n---@private\n---@return string JSON string of properties\nfunction Behaviour:_getPropsJson()\n return JE(self:getProperties())\nend\n\n--- Returns the active state of the behaviour. If the owner item is inactive, so are all attached behaviours\n---@return boolean true, if active, othersise false\nfunction Behaviour:isActive()\n return self._isActive\nend\n\n--- Returns the initialized state of the behaviour. If true, init ran through or there is no init\n---@return boolean true, if initialized, othersise false\nfunction Behaviour:isInitialized()\n return self._isInitialized\nend\n\n--- Clears all registered behaviours (used internally). They are expected to be empty anyway due to scripts\n--- cleaning up behind themselves. This function will assert this\n---@private\nfunction Behaviour._clearBehaviours()\n -- Clear in-place to avoid any stale references to the _behaviours table object\n -- preventing Lua GC from reclaiming behaviour instances.\n for nodeId, nodeBehaviours in pairs(_behavioursMapByNodeId) do\n -- nodeBehaviours is a keyed table (scriptId -> { ... })\n if nodeBehaviours and next(nodeBehaviours) ~= nil then\n -- This warning is useful when scripts forget to dispose their behaviours,\n -- but the check previously used `#nodeBehaviours` which is incorrect for keyed tables.\n print(\"WARNING: Some behaviours did not get cleaned properly. This is an engine bug!\")\n -- Keep clearing anyway to enable GC.\n end\n\n if nodeBehaviours then\n for scriptId in pairs(nodeBehaviours) do\n nodeBehaviours[scriptId] = nil\n end\n end\n\n _behavioursMapByNodeId[nodeId] = nil\n end\n\n -- Also clear the second map that has the behaviours by their script ID directly and the execution order map\n _behavioursMapByScriptId = {}\n _behavioursMapByExecutionOrder = {}\n _executionIndex = 1\nend\n\nfunction Behaviour:_init()\n if type(self.init) == 'function' then\n local ok, err = pcall(self.init, self)\n if not ok then\n print(self._scriptName .. \":init() failed:\", err)\n end\n end\n self._isInitialized = true\n self._isActive = true\nend\n\nfunction Behaviour:_ondisable()\n self._isActive = false\n if type(self.ondisable) == 'function' then\n local ok, err = pcall(self.ondisable, self)\n if not ok then\n print(self._scriptName .. \":ondisable() failed:\", err)\n end\n end\nend\n\nfunction Behaviour:_onenable()\n self._isActive = true\n if type(self.onenable) == 'function' then\n local ok, err = pcall(self.onenable, self)\n if not ok then\n print(self._scriptName .. \":onenable() failed:\", err)\n end\n end\nend\n\nfunction Behaviour:_ondestroy()\n if type(self.ondestroy) == 'function' then\n local ok, err = pcall(self.ondestroy, self)\n if not ok then\n print(self._scriptName .. \":ondestroy() failed:\", err)\n end\n end\n self._isActive = false\n self._isInitialized = false\nend\n\nfunction Behaviour._callHookOnAll(hookName, deltaTime, deltaTimeSmooth)\n local callcount = 0\n\n for _, behaviour in pairs(_behavioursMapByExecutionOrder) do\n local hookFunc = behaviour[hookName]\n if behaviour._isActive and behaviour._isInitialized and type(hookFunc) == 'function' then\n callcount = callcount + 1\n local ok, err = pcall(hookFunc, behaviour, deltaTime, deltaTimeSmooth)\n if not ok then\n print(behaviour._scriptName .. \":\" .. hookName .. \"() failed:\", err)\n end\n end\n end\n\n return callcount\nend\n\nfunction Behaviour._updateAll(deltaTime, deltaTimeSmooth)\n local callcount = 0\n\n callcount = callcount + Behaviour._callHookOnAll(\"preUpdate\", deltaTime, deltaTimeSmooth)\n callcount = callcount + Behaviour._callHookOnAll(\"update\", deltaTime, deltaTimeSmooth)\n callcount = callcount + Behaviour._callHookOnAll(\"lateUpdate\", deltaTime, deltaTimeSmooth)\n\n return callcount\nend\n\nfunction Behaviour._renderAll()\n\n if Canvas.autoClear then\n Canvas.clear()\n end\n\n local callcount = 0\n\n callcount = Behaviour._callHookOnAll(\"prerender\")\n callcount = Behaviour._callHookOnAll(\"render\")\n\n Canvas.commit()\n\n return callcount\nend\n\nfunction Behaviour._renderguiAll()\n return Behaviour._callHookOnAll(\"rendergui\")\nend\n\nfunction Behaviour._setActive(nodes)\n for scriptId, active in pairs(nodes) do\n local behaviour = _behavioursMapByScriptId[scriptId]\n if behaviour then\n behaviour._isActive = active\n else\n print(\"ERROR: Behaviour._setActive() cannot find script: \" .. scriptId)\n end\n end\nend\n\nfunction Behaviour._debugStats()\n local nodeCount = 0\n local behaviourCount = 0\n for _, nodeBehaviours in pairs(_behavioursMapByNodeId) do\n nodeCount = nodeCount + 1\n if nodeBehaviours then\n for _ in pairs(nodeBehaviours) do\n behaviourCount = behaviourCount + 1\n end\n end\n end\n\n return {\n nodeCount = nodeCount,\n behaviourCount = behaviourCount\n }\nend\n\nreturn Behaviour\n";
236155
236191
 
236156
236192
  var lua_api_canvas = "\nlocal _internal = require('engine/_internal');\n\n---@module canvas\nlocal canvas = {\n autoClear = false\n}\n\n-- Lua-side command buffer for canvas calls.\nlocal _cmds = {}\n\nlocal function _captureSendMessage(target, payload, buffers)\n table.insert(_cmds, {\n target = target,\n payload = payload,\n buffers = buffers\n })\n return nil\nend\n\nlocal function _runWithCapturedSend(fn, ...)\n local oldSendMessage = _internal.sendMessage\n _internal.sendMessage = _captureSendMessage\n\n local result = { pcall(fn, ...) }\n\n _internal.sendMessage = oldSendMessage\n\n if not result[1] then\n error(result[2])\n end\n\n return table.unpack(result, 2)\nend\n\nlocal function _commitIfNeeded()\n if #_cmds == 0 then\n return { committed = 0 }\n end\n\n local result = _internal.sendMessage('canvas.commit', { cmds = _cmds })\n _cmds = {}\n return result\nend\n\n---If set to true, the canvas will automatically clear once before the render hook is called\n---@param value boolean the flag value\nfunction canvas.setAutoClear(value)\n self.autoClear = value\nend\n\n---Returns the value of the auto clear flag\n---@return boolean the flag value\nfunction canvas.getAutoClear()\n return self.autoClear\nend\n\n---Commit all pending buffered canvas commands.\n---@return table|nil result Optional engine-side debug info.\nfunction canvas.commit()\n return _commitIfNeeded()\nend\n\n---Debug helper: returns count of pending buffered commands in Lua.\n---@return number\nfunction canvas.getPendingCommandCount()\n return #_cmds\nend\n\n---Debug helper: returns current pending buffered commands in Lua.\n---@return table\nfunction canvas.getPendingCommands()\n return _cmds\nend\n\n---Debug helper: returns most recently committed command list on engine side.\n---@return table\nfunction canvas.getLastCommittedCommands()\n _commitIfNeeded()\n return _internal.sendMessage('canvas.getLastCommittedCommands')\nend\n\n---Clear the canvas.\n---@function\nfunction canvas.clear()\n _internal.sendMessage('canvas.clear')\nend\n\n---Returns the width of the canvas in pixels.\n---@function\nfunction canvas.getWidth()\n return _internal.sendMessage('canvas.getWidth')\nend\n\n---Returns the height of the canvas in pixels.\n---@function\nfunction canvas.getHeight()\n return _internal.sendMessage('canvas.getHeight')\nend\n\n---Sets the width of lines in the canvas.\n---@param w number the width to set the lines to.\nfunction canvas.setLineWidth(w)\n _internal.sendMessage('canvas.setLineWidth', { w=w })\nend\n\n---Sets the type of endings applied to the ends of a line.\n---@param cap string the type of corner to create on a line. One of \"butt\", \"round\", \"square\".\nfunction canvas.setLineCap(cap)\n _internal.sendMessage('canvas.setLineCap', { cap=cap })\nend\n\n---Sets the type of corner created when two lines meet.\n---@param join string the type of connection to create between two lines. One of \"bevel\", \"round\", or \"miter\".\nfunction canvas.setLineJoin(join)\n _internal.sendMessage('canvas.setLineJoin', { join=join })\nend\n\n---Sets the maximum miter length. Miter length is the distance between the inner corner and the outer corner of the join.\n---@param limit number the maximum miter length. When the miter length exceeds this value, the corner is trimmed.\nfunction canvas.setMiterLimit(limit)\n _internal.sendMessage('canvas.setMiterLimit', { limit=limit })\nend\n\n---Sets the color of the stroke (outline) for shapes drawn on the canvas.\n---@param r number Red channel value (0–255)\n---@param g number Green channel value (0–255)\n---@param b number Blue channel value (0–255)\n---@param a number Alpha channel value (0–1)\nfunction canvas.setStrokeColor(r, g, b, a)\n _internal.sendMessage('canvas.setStrokeColor', { r=r, g=g, b=b, a=a })\nend\n\n---Sets the color that is used to fill in shapes and text when they are drawn on the canvas.\n---@param r number Red channel value (0–255)\n---@param g number Green channel value (0–255)\n---@param b number Blue channel value (0–255)\n---@param a number Alpha channel value (0–1)\nfunction canvas.setFillColor(r, g, b, a)\n _internal.sendMessage('canvas.setFillColor', { r=r, g=g, b=b, a=a })\nend\n\n---Sets the color to use for shadows.\n---@param r number Red channel value (0–255)\n---@param g number Green channel value (0–255)\n---@param b number Blue channel value (0–255)\n---@param a number Alpha channel value (0–1)\nfunction canvas.setShadowColor(r, g, b, a)\n _internal.sendMessage('canvas.setShadowColor', { r=r, g=g, b=b, a=a })\nend\n\n---Sets the blur level for shadows.\n---@param level number the level of blur to be applied to shadows (in pixels).\nfunction canvas.setShadowBlurLevel(level)\n _internal.sendMessage('canvas.setShadowBlurLevel', { level=level })\nend\n\n---Sets the blur level for shadows.\n---@param x number the vertical offset of the shadow in pixels.\n---@param y number the horizontal offset of the shadow in pixels.\nfunction canvas.setShadowOffset(x, y)\n _internal.sendMessage('canvas.setShadowOffset', { x=x, y=y })\nend\n\n---Begins a new path.\n---@function\nfunction canvas.beginPath()\n _internal.sendMessage('canvas.beginPath')\nend\n\n---Close the current path by connecting the last and first point in the path, creating a loop.\n---@function\nfunction canvas.closePath()\n _internal.sendMessage('canvas.closePath')\nend\n\n---Determines if the specified point is in the current path.\n---@param x number x-coordinate of the point to check.\n---@param y number y-coordinate of the point to check.\n---@return boolean indicating if the point is in the path or not.\nfunction canvas.isPointInPath(x, y)\n return _internal.sendMessage('canvas.isPointInPath', { x=x, y=y })\nend\n\n---Sets the clipping path to the current drawing path.\n---@function\nfunction canvas.clip()\n _internal.sendMessage('canvas.clip')\nend\n\n---Draws the outline of a shape or path using the current stroke style, line width and styles.\n---@function\nfunction canvas.stroke()\n _internal.sendMessage('canvas.stroke')\nend\n\n---Fills a shape or path with the current fill style.\n---@function\nfunction canvas.fill()\n _internal.sendMessage('canvas.fill')\nend\n\n---Moves the current drawing position to the specified coordinates.\n---@param x number x-coordinate of the new current drawing position.\n---@param y number y-coordinate of the new current drawing position.\nfunction canvas.moveTo(x, y)\n _internal.sendMessage('canvas.moveTo', { x=x, y=y })\nend\n\n---Draws a straight line from the current position to the specified coordinates.\n---@param x number the x-coordinate to draw the line to.\n---@param y number the y-coordinate to draw the line to.\nfunction canvas.lineTo(x, y)\n _internal.sendMessage('canvas.lineTo', { x=x, y=y })\nend\n\n---Sets the type of compositing operation to apply when drawing new shapes.\n---@param operation string the compositing operation to use, possible values are:\n---\"source-over\", \"source-in\", \"source-out\", \"source-atop\", \"destination-over\",\n---\"destination-in\", \"destination-out\", \"destination-atop\", \"lighter\", \"copy\", \"xor\".\nfunction canvas.setCompositeOperation(operation)\n _internal.sendMessage('canvas.setCompositeOperation', { operation=operation })\nend\n\n---Sets the transparency value that is applied to all rendering operations.\n---@param value number a value between 0.0 (fully transparent) and 1.0 (fully opaque).\nfunction canvas.setGlobalAlpha(value)\n _internal.sendMessage('canvas.setGlobalAlpha', { value=value })\nend\n\n---Creates a rectangle path which is only drawn after calling stroke() or fill().\n---@param x number x-coordinate of the rectangle upper-left corner.\n---@param y number y-coordinate of the rectangle upper-left corner.\n---@param w number width of the rectangle.\n---@param h number height of the rectangle.\nfunction canvas.pathRect(x, y, w, h)\n _internal.sendMessage('canvas.pathRect', { x=x, y=y, w=w, h=h })\nend\n\n---Adds a rounded rectangle to the current path. Must be followed by stroke() or fill().\n---@param x number x-coordinate of the rectangle upper-left corner.\n---@param y number y-coordinate of the rectangle upper-left corner.\n---@param w number width of the rectangle.\n---@param h number height of the rectangle.\n---@param radius number|table corner radius applied to all four corners (uniform), or a table\n---of 1–4 values to set individual corner radius in the order [top-left, top-right,\n---bottom-right, bottom-left], following the HTML Canvas API specification.\nfunction canvas.roundRect(x, y, w, h, radius)\n _internal.sendMessage('canvas.roundRect', { x=x, y=y, w=w, h=h, radius=radius })\nend\n\n---Draw a rectangle outline using the current stroke style.\n---@param x number x-coordinate of the rectangle upper-left corner.\n---@param y number y-coordinate of the rectangle upper-left corner.\n---@param w number width of the rectangle.\n---@param h number height of the rectangle.\nfunction canvas.strokeRect(x, y, w, h)\n _internal.sendMessage('canvas.strokeRect', { x=x, y=y, w=w, h=h })\nend\n\n---Draw a rectangle with a filled interior using the current fill style,\n---@param x number x-coordinate of the rectangle upper-left corner.\n---@param y number y-coordinate of the rectangle upper-left corner.\n---@param w number width of the rectangle.\n---@param h number height of the rectangle.\nfunction canvas.fillRect(x, y, w, h)\n _internal.sendMessage('canvas.fillRect', { x=x, y=y, w=w, h=h })\nend\n\n---Clears the specified rectangle by setting its pixels to transparent.\n---@param x number x-coordinate of the rectangle upper-left corner.\n---@param y number y-coordinate of the rectangle upper-left corner.\n---@param w number width of the rectangle.\n---@param h number height of the rectangle.\nfunction canvas.clearRect(x, y, w, h)\n _internal.sendMessage('canvas.clearRect', { x=x, y=y, w=w, h=h })\nend\n\n---Draws a circle with given parameters. Must be followed by stroke() or fill().\n---@param x number x-coordinates of the center of the circle.\n---@param y number y-coordinates of the center of the circle.\n---@param r number the radius of the circle\nfunction canvas.circle(x, y, r)\n _internal.sendMessage('canvas.circle', { x=x, y=y, r=r })\nend\n\n---Draws an arc with given parameters. Must be followed by stroke() or fill().\n---@param x number x-coordinates of the center of the circle.\n---@param y number y-coordinates of the center of the circle.\n---@param r number the radius of the circle.\n---@param startAngle number the starting angle in radians.\n---@param endAngle number the ending angle, in radians.\n---@param anticlockwise boolean a flag which specifies whether the drawing should be counterclockwise or clockwise.\nfunction canvas.arc(x, y, r, startAngle, endAngle, anticlockwise)\n _internal.sendMessage('canvas.arc', { x=x, y=y, r=r, startAngle=startAngle,\n endAngle=endAngle, anticlockwise=anticlockwise })\nend\n\n---Adds a quadratic Bézier curve to the path with given control point and end point.\n---@param cpx number x-coordinate of the control point.\n---@param cpy number y-coordinate of the control point.\n---@param x number x-coordinate of the end point.\n---@param y number y-coordinate of the end point.\nfunction canvas.quadraticCurve(cpx, cpy, x, y)\n _internal.sendMessage('canvas.quadraticCurve', { cpx=cpx, cpy=cpy, x=x, y=y })\nend\n\n---Draws a bezier curve from the current position to the specified point, using the specified control points.\n---@param cp1x number x-coordinate of the first control point.\n---@param cp1y number y-coordinate of the first control point.\n---@param cp2x number x-coordinate of the second control point.\n---@param cp2y number y-coordinate of the second control point.\n---@param x number x-coordinate of the end point.\n---@param y number y-coordinate of the end point.\nfunction canvas.bezierCurve(cp1x, cp1y, cp2x, cp2y, x, y)\n _internal.sendMessage('canvas.bezierCurve', { cp1x=cp1x, cp1y=cp1y,\n cp2x=cp2x, cp2y=cp2y,\n x=x, y=y })\nend\n\n---@class Gradient\n---A class to internally link gradient objects from the Lua environment to Lumino codebase.\n---A Gradient object can be create using @{createLinearGradient} or @{createRadialGradient}\n---@private\nlocal Gradient = {}\n\n---Creates a new gradient object with the given index\n---@param idx number index of the gradient object\n---@private\nfunction Gradient:new(idx)\n -- Store the gradient object in a field of the class instance metatable\n local obj = { idx = idx}\n Class.__setmetatable(obj, self)\n self.__index = self\n -- Return the instance\n return obj\nend\n\n---Hook that runs before an object is deleted by the garbage collector.\n---It calls a function to delete the gradient object in JS\n---@private\nfunction Gradient:__gc()\n -- Keep deletion ordering deterministic when gradient operations are buffered.\n _commitIfNeeded()\n _internal.sendMessage('canvas.deleteGradient', { gradientIdx = self.idx })\nend\n-- Add the Gradient class to the Canvas namespace\ncanvas.Gradient = Gradient\n\n---Sets a gradient object to active.\n---@param gradient Gradient a gradient object\nfunction canvas.setGradientActive(gradient)\n if gradient.idx >= 0 then\n _internal.sendMessage('canvas.setGradientActive', { gradientIdx = gradient.idx })\n end\nend\n\n---Adds a new stop, defined by an offset and a color, to a gradient object.\n---@param gradient Gradient a gradient object\n---@param offset number a value between 0.0 and 1.0 where the new color stop is positioned.\n---@param r number Red channel value (0–255)\n---@param g number Green channel value (0–255)\n---@param b number Blue channel value (0–255)\n---@param a number Alpha channel value (0–1)\nfunction canvas.colorStop(gradient, offset, r, g, b, a)\n _internal.sendMessage('canvas.colorStop', { gradientIdx=gradient.idx, offset=offset, r=r, g=g, b=b, a=a })\nend\n\n---Creates a linear gradient object.\n---@param x1 number the x-coordinate of the start point of the gradient\n---@param y1 number the y-coordinate of the start point of the gradient\n---@param x2 number the x-coordinate of the end point of the gradient\n---@param y2 number the y-coordinate of the end point of the gradient\n---@return Gradient a new gradient object\n---@usage local gradient = Canvas.createLinearGradient(0, 0, 50, 0)\nfunction canvas.createLinearGradient(x1, y1, x2, y2)\n local idx = _internal.sendMessage('canvas.createLinearGradient', { x1=x1, y1=y1,\n x2=x2, y2=y2 })\n local gradient = Gradient:new(idx)\n return gradient\nend\n\n---Creates a radial gradient object.\n---@param x1 number x-coordinate of the start circle\n---@param y1 number y-coordinate of the start circle\n---@param r1 number radius of the start circle\n---@param x2 number x-coordinate of the end circle\n---@param y2 number y-coordinate of the end circle\n---@param r2 number radius of the end circle\n---@return Gradient a new gradient object\nfunction canvas.createRadialGradient(x1, y1, r1, x2, y2, r2)\n local idx = _internal.sendMessage('canvas.createRadialGradient', { x1=x1, y1=y1, r1=r1,\n x2=x2, y2=y2, r2=r2})\n local gradient = Gradient:new(idx)\n return gradient\nend\n\n---Returns an array with strings of all available fonts. This will list all custom loaded fonts through Loader.loadFont and\n---fonts registered in Canvas Fonts in your project. It will also probe for common system fonts although the list might not be complete.\n---It is strongly recommended to use only custom uploaded fonts to have reliable results on all platforms.\n---@return table an array with all the available fonts as strings\nfunction canvas.getAvailableFonts()\n return _internal.sendMessage('canvas.getAvailableFonts')\nend\n\n---Sets a font style.\n---@param font string The font style to be set, in the format of 'font-style font-size font-family'. Example: 'italic 20px Arial'.\nfunction canvas.setFont(font)\n _internal.sendMessage('canvas.setFont', { font=font })\nend\n\n---Sets the current text alignment\n---@param align string The new text alignment to be set. One of 'start', 'end', 'left', 'right', or 'center'.\nfunction canvas.setTextAlign(align)\n _internal.sendMessage('canvas.setTextAlign', { align=align })\nend\n\n---Sets the text baseline used when drawing text.\n---@param baseline string The text baseline to set. One of 'alphabetic', 'top', 'hanging', 'middle', 'ideographic', or 'bottom'.\nfunction canvas.setTextBaseline(baseline)\n _internal.sendMessage('canvas.setTextBaseline', { baseline=baseline })\nend\n\n---Measures the width of the specified text in pixels.\n---@param text string The text to measure.\nfunction canvas.measureTextWidth(text)\n return _internal.sendMessage('canvas.measureTextWidth', { text=text })\nend\n\n---Draws and fills a given text string at the specified coordinates.\n---@param text string The text string to be drawn and filled.\n---@param x number The x-coordinate where the text will be drawn.\n---@param y number The y-coordinate where the text will be drawn.\nfunction canvas.fillText(text, x, y)\n _internal.sendMessage('canvas.fillText', { text=text, x=x, y=y })\nend\n\n---Draws the outline of the given text at the specified coordinates.\n---@param text string The text string to be drawn.\n---@param x number The x-coordinate where the text will be drawn.\n---@param y number The y-coordinate where the text will be drawn.\nfunction canvas.strokeText(text, x, y)\n _internal.sendMessage('canvas.strokeText', { text=text, x=x, y=y })\nend\n\n-- -TODO: ImageData is not yet ready for deployment because using it for pixel manipulation would be\n-- -inefficient and slow due to the need for JSON communication with JavaScript. While JSON\n-- -communication is necessary for the security of the application, it is not well-suited for tasks\n-- -that require frequent or high-volume data transfer. It is better to use ImageData for low\n-- -frequency tasks such as updating UI and handling events, rather than trying to use it for more\n-- -demanding tasks that may be slowed down by the use of JSON objects.\n\n-- --- Image class to link imageData objects in the canvas to Lua\n-- ---@class imageData\n-- local Image = {}\n\n-- --- Creates a new Image object with the given index\n-- ---@param idx number index of the imageData object in the canvas\n-- function Image:new(idx)\n-- local obj = {}\n-- Class.__setmetatable(obj, self)\n-- self.__index = self\n-- self.idx = idx\n-- return obj\n-- end\n-- canvas.Image = Image\n\n-- ---Creates a new, blank Image object with the specified dimensions.\n-- ---All of the pixels in the new object are transparent black.\n-- ---@param width number the width of the Image object\n-- ---@param height number the height of the Image object\n-- ---@return Image a new Image object\n-- function canvas.createImage(width, height)\n-- local idx = _internal.sendMessage('canvas.createImage', { width=width, height=height })\n-- local image = Image:new(idx)\n-- return image\n-- end\n\n-- ---Write the RGBA channels of an Image object\n-- ---@param r number the r channel of the Image object\n-- ---@param g number the g channel of the Image object\n-- ---@param b number the b channel of the Image object\n-- ---@param a number the a channel of the Image object\n-- function canvas.writeImageChannels(image, r, g, b, a)\n-- _internal.sendMessage('canvas.writeImageChannels', { imageIdx=image.idx, r=r, g=g, b=b, a=a })\n-- end\n\n-- ---Draws an image given by an url at the specified position and dimensions.\n-- ---@param url string\n-- ---@param x number\n-- ---@param y number\n-- ---@param width number\n-- ---@param height number\n-- function canvas.drawImageFromUrl(url, x, y, width, height)\n-- _internal.sendMessage('canvas.drawImageFromUrl', { url=url, x=x, y=y, width=width, height=height })\n-- end\n\n-- ---Repeats a given image on the canvas with a given pattern.\n-- ---@param image imageSource an image object\n-- ---@param repeat string one of repeat, repeat-x, repeat-y, no-repeat\n-- function canvas.imagePattern(image, repeatPattern)\n-- _internal.sendMessage('canvas.pattern', { image=image, repeatPattern=repeatPattern })\n-- end\n\n---Draws the image data at the given coordinates.\n---@param image Texture the image data to paint\n---@param x number x-coordinate of the top left corner where the image data will be painted\n---@param y number y-coordinate of the top left corner where the image data will be painted\n---@param width number width of the image on screen (optional)\n---@param height number height of the image on screen (optional)\n---@param mode number mode to use for stretching. possible values are 0 = stretch, 1 = fit, 2 = cover\nfunction canvas.drawImage(image, x, y, width, height, mode)\n __assertTrace(image and image._isTexture, \"image is not a Texture object\")\n _internal.sendMessage('canvas.drawImage', { image= image._handle, x=x, y=y, width=width, height=height, mode=mode })\nend\n\n---Draws the image data at the given coordinates.\n---@param image Texture the image data to paint\n---@param x number x-coordinate of the top left corner where the image data will be painted\n---@param y number y-coordinate of the top left corner where the image data will be painted\n---@param width number width of the image on screen (optional)\n---@param height number height of the image on screen (optional)\nfunction canvas.drawSubImage(image, x, y, width, height, sourceX, sourceY, sourceWidth, sourceHeight)\n __assertTrace(image and image._isTexture, \"image is not a Texture object\")\n _internal.sendMessage('canvas.drawSubImage', { image= image._handle,\n x=x, y=y, width=width, height=height,\n sourceX=sourceX, sourceY=sourceY, sourceWidth=sourceWidth, sourceHeight=sourceHeight })\nend\n\n--- Scales the canvas by the specified factors along the x and y axes.\n--- Transformations are applied relative to the canvas origin (0,0).\n--- To scale around a different point, use `translate()` to move the origin before scaling.\n---@param x number Scale factor along the x-axis.\n---@param y number Scale factor along the y-axis.\nfunction canvas.scale(x, y)\n _internal.sendMessage('canvas.scale', { x=x, y=y })\nend\n\n--- Rotates the canvas by the specified angle in radians.\n--- Rotation is performed around the canvas origin (0,0).\n--- To rotate around a different point, translate the canvas to that point before calling rotate().\n---@param a number Angle in radians.\nfunction canvas.rotate(a)\n _internal.sendMessage('canvas.rotate', { a=a })\nend\n\n\n--- Moves (translates) the canvas origin by the specified amounts.\n--- All subsequent drawing and transformations (scale, rotate, etc.) are relative to the new origin.\n---@param x number Amount to translate along the x-axis.\n---@param y number Amount to translate along the y-axis.\nfunction canvas.translate(x, y)\n _internal.sendMessage('canvas.translate', { x=x, y=y })\nend\n\n---Applies a 2D transformation matrix to the canvas.\n---@param horizontal_scale number The amount to scale horizontally.\n---@param horizontal_skew number The amount of horizontal skew.\n---@param vertical_skew number The amount of vertical skew.\n---@param vertical_scale number The amount to scale vertically.\n---@param horizontal_translation number The amount of horizontal translation.\n---@param vertical_translation number The amount of vertical translation.\nfunction canvas.transform(horizontal_scale, horizontal_skew, vertical_skew,\n vertical_scale, horizontal_translation, vertical_translation)\n _internal.sendMessage('canvas.transform', { a=horizontal_scale, b=horizontal_skew,\n c=vertical_skew, d=vertical_scale,\n e=horizontal_translation, f=vertical_translation })\nend\n\n---Resets the current canvas transform to the identity matrix and then invokes the transform() function with the given parameters.\n---@param horizontal_scale number The amount to scale horizontally.\n---@param horizontal_skew number The amount of horizontal skew.\n---@param vertical_skew number The amount of vertical skew.\n---@param vertical_scale number The amount to scale vertically.\n---@param horizontal_translation number The amount of horizontal translation.\n---@param vertical_translation number The amount of vertical translation.\nfunction canvas.resetAndSetTransform(horizontal_scale, horizontal_skew, vertical_skew,\n vertical_scale, horizontal_translation, vertical_translation)\n _internal.sendMessage('canvas.resetAndSetTransform', { a=horizontal_scale, b=horizontal_skew,\n c=vertical_skew, d=vertical_scale,\n e=horizontal_translation, f=vertical_translation })\nend\n\n---Reset the transformation matrix to the identity matrix.\n---@function\nfunction canvas.resetTransform()\n _internal.sendMessage('canvas.resetTransform')\nend\n\n---Pushes the current canvas state to a stack so that you can restore it.\n---This can be useful for performing multiple transformations or styles on the canvas, and\n---then restoring it to its original state. The canvas state in fact includes current transformation matrix\n---stroke and fill styles, shadow styles, and other attributes. To restore the canvas state you call\n---the restoreState() function.\n---@function\nfunction canvas.saveState()\n _internal.sendMessage('canvas.saveState')\nend\n\n---Pops the the most recently saved canvas from the saved state stack and restores it.\n---@function\nfunction canvas.restoreState()\n _internal.sendMessage('canvas.restoreState')\nend\n\n--- Resets the canvas to its default state, clearing the canvas and restoring all\n--- context -properties (transforms, styles, clipping region, etc.) to their\n--- defaults. Reset() is more thorough than -calling clear() alone, which only\n--- erases pixels but leaves context state intact.\n---@function\nfunction canvas.reset()\n _internal.sendMessage('canvas.reset')\nend\n\n-- Automatically wrap canvas methods for buffering, so non-query calls are queued\n-- and query/result-producing calls force an immediate commit first.\nlocal _passthroughMethods = {\n commit = true,\n getPendingCommandCount = true,\n getPendingCommands = true,\n}\n\nlocal _immediateMethods = {\n getLastCommittedCommands = true,\n getWidth = true,\n getHeight = true,\n isPointInPath = true,\n createLinearGradient = true,\n createRadialGradient = true,\n getAvailableFonts = true,\n measureTextWidth = true,\n}\n\nfor name, fn in pairs(canvas) do\n if type(fn) == \"function\" and name ~= \"Gradient\" then\n if _passthroughMethods[name] then\n -- keep as-is\n elseif _immediateMethods[name] then\n canvas[name] = function(...)\n _commitIfNeeded()\n return fn(...)\n end\n else\n canvas[name] = function(...)\n return _runWithCapturedSend(fn, ...)\n end\n end\n end\nend\n\nreturn canvas\n";
236157
236193
 
236158
- var lua_api_class = "\nlocal Class = {}\n\nClass.__setmetatable = setmetatable\n_G.setmetatable = function()\n error(\"Do not use setmetatable. Use Class.new() instead!\")\nend\n\n-- Put the class in the global scope\n_G.Class = Class\n\nfunction Class.new(self, super)\n if self ~= Class then\n -- new was called with dot syntax, so we need to move self to super.\n super = self\n end\n\n local class, metatable, properties = {}, {}, {}\n class.metatable = metatable\n class.properties = properties\n\n function metatable:__index(key)\n local prop = properties[key]\n if prop then\n return prop:get()\n elseif class[key] ~= nil then\n return class[key]\n elseif class.__customIndex then\n return class.__customIndex(self, key)\n elseif super then\n return super.metatable.__index(self, key)\n else\n return nil\n end\n end\n\n function metatable:__newindex(key, value)\n local prop = properties[key]\n if prop then\n prop:set(value)\n elseif class.__customNewIndex then\n class.__customNewIndex(self, key, value)\n else\n if (super and super.metatable.__customnewindex(self, key, value)) then\n return\n end\n rawset(self, key, value)\n end\n end\n\n function metatable:__customnewindex(key, value)\n if class.__customNewIndex then\n class.__customNewIndex(self, key, value)\n return true\n elseif super then\n return super.metatable.__customnewindex(self, key, value)\n end\n return false\n end\n\n function class:getClass()\n return class\n end\n\n function class.new(self, ...)\n local obj = Class.__setmetatable({}, class.metatable)\n\n if obj.__new then\n if self ~= class then\n -- new was called with dot syntax\n obj:__new(self, ...)\n else\n obj:__new(...)\n end\n end\n\n return obj\n end\n\n function tableLength(T)\n local count = 0\n for _ in pairs(T) do\n count = count + 1\n end\n return count\n end\n\n function class:addProperty(key, propType, defaultValue, options)\n options = options or {}\n if type(options) == 'string' then\n options = { info=options }\n end\n\n if class.properties[key] then\n error(\"A property with the name '\" .. key .. \"' already exists!\");\n return;\n end\n class.properties[key] = Property.new(propType, defaultValue, tableLength(class.properties), options);\n end\n\n return class\nend\n\nreturn Class\n";
236194
+ var lua_api_class = "\nlocal Class = {}\n\nClass.__setmetatable = setmetatable\n_G.setmetatable = function()\n error(\"Do not use setmetatable. Use Class.new() instead!\")\nend\n\n-- Put the class in the global scope\n_G.Class = Class\n\nfunction Class.new(self, super)\n if self ~= Class then\n -- new was called with dot syntax, so we need to move self to super.\n super = self\n end\n\n local class, metatable, properties = {}, {}, {}\n class.metatable = metatable\n class.properties = properties\n class.super = super\n\n function metatable:__index(key)\n local prop = properties[key]\n if prop then\n return prop:get()\n elseif class[key] ~= nil then\n return class[key]\n elseif class.__customIndex then\n return class.__customIndex(self, key)\n elseif super then\n return super.metatable.__index(self, key)\n else\n return nil\n end\n end\n\n function metatable:__newindex(key, value)\n local prop = properties[key]\n if prop then\n prop:set(value)\n elseif class.__customNewIndex then\n class.__customNewIndex(self, key, value)\n else\n if (super and super.metatable.__customnewindex(self, key, value)) then\n return\n end\n rawset(self, key, value)\n end\n end\n\n function metatable:__customnewindex(key, value)\n if class.__customNewIndex then\n class.__customNewIndex(self, key, value)\n return true\n elseif super then\n return super.metatable.__customnewindex(self, key, value)\n end\n return false\n end\n\n function class:getClass()\n return class\n end\n\n function class.new(self, ...)\n local obj = Class.__setmetatable({}, class.metatable)\n\n if obj.__new then\n if self ~= class then\n -- new was called with dot syntax\n obj:__new(self, ...)\n else\n obj:__new(...)\n end\n end\n\n return obj\n end\n\n function tableLength(T)\n local count = 0\n for _ in pairs(T) do\n count = count + 1\n end\n return count\n end\n\n function class:addProperty(key, propType, defaultValue, options)\n options = options or {}\n if type(options) == 'string' then\n options = { info=options }\n end\n\n if class.properties[key] then\n error(\"A property with the name '\" .. key .. \"' already exists!\");\n return;\n end\n class.properties[key] = Property.new(propType, defaultValue, tableLength(class.properties), options);\n end\n\n return class\nend\n\nreturn Class\n";
236159
236195
 
236160
236196
  var lua_api_console = "\nlocal _internal = require('engine/_internal');\n\n--- @module console\nlocal console = {}\n\n-- Add Console to the global scope\n_G.Console = console\n\n---Output log message\n---@param text string\nfunction console.log(text)\n _internal.sendMessage('console.log', { text=text })\nend\n\n---Output debug message\n---@param text string\nfunction console.debug(text)\n _internal.sendMessage('console.debug', { text=text })\nend\n\n---Output warning message\n---@param text string\nfunction console.warning(text)\n _internal.sendMessage('console.warning', { text=text })\nend\n\n---Output error message\n---@param text string\nfunction console.error(text)\n _internal.sendMessage('console.error', { text=text })\nend\n\n---Output inspector to the console that allows inspecting the value with a UI\n---@param value any\nfunction console.inspect(value)\n _internal.sendMessage('console.inspect', { value=value })\nend\n\nreturn console\n";
236161
236197
 
@@ -236239,7 +236275,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
236239
236275
 
236240
236276
  var lua_api_promise = "\nlocal handle = require 'engine/handle'\nlocal _internal = require 'engine/_internal'\nlocal Console = require 'engine/console'\n\n---@class Promise\nlocal Promise = {}\nPromise.__index = Promise\n\n-- Put the class in the global scope\n_G.Promise = Promise\n\nlocal _managedPromises = {}\nlocal _handleMap = {}\n\nfunction Promise:__init()\n _managedPromises = {}\n _handleMap = {}\nend\n\nfunction Promise.new(self, executorOrHandle)\n\n if self ~= Promise then\n executorOrHandle = self\n end\n\n self = Class.__setmetatable({}, Promise)\n self._type = \"Promise\"\n self._isPromise = true\n self.status = \"pending\"\n self.value = nil\n self.reason = nil\n self.onFulfilled = {}\n self.onRejected = {}\n\n table.insert(_managedPromises, self)\n\n if type(executorOrHandle) == \"string\" then\n self._handle = executorOrHandle\n _handleMap[self._handle] = self\n return self\n elseif type(executorOrHandle) ~= \"function\" then\n error(\"Promise.new() expects a function or a string handle\")\n end\n\n local function resolve(value)\n if self.status ~= \"pending\" then\n return\n end\n\n if value == self then\n return reject(\"Cannot resolve promise with itself\")\n end\n\n -- If value is a Promise, adopt its state\n if type(value) == \"table\" and value._isPromise then\n value:next(resolve, reject)\n return\n end\n\n self.status = \"fulfilled\"\n self.value = value\n coroutine.yield({ __engine_call=true }, \"promiseDone\", self._handle)\n end\n\n local function reject(reason)\n if self.status ~= \"pending\" then return end\n self.status = \"rejected\"\n self.reason = reason\n coroutine.yield({ __engine_call=true }, \"promiseDone\", self._handle)\n end\n\n self._handle = _internal.randomHex8()\n _handleMap[self._handle] = self\n\n local co = coroutine.create(function()\n executorOrHandle(resolve, reject)\n end)\n coroutine.yield({ __engine_call=true }, \"promise\", self._handle, co)\n\n return self\nend\n\nfunction Promise._processQueue()\n local processed = 0\n\n repeat\n processed = 0\n local i = 1\n while i <= #_managedPromises do\n local promise = _managedPromises[i]\n\n if promise == nil then\n table.remove(_managedPromises, i)\n elseif promise.status == \"fulfilled\" then\n for _, callback in ipairs(promise.onFulfilled) do\n callback(promise.value)\n end\n if promise._handle then _handleMap[promise._handle] = nil end\n table.remove(_managedPromises, i) -- removes and shifts\n processed = processed + 1\n elseif promise.status == \"rejected\" then\n local caught = false\n for _, callback in ipairs(promise.onRejected) do\n callback(promise.reason)\n caught = true\n end\n if not caught then\n Console.error(\"Uncaught rejection! -> \" .. promise.reason);\n end\n if promise._handle then _handleMap[promise._handle] = nil end\n table.remove(_managedPromises, i)\n processed = processed + 1\n else\n i = i + 1\n end\n end\n until processed == 0\nend\n\nfunction Promise:next(onFulfilled, onRejected)\n return Promise.new(function(resolve, reject)\n local function handleFulfilled(value)\n if type(onFulfilled) == \"function\" then\n local ok, result = pcall(onFulfilled, value)\n if ok then\n if type(result) == \"table\" and result._isPromise then\n result:next(resolve, reject)\n else\n resolve(result)\n end\n else\n reject(result)\n end\n else\n resolve(value)\n end\n end\n\n local function handleRejected(reason)\n if type(onRejected) == \"function\" then\n local ok, result = pcall(onRejected, reason)\n if ok then\n if type(result) == \"table\" and result._isPromise then\n result:next(resolve, reject)\n else\n resolve(result)\n end\n else\n reject(result)\n end\n else\n reject(reason)\n end\n end\n\n if self.status == \"fulfilled\" then\n handleFulfilled(self.value)\n elseif self.status == \"rejected\" then\n handleRejected(self.reason)\n else\n table.insert(self.onFulfilled, handleFulfilled)\n table.insert(self.onRejected, handleRejected)\n end\n end)\nend\n\nfunction Promise:catch(onRejected)\n return self:next(nil, onRejected)\nend\n\nfunction Promise.all(self, promises)\n\n if self ~= Promise then\n promises = self\n end\n\n return Promise.new(function(resolve, reject)\n local results = {}\n local remaining = #promises\n\n for i, p in ipairs(promises) do\n p:next(function(value)\n results[i] = value\n remaining = remaining - 1\n if remaining == 0 then\n resolve(results)\n end\n end, function(err)\n reject(err)\n end)\n end\n\n if remaining == 0 then\n resolve(table.unpack(results))\n end\n end)\nend\n\n-- Engine calls this to resolve or reject promises externally\n-- res = { handle = \"0xABC\", type = \"resolved\" or \"rejected\", value = ... }\nfunction Promise._externalResult(res)\n local promise = _handleMap[res._handle]\n if not promise or promise.status ~= \"pending\" then return end\n\n if res.type == \"resolved\" then\n if type(res.value) == 'table' and res.value._isHandle then\n res.value = handle.createObject(res.value)\n end\n promise.status = \"fulfilled\"\n promise.value = res.value\n\n elseif res.type == \"rejected\" then\n promise.status = \"rejected\"\n promise.reason = res.error\n end\n\n Promise._processQueue()\n\nend\n\nfunction Promise.awaitAll(self, promises)\n if self ~= Promise then\n promises = self\n end\n\n return await(Promise.all(promises))\nend\n\nfunction Promise:await()\n return await(self)\nend\n\nfunction Promise._debugStats()\n local handleCount = 0\n for _ in pairs(_handleMap) do\n handleCount = handleCount + 1\n end\n\n local pendingCount = 0\n local fulfilledCount = 0\n local rejectedCount = 0\n for i = 1, #_managedPromises do\n local p = _managedPromises[i]\n if p then\n if p.status == \"pending\" then\n pendingCount = pendingCount + 1\n elseif p.status == \"fulfilled\" then\n fulfilledCount = fulfilledCount + 1\n elseif p.status == \"rejected\" then\n rejectedCount = rejectedCount + 1\n end\n end\n end\n\n return {\n managedCount = #_managedPromises,\n pendingCount = pendingCount,\n fulfilledCount = fulfilledCount,\n rejectedCount = rejectedCount,\n handleCount = handleCount\n }\nend\n\nreturn Promise\n";
236241
236277
 
236242
- var lua_api_property = "\nlocal Class = require('engine/class')\nlocal Tools = require('engine/tools')\n\nlocal Property = Class.new()\n\n-- Put the class in the global scope\n_G.Property = Property\n\nProperty.String = \"string\"\nProperty.Number = \"number\"\nProperty.Bool = \"bool\"\nProperty.Boolean = \"bool\"\nProperty.Node = \"node\"\nProperty.Separator = \"separator\"\n\nProperty.Datatypes = { Property.String, Property.Number, Property.Bool, Property.Node, Property.Separator }\n\n--- Hook for the Class to call when a new object is created\n---@param datatype string type of property\n---@param value any initial value of the property\n---@param order number a number used for odering the properties\n---@param options table options for the property\n---@param options.info string an info text that can be displayed as tooltip in the editor UI\n---@param options.minValue number a minimum possible value for the property\n---@param options.maxValue number a maximum possible value for the property\n---@param options.conditions table a conditions object to determine, if that field should be visible in the UI\n---@private\nfunction Property:__new(datatype, value, order, options)\n\n if not Tools.isValueInTable(Property.Datatypes, datatype) then\n error(\"Invalid datatype for property: \" .. tostring(datatype));\n end\n\n options = options or {}\n\n self._isProperty = true\n self._type = \"Property\"\n self.datatype = datatype\n self.value = value\n self.order = order or 0\n self.info = options.info\n self.minValue = options.minValue\n self.maxValue = options.maxValue\n self.conditions = options.conditions\nend\n\n--- Set the value of the property\n---@param value any value of the property\nfunction Property:set(value)\n self.value = value\nend\n\n--- Get the value of the property\n---@return any value of the property\nfunction Property:get()\n return self.value\nend\n\n--- If the property has a value of type Node, this will call behaviour() on the node and return its value.\n--- Otherwise it will return nil\n---@param scriptName string name of the script item\n---@return Behaviour the behaviour if found or nil\nfunction Property:behaviour(scriptName)\n if self.datatype ~= Property.Node or not self.value then\n return nil\n end\n\n return self.value:behaviour(scriptName)\nend\n\n--- If the property has a value of type Node, this will call getEntityByScriptName() on the node and return its value.\n--- Otherwise it will return nil\n---@deprecated\n---@param scriptName string name of the script item\n---@return Behaviour the behaviour if found or nil\nfunction Property:entity(scriptName)\n if self.datatype ~= Property.Node or not self.value then\n return nil\n end\n\n return self.value:behaviour(scriptName)\nend\n\nreturn Property\n";
236278
+ var lua_api_property = "\nlocal Class = require('engine/class')\nlocal Tools = require('engine/tools')\n\nlocal Property = Class.new()\n\n-- Put the class in the global scope\n_G.Property = Property\n\nProperty.String = \"string\"\nProperty.Number = \"number\"\nProperty.Bool = \"bool\"\nProperty.Boolean = \"bool\"\nProperty.Node = \"node\"\nProperty.Link = \"link\"\nProperty.Separator = \"separator\"\nProperty.NumberArray = \"numberarray\"\nProperty.StringArray = \"stringarray\"\nProperty.BoolArray = \"boolarray\"\nProperty.BooleanArray = \"boolarray\"\nProperty.NodeArray = \"nodearray\"\nProperty.LinkArray = \"linkarray\"\n\nProperty.Datatypes = {\n Property.String, Property.Number, Property.Bool,\n Property.Node, Property.Link, Property.Separator,\n Property.NumberArray, Property.StringArray, Property.BoolArray,\n Property.NodeArray, Property.LinkArray,\n}\n\n--- Hook for the Class to call when a new object is created\n---@param datatype string type of property\n---@param value any initial value of the property\n---@param order number a number used for odering the properties\n---@param options table options for the property\n---@param options.info string an info text that can be displayed as tooltip in the editor UI\n---@param options.minValue number a minimum possible value for the property\n---@param options.maxValue number a maximum possible value for the property\n---@param options.conditions table a conditions object to determine, if that field should be visible in the UI\n---@param options.collapsed boolean when true, separator sections start collapsed in the editor\n---@param options.allowedTypes string[] when set on Link properties, restricts which item types can be linked\n---@private\nfunction Property:__new(datatype, value, order, options)\n\n if not Tools.isValueInTable(Property.Datatypes, datatype) then\n error(\"Invalid datatype for property: \" .. tostring(datatype));\n end\n\n options = options or {}\n\n self._isProperty = true\n self._type = \"Property\"\n self.datatype = datatype\n self.value = value\n self.order = order or 0\n self.info = options.info\n self.minValue = options.minValue\n self.maxValue = options.maxValue\n self.conditions = options.conditions\n self.collapsed = options.collapsed\n self.allowedTypes = options.allowedTypes\nend\n\n--- Set the value of the property\n---@param value any value of the property\nfunction Property:set(value)\n self.value = value\nend\n\n--- Get the value of the property\n---@return any value of the property\nfunction Property:get()\n return self.value\nend\n\n--- If the property has a value of type Node, this will call behaviour() on the node and return its value.\n--- Otherwise it will return nil\n---@param scriptName string name of the script item\n---@return Behaviour the behaviour if found or nil\nfunction Property:behaviour(scriptName)\n if self.datatype ~= Property.Node or not self.value then\n return nil\n end\n\n return self.value:behaviour(scriptName)\nend\n\n--- If the property has a value of type Node, this will call getEntityByScriptName() on the node and return its value.\n--- Otherwise it will return nil\n---@deprecated\n---@param scriptName string name of the script item\n---@return Behaviour the behaviour if found or nil\nfunction Property:entity(scriptName)\n if self.datatype ~= Property.Node or not self.value then\n return nil\n end\n\n return self.value:behaviour(scriptName)\nend\n\nreturn Property\n";
236243
236279
 
236244
236280
  var lua_api_renderer = "\nlocal _internal = require('engine/_internal');\nlocal handle = require 'engine/handle'\n\n--- @module renderer\nlocal renderer = {}\n\nlocal _data = {}\n\nfunction renderer.__setData(data)\n _data = data;\nend\n\n--- Get width of the output in pixels\n---@return number width\nfunction renderer.getWidth()\n return _data.width or 0\nend\n\n--- Get height of the output in pixels\n---@return number height\nfunction renderer.getHeight()\n return _data.height or 0\nend\n\n---Sets a uniform value inside a background shader\n---@param name string\n---@param value string\nfunction renderer.setBackgroundShaderUniform(name, value)\n if value == nil then\n return\n end\n local valueType = 'float';\n if type(value) == 'object' then\n valueType = value._type\n end\n _internal.sendMessage('renderer.setBackgroundShaderUniform', { name=name, value=value, type=valueType })\nend\n\n---Tests which objects are at the specified pixel position on screen\n---@param camera Camera the camera to use. If nil, the main camera of the scene will be used. if that does not exist, the first found camera will be used. If no camera exists at all, the function will throw an error\n---@param x number x position\n---@param y number y position\n---@param findAll boolean set to true, to get all objects at the position, otherwise only the first is returned\n---@return table list of intersections with the ray if findAll is true or a single result or nil if nothing was found.\nfunction renderer.raycast(camera, x, y, findAll)\n local results = _internal.sendMessage('renderer.raycast', { camera=camera, x=x, y=y, findAll=findAll })\n if results then\n if findAll then\n for k, v in pairs(results) do\n v.object = handle.createObject(v.object)\n end\n else\n results.object = handle.createObject(results.object)\n end\n end\n return results;\nend\n\nreturn renderer\n";
236245
236281
 
@@ -237465,7 +237501,16 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
237465
237501
  // TODO!
237466
237502
  }
237467
237503
  findById(params) {
237468
- // TODO!
237504
+ const id = params.id;
237505
+ if (!id)
237506
+ return null;
237507
+ const itemInstance = this.loadingManager.get(id, this.refId);
237508
+ if (!itemInstance) {
237509
+ console.warn(`Item.findById: item ${id} is not loaded yet`);
237510
+ return null;
237511
+ }
237512
+ this._addLoadedItemInstance(itemInstance);
237513
+ return this.runtime.makeObjectHandle(itemInstance);
237469
237514
  }
237470
237515
  getId(params) {
237471
237516
  return this.runtime.getObjectOfType(params.obj, Item)?.getId();
@@ -241885,8 +241930,16 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
241885
241930
  let payload;
241886
241931
  if (entry.type === "String" && key === "node")
241887
241932
  payload = this.packMessage({ scriptName: scriptItemName, value: value, scriptId: scriptId });
241933
+ else if (entry.type === "Link")
241934
+ payload = await this._packLinkFieldValue(value, scriptRunner.getReferenceId());
241935
+ else if (entry.type === "LinkArray")
241936
+ payload = await this._packLinkArrayFieldValue(value, scriptRunner.getReferenceId());
241937
+ else if (entry.type === "NodeArray")
241938
+ payload = this.packMessage(Array.isArray(value) ? value : []);
241888
241939
  else
241889
241940
  payload = this.packMessage(value);
241941
+ if (!payload)
241942
+ continue;
241890
241943
  const funcName = `__set_object_${key}`;
241891
241944
  if (this.functionExists(scriptId, funcName))
241892
241945
  await this.callFunctionWithObject(scriptId, funcName, payload);
@@ -241898,11 +241951,55 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
241898
241951
  }
241899
241952
  }
241900
241953
  }
241954
+ async _resolveLinkHandle(value, referenceId) {
241955
+ let preparedItem;
241956
+ if (typeof value === 'string') {
241957
+ preparedItem = await this.itemRepo.loadItem(value, { recursive: true });
241958
+ }
241959
+ else if (value && value._id) {
241960
+ if (value.type)
241961
+ preparedItem = value;
241962
+ else
241963
+ preparedItem = await this.itemRepo.loadItem(value._id, { recursive: true });
241964
+ }
241965
+ else {
241966
+ return null;
241967
+ }
241968
+ if (!preparedItem)
241969
+ return null;
241970
+ const loadingManager = this.engine.loadingManager;
241971
+ const ItemType = loadingManager.typeNameToType(preparedItem.type);
241972
+ let itemInstance = loadingManager.get(preparedItem._id, referenceId);
241973
+ if (!itemInstance)
241974
+ itemInstance = await loadingManager.load(referenceId, preparedItem, ItemType, { waitUntilFinished: true });
241975
+ if (!itemInstance)
241976
+ return null;
241977
+ return this.scriptRuntime.makeObjectHandle(itemInstance);
241978
+ }
241979
+ async _packLinkFieldValue(value, referenceId) {
241980
+ const handle = await this._resolveLinkHandle(value, referenceId);
241981
+ return handle ? this.packMessage(handle) : null;
241982
+ }
241983
+ async _packLinkArrayFieldValue(values, referenceId) {
241984
+ if (!Array.isArray(values))
241985
+ return null;
241986
+ const handles = [];
241987
+ for (const value of values) {
241988
+ if (value == null)
241989
+ continue;
241990
+ const handle = await this._resolveLinkHandle(value, referenceId);
241991
+ if (handle)
241992
+ handles.push(handle);
241993
+ }
241994
+ return this.packMessage(handles);
241995
+ }
241901
241996
  _prepareCode(code, scriptItemId, injectedFields = undefined) {
241902
241997
  let varCode = "";
241903
241998
  let injectedVarsNumLines = 0;
241904
241999
  if (injectedFields) {
241905
242000
  for (const field of injectedFields) {
242001
+ if (field.type === 'separator')
242002
+ continue;
241906
242003
  switch (field.type) {
241907
242004
  case 'node':
241908
242005
  if (field.name === 'node')
@@ -241911,8 +242008,26 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
241911
242008
  varCode += `function __set_object_${field.name}(object, data, len) if type(object.${field.name}) == 'table' then object.${field.name}:set(__api_sceneobject:findById(__api_internal.fetchAndUnpack(data, len))) else object.${field.name} = __api_sceneobject:findById(__api_internal.fetchAndUnpack(data, len)) end end\n`;
241912
242009
  injectedVarsNumLines++;
241913
242010
  break;
242011
+ case 'link':
242012
+ varCode += `function __set_object_${field.name}(object, data, len) local __handle = require('engine/handle'); local item = __handle.createObject(__api_internal.fetchAndUnpack(data, len)); if type(object.${field.name}) == 'table' and object.${field.name}.set then object.${field.name}:set(item) else object.${field.name} = item end end\n`;
242013
+ injectedVarsNumLines++;
242014
+ break;
242015
+ case 'numberarray':
242016
+ case 'stringarray':
242017
+ case 'boolarray':
242018
+ varCode += `function __set_object_${field.name}(object, data, len) object.${field.name} = __api_internal.fetchAndUnpack(data, len) end\n`;
242019
+ injectedVarsNumLines++;
242020
+ break;
242021
+ case 'nodearray':
242022
+ varCode += `function __set_object_${field.name}(object, data, len) local ids = __api_internal.fetchAndUnpack(data, len); local nodes = {}; for i, id in ipairs(ids or {}) do nodes[i] = __api_sceneobject:findById(id) end; object.${field.name} = nodes end\n`;
242023
+ injectedVarsNumLines++;
242024
+ break;
242025
+ case 'linkarray':
242026
+ varCode += `function __set_object_${field.name}(object, data, len) local __handle = require('engine/handle'); local handles = __api_internal.fetchAndUnpack(data, len); local items = {}; for i, h in ipairs(handles or {}) do items[i] = __handle.createObject(h) end; object.${field.name} = items end\n`;
242027
+ injectedVarsNumLines++;
242028
+ break;
241914
242029
  default:
241915
- varCode += `function __set_object_${field.name}(object, data, len) if type(object.${field.name}) == 'table' then object.${field.name}:set(__api_internal.fetchAndUnpack(data, len)) else object.${field.name} = __api_internal.fetchAndUnpack(data, len) end end\n`;
242030
+ varCode += `function __set_object_${field.name}(object, data, len) if type(object.${field.name}) == 'table' and object.${field.name}.set then object.${field.name}:set(__api_internal.fetchAndUnpack(data, len)) else object.${field.name} = __api_internal.fetchAndUnpack(data, len) end end\n`;
241916
242031
  injectedVarsNumLines++;
241917
242032
  break;
241918
242033
  }
@@ -266702,7 +266817,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
266702
266817
  });
266703
266818
  affectedFolderIds.add(resourcesFolderId);
266704
266819
  }
266705
- visibility = visibility || Ud.Private;
266820
+ visibility = visibility || Yd.Private;
266706
266821
  const foldersMap = new Map();
266707
266822
  const rewireItems = [];
266708
266823
  const itemsMapByItemId = new Map();
@@ -267220,7 +267335,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
267220
267335
  preventWheelEventDefault: options.preventWheelEventDefault !== undefined ? options.preventWheelEventDefault : true
267221
267336
  };
267222
267337
  if (!options.apiClient) {
267223
- this.apiClient = new zd({
267338
+ this.apiClient = new Gd({
267224
267339
  apiToken: options.apiToken,
267225
267340
  accessToken: options.accessToken
267226
267341
  });
@@ -267475,7 +267590,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
267475
267590
  if (!this.storage || this.storage.databaseName !== name)
267476
267591
  this.storage = undefined;
267477
267592
  if (!this.storage)
267478
- this.storage = new ar(name, 'lumino-engine');
267593
+ this.storage = new sr(name, 'lumino-engine');
267479
267594
  }
267480
267595
  async finishedForUse(timeout) {
267481
267596
  const _this = this;
@@ -268776,67 +268891,67 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
268776
268891
  });
268777
268892
 
268778
268893
  exports.AccessDeniedException = x$2;
268779
- exports.AggregatedItem = V;
268780
- exports.ApiClient = zd;
268781
- exports.ApiGateway = j;
268782
- exports.Block = le;
268783
- exports.CustomField = te$1;
268894
+ exports.AggregatedItem = C$1;
268895
+ exports.ApiClient = Gd;
268896
+ exports.ApiGateway = U;
268897
+ exports.Block = pe;
268898
+ exports.CustomField = re;
268784
268899
  exports.Engine = Engine;
268785
268900
  exports.EventEmitter = o$1;
268786
- exports.Field = ee;
268901
+ exports.Field = ne;
268787
268902
  exports.InvalidArgumentException = k;
268788
268903
  exports.InvalidStateException = S$1;
268789
268904
  exports.Item = Item;
268790
- exports.ItemCache = Or;
268791
- exports.ItemRepo = qi;
268792
- exports.ItemVisibility = Ud;
268793
- exports.LinkableItemsCache = Wd;
268905
+ exports.ItemCache = zr;
268906
+ exports.ItemRepo = Xn;
268907
+ exports.ItemVisibility = Yd;
268908
+ exports.LinkableItemsCache = qd;
268794
268909
  exports.LoaderException = T$1;
268795
268910
  exports.LoadingManager = LoadingManager;
268796
268911
  exports.MaxLayerCount = MaxLayerCount;
268797
- exports.PackageTools = Wi;
268912
+ exports.PackageTools = qn;
268798
268913
  exports.Player = Player;
268799
- exports.PreparedItem = ae$1;
268800
- exports.Profiler = _;
268914
+ exports.PreparedItem = se;
268915
+ exports.Profiler = w;
268801
268916
  exports.Proxifier = y$1;
268802
268917
  exports.ProxyEvent = u$2;
268803
268918
  exports.QuotaExceededException = M;
268804
268919
  exports.Renderer = Renderer;
268805
268920
  exports.SceneGraph = SceneGraph;
268806
268921
  exports.SceneGraphCollection = SceneGraphCollection;
268807
- exports.Script = Z;
268808
- exports.ScriptField = G$9;
268922
+ exports.Script = Q$1;
268923
+ exports.ScriptField = J;
268809
268924
  exports.SgItem = SgItem;
268810
268925
  exports.SgItemSubNode = SgItemSubNode;
268811
268926
  exports.Shortcuts = Shortcuts;
268812
268927
  exports.Snapshot = W;
268813
- exports.Storage = ar;
268814
- exports.Template = re;
268815
- exports.TemplateFactory = se;
268816
- exports.ThumbCache = Ur;
268817
- exports.UndoManager = Hi;
268928
+ exports.Storage = sr;
268929
+ exports.Template = ue$1;
268930
+ exports.TemplateFactory = ce;
268931
+ exports.ThumbCache = Yr;
268932
+ exports.UndoManager = Jn;
268818
268933
  exports.createAverager = createAverager;
268819
268934
  exports.deepDiff = deepDiff;
268820
268935
  exports.eulerDegToRad = eulerDegToRad;
268821
268936
  exports.eulerRadToDegRounded = eulerRadToDegRounded;
268822
268937
  exports.eulerToQuaternion = eulerToQuaternion;
268823
268938
  exports.eventBus = l$1;
268824
- exports.getDatatypeByName = E$1;
268825
- exports.getDatatypes = F;
268939
+ exports.getDatatypeByName = F;
268940
+ exports.getDatatypes = E$1;
268826
268941
  exports.getLongestSideOfBoundingBox = getLongestSideOfBoundingBox;
268827
268942
  exports.getSceneDebugInfo = getSceneDebugInfo;
268828
268943
  exports.getSceneGraphDebugInfo = getSceneGraphDebugInfo;
268829
268944
  exports.getSceneRelativeMatrix = getSceneRelativeMatrix;
268830
- exports.hasPermission = ie;
268945
+ exports.hasPermission = le;
268831
268946
  exports.logger = logger;
268832
268947
  exports.parseVectorFormulaSet = parseVectorFormulaSet;
268833
268948
  exports.profileAsyncBlock = v;
268834
268949
  exports.profileBlock = b;
268835
268950
  exports.quaternionToEuler = quaternionToEuler;
268836
268951
  exports.textureTools = textureTools;
268837
- exports.timeFunc = w;
268952
+ exports.timeFunc = _;
268838
268953
  exports.tools = tools;
268839
- exports.verifyAcl = ne;
268954
+ exports.verifyAcl = oe;
268840
268955
 
268841
268956
  return exports;
268842
268957