From 6e907dbc7087825a3a0342da66257328e2c6e7c0 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Tue, 19 Jun 2018 11:00:29 +0530 Subject: [PATCH] build --- app/Inconsolata.ttf | Bin app/index.html | 719 +- app/preview.html | 5 +- app/script.js | 81 +- app/service-worker.js | 12 +- app/style.css | 2 +- app/vendor.js | 55835 +++++++++++++++++++++++++++++++++++++++- 7 files changed, 55969 insertions(+), 685 deletions(-) mode change 100755 => 100644 app/Inconsolata.ttf diff --git a/app/Inconsolata.ttf b/app/Inconsolata.ttf old mode 100755 new mode 100644 diff --git a/app/index.html b/app/index.html index f50563f..5eb82fc 100644 --- a/app/index.html +++ b/app/index.html @@ -1,690 +1,63 @@ - + + Web Maker - + + + + + - + - + - + - + - - - + + + -
- -
-
-
-
- -
- - -
-
-
-
-
- - -
-
-
-
- -
- - -
-
-
-
-
- -
-
-
- Console (0) - -
-
-
- - - - -
-
-
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
- -
-

My Library

- - -
- - -
-
-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/app/preview.html b/app/preview.html index 8bddf9c..777c33f 100644 --- a/app/preview.html +++ b/app/preview.html @@ -2,8 +2,7 @@ - + - - + diff --git a/app/script.js b/app/script.js index 2a24ac4..5c242d8 100644 --- a/app/script.js +++ b/app/script.js @@ -1 +1,80 @@ -'serviceWorker'in navigator&&-1===document.cookie.indexOf('wmdebug')&&-1===location.href.indexOf('chrome-extension://')&&-1===location.href.indexOf('localhost')&&-1===location.href.indexOf('192.168')&&window.addEventListener('load',function(){navigator.serviceWorker.register('service-worker.js').then(function(e){e.onupdatefound=function(){var t=e.installing;t.onstatechange=function(){switch(t.state){case'installed':navigator.serviceWorker.controller?console.log('New or updated content is available.'):(console.log('Content is now available offline!'),window.alertsService&&window.alertsService.add('Web Maker is now ready to be used offline.'));break;case'redundant':console.error('The installing service worker became redundant.');}}}}).catch(function(t){console.error('Error during service worker registration:',t)})}),function(){window.DEBUG=-1[...document.querySelectorAll(e)];var e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';Node.prototype.nextUntil=function(e){const t=[...this.parentNode.querySelectorAll(e)],s=t.indexOf(this);return t[s+1]},window.requestIdleCallback=window.requestIdleCallback||function(e){setTimeout(e,10)},Node.prototype.previousUntil=function(e){const t=[...this.parentNode.querySelectorAll(e)],s=t.indexOf(this);return t[s-1]},window.utils={semverCompare:function(e,t){for(var s=e.split('.'),o=t.split('.'),n=0;3>n;n++){var i=+s[n],a=+o[n];if(i>a)return 1;if(a>i)return-1;if(!isNaN(i)&&isNaN(a))return 1;if(isNaN(i)&&!isNaN(a))return-1}return 0},generateRandomId:function(t){for(var s='',o=t||10;o--;)s+=e[~~(Math.random()*e.length)];return s},onButtonClick:function(e,t){e.addEventListener('click',function(s){return t(s),!1})},addInfiniteLoopProtection:function(e,{timeout:t}){var s=1,i=[],o='_wmloopvar',n=`\nif (Date.now() - %d > ${t}) { window.top.previewException(new Error("Infinite loop")); break;}\n`;return esprima.parse(e,{tolerant:!0,range:!0,jsx:!0},function(e){switch(e.type){case'DoWhileStatement':case'ForStatement':case'ForInStatement':case'ForOfStatement':case'WhileStatement':var t=1+e.body.range[0],a=e.body.range[1],l=n.replace('%d',o+s),r='';'BlockStatement'!==e.body.type&&(l='{'+l,r='}',--t),i.push({pos:t,str:l}),i.push({pos:a,str:r}),i.push({pos:e.range[0],str:'var %d = Date.now();\n'.replace('%d',o+s)}),++s;break;default:}}),i.sort(function(e,t){return t.pos-e.pos}).forEach(function(t){e=e.slice(0,t.pos)+t.str+e.slice(t.pos)}),e},getHumanDate:function(e){var t=new Date(e),s=t.getDate()+' '+['January','February','March','April','May','June','July','August','September','October','November','December'][t.getMonth()]+' '+t.getFullYear();return s},log:function(){window.DEBUG&&console.log(...arguments)},once:function(e,t,s){e.addEventListener(t,function(i){return i.target.removeEventListener(t,arguments.callee),s(i)})},downloadFile:function(e,t){function s(){var s=document.createElement('a');s.href=window.URL.createObjectURL(t),s.download=e,s.style.display='none',document.body.appendChild(s),s.click(),s.remove()}window.IS_EXTENSION?chrome.downloads.download({url:window.URL.createObjectURL(t),filename:e,saveAs:!0},()=>{chrome.runtime.lastError&&s()}):s()}},window.chrome=window.chrome||{},window.chrome.i18n={getMessage:()=>{}},window.IS_EXTENSION=!!window.chrome.extension,window.IS_EXTENSION?document.body.classList.add('is-extension'):document.body.classList.add('is-app')}(),(()=>{async function e(){return i?i:(utils.log('Initializing firestore'),i=new Promise((e,t)=>s?e(s):firebase.firestore().enablePersistence().then(function(){s=firebase.firestore(),utils.log('firebase db ready',s),e(s)}).catch(function(e){t(e.code),'failed-precondition'===e.code?(alert('Opening Web Maker web app in multiple tabs isn\'t supported at present and it seems like you already have it opened in another tab. Please use in one tab.'),window.trackEvent('fn','multiTabError')):'unimplemented'===e.code})),i)}const t=1;var s,i,o={get:(e,s)=>{const i={};'string'==typeof e?(i[e]=JSON.parse(window.localStorage.getItem(e)),setTimeout(()=>s(i),t)):(Object.keys(e).forEach((t)=>{const s=window.localStorage.getItem(t);i[t]=s===void 0||null===s?e[t]:JSON.parse(s)}),setTimeout(()=>s(i),t))},set:(e,s)=>{Object.keys(e).forEach((t)=>{window.localStorage.setItem(t,JSON.stringify(e[t]))}),setTimeout(()=>{if(s)return s()},t)}};const n=chrome&&chrome.storage?chrome.storage.local:o,a=chrome&&chrome.storage?chrome.storage.sync:o;window.db={getDb:e,getUser:async function(t){const s=await e();return s.doc(`users/${t}`).get().then((e)=>{if(!e.exists)return s.doc(`users/${t}`).set({},{merge:!0});const i=e.data();return Object.assign(window.user,i),i})},getUserLastSeenVersion:async function(){const e=deferred();return a.get({lastSeenVersion:''},(t)=>{e.resolve(t.lastSeenVersion)}),e.promise},setUserLastSeenVersion:async function(t){if(a.set({lastSeenVersion:t},function(){}),window.user){const s=await e();s.doc(`users/${window.user.uid}`).update({lastSeenVersion:t})}},getSettings:function(e){const t=deferred();return a.get(e,(e)=>{t.resolve(e)}),t.promise},local:n,sync:a}})(),window.logout=function(){firebase.auth().signOut()};function login(e){var t;return'facebook'===e?t=new firebase.auth.FacebookAuthProvider:'twitter'===e?t=new firebase.auth.TwitterAuthProvider:'google'===e?(t=new firebase.auth.GoogleAuthProvider,t.addScope('https://www.googleapis.com/auth/userinfo.profile')):t=new firebase.auth.GithubAuthProvider,firebase.auth().signInWithPopup(t).then(function(){window.trackEvent('fn','loggedIn',e),window.db.local.set({lastAuthProvider:e})}).catch(function(e){utils.log(e),'auth/account-exists-with-different-credential'===e.code&&alert('You have already signed up with the same email using different social login')})}window.login=login,window.trackEvent=function(e,t,s,i){return window.DEBUG?void utils.log('trackevent',e,t,s,i):void(window.ga&&ga('send','event',e,t,s,i))},navigator.onLine&&!window.DEBUG&&setTimeout(function(){(function(e,t,s,i,o,n,a){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,n=t.createElement(s),a=t.getElementsByTagName(s)[0],n.async=1,n.src=i,a.parentNode.insertBefore(n,a)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'),-1===location.href.indexOf('chrome-extension://')?ga('create','UA-87786708-1'):(ga('create','UA-87786708-1',{cookieDomain:'none'}),ga('set','checkProtocolTask',function(){})),ga('send','pageview')},100),function(){window.deferred=function(){var e={},t=new Promise(function(t,s){e.resolve=t,e.reject=s});return e.promise=t,Object.assign(e,t)}}(),function(e){window.loadJS=function(t){var s=deferred(),i=e.document.getElementsByTagName('script')[0],o=e.document.createElement('script');return o.src=t,o.async=!0,i.parentNode.insertBefore(o,i),o.onload=function(){s.resolve()},s.promise}}(window),function(){const e=$('#js-alerts-container');var t;window.alertsService={add:function(s){e.textContent=s,e.classList.add('is-active'),clearTimeout(t),t=setTimeout(function(){e.classList.remove('is-active')},2e3)}}}(),window.jsLibs=[{url:'https://code.jquery.com/jquery-3.2.1.min.js',label:'jQuery',type:'js'},{url:'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js',label:'Bootstrap 3',type:'js'},{url:'https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js',label:'Bootstrap 4',type:'js'},{url:'https://cdnjs.cloudflare.com/ajax/libs/foundation/6.4.3/js/foundation.min.js',label:'Foundation',type:'js'},{url:'https://semantic-ui.com/dist/semantic.min.js',label:'Semantic UI',type:'js'},{url:'https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js',label:'Angular',type:'js'},{url:'https://cdnjs.cloudflare.com/ajax/libs/react/16.2.0/umd/react.production.min.js',label:'React',type:'js'},{url:'https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.2.0/umd/react-dom.production.min.js',label:'React DOM',type:'js'},{url:'https://unpkg.com/vue/dist/vue.min.js',label:'Vue.js',type:'js'},{url:'https://cdnjs.cloudflare.com/ajax/libs/three.js/89/three.min.js',label:'Three.js',type:'js'},{url:'https://cdnjs.cloudflare.com/ajax/libs/d3/4.13.0/d3.min.js',label:'D3',type:'js'},{url:'https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js',label:'Underscore',type:'js'},{url:'https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TweenMax.min.js',label:'Greensock TweenMax',type:'js'},{url:'https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/uikit.min.js',label:'UIkit 2',type:'js'},{url:'https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.42/js/uikit.min.js',label:'UIkit 3',type:'js'}],window.cssLibs=[{url:'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css',label:'Bootstrap 3',type:'css'},{url:'https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css',label:'Bootstrap 4',type:'css'},{url:'https://cdnjs.cloudflare.com/ajax/libs/foundation/6.4.3/css/foundation.min.css',label:'Foundation',type:'css'},{url:'https://semantic-ui.com/dist/semantic.min.css',label:'Semantic UI',type:'css'},{url:'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css',label:'Bulma',type:'css'},{url:'https://cdnjs.cloudflare.com/ajax/libs/hint.css/2.5.0/hint.min.css',label:'Hint.css',type:'css'},{url:'https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css',label:'Tailwind.css',type:'css'},{url:'https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/uikit.min.css',label:'UIkit 2',type:'css'},{url:'https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.42/css/uikit.min.css',label:'UIkit 3',type:'css'},{url:'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css',label:'Animate.css',type:'css'},{url:'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',label:'FontAwesome 4',type:'css'},{url:'https://use.fontawesome.com/releases/v5.0.10/css/all.css',label:'FontAwesome 5',type:'css'}],function(){class e{constructor(e,t){this.t=e,this.filter=t.filter,this.selectedCallback=t.selectedCallback;var s=document.createElement('div');s.classList.add('btn-group'),e.parentElement.insertBefore(s,e),s.insertBefore(e,null),this.list=document.createElement('ul'),this.list.classList.add('dropdown__menu'),this.list.classList.add('autocomplete-dropdown'),s.insertBefore(this.list,null),this.loader=document.createElement('div'),this.loader.classList.add('loader'),this.loader.classList.add('autocomplete__loader'),this.loader.style.display='none',s.insertBefore(this.loader,null),setTimeout(()=>{requestIdleCallback(()=>{document.body.appendChild(this.list),this.list.style.position='fixed'})},100),this.t.addEventListener('input',(t)=>this.onInput(t)),this.t.addEventListener('keydown',(t)=>this.onKeyDown(t)),this.t.addEventListener('blur',(t)=>this.closeSuggestions(t)),this.list.addEventListener('mousedown',(t)=>this.onListMouseDown(t))}get currentLineNumber(){return this.t.value.substr(0,this.t.selectionStart).split('\n').length}get currentLine(){var e=this.currentLineNumber;return this.t.value.split('\n')[e-1]}closeSuggestions(){this.list.classList.remove('is-open'),this.isShowingSuggestions=!1}getList(e){return fetch('https://api.cdnjs.com/libraries?search='+e).then((e)=>e.json().then((e)=>e.results))}replaceCurrentLine(e){var t=this.t.value.split('\n');t.splice(this.currentLineNumber-1,1,e),this.t.value=t.join('\n')}onInput(){var e=this.currentLine;if(e){if(-1!==e.indexOf('/')||e.match(/https*:\/\//))return;clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.loader.style.display='block',this.getList(e).then((e)=>{if(this.loader.style.display='none',!e.length)return void this.closeSuggestions();this.list.innerHTML='',this.filter&&(e=e.filter(this.filter));for(var t=0;t${e[t].name}`;this.isShowingSuggestions=!0,this.textareaBounds||(this.textareaBounds=this.t.getBoundingClientRect(),this.list.style.top=this.textareaBounds.bottom+'px',this.list.style.left=this.textareaBounds.left+'px',this.list.style.width=this.textareaBounds.width+'px'),this.list.classList.add('is-open')})},500)}}onKeyDown(e){var t;this.isShowingSuggestions&&(27===e.keyCode&&(this.closeSuggestions(),e.stopPropagation()),40===e.keyCode&&this.isShowingSuggestions?(t=this.list.querySelector('.selected'),t?(t.classList.remove('selected'),t.nextElementSibling.classList.add('selected')):this.list.querySelector('li:first-child').classList.add('selected'),this.list.querySelector('.selected').scrollIntoView(!1),e.preventDefault()):38===e.keyCode&&this.isShowingSuggestions?(t=this.list.querySelector('.selected'),t?(t.classList.remove('selected'),t.previousElementSibling.classList.add('selected')):this.list.querySelector('li:first-child').classList.add('selected'),this.list.querySelector('.selected').scrollIntoView(!1),e.preventDefault()):13===e.keyCode&&this.isShowingSuggestions&&(t=this.list.querySelector('.selected'),this.selectSuggestion(t.dataset.url),this.closeSuggestions()))}onListMouseDown(e){var t=e.target;t.parentElement.dataset.url&&this.selectSuggestion(t.parentElement.dataset.url)}selectSuggestion(e){this.selectedCallback?this.selectedCallback.call(null,e):this.replaceCurrentLine(e),this.closeSuggestions()}}window.TextareaAutoComplete=e}(),(()=>{window.itemService={async getItem(e){var t=await window.db.getDb();return t.doc(`items/${e}`).get().then((e)=>e.data())},async getUserItemIds(){if(window.user)return new Promise((e)=>{e(window.user.items||{})});var e=await window.db.getDb();return e.doc(`users/${window.user.uid}`).get().then((e)=>e.exists?e.data().items:{})},async getAllItems(){var e=Date.now(),t=deferred();let s=await this.getUserItemIds();s=Object.getOwnPropertyNames(s||{}),utils.log('itemids',s),s.length||t.resolve([]);var i=await window.db.getDb();const o=[];return i.collection('items').where('createdBy','==',window.user.uid).onSnapshot(function(s){s.forEach(function(e){o.push(e.data())}),utils.log('Items fetched in ',Date.now()-e,'ms'),t.resolve(o)},function(){t.resolve([])}),t.promise},async setUser(){const e=await window.db.getDb();return e.doc(`users/${window.user.uid}`).set({items:{}})},async setItem(e,t){const s=deferred();var i;if(db.local.set({[e]:t},()=>{!window.IS_EXTENSION&&window.user&&navigator.onLine||s.resolve()}),'code'===e)return!1;if(window.user){var o=await window.db.getDb();utils.log(`Starting to save item ${e}`),t.createdBy=window.user.uid,i=o.collection('items').doc(e).set(t,{merge:!0}).then((e)=>{utils.log('Document written',e),s.resolve()}).catch(s.reject)}return window.user&&navigator.onLine?i:s.promise},saveItems(e){var t=deferred();return window.user?window.db.getDb().then((s)=>{const i=s.batch();for(var o in e)e[o].createdBy=window.user.uid,i.set(s.doc(`items/${o}`),e[o]),i.update(s.doc(`users/${window.user.uid}`),{[`items.${o}`]:!0}),window.user.items=window.user.items||{},window.user.items[o]=!0;i.commit().then(t.resolve)}):(window.db.local.set(e,t.resolve),window.db.local.get({items:{}},function(t){for(var s in e)t.items[s]=!0;window.db.local.set({items:t.items})})),t.promise},async removeItem(e){if(!window.user){var t=deferred();return db.local.remove(e,t.resolve),t.promise}const s=await window.db.getDb();return utils.log(`Starting to save item ${e}`),s.collection('items').doc(e).delete().then((e)=>{utils.log('Document removed',e)}).catch((e)=>utils.log(e))},async setItemForUser(e){if(!window.user)return window.db.local.get({items:{}},function(t){t.items[e]=!0,window.db.local.set({items:t.items})});const t=await window.db.getDb();return t.collection('users').doc(window.user.uid).update({[`items.${e}`]:!0}).then((t)=>{utils.log(`Item ${e} set for user`,t),window.user.items=window.user.items||{},window.user.items[e]=!0}).catch((e)=>utils.log(e))},async unsetItemForUser(e){if(!window.user)return window.db.local.get({items:{}},function(t){delete t.items[e],db.local.set({items:t.items})});const t=await window.db.getDb();return t.collection('users').doc(window.user.uid).update({[`items.${e}`]:firebase.firestore.FieldValue.delete()}).then((t)=>{delete window.user.items[e],utils.log(`Item ${e} unset for user`,t)}).catch((e)=>utils.log(e))}}})(),function(e,t){function s(){clearTimeout(s.timeout),s.timeout=setTimeout(function(){const e=2===ne||5===ne?'width':'height';[Ee,xe,Me].forEach(function(t){const s=t.getBoundingClientRect(),i=s[e];100>i?t.classList.add('is-minimized'):t.classList.remove('is-minimized'),-1===t.style[e].indexOf(`100% - ${2*ye}px`)?t.classList.remove('is-maximized'):t.classList.add('is-maximized')})},50)}function i(e){if(e.classList.contains('is-minimized')||e.classList.contains('is-maximized'))e.classList.remove('is-minimized'),e.classList.remove('is-maximized'),me.setSizes([33.3,33.3,33.3]);else{const s=parseInt(e.dataset.codeWrapId,10);var t=[`${ye}px`,`${ye}px`,`${ye}px`];t[s]=`calc(100% - ${2*ye}px)`,me.setSizes(t),e.classList.add('is-maximized')}}function o(){var e;return e=le&&le.mainSizes?3===ne?[le.mainSizes[1],le.mainSizes[0]]:le.mainSizes:5===ne?[75,25]:[50,50],e}function n(){me&&me.destroy(),ce&&ce.destroy();var e={direction:2===ne||5===ne?'horizontal':'vertical',minSize:ye,gutterSize:6,onDragStart:function(){document.body.classList.add('is-dragging')},onDragEnd:function(){s(),document.body.classList.remove('is-dragging')}};e.sizes=le&&le.sizes?le.sizes:[33.33,33.33,33.33],me=Split(['#js-html-code','#js-css-code','#js-js-code'],e),ce=Split(['#js-code-side','#js-demo-side'],{direction:2===ne?'vertical':'horizontal',minSize:150,gutterSize:6,sizes:o(),onDragEnd:function(){Ce.refreshOnResize&&setTimeout(function(){H.setPreviewContent(!0)},1)}})}function a(e){return e=500>window.innerWidth?2:e,ne===e?(ce.setSizes(o()),me.setSizes(le.sizes||[33.33,33.33,33.33]),void(ne=e)):void(ne=e,[1,2,3,4,5].forEach((e)=>{window[`layoutBtn${e}`].classList.remove('selected'),document.body.classList.remove(`layout-${e}`)}),$('#layoutBtn'+e).classList.add('selected'),document.body.classList.add('layout-'+e),n(),H.setPreviewContent(!0))}function l(){utils.log('onExternalLibChange'),r(),H.setPreviewContent(!0),e.add('Libraries updated.')}function r(){var e=0;e+=Be.value.split('\n').filter((e)=>!!e).length,e+=Fe.value.split('\n').filter((e)=>!!e).length,e?($('#js-external-lib-count').textContent=e,$('#js-external-lib-count').style.display='inline'):$('#js-external-lib-count').style.display='none'}function d(e,t){const s=deferred();return db.local.set({[e]:t},s.resolve),s.promise}function c(){if(!window.user&&!window.localStorage[se.LOGIN_AND_SAVE_MESSAGE_SEEN]){const e=confirm('Saving without signing in will save your work only on this machine and this browser. If you want it to be secure & available anywhere, please login in your account and then save.\n\nDo you still want to continue saving locally?');if(window.localStorage[se.LOGIN_AND_SAVE_MESSAGE_SEEN]=!0,!e)return trackEvent('ui',se.LOGIN_AND_SAVE_MESSAGE_SEEN,'login'),j(),void loginModal.classList.add('is-modal-visible');trackEvent('ui',se.LOGIN_AND_SAVE_MESSAGE_SEEN,'local')}var s=!le.id;le.id=le.id||'item-'+utils.generateRandomId(),saveBtn.classList.add('is-loading'),g().then(()=>{saveBtn.classList.remove('is-loading'),!pe&&Ce.autoSave&&(pe=!0,e.add('Auto-save enabled.'))}),s&&t.setItemForUser(le.id)}function m(){pe&&re&&c()}function u(){var e,t=2===ne||5===ne?'width':'height';try{e=[Ee.style[t],xe.style[t],Me.style[t]]}catch(t){e=[33.33,33.33,33.33]}finally{return e}}function p(){var e,t=2===ne?'height':'width';try{e=[+$('#js-code-side').style[t].match(/([\d.]+)%/)[1],+$('#js-demo-side').style[t].match(/([\d.]+)%/)[1]]}catch(t){e=[50,50]}finally{return e}}function g(s){return le.title=Pe.value,le.html=H.cm.html.getValue(),le.css=H.cm.css.getValue(),le.js=H.cm.js.getValue(),le.htmlMode=be,le.cssMode=Se,le.jsMode=fe,ee[Se].hasSettings&&(le.cssSettings={acssConfig:H.acssSettingsCm.getValue()}),le.updatedOn=Date.now(),le.layoutMode=ne,le.externalLibs={js:Be.value,css:Fe.value},le.sizes=u(),le.mainSizes=p(),utils.log('saving key',s||le.id,le),t.setItem(s||le.id,le).then(function(){window.user&&!navigator.onLine?e.add('Item saved locally. Will save to account when you are online.'):e.add('Item saved.'),re=0,saveBtn.classList.remove('is-marked')})}function h(e){var t='';e.length?(e.sort(function(e,t){return t.updatedOn-e.updatedOn}),e.forEach(function(e){t+='

'+e.title+'

Last updated: '+utils.getHumanDate(e.updatedOn)+'
'}),savedItemCountEl.textContent='('+e.length+')',savedItemCountEl.style.display='inline'):(t+='

Nothing saved here.

',savedItemCountEl.style.display='none'),Ie.querySelector('#js-saved-items-wrap').innerHTML=t,v()}function v(e){!1===e?Ie.classList.remove('is-open'):Ie.classList.toggle('is-open'),ke=Ie.classList.contains('is-open'),ke?searchInput.focus():(searchInput.value='',ue&&ue.focus()),document.body.classList[ke?'add':'remove']('overlay-visible')}async function b(e,s){var o=deferred();de={};var n=[];return window.user&&!s?(n=await t.getAllItems(),utils.log('got items'),e&&n.forEach((e)=>{de[e.id]=e}),o.resolve(n),o.promise):(db.local.get('items',function(t){var s=Object.getOwnPropertyNames(t.items||{});s.length||o.resolve([]),trackEvent('fn','fetchItems',s.length);for(let a=0;a{e.add('Item removed.'),le.id===s&&C()}),delete de[s],trackEvent('fn','itemRemoved'))}function w(){Pe.value=le.title||'Untitled',Be.value=le.externalLibs&&le.externalLibs.js||'',Fe.value=le.externalLibs&&le.externalLibs.css||'',utils.log('refresh editor'),be=le.htmlMode||Ce.htmlMode||X.HTML,Se=le.cssMode||Ce.cssMode||Z.CSS,fe=le.jsMode||Ce.jsMode||Q.JS,H.cm.html.setValue(le.html),H.cm.css.setValue(le.css),H.cm.js.setValue(le.js),H.cm.html.refresh(),H.cm.css.refresh(),H.cm.js.refresh(),H.acssSettingsCm.setValue(le.cssSettings?le.cssSettings.acssConfig:''),H.acssSettingsCm.refresh(),H.clearConsole(),r(),Promise.all([x(be),M(Se),T(fe)]).then(()=>H.setPreviewContent(!0)),a(le.layoutMode||Ce.layoutMode)}function j(){helpModal.classList.remove('is-modal-visible'),notificationsModal.classList.remove('is-modal-visible'),addLibraryModal.classList.remove('is-modal-visible'),onboardModal.classList.remove('is-modal-visible'),settingsModal.classList.remove('is-modal-visible'),cssSettingsModal.classList.remove('is-modal-visible'),keyboardShortcutsModal.classList.remove('is-modal-visible'),loginModal.classList.remove('is-modal-visible'),profileModal.classList.remove('is-modal-visible'),pledgeModal.classList.remove('is-modal-visible'),askToImportModal.classList.remove('is-modal-visible'),v(!1),document.dispatchEvent(new Event('overlaysClosed'))}function E(e){function t(){ee[e].hasLoaded=!0,i.resolve()}const s='lib/transpilers';var i=deferred();return ee[e].hasLoaded?(i.resolve(),i.promise):(e===X.JADE?loadJS(`${s}/jade.js`).then(t):e===X.MARKDOWN?loadJS(`${s}/marked.js`).then(t):e===Z.LESS?loadJS(`${s}/less.min.js`).then(t):e===Z.SCSS||e===Z.SASS?loadJS(`${s}/sass.js`).then(function(){ae=new Sass(`${s}/sass.worker.js`),t()}):e===Z.STYLUS?loadJS(`${s}/stylus.min.js`).then(t):e===Z.ACSS?loadJS(`${s}/atomizer.browser.js`).then(t):e===Q.COFFEESCRIPT?loadJS(`${s}/coffee-script.js`).then(t):e===Q.ES6?loadJS(`${s}/babel.min.js`).then(t):e===Q.TS?loadJS(`${s}/typescript.js`).then(t):i.resolve(),i.promise)}function x(e){return be=e,Oe.textContent=ee[e].label,Oe.parentElement.querySelector('select').value=e,H.cm.html.setOption('mode',ee[e].cmMode),CodeMirror.autoLoadMode(H.cm.html,ee[e].cmPath||ee[e].cmMode),E(e)}function M(e){return Se=e,De.textContent=ee[e].label,De.parentElement.querySelector('select').value=e,H.cm.css.setOption('mode',ee[e].cmMode),H.cm.css.setOption('readOnly',ee[e].cmDisable),cssSettingsBtn.classList[ee[e].hasSettings?'remove':'add']('hide'),CodeMirror.autoLoadMode(H.cm.css,ee[e].cmPath||ee[e].cmMode),E(e)}function T(e){return fe=e,_e.textContent=ee[e].label,_e.parentElement.querySelector('select').value=e,H.cm.js.setOption('mode',ee[e].cmMode),CodeMirror.autoLoadMode(H.cm.js,ee[e].cmPath||ee[e].cmMode),E(e)}function I(){var e=deferred(),t=H.cm.html.getValue();return be===X.HTML?e.resolve(t):be===X.MARKDOWN?e.resolve(marked?marked(t):t):be===X.JADE&&e.resolve(window.jade?jade.render(t):t),e.promise}function A(){var e=deferred(),t=H.cm.css.getValue();if(D('css'),Se===Z.CSS)e.resolve(t);else if(Se===Z.SCSS||Se===Z.SASS)ae&&t?ae.compile(t,{indentedSyntax:Se===Z.SASS},function(t){t.line&&t.message&&_('css',[{lineNumber:t.line-1,message:t.message}]),e.resolve(t.text)}):e.resolve(t);else if(Se===Z.LESS)less.render(t).then(function(t){e.resolve(t.css)},function(e){_('css',[{lineNumber:e.line,message:e.message}])});else if(Se===Z.STYLUS)stylus(t).render(function(t,s){if(t){window.err=t;var i=t.message.split('\n');i.pop(),_('css',[{lineNumber:+t.message.match(/stylus:(\d+):/)[1]-298,message:i.pop()}])}e.resolve(s)});else if(Se===Z.ACSS)if(!window.atomizer)e.resolve('');else{const t=H.cm.html.getValue(),i=atomizer.findClassNames(t);var s;try{s=atomizer.getConfig(i,JSON.parse(H.acssSettingsCm.getValue()))}catch(t){s=atomizer.getConfig(i,{})}const o=atomizer.getCss(s);H.cm.css.setValue(o),e.resolve(o)}return e.promise}function O(e){var t=deferred(),s=H.cm.js.getValue();if(D('js'),!s)return t.resolve(''),t.promise;if(fe===Q.JS)try{esprima.parse(s,{tolerant:!0})}catch(t){_('js',[{lineNumber:t.lineNumber-1,message:t.description}])}finally{!1!==e&&(s=utils.addInfiniteLoopProtection(s,{timeout:Ce.infiniteLoopTimeout})),t.resolve(s)}else if(fe===Q.COFFEESCRIPT){if(!window.CoffeeScript)return t.resolve(''),t.promise;try{s=CoffeeScript.compile(s,{bare:!0})}catch(t){_('js',[{lineNumber:t.location.first_line,message:t.message}])}finally{!1!==e&&(s=utils.addInfiniteLoopProtection(s,{timeout:Ce.infiniteLoopTimeout})),t.resolve(s)}}else if(fe===Q.ES6){if(!window.Babel)return t.resolve(''),t.promise;try{esprima.parse(s,{tolerant:!0,jsx:!0})}catch(t){_('js',[{lineNumber:t.lineNumber-1,message:t.description}])}finally{s=Babel.transform(s,{presets:['latest','stage-2','react']}).code,!1!==e&&(s=utils.addInfiniteLoopProtection(s,{timeout:Ce.infiniteLoopTimeout})),t.resolve(s)}}else if(fe===Q.TS)try{if(!window.ts)return t.resolve(''),t.promise;if(s=ts.transpileModule(s,{reportDiagnostics:!0,compilerOptions:{noEmitOnError:!0,diagnostics:!0,module:ts.ModuleKind.ES2015}}),s.diagnostics.length)throw{description:s.diagnostics[0].messageText,lineNumber:ts.getLineOfLocalPosition(s.diagnostics[0].file,s.diagnostics[0].start)};!1!==e&&(s=utils.addInfiniteLoopProtection(s.outputText,{timeout:Ce.infiniteLoopTimeout})),t.resolve(s)}catch(t){_('js',[{lineNumber:t.lineNumber-1,message:t.description}])}return t.promise}function D(e){H.cm[e].clearGutter('error-gutter')}function _(e,t){var s=H.cm[e];t.forEach(function(t){s.operation(function(){var e=document.createElement('div');e.setAttribute('data-title',t.message),e.classList.add('gutter-error-marker'),s.setGutterMarker(t.lineNumber,'error-gutter',e)})})}function P(e,t,s,i){var o=Be.value.split('\n').reduce(function(e,t){return e+(t?'\n':'')},''),n=Fe.value.split('\n').reduce(function(e,t){return e+(t?'\n':'')},''),a='\n\n\n\n'+n+'\n\n\n\n'+e+'\n'+o+'\n';if(i||(a+=''),fe===Q.ES6&&(a+=''),'string'==typeof s)a+='\n\n',a}function N(e,t,s){function i(e){return function(){utils.log(arguments),trackEvent('fn','error',e),N.errorCount=(N.errorCount||0)+1,4===N.errorCount&&setTimeout(function(){alert('Oops! Seems like your preview isn\'t updating. It\'s recommended to switch to the web app: https://webmakerapp.com/app/.\n\n If you still want to get the extension working, please try the following steps until it fixes:\n - Refresh Web Maker\n - Restart browser\n - Update browser\n - Reinstall Web Maker (don\'t forget to export all your creations from saved items pane (click the OPEN button) before reinstalling)\n\nIf nothing works, please tweet out to @webmakerApp.'),trackEvent('ui','writeFileMessageSeen')},1e3)}}var o=!1;window.webkitRequestFileSystem(window.TEMPORARY,5242880,function(n){n.root.getFile(e,{create:!0},function(e){e.createWriter((e)=>{e.onwriteend=function(){return o?s():(o=!0,e.seek(0),e.write(t),!1)},e.truncate(0)},i('createWriterFail'))},i('getFileFail'))},i('webkitRequestFileSystemFail'))}function B(e,t,s){const i=!window.webkitRequestFileSystem||!window.IS_EXTENSION;var o=P(e,t,i?s:null),n=new Blob([o],{type:'text/plain;charset=UTF-8'}),a=new Blob([s],{type:'text/plain;charset=UTF-8'});!trackEvent.hasTrackedCode&&(e||t||s)&&(trackEvent('fn','hasCode'),trackEvent.hasTrackedCode=!0),i?H.detachedWindow?(utils.log('\u2709\uFE0F Sending message to detached window'),H.detachedWindow.postMessage({contents:o},'*')):(je.src=je.src,setTimeout(()=>{je.contentDocument.open(),je.contentDocument.write(o),je.contentDocument.close()},10)):N('script.js',a,function(){N('preview.html',n,function(){var e=chrome.i18n.getMessage()?`chrome-extension://${chrome.i18n.getMessage('@@extension_id')}`:`${location.origin}`,t=`filesystem:${e}/temporary/preview.html`;H.detachedWindow?H.detachedWindow.postMessage(t,'*'):je.src=t})})}function F(){var e=I(),t=A(),s=O(!1);Promise.all([e,t,s]).then(function(e){var t=e[0],s=e[1],i=e[2],o=P(t,s,i,!0),n=new Date,a=['web-maker',n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds()].join('-');le.title&&(a=le.title),a+='.html';var l=new Blob([o],{type:'text/html;charset=UTF-8'});utils.downloadFile(a,l),trackEvent('fn','saveFileComplete')})}function z(e,t){var s=CodeMirror(e,{mode:t.mode,lineNumbers:!0,lineWrapping:!0,autofocus:t.autofocus||!1,autoCloseBrackets:!0,autoCloseTags:!0,matchBrackets:!0,matchTags:t.matchTags||!1,tabMode:'indent',keyMap:'sublime',theme:'monokai',lint:!!t.lint,tabSize:2,foldGutter:!0,styleActiveLine:!0,gutters:t.gutters||[],profile:t.profile||'',extraKeys:{Up:function(e){ke||CodeMirror.commands.goLineUp(e)},Down:function(e){ke||CodeMirror.commands.goLineDown(e)},"Shift-Tab":function(e){CodeMirror.commands.indentAuto(e)},Tab:function(e){if(t.emmet){const t=e.execCommand('emmetExpandAbbreviation');if(!0===t)return}const s=$('[data-setting=indentWith]:checked');e.somethingSelected()||s&&'spaces'!==s.value?CodeMirror.commands.defaultTab(e):CodeMirror.commands.insertSoftTab(e)},Enter:'emmetInsertLineBreak'}});return s.on('focus',(e)=>{ue=e}),s.on('change',function(e,t){clearTimeout(ie),ie=setTimeout(function(){'setValue'!==t.origin&&(!1!==Ce.autoPreview&&H.setPreviewContent(),saveBtn.classList.add('is-marked'),re+=1,0==re%he&&re>=he&&(saveBtn.classList.add('animated'),saveBtn.classList.add('wobble'),saveBtn.addEventListener('animationend',()=>{saveBtn.classList.remove('animated'),saveBtn.classList.remove('wobble')})),trackEvent.previewCount=(trackEvent.previewCount||0)+1,4===trackEvent.previewCount&&trackEvent('fn','usingPreview'))},ge)}),s.addKeyMap({"Ctrl-Space":'autocomplete'}),t.noAutocomplete||s.on('inputRead',function(e,t){Ce.autoComplete&&'+input'===t.origin&&';'!==t.text[0]&&','!==t.text[0]&&' '!==t.text[0]&&CodeMirror.commands.autocomplete(s,null,{completeSingle:!1})}),s}function V(){H.toggleModal(settingsModal)}function U(s){var i=[],o={};const n=deferred();s.forEach((e)=>{de[e.id]?i.push(e.id):(utils.log('merging',e.id),o[e.id]=e)});var a=s.length-i.length;if(i.length){var l=confirm(i.length+' creations already exist. Do you want to replace them?');l&&(utils.log('shouldreplace',l),s.forEach((e)=>{o[e.id]=e}),a=s.length)}return a?t.saveItems(o).then(()=>{n.resolve(),e.add(a+' creations imported successfully.'),trackEvent('fn','itemsImported',a)}):n.resolve(),v(!1),n.promise}function R(t){var e=t.target.files[0],s=new FileReader;s.onload=function(e){var t;try{t=JSON.parse(e.target.result),utils.log(t),U(t)}catch(e){utils.log(e),alert('Oops! Selected file is corrupted. Please select a file that was generated by clicking the "Export" button.')}},s.readAsText(e,'utf-8')}function W(e){function t(){var e='filesystem:chrome-extension://'+chrome.i18n.getMessage('@@extension_id')+'/temporary/'+d;chrome.downloads.download({url:e},function(){chrome.runtime.lastError&&window.open(e)})}function s(t){utils.log(t)}for(var o=atob(e.split(',')[1]),n=e.split(',')[0].split(':')[1].split(';')[0],a=new ArrayBuffer(o.length),l=new Uint8Array(a),r=0;r{e.root.getFile(d,{create:!0},(e)=>{e.createWriter((e)=>{e.onwriteend=t,e.write(i)},s)},s)},s)}function q(){var e=deferred();return window.IS_EXTENSION?(chrome.permissions.contains({permissions:['downloads']},function(t){t?e.resolve():chrome.permissions.request({permissions:['downloads']},function(t){t?(trackEvent('fn','downloadsPermGiven'),e.resolve()):e.reject()})}),e.promise):(e.resolve(),e.promise)}function K(){$('[data-setting=preserveLastCode]').checked=Ce.preserveLastCode,$('[data-setting=replaceNewTab]').checked=Ce.replaceNewTab,$('[data-setting=htmlMode]').value=Ce.htmlMode,$('[data-setting=cssMode]').value=Ce.cssMode,$('[data-setting=jsMode]').value=Ce.jsMode,$('[data-setting=indentSize]').value=Ce.indentSize,indentationSizeValueEl.textContent=Ce.indentSize,$('[data-setting=indentWith][value='+(Ce.indentWith||'spaces')+']').checked=!0,$('[data-setting=isCodeBlastOn]').checked=Ce.isCodeBlastOn,$('[data-setting=editorTheme]').value=Ce.editorTheme,$('[data-setting=keymap][value='+(Ce.keymap||'sublime')+']').checked=!0,$('[data-setting=fontSize]').value=Ce.fontSize||16,$('[data-setting=refreshOnResize]').checked=Ce.refreshOnResize,$('[data-setting=autoPreview]').checked=Ce.autoPreview,$('[data-setting=editorFont]').value=Ce.editorFont,$('[data-setting=editorCustomFont]').value=Ce.editorCustomFont,$('[data-setting=autoSave]').checked=Ce.autoSave,$('[data-setting=autoComplete]').checked=Ce.autoComplete,$('[data-setting=preserveConsoleLogs]').checked=Ce.preserveConsoleLogs,$('[data-setting=lightVersion]').checked=Ce.lightVersion,$('[data-setting=lineWrap]').checked=Ce.lineWrap,$('[data-setting=infiniteLoopTimeout]').value=Ce.infiniteLoopTimeout}function G(e){function t(t){const e=s(`[d-${t}]`);e.forEach(function(s){s.addEventListener(t,function(i){H[s.getAttribute(`d-${t}`)].call(window,i)})})}e instanceof Node||(e=document);const s=(t)=>[...e.querySelectorAll(t)];t('click'),t('change'),t('input'),t('keyup');const i=s(`[d-open-modal]`);i.forEach(function(e){utils.onButtonClick(e,function(){H.toggleModal(window[e.getAttribute('d-open-modal')]),trackEvent(e.getAttribute('data-event-category'),e.getAttribute('data-event-action'))})});const o=s(`[d-html]`);o.forEach(function(e){fetch(e.getAttribute('d-html')).then((t)=>{e.removeAttribute('d-html'),t.text().then((t)=>{requestIdleCallback(()=>{e.innerHTML=t,G(e)})})})})}var H=H||{},Y='3.2.0';window.DEBUG&&(window.scope=H);const J={preserveLastCode:!0,replaceNewTab:!1,htmlMode:'html',jsMode:'js',cssMode:'css',isCodeBlastOn:!1,indentWith:'spaces',indentSize:2,editorTheme:'monokai',keymap:'sublime',fontSize:16,refreshOnResize:!1,autoPreview:!0,editorFont:'FiraCode',editorCustomFont:'',autoSave:!0,autoComplete:!0,preserveConsoleLogs:!0,lightVersion:!1,lineWrap:!0,infiniteLoopTimeout:1e3};var X={HTML:'html',MARKDOWN:'markdown',JADE:'jade'},Z={CSS:'css',SCSS:'scss',SASS:'sass',LESS:'less',STYLUS:'stylus',ACSS:'acss'},Q={JS:'js',ES6:'es6',COFFEESCRIPT:'coffee',TS:'typescript'},ee={};ee[X.HTML]={label:'HTML',cmMode:'htmlmixed',codepenVal:'none'},ee[X.MARKDOWN]={label:'Markdown',cmMode:'markdown',codepenVal:'markdown'},ee[X.JADE]={label:'Pug',cmMode:'pug',codepenVal:'pug'},ee[Q.JS]={label:'JS',cmMode:'javascript',codepenVal:'none'},ee[Q.COFFEESCRIPT]={label:'CoffeeScript',cmMode:'coffeescript',codepenVal:'coffeescript'},ee[Q.ES6]={label:'ES6 (Babel)',cmMode:'jsx',codepenVal:'babel'},ee[Q.TS]={label:'TypeScript',cmPath:'jsx',cmMode:'text/typescript-jsx',codepenVal:'typescript'},ee[Z.CSS]={label:'CSS',cmPath:'css',cmMode:'css',codepenVal:'none'},ee[Z.SCSS]={label:'SCSS',cmPath:'css',cmMode:'text/x-scss',codepenVal:'scss'},ee[Z.SASS]={label:'SASS',cmMode:'sass',codepenVal:'sass'},ee[Z.LESS]={label:'LESS',cmPath:'css',cmMode:'text/x-less',codepenVal:'less'},ee[Z.STYLUS]={label:'Stylus',cmMode:'stylus',codepenVal:'stylus'},ee[Z.ACSS]={label:'Atomic CSS',cmPath:'css',cmMode:'css',codepenVal:'notsupported',cmDisable:!0,hasSettings:!0};const te=chrome.extension||window.DEBUG?'/':'/app',se={LOGIN_AND_SAVE_MESSAGE_SEEN:'loginAndsaveMessageSeen',ASKED_TO_IMPORT_CREATIONS:'askedToImportCreations'};var ie,oe,ne,ae,le,re,de,ce,me,ue,pe,ge=500,he=15,ve=!0,be=X.HTML,fe=Q.JS,Se=Z.CSS,ye=33,Ce={},Le={html:null,css:null,js:null},ke=!1,we=0,je=$('#demo-frame'),Ee=$('#js-html-code'),xe=$('#js-css-code'),Me=$('#js-js-code'),Te=$('#js-codepen-form'),Ie=$('#js-saved-items-pane'),Ae=$('#js-saved-items-pane-close-btn'),Oe=$('#js-html-mode-label'),De=$('#js-css-mode-label'),_e=$('#js-js-mode-label'),Pe=$('#js-title-input'),Ne=$('#js-add-library-select'),Be=$('#js-external-js'),Fe=$('#js-external-css');H.cm={},H.frame=je,H.demoFrameDocument=je.contentDocument||je.contentWindow.document,window.previewException=function(e){console.error('Possible infinite loop detected.',e.stack),window.onMessageFromConsole('Possible infinite loop detected.',e.stack)},window.onunload=function(){g('code'),H.detachedWindow&&H.detachedWindow.close()},H.setPreviewContent=function(e,t){if(!Ce.autoPreview&&!t)return;Ce.preserveConsoleLogs||H.clearConsole();var s={html:H.cm.html.getValue(),css:H.cm.css.getValue(),js:H.cm.js.getValue()};utils.log('\uD83D\uDD0E setPreviewContent',e);const i=H.detachedWindow?H.detachedWindow.document.querySelector('iframe'):je;if(!e&&s.html===Le.html&&s.js===Le.js)A().then(function(e){i.contentDocument.querySelector('#webmakerstyle')&&(i.contentDocument.querySelector('#webmakerstyle').textContent=e)});else{var o=I(),n=A(),a=O();Promise.all([o,n,a]).then(function(e){B(e[0],e[1],e[2])})}Le.html=s.html,Le.css=s.css,Le.js=s.js},H.cm.html=z(Ee,{mode:'htmlmixed',profile:'xhtml',gutters:['CodeMirror-linenumbers','CodeMirror-foldgutter'],noAutocomplete:!0,matchTags:{bothTags:!0},emmet:!0}),H.cm.css=z(xe,{mode:'css',gutters:['error-gutter','CodeMirror-linenumbers','CodeMirror-foldgutter'],emmet:!0}),Inlet(H.cm.css),H.cm.js=z(Me,{mode:'javascript',gutters:['error-gutter','CodeMirror-linenumbers','CodeMirror-foldgutter']}),Inlet(H.cm.js),H.consoleCm=CodeMirror(consoleLogEl,{mode:'javascript',lineWrapping:!0,theme:'monokai',foldGutter:!0,readOnly:!0,gutters:['CodeMirror-foldgutter']}),H.onModalSettingsLinkClick=function(){V(),trackEvent('ui','onboardSettingsBtnClick')},H.onShowInTabClicked=function(){trackEvent('ui','onboardShowInTabClick')},H.onDontShowInTabClicked=function(){trackEvent('ui','onboardDontShowInTabClick')},H.exportItems=function(t){q().then(()=>{b().then(function(e){var t=new Date,s=['web-maker-export',t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()].join('-');s+='.json';var i=new Blob([JSON.stringify(e,!1,2)],{type:'application/json;charset=UTF-8'});utils.downloadFile(s,i),trackEvent('ui','exportBtnClicked')})}),t.preventDefault()},H.onImportBtnClicked=function(t){var e=document.createElement('input');e.type='file',e.style.display='none',e.accept='accept="application/json',document.body.appendChild(e),e.addEventListener('change',R),e.click(),trackEvent('ui','importBtnClicked'),t.preventDefault()},H.takeScreenshot=function(t){q().then(()=>{function e(t){var s=document.createElement('canvas'),i=je.getBoundingClientRect();s.width=i.width,s.height=i.height;var o=s.getContext('2d'),n=window.devicePixelRatio||1;o.drawImage(t,i.left*n,i.top*n,i.width*n,i.height*n,0,0,i.width,i.height),t.removeEventListener('load',e),W(s.toDataURL())}var t=document.createElement('style');t.textContent='[class*="hint"]:after, [class*="hint"]:before { display: none!important; }',document.body.appendChild(t),setTimeout(()=>{chrome.tabs.captureVisibleTab(null,{format:'png',quality:100},function(s){if(t.remove(),s){var i=new Image;i.src=s,i.addEventListener('load',()=>e(i,s))}})},50),trackEvent('ui','takeScreenshotBtnClick')}),t.preventDefault()},H.updateSetting=function(t){if(t){var s=t.target.dataset.setting,i={},o=t.target;utils.log(s,'checkbox'===o.type?o.checked:o.value),Ce[s]='checkbox'===o.type?o.checked:o.value,i[s]=Ce[s],db.sync.set(i,function(){e.add('Setting saved')}),window.user&&window.db.getDb().then((e)=>{e.collection('users').doc(window.user.uid).update({[`settings.${s}`]:Ce[s]}).then((e)=>{utils.log(`Setting "${s}" for user`,e)}).catch((e)=>utils.log(e))}),trackEvent('ui','updatePref-'+s,Ce[s])}runBtn.classList[Ce.autoPreview?'add':'remove']('hide'),Ee.querySelector('.CodeMirror').style.fontSize=Ce.fontSize,xe.querySelector('.CodeMirror').style.fontSize=Ce.fontSize,Me.querySelector('.CodeMirror').style.fontSize=Ce.fontSize,consoleEl.querySelector('.CodeMirror').style.fontSize=Ce.fontSize,indentationSizeValueEl.textContent=$('[data-setting=indentSize]').value,editorThemeLinkTag.href=`lib/codemirror/theme/${Ce.editorTheme}.css`,fontStyleTag.textContent=fontStyleTemplate.textContent.replace(/fontname/g,('other'===Ce.editorFont?Ce.editorCustomFont:Ce.editorFont)||'FiraCode'),customEditorFontInput.classList['other'===Ce.editorFont?'remove':'add']('hide'),['html','js','css'].forEach((e)=>{H.cm[e].setOption('indentWithTabs','spaces'!==$('[data-setting=indentWith]:checked').value),H.cm[e].setOption('blastCode',!!$('[data-setting=isCodeBlastOn]').checked&&{effect:2,shake:!1}),H.cm[e].setOption('indentUnit',+$('[data-setting=indentSize]').value),H.cm[e].setOption('tabSize',+$('[data-setting=indentSize]').value),H.cm[e].setOption('theme',$('[data-setting=editorTheme]').value),H.cm[e].setOption('keyMap',$('[data-setting=keymap]:checked').value),H.cm[e].setOption('lineWrapping',$('[data-setting=lineWrap]').checked),H.cm[e].refresh()}),H.consoleCm.setOption('theme',$('[data-setting=editorTheme]').value),H.acssSettingsCm.setOption('theme',$('[data-setting=editorTheme]').value),Ce.autoSave?!oe&&(oe=setInterval(m,15000)):(clearInterval(oe),oe=null),document.body.classList[Ce.lightVersion?'add':'remove']('light-version')},H.onNewBtnClick=function(){if(trackEvent('ui','newBtnClick'),re){var e=confirm('You have unsaved changes. Do you still want to create something new?');e&&C()}else C()},H.onOpenBtnClick=function(){trackEvent('ui','openBtnClick'),f()},H.onSaveBtnClick=function(){trackEvent('ui','saveBtnClick',le.id?'saved':'new'),c()},H.toggleModal=function(e){e.classList.toggle('is-modal-visible');const t=e.classList.contains('is-modal-visible');if(document.body.classList[t?'add':'remove']('overlay-visible'),t){function t(){e.querySelector('.js-modal__close-btn').focus(),e.querySelector('.modal__content').removeEventListener('transitionend',t)}e.querySelector('.modal__content').addEventListener('transitionend',t)}},H.onSearchInputChange=function(t){const e=t.target.value;let s;for(const[i,o]of Object.entries(de))s=$(`#js-saved-items-pane [data-item-id=${i}]`),-1===o.title.toLowerCase().indexOf(e)?s.classList.add('hide'):s.classList.remove('hide');trackEvent('ui','searchInputType')},H.toggleConsole=function(){consoleEl.classList.toggle('is-minimized'),trackEvent('ui','consoleToggle')},H.clearConsole=window.clearConsole=function(){H.consoleCm.setValue(''),we=0,logCountEl.textContent=we},H.onClearConsoleBtnClick=function(){H.clearConsole(),trackEvent('ui','consoleClearBtnClick')},H.evalConsoleExpr=function(t){(76===t.which||12===t.which)&&t.ctrlKey?(H.clearConsole(),trackEvent('ui','consoleClearKeyboardShortcut')):13===t.which&&(window.onMessageFromConsole('> '+t.target.value),je.contentWindow._wmEvaluate(t.target.value),t.target.value='',trackEvent('fn','evalConsoleExpr'))},window.onMessageFromConsole=function(){[...arguments].forEach(function(e){e&&e.indexOf&&-1!==e.indexOf('filesystem:chrome-extension')&&(e=e.replace(/filesystem:chrome-extension.*\.js:(\d+):*(\d*)/g,'script $1:$2'));try{H.consoleCm.replaceRange(e+' '+((e+'').match(/\[object \w+]/)?JSON.stringify(e):'')+'\n',{line:Infinity})}catch(t){H.consoleCm.replaceRange('\uD83C\uDF00\n',{line:Infinity})}H.consoleCm.scrollTo(0,Infinity),we++}),logCountEl.textContent=we},H.onRunBtnClick=function(){H.setPreviewContent(!0,!0),trackEvent('ui','runBtnClick')},H.openDetachedPreview=function(){if(trackEvent('ui','detachPreviewBtnClick'),H.detachedWindow)return void H.detachedWindow.focus();var e=je.getBoundingClientRect();const t=e.width,s=e.height;document.body.classList.add('is-detached-mode'),globalConsoleContainerEl.insertBefore(consoleEl,null),H.detachedWindow=window.open('./preview.html','Web Maker',`width=${t},height=${s},resizable,scrollbars=yes,status=1`),setTimeout(()=>{H.setPreviewContent(!0)},1500);var i=window.setInterval(function(){H.detachedWindow&&H.detachedWindow.closed&&(clearInterval(i),document.body.classList.remove('is-detached-mode'),$('#js-demo-side').insertBefore(consoleEl,null),H.detachedWindow=null,H.setPreviewContent(!0))},500)},H.openCssSettingsModal=function(){H.toggleModal(cssSettingsModal),setTimeout(()=>{H.acssSettingsCm.refresh(),H.acssSettingsCm.focus()},500),trackEvent('ui','cssSettingsBtnClick')},H.onModalCloseBtnClick=function(t){j(),t.preventDefault()},H.openSupportDeveloperModal=function(t){j(),H.toggleModal(pledgeModal),t&&trackEvent('ui',t.target.dataset.eventAction)},H.updateProfileUi=()=>{window.user?(document.body.classList.add('is-logged-in'),headerAvatarImg.src=profileAvatarImg.src=window.user.photoURL||'data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\'%3E%3Cpath fill=\'#ccc\' d=\'M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z\' /%3E%3C/svg%3E',profileUserName.textContent=window.user.displayName||'Anonymous Creator'):(document.body.classList.remove('is-logged-in'),headerAvatarImg.src=profileAvatarImg.src='',profileUserName.textContent='Anonymous Creator')},H.login=(t)=>{const e=t.target.dataset.authProvider;trackEvent('ui','loginProviderClick',e),window.login(e),t&&t.preventDefault()},H.logout=(t)=>{if(t.preventDefault(),re){var e=confirm('You have unsaved changes. Do you still want to logout?');if(!e)return}trackEvent('fn','loggedOut'),window.logout()},H.dontAskToImportAnymore=(t)=>{H.toggleModal(askToImportModal),window.localStorage[se.ASKED_TO_IMPORT_CREATIONS]=!0,t&&trackEvent('ui','dontAskToImportBtnClick')},H.importCreationsAndSettingsIntoApp=()=>{U(H.oldSavedItems).then(()=>{trackEvent('fn','oldItemsImported'),H.dontAskToImportAnymore()})},H.closeAllOverlays=j,function(){function t(e){return function(){return d('layoutMode',e),trackEvent('ui','toggleLayoutClick',e),a(e),!1}}function o(t){consoleEl.style.height=p+u-t.pageY+'px'}firebase.initializeApp({apiKey:'AIzaSyBl8Dz7ZOE7aP75mipYl2zKdLSRzBU2fFc',authDomain:'web-maker-app.firebaseapp.com',databaseURL:'https://web-maker-app.firebaseio.com',projectId:'web-maker-app',storageBucket:'web-maker-app.appspot.com',messagingSenderId:'560473480645'}),firebase.auth().onAuthStateChanged(function(t){H.closeAllOverlays(),t?(utils.log('You are -> ',t),e.add('You are now logged in!'),H.user=window.user=t,!window.localStorage[se.ASKED_TO_IMPORT_CREATIONS]&&window.oldSavedCreationsCountEl&&b(!1,!0).then((e)=>{e.length&&(H.oldSavedItems=e,window.oldSavedCreationsCountEl.textContent=e.length,H.toggleModal(askToImportModal),trackEvent('ui','askToImportModalSeen'))}),window.db.getUser(t.uid).then((e)=>{e&&(Object.assign(Ce,t.settings),K(),H.updateSetting())})):delete window.user,H.updateProfileUi()});var n;CodeMirror.modeURL=`lib/codemirror/mode/%N/%N.js`,window.db.local.get({lastAuthProvider:''},(e)=>{e.lastAuthProvider&&document.body.classList.add(`last-login-${e.lastAuthProvider}`)}),document.body.style.height=`${window.innerHeight}px`,layoutBtn1.addEventListener('click',t(1)),layoutBtn2.addEventListener('click',t(2)),layoutBtn3.addEventListener('click',t(3)),layoutBtn4.addEventListener('click',t(4)),layoutBtn5.addEventListener('click',t(5)),notificationsBtn.addEventListener('click',function(){return H.toggleModal(notificationsModal),notificationsModal.classList.contains('is-modal-visible')&&!ve&&(ve=!0,notificationsBtn.classList.remove('has-new'),window.db.setUserLastSeenVersion(Y)),trackEvent('ui','notificationButtonClick',Y),!1}),codepenBtn.addEventListener('click',function(t){if(Se===Z.ACSS)return alert('Oops! CodePen doesn\'t supports Atomic CSS currently.'),void t.preventDefault();var e={title:'A Web Maker experiment',html:H.cm.html.getValue(),css:H.cm.css.getValue(),js:H.cm.js.getValue(),html_pre_processor:ee[be].codepenVal,css_pre_processor:ee[Se].codepenVal,js_pre_processor:ee[fe].codepenVal,css_external:Fe.value.split('\n').join(';'),js_external:Be.value.split('\n').join(';')};le.title.match(/Untitled\s\d\d*-\d/)||(e.title=le.title),e=JSON.stringify(e),Te.querySelector('input').value=e,Te.submit(),trackEvent('ui','openInCodepen'),t.preventDefault()}),utils.onButtonClick(saveHtmlBtn,function(){F(),trackEvent('ui','saveHtmlClick')}),utils.onButtonClick(Ae,v),utils.onButtonClick(Ie,function(t){t.target.classList.contains('js-saved-item-tile')&&(setTimeout(function(){L(t.target.dataset.itemId)},350),v()),t.target.classList.contains('js-saved-item-tile__remove-btn')?k(t.target.parentElement.parentElement.dataset.itemId):t.target.classList.contains('js-saved-item-tile__fork-btn')&&(v(),setTimeout(function(){y(de[t.target.parentElement.parentElement.dataset.itemId])},350))}),Pe.addEventListener('blur',function(){le.id&&(c(),trackEvent('ui','titleChanged'))}),$all('.js-mode-select').forEach((e)=>{e.addEventListener('change',function(t){var e=t.target.value,s=t.target.dataset.type,i='html'===s?be:'css'===s?Se:fe;i!==e&&('html'===s?x(e).then(()=>H.setPreviewContent(!0)):'js'===s?T(e).then(()=>H.setPreviewContent(!0)):'css'===s&&M(e).then(()=>H.setPreviewContent(!0)),trackEvent('ui','updateCodeMode',e))})});var r=$all('.js-code-collapse-btn');r.forEach(function(e){e.addEventListener('click',function(t){var e=t.currentTarget.parentElement.parentElement.parentElement;return i(e),trackEvent('ui','paneCollapseBtnClick',e.dataset.type),!1})}),[Ee,xe,Me].forEach(function(e){e.addEventListener('transitionend',function(){s()})}),window.addEventListener('keydown',function(e){(e.ctrlKey||e.metaKey)&&83===e.keyCode&&(e.preventDefault(),c(),trackEvent('ui','saveItemKeyboardShortcut')),(e.ctrlKey||e.metaKey)&&e.shiftKey&&53===e.keyCode?(e.preventDefault(),H.setPreviewContent(!0,!0),trackEvent('ui','previewKeyboardShortcut')):(e.ctrlKey||e.metaKey)&&79===e.keyCode?(e.preventDefault(),f(),trackEvent('ui','openCreationKeyboardShortcut')):(e.ctrlKey||e.metaKey)&&e.shiftKey&&191===e.keyCode?(e.preventDefault(),H.toggleModal(keyboardShortcutsModal),trackEvent('ui','showKeyboardShortcutsShortcut')):27===e.keyCode&&j()}),Ie.addEventListener('keydown',function(e){if(!ke)return;const t=e.ctrlKey||e.metaKey,s=t&&70===e.keyCode,i=40===e.keyCode,o=38===e.keyCode,n=13===e.keyCode,a=$('.js-saved-item-tile.selected'),l=0!==$all('.js-saved-item-tile').length;if((i||o)&&l){const e=i?'nextUntil':'previousUntil';a?(a.classList.remove('selected'),a[e]('.js-saved-item-tile:not(.hide)').classList.add('selected')):$('.js-saved-item-tile:not(.hide)').classList.add('selected'),$('.js-saved-item-tile.selected').scrollIntoView(!1)}n&&a&&(setTimeout(function(){L(a.dataset.itemId)},350),v()),s&&(e.preventDefault(),setTimeout(function(){y(de[a.dataset.itemId])},350),v(),trackEvent('ui','forkKeyboardShortcut'))}),window.addEventListener('click',function(t){'string'!=typeof t.target.className||(t.target.classList.contains('modal-overlay')||t.target.classList.contains('modal'))&&j()}),window.addEventListener('dblclick',function(t){var e=t.target;if(e.classList.contains('js-console__header')&&(H.toggleConsole(),trackEvent('ui','consoleToggleDblClick')),e.classList.contains('js-code-wrap__header')){var s=e.parentElement;i(s),trackEvent('ui','paneHeaderDblClick',s.dataset.type)}});var m=window.jsLibs.reduce((e,t)=>e+``,'');Ne.children[1].innerHTML=m,m=window.cssLibs.reduce((e,t)=>e+``,''),Ne.children[2].innerHTML=m,Ne.addEventListener('change',function(t){var e=t.target;e.value&&($('#js-external-'+e.selectedOptions[0].dataset.type).value+='\n'+e.value,trackEvent('ui','addLibrarySelect',e.selectedOptions[0].label),l(),e.value='')}),Be.addEventListener('blur',l),Fe.addEventListener('blur',l),new TextareaAutoComplete(Be,{filter:(e)=>e.latest.match(/\.js$/)}),new TextareaAutoComplete(Fe,{filter:(e)=>e.latest.match(/\.css$/)}),new TextareaAutoComplete(externalLibrarySearchInput,{selectedCallback:(e)=>{const t=e.match(/\.js$/)?Be:Fe;t.value=`${t.value}\n${e}`,externalLibrarySearchInput.value=''}});var u,p;$('.js-console__header').addEventListener('mousedown',(t)=>{u=t.pageY,p=consoleEl.getBoundingClientRect().height,$('#demo-frame').classList.add('pointer-none'),window.addEventListener('mousemove',o)}),$('.js-console__header').addEventListener('mouseup',()=>{window.removeEventListener('mousemove',o),$('#demo-frame').classList.remove('pointer-none')}),db.local.get({layoutMode:1,code:''},function(e){a(e.layoutMode),Ce.layoutMode=e.layoutMode,e.code&&(n=e.code)}),db.getSettings(J).then((e)=>{e.preserveLastCode&&n?(re=0,n.id&&window.IS_EXTENSION?db.local.get(n.id,function(e){e[n.id]&&(utils.log('Load item ',n.id),le=e[n.id],w())}):(utils.log('Load last unsaved item',n),le=n,w())):C(),Object.assign(Ce,e),K(),H.updateSetting()}),db.getUserLastSeenVersion().then((e)=>{e||(onboardModal.classList.add('is-modal-visible'),-1===document.cookie.indexOf('onboarded')&&(trackEvent('ui','onboardModalSeen',Y),document.cookie='onboarded=1'),window.db.setUserLastSeenVersion(Y)),e&&-1===utils.semverCompare(e,Y)&&!window.localStorage.pledgeModalSeen&&(H.openSupportDeveloperModal(),window.localStorage.pledgeModalSeen=!0),e&&-1!==utils.semverCompare(e,Y)||(notificationsBtn.classList.add('has-new'),ve=!1)}),H.acssSettingsCm=CodeMirror.fromTextArea(acssSettingsTextarea,{mode:'application/ld+json'}),H.acssSettingsCm.on('blur',()=>{H.setPreviewContent(!0)});var g='';['3024-day','3024-night','abcdef','ambiance','base2tone-meadow-dark','base16-dark','base16-light','bespin','blackboard','cobalt','colorforth','dracula','duotone-dark','duotone-light','eclipse','elegant','erlang-dark','hopscotch','icecoder','isotope','lesser-dark','liquibyte','material','mbo','mdn-like','midnight','monokai','neat','neo','night','panda-syntax','paraiso-dark','paraiso-light','pastel-on-dark','railscasts','rubyblue','seti','solarized dark','solarized light','the-matrix','tomorrow-night-bright','tomorrow-night-eighties','ttcn','twilight','vibrant-ink','xq-dark','xq-light','yeti','zenburn'].forEach((e)=>{g+=''}),document.querySelector('[data-setting="editorTheme"]').innerHTML=g,requestAnimationFrame(G),window.addEventListener('focusin',(t)=>{if(document.body.classList.contains('overlay-visible')){const e=$('.is-modal-visible');if(!e)return;e.contains(t.target)||(t.preventDefault(),e.querySelector('.js-modal__close-btn').focus())}})}()}(window.alertsService,window.itemService),function(e){function t(e){s&&(!e||e!==s)&&(s.classList.remove('open'),s=null)}var s;(function(){var i=e('[dropdown]');i.forEach(function(e){e.addEventListener('click',function(i){t(i.currentTarget),i.currentTarget.classList.toggle('open'),s=i.currentTarget,i.stopPropagation()})}),document.addEventListener('click',function(){t()})})()}($all); \ No newline at end of file +/** + * Copyright 2015 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* eslint-env browser */ + +if ( + 'serviceWorker' in navigator && + document.cookie.indexOf('wmdebug') === -1 && + location.href.indexOf('chrome-extension://') === -1 && + location.href.indexOf('localhost') === -1 && + location.href.indexOf('192.168') === -1 +) { + // Delay registration until after the page has loaded, to ensure that our + // precaching requests don't degrade the first visit experience. + // See https://developers.google.com/web/fundamentals/instant-and-offline/service-worker/registration + window.addEventListener('load', function() { + // Your service-worker.js *must* be located at the top-level directory relative to your site. + // It won't be able to control pages unless it's located at the same level or higher than them. + // *Don't* register service worker file in, e.g., a scripts/ sub-directory! + // See https://github.com/slightlyoff/ServiceWorker/issues/468 + navigator.serviceWorker + .register('service-worker.js') + .then(function(reg) { + // updatefound is fired if service-worker.js changes. + reg.onupdatefound = function() { + // The updatefound event implies that reg.installing is set; see + // https://w3c.github.io/ServiceWorker/#service-worker-registration-updatefound-event + var installingWorker = reg.installing; + + installingWorker.onstatechange = function() { + /* eslint-disable default-case */ + switch (installingWorker.state) { + case 'installed': + if (navigator.serviceWorker.controller) { + // At this point, the old content will have been purged and the fresh content will + // have been added to the cache. + // It's the perfect time to display a "New content is available; please refresh." + // message in the page's interface. + console.log('New or updated content is available.'); + } else { + // At this point, everything has been precached. + // It's the perfect time to display a "Content is cached for offline use." message. + console.log('Content is now available offline!'); + if (window.alertsService) { + window.alertsService.add( + 'Web Maker is now ready to be used offline.' + ); + } + } + break; + + case 'redundant': + console.error( + 'The installing service worker became redundant.' + ); + break; + } + }; + }; + }) + .catch(function(e) { + console.error('Error during service worker registration:', e); + }); + }); +} + +webpackJsonp([0],{JkW7:function(e,t,n){"use strict";function o(){var e={},t=new Promise(function(t,n){e.resolve=t,e.reject=n});return e.promise=t,V(e,t)}function s(e,t){var n=o();return t===P.HTML?n.resolve({code:e}):t===P.MARKDOWN?n.resolve(window.marked?{code:marked(e)}:{code:e}):t===P.JADE&&n.resolve(window.jade?{code:jade.render(e)}:{code:e}),n.promise}function i(e,t,n){var s,i=o();if(t===D.CSS)i.resolve({code:e});else if(t===D.SCSS||t===D.SASS)window.sass&&e?window.sass.compile(e,{indentedSyntax:t===D.SASS},function(e){e.line&&e.message&&(s={lang:"css",data:[{lineNumber:e.line-1,message:e.message}]}),i.resolve({code:e.text,errors:s})}):i.resolve({code:e});else if(t===D.LESS)less.render(e).then(function(e){i.resolve({code:e.css})},function(e){s={lang:"css",data:[{lineNumber:e.line,message:e.message}]},i.resolve({code:"",errors:s})});else if(t===D.STYLUS)stylus(e).render(function(e,t){if(e){window.err=e;var n=e.message.split("\n");n.pop(),s={lang:"css",data:[{lineNumber:+e.message.match(/stylus:(\d+):/)[1]-298,message:n.pop()}]}}i.resolve({code:t,errors:s})});else if(t===D.ACSS)if(!window.atomizer)i.resolve({code:""});else{const t=atomizer.findClassNames(e);var a;try{a=atomizer.getConfig(t,JSON.parse(n.acssConfig))}catch(n){a=atomizer.getConfig(t,{})}const o=atomizer.getCss(a);i.resolve({code:o})}return i.promise}function a(e,t,n,s){var i,a=o();if(!e)return a.resolve(""),a.promise;if(t===F.JS)try{W.parse(e,{tolerant:!0})}catch(t){i={lang:"js",data:[{lineNumber:t.lineNumber-1,message:t.description}]}}finally{!1!==n&&(e=i?e:h(e,{timeout:s})),a.resolve({code:e,errors:i})}else if(t===F.COFFEESCRIPT){if(!window.CoffeeScript)return a.resolve(""),a.promise;try{e=CoffeeScript.compile(e,{bare:!0})}catch(t){i={lang:"js",data:[{lineNumber:t.location.first_line,message:t.message}]}}finally{!1!==n&&(e=i?e:h(e,{timeout:s})),a.resolve({code:e,errors:i})}}else if(t===F.ES6){if(!window.Babel)return a.resolve(""),a.promise;try{W.parse(e,{tolerant:!0,jsx:!0})}catch(t){i={lang:"js",data:[{lineNumber:t.lineNumber-1,message:t.description}]}}finally{e=Babel.transform(e,{presets:["latest","stage-2","react"]}).code,!1!==n&&(e=i?e:h(e,{timeout:s})),a.resolve({code:e,errors:i})}}else if(t===F.TS)try{if(!window.ts)return a.resolve({code:""}),a.promise;e=ts.transpileModule(e,{reportDiagnostics:!0,compilerOptions:{noEmitOnError:!0,diagnostics:!0,module:ts.ModuleKind.ES2015}}),e.diagnostics.length&&(i={lang:"js",data:[{message:e.diagnostics[0].messageText,lineNumber:ts.getLineOfLocalPosition(e.diagnostics[0].file,e.diagnostics[0].start)-1}]}),e=e.outputText,!1===n||i||(e=h(e,{timeout:s})),a.resolve({code:e,errors:i})}catch(t){}return a.promise}function r(e,t){for(var n=e.split("."),o=t.split("."),s=0;3>s;s++){var i=+n[s],a=+o[s];if(i>a)return 1;if(a>i)return-1;if(!isNaN(i)&&isNaN(a))return 1;if(isNaN(i)&&!isNaN(a))return-1}return 0}function l(e){for(var t="",n=e||10;n--;)t+=U[~~(Math.random()*U.length)];return t}function c(){window.DEBUG&&console.log(Date.now(),...arguments)}function h(e,{timeout:t}){var n=1,o=[],s="_wmloopvar",i=`\nif (Date.now() - %d > ${t}) { window.top.previewException(new Error("Infinite loop")); break;}\n`;return z.parse(e,{tolerant:!0,range:!0,jsx:!0},function(e){switch(e.type){case"DoWhileStatement":case"ForStatement":case"ForInStatement":case"ForOfStatement":case"WhileStatement":var t=1+e.body.range[0],a=e.body.range[1],r=i.replace("%d",s+n),l="";"BlockStatement"!==e.body.type&&(r="{"+r,l="}",--t),o.push({pos:t,str:r}),o.push({pos:a,str:l}),o.push({pos:e.range[0],str:"var %d = Date.now();\n".replace("%d",s+n)}),++n;break;default:}}),o.sort(function(e,t){return t.pos-e.pos}).forEach(function(t){e=e.slice(0,t.pos)+t.str+e.slice(t.pos)}),e}function d(e){var t=new Date(e),n=t.getDate()+" "+["January","February","March","April","May","June","July","August","September","October","November","December"][t.getMonth()]+" "+t.getFullYear();return n}function p(e,t){function n(){var n=document.createElement("a");n.href=window.URL.createObjectURL(t),n.download=e,n.style.display="none",document.body.appendChild(n),n.click(),n.remove()}window.IS_EXTENSION?chrome.downloads.download({url:window.URL.createObjectURL(t),filename:e,saveAs:!0},()=>{chrome.runtime.lastError&&n()}):n()}function u(e,t,n){function o(e){return function(){c(arguments),v("fn","error",e),u.errorCount=(u.errorCount||0)+1,4===u.errorCount&&setTimeout(function(){alert("Oops! Seems like your preview isn't updating. It's recommended to switch to the web app: https://webmakerapp.com/app/.\n\n If you still want to get the extension working, please try the following steps until it fixes:\n - Refresh Web Maker\n - Restart browser\n - Update browser\n - Reinstall Web Maker (don't forget to export all your creations from saved items pane (click the OPEN button) before reinstalling)\n\nIf nothing works, please tweet out to @webmakerApp."),v("ui","writeFileMessageSeen")},1e3)}}var s=!1;window.webkitRequestFileSystem(window.TEMPORARY,5242880,function(i){i.root.getFile(e,{create:!0},function(e){e.createWriter((e)=>{e.onwriteend=function(){return s?n():(s=!0,e.seek(0),e.write(t),!1)},e.truncate(0)},o("createWriterFail"))},o("getFileFail"))},o("webkitRequestFileSystemFail"))}function m(e){var t=o(),n=window.document.getElementsByTagName("script")[0],s=window.document.createElement("script");return s.src=e,s.async=!0,n.parentNode.insertBefore(s,n),s.onload=function(){t.resolve()},t.promise}function g(e,t,n,o,s){if(!o)return"";var i=o.externalLibs.js.split("\n").reduce(function(e,t){return e+(t?"\n":"")},""),a=o.externalLibs.css.split("\n").reduce(function(e,t){return e+(t?"\n":"")},""),r="\n\n\n\n"+a+"\n\n\n\n"+e+"\n"+i+"\n";if(s||(r+=""),o.jsMode===F.ES6&&(r+=""),"string"==typeof n)r+="\n\n",r}function f(e){var t=s(e.html,e.htmlMode),n=i(e.css,e.cssMode),o=a(e.js,e.jsMode,!1);Promise.all([t,n,o]).then(function(t){var n=t[0].code,o=t[1].code,s=t[2].code,i=g(n,o,s,e,!0),a=new Date,r=["web-maker",a.getFullYear(),a.getMonth()+1,a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds()].join("-");e.title&&(r=e.title),r+=".html";var l=new Blob([i],{type:"text/html;charset=UTF-8"});p(r,l),v("fn","saveFileComplete")})}function b(){var e=o();return window.IS_EXTENSION?(chrome.permissions.contains({permissions:["downloads"]},function(t){t?e.resolve():chrome.permissions.request({permissions:["downloads"]},function(t){t?(v("fn","downloadsPermGiven"),e.resolve()):e.reject()})}),e.promise):(e.resolve(),e.promise)}function v(e,t,n,o){return window.DEBUG?void c("trackevent",e,t,n,o):void(window.ga&&ga("send","event",e,t,n,o))}function C(e,t){var n={};for(var o in e)0<=t.indexOf(o)||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function y(e){return Object(O.h)(q,K({Tag:"a"},e))}function S(e){return Object(O.h)("div",{class:"main-header"},Object(O.h)("input",{type:"text",id:"titleInput",title:"Click to edit",class:"item-title-input",value:e.title,onBlur:e.titleInputBlurHandler}),Object(O.h)("div",{class:"main-header__btn-wrap flex flex-v-center"},Object(O.h)("a",{id:"runBtn",class:"hide flex flex-v-center hint--rounded hint--bottom-left","aria-label":"Run preview (Ctrl/\u2318 + Shift + 5)",onClick:e.runBtnClickHandler},Y,"Run"),Object(O.h)(y,{onClick:e.addLibraryBtnHandler,"data-event-category":"ui","data-event-action":"addLibraryButtonClick",class:"flex-v-center hint--rounded hint--bottom-left","aria-label":"Add a JS/CSS library"},"Add library"," ",Object(O.h)("span",{id:"js-external-lib-count",style:`display:${e.externalLibCount?"inline":"none"}`,class:"count-label"},e.externalLibCount)),Object(O.h)("a",{class:"flex flex-v-center hint--rounded hint--bottom-left","aria-label":"Start a new creation",onClick:e.newBtnHandler},G,"New"),Object(O.h)("a",{id:"saveBtn",class:`flex flex-v-center hint--rounded hint--bottom-left ${e.isSaving?"is-loading":""} ${e.unsavedEditCount?"is-marked":0}`,"aria-label":"Save current creation (Ctrl/\u2318 + S)",onClick:e.saveBtnHandler},Z,X,"Save"),Object(O.h)("a",{id:"openItemsBtn",class:`flex flex-v-center hint--rounded hint--bottom-left ${e.isFetchingItems?"is-loading":""}`,"aria-label":"Open a saved creation (Ctrl/\u2318 + O)",onClick:e.openBtnHandler},Q,ee,"Open"),Object(O.h)(y,{onClick:e.loginBtnHandler,"data-event-category":"ui","data-event-action":"loginButtonClick",class:"hide-on-login flex flex-v-center hint--rounded hint--bottom-left","aria-label":"Login/Signup"},"Login/Signup"),Object(O.h)(y,{onClick:e.profileBtnHandler,"data-event-category":"ui","data-event-action":"headerAvatarClick","aria-label":"See profile or Logout",class:"hide-on-logout hint--rounded hint--bottom-left"},Object(O.h)("img",{id:"headerAvatarImg",width:"20",src:e.user?e.user.photoURL||J:"",class:"main-header__avatar-img"}))))}function w(e,t){var n=t;return function(){0==--n&&e()}}function k(e,t){var n=ne.a.modes[e].dependencies;if(!n)return t();for(var o=[],s=0;s{e.root.getFile(d,{create:!0},(e)=>{e.createWriter((e)=>{e.onwriteend=t,e.write(i)},n)},n)},n)}function A(e){b().then(()=>{function t(n){var o=document.createElement("canvas"),s=e;o.width=s.width,o.height=s.height;var i=o.getContext("2d"),a=window.devicePixelRatio||1;i.drawImage(n,s.left*a,s.top*a,s.width*a,s.height*a,0,0,s.width,s.height),n.removeEventListener("load",t),H(o.toDataURL())}var n=document.createElement("style");n.textContent="[class*=\"hint\"]:after, [class*=\"hint\"]:before { display: none!important; }",document.body.appendChild(n),setTimeout(()=>{chrome.tabs.captureVisibleTab(null,{format:"png",quality:100},function(e){if(n.remove(),e){var o=new Image;o.src=e,o.addEventListener("load",()=>t(o,e))}})},50),v("ui","takeScreenshotBtnClick")})}function j({show:e,closeHandler:t,oldSavedCreationsCount:n,dontAskBtnClickHandler:o,importBtnClickHandler:s}){return Object(O.h)(gt,{extraClasses:"ask-to-import-modal",show:e,closeHandler:t},Lo,Object(O.h)("div",null,Object(O.h)("p",null,"You have ",Object(O.h)("span",null,n)," creations saved in your local machine. Do you want to import those creations in your account so they are more secure and accessible anywhere?"),Io,Object(O.h)("div",{class:"flex flex-h-end"},Object(O.h)("button",{onClick:o,class:"btn"},"Don't ask me again"),Object(O.h)("button",{onClick:s,class:"btn btn--primary ml-1"},"Yes, please import"))))}function B(e){return Object(O.h)(gt,{show:e.show,closeHandler:e.closeHandler},jo,Bo)}function E(e){return Object(O.h)(gt,{show:e.show,closeHandler:e.closeHandler},Eo,Oo,To,Vo)}Object.defineProperty(t,"__esModule",{value:!0});var O=n("KM04"),T=n.n(O),V=Object.assign||function(e){for(var t,n=1;n{}},window.$all=(e)=>[...document.querySelectorAll(e)],window.IS_EXTENSION=!!window.chrome.extension;const R=window.chrome.extension||window.DEBUG?"/":"/app";var U="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";Node.prototype.nextUntil=function(e){const t=Array.from(this.parentNode.querySelectorAll(e)),n=t.indexOf(this);return t[n+1]},Node.prototype.previousUntil=function(e){const t=Array.from(this.parentNode.querySelectorAll(e)),n=t.indexOf(this);return t[n-1]},window.requestIdleCallback=window.requestIdleCallback||function(e){setTimeout(e,10)},window.IS_EXTENSION?document.body.classList.add("is-extension"):document.body.classList.add("is-app"),!1;var K=Object.assign||function(e){for(var t,n=1;n{"function"==typeof this.props.onFocus&&this.props.onFocus(e)}),this.cm.on("change",this.props.onChange),this.cm.addKeyMap({"Ctrl-Space":"autocomplete"}),e.noAutocomplete||this.cm.on("inputRead",(e,t)=>{this.props.autoComplete&&"+input"===t.origin&&";"!==t.text[0]&&","!==t.text[0]&&" "!==t.text[0]&&se.commands.autocomplete(this.cm,null,{completeSingle:!1})}),this.props.onCreation(this.cm)}render(){return Object(O.h)("textarea",{ref:(e)=>this.textarea=e,name:"",id:"",cols:"30",rows:"10"})}};var dt=n("mSND"),ct=n.n(dt);let ht=class extends O.Component{componentDidMount(){this.updateSplit()}componentWillUpdate(){this.splitInstance&&this.splitInstance.destroy()}componentDidUpdate(){this.updateSplit()}updateSplit(){const e={direction:this.props.direction,minSize:this.props.minSize,gutterSize:6,sizes:this.props.sizes};this.props.onDragEnd&&(e.onDragEnd=this.props.onDragEnd),this.props.onDragStart&&(e.onDragStart=this.props.onDragStart),this.splitInstance=ct()(this.props.children.map((e)=>"#"+e.attributes.id),e),this.props.onSplit&&this.props.onSplit(this.splitInstance)}render(){const e=this.props,{children:t}=e,n=x(e,["children"]);return Object(O.h)("div",n,this.props.children)}},pt=class extends O.Component{componentDidMount(){this.initEditor()}shouldComponentUpdate(){return!1}initEditor(){this.cm=se.fromTextArea(this.textarea,this.props.options),this.props.onChange&&this.cm.on("change",this.props.onChange),this.props.onBlur&&this.cm.on("blur",this.props.onBlur),this.props.onCreation(this.cm)}render(){return Object(O.h)("textarea",{ref:(e)=>this.textarea=e,name:"",id:"",cols:"30",rows:"10"})}};var ut=n("q6qL"),mt=n.n(ut);let gt=class extends O.Component{componentDidMount(){window.addEventListener("keydown",this.onKeyDownHandler.bind(this))}componentWillUnmount(){window.removeEventListener("keydown",this.onKeyDownHandler.bind(this))}onKeyDownHandler(t){27===t.keyCode&&this.props.closeHandler()}onOverlayClick(t){t.target===this.overlayEl&&this.props.closeHandler()}componentDidUpdate(e){this.props.show!==e.show&&(document.body.classList[this.props.show?"add":"remove"]("overlay-visible"),this.props.show&&setTimeout(()=>{this.overlayEl.querySelector(".js-modal__close-btn").focus()},0))}render(){return this.props.show?Object(O.h)(mt.a,{into:"body"},Object(O.h)("div",{class:`${this.props.extraClasses||""} modal is-modal-visible`,ref:(e)=>this.overlayEl=e,onClick:this.onOverlayClick.bind(this)},Object(O.h)("div",{class:"modal__content"},Object(O.h)("button",{type:"button",onClick:this.props.closeHandler,"aria-label":"Close modal",title:"Close",class:"js-modal__close-btn modal__close-btn"},"Close"),this.props.children))):null}};var ft=Object(O.h)("h1",null,"Atomic CSS Settings"),bt=Object(O.h)("h3",null,"Configure Atomizer settings."," ",Object(O.h)("a",{href:"https://github.com/acss-io/atomizer#api",target:"_blank",rel:"noopener noreferrer"},"Read more")," ","about available settings.");let vt=class extends O.Component{componentDidUpdate(){this.props.show&&setTimeout(()=>{this.props.settings&&this.cm.setValue(this.props.settings.acssConfig),this.cm.refresh(),this.cm.focus()},500)}render(){return Object(O.h)(gt,{show:this.props.show,closeHandler:this.props.closeHandler},ft,bt,Object(O.h)("div",{style:"height: calc(100vh - 350px);"},Object(O.h)(pt,{options:{mode:"application/ld+json",theme:this.props.editorTheme},onCreation:(e)=>this.cm=e,onBlur:(e)=>this.props.onChange(e.getValue())})),Object(O.h)("div",{class:"flex flex-h-end"},Object(O.h)("button",{class:"btn btn--primary",onClick:this.props.closeHandler},"Apply and Close")))}};const Ct=33;var yt=Object(O.h)("span",{class:"caret"}),St=Object(O.h)("option",{value:"html"},"HTML"),wt=Object(O.h)("option",{value:"markdown"},"Markdown"),kt=Object(O.h)("option",{value:"jade"},"Pug"),xt=Object(O.h)("span",{class:"caret"}),Mt=Object(O.h)("option",{value:"css"},"CSS"),_t=Object(O.h)("option",{value:"scss"},"SCSS"),Lt=Object(O.h)("option",{value:"sass"},"SASS"),It=Object(O.h)("option",{value:"less"},"LESS"),Ht=Object(O.h)("option",{value:"stylus"},"Stylus"),At=Object(O.h)("option",{value:"acss"},"Atomic CSS"),jt=Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#settings-icon"})),Bt=Object(O.h)("span",{class:"caret"}),Et=Object(O.h)("option",{value:"js"},"JS"),Ot=Object(O.h)("option",{value:"coffee"},"CoffeeScript"),Tt=Object(O.h)("option",{value:"es6"},"ES6 (Babel)"),Vt=Object(O.h)("option",{value:"typescript"},"TypeScript"),Pt=Object(O.h)("span",{class:"code-wrap__header-label"},"Console (",Object(O.h)("span",{id:"logCountEl"},"0"),")"),Dt=Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#cancel-icon"})),Ft=Object(O.h)("svg",{width:"18",height:"18",fill:"#346fd2"},Object(O.h)("use",{xlinkHref:"#chevron-icon"}));let Nt=class extends O.Component{constructor(e){super(e),this.state={isConsoleOpen:!1,isCssSettingsModalOpen:!1},this.updateTimer=null,this.updateDelay=500,this.htmlMode=P.HTML,this.jsMode=P.HTML,this.cssMode=D.CSS,this.jsMode=F.JS,this.prefs={},this.codeInPreview={html:null,css:null,js:null},this.cmCodes={html:e.currentItem.html,css:"",js:""},this.cm={},this.logCount=0,window.onMessageFromConsole=this.onMessageFromConsole.bind(this),window.previewException=this.previewException.bind(this),window.clearConsole=this.clearConsole.bind(this)}shouldComponentUpdate(e,t){return this.state.isConsoleOpen!==t.isConsoleOpen||this.state.isCssSettingsModalOpen!==t.isCssSettingsModalOpen||this.state.codeSplitSizes!==t.codeSplitSizes||this.state.mainSplitSizes!==t.mainSplitSizes||this.props.currentLayoutMode!==e.currentLayoutMode||this.props.currentItem!==e.currentItem}componentDidUpdate(){window.logCountEl.textContent=this.logCount}componentDidMount(){this.props.onRef(this)}onHtmlCodeChange(e,t){this.cmCodes.html=e.getValue(),this.props.onCodeChange("html",this.cmCodes.html,"setValue"!==t.origin),this.onCodeChange(e,t)}onCssCodeChange(e,t){this.cmCodes.css=e.getValue(),this.props.onCodeChange("css",this.cmCodes.css,"setValue"!==t.origin),this.onCodeChange(e,t)}onJsCodeChange(e,t){this.cmCodes.js=e.getValue(),this.props.onCodeChange("js",this.cmCodes.js,"setValue"!==t.origin),this.onCodeChange(e,t)}onCodeChange(e,t){clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>{"setValue"!==t.origin&&(!1!==this.prefs.autoPreview&&this.setPreviewContent(),v.previewCount=(v.previewCount||0)+1,4===v.previewCount&&v("fn","usingPreview"))},this.updateDelay)}createPreviewFile(e,t,n){const o=!window.webkitRequestFileSystem||!window.IS_EXTENSION;var s=g(e,t,o?n:null,this.props.currentItem),i=new Blob([s],{type:"text/plain;charset=UTF-8"}),a=new Blob([n],{type:"text/plain;charset=UTF-8"});!v.hasTrackedCode&&(e||t||n)&&(v("fn","hasCode"),v.hasTrackedCode=!0),o?this.detachedWindow?(c("\u2709\uFE0F Sending message to detached window"),this.detachedWindow.postMessage({contents:s},"*")):(this.frame.src=this.frame.src,setTimeout(()=>{this.frame.contentDocument.open(),this.frame.contentDocument.write(s),this.frame.contentDocument.close()},10)):u("script.js",a,()=>{u("preview.html",i,()=>{var e=chrome.i18n.getMessage()?`chrome-extension://${chrome.i18n.getMessage("@@extension_id")}`:`${location.origin}`,t=`filesystem:${e}/temporary/preview.html`;this.detachedWindow?this.detachedWindow.postMessage(t,"*"):this.frame.src=t})})}cleanupErrors(e){this.cm[e].clearGutter("error-gutter")}showErrors(e,t){var o=this.cm[e];t.forEach(function(t){o.operation(function(){var e=document.createElement("div");e.setAttribute("data-title",t.message),e.classList.add("gutter-error-marker"),o.setGutterMarker(t.lineNumber,"error-gutter",e)})})}setPreviewContent(e,t){if(!this.props.prefs.autoPreview&&!t)return;this.props.prefs.preserveConsoleLogs||this.clearConsole(),this.cleanupErrors("html"),this.cleanupErrors("css"),this.cleanupErrors("js");var n={html:this.cmCodes.html,css:this.cmCodes.css,js:this.cmCodes.js};c("\uD83D\uDD0E setPreviewContent",e);const o=this.detachedWindow?this.detachedWindow.document.querySelector("iframe"):this.frame,r=this.props.currentItem.cssMode;if(!e&&n.html===this.codeInPreview.html&&n.js===this.codeInPreview.js)i(r===D.ACSS?n.html:n.css,r,this.props.currentItem.cssSettings).then((e)=>{r===D.ACSS&&this.cm.css.setValue(e.code||""),o.contentDocument.querySelector("#webmakerstyle")&&(o.contentDocument.querySelector("#webmakerstyle").textContent=e.code||"")});else{var l=s(n.html,this.props.currentItem.htmlMode),d=i(r===D.ACSS?n.html:n.css,r,this.props.currentItem.cssSettings),h=a(n.js,this.props.currentItem.jsMode,!0,this.props.prefs.infiniteLoopTimeout);Promise.all([l,d,h]).then((e)=>{r===D.ACSS&&this.cm.css.setValue(e[1].code||""),this.createPreviewFile(e[0].code||"",e[1].code||"",e[2].code||""),e.forEach((e)=>{e.errors&&this.showErrors(e.errors.lang,e.errors.data)})})}this.codeInPreview.html=n.html,this.codeInPreview.css=n.css,this.codeInPreview.js=n.js}isValidItem(e){return!!e.title}refreshEditor(){this.cmCodes.html=this.props.currentItem.html,this.cmCodes.css=this.props.currentItem.css,this.cmCodes.js=this.props.currentItem.js,this.cm.html.setValue(this.cmCodes.html||""),this.cm.css.setValue(this.cmCodes.css||""),this.cm.js.setValue(this.cmCodes.js||""),this.cm.html.refresh(),this.cm.css.refresh(),this.cm.js.refresh(),this.clearConsole(),Promise.all([this.updateHtmlMode(this.props.currentItem.htmlMode),this.updateCssMode(this.props.currentItem.cssMode),this.updateJsMode(this.props.currentItem.jsMode)]).then(()=>this.setPreviewContent(!0))}applyCodemirrorSettings(e){this.cm&&(htmlCodeEl.querySelector(".CodeMirror").style.fontSize=cssCodeEl.querySelector(".CodeMirror").style.fontSize=jsCodeEl.querySelector(".CodeMirror").style.fontSize=`${parseInt(e.fontSize,10)}px`,window.consoleEl.querySelector(".CodeMirror").style.fontSize=`${parseInt(e.fontSize,10)}px`,window.editorThemeLinkTag.href=`lib/codemirror/theme/${e.editorTheme}.css`,window.fontStyleTag.textContent=window.fontStyleTemplate.textContent.replace(/fontname/g,("other"===e.editorFont?e.editorCustomFont:e.editorFont)||"FiraCode"),this.consoleCm.setOption("theme",e.editorTheme),["html","js","css"].forEach((t)=>{this.cm[t].setOption("indentWithTabs","spaces"!==e.indentWith),this.cm[t].setOption("blastCode",!!e.isCodeBlastOn&&{effect:2,shake:!1}),this.cm[t].setOption("indentUnit",+e.indentSize),this.cm[t].setOption("tabSize",+e.indentSize),this.cm[t].setOption("theme",e.editorTheme),this.cm[t].setOption("keyMap",e.keymap),this.cm[t].setOption("lineWrapping",e.lineWrap),this.cm[t].refresh()}))}updateCodeWrapCollapseStates(){clearTimeout(this.updateCodeWrapCollapseStates.timeout),this.updateCodeWrapCollapseStates.timeout=setTimeout(()=>{const{currentLayoutMode:e}=this.props,t=2===e||5===e?"width":"height";[htmlCodeEl,cssCodeEl,jsCodeEl].forEach(function(e){const n=e.getBoundingClientRect(),o=n[t];100>o?e.classList.add("is-minimized"):e.classList.remove("is-minimized"),-1===e.style[t].indexOf(`100% - ${2*Ct}px`)?e.classList.remove("is-maximized"):e.classList.add("is-maximized")})},50)}toggleCodeWrapCollapse(e){if(e.classList.contains("is-minimized")||e.classList.contains("is-maximized"))e.classList.remove("is-minimized"),e.classList.remove("is-maximized"),this.codeSplitInstance.setSizes([33.3,33.3,33.3]);else{const n=parseInt(e.dataset.codeWrapId,10);var t=[`${Ct}px`,`${Ct}px`,`${Ct}px`];t[n]=`calc(100% - ${2*Ct}px)`,this.codeSplitInstance.setSizes(t),e.classList.add("is-maximized")}}collapseBtnHandler(t){var e=t.currentTarget.parentElement.parentElement.parentElement;this.toggleCodeWrapCollapse(e),v("ui","paneCollapseBtnClick",e.dataset.type)}codeWrapHeaderDblClickHandler(t){if(t.target.classList.contains("js-code-wrap__header")){const e=t.target.parentElement;this.toggleCodeWrapCollapse(e),v("ui","paneHeaderDblClick",e.dataset.type)}}resetSplitting(){this.setState({codeSplitSizes:this.getCodeSplitSizes(),mainSplitSizes:this.getMainSplitSizesToApply()})}getMainSplitSizesToApply(){var e;const{currentItem:t,currentLayoutMode:n}=this.props;return e=t&&t.mainSizes?3===n?[t.mainSizes[1],t.mainSizes[0]]:t.mainSizes:5===n?[75,25]:[50,50],e}getCodeSplitSizes(){return this.props.currentItem&&this.props.currentItem.sizes?this.props.currentItem.sizes:[33.33,33.33,33.33]}mainSplitDragEndHandler(){this.props.prefs.refreshOnResize&&setTimeout(()=>{this.setPreviewContent(!0)},1)}codeSplitDragStart(){document.body.classList.add("is-dragging")}codeSplitDragEnd(){this.updateCodeWrapCollapseStates(),document.body.classList.remove("is-dragging")}handleModeRequirements(e){function t(){N[e].hasLoaded=!0,s.resolve()}const n="lib/transpilers";var s=o();return N[e].hasLoaded?(s.resolve(),s.promise):(e===P.JADE?m(`${n}/jade.js`).then(t):e===P.MARKDOWN?m(`${n}/marked.js`).then(t):e===D.LESS?m(`${n}/less.min.js`).then(t):e===D.SCSS||e===D.SASS?m(`${n}/sass.js`).then(function(){window.sass=new Sass(`${n}/sass.worker.js`),t()}):e===D.STYLUS?m(`${n}/stylus.min.js`).then(t):e===D.ACSS?m(`${n}/atomizer.browser.js`).then(t):e===F.COFFEESCRIPT?m(`${n}/coffee-script.js`).then(t):e===F.ES6?m(`${n}/babel.min.js`).then(t):e===F.TS?m(`${n}/typescript.js`).then(t):s.resolve(),s.promise)}updateHtmlMode(e){return this.props.onCodeModeChange("html",e),this.props.currentItem.htmlMode=e,this.cm.html.setOption("mode",N[e].cmMode),se.autoLoadMode(this.cm.html,N[e].cmPath||N[e].cmMode),this.handleModeRequirements(e)}updateCssMode(e){return this.props.onCodeModeChange("css",e),this.props.currentItem.cssMode=e,this.cm.css.setOption("mode",N[e].cmMode),this.cm.css.setOption("readOnly",N[e].cmDisable),window.cssSettingsBtn.classList[N[e].hasSettings?"remove":"add"]("hide"),se.autoLoadMode(this.cm.css,N[e].cmPath||N[e].cmMode),this.handleModeRequirements(e)}updateJsMode(e){return this.props.onCodeModeChange("js",e),this.props.currentItem.jsMode=e,this.cm.js.setOption("mode",N[e].cmMode),se.autoLoadMode(this.cm.js,N[e].cmPath||N[e].cmMode),this.handleModeRequirements(e)}codeModeChangeHandler(t){var e=t.target.value,n=t.target.dataset.type,o=this.props.currentItem["html"===n?"htmlMode":"css"===n?"cssMode":"jsMode"];o!==e&&("html"===n?this.updateHtmlMode(e).then(()=>this.setPreviewContent(!0)):"js"===n?this.updateJsMode(e).then(()=>this.setPreviewContent(!0)):"css"===n&&this.updateCssMode(e).then(()=>this.setPreviewContent(!0)),v("ui","updateCodeMode",e))}detachPreview(){if(this.detachedWindow)return void this.detachedWindow.focus();const e=this.frame.getBoundingClientRect(),t=e.width,n=e.height;document.body.classList.add("is-detached-mode"),window.globalConsoleContainerEl.insertBefore(window.consoleEl,null),this.detachedWindow=window.open("./preview.html","Web Maker",`width=${t},height=${n},resizable,scrollbars=yes,status=1`),setTimeout(()=>{this.setPreviewContent(!0)},1500);var o=window.setInterval(function(){this.detachedWindow&&this.detachedWindow.closed&&(clearInterval(o),document.body.classList.remove("is-detached-mode"),$("#js-demo-side").insertBefore(window.consoleEl,null),this.detachedWindow=null,this.setPreviewContent(!0))}.bind(this),500)}onMessageFromConsole(){[...arguments].forEach((e)=>{e&&e.indexOf&&-1!==e.indexOf("filesystem:chrome-extension")&&(e=e.replace(/filesystem:chrome-extension.*\.js:(\d+):*(\d*)/g,"script $1:$2"));try{this.consoleCm.replaceRange(e+" "+((e+"").match(/\[object \w+]/)?JSON.stringify(e):"")+"\n",{line:Infinity})}catch(t){this.consoleCm.replaceRange("\uD83C\uDF00\n",{line:Infinity})}this.consoleCm.scrollTo(0,Infinity),this.logCount++}),logCountEl.textContent=this.logCount}previewException(e){console.error("Possible infinite loop detected.",e.stack),this.onMessageFromConsole("Possible infinite loop detected.",e.stack)}toggleConsole(){this.setState({isConsoleOpen:!this.state.isConsoleOpen}),v("ui","consoleToggle")}consoleHeaderDblClickHandler(t){t.target.classList.contains("js-console__header")&&(v("ui","consoleToggleDblClick"),this.toggleConsole())}clearConsole(){this.consoleCm.setValue(""),this.logCount=0,window.logCountEl.textContent=this.logCount}clearConsoleBtnClickHandler(){this.clearConsole(),v("ui","consoleClearBtnClick")}evalConsoleExpr(t){(76===t.which||12===t.which)&&t.ctrlKey?(this.clearConsole(),v("ui","consoleClearKeyboardShortcut")):13===t.which&&(this.onMessageFromConsole("> "+t.target.value),this.frame.contentWindow._wmEvaluate(t.target.value),t.target.value="",v("fn","evalConsoleExpr"))}cssSettingsBtnClickHandler(){this.setState({isCssSettingsModalOpen:!0}),v("ui","cssSettingsBtnClick")}cssSettingsChangeHandler(e){this.props.onCodeSettingsChange("css",e),this.setPreviewContent(!0)}getDemoFrame(e){e(this.frame)}editorFocusHandler(e){this.props.onEditorFocus(e)}render(){return Object(O.h)(ht,{class:"content-wrap flex flex-grow",sizes:this.state.mainSplitSizes,minSize:150,style:"",direction:2===this.props.currentLayoutMode?"vertical":"horizontal",onDragEnd:this.mainSplitDragEndHandler.bind(this)},Object(O.h)(ht,{class:"code-side",id:"js-code-side",sizes:this.state.codeSplitSizes,minSize:Ct,direction:2===this.props.currentLayoutMode||5===this.props.currentLayoutMode?"horizontal":"vertical",onDragStart:this.codeSplitDragStart.bind(this),onDragEnd:this.codeSplitDragEnd.bind(this),onSplit:(e)=>this.codeSplitInstance=e},Object(O.h)("div",{"data-code-wrap-id":"0",id:"htmlCodeEl","data-type":"html",class:"code-wrap",onTransitionEnd:this.updateCodeWrapCollapseStates.bind(this)},Object(O.h)("div",{class:"js-code-wrap__header code-wrap__header",title:"Double click to toggle code pane",onDblClick:this.codeWrapHeaderDblClickHandler.bind(this)},Object(O.h)("label",{class:"btn-group",dropdow:!0,title:"Click to change"},Object(O.h)("span",{class:"code-wrap__header-label"},N[this.props.currentItem.htmlMode||"html"].label),yt,Object(O.h)("select",{"data-type":"html",class:"js-mode-select hidden-select",onChange:this.codeModeChangeHandler.bind(this),value:this.props.currentItem.htmlMode},St,wt,kt)),Object(O.h)("div",{class:"code-wrap__header-right-options"},Object(O.h)("a",{class:"js-code-collapse-btn code-wrap__header-btn code-wrap__collapse-btn",title:"Toggle code pane",onClick:this.collapseBtnHandler.bind(this)}))),Object(O.h)(lt,{options:{mode:"htmlmixed",profile:"xhtml",gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],noAutocomplete:!0,matchTags:{bothTags:!0},emmet:!0},onChange:this.onHtmlCodeChange.bind(this),onCreation:(e)=>this.cm.html=e,onFocus:this.editorFocusHandler.bind(this)})),Object(O.h)("div",{"data-code-wrap-id":"1",id:"cssCodeEl","data-type":"css",class:"code-wrap",onTransitionEnd:this.updateCodeWrapCollapseStates.bind(this)},Object(O.h)("div",{class:"js-code-wrap__header code-wrap__header",title:"Double click to toggle code pane",onDblClick:this.codeWrapHeaderDblClickHandler.bind(this)},Object(O.h)("label",{class:"btn-group",title:"Click to change"},Object(O.h)("span",{class:"code-wrap__header-label"},N[this.props.currentItem.cssMode||"css"].label),xt,Object(O.h)("select",{"data-type":"css",class:"js-mode-select hidden-select",onChange:this.codeModeChangeHandler.bind(this),value:this.props.currentItem.cssMode},Mt,_t,Lt,It,Ht,At)),Object(O.h)("div",{class:"code-wrap__header-right-options"},Object(O.h)("a",{href:"#",id:"cssSettingsBtn",title:"Atomic CSS configuration",onClick:this.cssSettingsBtnClickHandler.bind(this),class:"code-wrap__header-btn hide"},jt),Object(O.h)("a",{class:"js-code-collapse-btn code-wrap__header-btn code-wrap__collapse-btn",title:"Toggle code pane",onClick:this.collapseBtnHandler.bind(this)}))),Object(O.h)(lt,{options:{mode:"css",gutters:["error-gutter","CodeMirror-linenumbers","CodeMirror-foldgutter"],emmet:!0},onChange:this.onCssCodeChange.bind(this),onCreation:(e)=>this.cm.css=e,onFocus:this.editorFocusHandler.bind(this)})),Object(O.h)("div",{"data-code-wrap-id":"2",id:"jsCodeEl","data-type":"js",class:"code-wrap",onTransitionEnd:this.updateCodeWrapCollapseStates.bind(this)},Object(O.h)("div",{class:"js-code-wrap__header code-wrap__header",title:"Double click to toggle code pane",onDblClick:this.codeWrapHeaderDblClickHandler.bind(this)},Object(O.h)("label",{class:"btn-group",title:"Click to change"},Object(O.h)("span",{class:"code-wrap__header-label"},N[this.props.currentItem.jsMode||"js"].label),Bt,Object(O.h)("select",{"data-type":"js",class:"js-mode-select hidden-select",onChange:this.codeModeChangeHandler.bind(this),value:this.props.currentItem.jsMode},Et,Ot,Tt,Vt)),Object(O.h)("div",{class:"code-wrap__header-right-options"},Object(O.h)("a",{class:"js-code-collapse-btn code-wrap__header-btn code-wrap__collapse-btn",title:"Toggle code pane",onClick:this.collapseBtnHandler.bind(this)}))),Object(O.h)(lt,{options:{mode:"javascript",gutters:["error-gutter","CodeMirror-linenumbers","CodeMirror-foldgutter"]},autoComplete:this.props.prefs.autoComplete,onChange:this.onJsCodeChange.bind(this),onCreation:(e)=>this.cm.js=e,onFocus:this.editorFocusHandler.bind(this)}))),Object(O.h)("div",{class:"demo-side",id:"js-demo-side",style:""},Object(O.h)("iframe",{ref:(e)=>this.frame=e,src:"about://blank",frameborder:"0",id:"demo-frame",allowfullscreen:!0}),Object(O.h)("div",{id:"consoleEl",class:`console ${this.state.isConsoleOpen?"":"is-minimized"}`},Object(O.h)("div",{id:"consoleLogEl",class:"console__log"},Object(O.h)("div",{class:"js-console__header code-wrap__header",title:"Double click to toggle console",onDblClick:this.toggleConsole.bind(this)},Pt,Object(O.h)("div",{class:"code-wrap__header-right-options"},Object(O.h)("a",{class:"code-wrap__header-btn",title:"Clear console (CTRL + L)",onClick:this.clearConsoleBtnClickHandler.bind(this)},Dt),Object(O.h)("a",{class:"code-wrap__header-btn code-wrap__collapse-btn",title:"Toggle console",onClick:this.toggleConsole.bind(this)}))),Object(O.h)(pt,{options:{mode:"javascript",lineWrapping:!0,theme:"monokai",foldGutter:!0,readOnly:!0,gutters:["CodeMirror-foldgutter"]},onCreation:(e)=>this.consoleCm=e})),Object(O.h)("div",{id:"consolePromptEl",class:"console__prompt flex flex-v-center"},Ft,Object(O.h)("input",{onKeyUp:this.evalConsoleExpr.bind(this),class:"console-exec-input"}))),Object(O.h)(vt,{show:this.state.isCssSettingsModalOpen,closeHandler:()=>this.setState({isCssSettingsModalOpen:!1}),onChange:this.cssSettingsChangeHandler.bind(this),settings:this.props.currentItem.cssSettings,editorTheme:this.props.prefs.editorTheme})))}};var Wt=Object(O.h)("svg",{viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z"})),zt=Object(O.h)("svg",{style:"display: none;",xmlns:"http://www.w3.org/2000/svg"},Object(O.h)("symbol",{id:"codepen-logo",viewBox:"0 0 120 120"},Object(O.h)("path",{class:"outer-ring",d:"M60.048 0C26.884 0 0 26.9 0 60.048s26.884 60 60 60.047c33.163 0 60.047-26.883 60.047-60.047 S93.211 0 60 0z M60.048 110.233c-27.673 0-50.186-22.514-50.186-50.186S32.375 9.9 60 9.9 c27.672 0 50.2 22.5 50.2 50.186S87.72 110.2 60 110.233z"}),Object(O.h)("path",{class:"inner-box",d:"M97.147 48.319c-0.007-0.047-0.019-0.092-0.026-0.139c-0.016-0.09-0.032-0.18-0.056-0.268 c-0.014-0.053-0.033-0.104-0.05-0.154c-0.025-0.078-0.051-0.156-0.082-0.232c-0.021-0.053-0.047-0.105-0.071-0.156 c-0.033-0.072-0.068-0.143-0.108-0.211c-0.029-0.051-0.061-0.1-0.091-0.148c-0.043-0.066-0.087-0.131-0.135-0.193 c-0.035-0.047-0.072-0.094-0.109-0.139c-0.051-0.059-0.104-0.117-0.159-0.172c-0.042-0.043-0.083-0.086-0.127-0.125 c-0.059-0.053-0.119-0.104-0.181-0.152c-0.048-0.037-0.095-0.074-0.145-0.109c-0.019-0.012-0.035-0.027-0.053-0.039L61.817 23.5 c-1.072-0.715-2.468-0.715-3.54 0L24.34 46.081c-0.018 0.012-0.034 0.027-0.053 0.039c-0.05 0.035-0.097 0.072-0.144 0.1 c-0.062 0.049-0.123 0.1-0.181 0.152c-0.045 0.039-0.086 0.082-0.128 0.125c-0.056 0.055-0.108 0.113-0.158 0.2 c-0.038 0.045-0.075 0.092-0.11 0.139c-0.047 0.062-0.092 0.127-0.134 0.193c-0.032 0.049-0.062 0.098-0.092 0.1 c-0.039 0.068-0.074 0.139-0.108 0.211c-0.024 0.051-0.05 0.104-0.071 0.156c-0.031 0.076-0.057 0.154-0.082 0.2 c-0.017 0.051-0.035 0.102-0.05 0.154c-0.023 0.088-0.039 0.178-0.056 0.268c-0.008 0.047-0.02 0.092-0.025 0.1 c-0.019 0.137-0.029 0.275-0.029 0.416V71.36c0 0.1 0 0.3 0 0.418c0.006 0 0 0.1 0 0.1 c0.017 0.1 0 0.2 0.1 0.268c0.015 0.1 0 0.1 0.1 0.154c0.025 0.1 0.1 0.2 0.1 0.2 c0.021 0.1 0 0.1 0.1 0.154c0.034 0.1 0.1 0.1 0.1 0.213c0.029 0 0.1 0.1 0.1 0.1 c0.042 0.1 0.1 0.1 0.1 0.193c0.035 0 0.1 0.1 0.1 0.139c0.05 0.1 0.1 0.1 0.2 0.2 c0.042 0 0.1 0.1 0.1 0.125c0.058 0.1 0.1 0.1 0.2 0.152c0.047 0 0.1 0.1 0.1 0.1 c0.019 0 0 0 0.1 0.039L58.277 96.64c0.536 0.4 1.2 0.5 1.8 0.537c0.616 0 1.233-0.18 1.77-0.537 l33.938-22.625c0.018-0.012 0.034-0.027 0.053-0.039c0.05-0.035 0.097-0.072 0.145-0.109c0.062-0.049 0.122-0.1 0.181-0.152 c0.044-0.039 0.085-0.082 0.127-0.125c0.056-0.055 0.108-0.113 0.159-0.172c0.037-0.045 0.074-0.09 0.109-0.139 c0.048-0.062 0.092-0.127 0.135-0.193c0.03-0.049 0.062-0.098 0.091-0.146c0.04-0.07 0.075-0.141 0.108-0.213 c0.024-0.051 0.05-0.102 0.071-0.154c0.031-0.078 0.057-0.156 0.082-0.234c0.017-0.051 0.036-0.102 0.05-0.154 c0.023-0.088 0.04-0.178 0.056-0.268c0.008-0.045 0.02-0.092 0.026-0.137c0.018-0.139 0.028-0.277 0.028-0.418V48.735 C97.176 48.6 97.2 48.5 97.1 48.319z M63.238 32.073l25.001 16.666L77.072 56.21l-13.834-9.254V32.073z M56.856 32.1 v14.883L43.023 56.21l-11.168-7.471L56.856 32.073z M29.301 54.708l7.983 5.34l-7.983 5.34V54.708z M56.856 88.022L31.855 71.4 l11.168-7.469l13.833 9.252V88.022z M60.048 67.597l-11.286-7.549l11.286-7.549l11.285 7.549L60.048 67.597z M63.238 88.022V73.14 l13.834-9.252l11.167 7.469L63.238 88.022z M90.794 65.388l-7.982-5.34l7.982-5.34V65.388z"}))),Rt=Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#codepen-logo"})),Ut=Object(O.h)("svg",{style:"width:24px;height:24px",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M4,4H7L9,2H15L17,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9Z"})),Kt=Object(O.h)("div",{class:"footer__separator hide-on-mobile"}),qt=Object(O.h)("svg",{viewBox:"0 0 100 100",style:"transform:rotate(-90deg)"},Object(O.h)("use",{xlinkHref:"#mode-icon"})),Jt=Object(O.h)("svg",{viewBox:"0 0 100 100"},Object(O.h)("use",{xlinkHref:"#mode-icon"})),Yt=Object(O.h)("svg",{viewBox:"0 0 100 100",style:"transform:rotate(90deg)"},Object(O.h)("use",{xlinkHref:"#mode-icon"})),Gt=Object(O.h)("svg",{viewBox:"0 0 100 100"},Object(O.h)("use",{xlinkHref:"#vertical-mode-icon"})),Zt=Object(O.h)("svg",{viewBox:"0 0 100 100"},Object(O.h)("rect",{x:"0",y:"0",width:"100",height:"100"})),Xt=Object(O.h)("svg",{viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M22,17V7H6V17H22M22,5A2,2 0 0,1 24,7V17C24,18.11 23.1,19 22,19H16V21H18V23H10V21H12V19H6C4.89,19 4,18.11 4,17V7A2,2 0 0,1 6,5H22M2,3V15H0V3A2,2 0 0,1 2,1H20V3H2Z"})),Qt=Object(O.h)("div",{class:"footer__separator"}),$t=Object(O.h)("svg",{viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M14,20A2,2 0 0,1 12,22A2,2 0 0,1 10,20H14M12,2A1,1 0 0,1 13,3V4.08C15.84,4.56 18,7.03 18,10V16L21,19H3L6,16V10C6,7.03 8.16,4.56 11,4.08V3A1,1 0 0,1 12,2Z"})),en=Object(O.h)("span",{class:"notifications-btn__dot"}),tn=Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#settings-icon"})),nn=Object(O.h)("a",{href:"https://webmakerapp.com/",target:"_blank",rel:"noopener noreferrer"},Object(O.h)("div",{class:"logo"})),on=Object(O.h)("span",{class:"web-maker-with-tag"},"Web Maker"),sn=Object(O.h)("svg",{style:"width:20px; height:20px; vertical-align:text-bottom",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"})),an=Object(O.h)("use",{xlinkHref:"#keyboard-icon"}),rn=Object(O.h)("use",{xlinkHref:"#twitter-icon"});let ln=class extends O.Component{constructor(e){super(e),this.state={isKeyboardShortcutsModalOpen:!1}}layoutBtnClickhandler(e){this.props.layoutBtnClickHandler(e)}render(){return Object(O.h)("div",{id:"footer",class:"footer"},Object(O.h)("div",{class:"footer__right fr"},Object(O.h)("a",{onClick:this.props.saveHtmlBtnClickHandler,id:"saveHtmlBtn",class:"mode-btn hint--rounded hint--top-left hide-on-mobile","data-hint":"Save as HTML file"},Wt),zt,Object(O.h)("a",{href:"",onClick:this.props.codepenBtnClickHandler,id:"codepenBtn",class:"mode-btn hint--rounded hint--top-left hide-on-mobile","aria-label":"Edit on CodePen"},Rt),Object(O.h)("a",{href:"",id:"screenshotBtn",class:"mode-btn hint--rounded hint--top-left show-when-extension",onClick:this.props.screenshotBtnClickHandler,"aria-label":"Take screenshot of preview"},Ut),Kt,Object(O.h)("a",{onClick:this.layoutBtnClickhandler.bind(this,1),id:"layoutBtn1",class:"mode-btn hide-on-mobile"},qt),Object(O.h)("a",{onClick:this.layoutBtnClickhandler.bind(this,2),id:"layoutBtn2",class:"mode-btn hide-on-mobile"},Jt),Object(O.h)("a",{onClick:this.layoutBtnClickhandler.bind(this,3),id:"layoutBtn3",class:"mode-btn hide-on-mobile"},Yt),Object(O.h)("a",{onClick:this.layoutBtnClickhandler.bind(this,5),id:"layoutBtn5",class:"mode-btn hide-on-mobile"},Gt),Object(O.h)("a",{onClick:this.layoutBtnClickhandler.bind(this,4),id:"layoutBtn4",class:"mode-btn hint--top-left hint--rounded hide-on-mobile","aria-label":"Full Screen"},Zt),Object(O.h)("a",{class:"mode-btn hint--top-left hint--rounded hide-on-mobile","aria-label":"Detach Preview",onClick:this.props.detachedPreviewBtnHandler},Xt),Qt,Object(O.h)("a",{onClick:this.props.notificationsBtnClickHandler,id:"notificationsBtn",class:`notifications-btn mode-btn hint--top-left hint--rounded ${this.props.hasUnseenChangelog?"has-new":""}`,"aria-label":"Notifications"},$t,en),Object(O.h)(y,{onClick:this.props.settingsBtnClickHandler,"data-event-category":"ui","data-event-action":"settingsBtnClick",class:"mode-btn hint--top-left hint--rounded","aria-label":"Settings"},tn)),nn,"\xA9",on," \xA0\xA0",Object(O.h)(y,{onClick:this.props.helpBtnClickHandler,"data-event-category":"ui","data-event-action":"helpButtonClick",class:"footer__link hint--rounded hint--top-right","aria-label":"Help"},sn),Object(O.h)(y,{onClick:this.props.keyboardShortcutsBtnClickHandler,"data-event-category":"ui","data-event-action":"keyboardShortcutButtonClick",class:"footer__link hint--rounded hint--top-right hide-on-mobile","aria-label":"Keyboard shortcuts"},Object(O.h)("svg",{style:{width:"20px",height:"20px",verticalAlign:"text-bottom"}},an)),Object(O.h)("a",{class:"footer__link hint--rounded hint--top-right","aria-label":"Tweet about 'Web Maker'",href:"http://twitter.com/share?url=https://webmakerapp.com/&text=Web Maker - A blazing fast %26 offline web playground! via @webmakerApp&related=webmakerApp&hashtags=web,frontend,playground,offline",target:"_blank",rel:"noopener noreferrer"},Object(O.h)("svg",{style:{width:"20px",height:"20px",verticalAlign:"text-bottom"}},rn)),Object(O.h)(y,{onClick:this.props.supportDeveloperBtnClickHandler,"data-event-action":"supportDeveloperFooterBtnClick",class:"footer__link ml-1 hint--rounded hint--top-right hide-on-mobile","aria-label":"Support the developer by pledging some amount",target:"_blank",rel:"noopener noreferrer"},"Support the developer"))}};var dn=n("gfUn"),cn=n.n(dn);const hn={async getItem(e){var t=await window.db.getDb();return t.doc(`items/${e}`).get().then((e)=>e.data())},async getUserItemIds(){if(window.user)return new Promise((e)=>{e(window.user.items||{})});var e=await window.db.getDb();return e.doc(`users/${window.user.uid}`).get().then((e)=>e.exists?e.data().items:{})},async getAllItems(){var e=Date.now(),t=o();let n=await this.getUserItemIds();n=Object.getOwnPropertyNames(n||{}),Object(dn.log)("itemids",n),n.length||t.resolve([]);var s=await window.db.getDb();const i=[];return s.collection("items").where("createdBy","==",window.user.uid).onSnapshot(function(n){n.forEach(function(e){i.push(e.data())}),Object(dn.log)("Items fetched in ",Date.now()-e,"ms"),t.resolve(i)},function(){t.resolve([])}),t.promise},async setUser(){const e=await window.db.getDb();return e.doc(`users/${window.user.uid}`).set({items:{}})},async setItem(e,t){const n=o();var s;if(db.local.set({[e]:t},()=>{!window.IS_EXTENSION&&window.user&&navigator.onLine||n.resolve()}),"code"===e)return!1;if(window.user){var i=await window.db.getDb();Object(dn.log)(`Starting to save item ${e}`),t.createdBy=window.user.uid,s=i.collection("items").doc(e).set(t,{merge:!0}).then((e)=>{Object(dn.log)("Document written",e),n.resolve()}).catch(n.reject)}return window.user&&navigator.onLine?s:n.promise},saveItems(e){var t=o();return window.user?window.db.getDb().then((n)=>{const o=n.batch();for(var s in e)e[s].createdBy=window.user.uid,o.set(n.doc(`items/${s}`),e[s]),o.update(n.doc(`users/${window.user.uid}`),{[`items.${s}`]:!0}),window.user.items=window.user.items||{},window.user.items[s]=!0;o.commit().then(t.resolve)}):(window.db.local.set(e,t.resolve),window.db.local.get({items:{}},function(t){for(var n in e)t.items[n]=!0;window.db.local.set({items:t.items})})),t.promise},async removeItem(e){if(!window.user){var t=o();return window.db.local.remove(e,t.resolve),t.promise}const n=await window.db.getDb();return Object(dn.log)(`Starting to save item ${e}`),n.collection("items").doc(e).delete().then((e)=>{Object(dn.log)("Document removed",e)}).catch((e)=>Object(dn.log)(e))},async setItemForUser(e){if(!window.user)return window.db.local.get({items:{}},function(t){t.items[e]=!0,window.db.local.set({items:t.items})});const t=await window.db.getDb();return t.collection("users").doc(window.user.uid).update({[`items.${e}`]:!0}).then((t)=>{Object(dn.log)(`Item ${e} set for user`,t),window.user.items=window.user.items||{},window.user.items[e]=!0}).catch((e)=>Object(dn.log)(e))},async unsetItemForUser(e){if(!window.user)return window.db.local.get({items:{}},function(t){delete t.items[e],window.db.local.set({items:t.items})});const t=await window.db.getDb();return t.collection("users").doc(window.user.uid).update({[`items.${e}`]:firebase.firestore.FieldValue.delete()}).then((t)=>{delete window.user.items[e],Object(dn.log)(`Item ${e} unset for user`,t)}).catch((e)=>Object(dn.log)(e))}};var pn;const un={add:function(e){const t=$("#js-alerts-container");t.textContent=e,t.classList.add("is-active"),clearTimeout(pn),pn=setTimeout(function(){t.classList.remove("is-active")},2e3)}};window.alertsService=un;var mn=Object(O.h)("div",{class:"mt-1"},"No match found."),gn=Object(O.h)("span",{class:"show-when-selected"},"(Ctrl/\u2318 + F)"),fn=Object(O.h)("h2",{class:"opacity--30"},"Nothing saved here.");let bn=class extends O.Component{constructor(e){super(e),this.items=[],this.state={filteredItems:[]}}componentWillUpdate(e){this.props.items!==e.items&&(this.items=Object.values(e.items),this.items.sort(function(e,t){return t.updatedOn-e.updatedOn}),this.setState({filteredItems:this.items}))}componentDidUpdate(e){this.props.isOpen&&!e.isOpen&&(window.searchInput.value="")}onCloseIntent(){this.props.closeHandler()}itemClickHandler(e){this.props.itemClickHandler(e)}itemRemoveBtnClickHandler(t,n){n.stopPropagation(),this.props.itemRemoveBtnClickHandler(t)}itemForkBtnClickHandler(t,n){n.stopPropagation(),this.props.itemForkBtnClickHandler(t)}keyDownHandler(e){if(this.props.isOpen){const t=e.ctrlKey||e.metaKey,n=t&&70===e.keyCode,o=40===e.keyCode,s=38===e.keyCode,i=13===e.keyCode,a=$(".js-saved-item-tile.selected"),r=0!==$all(".js-saved-item-tile").length;if((o||s)&&r){const e=o?"nextUntil":"previousUntil";a?(a.classList.remove("selected"),a[e](".js-saved-item-tile:not(.hide)").classList.add("selected")):$(".js-saved-item-tile:not(.hide)").classList.add("selected"),$(".js-saved-item-tile.selected").scrollIntoView(!1)}if(i&&a){const e=this.props.items[a.dataset.itemId];console.log("opening",e),this.props.itemClickHandler(e),v("ui","openItemKeyboardShortcut")}if(n){e.preventDefault();const t=this.props.items[a.dataset.itemId];this.props.itemForkBtnClickHandler(t),v("ui","forkKeyboardShortcut")}}}mergeImportedItems(e){var t=[],n={};const s=o(),i={};this.items.forEach((e)=>i[e.id]=e),e.forEach((e)=>{i[e.id]?t.push(e.id):(c("merging",e.id),n[e.id]=e)});var a=e.length-t.length;if(t.length){var r=confirm(t.length+" creations already exist. Do you want to replace them?");r&&(c("shouldreplace",r),e.forEach((e)=>{n[e.id]=e}),a=e.length)}return a?hn.saveItems(n).then(()=>{s.resolve(),un.add(a+" creations imported successfully."),v("fn","itemsImported",a)}):s.resolve(),this.props.closeHandler(),s.promise}importFileChangeHandler(t){var e=t.target.files[0],n=new FileReader;n.addEventListener("load",(e)=>{var t;try{t=JSON.parse(e.target.result),c(t),this.mergeImportedItems(t)}catch(e){c(e),alert("Oops! Selected file is corrupted. Please select a file that was generated by clicking the \"Export\" button.")}}),n.readAsText(e,"utf-8")}importBtnClickHandler(t){var e=document.createElement("input");e.type="file",e.style.display="none",e.accept="accept=\"application/json",document.body.appendChild(e),e.addEventListener("change",this.importFileChangeHandler.bind(this)),e.click(),v("ui","importBtnClicked"),t.preventDefault()}searchInputHandler(t){const e=t.target.value;e?this.setState({filteredItems:this.items.filter((t)=>-1!==t.title.toLowerCase().indexOf(e))}):this.setState({filteredItems:this.items}),v("ui","searchInputType")}render(){return Object(O.h)("div",{id:"js-saved-items-pane",class:`saved-items-pane ${this.props.isOpen?"is-open":""}`,onKeyDown:this.keyDownHandler.bind(this)},Object(O.h)("button",{onClick:this.onCloseIntent.bind(this),class:"btn saved-items-pane__close-btn",id:"js-saved-items-pane-close-btn"},"X"),Object(O.h)("div",{class:"flex flex-v-center",style:"justify-content: space-between;"},Object(O.h)("h3",null,"My Library (",this.items.length,")"),Object(O.h)("div",{class:"main-header__btn-wrap"},Object(O.h)("a",{onClick:this.props.exportBtnClickHandler,href:"",class:"btn btn-icon hint--bottom-left hint--rounded hint--medium","aria-label":"Export all your creations into a single importable file."},"Export"),Object(O.h)("a",{onClick:this.importBtnClickHandler.bind(this),href:"",class:"btn btn-icon hint--bottom-left hint--rounded hint--medium","aria-label":"Only the file that you export through the 'Export' button can be imported."},"Import"))),Object(O.h)("input",{id:"searchInput",class:"search-input",onInput:this.searchInputHandler.bind(this),placeholder:"Search your creations here..."}),Object(O.h)("div",{id:"js-saved-items-wrap",class:"saved-items-pane__container"},!this.state.filteredItems.length&&this.items.length&&mn,this.state.filteredItems.map((e)=>Object(O.h)("div",{class:"js-saved-item-tile saved-item-tile","data-item-id":e.id,onClick:this.itemClickHandler.bind(this,e)},Object(O.h)("div",{class:"saved-item-tile__btns"},Object(O.h)("a",{class:"js-saved-item-tile__fork-btn saved-item-tile__btn hint--left hint--medium","aria-label":"Creates a duplicate of this creation (Ctrl/\u2318 + F)",onClick:this.itemForkBtnClickHandler.bind(this,e)},"Fork",gn),Object(O.h)("a",{class:"js-saved-item-tile__remove-btn saved-item-tile__btn hint--left","aria-label":"Remove",onClick:this.itemRemoveBtnClickHandler.bind(this,e)},"X")),Object(O.h)("h3",{class:"saved-item-tile__title"},e.title),Object(O.h)("span",{class:"saved-item-tile__meta"},"Last updated: ",d(e.updatedOn)))),!this.items.length&&fn))}};const vn=[{url:"https://code.jquery.com/jquery-3.2.1.min.js",label:"jQuery",type:"js"},{url:"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js",label:"Bootstrap 3",type:"js"},{url:"https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js",label:"Bootstrap 4",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/foundation/6.4.3/js/foundation.min.js",label:"Foundation",type:"js"},{url:"https://semantic-ui.com/dist/semantic.min.js",label:"Semantic UI",type:"js"},{url:"https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js",label:"Angular",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/react/16.2.0/umd/react.production.min.js",label:"React",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.2.0/umd/react-dom.production.min.js",label:"React DOM",type:"js"},{url:"https://unpkg.com/vue/dist/vue.min.js",label:"Vue.js",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/three.js/89/three.min.js",label:"Three.js",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/d3/4.13.0/d3.min.js",label:"D3",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.min.js",label:"P5.js",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.dom.min.js",label:"P5.js DOM",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.sound.min.js",label:"P5.js Sound",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js",label:"Underscore",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TweenMax.min.js",label:"Greensock TweenMax",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/uikit.min.js",label:"UIkit 2",type:"js"},{url:"https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.42/js/uikit.min.js",label:"UIkit 3",type:"js"}],Cn=[{url:"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css",label:"Bootstrap 3",type:"css"},{url:"https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css",label:"Bootstrap 4",type:"css"},{url:"https://cdnjs.cloudflare.com/ajax/libs/foundation/6.4.3/css/foundation.min.css",label:"Foundation",type:"css"},{url:"https://semantic-ui.com/dist/semantic.min.css",label:"Semantic UI",type:"css"},{url:"https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css",label:"Bulma",type:"css"},{url:"https://cdnjs.cloudflare.com/ajax/libs/hint.css/2.5.0/hint.min.css",label:"Hint.css",type:"css"},{url:"https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css",label:"Tailwind.css",type:"css"},{url:"https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/uikit.min.css",label:"UIkit 2",type:"css"},{url:"https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.42/css/uikit.min.css",label:"UIkit 3",type:"css"},{url:"https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css",label:"Animate.css",type:"css"},{url:"https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css",label:"FontAwesome 4",type:"css"},{url:"https://use.fontawesome.com/releases/v5.0.10/css/all.css",label:"FontAwesome 5",type:"css"}];let yn=class extends O.Component{componentDidMount(){this.t=this.wrap.querySelector("input,textarea"),this.filter=this.props.filter,this.selectedCallback=this.props.onSelect,setTimeout(()=>{requestIdleCallback(()=>{document.body.appendChild(this.list),this.list.style.position="fixed"})},100),this.t.addEventListener("input",(t)=>this.onInput(t)),this.t.addEventListener("keydown",(t)=>this.onKeyDown(t)),this.t.addEventListener("blur",(t)=>this.closeSuggestions(t)),this.list.addEventListener("mousedown",(t)=>this.onListMouseDown(t))}componentWillUnmount(){this.t.removeEventListener("input",(t)=>this.onInput(t)),this.t.removeEventListener("keydown",(t)=>this.onKeyDown(t)),this.t.removeEventListener("blur",(t)=>this.closeSuggestions(t)),this.list.removeEventListener("mousedown",(t)=>this.onListMouseDown(t))}get currentLineNumber(){return this.t.value.substr(0,this.t.selectionStart).split("\n").length}get currentLine(){var e=this.currentLineNumber;return this.t.value.split("\n")[e-1]}closeSuggestions(){this.list.classList.remove("is-open"),this.isShowingSuggestions=!1}getList(e){return fetch("https://api.cdnjs.com/libraries?search="+e).then((e)=>e.json().then((e)=>e.results))}replaceCurrentLine(e){var t=this.t.value.split("\n");t.splice(this.currentLineNumber-1,1,e),this.t.value=t.join("\n")}onInput(){var e=this.currentLine;if(e){if(-1!==e.indexOf("/")||e.match(/https*:\/\//))return;clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.loader.style.display="block",this.getList(e).then((e)=>{if(this.loader.style.display="none",!e.length)return void this.closeSuggestions();this.list.innerHTML="",this.filter&&(e=e.filter(this.filter));for(var t=0;t${e[t].name}`;this.isShowingSuggestions=!0,this.textareaBounds||(this.textareaBounds=this.t.getBoundingClientRect(),this.list.style.top=this.textareaBounds.bottom+"px",this.list.style.left=this.textareaBounds.left+"px",this.list.style.width=this.textareaBounds.width+"px"),this.list.classList.add("is-open")})},500)}}onKeyDown(e){var t;this.isShowingSuggestions&&(27===e.keyCode&&(this.closeSuggestions(),e.stopPropagation()),40===e.keyCode&&this.isShowingSuggestions?(t=this.list.querySelector(".selected"),t?(t.classList.remove("selected"),t.nextElementSibling.classList.add("selected")):this.list.querySelector("li:first-child").classList.add("selected"),this.list.querySelector(".selected").scrollIntoView(!1),e.preventDefault()):38===e.keyCode&&this.isShowingSuggestions?(t=this.list.querySelector(".selected"),t?(t.classList.remove("selected"),t.previousElementSibling.classList.add("selected")):this.list.querySelector("li:first-child").classList.add("selected"),this.list.querySelector(".selected").scrollIntoView(!1),e.preventDefault()):13===e.keyCode&&this.isShowingSuggestions&&(t=this.list.querySelector(".selected"),this.selectSuggestion(t.dataset.url),this.closeSuggestions()))}onListMouseDown(e){var t=e.target;t.parentElement.dataset.url&&this.selectSuggestion(t.parentElement.dataset.url)}selectSuggestion(e){this.t.focus(),v("ui","autoSuggestionLibSelected",e),this.selectedCallback?this.selectedCallback.call(null,e):this.replaceCurrentLine(e),this.closeSuggestions()}render(){return Object(O.h)("div",{class:`btn-group ${this.props.fullWidth?"flex-grow":""}`,ref:(e)=>this.wrap=e},this.props.children,Object(O.h)("ul",{ref:(e)=>this.list=e,class:"dropdown__menu autocomplete-dropdown"}),Object(O.h)("div",{ref:(e)=>this.loader=e,class:"loader autocomplete__loader",style:"display:none"}))}};var Sn=Object(O.h)("h1",null,"Add Library"),wn=Object(O.h)("svg",{style:"width: 30px; height: 30px;fill:#999"},Object(O.h)("use",{xlinkHref:"#search"})),kn=Object(O.h)("input",{type:"text",id:"externalLibrarySearchInput",class:"full-width",placeholder:"Type here to search libraries"}),xn=Object(O.h)("div",{class:"tar opacity--70"},Object(O.h)("small",null,"Powered by cdnjs")),Mn=Object(O.h)("option",{value:""},"-------"),_n=Object(O.h)("h3",{class:"mb-0"},"JS"),Ln=Object(O.h)("p",{class:"mt-0 help-text"},"Put each library in new line"),In=Object(O.h)("p",{style:"font-size: 0.8em;",class:"show-when-extension opacity--70"},"Note: You can load external scripts from following domains: localhost, https://ajax.googleapis.com, https://code.jquery.com, https://cdnjs.cloudflare.com, https://unpkg.com, https://maxcdn.com, https://cdn77.com, https://maxcdn.bootstrapcdn.com, https://cdn.jsdelivr.net/, https://rawgit.com, https://wzrd.in"),Hn=Object(O.h)("h3",{class:"mb-0"},"CSS"),An=Object(O.h)("p",{class:"mt-0 help-text"},"Put each library in new line");let jn=class extends O.Component{constructor(e){super(e),this.state={css:e.css||"",js:e.js||""}}onSelectChange(t){const e=t.target;if(e.value){const t=e.selectedOptions[0].dataset.type;"js"===t?this.setState({js:`${this.state.js}\n${e.value}`}):this.setState({css:`${this.state.css}\n${e.value}`}),v("ui","addLibrarySelect",e.selectedOptions[0].label),this.props.onChange({js:this.state.js,css:this.state.css}),e.value=""}}textareaBlurHandler(t,e){const n=t?t.target:e,o=n.dataset.lang;"js"===o?this.setState({js:n.value||""}):this.setState({css:n.value||""}),this.props.onChange({js:this.state.js,css:this.state.css})}suggestionSelectHandler(e){const t=e.match(/\.js$/)?window.externalJsTextarea:window.externalCssTextarea;t.value=`${t.value}\n${e}`,window.externalLibrarySearchInput.value="",this.textareaBlurHandler(null,t)}render(){return Object(O.h)("div",null,Sn,Object(O.h)("div",{class:"flex"},wn,Object(O.h)(yn,{fullWidth:!0,onSelect:this.suggestionSelectHandler.bind(this)},kn)),xn,Object(O.h)("div",{style:"margin:20px 0;"},"Choose from popular libraries:"," ",Object(O.h)("select",{name:"",id:"js-add-library-select",onChange:this.onSelectChange.bind(this)},Mn,Object(O.h)("optgroup",{label:"JavaScript Libraries"},vn.map((e)=>Object(O.h)("option",{"data-type":e.type,value:e.url},e.label))),Object(O.h)("optgroup",{label:"CSS Libraries"},Cn.map((e)=>Object(O.h)("option",{"data-type":e.type,value:e.url},e.label))))),_n,Ln,In,Object(O.h)("textarea",{onBlur:this.textareaBlurHandler.bind(this),"data-lang":"js",class:"full-width",id:"externalJsTextarea",cols:"30",rows:"5",placeholder:"Put each library in new line",value:this.state.js}),Hn,An,Object(O.h)("textarea",{onBlur:this.textareaBlurHandler.bind(this),"data-lang":"css",class:"full-width",id:"externalCssTextarea",cols:"30",rows:"5",placeholder:"Put each library in new line",value:this.state.css}))}};var Bn=n("ZUoI"),En=n.n(Bn);const On={logout(){En.a.auth().signOut()},login(e){var t;return"facebook"===e?t=new En.a.auth.FacebookAuthProvider:"twitter"===e?t=new En.a.auth.TwitterAuthProvider:"google"===e?(t=new En.a.auth.GoogleAuthProvider,t.addScope("https://www.googleapis.com/auth/userinfo.profile")):t=new En.a.auth.GithubAuthProvider,En.a.auth().signInWithPopup(t).then(function(){v("fn","loggedIn",e),window.db.local.set({lastAuthProvider:e})}).catch(function(e){c(e),"auth/account-exists-with-different-credential"===e.code&&alert("You have already signed up with the same email using different social login")})}};var Tn=Object(O.h)("h2",null,"Login / Signup"),Vn=Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#github-icon"})),Pn=Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#google-icon"})),Dn=Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#fb-icon"})),Fn=Object(O.h)("p",null,"Join a community of 50,000+ Developers");let Nn=class extends O.Component{login(t){const e=t.target.dataset.authProvider;v("ui","loginProviderClick",e),On.login(e)}componentDidMount(){window.db.local.get({lastAuthProvider:""},(e)=>{e.lastAuthProvider&&document.body.classList.add(`last-login-${e.lastAuthProvider}`)})}render(){return Object(O.h)("div",null,Tn,Object(O.h)("div",null,Object(O.h)("p",null,Object(O.h)("button",{type:"button",onClick:this.login.bind(this),class:"social-login-btn social-login-btn--github btn btn-icon btn--big full-width hint--right hint--always","data-auth-provider":"github","data-hint":"You logged in with Github last time"},Vn,"Login with Github")),Object(O.h)("p",null,Object(O.h)("button",{type:"button",onClick:this.login.bind(this),class:"social-login-btn social-login-btn--google btn btn-icon btn--big full-width hint--right hint--always","data-auth-provider":"google","data-hint":"You logged in with Google last time"},Pn,"Login with Google")),Object(O.h)("p",{class:"mb-2"},Object(O.h)("button",{type:"button",onClick:this.login.bind(this),class:"social-login-btn social-login-btn--facebook btn btn-icon btn--big full-width hint--right hint--always","data-auth-provider":"facebook","data-hint":"You logged in with Facebook last time"},Dn,"Login with Facebook")),Fn))}};En.a.initializeApp({apiKey:"AIzaSyBl8Dz7ZOE7aP75mipYl2zKdLSRzBU2fFc",authDomain:"web-maker-app.firebaseapp.com",databaseURL:"https://web-maker-app.firebaseio.com",projectId:"web-maker-app",storageBucket:"web-maker-app.appspot.com",messagingSenderId:"560473480645"});var Wn=n("7vHL"),zn=Object.assign||function(e){for(var t,n=1;n{async function e(){return s?s:(c("Initializing firestore"),s=new Promise((e,t)=>n?e(n):En.a.firestore().enablePersistence().then(function(){n=En.a.firestore(),c("firebase db ready",n),e(n)}).catch(function(e){t(e.code),"failed-precondition"===e.code?(alert("Opening Web Maker web app in multiple tabs isn't supported at present and it seems like you already have it opened in another tab. Please use in one tab."),v("fn","multiTabError")):"unimplemented"===e.code})),s)}const t=1;var n,s,i={get:(e,n)=>{const o={};"string"==typeof e?(o[e]=JSON.parse(window.localStorage.getItem(e)),setTimeout(()=>n(o),t)):(Object.keys(e).forEach((t)=>{const n=window.localStorage.getItem(t);o[t]=void 0===n||null===n?e[t]:JSON.parse(n)}),setTimeout(()=>n(o),t))},set:(e,n)=>{Object.keys(e).forEach((t)=>{window.localStorage.setItem(t,JSON.stringify(e[t]))}),setTimeout(()=>{if(n)return n()},t)},remove:(e,n)=>{window.localStorage.removeItem(e),setTimeout(()=>n(),t)}};const a=chrome&&chrome.storage?chrome.storage.local:i,r=chrome&&chrome.storage?chrome.storage.sync:i;window.db={getDb:e,getUser:async function(t){const n=await e();return n.doc(`users/${t}`).get().then((e)=>{if(!e.exists)return n.doc(`users/${t}`).set({},{merge:!0});const o=e.data();return zn(window.user,o),o})},getUserLastSeenVersion:async function(){const e=o();return r.get({lastSeenVersion:""},(t)=>{e.resolve(t.lastSeenVersion)}),e.promise},setUserLastSeenVersion:async function(t){if(r.set({lastSeenVersion:t},function(){}),window.user){const n=await e();n.doc(`users/${window.user.uid}`).update({lastSeenVersion:t})}},getSettings:function(e){const t=o();return r.get(e,(e)=>{t.resolve(e)}),t.promise},local:a,sync:r}})();var Rn=Object(O.h)("div",null,Object(O.h)("h1",null,"Whats new?"),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"3.2.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"\uD83D\uDE80 Loop timeout setting"),": You now have a setting to tweak the maximum timeout of a loop iteration before it's marked as infinite loop."),Object(O.h)("li",null,Object(O.h)("strong",null,"\u267F\uFE0F Accessibility"),": Modals now have proper keyboard navigation integrated."),Object(O.h)("li",null,Object(O.h)("strong",null,"\u267F\uFE0F Accessibility"),": Color contrast improvements."),Object(O.h)("li",null,"\uD83D\uDE80 Popular libraries list updated. Thanks",Object(O.h)("a",{href:"https://github.com/diomed",target:"_blank"},"@diomed")," ","&"," ",Object(O.h)("a",{href:"https://github.com/leninalbertolp",target:"_blank"},"@leninalbertolp")),Object(O.h)("li",null,Object(O.h)("strong",null,"\uD83D\uDD27 Bugfix"),": Modal take up appropriate width instead of spanning full width."),Object(O.h)("br",null),Object(O.h)("li",null,Object(O.h)("strong",null,"\uD83D\uDE80 Announcement"),": Hi! I am Kushagra Gour (creator of Web Maker) and I have launched a",Object(O.h)("a",{href:"https://patreon.com/kushagra",target:"_blank"},"Patreon campaign"),". If you love Web Maker, consider pledging to",Object(O.h)("a",{href:"https://patreon.com/kushagra",target:"_blank"},"support me")," ",":)"),Object(O.h)("li",null,Object(O.h)("a",{href:"https://github.com/chinchang/web-maker/issues",target:"_blank"},"Suggest features or report bugs.")),Object(O.h)("li",null,"Web Maker now has more than 50K weekly active users! Thank you for being a part of this community of awesome developers. If you find Web Maker helpful,",Object(O.h)("a",{href:"https://chrome.google.com/webstore/detail/web-maker/lkfkkhfhhdkiemehlpkgjeojomhpccnh/reviews",target:"_blank",class:"btn"},"Please rate Web Maker ",Object(O.h)("span",{class:"star"})),"\xA0",Object(O.h)("a",{href:"http://twitter.com/share?url=https://webmakerapp.com/&text=Web Maker - A blazing fast %26 offline web playground! via @webmakerApp&related=webmakerApp&hashtags=web,editor,chrome,extension",target:"_blank",target:"_blank",class:"btn"},"Share it"),"\xA0",Object(O.h)("a",{"aria-label":"Support the developer","d-click":"openSupportDeveloperModal","data-event-action":"supportDeveloperChangelogBtnClick",class:"btn btn-icon"},"Support the developer")))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"3.1.1"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": Fix the \"Run\" button not refreshing the preview after release 3.0.4."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"3.1.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Mobile Support (app only)."),": Make the Web Maker app usable on mobile. This is only for web app as Chrome extensions don't run on mobile."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"3.0.4"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": Guarantee code doesn't execute when \"auto preview\" is off."),Object(O.h)("li",null,"Add link to our new",Object(O.h)("a",{href:"https://web-maker.slack.com",target:"_blank",rel:"noopener noreferrer"},"Slack channel")," ","\uD83E\uDD17."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"3.0.3"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix (extension)"),": \"Save as HTML\" file saves with correct extension."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"3.0.1"),Object(O.h)("ul",null,Object(O.h)("li",null,"After months of work, here is Web Maker 3.0.",Object(O.h)("a",{href:"https://medium.com/web-maker/web-maker-3-0-is-here-f158a40eeaee",target:"_blank",rel:"noopener noreferrer"},"Read the blog post about it"),"."),Object(O.h)("li",null,"Web Maker is no more just a Chrome extension, it is also available as web app that runs offline just like the extension! Checkout it out ->",Object(O.h)("a",{href:"https://webmakerapp.com/app/",target:"_blank",rel:"noopener noreferrer"},"https://webmakerapp.com/app/"),"."),Object(O.h)("li",null,"Now use Web Maker web app on any modern browser (tested with Chrome and Firefox)."),Object(O.h)("li",null,Object(O.h)("strong",null,"User Accounts")," - The much requested user accounts are here. Now maintain your account and store all your creations in the cloud and access them anywhere anytime."),Object(O.h)("li",null,Object(O.h)("strong",null,"New layout mode")," - One more layout mode, that lets you align all the panes vertically."),Object(O.h)("li",null,Object(O.h)("strong",null,"No more restriction on scripts (Web app only)")," - If you are using the web app, there is no more a restriction to load scripts from only specific domains. Load any script!"),Object(O.h)("li",null,Object(O.h)("strong",null,"Inline scripts (Web app only)")," - The restriction of writing JavaScript only in JS pane is also removed."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.9.7"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("a",{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer"},"Tailwind CSS")," ","added to popular CSS libraries list. Thanks",Object(O.h)("a",{href:"https://github.com/diomed",target:"_blank",rel:"noopener noreferrer"},"diomed"),"."),Object(O.h)("li",null,"Popular libraries list updated. Thanks",Object(O.h)("a",{href:"https://github.com/diomed",target:"_blank",rel:"noopener noreferrer"},"diomed"),"."),Object(O.h)("li",null,Object(O.h)("strong",null,"Dev"),": Bug fixes and code refactoring to make things simple. Thanks",Object(O.h)("a",{href:"https://github.com/iamandrewluca",target:"_blank",rel:"noopener noreferrer"},"iamandrewluca"),"."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.9.6"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": Fix close buttons not working in notifications and keyboard shortcuts modal."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": Fix keyboard shortcut to see keyboard shortcuts :) Thanks",Object(O.h)("a",{href:"https://github.com/ClassicOldSong",target:"_blank",rel:"noopener noreferrer"},"ClassicOldSong"),"."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.9.5"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("a",{href:"https://medium.com/web-maker/release-2-9-5-add-library-search-pane-collapsing-ux-improvements-more-1085216c1301",target:"_blank",rel:"noopener noreferrer"},"Read blog post about this release.")),Object(O.h)("li",null,Object(O.h)("strong",null,"Keyboard shortcuts panel"),": Add a list of all keyboard shotcuts. Access with",Object(O.h)("code",null," Ctrl/\u2318 + Shift + ?")," or click keyboard button in footer."),Object(O.h)("li",null,Object(O.h)("strong",null,"Add external library"),": Better UX for searching third party libraries."),Object(O.h)("li",null,Object(O.h)("strong",null,"Improvement"),": Code panes now go fullscreen when double-clicked on their headers - which is much more intuitive behavior based on feedback from lot of developers."),Object(O.h)("li",null,Object(O.h)("strong",null,"Improvement"),": Add",Object(O.h)("code",null,"allowfullscreen")," attribute on iframes. Thanks",Object(O.h)("a",{href:"https://github.com/ClassicOldSong",target:"_blank",rel:"noopener noreferrer"},"ClassicOldSong"),"."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Stop screenlog.js from showing up in the exported HTML."),Object(O.h)("li",null,"Popular external libraries list updated. Thanks",Object(O.h)("a",{href:"https://github.com/jlapitan",target:"_blank",rel:"noopener noreferrer"},"jlapitan"),"."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.9.4"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Improvement"),": Atomic CSS (Atomizer) has been updated to latest version. Now you can do things like psuedo elements. Learn More."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Logging circular objects is now possible. It won't show in the Web Maker console, but will show fine in browser's console."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Console's z-index issue has been fixed."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.9.3"),Object(O.h)("ul",null,Object(O.h)("li",null,"Choose the save location while exporting your saved creations. Now easily sync them to your Dropbox or any cloud storage."),Object(O.h)("li",null,"All modals inside the app now have a close button."),Object(O.h)("li",null,"Checkbox that showed on clicking a boolean value is now removed. Thanks",Object(O.h)("a",{href:"https://github.com/gauravmuk",target:"_blank",rel:"noopener noreferrer"},"Gaurav Nanda"),"."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Screenshots on retina device are now correct. Thanks",Object(O.h)("a",{href:"https://github.com/AshBardhan",target:"_blank",rel:"noopener noreferrer"},"Ashish Bardhan"),"."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Double console log in detached mode fixed."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Console.clear now works in detached mode too."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - DOCTYPE added in preview."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Typo correction in README. Thanks",Object(O.h)("a",{href:"https://github.com/AdilMah",target:"_blank",rel:"noopener noreferrer"},"Adil Mahmood"),"."),Object(O.h)("li",null,"gstatic.com is available to load external JavaScripts from."),Object(O.h)("li",null,"Popular libraries list updated. Thanks",Object(O.h)("a",{href:"https://github.com/diomed",target:"_blank",rel:"noopener noreferrer"},"diomed"),"."),Object(O.h)("li",null,"Added",Object(O.h)("a",{href:"https://github.com/chinchang/web-maker/blob/master/CONTRIBUTING.md",target:"_blank",rel:"noopener noreferrer"},"contribution guidelines")," ","in the Github repository."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.9.2"),Object(O.h)("ul",null,Object(O.h)("li",null,"Minor bug fixes."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.9.1"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("a",{href:"https://medium.com/web-maker/v2-9-lots-of-goodies-bd1e939571f6",target:"_blank",rel:"noopener noreferrer"},"Read blog post about last release.")),Object(O.h)("li",null,"Use Ctrl/Cmd+D to select next occurence of matching selection."),Object(O.h)("li",null,"Improve onboard experience."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.9.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("a",{href:"https://medium.com/web-maker/v2-9-lots-of-goodies-bd1e939571f6",target:"_blank",rel:"noopener noreferrer"},"Read blog post about this release.")),Object(O.h)("li",null,Object(O.h)("strong",null,"Detached Preview")," - Yes, you read that correct! You can now detach your preview and send it to your secondary monitor."),Object(O.h)("li",null,Object(O.h)("strong",null,"Find & Replace")," - Long awaited, now its there. Ctrl/Cmd+f to find and add Alt to replace."),Object(O.h)("li",null,Object(O.h)("strong",null,"Atomic CSS (Atomizer) configurations")," - Add custom config for Atomic CSS.",Object(O.h)("a",{href:"https://github.com/acss-io/atomizer#api",target:"_blank",rel:"noopener noreferrer"},"Read more"),"."),Object(O.h)("li",null,Object(O.h)("strong",null,"Light mode")," - This new setting makes Web Maker drop some heavy effects like blur etc to gain more performance. Thanks",Object(O.h)("a",{href:"https://github.com/iamandrewluca",target:"_blank",rel:"noopener noreferrer"},"Andrew"),"."),Object(O.h)("li",null,Object(O.h)("strong",null,"Preserve logs setting")," - Choose whether or not to preserve logs across preview refreshes. Thanks",Object(O.h)("a",{href:"https://github.com/BasitAli",target:"_blank",rel:"noopener noreferrer"},"Basit"),"."),Object(O.h)("li",null,Object(O.h)("strong",null,"Line wrap setting")," - As the name says."),Object(O.h)("li",null,"Semantic UI added to popular libraries."),Object(O.h)("li",null,"Bootstrap, Vue, UI-Kit and more updated to latest versions in popular libraries."),Object(O.h)("li",null,"UX improvements in settings UI"),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Trigger preview refresh anytime with Ctrl/\u2318 + Shift + 5. Even with auto-preview on."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.8.1"),Object(O.h)("ul",null,Object(O.h)("li",null,"Vue.js & UIKit version updated to latest version in 'Add Library' list."),Object(O.h)("li",null,"UTF-8 charset added to preview HTML to support universal characters."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.8.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("a",{href:"https://medium.com/web-maker/release-v2-8-is-out-f44e6ea5d9c4",target:"_blank",rel:"noopener noreferrer"},"Read blog post about this release.")),Object(O.h)("li",null,Object(O.h)("strong",null,"Auto Save")," - Your creations now auto-save after your first manual save. This is configurable from settings."),Object(O.h)("li",null,Object(O.h)("strong",null,"Base2Tone-Meadow Editor Theme")," - First user contributed theme. Thanks to Diomed."),Object(O.h)("li",null,Object(O.h)("strong",null,"Use System Fonts")," - You can now use any of your existing system fonts in the editor!"),Object(O.h)("li",null,Object(O.h)("strong",null,"Matching Tag Highlight")," - Cursor over any HTML tag would highlight the matching pair tag."),Object(O.h)("li",null,"Auto-completion suggestion can now be switched off from settings."),Object(O.h)("li",null,Object(O.h)("strong",null,"Improvement")," - Stop white flicker in editor when the app opens."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Add Babel Polyfill to enable use of next-gen built-ins like Promise or WeakMap."),Object(O.h)("li",null,"Vue.js version updated to 2.4.0 in popular library list."),Object(O.h)("li",null,"Downloads permission is optional. Asked only when you take screenshot."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.7.2"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"External Libraries")," - Add Foundation.js and update UIKit 3 to latest beta."),Object(O.h)("li",null,Object(O.h)("strong",null,"rawgit.com")," &",Object(O.h)("strong",null,"wzrd.in")," domains are now allowed for loading external libraries from."),Object(O.h)("li",null,"Minor booting speed improvements"))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.7.1"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Framer.js support")," - You can now load the latest framer.js library from",Object(O.h)("a",{href:"https://builds.framerjs.com/",target:"_blank",rel:"noopener noreferrer"},"framer builds page")," ","and start coding framer prototypes."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": Edit on CodePen is back in action."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": Autocompletion menu doesn't show on cut and paste now."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": Updated & fixed urls of some common external libraries to latest versions. UIKit3 & Bootstrap 4\u03B1 are now in the list."),Object(O.h)("li",null,"Preprocessor selector are now more accessible."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.7.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Fork any creation!"),": Now you can fork any existing creation of yours to start a new work based on it. One big use case of this feature is \"Templates\"!",Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://kushagragour.in/blog/2017/05/web-maker-fork-templates/?utm_source=webmakerapp&utm_medium=referral"},"Read more about it"),"."),Object(O.h)("li",null,Object(O.h)("strong",null,"Fonts \uD83D\uDE0D "),": Super-awesome 4 fonts (mostly with ligature support) now available to choose from. Fira Code is the default font now."),Object(O.h)("li",null,"Updated most used external libraries to latest versions."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": Add missing Bootstrap JS file to most used external libraries list."),Object(O.h)("li",null,"Several other minor bugfixes and improvements to make Web Maker awesome!"),Object(O.h)("li",null,"Great news to share with you - Web Maker has been featured on the Chrome Webstore homepage! Thanks for all the love :)"))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.6.1"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": Emojis vanishing while exporting to Codepen has been fixed."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),":",Object(O.h)("code",null,"console.clear()")," now doesn't error and clears the inbuilt console."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix"),": External libraries added to the creation are exported as well to Codepen."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.6.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"The \"Console\""),": The most awaited feature is here! There is now an inbuilt console to see your logs, errors and for quickly evaluating JavaScript code inside your preview. Enjoy! I also a",Object(O.h)("a",{href:"https://kushagragour.in/blog/2017/05/web-maker-console-is-here/?utm_source=webmakerapp&utm_medium=referral",target:"_blank",rel:"noopener noreferrer"},"blog post about it"),"."),Object(O.h)("li",null,"Number slider which popped on clicking any number in the code has been removed due to poor user experience."),Object(O.h)("li",null,"Minor usability improvements."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.5.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Atomic CSS"),": Use can now use Atomic CSS(ACSS) in your work!",Object(O.h)("a",{href:"https://acss.io/",target:"_blank",rel:"noopener noreferrer"},"Read more about it here"),"."),Object(O.h)("li",null,Object(O.h)("strong",null,"Search your saved creations"),": Easily search through all your saved creations by title."),Object(O.h)("li",null,Object(O.h)("strong",null,"Configurable Auto-preview")," - You can turn off the auto preview in settings if you don't want the preview to update as you type."),Object(O.h)("li",null,Object(O.h)("strong",null,"Configurable refresh on resize")," - You can configure whether you want the preview to refresh when you resize the preview panel."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Fix indentation",Object(O.h)("a",{href:"https://github.com/chinchang/web-maker/issues/104",target:"_blank",rel:"noopener noreferrer"},"issue")," ","with custom indentation size."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.4.2"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Improved infinite loop protection"),": Infinite loop protection is now faster and more reliable. And works without the need of Escodegen. Thanks to Ariya Hidayat!"),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Default parameters not working in JavaScript is fixed."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.4.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Import/Export"),": Your creations are most important. Now export all your creations into a single file as a backup that can be imported anytime & anywhere."),Object(O.h)("li",null,Object(O.h)("strong",null,"Editor themes"),": You have been heard. Now you can choose from a huge list of wonderful editor themes!"),Object(O.h)("li",null,Object(O.h)("strong",null,"Identation settings"),": Not a spaces fan? Switch to tabs and set your indentation size."),Object(O.h)("li",null,Object(O.h)("strong",null,"Vim key bindings"),": Rejoice Vim lovers!"),Object(O.h)("li",null,Object(O.h)("strong",null,"Code blast"),": Why don't you try coding with this switched on from the settings? Go on..."),Object(O.h)("li",null,Object(O.h)("strong",null,"Important"),": Due to security policy changes from Chrome 57 onwards, Web Maker now allows loading external JavaScript libraries only from certain whitelisted domains (localhost, https://ajax.googleapis.com, https://code.jquery.com, https://cdnjs.cloudflare.com, https://unpkg.com, https://maxcdn.com, https://cdn77.com, https://maxcdn.bootstrapcdn.com, https://cdn.jsdelivr.net/)"),Object(O.h)("li",null,"Save button now highlights when you have unsaved changes."),Object(O.h)("li",null,"Jade is now called Pug. Just a name change."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.3.2"),Object(O.h)("ul",null,Object(O.h)("li",null,"Update Babel to support latest and coolest ES6 features."),Object(O.h)("li",null,"Improve onboarding experience at first install."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.3.1"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Splitting of code and preview panes is remembered by the editor."),Object(O.h)("li",null,"Title of the creation is used for the file name when saving as HTML."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.3.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Add Library Autocompletion")," - Just start typing the name of library and you'll be shown matching libraries from cdnjs."),Object(O.h)("li",null,Object(O.h)("strong",null,"Preview Screenshot Capture")," - Want to grab a nice screenshot of your creation. You have it! Click and capture."),Object(O.h)("li",null,Object(O.h)("strong",null,"Auto Indent Code")," - Select your code and hit Shift-Tab to auto-indent it!"),Object(O.h)("li",null,Object(O.h)("strong",null,"Keyboard Navigation in Saved List")," - Now select your creation using arrow keys and hit ENTER to open it."),Object(O.h)("li",null,"Highlight active line in code panes."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Fix in generated title of new creation."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - HTML autocompletion is manual triggered now with Ctrl+Space."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.2.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Code Autocompletion")," - See code suggestions while you type!"),Object(O.h)("li",null,Object(O.h)("strong",null,"Full Screen Preview")," - Checkout your creation in a full-screen layout."),Object(O.h)("li",null,Object(O.h)("strong",null,"SASS")," - SASS support added for CSS."),Object(O.h)("li",null,Object(O.h)("strong",null,"Faster CSS update")," - Preview updates instantly without refresh when just CSS is changed."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Indentation fixed while going on new line."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Works even in Chrome Canary now. Though libraries can be added only through CDNs."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.1.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"TypeScript")," - Now you can code in TypeScript too!"),Object(O.h)("li",null,Object(O.h)("strong",null,"Stylus Preprocessor")," - Stylus supported adding for CSS."),Object(O.h)("li",null,Object(O.h)("strong",null,"Code Folding")," - Collapse large code blocks for easy editing."),Object(O.h)("li",null,Object(O.h)("strong",null,"Bugfix")," - Support JSX in JavaScript."),Object(O.h)("li",null,"Better onboarding for first time users."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"2.0.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Save and Load")," - Long pending and super-useful, now you can save your creations and resume them anytime later."),Object(O.h)("li",null,Object(O.h)("strong",null,"Insert JS & CSS")," - Load popular JavaScript & CSS libraries in your work without writing any code."),Object(O.h)("li",null,Object(O.h)("strong",null,"Collapsed Panes")," - Collapse/uncollapse code panes with a single click. Your pane configuration is even saved with every creation!"),Object(O.h)("li",null,Object(O.h)("strong",null,"Quick color & number change")," - Click on any color or number and experiment with quick values using a slider."),Object(O.h)("li",null,Object(O.h)("strong",null,"Linting")," - See your code errors right where you are coding."),Object(O.h)("li",null,"No more browser hang due to infinite loops!"))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"1.7.0"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("strong",null,"Preprocessors!")," - Enjoy a whole list of preprocessors for HTML(Jade & markdown), CSS(SCSS & LESS) and JavaScript(CoffeeScript & Babel)."),Object(O.h)("li",null,"More awesome font for code."))),Object(O.h)("div",{class:"notification"},Object(O.h)("span",{class:"notification__version"},"1.6.0"),Object(O.h)("ul",null,Object(O.h)("li",null,"You can now configure Web-Maker to not replace new tab page from the settings. It is always accessible from the icon in the top-right."),Object(O.h)("li",null,"Download current code as HTML file with Ctrl/\u2318 + S keyboard shortcut."),Object(O.h)("li",null,"New notifications panel added so you are always aware of the new changes in Web-Maker."))));const Un=["3024-day","3024-night","abcdef","ambiance","base2tone-meadow-dark","base16-dark","base16-light","bespin","blackboard","cobalt","colorforth","dracula","duotone-dark","duotone-light","eclipse","elegant","erlang-dark","hopscotch","icecoder","isotope","lesser-dark","liquibyte","material","mbo","mdn-like","midnight","monokai","neat","neo","night","panda-syntax","paraiso-dark","paraiso-light","pastel-on-dark","railscasts","rubyblue","seti","solarized dark","solarized light","the-matrix","tomorrow-night-bright","tomorrow-night-eighties","ttcn","twilight","vibrant-ink","xq-dark","xq-light","yeti","zenburn"];var Kn=Object(O.h)("h1",null,"Settings"),qn=Object(O.h)("h3",null,"Indentation"),Jn=Object(O.h)("datalist",{id:"indentationSizeList"},Object(O.h)("option",null,"1"),Object(O.h)("option",null,"2"),Object(O.h)("option",null,"3"),Object(O.h)("option",null,"4"),Object(O.h)("option",null,"5"),Object(O.h)("option",null,"6"),Object(O.h)("option",null,"7")),Yn=Object(O.h)("hr",null),Gn=Object(O.h)("h3",null,"Editor"),Zn=Object(O.h)("label",{class:"line"},"Default Preprocessors"),Xn=Object(O.h)("option",{value:"html"},"HTML"),Qn=Object(O.h)("option",{value:"markdown"},"Markdown"),$n=Object(O.h)("option",{value:"jade"},"Pug"),eo=Object(O.h)("option",{value:"css"},"CSS"),to=Object(O.h)("option",{value:"scss"},"SCSS"),no=Object(O.h)("option",{value:"sass"},"SASS"),oo=Object(O.h)("option",{value:"less"},"LESS"),so=Object(O.h)("option",{value:"stylus"},"Stylus"),io=Object(O.h)("option",{value:"acss"},"Atomic CSS"),ao=Object(O.h)("option",{value:"js"},"JS"),ro=Object(O.h)("option",{value:"coffee"},"CoffeeScript"),lo=Object(O.h)("option",{value:"es6"},"ES6 (Babel)"),co=Object(O.h)("option",{value:"typescript"},"TypeScript"),ho=Object(O.h)("option",{value:"FiraCode"},"Fira Code"),po=Object(O.h)("option",{value:"Inconsolata"},"Inconsolata"),uo=Object(O.h)("option",{value:"Monoid"},"Monoid"),mo=Object(O.h)("option",{value:"FixedSys"},"FixedSys"),go=Object(O.h)("option",{disabled:"disabled"},"----"),fo=Object(O.h)("option",{value:"other"},"Other font from system"),bo=Object(O.h)("hr",null),vo=Object(O.h)("h3",null,"Fun"),Co=Object(O.h)("hr",null),yo=Object(O.h)("h3",null,"Advanced"),So=Object(O.h)("div",{class:"help-text"},"If any loop iteration takes more than the defined time, it is detected as a potential infinite loop and further iterations are stopped.");let wo=class extends O.Component{updateSetting(t){this.props.onChange(t)}shouldComponentUpdate(){return!0}render(){return Object(O.h)("div",null,Kn,qn,Object(O.h)("div",{class:"line",title:"I know this is tough, but you have to decide one!"},Object(O.h)("label",null,Object(O.h)("input",{type:"radio",name:"indentation",value:"spaces",checked:"spaces"===this.props.prefs.indentation,onChange:this.updateSetting.bind(this),"data-setting":"indentWith"})," ","Spaces"),Object(O.h)("label",{class:"ml-1"},Object(O.h)("input",{type:"radio",name:"indentation",value:"tabs",checked:"tabs"===this.props.prefs.indentation,onChange:this.updateSetting.bind(this),"data-setting":"indentWith"})," ","Tabs")),Object(O.h)("label",{class:"line",title:""},"Indentation Size"," ",Object(O.h)("input",{type:"range",class:"va-m ml-1",value:this.props.prefs.indentSize,min:"1",max:"7",list:"indentationSizeList","data-setting":"indentSize",onChange:this.updateSetting.bind(this)}),Object(O.h)("span",{id:"indentationSizeValueEl"},this.props.prefs.indentSize),Jn),Yn,Gn,Object(O.h)("div",{class:"flex block--mobile"},Object(O.h)("div",null,Zn,Object(O.h)("div",{class:"flex line"},Object(O.h)("select",{style:"flex:1;margin-left:20px","data-setting":"htmlMode",value:this.props.prefs.htmlMode,onChange:this.updateSetting.bind(this)},Xn,Qn,$n),Object(O.h)("select",{style:"flex:1;margin-left:20px","data-setting":"cssMode",value:this.props.prefs.cssMode,onChange:this.updateSetting.bind(this)},eo,to,no,oo,so,io),Object(O.h)("select",{style:"flex:1;margin-left:20px","data-setting":"jsMode",value:this.props.prefs.jsMode,onChange:this.updateSetting.bind(this)},ao,ro,lo,co)),Object(O.h)("label",{class:"line"},"Theme",Object(O.h)("select",{style:"flex:1;margin:0 20px","data-setting":"editorTheme",value:this.props.prefs.editorTheme,onChange:this.updateSetting.bind(this)},Un.map((e)=>Object(O.h)("option",{value:e},e)))),Object(O.h)("label",{class:"line"},"Font",Object(O.h)("select",{style:"flex:1;margin:0 20px","data-setting":"editorFont",value:this.props.prefs.editorFont,onChange:this.updateSetting.bind(this)},ho,po,uo,mo,go,fo),"other"===this.props.prefs.editorFont&&Object(O.h)("input",{id:"customEditorFontInput",type:"text",value:this.props.prefs.editorCustomFont,placeholder:"Custom font name here","data-setting":"editorCustomFont",onChange:this.updateSetting.bind(this)})),Object(O.h)("label",{class:"line"},"Font Size"," ",Object(O.h)("input",{style:"width:70px",type:"number",value:this.props.prefs.fontSize,"data-setting":"fontSize",onChange:this.updateSetting.bind(this)})," ","px"),Object(O.h)("div",{class:"line"},"Key bindings",Object(O.h)("label",{class:"ml-1"},Object(O.h)("input",{type:"radio",name:"keymap",value:"sublime",checked:"sublime"===this.props.prefs.keymap,"data-setting":"keymap",onChange:this.updateSetting.bind(this)})," ","Sublime"),Object(O.h)("label",{class:"ml-1"},Object(O.h)("input",{type:"radio",name:"keymap",value:"vim",checked:"vim"===this.props.prefs.keymap,"data-setting":"keymap",onChange:this.updateSetting.bind(this)})," ","Vim"))),Object(O.h)("div",{class:"ml-2 ml-0--mobile"},Object(O.h)(M,{name:"lineWrap",title:"Toggle wrapping of long sentences onto new line",label:"Line wrap",pref:this.props.prefs.lineWrap,onChange:this.updateSetting.bind(this)}),Object(O.h)(M,{name:"refreshOnResize",title:"Your Preview will refresh when you resize the preview split",label:"Refresh preview on resize",pref:this.props.prefs.refreshOnResize,onChange:this.updateSetting.bind(this)}),Object(O.h)(M,{name:"autoComplete",title:"Turns on the auto-completion suggestions as you type",label:"Auto-complete suggestions",pref:this.props.prefs.autoComplete,onChange:this.updateSetting.bind(this)}),Object(O.h)(M,{name:"autoPreview",title:"Refreshes the preview as you code. Otherwise use the Run button",label:"Auto-preview",pref:this.props.prefs.autoPreview,onChange:this.updateSetting.bind(this)}),Object(O.h)(M,{name:"autoSave",title:"Auto-save keeps saving your code at regular intervals after you hit the first save manually",label:"Auto-save",pref:this.props.prefs.autoSave,onChange:this.updateSetting.bind(this)}),Object(O.h)(M,{name:"preserveLastCode",title:"Loads the last open creation when app starts",label:"Preserve last written code",pref:this.props.prefs.preserveLastCode,onChange:this.updateSetting.bind(this)}),Object(O.h)(M,{name:"replaceNewTab",title:"Turning this on will start showing Web Maker in every new tab you open",label:"Replace new tab page",pref:this.props.prefs.replaceNewTab,onChange:this.updateSetting.bind(this),showWhenExtension:!0}),Object(O.h)(M,{name:"preserveConsoleLogs",title:"Preserves the console logs across your preview refreshes",label:"Preserve console logs",pref:this.props.prefs.preserveConsoleLogs,onChange:this.updateSetting.bind(this)}),Object(O.h)(M,{name:"lightVersion",title:"Switch to lighter version for better performance. Removes things like blur etc.",label:"Fast/light version",pref:this.props.prefs.lightVersion,onChange:this.updateSetting.bind(this)}))),bo,vo,Object(O.h)("p",null,Object(O.h)(M,{title:"Enjoy wonderful particle blasts while you type",label:"Code blast!",name:"isCodeBlastOn",pref:this.props.prefs.isCodeBlastOn,onChange:this.updateSetting.bind(this)})),Co,yo,Object(O.h)("p",null,Object(O.h)("label",{class:"line",title:"This timeout is used to indentify a possible infinite loop and prevent it."},"Maximum time allowed in a loop iteration",Object(O.h)("input",{type:"number",value:this.props.prefs.infiniteLoopTimeout,"data-setting":"infiniteLoopTimeout",onChange:this.updateSetting.bind(this)})," ","ms"),So))}};n("zKjx");const ko="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='#ccc' d='M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z' /%3E%3C/svg%3E";var xo=Object(O.h)("div",{class:"tac"},Object(O.h)("h1",null,"Support the Developer"),Object(O.h)("p",null,"Hi,"," ",Object(O.h)("a",{href:"https://kushagragour.in",target:"_blank",rel:"noopener noreferrer"},"Kushagra")," ","here! Web Maker is a free and open-source project. To keep myself motivated for working on such open-source and free"," ",Object(O.h)("a",{href:"https://kushagragour.in/lab/",target:"_blank",rel:"noopener noreferrer"},"side projects"),", I am accepting donations. Your pledge, no matter how small, will act as an appreciation towards my work and keep me going forward making Web Maker more awesome\uD83D\uDD25. So please consider donating. \uD83D\uDE4F\uD83C\uDFFC (could be as small as $1/month)."),Object(O.h)("div",{class:"flex flex-h-center",id:"onboardDontShowInTabOptionBtn","d-click":"onDontShowInTabClicked"},Object(O.h)("a",{class:"onboard-selection",href:"https://patreon.com/kushagra",target:"_blank",rel:"noopener noreferrer","aria-label":"Make a monthly pledge on Patreon"},Object(O.h)("img",{src:"patreon.png",height:"60",alt:"Become a patron image"}),Object(O.h)("h3",{class:"onboard-selection-text"},"Make a monthly pledge on Patreon"))),Object(O.h)("a",{href:"https://www.paypal.me/kushagragour",target:"_blank",rel:"noopener noreferrer","aria-label":"Make a one time donation on Paypal"},"Or, make a one time donation")),Mo=Object(O.h)("h1",null,"Keyboard Shortcuts"),_o=Object(O.h)("div",{class:"flex"},Object(O.h)("div",null,Object(O.h)("h2",null,"Global"),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + Shift + ?"),Object(O.h)("span",{class:"kbd-shortcut__details"},"See keyboard shortcuts")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + Shift + 5"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Refresh preview")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + S"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Save current creations")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + O"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Open list of saved creations")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl + L"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Clear console (works when console input is focused)")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Esc"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Close saved creations panel & modals"))),Object(O.h)("div",{class:"ml-2"},Object(O.h)("h2",null,"Editor"),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + F"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Find")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + G"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Select next match")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + Shift + G"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Select previous match")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + Opt/Alt + F"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Find & replace")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Shift + Tab"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Realign code")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + ]"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Indent code right")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + ["),Object(O.h)("span",{class:"kbd-shortcut__details"},"Indent code left")),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Tab"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Emmet code completion"," ",Object(O.h)("a",{href:"https://emmet.io/",target:"_blank",rel:"noopener noreferrer"},"Read more"))),Object(O.h)("p",null,Object(O.h)("span",{class:"kbd-shortcut__keys"},"Ctrl/\u2318 + /"),Object(O.h)("span",{class:"kbd-shortcut__details"},"Single line comment")))),Lo=Object(O.h)("h2",null,"Import your creations in your account"),Io=Object(O.h)("p",null,"It's okay if you don't want to. You can simply logout and access them anytime on this browser."),Ho=Object(O.h)("div",{class:"alerts-container",id:"js-alerts-container"});let Ao=class extends O.Component{shouldComponentUpdate(){return!1}render(){return Ho}};var jo=Object(O.h)("h1",null,Object(O.h)("div",{class:"web-maker-with-tag"},"Web Maker"),Object(O.h)("small",{style:"font-size:14px;"}," v3.2.0")),Bo=Object(O.h)("div",null,Object(O.h)("p",null,"Made with ",Object(O.h)("span",{style:"margin-right: 8px;"},"\uD83D\uDC96")," &"," ",Object(O.h)("span",{style:"margin-right: 8px;"},"\uD83D\uDE4C")," by"," ",Object(O.h)("a",{href:"https://twitter.com/chinchang457",target:"_blank",rel:"noopener noreferrer"},"Kushagra Gour")),Object(O.h)("p",null,Object(O.h)("a",{href:"/docs",target:"_blank",rel:"noopener noreferrer"},"Read the documentation"),"."),Object(O.h)("p",null,"Tweet out your feature requests, comments & suggestions to"," ",Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://twitter.com/webmakerApp"},"@webmakerApp"),"."),Object(O.h)("p",null,"Like this extension? Please"," ",Object(O.h)("a",{href:"https://chrome.google.com/webstore/detail/web-maker/lkfkkhfhhdkiemehlpkgjeojomhpccnh/reviews",target:"_blank",rel:"noopener noreferrer"},"rate it here"),"."),Object(O.h)("p",null,Object(O.h)("button",{"aria-label":"Support the developer","d-click":"openSupportDeveloperModal","data-event-action":"supportDeveloperHelpBtnClick",class:"btn btn-icon"},Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#gift-icon"})),"Support the developer")," ",Object(O.h)("a",{"aria-label":"Rate Web Maker",href:"https://chrome.google.com/webstore/detail/web-maker/lkfkkhfhhdkiemehlpkgjeojomhpccnh/reviews",target:"_blank",rel:"noopener noreferrer",class:"btn btn-icon"},Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#heart-icon"})),"Share Web Maker")," ",Object(O.h)("a",{"aria-label":"Chat",href:"https://web-maker.slack.com",target:"_blank",rel:"noopener noreferrer",class:"btn btn-icon"},Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#chat-icon"})),"Chat")," ",Object(O.h)("a",{"aria-label":"Report a Bug",href:"https://github.com/chinchang/web-maker/issues",target:"_blank",rel:"noopener noreferrer",class:"btn btn-icon"},Object(O.h)("svg",null,Object(O.h)("use",{xlinkHref:"#bug-icon"})),"Report a bug")),Object(O.h)("p",null,Object(O.h)("h3",null,"Awesome libraries used"),Object(O.h)("ul",null,Object(O.h)("li",null,Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://kushagragour.in/lab/hint/"},"Hint.css")," ","&",Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/chinchang/screenlog.js"},"Screenlog.js")," ","- By me :)"),Object(O.h)("li",null,Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://nathancahill.github.io/Split.js/"},"Split.js")," ","- Nathan Cahill"),Object(O.h)("li",null,Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://codemirror.net/"},"Codemirror")," ","- Marijn Haverbeke"),Object(O.h)("li",null,Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://emmet.io/"},"Emmet")," ","- Sergey Chikuyonok"),Object(O.h)("li",null,Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"http://esprima.org/"},"Esprima")," ","- Ariya Hidayat"),Object(O.h)("li",null,Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/enjalot/Inlet"},"Inlet")," ","- Ian Johnson"),Object(O.h)("li",null,Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://webmakerapp.com/"},"Web Maker!")," ","- whhat!"))),Object(O.h)("p",null,Object(O.h)("h3",null,"License"),"\"Web Maker\" is"," ",Object(O.h)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/chinchang/web-maker"},"open-source")," ","under the"," ",Object(O.h)("a",{href:"https://opensource.org/licenses/MIT",target:"_blank",rel:"noopener noreferrer"},"MIT License"),".")),Eo=Object(O.h)("div",{class:"tac"},Object(O.h)("svg",{width:"130px",height:"50px","aria-hidden":"true"},Object(O.h)("use",{xlinkHref:"#logo"})),Object(O.h)("h1",{style:"margin-top:20px"},"Welcome to Web Maker")),Oo=Object(O.h)("div",{class:"flex",style:"margin-top:40px;"},Object(O.h)("div",{class:"onboard-step show-when-app"},Object(O.h)("div",{class:"tac"},Object(O.h)("svg",{class:"onboard-step__icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0 0,1 6,18V3A1,1 0 0,1 7,2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z"}))),Object(O.h)("p",null,"Open Web Maker anytime by visiting"," ",Object(O.h)("a",null,"https://webmakerapp.com/app/")," - Even when you are offline! It just works! \uD83D\uDE31 ",Object(O.h)("strong",null,"Drag the following bookmarklet")," on your bookmark bar to create a quick access shortcut:",Object(O.h)("a",{class:"ml-1 bookmarklet",href:"https://webmakerapp.com/app/"},Object(O.h)("svg",{width:"20",height:"20","aria-hidden":"true"},Object(O.h)("use",{xlinkHref:"#logo"})),"Web Maker"))),Object(O.h)("div",{class:"onboard-step show-when-extension"},Object(O.h)("div",{class:"tac"},Object(O.h)("svg",{class:"onboard-step__icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0 0,1 6,18V3A1,1 0 0,1 7,2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z"}))),Object(O.h)("p",null,"Open Web Maker anytime by clicking the",Object(O.h)("svg",{class:"relative",style:"top:5px;",width:"40",height:"30"},Object(O.h)("use",{xlinkHref:"#logo"}))," ","button in top-right side of your browser.")),Object(O.h)("div",{class:"onboard-step"},Object(O.h)("div",{class:"tac"},Object(O.h)("svg",{class:"onboard-step__icon",viewBox:"0 0 24 24"},Object(O.h)("use",{xlinkHref:"#settings-icon"}))),Object(O.h)("p",null,"Configure and customize settings by clicking the gear icon (",Object(O.h)("svg",{style:"width:18px;height:18px;position:relative;top:3px;fill:#888",viewBox:"0 0 24 24"},Object(O.h)("use",{xlinkHref:"#settings-icon"})),") in bottom right of the app.")),Object(O.h)("div",{class:"onboard-step"},Object(O.h)("div",{class:"tac"},Object(O.h)("svg",{class:"onboard-step__icon",style:"stroke-width:0.3px;"},Object(O.h)("use",{xlinkHref:"#twitter-icon"}))),Object(O.h)("p",null,"Follow"," ",Object(O.h)("a",{href:"https://twitter.com/intent/follow?screen_name=webmakerApp",targe:"_blank",rel:"noopener noreferrer"},"@webmakerApp")," ","to know about the new upcoming features!"))),To=Object(O.h)("p",{class:"tac show-when-app"},"If you are an existing Chrome extension user, you can import your creations from there to here."," ",Object(O.h)("a",{href:"https://medium.com/web-maker/importing-exporting-your-creations-d92e7de5c3dc",target:"_blank"},"Learn how to export/import"),"."),Vo=Object(O.h)("p",{class:"tac"},Object(O.h)("button",{class:"btn btn--primary","d-click":"closeAllOverlays"},"Lets start!")),Po=Object(O.h)("symbol",{id:"logo",viewBox:"-145 -2 372 175"},Object(O.h)("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",transform:"translate(-145.000000, -1.000000)"},Object(O.h)("polygon",{id:"Path-1",fill:"#FF4600",points:"31 0 232 0 132 173.310547"}),Object(O.h)("polygon",{id:"Path-1",fill:"#FF6C00",points:"0 0 201 0 101 173.310547"}),Object(O.h)("polygon",{id:"Path-1",fill:"#FF6C00",transform:"translate(271.500000, 86.500000) scale(1, -1) translate(-271.500000, -86.500000) ",points:"171 0 372 0 272 173.310547"}),Object(O.h)("polygon",{id:"Path-1",fill:"#FF4600",transform:"translate(241.500000, 86.500000) scale(1, -1) translate(-241.500000, -86.500000) ",points:"141 0 342 0 242 173.310547"}))),Do=Object(O.h)("symbol",{id:"bug-icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M14,12H10V10H14M14,16H10V14H14M20,8H17.19C16.74,7.22 16.12,6.55 15.37,6.04L17,4.41L15.59,3L13.42,5.17C12.96,5.06 12.5,5 12,5C11.5,5 11.04,5.06 10.59,5.17L8.41,3L7,4.41L8.62,6.04C7.88,6.55 7.26,7.22 6.81,8H4V10H6.09C6.04,10.33 6,10.66 6,11V12H4V14H6V15C6,15.34 6.04,15.67 6.09,16H4V18H6.81C7.85,19.79 9.78,21 12,21C14.22,21 16.15,19.79 17.19,18H20V16H17.91C17.96,15.67 18,15.34 18,15V14H20V12H18V11C18,10.66 17.96,10.33 17.91,10H20V8Z"})),Fo=Object(O.h)("symbol",{id:"google-icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M21.35,11.1H12.18V13.83H18.69C18.36,17.64 15.19,19.27 12.19,19.27C8.36,19.27 5,16.25 5,12C5,7.9 8.2,4.73 12.2,4.73C15.29,4.73 17.1,6.7 17.1,6.7L19,4.72C19,4.72 16.56,2 12.1,2C6.42,2 2.03,6.8 2.03,12C2.03,17.05 6.16,22 12.25,22C17.6,22 21.5,18.33 21.5,12.91C21.5,11.76 21.35,11.1 21.35,11.1V11.1Z"})),No=Object(O.h)("symbol",{id:"fb-icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M17,2V2H17V6H15C14.31,6 14,6.81 14,7.5V10H14L17,10V14H14V22H10V14H7V10H10V6A4,4 0 0,1 14,2H17Z"})),Wo=Object(O.h)("symbol",{id:"github-icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z"})),zo=Object(O.h)("symbol",{id:"settings-icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z"})),Ro=Object(O.h)("symbol",{id:"twitter-icon",viewBox:"0 0 16 16"},Object(O.h)("path",{d:"M15.969,3.058c-0.586,0.26-1.217,0.436-1.878,0.515c0.675-0.405,1.194-1.045,1.438-1.809 c-0.632,0.375-1.332,0.647-2.076,0.793c-0.596-0.636-1.446-1.033-2.387-1.033c-1.806,0-3.27,1.464-3.27,3.27 c0,0.256,0.029,0.506,0.085,0.745C5.163,5.404,2.753,4.102,1.14,2.124C0.859,2.607,0.698,3.168,0.698,3.767 c0,1.134,0.577,2.135,1.455,2.722C1.616,6.472,1.112,6.325,0.671,6.08c0,0.014,0,0.027,0,0.041c0,1.584,1.127,2.906,2.623,3.206 C3.02,9.402,2.731,9.442,2.433,9.442c-0.211,0-0.416-0.021-0.615-0.059c0.416,1.299,1.624,2.245,3.055,2.271 c-1.119,0.877-2.529,1.4-4.061,1.4c-0.264,0-0.524-0.015-0.78-0.046c1.447,0.928,3.166,1.469,5.013,1.469 c6.015,0,9.304-4.983,9.304-9.304c0-0.142-0.003-0.283-0.009-0.423C14.976,4.29,15.531,3.714,15.969,3.058z"})),Uo=Object(O.h)("symbol",{id:"heart-icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"})),Ko=Object(O.h)("symbol",{id:"play-icon",viewBox:"0 0 24 24"},Object(O.h)("svg",null,Object(O.h)("path",{d:"M8,5.14V19.14L19,12.14L8,5.14Z"}))),qo=Object(O.h)("symbol",{id:"cancel-icon",viewBox:"0 0 24 24"},Object(O.h)("svg",null,Object(O.h)("path",{d:"M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12C4,13.85 4.63,15.55 5.68,16.91L16.91,5.68C15.55,4.63 13.85,4 12,4M12,20A8,8 0 0,0 20,12C20,10.15 19.37,8.45 18.32,7.09L7.09,18.32C8.45,19.37 10.15,20 12,20Z"}))),Jo=Object(O.h)("symbol",{id:"chevron-icon",viewBox:"0 0 24 24"},Object(O.h)("svg",null,Object(O.h)("path",{d:"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}))),Yo=Object(O.h)("symbol",{id:"chat-icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M20,2H4A2,2 0 0,0 2,4V22L6,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M8,14H6V12H8V14M8,11H6V9H8V11M8,8H6V6H8V8M15,14H10V12H15V14M18,11H10V9H18V11M18,8H10V6H18V8Z"})),Go=Object(O.h)("path",{d:"M22,12V20A2,2 0 0,1 20,22H4A2,2 0 0,1 2,20V12A1,1 0 0,1 1,11V8A2,2 0 0,1 3,6H6.17C6.06,5.69 6,5.35 6,5A3,3 0 0,1 9,2C10,2 10.88,2.5 11.43,3.24V3.23L12,4L12.57,3.23V3.24C13.12,2.5 14,2 15,2A3,3 0 0,1 18,5C18,5.35 17.94,5.69 17.83,6H21A2,2 0 0,1 23,8V11A1,1 0 0,1 22,12M4,20H11V12H4V20M20,20V12H13V20H20M9,4A1,1 0 0,0 8,5A1,1 0 0,0 9,6A1,1 0 0,0 10,5A1,1 0 0,0 9,4M15,4A1,1 0 0,0 14,5A1,1 0 0,0 15,6A1,1 0 0,0 16,5A1,1 0 0,0 15,4M3,8V10H11V8H3M13,8V10H21V8H13Z"}),Zo=Object(O.h)("symbol",{id:"gift-icon",viewBox:"0 0 24 24"}),Xo=Object(O.h)("symbol",{id:"cross-icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"})),Qo=Object(O.h)("symbol",{id:"keyboard-icon",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M19,10H17V8H19M19,13H17V11H19M16,10H14V8H16M16,13H14V11H16M16,17H8V15H16M7,10H5V8H7M7,13H5V11H7M8,11H10V13H8M8,8H10V10H8M11,11H13V13H11M11,8H13V10H11M20,5H4C2.89,5 2,5.89 2,7V17A2,2 0 0,0 4,19H20A2,2 0 0,0 22,17V7C22,5.89 21.1,5 20,5Z"})),$o=Object(O.h)("symbol",{id:"mode-icon",viewBox:"0 0 100 100"},Object(O.h)("g",null,Object(O.h)("rect",{x:0,y:0,width:28,height:47}),Object(O.h)("rect",{x:36,y:0,width:28,height:47}),Object(O.h)("rect",{x:72,y:0,width:28,height:47}),Object(O.h)("rect",{x:0,y:53,width:100,height:47}))),es=Object(O.h)("symbol",{id:"vertical-mode-icon",viewBox:"0 0 100 100"},Object(O.h)("g",null,Object(O.h)("rect",{x:0,y:0,width:20,height:100}),Object(O.h)("rect",{x:23,y:0,width:20,height:100}),Object(O.h)("rect",{x:46,y:0,width:20,height:100}),Object(O.h)("rect",{x:69,y:0,width:32,height:100}))),ns=Object(O.h)("symbol",{id:"search",viewBox:"0 0 24 24"},Object(O.h)("path",{d:"M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"})),os=Object(O.h)("g",{fill:"none",fillRule:"evenodd",strokeWidth:10},Object(O.h)("circle",{cx:22,cy:22,r:1},Object(O.h)("animate",{attributeName:"r",begin:"0s",dur:"1.8s",values:"1; 20",calcMode:"spline",keyTimes:"0; 1",keySplines:"0.165, 0.84, 0.44, 1",repeatCount:"indefinite"}),Object(O.h)("animate",{attributeName:"stroke-opacity",begin:"0s",dur:"1.8s",values:"1; 0",calcMode:"spline",keyTimes:"0; 1",keySplines:"0.3, 0.61, 0.355, 1",repeatCount:"indefinite"})),Object(O.h)("circle",{cx:22,cy:22,r:1},Object(O.h)("animate",{attributeName:"r",begin:"-0.9s",dur:"1.8s",values:"1; 20",calcMode:"spline",keyTimes:"0; 1",keySplines:"0.165, 0.84, 0.44, 1",repeatCount:"indefinite"}),Object(O.h)("animate",{attributeName:"stroke-opacity",begin:"-0.9s",dur:"1.8s",values:"1; 0",calcMode:"spline",keyTimes:"0; 1",keySplines:"0.3, 0.61, 0.355, 1",repeatCount:"indefinite"}))),ss=Object.assign||function(e){for(var t,n=1;nHello, World!\"}"})),hs=Object(O.h)(function(){return Rn},null),ps=Object(O.h)(Nn,null),us=Object(O.h)(function(){return Object(O.h)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",style:{display:"none"}},Po,Do,Fo,No,Wo,zo,Ro,Uo,Ko,qo,Jo,Yo,Object(O.h)("symbol",{id:"gift-icon",viewBox:"0 0 24 24"},Go,Zo,Xo,Qo,$o,es,ns,Object(O.h)("symbol",{id:"loader-icon",viewBox:"0 0 44 44"},os)))},null),ms=Object(O.h)("form",{style:"display:none;",action:"https://codepen.io/pen/define",method:"POST",target:"_blank",id:"codepenForm"},Object(O.h)("input",{type:"hidden",name:"data",value:"{\"title\": \"New Pen!\", \"html\": \"
Hello, World!
\"}"}));let gs=class extends O.Component{constructor(){super(),this.AUTO_SAVE_INTERVAL=15000,this.state={isSavedItemPaneOpen:!1,isModalOpen:!1,isAddLibraryModalOpen:!1,isSettingsModalOpen:!1,isHelpModalOpen:!1,isNotificationsModalOpen:!1,isLoginModalOpen:!1,isProfileModalOpen:!1,isSupportDeveloperModalOpen:!1,isKeyboardShortcutsModalOpen:!1,isAskToImportModalOpen:!1,isOnboardModalOpen:!1,prefs:{},currentItem:{title:"",externalLibs:{js:"",css:""}}},this.defaultSettings={preserveLastCode:!0,replaceNewTab:!1,htmlMode:"html",jsMode:"js",cssMode:"css",isCodeBlastOn:!1,indentWith:"spaces",indentSize:2,editorTheme:"monokai",keymap:"sublime",fontSize:16,refreshOnResize:!1,autoPreview:!0,editorFont:"FiraCode",editorCustomFont:"",autoSave:!0,autoComplete:!0,preserveConsoleLogs:!0,lightVersion:!1,lineWrap:!0,infiniteLoopTimeout:1e3,layoutMode:2},this.prefs={},En.a.auth().onAuthStateChanged((e)=>{this.setState({isLoginModalOpen:!1}),e?(c("You are -> ",e),un.add("You are now logged in!"),this.setState({user:e}),window.user=e,!window.localStorage[is.ASKED_TO_IMPORT_CREATIONS]&&this.fetchItems(!1,!0).then((e)=>{e.length&&(this.oldSavedItems=e,this.oldSavedCreationsCount=e.length,this.setState({isAskToImportModalOpen:!0}),v("ui","askToImportModalSeen"))}),window.db.getUser(e.uid).then((t)=>{if(t){const t=ss({},this.state.prefs);ss(t,e.settings),this.setState({prefs:t}),this.updateSetting()}})):(this.setState({user:void 0}),delete window.user),this.updateProfileUi()})}componentWillMount(){var e;window.onunload=()=>{this.saveCode("code"),this.detachedWindow&&this.detachedWindow.close()},db.local.get({layoutMode:1,code:""},(t)=>{this.toggleLayout(t.layoutMode),this.state.prefs.layoutMode=t.layoutMode,t.code&&(e=t.code)}),db.getSettings(this.defaultSettings).then((t)=>{t.preserveLastCode&&e?(this.setState({unsavedEditCount:0}),e.id&&window.IS_EXTENSION?db.local.get(e.id,(t)=>{t[e.id]&&(c("Load item ",e.id),this.setCurrentItem(t[e.id]).then(()=>this.refreshEditor()))}):(c("Load last unsaved item",e),this.setCurrentItem(e).then(()=>this.refreshEditor()))):this.createNewItem(),ss(this.state.prefs,t),this.setState({prefs:this.state.prefs}),this.updateSetting()}),db.getUserLastSeenVersion().then((e)=>{e||(this.setState({isOnboardModalOpen:!0}),-1===document.cookie.indexOf("onboarded")&&(v("ui","onboardModalSeen",rs),document.cookie="onboarded=1"),window.db.setUserLastSeenVersion(rs)),e&&-1===r(e,rs)&&!window.localStorage.pledgeModalSeen&&(this.openSupportDeveloperModal(),window.localStorage.pledgeModalSeen=!0),e&&-1!==r(e,rs)||(this.setState({hasUnseenChangelog:!0}),this.hasSeenNotifications=!1)})}updateProfileUi(){this.state.user?document.body.classList.add("is-logged-in"):document.body.classList.remove("is-logged-in")}refreshEditor(){this.toggleLayout(this.state.currentItem.layoutMode||this.state.prefs.layoutMode),this.updateExternalLibCount(),this.contentWrap.refreshEditor()}forkItem(e){if(this.state.unsavedEditCount){var t=confirm("You have unsaved changes in your current work. Do you want to discard unsaved changes and continue?");if(!t)return}const n=JSON.parse(JSON.stringify(e));delete n.id,n.title="(Forked) "+e.title,n.updatedOn=Date.now(),this.setCurrentItem(n).then(()=>this.refreshEditor()),un.add(`"${e.title}" was forked`),v("fn","itemForked")}createNewItem(){var e=new Date;this.setCurrentItem({title:"Untitled "+e.getDate()+"-"+(e.getMonth()+1)+"-"+e.getHours()+":"+e.getMinutes(),html:"",css:"",js:"",externalLibs:{js:"",css:""},layoutMode:this.state.currentLayoutMode}).then(()=>this.refreshEditor()),un.add("New item created")}openItem(e){this.setCurrentItem(e).then(()=>this.refreshEditor()),un.add("Saved item loaded")}removeItem(e){var t=confirm(`Are you sure you want to delete "${e.title}"?`);t&&(hn.unsetItemForUser(e.id),hn.removeItem(e.id).then(()=>{un.add("Item removed.",e),this.state.currentItem.id===e.id&&this.createNewItem()}),delete this.state.savedItems[e.id],this.setState({savedItems:ss({},this.state.savedItems)}),v("fn","itemRemoved"))}setCurrentItem(e){const t=o();return e.htmlMode=e.htmlMode||this.state.prefs.htmlMode||P.HTML,e.cssMode=e.cssMode||this.state.prefs.cssMode||D.CSS,e.jsMode=e.jsMode||this.state.prefs.jsMode||F.JS,this.setState({currentItem:e},t.resolve),this.isAutoSavingEnabled=!1,this.setState({unsavedEditCount:0}),t.promise}saveBtnClickHandler(){v("ui","saveBtnClick",this.state.currentItem.id?"saved":"new"),this.saveItem()}populateItemsInSavedPane(){this.setState({savedItems:ss({},this.state.savedItems)}),this.toggleSavedItemsPane()}toggleSavedItemsPane(){this.setState({isSavedItemPaneOpen:!this.state.isSavedItemPaneOpen}),this.state.isSavedItemPaneOpen?window.searchInput.focus():window.searchInput.value="",document.body.classList[this.state.isSavedItemPaneOpen?"add":"remove"]("overlay-visible")}async fetchItems(e,t){var n=o();this.state.savedItems={};var s=[];return window.user&&!t?(s=await hn.getAllItems(),c("got items"),e&&s.forEach((e)=>{this.state.savedItems[e.id]=e}),n.resolve(s),n.promise):(db.local.get("items",(t)=>{var o=Object.getOwnPropertyNames(t.items||{});o.length||n.resolve([]),v("fn","fetchItems",o.length);for(let a=0;a{e&&(this.state.savedItems[o[a]]=t[o[a]]),s.push(t[o[a]]),o.length===s.length&&n.resolve(s)})}),n.promise)}openSavedItemsPane(){this.setState({isFetchingItems:!0}),this.fetchItems(!0).then((e)=>{this.setState({isFetchingItems:!1}),this.populateItemsInSavedPane(e)})}openAddLibrary(){this.setState({isAddLibraryModalOpen:!0})}closeSavedItemsPane(){this.setState({isSavedItemPaneOpen:!1}),document.body.classList.remove("overlay-visible"),this.editorWithFocus&&this.editorWithFocus.focus()}componentDidMount(){document.body.style.height=`${window.innerHeight}px`,window.addEventListener("keydown",(e)=>{(e.ctrlKey||e.metaKey)&&83===e.keyCode&&(e.preventDefault(),this.saveItem(),v("ui","saveItemKeyboardShortcut")),(e.ctrlKey||e.metaKey)&&e.shiftKey&&53===e.keyCode?(e.preventDefault(),this.contentWrap.setPreviewContent(!0,!0),v("ui","previewKeyboardShortcut")):(e.ctrlKey||e.metaKey)&&79===e.keyCode?(e.preventDefault(),this.openSavedItemsPane(),v("ui","openCreationKeyboardShortcut")):(e.ctrlKey||e.metaKey)&&e.shiftKey&&191===e.keyCode?(e.preventDefault(),this.setState({isKeyboardShortcutsModalOpen:!this.state.isKeyboardShortcutsModalOpen}),v("ui","showKeyboardShortcutsShortcut")):27===e.keyCode&&this.closeAllOverlays()})}closeAllOverlays(){this.state.isSavedItemPaneOpen&&this.closeSavedItemsPane()}onExternalLibChange(e){c("onExternalLibChange"),this.state.currentItem.externalLibs={js:e.js,css:e.css},this.updateExternalLibCount(),this.setState({currentItem:ss({},this.state.currentItem)}),this.contentWrap.setPreviewContent(!0),un.add("Libraries updated.")}updateExternalLibCount(){var e=0;e+=this.state.currentItem.externalLibs.js.split("\n").filter((e)=>!!e).length,e+=this.state.currentItem.externalLibs.css.split("\n").filter((e)=>!!e).length,this.setState({externalLibCount:e})}toggleLayout(e){return e=500>window.innerWidth?2:e,this.state.currentLayoutMode===e?(this.contentWrap.resetSplitting(),void this.setState({currentLayoutMode:e})):void([1,2,3,4,5].forEach((e)=>{window[`layoutBtn${e}`].classList.remove("selected"),document.body.classList.remove(`layout-${e}`)}),$("#layoutBtn"+e).classList.add("selected"),document.body.classList.add("layout-"+e),this.setState({currentLayoutMode:e},()=>{this.contentWrap.resetSplitting(),this.contentWrap.setPreviewContent(!0)}))}layoutBtnClickHandler(e){this.saveSetting("layoutMode",e),v("ui","toggleLayoutClick",e),this.toggleLayout(e)}getCodePaneSizes(){var e;const t=this.state.currentLayoutMode;var n=2===t||5===t?"width":"height";try{e=[htmlCodeEl.style[n],cssCodeEl.style[n],jsCodeEl.style[n]]}catch(t){e=[33.33,33.33,33.33]}finally{return e}}getMainPaneSizes(){var e;const t=this.state.currentLayoutMode;var n=2===t?"height":"width";try{e=[+$("#js-code-side").style[n].match(/([\d.]+)%/)[1],+$("#js-demo-side").style[n].match(/([\d.]+)%/)[1]]}catch(t){e=[50,50]}finally{return e}}saveSetting(e,t){const n=o();return db.local.set({[e]:t},n.resolve),n.promise}saveCode(e){return this.state.currentItem.updatedOn=Date.now(),this.state.currentItem.layoutMode=this.state.currentLayoutMode,this.state.currentItem.sizes=this.getCodePaneSizes(),this.state.currentItem.mainSizes=this.getMainPaneSizes(),c("saving key",e||this.state.currentItem.id,this.state.currentItem),hn.setItem(e||this.state.currentItem.id,this.state.currentItem).then(function(){window.user&&!navigator.onLine?un.add("Item saved locally. Will save to account when you are online."):un.add("Item saved."),this.setState({unsavedEditCount:0})}.bind(this))}saveItem(){if(!window.user&&!window.localStorage[is.LOGIN_AND_SAVE_MESSAGE_SEEN]){const e=confirm("Saving without signing in will save your work only on this machine and this browser. If you want it to be secure & available anywhere, please login in your account and then save.\n\nDo you still want to continue saving locally?");if(window.localStorage[is.LOGIN_AND_SAVE_MESSAGE_SEEN]=!0,!e)return v("ui",is.LOGIN_AND_SAVE_MESSAGE_SEEN,"login"),this.closeAllOverlays(),void this.setState({isLoginModalOpen:!0});v("ui",is.LOGIN_AND_SAVE_MESSAGE_SEEN,"local")}var e=!this.state.currentItem.id;this.state.currentItem.id=this.state.currentItem.id||"item-"+l(),this.setState({isSaving:!0}),this.saveCode().then(()=>{this.setState({isSaving:!1}),!this.isAutoSavingEnabled&&this.state.prefs.autoSave&&(this.isAutoSavingEnabled=!0,un.add("Auto-save enabled."))}),e&&hn.setItemForUser(this.state.currentItem.id)}onCodeModeChange(e,t){const n=ss({},this.state.currentItem);n[`${e}Mode`]=t,this.setState({currentItem:n})}onCodeChange(e,t,n){this.state.currentItem[e]=t,n&&(this.setState({unsavedEditCount:this.state.unsavedEditCount+1}),0==this.state.unsavedEditCount%as&&this.state.unsavedEditCount>=as&&(window.saveBtn.classList.add("animated"),window.saveBtn.classList.add("wobble"),window.saveBtn.addEventListener("animationend",()=>{window.saveBtn.classList.remove("animated"),window.saveBtn.classList.remove("wobble")})))}onCodeSettingsChange(e,t){this.state.currentItem[`${e}Settings`]={acssConfig:t}}titleInputBlurHandler(t){this.state.currentItem.title=t.target.value,this.state.currentItem.id&&(this.saveItem(),v("ui","titleChanged"))}updateSetting(t){if(t){var e=t.target.dataset.setting,n={},o=t.target;c(e,"checkbox"===o.type?o.checked:o.value);const s=ss({},this.state.prefs);s[e]="checkbox"===o.type?o.checked:o.value,n[e]=s[e],this.setState({prefs:s}),db.sync.set(n,function(){un.add("Setting saved")}),window.user&&window.db.getDb().then((t)=>{t.collection("users").doc(window.user.uid).update({[`settings.${e}`]:this.state.prefs[e]}).then((t)=>{c(`Setting "${e}" for user`,t)}).catch((e)=>c(e))}),v("ui","updatePref-"+e,s[e])}const s=this.state.prefs;runBtn.classList[s.autoPreview?"add":"remove"]("hide"),this.contentWrap.applyCodemirrorSettings(this.state.prefs),s.autoSave?!this.autoSaveInterval&&(this.autoSaveInterval=setInterval(()=>{this.autoSaveLoop()},this.AUTO_SAVE_INTERVAL)):(clearInterval(this.autoSaveInterval),this.autoSaveInterval=null),document.body.classList[s.lightVersion?"add":"remove"]("light-version")}autoSaveLoop(){this.isAutoSavingEnabled&&this.state.unsavedEditCount&&this.saveItem()}loginBtnClickHandler(){this.setState({isLoginModalOpen:!0})}profileBtnClickHandler(){this.setState({isProfileModalOpen:!0})}logout(){if(this.state.unsavedEditCount){var e=confirm("You have unsaved changes. Do you still want to logout?");if(!e)return}v("fn","loggedOut"),On.logout(),this.setState({isProfileModalOpen:!1}),un.add("Log out successfull")}itemClickHandler(e){setTimeout(()=>{this.openItem(e)},350),this.toggleSavedItemsPane()}itemRemoveBtnClickHandler(e){this.removeItem(e)}itemForkBtnClickHandler(e){this.toggleSavedItemsPane(),setTimeout(()=>{this.forkItem(e)},350)}newBtnClickHandler(){if(v("ui","newBtnClick"),this.state.unsavedEditCount){var e=confirm("You have unsaved changes. Do you still want to create something new?");e&&this.createNewItem()}else this.createNewItem()}openBtnClickHandler(){v("ui","openBtnClick"),this.openSavedItemsPane()}detachedPreviewBtnHandler(){v("ui","detachPreviewBtnClick"),this.contentWrap.detachPreview()}notificationsBtnClickHandler(){return this.setState({isNotificationsModalOpen:!0}),this.state.isNotificationsModalOpen&&!this.hasSeenNotifications&&(this.hasSeenNotifications=!0,this.setState({hasUnseenChangelog:!1}),window.db.setUserLastSeenVersion(rs)),v("ui","notificationButtonClick",rs),!1}codepenBtnClickHandler(t){if(this.state.currentItem.cssMode===D.ACSS)return alert("Oops! CodePen doesn't supports Atomic CSS currently. \nHere is something you can still do -> https://medium.com/web-maker/sharing-your-atomic-css-work-on-codepen-a402001b26ab"),void t.preventDefault();var e={title:"A Web Maker experiment",html:this.state.currentItem.html,css:this.state.currentItem.css,js:this.state.currentItem.js,html_pre_processor:N[this.state.currentItem.htmlMode].codepenVal,css_pre_processor:N[this.state.currentItem.cssMode].codepenVal,js_pre_processor:N[this.state.currentItem.jsMode].codepenVal,css_external:this.state.currentItem.externalLibs.css.split("\n").join(";"),js_external:this.state.currentItem.externalLibs.js.split("\n").join(";")};this.state.currentItem.title.match(/Untitled\s\d\d*-\d/)||(e.title=this.state.currentItem.title),e=JSON.stringify(e),window.codepenForm.querySelector("input").value=e,window.codepenForm.submit(),v("ui","openInCodepen"),t.preventDefault()}saveHtmlBtnClickHandler(t){f(this.state.currentItem),v("ui","saveHtmlClick"),t.preventDefault()}runBtnClickHandler(){this.contentWrap.setPreviewContent(!0,!0),v("ui","runBtnClick")}exportItems(){b().then(()=>{this.fetchItems().then((e)=>{var t=new Date,n=["web-maker-export",t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()].join("-");n+=".json";var o=new Blob([JSON.stringify(e,!1,2)],{type:"application/json;charset=UTF-8"});p(n,o),v("fn","exportItems")})})}exportBtnClickHandler(t){this.exportItems(),t.preventDefault(),v("ui","exportBtnClicked")}screenshotBtnClickHandler(t){this.contentWrap.getDemoFrame((e)=>{A(e.getBoundingClientRect())}),t.preventDefault()}openSupportDeveloperModal(t){this.setState({isSupportDeveloperModalOpen:!0}),t&&v("ui",t.target.dataset.eventAction)}supportDeveloperBtnClickHandler(t){this.openSupportDeveloperModal(t)}dontAskToImportAnymore(t){this.setState({isAskToImportModalOpen:!1}),window.localStorage[is.ASKED_TO_IMPORT_CREATIONS]=!0,t&&v("ui","dontAskToImportBtnClick")}importCreationsAndSettingsIntoApp(){this.mergeImportedItems(this.oldSavedItems).then(()=>{v("fn","oldItemsImported"),this.dontAskToImportAnymore()})}editorFocusHandler(e){this.editorWithFocus=e}modalOverlayClickHandler(){this.closeAllOverlays()}render(){return Object(O.h)("div",null,Object(O.h)("div",{class:"main-container"},Object(O.h)(S,{externalLibCount:this.state.externalLibCount,openBtnHandler:this.openBtnClickHandler.bind(this),newBtnHandler:this.newBtnClickHandler.bind(this),saveBtnHandler:this.saveBtnClickHandler.bind(this),loginBtnHandler:this.loginBtnClickHandler.bind(this),profileBtnHandler:this.profileBtnClickHandler.bind(this),addLibraryBtnHandler:this.openAddLibrary.bind(this),runBtnClickHandler:this.runBtnClickHandler.bind(this),isFetchingItems:this.state.isFetchingItems,isSaving:this.state.isSaving,title:this.state.currentItem.title,titleInputBlurHandler:this.titleInputBlurHandler.bind(this),user:this.state.user,unsavedEditCount:this.state.unsavedEditCount}),Object(O.h)(Nt,{currentLayoutMode:this.state.currentLayoutMode,currentItem:this.state.currentItem,onCodeChange:this.onCodeChange.bind(this),onCodeSettingsChange:this.onCodeSettingsChange.bind(this),onCodeModeChange:this.onCodeModeChange.bind(this),onRef:(e)=>this.contentWrap=e,prefs:this.state.prefs,onEditorFocus:this.editorFocusHandler.bind(this)}),ls,Object(O.h)(ln,{layoutBtnClickHandler:this.layoutBtnClickHandler.bind(this),helpBtnClickHandler:()=>this.setState({isHelpModalOpen:!0}),settingsBtnClickHandler:()=>this.setState({isSettingsModalOpen:!0}),notificationsBtnClickHandler:this.notificationsBtnClickHandler.bind(this),supportDeveloperBtnClickHandler:this.supportDeveloperBtnClickHandler.bind(this),detachedPreviewBtnHandler:this.detachedPreviewBtnHandler.bind(this),codepenBtnClickHandler:this.codepenBtnClickHandler.bind(this),saveHtmlBtnClickHandler:this.saveHtmlBtnClickHandler.bind(this),keyboardShortcutsBtnClickHandler:()=>this.setState({isKeyboardShortcutsModalOpen:!0}),screenshotBtnClickHandler:this.screenshotBtnClickHandler.bind(this),hasUnseenChangelog:this.state.hasUnseenChangelog})),Object(O.h)(bn,{items:this.state.savedItems,isOpen:this.state.isSavedItemPaneOpen,closeHandler:this.closeSavedItemsPane.bind(this),itemClickHandler:this.itemClickHandler.bind(this),itemRemoveBtnClickHandler:this.itemRemoveBtnClickHandler.bind(this),itemForkBtnClickHandler:this.itemForkBtnClickHandler.bind(this),exportBtnClickHandler:this.exportBtnClickHandler.bind(this)}),ds,cs,Object(O.h)(gt,{show:this.state.isAddLibraryModalOpen,closeHandler:()=>this.setState({isAddLibraryModalOpen:!1})},Object(O.h)(jn,{js:this.state.currentItem.externalLibs?this.state.currentItem.externalLibs.js:"",css:this.state.currentItem.externalLibs?this.state.currentItem.externalLibs.css:"",onChange:this.onExternalLibChange.bind(this)})),Object(O.h)(gt,{show:this.state.isNotificationsModalOpen,closeHandler:()=>this.setState({isNotificationsModalOpen:!1})},hs),Object(O.h)(gt,{extraClasses:"modal--settings",show:this.state.isSettingsModalOpen,closeHandler:()=>this.setState({isSettingsModalOpen:!1})},Object(O.h)(wo,{prefs:this.state.prefs,onChange:this.updateSetting.bind(this)})),Object(O.h)(gt,{extraClasses:"login-modal",show:this.state.isLoginModalOpen,closeHandler:()=>this.setState({isLoginModalOpen:!1})},ps),Object(O.h)(gt,{show:this.state.isProfileModalOpen,closeHandler:()=>this.setState({isProfileModalOpen:!1})},Object(O.h)(_,{user:this.state.user,logoutBtnHandler:this.logout.bind(this)})),Object(O.h)(B,{show:this.state.isHelpModalOpen,closeHandler:()=>this.setState({isHelpModalOpen:!1})}),Object(O.h)(L,{show:this.state.isSupportDeveloperModalOpen,closeHandler:()=>this.setState({isSupportDeveloperModalOpen:!1})}),Object(O.h)(I,{show:this.state.isKeyboardShortcutsModalOpen,closeHandler:()=>this.setState({isKeyboardShortcutsModalOpen:!1})}),Object(O.h)(j,{show:this.state.isAskToImportModalOpen,closeHandler:()=>this.setState({isAskToImportModalOpen:!1}),oldSavedCreationsCount:this.oldSavedCreationsCount,importBtnClickHandler:this.importCreationsAndSettingsIntoApp.bind(this),dontAskBtnClickHandler:this.dontAskToImportAnymore.bind(this)}),Object(O.h)(E,{show:this.state.isOnboardModalOpen,closeHandler:()=>this.setState({isOnboardModalOpen:!1})}),Object(O.h)(mt.a,{into:"body"},Object(O.h)("div",{class:"modal-overlay",onClick:this.modalOverlayClickHandler.bind(this)})),us,ms)}};t["default"]=gs}},["pwNi"]); \ No newline at end of file diff --git a/app/service-worker.js b/app/service-worker.js index 79a8102..ef59101 100644 --- a/app/service-worker.js +++ b/app/service-worker.js @@ -37,7 +37,7 @@ /* eslint-disable indent, no-unused-vars, no-multiple-empty-lines, max-nested-callbacks, space-before-function-paren, quotes, comma-spacing */ 'use strict'; -var precacheConfig = [["FiraCode.ttf","fa1f8c8961adca519738d9518139579c"],["FixedSys.ttf","43cc87e8f9adba81b9d63b6e2d15db57"],["Inconsolata.ttf","b0639eb725c0df94f68b779889679457"],["Monoid.ttf","9b27db986ad2a74c522e9d3b6f7e2a63"],["detached-window.js","f05b0a0f2a8cc967028fb4f95f4a9614"],["icon-128.png","cf558ed413851d046b9dcc84c1d57543"],["icon-48.png","ca68956f464ed4fd2e09c66d5edaed5f"],["index.html","9d29741ca80edf97b511d4a237cb2d79"],["lib/codemirror/mode/coffeescript/coffeescript.js","dea87b9f4c669789c4760605d947f1a9"],["lib/codemirror/mode/css/css.js","6c9ca32a78c120340e588ed3df734138"],["lib/codemirror/mode/css/gss.html","9afa6e2f3a7daa6127a3f26e2e68005c"],["lib/codemirror/mode/css/gss_test.js","e40c6fd9abdc6edc2b29e521bda726e1"],["lib/codemirror/mode/css/less.html","a35ff50857d48bb2f4df8ac737f35d64"],["lib/codemirror/mode/css/scss.html","8c96251f27727a9b23b45c41511e23a0"],["lib/codemirror/mode/haml/haml.js","9abc1679e0f54dcdd62d2326ed6133f5"],["lib/codemirror/mode/htmlembedded/htmlembedded.js","67f745ab3879bf7bc3029ac75ea3e181"],["lib/codemirror/mode/htmlmixed/htmlmixed.js","2d6915b576f267e93f0e1cf72f31af37"],["lib/codemirror/mode/javascript/javascript.js","3b2f1591e3175a24846cb182943f2a40"],["lib/codemirror/mode/javascript/json-ld.html","a2a5069194b78b6b5523cace263cab06"],["lib/codemirror/mode/javascript/typescript.html","76c2ffb883a133aa0fc5cc75ec0c56f5"],["lib/codemirror/mode/jsx/jsx.js","7bee6944931c2cc6ccd99b50fca637db"],["lib/codemirror/mode/markdown/markdown.js","30dd4984e2e929429d70cf5174b35c5d"],["lib/codemirror/mode/meta.js","6e456ea5fd8920c85d5281bd1efecb4c"],["lib/codemirror/mode/pug/pug.js","e988fd72c82f3b11836f6a06f7452436"],["lib/codemirror/mode/sass/sass.js","bd31ac70e9a457abc2789c2b83a21984"],["lib/codemirror/mode/stylus/stylus.js","81e2d281ecbb1dcf5c86857097ae60a7"],["lib/codemirror/mode/xml/xml.js","80f64aaafa6af7844d14f32f3219bb26"],["lib/codemirror/theme/3024-day.css","73c8f41583b4b71dbe1e5eac5c96f1a9"],["lib/codemirror/theme/3024-night.css","745180be9a932f24c6c0dd4ebdf5a0ed"],["lib/codemirror/theme/abcdef.css","8004cb71fd65e58bdfa64fdd55241315"],["lib/codemirror/theme/ambiance-mobile.css","256f2dd130b80c6afaa40fddf700d12a"],["lib/codemirror/theme/ambiance.css","6a200e1f3976929816cf3ac4675c810a"],["lib/codemirror/theme/base16-dark.css","84b6347918411d58d7f9b65a7ee87f65"],["lib/codemirror/theme/base16-light.css","037c7f3d16fe6d5ae2baa532e334172b"],["lib/codemirror/theme/base2tone-meadow-dark.css","f9dd12e2e51fc1575c57f3e5edc2232f"],["lib/codemirror/theme/bespin.css","cc414e4ec18bc89b3c79935b0e27fc20"],["lib/codemirror/theme/blackboard.css","cf9366960ff65c8101793bc64fe13e88"],["lib/codemirror/theme/cobalt.css","3488b576456693fd7ced2da0e10c8a16"],["lib/codemirror/theme/colorforth.css","b2ee8d2296277fc2811a7473ee4e9977"],["lib/codemirror/theme/dracula.css","e514d652ae86bfeaed34237b7d3afe44"],["lib/codemirror/theme/duotone-dark.css","02ec891b23125aaf625d978a39fd24ca"],["lib/codemirror/theme/duotone-light.css","608d11459665117d708651ce7f803fde"],["lib/codemirror/theme/eclipse.css","194369eec66630cfaf662ce5f0a193be"],["lib/codemirror/theme/elegant.css","0a4227e805a9d5f73a55dd248c1b052d"],["lib/codemirror/theme/erlang-dark.css","b5543f5273c968449760ab0d6a2af6dc"],["lib/codemirror/theme/hopscotch.css","b924ed31af30b1c68e5a01fc3c9b0553"],["lib/codemirror/theme/icecoder.css","576d776abdf7e28ea9f84e2eb161a20d"],["lib/codemirror/theme/isotope.css","7bb44bff5190c427de5ae750d6369633"],["lib/codemirror/theme/lesser-dark.css","da2c896bff035cec86fa98b6dc13f7cc"],["lib/codemirror/theme/liquibyte.css","9f37e7a4f3c02bec9bb735b78ed082d6"],["lib/codemirror/theme/material.css","11e812a3688805b5c187a6e6852bafe1"],["lib/codemirror/theme/mbo.css","55ff4bdd8a92c3dcbfd5421c532b3059"],["lib/codemirror/theme/mdn-like.css","79f8dabc5593d01d27bc824b801f9f05"],["lib/codemirror/theme/midnight.css","950e76dca6461ee1a2eac39f2d886613"],["lib/codemirror/theme/monokai.css","31c75ebee6311d49c046ffbbb91028f4"],["lib/codemirror/theme/neat.css","6b19894b9787c6791c250a95d0d4f8d6"],["lib/codemirror/theme/neo.css","2886072b53043c167e6f8765606c705c"],["lib/codemirror/theme/night.css","fe3ce7650a77e7e3887816dd7b6d880d"],["lib/codemirror/theme/panda-syntax.css","acbf94261e43c1f29c2252eb445de032"],["lib/codemirror/theme/paraiso-dark.css","3c24cee0dfac767713840b24e8359c99"],["lib/codemirror/theme/paraiso-light.css","e245bbfd22b4f61efe526ff13903f19e"],["lib/codemirror/theme/pastel-on-dark.css","48aae1a42733db57bd0a260ce0d83975"],["lib/codemirror/theme/railscasts.css","a5e7682d89da46244e5464d9572e24d8"],["lib/codemirror/theme/rubyblue.css","52bb601017a90bca522d66f6e82e73aa"],["lib/codemirror/theme/seti.css","f71668880eb1625f420ceaad670436f0"],["lib/codemirror/theme/solarized dark.css","4d05a166d713bb1ac24833061c1522d7"],["lib/codemirror/theme/solarized light.css","4d05a166d713bb1ac24833061c1522d7"],["lib/codemirror/theme/the-matrix.css","33c49ceeedafd0a08e712e465e3ad3ce"],["lib/codemirror/theme/tomorrow-night-bright.css","777d36e1c5bbfeb3bf2ca8dd607eee93"],["lib/codemirror/theme/tomorrow-night-eighties.css","5ceb5531fbe074d5190b55e8c725051e"],["lib/codemirror/theme/ttcn.css","d2cb74dfae563a10e9c286357429ea8b"],["lib/codemirror/theme/twilight.css","684040adf66ef89355cb7ebc6b54b00b"],["lib/codemirror/theme/vibrant-ink.css","f10004836fb29cc9a08c987d3e18938a"],["lib/codemirror/theme/xq-dark.css","60f162f0c4240e7352364d436b5598fa"],["lib/codemirror/theme/xq-light.css","447e80da7fe8c5c2bcf39127200cead2"],["lib/codemirror/theme/yeti.css","623dc805bc84dd6d25deef376593354e"],["lib/codemirror/theme/zenburn.css","94ad50bf3d048ed92cc513cd901dc685"],["lib/screenlog.js","974cb1ec0473b11ae4834028c1820816"],["lib/transpilers/atomizer.browser.js","c2925b84a627b017797664530f284618"],["lib/transpilers/babel-polyfill.min.js","6fef55c62df380d41c8f42f8b0c1f4da"],["lib/transpilers/babel.min.js","77a1a84bbc2661db874c738f9b3ba375"],["lib/transpilers/coffee-script.js","df68698ca5d438d7fb70c3c259155a37"],["lib/transpilers/jade.js","529e365c68f8d5efc4cea18be310bd76"],["lib/transpilers/less.min.js","6fd457ee80aaf9aa8758fe8a2345c970"],["lib/transpilers/marked.js","93163e72d380637970dc957c6cf75a77"],["lib/transpilers/sass.js","1263518af3f8b2090c9b08d195bd20d9"],["lib/transpilers/sass.worker.js","0d6c944b36008580fbedc09642f7f656"],["lib/transpilers/stylus.min.js","58f6030903ab52f596fb407dcd3df34f"],["lib/transpilers/typescript.js","cc0882a3185037052e21fa06a38ef077"],["partials/ask-to-import-modal.html","4c41c4fe11e4812ba6258d8e04d27d40"],["partials/changelog.html","d07acae211850ce1db53678b6258f9e5"],["partials/help-modal.html","c43bfe929337f371221503e83c62bdb8"],["partials/keyboard-shortcuts.html","d7c4124380a4eeb18968d55276d19591"],["partials/login-modal.html","7bb43bece90a93308919fb00162ee669"],["partials/onboard-modal.html","e9597ff891a70080a418e98abf198a5d"],["partials/pledge-modal.html","13f16984222c6447fb830250a818b763"],["patreon.png","8b4321f782e84764e556af3dee32a131"],["preview.html","632a603a300de4922f0c30b6749d850a"],["script.js","fca9fb7b8cef5ec1dd408e67de8d8deb"],["style.css","2458fa214798057cae13ddf358d3e7a2"],["vendor.css","6ed94306315b8aaf789c53091c23bb4b"],["vendor.js","bc5f5398fd1f7495a3d2c0408b75578e"]]; +var precacheConfig = [["FiraCode.ttf","fa1f8c8961adca519738d9518139579c"],["FixedSys.ttf","43cc87e8f9adba81b9d63b6e2d15db57"],["Inconsolata.ttf","b0639eb725c0df94f68b779889679457"],["Monoid.ttf","9b27db986ad2a74c522e9d3b6f7e2a63"],["detached-window.js","f05b0a0f2a8cc967028fb4f95f4a9614"],["icon-128.png","cf558ed413851d046b9dcc84c1d57543"],["icon-48.png","ca68956f464ed4fd2e09c66d5edaed5f"],["index.html","2df6e01f236e6c99bf7c4f84feeca789"],["lib/codemirror/mode/coffeescript/coffeescript.js","dea87b9f4c669789c4760605d947f1a9"],["lib/codemirror/mode/css/css.js","6c9ca32a78c120340e588ed3df734138"],["lib/codemirror/mode/css/gss.html","9afa6e2f3a7daa6127a3f26e2e68005c"],["lib/codemirror/mode/css/gss_test.js","e40c6fd9abdc6edc2b29e521bda726e1"],["lib/codemirror/mode/css/less.html","a35ff50857d48bb2f4df8ac737f35d64"],["lib/codemirror/mode/css/scss.html","8c96251f27727a9b23b45c41511e23a0"],["lib/codemirror/mode/haml/haml.js","9abc1679e0f54dcdd62d2326ed6133f5"],["lib/codemirror/mode/htmlembedded/htmlembedded.js","67f745ab3879bf7bc3029ac75ea3e181"],["lib/codemirror/mode/htmlmixed/htmlmixed.js","2d6915b576f267e93f0e1cf72f31af37"],["lib/codemirror/mode/javascript/javascript.js","3b2f1591e3175a24846cb182943f2a40"],["lib/codemirror/mode/javascript/json-ld.html","a2a5069194b78b6b5523cace263cab06"],["lib/codemirror/mode/javascript/typescript.html","76c2ffb883a133aa0fc5cc75ec0c56f5"],["lib/codemirror/mode/jsx/jsx.js","7bee6944931c2cc6ccd99b50fca637db"],["lib/codemirror/mode/markdown/markdown.js","30dd4984e2e929429d70cf5174b35c5d"],["lib/codemirror/mode/meta.js","6e456ea5fd8920c85d5281bd1efecb4c"],["lib/codemirror/mode/pug/pug.js","e988fd72c82f3b11836f6a06f7452436"],["lib/codemirror/mode/sass/sass.js","bd31ac70e9a457abc2789c2b83a21984"],["lib/codemirror/mode/stylus/stylus.js","81e2d281ecbb1dcf5c86857097ae60a7"],["lib/codemirror/mode/xml/xml.js","80f64aaafa6af7844d14f32f3219bb26"],["lib/codemirror/theme/3024-day.css","73c8f41583b4b71dbe1e5eac5c96f1a9"],["lib/codemirror/theme/3024-night.css","745180be9a932f24c6c0dd4ebdf5a0ed"],["lib/codemirror/theme/abcdef.css","8004cb71fd65e58bdfa64fdd55241315"],["lib/codemirror/theme/ambiance-mobile.css","256f2dd130b80c6afaa40fddf700d12a"],["lib/codemirror/theme/ambiance.css","6a200e1f3976929816cf3ac4675c810a"],["lib/codemirror/theme/base16-dark.css","84b6347918411d58d7f9b65a7ee87f65"],["lib/codemirror/theme/base16-light.css","037c7f3d16fe6d5ae2baa532e334172b"],["lib/codemirror/theme/base2tone-meadow-dark.css","f9dd12e2e51fc1575c57f3e5edc2232f"],["lib/codemirror/theme/bespin.css","cc414e4ec18bc89b3c79935b0e27fc20"],["lib/codemirror/theme/blackboard.css","cf9366960ff65c8101793bc64fe13e88"],["lib/codemirror/theme/cobalt.css","3488b576456693fd7ced2da0e10c8a16"],["lib/codemirror/theme/colorforth.css","b2ee8d2296277fc2811a7473ee4e9977"],["lib/codemirror/theme/dracula.css","e514d652ae86bfeaed34237b7d3afe44"],["lib/codemirror/theme/duotone-dark.css","02ec891b23125aaf625d978a39fd24ca"],["lib/codemirror/theme/duotone-light.css","608d11459665117d708651ce7f803fde"],["lib/codemirror/theme/eclipse.css","194369eec66630cfaf662ce5f0a193be"],["lib/codemirror/theme/elegant.css","0a4227e805a9d5f73a55dd248c1b052d"],["lib/codemirror/theme/erlang-dark.css","b5543f5273c968449760ab0d6a2af6dc"],["lib/codemirror/theme/hopscotch.css","b924ed31af30b1c68e5a01fc3c9b0553"],["lib/codemirror/theme/icecoder.css","576d776abdf7e28ea9f84e2eb161a20d"],["lib/codemirror/theme/isotope.css","7bb44bff5190c427de5ae750d6369633"],["lib/codemirror/theme/lesser-dark.css","da2c896bff035cec86fa98b6dc13f7cc"],["lib/codemirror/theme/liquibyte.css","9f37e7a4f3c02bec9bb735b78ed082d6"],["lib/codemirror/theme/material.css","11e812a3688805b5c187a6e6852bafe1"],["lib/codemirror/theme/mbo.css","55ff4bdd8a92c3dcbfd5421c532b3059"],["lib/codemirror/theme/mdn-like.css","79f8dabc5593d01d27bc824b801f9f05"],["lib/codemirror/theme/midnight.css","950e76dca6461ee1a2eac39f2d886613"],["lib/codemirror/theme/monokai.css","31c75ebee6311d49c046ffbbb91028f4"],["lib/codemirror/theme/neat.css","6b19894b9787c6791c250a95d0d4f8d6"],["lib/codemirror/theme/neo.css","2886072b53043c167e6f8765606c705c"],["lib/codemirror/theme/night.css","fe3ce7650a77e7e3887816dd7b6d880d"],["lib/codemirror/theme/panda-syntax.css","acbf94261e43c1f29c2252eb445de032"],["lib/codemirror/theme/paraiso-dark.css","3c24cee0dfac767713840b24e8359c99"],["lib/codemirror/theme/paraiso-light.css","e245bbfd22b4f61efe526ff13903f19e"],["lib/codemirror/theme/pastel-on-dark.css","48aae1a42733db57bd0a260ce0d83975"],["lib/codemirror/theme/railscasts.css","a5e7682d89da46244e5464d9572e24d8"],["lib/codemirror/theme/rubyblue.css","52bb601017a90bca522d66f6e82e73aa"],["lib/codemirror/theme/seti.css","f71668880eb1625f420ceaad670436f0"],["lib/codemirror/theme/solarized dark.css","4d05a166d713bb1ac24833061c1522d7"],["lib/codemirror/theme/solarized light.css","4d05a166d713bb1ac24833061c1522d7"],["lib/codemirror/theme/the-matrix.css","33c49ceeedafd0a08e712e465e3ad3ce"],["lib/codemirror/theme/tomorrow-night-bright.css","777d36e1c5bbfeb3bf2ca8dd607eee93"],["lib/codemirror/theme/tomorrow-night-eighties.css","5ceb5531fbe074d5190b55e8c725051e"],["lib/codemirror/theme/ttcn.css","d2cb74dfae563a10e9c286357429ea8b"],["lib/codemirror/theme/twilight.css","684040adf66ef89355cb7ebc6b54b00b"],["lib/codemirror/theme/vibrant-ink.css","f10004836fb29cc9a08c987d3e18938a"],["lib/codemirror/theme/xq-dark.css","60f162f0c4240e7352364d436b5598fa"],["lib/codemirror/theme/xq-light.css","447e80da7fe8c5c2bcf39127200cead2"],["lib/codemirror/theme/yeti.css","623dc805bc84dd6d25deef376593354e"],["lib/codemirror/theme/zenburn.css","94ad50bf3d048ed92cc513cd901dc685"],["lib/screenlog.js","974cb1ec0473b11ae4834028c1820816"],["lib/transpilers/atomizer.browser.js","c2925b84a627b017797664530f284618"],["lib/transpilers/babel-polyfill.min.js","6fef55c62df380d41c8f42f8b0c1f4da"],["lib/transpilers/babel.min.js","77a1a84bbc2661db874c738f9b3ba375"],["lib/transpilers/coffee-script.js","df68698ca5d438d7fb70c3c259155a37"],["lib/transpilers/jade.js","529e365c68f8d5efc4cea18be310bd76"],["lib/transpilers/less.min.js","6fd457ee80aaf9aa8758fe8a2345c970"],["lib/transpilers/marked.js","93163e72d380637970dc957c6cf75a77"],["lib/transpilers/sass.js","1263518af3f8b2090c9b08d195bd20d9"],["lib/transpilers/sass.worker.js","0d6c944b36008580fbedc09642f7f656"],["lib/transpilers/stylus.min.js","58f6030903ab52f596fb407dcd3df34f"],["lib/transpilers/typescript.js","cc0882a3185037052e21fa06a38ef077"],["partials/ask-to-import-modal.html","4c41c4fe11e4812ba6258d8e04d27d40"],["partials/changelog.html","d07acae211850ce1db53678b6258f9e5"],["partials/help-modal.html","c43bfe929337f371221503e83c62bdb8"],["partials/keyboard-shortcuts.html","d7c4124380a4eeb18968d55276d19591"],["partials/login-modal.html","7bb43bece90a93308919fb00162ee669"],["partials/onboard-modal.html","e9597ff891a70080a418e98abf198a5d"],["partials/pledge-modal.html","13f16984222c6447fb830250a818b763"],["patreon.png","8b4321f782e84764e556af3dee32a131"],["preview.html","ad041893596a3a2045aeab80feb24532"],["script.js","3bd018f1ac5fbda3d900a2c4feb89c42"],["style.css","52c81c000d75a52160976381ee0df9fb"],["vendor.css","6ed94306315b8aaf789c53091c23bb4b"],["vendor.js","e03ecbe2db9ff1eadc337415db0f1f80"]]; var cacheName = 'sw-precache-v3--' + (self.registration ? self.registration.scope : ''); @@ -45,7 +45,7 @@ var ignoreUrlParametersMatching = [/^utm_/]; -var addDirectoryIndex = function (originalUrl, index) { +var addDirectoryIndex = function(originalUrl, index) { var url = new URL(originalUrl); if (url.pathname.slice(-1) === '/') { url.pathname += index; @@ -53,7 +53,7 @@ var addDirectoryIndex = function (originalUrl, index) { return url.toString(); }; -var cleanResponse = function (originalResponse) { +var cleanResponse = function(originalResponse) { // If this is not a redirected response, then we don't have to do anything. if (!originalResponse.redirected) { return Promise.resolve(originalResponse); @@ -75,7 +75,7 @@ var cleanResponse = function (originalResponse) { }); }; -var createCacheKey = function (originalUrl, paramName, paramValue, +var createCacheKey = function(originalUrl, paramName, paramValue, dontCacheBustUrlsMatching) { // Create a new URL object to avoid modifying originalUrl. var url = new URL(originalUrl); @@ -91,7 +91,7 @@ var createCacheKey = function (originalUrl, paramName, paramValue, return url.toString(); }; -var isPathWhitelisted = function (whitelist, absoluteUrlString) { +var isPathWhitelisted = function(whitelist, absoluteUrlString) { // If the whitelist is empty, then consider all URLs to be whitelisted. if (whitelist.length === 0) { return true; @@ -104,7 +104,7 @@ var isPathWhitelisted = function (whitelist, absoluteUrlString) { }); }; -var stripIgnoredUrlParameters = function (originalUrl, +var stripIgnoredUrlParameters = function(originalUrl, ignoreUrlParametersMatching) { var url = new URL(originalUrl); // Remove the hash; see https://github.com/GoogleChrome/sw-precache/issues/290 diff --git a/app/style.css b/app/style.css index d3ced79..8a9b436 100644 --- a/app/style.css +++ b/app/style.css @@ -1 +1 @@ -:root{--color-bg:#252637;--color-sidebar:#3a2b63;--code-font-size:16px;--color-button:#0074d9}body{margin:0;padding:0;background:rgba(0,0,0,.5);background:var(--color-bg);color:rgba(255,255,255,.9);min-height:100vh;font-size:87.5%;position:relative;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Segoe UI Emoji','Segoe UI Symbol'}h1{margin-top:0}a{text-decoration:none;color:#d61237;cursor:pointer}p{line-height:1.65}.hide{display:none!important}.flex{display:flex}.flex-grow{flex-grow:1}.flex-v-center{align-items:center}.flex-h-center{justify-content:center}.flex-h-end{justify-content:flex-end}.fr{float:right}.relative{position:relative}.tac{text-align:center}.tar{text-align:right}.va-m{vertical-align:middle}.full-width{width:100%}.opacity--30{opacity:.3}.opacity--70{opacity:.7}.pointer-none{pointer-events:none}.ml-1{margin-left:1rem}.ml-2{margin-left:2rem}.mb-1{margin-bottom:1rem}.mb-2{margin-bottom:2rem}@media screen and (max-width:500px){.block--mobile{display:block}.ml-0--mobile{margin-left:0}.hide-on-mobile{display:none!important}}hr{background:0;border:0;border-bottom:1px solid #dedede}label{cursor:pointer}[class*=hint--]:after{text-transform:none;font-weight:400;letter-spacing:.5px;font-size:14px}.line{display:block;margin-bottom:1em}.caret{display:inline-block;width:0;height:0;border:6px solid transparent;border-top-color:currentColor;position:relative;top:5px;margin-left:8px}a>svg{fill:rgba(255,255,255,.2)}input[type=number],input[type=text],select,textarea{padding:3px 5px;font-size:inherit}.hidden-select{opacity:0;position:absolute;left:0;right:0;top:0;bottom:0}.btn{display:inline-block;color:var(--color-button);font-size:inherit;border:3px solid var(--color-button);border-radius:5px;padding:9px 15px;cursor:pointer;letter-spacing:.2px;line-height:1;transition:box-shadow .2s ease}.btn--primary{background:var(--color-button) linear-gradient(180deg,rgba(0,0,0,.5) 0,transparent);color:#fff}.btn--big{padding:15px 30px;border-radius:3px}.btn-icon{display:inline-flex;align-items:center}.btn:hover{text-decoration:none;box-shadow:0 5px 5px 0 rgba(0,0,0,.25)}.btn:focus{outline-width:4px;outline-color:#b76b29;outline-style:solid;outline-offset:1px}.btn-icon>svg{width:20px;height:20px;fill:currentColor;vertical-align:middle;margin-right:8px}.btn--big>svg{width:25px;height:25px;margin-right:12px}.btn-loader{display:none}.is-loading>svg{display:none}.is-loading .btn-loader{display:block}.star:after{content:'★';color:#eee333}.show-when-selected{display:none}.selected .show-when-selected{display:inline-block}.main-container{position:absolute;left:0;right:0;top:0;bottom:0;display:flex;flex-direction:column;overflow:hidden;transition:.1s ease .2s;will-change:filter}body:not(.light-version).overlay-visible .main-container{transition-duration:.5s;transition-delay:.4s;filter:blur(3px)}.content-wrap{max-height:calc(100% - 70px)}.code-side,.demo-side{flex-basis:inherit;position:relative;width:50%}.layout-3 .content-wrap{flex-direction:row-reverse}.code-side{display:flex;flex-direction:column}.layout-2 .content-wrap{flex-direction:column}.layout-2 .code-side{flex-direction:row;width:auto}.layout-2 .demo-side{width:auto}.layout-5 .code-side{flex-direction:row;width:auto}.layout-5 .code-wrap{height:auto}.layout-4 .code-side{display:none}.layout-4 .code-side+.gutter{display:none}.layout-4 .demo-side{width:100%!important}.is-detached-mode .demo-side{display:none}.is-detached-mode .code-side{width:100%!important}.is-detached-mode.layout-2 .code-side{height:auto!important}.code-wrap{display:flex;flex-direction:column;flex-basis:inherit;height:33%;overflow:hidden;position:relative;background:var(--color-bg);transition:height .3s ease,width .3s ease;will-change:height}.layout-2 .code-wrap.is-minimized,.layout-5 .code-wrap.is-minimized{flex-direction:row}.is-dragging .code-wrap{transition:none}.layout-2 .code-wrap{height:auto;width:33%}.code-wrap__header{display:flex;flex-shrink:0;justify-content:space-between;align-items:center;padding:5px 10px;background:rgba(0,0,0,.2);color:#888;border-bottom:1px solid rgba(0,0,0,.3);font-weight:700;user-select:none}.code-wrap__header-label{display:inline-block;font-size:1.1em}.layout-2 .code-side .is-minimized .code-wrap__header,.layout-5 .code-side .is-minimized .code-wrap__header{writing-mode:vertical-lr;padding:10px 5px}.code-wrap__header .caret{transition:.2s ease}.is-minimized .code-wrap__header .caret{opacity:0}.code-wrap__header-btn{display:inline-block;vertical-align:top;margin-left:8px}.code-wrap__header-btn,.code-wrap__header-btn>svg{width:18px;height:18px}.code-wrap__header-right-options{position:relative;z-index:1}.code-wrap__collapse-btn:before{content:url('data:image/svg+xml;utf8,')}.is-maximized .code-wrap__collapse-btn:before{content:url('data:image/svg+xml;utf8,')}@keyframes pop-in{from{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}.Codemirror{width:100%;height:calc(100% - 25px);font-size:var(--code-font-size)}.layout-2 .is-minimized .Codemirror,.layout-5 .is-minimized .Codemirror{height:calc(100%)}.Codemirror pre{font-variant-ligatures:contextual}.cm-s-monokai .CodeMirror-linenumber{color:rgba(255,255,255,.2)}.cm-s-monokai .CodeMirror-gutters,.cm-s-monokai.CodeMirror{background:var(--color-bg)}.cm-s-monokai .CodeMirror-guttermarker-subtle{opacity:.4}.cm-s-monokai .CodeMirror-activeline-background,.cm-s-monokai .CodeMirror-activeline-gutter{background:rgba(0,0,0,.1)!important}.CodeMirror-hints{font-size:var(--code-font-size);border:0;background:#1e1e2c}.CodeMirror-hint{color:#bbb;padding:2px 4px}li.CodeMirror-hint-active{background:#5b429d}#demo-frame{border:0;width:100%;height:calc(100% - 29px);position:absolute;z-index:1;background:#fff}body>#demo-frame{height:100%}.footer,.main-header{padding:5px 10px;background-color:#12131b;color:rgba(255,255,255,.45);border-top:1px solid rgba(255,255,255,.14)}.footer{z-index:6}.main-header{display:flex;flex-wrap:nowrap;border:0;border-bottom:1px solid rgba(255,255,255,.14)}.main-header__btn-wrap>a{font-size:.8em;font-weight:700;line-height:20px;height:20px;letter-spacing:.6px;color:#9297b3;border-radius:3px;margin-left:10px;padding:0 8px;border:1px solid rgba(0,0,0,.9);background:linear-gradient(180deg,rgba(0,0,0,.5) 0,rgba(255,255,255,.1) 100%);box-shadow:0 -1px 0 0 rgba(255,255,255,.15);text-transform:uppercase}.main-header__btn-wrap>a>svg{fill:#9297b3;margin-right:4px}.main-header__btn-wrap>a.is-marked>svg{fill:#dc143c}.main-header__btn-wrap>a:hover{border-color:rgba(146,151,179,.5)}.main-header__btn-wrap>a.is-loading{pointer-events:none;opacity:.4}.main-header__avatar-img,.profile-modal__avatar-img{border-radius:50%}.logo{display:inline-block;height:25px;width:48px;margin-right:5px;background:url(icon-48.png) 0 -12px;background-repeat:no-repeat;vertical-align:middle;-webkit-filter:grayscale(.9);filter:grayscale(.9);transition:.4s ease;opacity:.3;will-change:opacity,filter}.footer:hover .logo{-webkit-filter:grayscale(0);filter:grayscale(0);opacity:1}.footer__right{font-size:0;line-height:0}.footer__separator{display:inline-block;height:24px;margin:0 10px 0 20px;border-left:1px solid rgba(255,255,255,.2)}.mode-btn{margin-left:10px;display:inline-block}.footer__link:first-of-type{margin-left:5px}.footer__link{display:inline-block;margin-right:5px;position:relative;top:2px}.footer a>svg{transition:.3s ease;fill:rgba(255,255,255,.2)}.footer a:hover svg{fill:rgba(255,255,255,.45)}.mode-btn svg{width:24px;height:24px}.mode-btn.selected svg{fill:rgba(255,255,255,.45)}.gutter{background:rgba(255,255,255,.05);flex-shrink:0}.gutter-horizontal{cursor:ew-resize}.gutter-vertical{cursor:ns-resize}.item-title-input{background:0 0;border:0;color:rgba(255,255,255,.6);flex:1}.search-input{background:rgba(255,255,255,.1);padding:10px 20px;border:0;width:100%;font-size:16px;color:#fff;border-radius:4px}.modal{position:fixed;top:0;left:0;width:100vw;height:100vh;overflow-y:auto;align-items:center;display:flex;align-items:baseline;justify-content:center;z-index:2000;visibility:hidden}.modal__close-btn{position:absolute;right:10px;top:10px;opacity:.8;transition:.25s ease}.modal__close-btn>svg{fill:#000;width:30px;height:30px}.modal__close-btn:hover{opacity:.7}.modal__content{background:#fdfdfd;color:#444;position:relative;border-radius:8px;opacity:0;padding:3em;font-size:1.1em;line-height:1.4;max-width:85vw;margin:2rem auto;box-sizing:border-box;overflow-y:auto;pointer-events:auto;transition-property:transform,opacity;transition-duration:.19s;transform:translateY(50px) scale(.95)}@media screen and (max-width:900px){.modal__content{max-width:95vw}}.is-modal-visible{visibility:visible}.is-modal-visible .modal__content{transition-duration:.3s;transform:translateY(0) scale(1);opacity:1}.modal-overlay{position:fixed;width:100%;height:100%;visibility:hidden;top:0;left:0;z-index:5;opacity:0;will-change:opacity;background:rgba(0,0,0,.6);transition:opacity .3s}.ask-to-import-modal .modal__content,.pledge-modal .modal__content{max-width:800px}.login-modal .modal__content{overflow-y:initial}.saved-items-pane{position:fixed;right:0;top:0;bottom:0;width:450px;padding:20px 30px;z-index:6;background-color:var(--color-sidebar);transition:.3s cubic-bezier(1,.13,.21,.87);transition-property:transform;will-change:transform;transform:translateX(100%)}.saved-items-pane.is-open{transition-duration:.4s;transform:translateX(0)}.is-modal-visible~.modal-overlay,.saved-items-pane.is-open~.modal-overlay{opacity:1;visibility:visible}.saved-items-pane__close-btn{position:absolute;left:-18px;top:24px;opacity:0;visibility:hidden;border-radius:50%;padding:10px 14px;background:#dc143c;color:#fff;border:0;transform:scale(0);will-change:transform,opacity;transition:.3s ease;transition-delay:0}.saved-items-pane.is-open .saved-items-pane__close-btn{opacity:1;transition-delay:.4s;transform:scale(1);visibility:visible}.saved-item-tile{padding:20px;background-color:rgba(255,255,255,.06);position:relative;margin:20px 0;display:block;border-radius:4px;cursor:pointer;opacity:0;transform:translateX(50px);will-change:opacity,transform;box-shadow:0 2px 4px 0 rgba(0,0,0,.2);animation:slide-left .35s ease forwards}.saved-item-tile:nth-child(1){animation-delay:.2s}.saved-item-tile:nth-child(2){animation-delay:.25s}.saved-item-tile:nth-child(3){animation-delay:.3s}.saved-item-tile:nth-child(4){animation-delay:.35s}.saved-item-tile:nth-child(5){animation-delay:.4s}.saved-item-tile:nth-child(6){animation-delay:.45s}.saved-item-tile:nth-child(7){animation-delay:.5s}.saved-item-tile:nth-child(8){animation-delay:.55s}.saved-item-tile:nth-child(9){animation-delay:.6s}.saved-item-tile:nth-child(10){animation-delay:.65s}.saved-item-tile:nth-child(11){animation-delay:.7s}.saved-item-tile:nth-child(12){animation-delay:.75s}.saved-item-tile:nth-child(n+12){animation-delay:.8s}@keyframes slide-left{from{opacity:0;transform:translateX(50px)}to{opacity:1;transform:translateX(0)}}.saved-item-tile.selected,.saved-item-tile:hover{background:rgba(255,255,255,.1)}.saved-item-tile__btns{position:absolute;top:6px;z-index:1;right:8px;opacity:0;pointer-events:none;transition:.25s ease}.saved-item-tile.selected .saved-item-tile__btns,.saved-item-tile:hover .saved-item-tile__btns{opacity:1;pointer-events:auto}.saved-item-tile__btn{padding:7px 10px;color:rgba(255,255,255,.3);border-radius:20px;margin-left:2px;background:rgba(255,255,255,.05);text-transform:uppercase}.saved-item-tile__btn:hover{background:rgba(255,255,255,.8);color:#555}.saved-item-tile__title{pointer-events:none;font-size:1.4em;margin:0 0 1em 0;opacity:.8}.saved-item-tile__meta{pointer-events:none;opacity:.3}.saved-items-pane__container{overflow-y:scroll;max-height:calc(100vh - 90px)}.notifications-btn{position:relative}@keyframes shake{2%,22%{transform:translate3d(-1px,0,0)}20%,5%{transform:translate3d(2px,0,0)}12%,17%,7%{transform:translate3d(-4px,0,0)}10%,15%{transform:translate3d(4px,0,0)}}.notifications-btn.has-new{animation:shake 7s linear infinite;transform-origin:50% 10px}.notifications-btn__dot{position:absolute;right:1;top:-2px;background:#31fe45;border-radius:50%;width:12px;height:12px;display:none}.has-new .notifications-btn__dot{display:block}.notification{border:1px solid #f1f1f1;border-radius:5px;padding:20px;background:#f8f6f9;position:relative}.notification:not(:last-child){margin-bottom:10px}.notification li:not(:last-child){margin-bottom:10px}.notification__version{background:#ff8c00;color:#fff;padding:3px;border-radius:5px;position:absolute;top:2px;left:2px}.loader,.loader:after{border-radius:50%;width:3em;height:3em}.loader{font-size:5px;position:relative;text-indent:-9999em;border-top:1.1em solid rgba(118,57,229,.2);border-right:1.1em solid rgba(118,57,229,.2);border-bottom:1.1em solid rgba(118,57,229,.2);border-left:1.1em solid #7639e5;transform:translateZ(0);animation:load8 1.1s infinite linear}@keyframes load8{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.btn-group{position:relative;cursor:pointer}.dropdown__menu{position:absolute;top:100%;left:0;padding:0;margin:0;min-width:200px;display:block;font-size:.88rem;list-style:none;border-radius:4px;overflow:hidden;opacity:0;visibility:hidden;transition:transform .25s ease;transform:translateY(10px);z-index:5;background:#fff}.dropdown__menu>li>a{display:block;padding:6px 15px;color:#333;cursor:pointer}.dropdown__menu>li.selected>a,.dropdown__menu>li>a:hover{background:var(--color-sidebar);color:#fff}.dropdown__menu>li:not(:last-child){border-bottom:1px solid rgba(0,0,0,.05)}.dropdown__menu.is-open,.open>.dropdown__menu{opacity:1;visibility:visible;transform:translateY(0)}.alerts-container{position:fixed;will-change:transform;left:50%;top:-5px;padding:10px;background:#fff;border:1px solid #eee;color:#333;box-shadow:0 3px 5px rgba(0,0,0,.2);font-size:1rem;border-radius:3px;z-index:6;transform:translateX(-50%) translateY(-100%);transition:.3s ease}.alerts-container.is-active{transform:translateX(-50%) translateY(0)}.error-gutter{width:8px}.gutter-error-marker{width:8px;height:20px;background:red;border-radius:0;position:relative;top:0;left:1px}.gutter-error-marker:after{content:attr(data-title);background:red;color:#fff;padding:4px;opacity:0;visibility:hidden;position:absolute;top:14px;left:0;width:300px;transform:translateX(-10px);will-change:transform;transition:.2s ease}.gutter-error-marker:hover:after{opacity:1;visibility:visible;transform:translateX(0)}.count-label{color:rgba(0,0,0,.8);background:rgba(255,255,255,.53);border-radius:5px;padding:1px 6px;font-weight:700}.onboard-step{background:#f7f2f1;border:1px solid #ecdede;margin:15px;padding:20px 30px;background-color:#fff;border-radius:10px;box-shadow:0 16px 22px rgba(0,0,0,.1);flex:1;opacity:0;animation:onboard-step-show .6s ease forwards;animation-delay:.1s}.onboard-step:nth-child(2){animation-delay:.2s}.onboard-step:nth-child(3){animation-delay:.4s}.onboard-step__icon{fill:#fff2ed;stroke-width:.5px;stroke:#e79f80;width:80px;height:80px}@keyframes onboard-step-show{from{transform:translateY(10px);opacity:0}to{transform:translateY(0);opacity:1}}.autocomplete-dropdown{border-top-left-radius:0;border-top-right-radius:0;right:0;max-height:200px;overflow-y:auto;border:1px solid rgba(0,0,0,.5);z-index:2001}.autocomplete__loader{position:absolute;right:3px;bottom:1px}@keyframes wobble{from{transform:none}15%{transform:translate3d(-25%,0,0) rotate3d(0,0,1,-5deg)}30%{transform:translate3d(20%,0,0) rotate3d(0,0,1,3deg)}45%{transform:translate3d(-15%,0,0) rotate3d(0,0,1,-3deg)}60%{transform:translate3d(10%,0,0) rotate3d(0,0,1,2deg)}75%{transform:translate3d(-5%,0,0) rotate3d(0,0,1,-1deg)}to{transform:none}}.animated{animation-duration:1s;animation-fill-mode:both}.wobble{animation-name:wobble}.console{background:var(--color-bg);z-index:6;position:absolute;bottom:0;min-height:80px;height:35vh;left:0;right:0;transform:translateY(0);transition:transform .4s cubic-bezier(.76,.01,.13,.9)}.console.is-minimized{transform:translateY(calc(100% - 29px))}.console .Codemirror{height:calc(100% - 55px)}.console-exec-input{padding:5px;font-size:1.3em;flex:1;background:rgba(0,0,0,.3);color:#fff;border:0;outline:0}.console:not(.is-minimized) .code-wrap__header{cursor:ns-resize}.global-console-container{display:none;position:relative;height:35px}.is-detached-mode .console,.is-detached-mode .footer{z-index:4}.is-detached-mode .global-console-container{display:block}.kbd-shortcut__keys{background:rgba(0,0,0,.1);border-radius:3px;padding:3px 8px;margin-right:5px;display:inline-block;font-size:.9rem;font-weight:700}.kbd-shortcut__details{display:inline-block}.web-maker-with-tag{position:relative;display:inline-block}.is-extension .web-maker-with-tag:after{display:none}.social-login-btn--github{color:#fff;background:#656b6f;border-color:#656b6f}.social-login-btn--facebook{color:#fff;background:#4e62c0;border-color:#4e62c0}.social-login-btn--google{background:#fff;border:2px solid currentColor;color:inherit}body.is-logged-in .hide-on-login,body:not(.is-app) .show-when-app,body:not(.is-extension) .show-when-extension,body:not(.is-logged-in) .hide-on-logout{display:none}.onboard-selection{padding:10px;margin:0 40px;border-radius:5px;transition:.25s ease;position:relative;border:1px solid transparent}.onboard-selection:hover{cursor:pointer;transform:scale(1.15)}.onboard-selection.selected:after{content:'';position:absolute;right:-20px;bottom:40px;width:80px;height:80px;border-radius:50%;background:#fff url('data:image/svg+xml;charset=UTF-8,')}.bookmarklet{display:inline-flex;align-items:center;border:1px #aaa solid;padding:0 5px;border-style:dashed;color:#333}.help-text{font-size:.9em;color:#616465;padding-left:1em}.social-login-btn:after,.social-login-btn:before,.social-login-btn:hover:after,.social-login-btn:hover:before{visibility:hidden}.last-login-github .social-login-btn--github:after,.last-login-github .social-login-btn--github:before{visibility:visible}.last-login-facebook .social-login-btn--facebook:after,.last-login-facebook .social-login-btn--facebook:before{visibility:visible}.last-login-google .social-login-btn--google:after,.last-login-google .social-login-btn--google:before{visibility:visible}@media screen and (max-width:500px){body{font-size:70%}.main-header{overflow-x:auto}.main-header__btn-wrap{flex-shrink:0}.modal__content{padding:1em}.saved-items-pane{width:77vw;padding:10px 20px}}.cm-s-paraiso-dark.CodeMirror{background:#2f1e2e;color:#b9b6b0}.cm-s-paraiso-dark .CodeMirror-gutters{background:#2f1e2e;border-right:0}.cm-s-paraiso-dark .CodeMirror-activeline-background{background:#4d344a}.cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0}.cm-s-monokai .CodeMirror-activeline-background{background:#373831}.cm-s-3024-day.CodeMirror{background:#f7f7f7;color:#3a3432}.cm-s-3024-day .CodeMirror-gutters{background:#f7f7f7;border-right:0}.cm-s-3024-day .CodeMirror-activeline-background{background:#e8f2ff}.cm-s-material.CodeMirror{background-color:#263238;color:rgba(233,237,237,1)}.cm-s-material .CodeMirror-gutters{background:#263238;color:#537f7e}.cm-s-material .CodeMirror-activeline-background{background:rgba(0,0,0,0)}.cm-s-dracula .CodeMirror-gutters,.cm-s-dracula.CodeMirror{background-color:#282a36!important;color:#f8f8f2!important}.cm-s-dracula .CodeMirror-activeline-background{background:rgba(255,255,255,.1)}.cm-s-blackboard.CodeMirror{background:#0c1021;color:#f8f8f8}.cm-s-blackboard .CodeMirror-gutters{background:#0c1021;border-right:0}.cm-s-blackboard .CodeMirror-activeline-background{background:#3c3636}.cm-s-midnight.CodeMirror{background:#0f192a;color:#d1edff}.cm-s-midnight .CodeMirror-gutters{background:#0f192a;border-right:1px solid}.cm-s-midnight .CodeMirror-activeline-background{background:#253540} \ No newline at end of file +:root{--color-bg:#252637;--color-sidebar:#3a2b63;--code-font-size:16px;--color-button:#0074d9}body{margin:0;padding:0;background:rgba(0,0,0,.5);background:var(--color-bg);color:rgba(255,255,255,.9);min-height:100vh;font-size:87.5%;position:relative;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Segoe UI Emoji','Segoe UI Symbol'}h1{margin-top:0}a{text-decoration:none;color:#d61237;cursor:pointer}p{line-height:1.65}.hide{display:none!important}.flex{display:flex}.flex-grow{flex-grow:1}.flex-v-center{align-items:center}.flex-h-center{justify-content:center}.flex-h-end{justify-content:flex-end}.fr{float:right}.relative{position:relative}.tac{text-align:center}.tar{text-align:right}.va-m{vertical-align:middle}.full-width{width:100%}.opacity--30{opacity:.3}.opacity--70{opacity:.7}.pointer-none{pointer-events:none}.ml-1{margin-left:1rem}.ml-2{margin-left:2rem}.mb-1{margin-bottom:1rem}.mb-2{margin-bottom:2rem}.mb-0{margin-bottom:0}.mt-0{margin-top:0}@media screen and (max-width:500px){.block--mobile{display:block}.ml-0--mobile{margin-left:0}.hide-on-mobile{display:none!important}}hr{background:0;border:0;border-bottom:1px solid #dedede}label{cursor:pointer}[class*=hint--]:after{text-transform:none;font-weight:400;letter-spacing:.5px;font-size:14px}.line{display:block;margin-bottom:1em}.caret{display:inline-block;width:0;height:0;border:6px solid transparent;border-top-color:currentColor;position:relative;top:5px;margin-left:8px}a>svg{fill:rgba(255,255,255,.2)}input[type=number],input[type=text],select,textarea{padding:3px 5px;font-size:inherit}.hidden-select{opacity:0;position:absolute;left:0;right:0;top:0;bottom:0}.btn{display:inline-block;color:var(--color-button);font-size:inherit;border:3px solid var(--color-button);border-radius:5px;padding:9px 15px;cursor:pointer;letter-spacing:.2px;line-height:1;transition:box-shadow .2s ease}.btn--primary{background:var(--color-button) linear-gradient(180deg,rgba(0,0,0,.5) 0,transparent);color:#fff}.btn--big{padding:15px 30px;border-radius:3px}.btn-icon{display:inline-flex;align-items:center}.btn:hover{text-decoration:none;box-shadow:0 5px 5px 0 rgba(0,0,0,.25)}.btn:focus{outline-width:4px;outline-color:#b76b29;outline-style:solid;outline-offset:1px}.btn-icon>svg{width:20px;height:20px;fill:currentColor;vertical-align:middle;margin-right:8px}.btn--big>svg{width:25px;height:25px;margin-right:12px}.btn-loader{display:none}.is-loading>svg{display:none}.is-loading .btn-loader{display:block}.star:after{content:'★';color:currentColor}.show-when-selected{display:none}.selected .show-when-selected{display:inline-block}.main-container{position:absolute;left:0;right:0;top:0;bottom:0;display:flex;flex-direction:column;overflow:hidden;transition:.1s ease .2s;will-change:filter}body:not(.light-version).overlay-visible .main-container{transition-duration:.5s;transition-delay:.4s;filter:blur(3px)}.content-wrap{height:1px;max-height:calc(100% - 70px)}.code-side,.demo-side{flex-basis:inherit;position:relative;width:50%}.layout-3 .content-wrap{flex-direction:row-reverse}.code-side{display:flex;flex-direction:column}.layout-2 .content-wrap{flex-direction:column}.layout-2 .code-side{flex-direction:row;width:auto}.layout-2 .demo-side{width:auto}.layout-5 .code-side{flex-direction:row;width:auto}.layout-5 .code-wrap{height:auto}.layout-4 .code-side{display:none}.layout-4 .code-side+.gutter{display:none}.layout-4 .demo-side{width:100%!important}.is-detached-mode .demo-side{display:none}.is-detached-mode .code-side{width:100%!important}.is-detached-mode.layout-2 .code-side{height:auto!important}.code-wrap{display:flex;flex-direction:column;flex-basis:inherit;height:33%;overflow:hidden;position:relative;background:var(--color-bg);transition:height .3s ease,width .3s ease;will-change:height}.layout-2 .code-wrap.is-minimized,.layout-5 .code-wrap.is-minimized{flex-direction:row}.is-dragging .code-wrap{transition:none}.layout-2 .code-wrap{height:auto;width:33%}.code-wrap__header{display:flex;flex-shrink:0;justify-content:space-between;align-items:center;padding:5px 10px;background:rgba(0,0,0,.2);color:#888;border-bottom:1px solid rgba(0,0,0,.3);font-weight:700;user-select:none}.code-wrap__header-label{display:inline-block;font-size:1.1em}.layout-2 .code-side .is-minimized .code-wrap__header,.layout-5 .code-side .is-minimized .code-wrap__header{writing-mode:vertical-lr;padding:10px 5px}.code-wrap__header .caret{transition:.2s ease}.is-minimized .code-wrap__header .caret{opacity:0}.code-wrap__header-btn{display:inline-block;vertical-align:top;margin-left:8px}.code-wrap__header-btn,.code-wrap__header-btn>svg{width:18px;height:18px}.code-wrap__header-right-options{position:relative;z-index:1}.code-wrap__collapse-btn:before{content:url('data:image/svg+xml;utf8,')}.is-maximized .code-wrap__collapse-btn:before{content:url('data:image/svg+xml;utf8,')}@keyframes pop-in{from{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}.CodeMirror{width:100%;height:calc(100% - 25px);font-size:var(--code-font-size)}.layout-2 .is-minimized .Codemirror,.layout-5 .is-minimized .Codemirror{height:calc(100%)}.CodeMirror pre{font-variant-ligatures:contextual}.cm-s-monokai .CodeMirror-linenumber{color:rgba(255,255,255,.2)}.cm-s-monokai .CodeMirror-gutters,.cm-s-monokai.CodeMirror{background:var(--color-bg)}.cm-s-monokai .CodeMirror-guttermarker-subtle{opacity:.4}.cm-s-monokai .CodeMirror-activeline-background,.cm-s-monokai .CodeMirror-activeline-gutter{background:rgba(0,0,0,.1)!important}.CodeMirror-hints{font-size:var(--code-font-size);border:0;background:#1e1e2c}.CodeMirror-hint{color:#bbb;padding:2px 4px}li.CodeMirror-hint-active{background:#5b429d}#demo-frame{border:0;width:100%;height:calc(100% - 29px);position:absolute;z-index:1;background:#fff}body>#demo-frame{height:100%}.footer,.main-header{padding:5px 10px;background-color:#12131b;color:rgba(255,255,255,.45);border-top:1px solid rgba(255,255,255,.14)}.footer{z-index:6}.main-header{display:flex;flex-wrap:nowrap;border:0;border-bottom:1px solid rgba(255,255,255,.14)}.main-header__btn-wrap>a{font-size:.8em;font-weight:700;line-height:20px;height:20px;letter-spacing:.6px;color:#9297b3;border-radius:3px;margin-left:10px;padding:0 8px;border:1px solid rgba(0,0,0,.9);background:linear-gradient(180deg,rgba(0,0,0,.5) 0,rgba(255,255,255,.1) 100%);box-shadow:0 -1px 0 0 rgba(255,255,255,.15);text-transform:uppercase}.main-header__btn-wrap>a>svg{fill:#9297b3;margin-right:4px}.main-header__btn-wrap>a.is-marked>svg{fill:#dc143c}.main-header__btn-wrap>a:hover{border-color:rgba(146,151,179,.5)}.main-header__btn-wrap>a.is-loading{pointer-events:none;opacity:.4}.main-header__avatar-img,.profile-modal__avatar-img{border-radius:50%}.logo{display:inline-block;height:25px;width:48px;margin-right:5px;background:url(icon-48.png) 0 -12px;background-repeat:no-repeat;vertical-align:middle;-webkit-filter:grayscale(.9);filter:grayscale(.9);transition:.4s ease;opacity:.3;will-change:opacity,filter}.footer:hover .logo{-webkit-filter:grayscale(0);filter:grayscale(0);opacity:1}.footer__right{font-size:0;line-height:0}.footer__separator{display:inline-block;height:24px;margin:0 10px 0 20px;border-left:1px solid rgba(255,255,255,.2)}.mode-btn{margin-left:10px;display:inline-block}.footer__link:first-of-type{margin-left:5px}.footer__link{display:inline-block;margin-right:5px;position:relative;top:2px}.footer a>svg{transition:.3s ease;fill:rgba(255,255,255,.2)}.footer a:hover svg{fill:rgba(255,255,255,.45)}.mode-btn svg{width:24px;height:24px}.mode-btn.selected svg{fill:rgba(255,255,255,.45)}.gutter{background:rgba(255,255,255,.05);flex-shrink:0}.gutter-horizontal{cursor:ew-resize}.gutter-vertical{cursor:ns-resize}.item-title-input{background:0 0;border:0;color:rgba(255,255,255,.6);flex:1}.search-input{background:rgba(255,255,255,.1);padding:10px 20px;border:0;width:100%;font-size:16px;color:#fff;border-radius:4px}.modal{position:fixed;top:0;left:0;width:100vw;height:100vh;overflow-y:auto;align-items:center;display:flex;align-items:baseline;justify-content:center;z-index:2000;visibility:hidden;will-change:transform}@keyframes anim-modal-overlay{to{opacity:1;transform:translateY(0) scale(1)}}.modal__close-btn{position:absolute;right:10px;top:10px;text-transform:uppercase;font-weight:700;opacity:.8;transition:.25s ease}.modal__close-btn>svg{fill:#000;width:30px;height:30px}.modal__close-btn:hover{opacity:.7}.modal__content{background:#fdfdfd;color:#444;position:relative;border-radius:8px;opacity:0;padding:3em;font-size:1.1em;line-height:1.4;max-width:85vw;margin:2rem auto;box-sizing:border-box;overflow-y:auto;pointer-events:auto;transform:translateY(50px) scale(.95);animation:anim-modal .3s ease forwards;animation-delay:150ms}@keyframes anim-modal{to{opacity:1;transform:translateY(0) scale(1)}}@media screen and (max-width:900px){.modal__content{max-width:95vw}}.is-modal-visible{visibility:visible}.modal-overlay{position:fixed;width:100%;height:100%;visibility:hidden;top:0;left:0;z-index:5;opacity:0;will-change:opacity;background:rgba(0,0,0,.6);transition:opacity .3s}.ask-to-import-modal .modal__content,.pledge-modal .modal__content{max-width:800px}.login-modal .modal__content{overflow-y:initial}.saved-items-pane{position:fixed;right:0;top:0;bottom:0;width:450px;padding:20px 30px;z-index:6;background-color:var(--color-sidebar);transition:.3s cubic-bezier(1,.13,.21,.87);transition-property:transform;will-change:transform;transform:translateX(100%)}.saved-items-pane.is-open{transition-duration:.4s;transform:translateX(0)}.is-modal-visible~.modal-overlay,.overlay-visible .modal-overlay,.saved-items-pane.is-open~.modal-overlay{opacity:1;visibility:visible}.saved-items-pane__close-btn{position:absolute;left:-18px;top:24px;opacity:0;visibility:hidden;border-radius:50%;padding:10px 14px;background:#dc143c;color:#fff;border:0;transform:scale(0);will-change:transform,opacity;transition:.3s ease;transition-delay:0}.saved-items-pane.is-open .saved-items-pane__close-btn{opacity:1;transition-delay:.4s;transform:scale(1);visibility:visible}.saved-item-tile{padding:20px;background-color:rgba(255,255,255,.06);position:relative;margin:20px 0;display:block;border-radius:4px;cursor:pointer;opacity:0;transform:translateX(50px);will-change:opacity,transform;box-shadow:0 2px 4px 0 rgba(0,0,0,.2);animation:slide-left .35s ease forwards}.saved-item-tile:nth-child(1){animation-delay:.2s}.saved-item-tile:nth-child(2){animation-delay:.25s}.saved-item-tile:nth-child(3){animation-delay:.3s}.saved-item-tile:nth-child(4){animation-delay:.35s}.saved-item-tile:nth-child(5){animation-delay:.4s}.saved-item-tile:nth-child(6){animation-delay:.45s}.saved-item-tile:nth-child(7){animation-delay:.5s}.saved-item-tile:nth-child(8){animation-delay:.55s}.saved-item-tile:nth-child(9){animation-delay:.6s}.saved-item-tile:nth-child(10){animation-delay:.65s}.saved-item-tile:nth-child(11){animation-delay:.7s}.saved-item-tile:nth-child(12){animation-delay:.75s}.saved-item-tile:nth-child(n+12){animation-delay:.8s}@keyframes slide-left{from{opacity:0;transform:translateX(50px)}to{opacity:1;transform:translateX(0)}}.saved-item-tile.selected,.saved-item-tile:hover{background:rgba(255,255,255,.1)}.saved-item-tile__btns{position:absolute;top:6px;z-index:1;right:8px;opacity:0;pointer-events:none;transition:.25s ease}.saved-item-tile.selected .saved-item-tile__btns,.saved-item-tile:hover .saved-item-tile__btns{opacity:1;pointer-events:auto}.saved-item-tile__btn{padding:7px 10px;color:rgba(255,255,255,.3);border-radius:20px;margin-left:2px;background:rgba(255,255,255,.05);text-transform:uppercase}.saved-item-tile__btn:hover{background:rgba(255,255,255,.8);color:#555}.saved-item-tile__title{pointer-events:none;font-size:1.4em;margin:0 0 1em 0;opacity:.8}.saved-item-tile__meta{pointer-events:none;opacity:.3}.saved-items-pane__container{overflow-y:scroll;max-height:calc(100vh - 90px)}.notifications-btn{position:relative}@keyframes shake{2%,22%{transform:translate3d(-1px,0,0)}20%,5%{transform:translate3d(2px,0,0)}12%,17%,7%{transform:translate3d(-4px,0,0)}10%,15%{transform:translate3d(4px,0,0)}}.notifications-btn.has-new{animation:shake 7s linear infinite;transform-origin:50% 10px}.notifications-btn__dot{position:absolute;right:1;top:-2px;background:#31fe45;border-radius:50%;width:12px;height:12px;display:none}.has-new .notifications-btn__dot{display:block}.notification{border:1px solid #f1f1f1;border-radius:5px;padding:20px;background:#f8f6f9;position:relative}.notification:not(:last-child){margin-bottom:10px}.notification li:not(:last-child){margin-bottom:10px}.notification__version{background:#ff8c00;color:#fff;padding:3px;border-radius:5px;position:absolute;top:2px;left:2px}.loader,.loader:after{border-radius:50%;width:3em;height:3em}.loader{font-size:5px;position:relative;text-indent:-9999em;border-top:1.1em solid rgba(118,57,229,.2);border-right:1.1em solid rgba(118,57,229,.2);border-bottom:1.1em solid rgba(118,57,229,.2);border-left:1.1em solid #7639e5;transform:translateZ(0);animation:load8 1.1s infinite linear}@keyframes load8{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.btn-group{position:relative;cursor:pointer}.dropdown__menu{position:absolute;top:100%;left:0;padding:0;margin:0;min-width:200px;display:block;font-size:.88rem;list-style:none;border-radius:4px;overflow:hidden;opacity:0;visibility:hidden;transition:transform .25s ease;transform:translateY(10px);z-index:5;background:#fff}.dropdown__menu>li>a{display:block;padding:6px 15px;color:#333;cursor:pointer}.dropdown__menu>li.selected>a,.dropdown__menu>li>a:hover{background:var(--color-sidebar);color:#fff}.dropdown__menu>li:not(:last-child){border-bottom:1px solid rgba(0,0,0,.05)}.dropdown__menu.is-open,.open>.dropdown__menu{opacity:1;visibility:visible;transform:translateY(0)}.alerts-container{position:fixed;will-change:transform;left:50%;top:-5px;padding:10px;background:#fff;border:1px solid #eee;color:#333;box-shadow:0 3px 5px rgba(0,0,0,.2);font-size:1rem;border-radius:3px;z-index:6;transform:translateX(-50%) translateY(-100%);transition:.3s ease}.alerts-container.is-active{transform:translateX(-50%) translateY(0)}.error-gutter{width:8px}.gutter-error-marker{width:8px;height:20px;background:red;border-radius:0;position:relative;top:0;left:1px}.gutter-error-marker:after{content:attr(data-title);background:red;color:#fff;padding:4px;opacity:0;visibility:hidden;position:absolute;top:14px;left:0;width:300px;transform:translateX(-10px);will-change:transform;transition:.2s ease}.gutter-error-marker:hover:after{opacity:1;visibility:visible;transform:translateX(0)}.count-label{color:rgba(0,0,0,.8);background:rgba(255,255,255,.53);border-radius:5px;padding:1px 6px;font-weight:700}.onboard-step{background:#f7f2f1;border:1px solid #ecdede;margin:15px;padding:20px 30px;background-color:#fff;border-radius:10px;box-shadow:0 16px 22px rgba(0,0,0,.1);flex:1;opacity:0;animation:onboard-step-show .6s ease forwards;animation-delay:.1s}.onboard-step:nth-child(2){animation-delay:.2s}.onboard-step:nth-child(3){animation-delay:.4s}.onboard-step__icon{fill:#fff2ed;stroke-width:.5px;stroke:#e79f80;width:80px;height:80px}@keyframes onboard-step-show{from{transform:translateY(10px);opacity:0}to{transform:translateY(0);opacity:1}}.autocomplete-dropdown{border-top-left-radius:0;border-top-right-radius:0;right:0;max-height:200px;overflow-y:auto;border:1px solid rgba(0,0,0,.5);z-index:2001}.autocomplete__loader{position:absolute;right:3px;bottom:1px}@keyframes wobble{from{transform:none}15%{transform:translate3d(-25%,0,0) rotate3d(0,0,1,-5deg)}30%{transform:translate3d(20%,0,0) rotate3d(0,0,1,3deg)}45%{transform:translate3d(-15%,0,0) rotate3d(0,0,1,-3deg)}60%{transform:translate3d(10%,0,0) rotate3d(0,0,1,2deg)}75%{transform:translate3d(-5%,0,0) rotate3d(0,0,1,-1deg)}to{transform:none}}.animated{animation-duration:1s;animation-fill-mode:both}.wobble{animation-name:wobble}.console{background:var(--color-bg);z-index:6;position:absolute;bottom:0;min-height:80px;height:35vh;left:0;right:0;display:flex;flex-direction:column;transform:translateY(0);transition:transform .4s cubic-bezier(.76,.01,.13,.9)}.console.is-minimized{transform:translateY(calc(100% - 29px))}.console .CodeMirror{height:calc(100% - 30px)}.console__log{flex:1}.console-exec-input{padding:5px;font-size:1.3em;flex:1;background:rgba(0,0,0,.3);color:#fff;border:0;outline:0}.console:not(.is-minimized) .code-wrap__header{cursor:ns-resize}.global-console-container{display:none;position:relative;height:35px}.is-detached-mode .console,.is-detached-mode .footer{z-index:4}.is-detached-mode .global-console-container{display:block}.kbd-shortcut__keys{background:rgba(0,0,0,.1);border-radius:3px;padding:3px 8px;margin-right:5px;display:inline-block;font-size:.9rem;font-weight:700}.kbd-shortcut__details{display:inline-block}.web-maker-with-tag{position:relative;display:inline-block}.is-extension .web-maker-with-tag:after{display:none}.social-login-btn--github{color:#fff;background:#656b6f;border-color:#656b6f}.social-login-btn--facebook{color:#fff;background:#4e62c0;border-color:#4e62c0}.social-login-btn--google{background:#fff;border:2px solid currentColor;color:inherit}body.is-logged-in .hide-on-login,body:not(.is-app) .show-when-app,body:not(.is-extension) .show-when-extension,body:not(.is-logged-in) .hide-on-logout{display:none}.onboard-selection{padding:10px;margin:0 40px;border-radius:5px;transition:.25s ease;position:relative;border:1px solid transparent}.onboard-selection:hover{cursor:pointer;transform:scale(1.15)}.onboard-selection.selected:after{content:'';position:absolute;right:-20px;bottom:40px;width:80px;height:80px;border-radius:50%;background:#fff url('data:image/svg+xml;charset=UTF-8,')}.bookmarklet{display:inline-flex;align-items:center;border:1px #aaa solid;padding:0 5px;border-style:dashed;color:#333}.help-text{font-size:.9em;color:#616465}.social-login-btn:after,.social-login-btn:before,.social-login-btn:hover:after,.social-login-btn:hover:before{visibility:hidden}.last-login-github .social-login-btn--github:after,.last-login-github .social-login-btn--github:before{visibility:visible}.last-login-facebook .social-login-btn--facebook:after,.last-login-facebook .social-login-btn--facebook:before{visibility:visible}.last-login-google .social-login-btn--google:after,.last-login-google .social-login-btn--google:before{visibility:visible}@media screen and (max-width:500px){body{font-size:70%}.main-header{overflow-x:auto}.main-header__btn-wrap{flex-shrink:0}.modal__content{padding:1em}.saved-items-pane{width:77vw;padding:10px 20px}}.cm-s-paraiso-dark.CodeMirror{background:#2f1e2e;color:#b9b6b0}.cm-s-paraiso-dark .CodeMirror-gutters{background:#2f1e2e;border-right:0}.cm-s-paraiso-dark .CodeMirror-activeline-background{background:#4d344a}.cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0}.cm-s-monokai .CodeMirror-activeline-background{background:#373831}.cm-s-3024-day.CodeMirror{background:#f7f7f7;color:#3a3432}.cm-s-3024-day .CodeMirror-gutters{background:#f7f7f7;border-right:0}.cm-s-3024-day .CodeMirror-activeline-background{background:#e8f2ff}.cm-s-material.CodeMirror{background-color:#263238;color:rgba(233,237,237,1)}.cm-s-material .CodeMirror-gutters{background:#263238;color:#537f7e}.cm-s-material .CodeMirror-activeline-background{background:rgba(0,0,0,0)}.cm-s-dracula .CodeMirror-gutters,.cm-s-dracula.CodeMirror{background-color:#282a36!important;color:#f8f8f2!important}.cm-s-dracula .CodeMirror-activeline-background{background:rgba(255,255,255,.1)}.cm-s-blackboard.CodeMirror{background:#0c1021;color:#f8f8f8}.cm-s-blackboard .CodeMirror-gutters{background:#0c1021;border-right:0}.cm-s-blackboard .CodeMirror-activeline-background{background:#3c3636}.cm-s-midnight.CodeMirror{background:#0f192a;color:#d1edff}.cm-s-midnight .CodeMirror-gutters{background:#0f192a;border-right:1px solid}.cm-s-midnight .CodeMirror-activeline-background{background:#253540} \ No newline at end of file diff --git a/app/vendor.js b/app/vendor.js index 9fd869c..abd701b 100644 --- a/app/vendor.js +++ b/app/vendor.js @@ -1 +1,55834 @@ -(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.CodeMirror=t()})(this,function(){'use strict';function e(e){return new RegExp('(^|\\s)'+e+'(?:$|\\s)\\s*')}function t(t){for(var e=t.childNodes.length;0n||n>=t)return i+(t-s);i+=n-s,i+=o-i%o,s=n+1}}function h(e,t){for(var n=0;n=t)return o+vi(i,t-r);if(r+=a-o,r+=n-r%n,o=a+1,r>=t)return o}}function g(e){for(;Zi.length<=e;)Zi.push(f(Zi)+' ');return Zi[e]}function f(e){return e[e.length-1]}function y(e,t){for(var n=[],o=0;on?0n?-1:1;;){if(t==n)return t;var r=(t+n)/2,a=0>o?bi(r):yi(r);if(a==t)return e(a)?t:n;e(a)?n=a:t=a+o}}function I(e,t,n){var a=this;this.input=n,a.scrollbarFiller=o('div',null,'CodeMirror-scrollbar-filler'),a.scrollbarFiller.setAttribute('cm-not-content','true'),a.gutterFiller=o('div',null,'CodeMirror-gutter-filler'),a.gutterFiller.setAttribute('cm-not-content','true'),a.lineDiv=r('div',null,'CodeMirror-code'),a.selectionDiv=o('div',null,null,'position: relative; z-index: 1'),a.cursorDiv=o('div',null,'CodeMirror-cursors'),a.measure=o('div',null,'CodeMirror-measure'),a.lineMeasure=o('div',null,'CodeMirror-measure'),a.lineSpace=r('div',[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,'position: relative; outline: none');var i=r('div',[a.lineSpace],'CodeMirror-lines');a.mover=o('div',[i],null,'position: relative'),a.sizer=o('div',[a.mover],'CodeMirror-sizer'),a.sizerWidth=null,a.heightForcer=o('div',null,null,'position: absolute; height: '+Xi+'px; width: 1px;'),a.gutters=o('div',null,'CodeMirror-gutters'),a.lineGutter=null,a.scroller=o('div',[a.sizer,a.heightForcer,a.gutters],'CodeMirror-scroll'),a.scroller.setAttribute('tabIndex','-1'),a.wrapper=o('div',[a.scrollbarFiller,a.gutterFiller,a.scroller],'CodeMirror'),wi&&8>Ii&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),Ni||Si&&Fi||(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,n.init(a)}function N(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error('There is no line '+(t+e.first)+' in the document.');for(var n=e;!n.lines;)for(var o=0;;++o){var r=n.children[o],a=r.chunkSize();if(t=e.first&&tF(e,t)?t:e}function W(e,t){return 0>F(e,t)?e:t}function H(e,t){return fi(e.first,vi(t,e.first+e.size-1))}function q(e,t){if(t.linen?M(n,N(e,n).text.length):j(t,N(e,t.line).text.length)}function j(e,t){var n=e.ch;return null==n||n>t?M(e.line,t):0>n?M(e.line,0):e}function z(e,t){for(var n=[],o=0;o=t:a.to>t);(o||(o=[])).push(new X(i,a.from,d?null:a.to))}}return o}function Z(e,t,n){var o;if(e)for(var r=0;r=t:a.to>t);if(s||a.from==t&&'bookmark'==i.type&&(!n||a.marker.insertLeft)){var d=null==a.from||(i.inclusiveLeft?a.from<=t:a.fromF(l.to,s.from)||0c)&&(i.inclusiveLeft||c)||p.push({from:l.from,to:s.from}),!(0de(o,r.marker))&&(o=r.marker);return o}function pe(e){return le(e,!0)}function ce(e){return le(e,!1)}function ue(e,t,n,o,r){var a=N(e,t),s=os&&a.markedSpans;if(s)for(var d=0,i;d=c||0>=p&&0<=c)&&(0>=p&&(i.marker.inclusiveRight&&r.inclusiveLeft?0<=F(l.to,n):0=F(l.from,o):0>F(l.from,o))))return!0}}function he(e){for(var t;t=pe(e);)e=t.find(-1,!0).line;return e}function me(e){for(var t;t=ce(e);)e=t.find(1,!0).line;return e}function ge(e){for(var t,n;t=ce(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function fe(e,t){var n=N(e,t),o=he(n);return n==o?t:O(o)}function ye(e,t){if(t>e.lastLine())return t;var n=N(e,t),o;if(!be(e,n))return t;for(;o=ce(n);)n=o.find(1,!0).line;return O(n)+1}function be(e,t){var n=os&&t.markedSpans;if(n)for(var o=void 0,r=0;rt.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function Ee(e,t,n,o){if(!e)return o(t,n,'ltr',0);for(var r=!1,a=0,i;at||t==n&&i.to==t)&&(o(fi(i.from,t),vi(i.to,n),1==i.level?'rtl':'ltr',a),r=!0);r||o(t,n,'ltr')}function ke(e,t,n){var o;rs=null;for(var r=0,a;rt)return r;a.to==t&&(a.from!=a.to&&'before'==n?o=r:rs=r),a.from==t&&(a.from!=a.to&&'before'!=n?o=r:rs=r)}return null==o?rs:o}function Te(e,t){var n=e.order;return null==n&&(n=e.order=as(e.text,t)),n}function we(e,t){return e._handlers&&e._handlers[t]||is}function Ie(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent('on'+t,n);else{var o=e._handlers,r=o&&o[t];if(r){var a=h(r,n);-1=t.offsetWidth&&2Ii))}var r=fs?o('span','\u200B'):o('span','\xA0',null,'display: inline-block; width: 1px; margin-right: -1px');return r.setAttribute('cm-text',''),r}function Ve(e){if(null!=ys)return ys;var o=n(e,document.createTextNode('A\u062EA')),r=zi(o,0,1).getBoundingClientRect(),a=zi(o,1,2).getBoundingClientRect();return t(e),r&&r.left!=r.right&&(ys=3>a.right-r.right)}function We(e){if(null!=cs)return cs;var t=n(e,o('span','x')),r=t.getBoundingClientRect(),a=zi(t,0,1).getBoundingClientRect();return cs=1e&&a.splice(l,1,e,a[l+1],r),l+=2,i=vi(e,r);if(t)if(o.opaque)a.splice(n,l-n,e,'overlay '+t),l=n+2;else for(;ne.options.maxHighlightLength&&Ke(e.doc.mode,o.state),a=Qe(e,t,o);r&&(o.state=r),t.stateAfter=o.save(!r),t.styles=a.styles,a.classes?t.styleClasses=a.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=fi(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Je(e,t,n){var o=e.doc,r=e.display;if(!o.mode.startState)return new vs(o,!0,t);var a=rt(e,t,n),i=a>o.first&&N(o,a-1).stateAfter,s=i?vs.fromSaved(o,i,a):new vs(o,Xe(o.mode),a);return o.iter(a,t,function(n){$e(e,n.text,s);var o=s.line;n.stateAfter=o==t-1||0==o%5||o>=r.viewFrom&&or;r++){o&&(o[0]=Ge(e,n).mode);var a=e.token(t,n);if(t.pos>t.start)return a}throw new Error('Mode '+e.name+' failed to advance stream.')}function tt(e,t,n,o){var r=e.doc,a=r.mode,i;t=q(r,t);var s=N(r,t.line),d=Je(e,t.line,n),l=new gs(s.text,e.options.tabSize,d),p;for(o&&(p=[]);(o||l.pose.options.maxHighlightLength?(s=!1,i&&$e(e,t,o,p.pos),p.pos=t.length,u=null):u=nt(et(n,p,o.state,c),a),c){var h=c[0].name;h&&(u='m-'+(u?h+' '+u:h))}if(!s||l!=u){for(;dr;--a){if(a<=o.first)return o.first;var d=N(o,a-1),l=d.stateAfter;if(l&&(!n||a+(l instanceof bs?l.lookAhead:0)<=o.modeFrontier))return a;var p=u(d.text,null,e.options.tabSize);(null==s||i>p)&&(s=a-1,i=p)}return s}function at(e,t){if(e.modeFrontier=vi(e.modeFrontier,t),!(e.highlightFrontiern;o--)if(r=N(e,o).stateAfter,r&&(!(r instanceof bs)||o+r.lookAheadIi&&(p=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var u=0;;){l.lastIndex=u;var h=l.exec(t),f=h?h.index-u:t.length-u;if(f){var y=document.createTextNode(d.slice(u,u+f));wi&&9>Ii?c.appendChild(o('span',[y])):c.appendChild(y),e.map.push(e.pos,e.pos+f,y),e.col+=f,e.pos+=f}if(!h)break;u+=f+1;var b=void 0;if('\t'==h[0]){var v=e.cm.options.tabSize,x=v-e.col%v;b=c.appendChild(o('span',g(x),'cm-tab')),b.setAttribute('role','presentation'),b.setAttribute('cm-text','\t'),e.col+=x}else'\r'==h[0]||'\n'==h[0]?(b=c.appendChild(o('span','\r'==h[0]?'\u240D':'\u2424','cm-invalidchar')),b.setAttribute('cm-text',h[0]),e.col+=1):(b=e.cm.options.specialCharPlaceholder(h[0]),b.setAttribute('cm-text',h[0]),wi&&9>Ii?c.appendChild(o('span',[b])):c.appendChild(b),e.col+=1);e.map.push(e.pos,e.pos+1,b),e.pos++}}if(e.trailingSpace=32==d.charCodeAt(t.length-1),n||r||a||p||s){var C=n||'';r&&(C+=r),a&&(C+=a);var S=o('span',[c],C,s);return i&&(S.title=i),e.content.appendChild(S)}e.content.appendChild(c)}}function ut(e,t){if(1p&&u.from<=p));h++);if(u.to>=c)return e(n,o,r,a,s,d,l);e(n,o.slice(0,u.to-p),r,a,null,d,l),a=null,o=o.slice(u.to-p),p=u.to}}}function mt(e,t,n,o){var r=!o&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!o&&e.cm.display.input.needsContentAttribute&&(!r&&(r=e.content.appendChild(document.createElement('span'))),r.setAttribute('cm-marker',n.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function gt(e,t,n){var o=e.markedSpans,r=e.text,a=0;if(!o){for(var s=1;sl||k.collapsed&&E.to==l&&E.from==l)?(null!=E.to&&E.to!=l&&c>E.to&&(c=E.to,f=''),k.className&&(g+=' '+k.className),k.css&&(h=(h?h+';':'')+k.css),k.startStyle&&E.from==l&&(y+=' '+k.startStyle),k.endStyle&&E.to==c&&(C||(C=[])).push(k.endStyle,E.to),k.title&&!b&&(b=k.title),k.collapsed&&(!v||0>de(v.marker,k))&&(v=E)):E.from>l&&c>E.from&&(c=E.from)}if(C)for(var m=0;m=d)break;for(var w=vi(d,c);;){if(i){var I=l+i.length;if(!v){var N=I>w?i.slice(0,w-l):i;t.addToken(t,N,u?u+g:g,y,l+N.length==c?f:'',b,h)}if(I>=w){i=i.slice(w-l),l=w;break}l=I,y=''}i=r.slice(a,a=n[p++]),u=dt(n[p++],t.cm.options)}}}function ft(e,t,n){this.line=t,this.rest=ge(t),this.size=this.rest?O(f(this.rest))-n+1:1,this.node=this.text=null,this.hidden=be(e,t)}function yt(e,t,n){for(var o=[],r=t,a,i;rIi&&(e.node.style.zIndex=2)),e.node}function Tt(e,t){var n=t.bgClass?t.bgClass+' '+(t.line.bgClass||''):t.line.bgClass;if(n&&(n+=' CodeMirror-linebackground'),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=kt(t);t.background=r.insertBefore(o('div',null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function wt(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):lt(e,t)}function It(e,t){var n=t.text.className,o=wt(e,t);t.text==t.node&&(t.node=o.pre),t.text.parentNode.replaceChild(o.pre,t.text),t.text=o.pre,o.bgClass!=t.bgClass||o.textClass!=t.textClass?(t.bgClass=o.bgClass,t.textClass=o.textClass,Nt(e,t)):n&&(t.text.className=n)}function Nt(e,t){Tt(e,t),t.line.wrapClass?kt(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className='');var n=t.textClass?t.textClass+' '+(t.line.textClass||''):t.line.textClass;t.text.className=n||''}function At(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var a=kt(t);t.gutterBackground=o('div',null,'CodeMirror-gutter-background '+t.line.gutterClass,'left: '+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+'px; width: '+r.gutterTotalWidth+'px'),e.display.input.setUneditable(t.gutterBackground),a.insertBefore(t.gutterBackground,t.text)}var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var s=kt(t),d=t.gutter=o('div',null,'CodeMirror-gutter-wrapper','left: '+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+'px');if(e.display.input.setUneditable(d),s.insertBefore(d,t.text),t.line.gutterClass&&(d.className+=' '+t.line.gutterClass),!e.options.lineNumbers||i&&i['CodeMirror-linenumbers']||(t.lineNumber=d.appendChild(o('div',_(e.options,n),'CodeMirror-linenumber CodeMirror-gutter-elt','left: '+r.gutterLeft['CodeMirror-linenumbers']+'px; width: '+e.display.lineNumInnerWidth+'px'))),i)for(var l=0;ln)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function zt(e,t){t=he(t);var o=O(t),r=e.display.externalMeasured=new ft(e.doc,t,o);r.lineN=o;var a=r.built=lt(e,r);return r.text=a.pre,n(e.display.lineMeasure,a.pre),r}function Kt(e,t,n,o){return Qt(e,Xt(e,t),n,o)}function Gt(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(i=l-d,a=i-1,t>=l&&(s='right')),null!=a){if(r=e[o+2],d==l&&n==(r.insertLeft?'left':'right')&&(s=n),'left'==n&&0==a)for(;o&&e[o-2]==e[o-3]&&e[o-1].insertLeft;)r=e[(o-=3)+2],s='left';if('right'==n&&a==l-d)for(;oc;c++){for(;s&&k(t.line.text.charAt(r.coverStart+s));)--s;for(;r.coverStart+dIi&&0==s&&d==r.coverEnd-r.coverStart?a.parentNode.getBoundingClientRect():Jt(zi(a,s,d).getClientRects(),o),p.left||p.right||0==s)break;d=s,--s,l='right'}wi&&11>Ii&&(p=Zt(e.display.measure,p))}else{0Ii&&!s&&(!p||!p.left&&!p.right)){var h=a.parentNode.getClientRects()[0];p=h?{left:h.left,right:h.left+Sn(e.display),top:h.top,bottom:h.bottom}:ws}for(var m=p.top-t.rect.top,g=p.bottom-t.rect.top,f=t.view.measure.heights,y=0;y=o.text.length?(l=o.text.length,p='before'):0>=l&&(l=0,p='after'),!d)return i('before'==p?l-1:l,'before'==p);var c=ke(d,l,p),u=rs,h=s(l,c,'before'==p);return null!=u&&(h.other=s(l,u,'before'!=p)),h}function un(e,t){var n=0;t=q(e.doc,t),e.options.lineWrapping||(n=Sn(e.display)*t.ch);var o=N(e.doc,t.line),r=xe(o)+Ft(e.display);return{left:n,right:n,top:r,bottom:r+o.height}}function hn(e,t,n,o,r){var a=M(e,t,n);return a.xRel=r,o&&(a.outside=!0),a}function mn(e,t,n){var o=e.doc;if(n+=e.display.viewOffset,0>n)return hn(o.first,0,null,!0,-1);var r=P(o,n),a=o.first+o.size-1;if(r>a)return hn(o.first+o.size-1,N(o,a).text.length,null,!0,1);0>t&&(t=0);for(var i=N(o,r);;){var s=bn(e,i,r,t,n),d=ce(i),l=d&&d.find(0,!0);if(d&&(s.ch>l.from.ch||s.ch==l.from.ch&&0o},a,r),{begin:a,end:r}}function fn(e,t,n,o){n||(n=Xt(e,t));var r=dn(e,t,Qt(e,n,o),'line').top;return gn(e,t,n,r)}function yn(e,t,n,o){return!(e.bottom<=n)&&(!!(e.top>n)||(o?e.left:e.right)>t)}function bn(e,t,n,o,r){r-=xe(t);var a=Xt(e,t),i=sn(t),s=0,d=t.text.length,l=!0,p=Te(t,e.doc.direction);if(p){var c=(e.options.lineWrapping?xn:vn)(e,t,n,a,p,o,r);l=1!=c.level,s=l?c.from:c.to-1,d=l?c.to:c.from-1}var u=null,h=null,m=w(function(t){var n=Qt(e,a,t);return(n.top+=i,n.bottom+=i,!!yn(n,o,r,!1))&&(n.top<=r&&n.left<=o&&(u=t,h=n),!0)},s,d),g=!1,f,y;if(h){var b=o-h.left=x.bottom}return m=T(t.text,m,1),hn(n,m,y,g,o-f)}function vn(e,t,n,o,r,a,s){var i=w(function(d){var i=r[d],l=1!=i.level;return yn(cn(e,M(n,l?i.to:i.from,l?'before':'after'),'line',t,o),a,s,!0)},0,r.length-1),d=r[i];if(0s&&(d=r[i-1])}return d}function xn(e,t,n,o,r,a,s){var d=gn(e,t,o,s),l=d.begin,c=d.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,h=null,m=0,i;m=c||i.to<=l)){var p=1!=i.level,g=Qt(e,o,p?vi(c,i.to)-1:fi(l,i.from)).right,f=gf)&&(u=i,h=f)}return u||(u=r[r.length-1]),u.fromc&&(u={from:u.from,to:c,level:u.level}),u}function Cn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ns){Ns=o('pre');for(var r=0;49>r;++r)Ns.appendChild(document.createTextNode('x')),Ns.appendChild(o('br'));Ns.appendChild(document.createTextNode('x'))}n(e.measure,Ns);var a=Ns.offsetHeight/50;return 3=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var n=e.display.view,o=0;ot)return o}function An(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ln(e,t){void 0===t&&(t=!0);for(var n=e.doc,o={},r=o.cursors=document.createDocumentFragment(),a=o.selection=document.createDocumentFragment(),s=0;s=e.display.viewTo||i.to().linet&&(t=0),t=mi(t),r=mi(r),d.appendChild(o('div',null,'CodeMirror-selected','position: absolute; left: '+e+'px;\n top: '+t+'px; width: '+(null==n?c-e:n)+'px;\n height: '+(r-t)+'px'))}function a(t,n,o){function a(n,o){return pn(e,M(t,n),'div',d,o)}function i(t,n,o){var r=fn(e,d,null,t),i='ltr'==n==('after'==o)?'left':'right',s='after'==o?r.begin:r.end-(/\s/.test(d.text.charAt(r.end-1))?2:1);return a(s,i)[i]}var d=N(s,t),l=d.text.length,h=Te(d,s.direction),m,g;return Ee(h,n||0,null==o?l:o,function(e,t,s,d){var f='ltr'==s,y=a(e,f?'left':'right'),b=a(t-1,f?'right':'left'),v=null==n&&0==e,x=null==o&&t==l,C=0==d,S=!h||d==h.length-1;if(3>=b.top-y.top){var E=(u?v:x)&&C,k=(u?x:v)&&S,T=E?p:(f?y:b).left,w=k?c:(f?b:y).right;r(T,y.top,w-T,y.bottom)}else{var I,N,A,L;f?(I=u&&v&&C?p:y.left,N=u?c:i(e,s,'before'),A=u?p:i(t,s,'after'),L=u&&x&&S?c:b.right):(I=u?i(e,s,'before'):p,N=!u&&v&&C?c:y.right,A=!u&&x&&S?p:b.left,L=u?i(t,s,'after'):c),r(I,y.top,N-I,y.bottom),y.bottomOn(y,m))&&(m=y),0>On(b,m)&&(m=b),(!g||0>On(y,g))&&(g=y),0>On(b,g)&&(g=b)}),{start:m,end:g}}var i=e.display,s=e.doc,d=document.createDocumentFragment(),l=Ut(e.display),p=l.left,c=fi(i.sizerWidth,Wt(e)-i.sizer.offsetLeft)-l.right,u='ltr'==s.direction,h=t.from(),m=t.to();if(h.line==m.line)a(h.line,h.ch,m.ch);else{var g=N(s,h.line),f=N(s,m.line),y=he(g)==he(f),b=a(h.line,h.ch,y?g.text.length+1:null).end,v=a(m.line,y?0:null,m.ch).start;y&&(b.tope.options.cursorBlinkRate&&(t.cursorDiv.style.visibility='hidden')}}function _n(e){e.state.focused||(e.display.input.focus(),Fn(e))}function Mn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Bn(e))},100)}function Fn(t,n){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),'nocursor'==t.options.readOnly||(!t.state.focused&&(Ne(t,'focus',t,n),t.state.focused=!0,d(t.display.wrapper,'CodeMirror-focused'),!t.curOp&&t.display.selForContextMenu!=t.doc.sel&&(t.display.input.reset(),Ni&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Dn(t))}function Bn(t,n){t.state.delayingBlurEvent||(t.state.focused&&(Ne(t,'blur',t,n),t.state.focused=!1,ji(t.display.wrapper,'CodeMirror-focused')),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function Un(e){for(var t=e.display,n=t.lineDiv.offsetTop,o=0;oIi){var i=r.node.offsetTop+r.node.offsetHeight;a=i-n,n=i}else{var s=r.node.getBoundingClientRect();a=s.bottom-s.top}var d=r.line.height-a;if(2>a&&(a=Cn(t)),(.005d)&&(R(r.line,a),Vn(r.line),r.rest))for(var l=0;l=i&&(a=P(t,xe(N(t,d))-e.wrapper.clientHeight),i=d)}return{from:a,to:fi(i,a+1)}}function Hn(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var o=kn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,a=o+'px',s=0;st.top+r.top?a=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),null!=a&&!Di){var i=o('div','\u200B',null,'position: absolute;\n top: '+(t.top-n.viewOffset-Ft(e.display))+'px;\n height: '+(t.bottom-t.top+Vt(e)+n.barHeight)+'px;\n left: '+t.left+'px; width: '+fi(2,t.right-t.left)+'px;');e.display.lineSpace.appendChild(i),i.scrollIntoView(a),e.display.lineSpace.removeChild(i)}}}function zn(e,t,n,o){null==o&&(o=0);var r;e.options.lineWrapping||t!=n||(t=t.ch?M(t.line,'before'==t.sticky?t.ch-1:t.ch,'after'):t,n='before'==t.sticky?M(t.line,t.ch+1,'before'):t);for(var a=0;5>a;a++){var i=!1,s=cn(e,t),d=n&&n!=t?cn(e,n):s;r={left:vi(s.left,d.left),top:vi(s.top,d.top)-o,right:fi(s.left,d.left),bottom:fi(s.bottom,d.bottom)+o};var l=Gn(e,r),p=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=l.scrollTop&&(eo(e,l.scrollTop),1t.top&&(t.top=0);var r=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,a=Ht(e),i={};t.bottom-t.top>a&&(t.bottom=t.top+a);var s=e.doc.height+Bt(n),d=t.tops-o;if(t.topr+a){var p=vi(t.top,(l?s:t.bottom)-a);p!=r&&(i.scrollTop=p)}var c=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,u=Wt(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),h=t.right-t.left>u;return h&&(t.right=t.left+u),10>t.left?i.scrollLeft=0:t.leftu+c-3&&(i.scrollLeft=t.right+(h?0:10)-u),i}function Xn(e,t){null==t||($n(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Qn(e){$n(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Yn(e,t,n){(null!=t||null!=n)&&$n(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Jn(e,t){$n(e),e.curOp.scrollToPos=t}function $n(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=un(e,t.from),o=un(e,t.to);Zn(e,n,o,t.margin)}}function Zn(e,t,n,o){var r=Gn(e,{left:vi(t.left,n.left),top:vi(t.top,n.top)-o,right:fi(t.right,n.right),bottom:fi(t.bottom,n.bottom)+o});Yn(e,r.scrollLeft,r.scrollTop)}function eo(e,t){2>gi(e.doc.scrollTop-t)||(!Si&&Po(e,{top:t}),to(e,t,!0),Si&&Po(e),wo(e,100))}function to(e,t,n){t=vi(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function no(e,t,n,o){t=vi(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:2>gi(e.doc.scrollLeft-t))&&!o||(e.doc.scrollLeft=t,Hn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function oo(e){var t=e.display,n=t.gutters.offsetWidth,o=mi(e.doc.height+Bt(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:o,scrollHeight:o+Vt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function ro(e,t){t||(t=oo(e));var n=e.display.barWidth,o=e.display.barHeight;ao(e,t);for(var r=0;4>r&&n!=e.display.barWidth||o!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&Un(e),ao(e,oo(e)),n=e.display.barWidth,o=e.display.barHeight}function ao(e,t){var n=e.display,o=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=o.right)+'px',n.sizer.style.paddingBottom=(n.barHeight=o.bottom)+'px',n.heightForcer.style.borderBottom=o.bottom+'px solid transparent',o.right&&o.bottom?(n.scrollbarFiller.style.display='block',n.scrollbarFiller.style.height=o.bottom+'px',n.scrollbarFiller.style.width=o.right+'px'):n.scrollbarFiller.style.display='',o.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display='block',n.gutterFiller.style.height=o.bottom+'px',n.gutterFiller.style.width=t.gutterWidth+'px'):n.gutterFiller.style.display=''}function io(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ji(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ls[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ss(t,'mousedown',function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute('cm-not-content','true')},function(t,n){'horizontal'==n?no(e,t):eo(e,t)},e),e.display.scrollbars.addClass&&d(e.display.wrapper,e.display.scrollbars.addClass)}function so(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Rs},bt(e.curOp)}function lo(e){var t=e.curOp;xt(t,function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Os(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function uo(e){e.updatedDisplay=e.mustUpdate&&Ro(e.cm,e.update)}function ho(e){var t=e.cm,n=t.display;e.updatedDisplay&&Un(t),e.barMeasure=oo(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Kt(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=fi(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Vt(t)+t.display.barWidth),e.maxScrollLeft=fi(0,n.sizer.offsetLeft+e.adjustWidthTo-Wt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function mo(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+'px',e.maxScrollLeftt)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)os&&fe(e.doc,t)r.viewFrom?So(e):(r.viewFrom+=o,r.viewTo+=o);else if(t<=r.viewFrom&&n>=r.viewTo)So(e);else if(t<=r.viewFrom){var a=Eo(e,n,n+o,1);a?(r.view=r.view.slice(a.index),r.viewFrom=a.lineN,r.viewTo+=o):So(e)}else if(n>=r.viewTo){var i=Eo(e,t,t,-1);i?(r.view=r.view.slice(0,i.index),r.viewTo=i.lineN):So(e)}else{var s=Eo(e,t,t,-1),d=Eo(e,n,n+o,1);s&&d?(r.view=r.view.slice(0,s.index).concat(yt(e,s.lineN,d.lineN)).concat(r.view.slice(d.index)),r.viewTo+=o):So(e)}var l=r.externalMeasured;l&&(n=r.lineN&&t=o.viewTo)){var a=o.view[Nn(e,t)];if(null!=a.node){var i=a.changes||(a.changes=[]);-1==h(i,n)&&i.push(n)}}}function So(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Eo(e,t,o,r){var a=Nn(e,t),s=e.display.view,d;if(!os||o==e.doc.first+e.doc.size)return{index:a,lineN:o};for(var l=e.display.viewFrom,n=0;nr?0:s.length-1))return null;o+=r*s[a-(0>r?1:0)].size,a+=r}return{index:a,lineN:o}}function ko(e,t,n){var o=e.display,r=o.view;0==r.length||t>=o.viewTo||n<=o.viewFrom?(o.view=yt(e,t,n),o.viewFrom=t):(o.viewFrom>t?o.view=yt(e,t,o.viewFrom).concat(o.view):o.viewFromn&&(o.view=o.view.slice(0,Nn(e,n)))),o.viewTo=n}function To(e){for(var t=e.display.view,n=0,o=0,r;o=e.display.viewTo)){var n=+new Date+e.options.workTime,o=Je(e,t.highlightFrontier),r=[];t.iter(o.line,vi(t.first+t.size,e.display.viewTo+500),function(a){if(o.line>=e.display.viewFrom){var s=a.styles,d=a.text.length>e.options.maxHighlightLength?Ke(t.mode,o.state):null,l=Qe(e,a,o,!0);d&&(o.state=d),a.styles=l.styles;var p=a.styleClasses,c=l.classes;c?a.styleClasses=c:p&&(a.styleClasses=null);for(var u=!s||s.length!=a.styles.length||p!=c&&(!p||!c||p.bgClass!=c.bgClass||p.textClass!=c.textClass),h=0;!u&&hn?(wo(e,e.options.workDelay),!0):void 0}),t.highlightFrontier=o.line,t.modeFrontier=fi(t.modeFrontier,o.line),r.length&&fo(e,function(){for(var t=0;t=o.viewFrom&&n.visible.to<=o.viewTo&&(null==o.updateLineNumbers||o.updateLineNumbers>=o.viewTo)&&o.renderedView==o.view&&0==To(e))return!1;qn(e)&&(So(e),n.dims=En(e));var a=r.first+r.size,i=fi(n.visible.from-e.options.viewportMargin,r.first),s=vi(a,n.visible.to+e.options.viewportMargin);o.viewFromi-o.viewFrom&&(i=fi(r.first,o.viewFrom)),o.viewTo>s&&20>o.viewTo-s&&(s=vi(a,o.viewTo)),os&&(i=fe(e.doc,i),s=ye(e.doc,s));var d=i!=o.viewFrom||s!=o.viewTo||o.lastWrapHeight!=n.wrapperHeight||o.lastWrapWidth!=n.wrapperWidth;ko(e,i,s),o.viewOffset=xe(N(e.doc,o.viewFrom)),e.display.mover.style.top=o.viewOffset+'px';var l=To(e);if(!d&&0==l&&!n.force&&o.renderedView==o.view&&(null==o.updateLineNumbers||o.updateLineNumbers>=o.viewTo))return!1;var p=Ao(e);return 4=e.display.viewFrom&&t.visible.to<=e.display.viewTo))break;if(!Ro(e,t))break;Un(e);var r=oo(e);An(e),ro(e,r),Mo(e,r),t.force=!1}t.signal(e,'update',e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,'viewportChange',e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Po(e,t){var n=new Os(e,t);if(Ro(e,n)){Un(e),Oo(e,n);var o=oo(e);An(e),ro(e,o),Mo(e,o),n.finish()}}function Do(e,n,o){function r(t){var n=t.nextSibling;return Ni&&Bi&&e.display.currentWheelTarget==t?t.style.display='none':t.parentNode.removeChild(t),n}for(var a=e.display,s=e.options.lineNumbers,d=a.lineDiv,l=d.firstChild,p=a.view,c=a.viewFrom,u=0,i;us.clientWidth,l=s.scrollHeight>s.clientHeight;if(o&&d||r&&l){if(r&&Bi&&Ni)outer:for(var p=n.target,c=a.view;p!=s;p=p.parentNode)for(var u=0;ui?h=fi(0,h+i-50):m=vi(t.doc.height,m+i+50),Po(t,{top:h,bottom:m})}20>Ps&&(null==a.wheelStartX?(a.wheelStartX=s.scrollLeft,a.wheelStartY=s.scrollTop,a.wheelDX=o,a.wheelDY=r,setTimeout(function(){if(null!=a.wheelStartX){var e=s.scrollLeft-a.wheelStartX,t=s.scrollTop-a.wheelStartY,n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null,n&&(Ds=(Ds*Ps+n)/(Ps+1),++Ps)}},200)):(a.wheelDX+=o,a.wheelDY+=r))}}function Ho(e,t){var n=e[t];e.sort(function(e,t){return F(e.from(),t.from())}),t=h(e,n);for(var o=1;oF(e,t.from))return e;if(0>=F(e,t.to))return jo(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,o=e.ch;return e.line==t.to.line&&(o+=jo(t).ch-t.to.ch),M(n,o)}function Ko(e,t){for(var n=[],o=0,r;oF(p.head,p.anchor);o[s]=new Ms(c?l:d,c?d:l)}else o[s]=new Ms(d,d)}return new _s(o,e.sel.primIndex)}function Qo(e){e.doc.mode=je(e.options,e.doc.modeOption),Yo(e)}function Yo(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,wo(e,100),e.state.modeGen++,e.curOp&&xo(e)}function Jo(e,t){return 0==t.from.ch&&0==t.to.ch&&''==f(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function $o(e,t,o,n){function r(e){return o?o[e]:null}function a(e,o,r){it(e,o,r,n),Ct(e,'change',e,t)}function i(e,t){for(var o=[],a=e;aa-(e.cm?e.cm.options.historyEventDelay:500)||'*'==t.origin.charAt(0)))&&(i=ir(r,r.lastOp==o)))s=f(i.changes),0==F(t.from,t.to)&&0==F(t.from,s.to)?s.to=jo(t):i.changes.push(rr(e,t));else{var d=f(r.done);for(d&&d.ranges||pr(e.sel,r.done),i={changes:[rr(e,t)],generation:r.generation},r.done.push(i);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=o,r.lastOrigin=r.lastSelOrigin=t.origin,s||Ne(e,'historyAdded')}function dr(e,t,n,o){var r=t.charAt(0);return'*'==r||'+'==r&&n.ranges.length==o.ranges.length&&n.somethingSelected()==o.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lr(e,t,n,o){var r=e.history,a=o&&o.origin;n==r.lastSelOp||a&&r.lastSelOrigin==a&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==a||dr(e,a,f(r.done),t))?r.done[r.done.length-1]=t:pr(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=a,r.lastSelOp=n,o&&!1!==o.clearRedo&&ar(r.undone)}function pr(e,t){var n=f(t);n&&n.ranges&&n.equals(e)||t.push(e)}function cr(e,t,o,r){var a=t['spans_'+e.id],i=0;e.iter(fi(e.first,o),vi(e.first+e.size,r),function(n){n.markedSpans&&((a||(a=t['spans_'+e.id]={}))[i]=n.markedSpans),++i})}function ur(e){if(!e)return null;for(var t=0,n;tF(t,r);a==0>F(n,r)?a!=0>F(t,n)&&(t=n):(r=t,t=n)}return new Ms(r,t)}return new Ms(n||t,t)}function yr(e,t,n,o,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),Er(e,new _s([fr(e.sel.primary(),t,n,r)],0),o)}function br(e,t,n){for(var o=[],r=e.cm&&(e.cm.display.shift||e.extend),a=0;aF(t.primary().head,e.sel.primary().head)?-1:1);Tr(e,Ir(e,t,o,!0)),!(n&&!1===n.scroll)&&e.cm&&Qn(e.cm)}function Tr(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Le(e.cm)),Ct(e,'cursorActivity',e))}function wr(e){Tr(e,Ir(e,e.sel,null,!1))}function Ir(e,t,n,o){for(var r=0,a;r=t.ch:i.to>t.ch))){if(r&&(Ne(d,'beforeCursorEnter'),d.explicitlyCleared))if(!a.markedSpans)break;else{--s;continue}if(!d.atomic)continue;if(n){var l=d.find(0>o?1:-1),p=void 0;if((0>o?d.inclusiveRight:d.inclusiveLeft)&&(l=Lr(e,l,-o,l&&l.line==t.line?a:null)),l&&l.line==t.line&&(p=F(l,n))&&(0>o?0>p:0o?-1:1);return(0>o?d.inclusiveLeft:d.inclusiveRight)&&(c=Lr(e,c,o,c.line==t.line?a:null)),c?Nr(e,c,t,o,r):null}}return t}function Ar(e,t,n,o,r){var a=o||1,i=Nr(e,t,n,a,r)||!r&&Nr(e,t,n,a,!0)||Nr(e,t,n,-a,r)||!r&&Nr(e,t,n,-a,!0);return i?i:(e.cantEdit=!0,M(e.first,0))}function Lr(e,t,n,o){return 0>n&&0==t.ch?t.line>e.first?q(e,M(t.line-1)):null:0e.lastLine())){if(t.from.linea&&(t={from:t.from,to:M(a,N(e,a).text.length),text:[t.text[0]],origin:t.origin}),t.removed=A(e,t.from,t.to),n||(n=Ko(e,t)),e.cm?Br(e.cm,t,o):$o(e,t,o),kr(e,n,Yi)}}function Br(e,t,n){var o=e.doc,r=e.display,a=t.from,i=t.to,s=!1,d=a.line;e.options.lineWrapping||(d=O(he(N(o,a.line))),o.iter(d,i.line+1,function(e){if(e==r.maxLine)return s=!0,!0})),-1r.maxLineLength&&(r.maxLine=e,r.maxLineLength=t,r.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),at(o,a.line),wo(e,400);var l=t.text.length-(i.line-a.line)-1;t.full?xo(e):a.line!=i.line||1!=t.text.length||Jo(e.doc,t)?xo(e,a.line,i.line+1,l):Co(e,a.line,'text');var p=Re(e,'changes'),c=Re(e,'change');if(c||p){var u={from:a,to:i,text:t.text,removed:t.removed,origin:t.origin};c&&Ct(e,'change',e,u),p&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(u)}e.display.selForContextMenu=null}function Ur(e,t,n,o,r){if(o||(o=n),0>F(o,n)){var a;a=[o,n],n=a[0],o=a[1],a}'string'==typeof t&&(t=e.splitLines(t)),Pr(e,{from:n,to:o,text:t,origin:r})}function Vr(e,t,n,o){n+new Date-qs))return void Me(n);if(!(Ae(t,n)||Mt(t.display,n))&&(n.dataTransfer.setData('Text',t.getSelection()),n.dataTransfer.effectAllowed='copyMove',n.dataTransfer.setDragImage&&!Oi)){var e=o('img',null,null,'position: fixed; left: 0; top: 0;');e.src='data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==',Ri&&(e.width=e.height=1,t.display.wrapper.appendChild(e),e._top=e.offsetTop),n.dataTransfer.setDragImage(e,0,0),Ri&&e.parentNode.removeChild(e)}}function ta(t,r){var e=In(t,r);if(e){var a=document.createDocumentFragment();Rn(t,e,a),t.display.dragCursor||(t.display.dragCursor=o('div',null,'CodeMirror-cursors CodeMirror-dragcursors'),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),n(t.display.dragCursor,a)}}function na(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function oa(e){if(document.getElementsByClassName)for(var t=document.getElementsByClassName('CodeMirror'),n=0,o;n=F(a.from,f(o).to);){var i=o.pop();if(0>F(i.from,a.from)){a.from=i.from;break}}o.push(a)}fo(e,function(){for(var t=o.length-1;0<=t;t--)Ur(e.doc,'',o[t].from,o[t].to,'+delete');Qn(e)})}function ga(e,t,n){var o=T(e.text,t+n,n);return 0>o||o>e.text.length?null:o}function fa(e,t,n){var o=ga(e,t.ch,n);return null==o?null:new M(t.line,o,0>n?'after':'before')}function ya(e,t,n,o,r){if(e){var a=Te(n,t.doc.direction);if(a){var i=0>r?f(a):a[0],s=0>r==(1==i.level),d=s?'after':'before',l;if(0r?n.text.length-1:0;var c=Qt(t,p,l).top;l=w(function(e){return Qt(t,p,e).top==c},0>r==(1==i.level)?i.from:i.to-1,l),'before'==d&&(l=ga(n,l,1))}else l=0>r?i.to:i.from;return new M(o,l,d)}}return new M(o,0>r?n.text.length:0,0>r?'before':'after')}function ba(e,t,n,o){var r=Te(t,e.doc.direction);if(!r)return fa(t,n,o);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky='before'):0>=n.ch&&(n.ch=0,n.sticky='after');var a=ke(r,n.ch,n.sticky),i=r[a];if('ltr'==e.doc.direction&&0==i.level%2&&(0n.ch:i.fromo,u=s(n,c?1:-1);if(null!=u&&(c?u<=i.to&&u<=l.end:u>=i.from&&u>=l.begin)){var h=c?'before':'after';return new M(n.line,u,h)}}var m=function(e,t,o){for(var a=function(e,t){return t?new M(n.line,s(e,1),'before'):new M(n.line,e,'after')};0<=e&&eIi&&27==t.keyCode&&(t.returnValue=!1);var n=t.keyCode;e.display.shift=16==n||t.shiftKey;var o=wa(e,t);Ri&&(Js=o?n:null,!o&&88==n&&!ps&&(Bi?t.metaKey:t.ctrlKey)&&e.replaceSelection('',null,'cut')),18!=n||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||Aa(e)}}function Aa(e){function t(o){18!=o.keyCode&&o.altKey||(ji(n,'CodeMirror-crosshair'),Ie(document,'keyup',t),Ie(document,'mouseover',t))}var n=e.display.lineDiv;d(n,'CodeMirror-crosshair'),ss(document,'keyup',t),ss(document,'mouseover',t)}function La(t){16==t.keyCode&&(this.doc.sel.shift=!1),Ae(this,t)}function Ra(t){var e=this;if(!(Mt(e.display,t)||Ae(e,t)||t.ctrlKey&&!t.altKey||Bi&&t.metaKey)){var n=t.keyCode,o=t.charCode;if(Ri&&n==Js)return Js=null,void Pe(t);if(!(Ri&&(!t.which||10>t.which)&&wa(e,t))){var r=hi(null==o?n:o);'\b'==r||Ia(e,t,r)||e.display.input.onKeyPress(t)}}}function Oa(e,t){var n=+new Date;return od&&od.compare(n,e,t)?(nd=od=null,'triple'):nd&&nd.compare(n,e,t)?(od=new $s(n,e,t),nd=null,'double'):(nd=new $s(n,e,t),od=null,'single')}function Pa(t){var e=this,n=e.display;if(!(Ae(e,t)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=t.shiftKey,Mt(n,t))return void(Ni||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100)));if(!Ha(e,t)){var o=In(e,t),r=Be(t),a=o?Oa(o,r):'single';window.focus(),1==r&&e.state.selectingText&&e.state.selectingText(t),o&&Da(e,r,o,a,t)||(1==r?o?Ma(e,o,a,t):Fe(t)==n.scroller&&Pe(t):2==r?(o&&yr(e.doc,o),setTimeout(function(){return n.input.focus()},20)):3==r&&(qi?qa(e,t):Mn(e)))}}}function Da(e,t,n,o,r){var a='Click';return'double'==o?a='Double'+a:'triple'==o&&(a='Triple'+a),a=(1==t?'Left':2==t?'Middle':'Right')+a,ka(e,ca(a,r),r,function(t){if('string'==typeof t&&(t=Qs[t]),!t)return!1;var o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),o=t(e,n)!=Qi}finally{e.state.suppressEdits=!1}return o})}function _a(e,t,n){var o=e.getOption('configureMouse'),r=o?o(e,t,n):{};if(null==r.unit){var a=Ui?n.shiftKey&&n.metaKey:n.altKey;r.unit=a?'rectangle':'single'==t?'char':'double'==t?'word':'line'}return(null==r.extend||e.doc.extend)&&(r.extend=e.doc.extend||n.shiftKey),null==r.addNew&&(r.addNew=Bi?n.metaKey:n.ctrlKey),null==r.moveOnDrag&&(r.moveOnDrag=Bi?!n.altKey:!n.ctrlKey),r}function Ma(e,t,n,o){wi?setTimeout(p(_n,e),0):e.curOp.focus=s();var r=_a(e,n,o),a=e.doc.sel,i;e.options.dragDrop&&on&&!e.isReadOnly()&&'single'==n&&-1<(i=a.contains(t))&&(0>F((i=a.ranges[i]).from(),t)||0t.xRel)?Fa(e,o,t,r):Ua(e,o,t,r)}function Fa(t,e,n,o){var r=t.display,a=!1,i=yo(t,function(l){Ni&&(r.scroller.draggable=!1),t.state.draggingText=!1,Ie(r.wrapper.ownerDocument,'mouseup',i),Ie(r.wrapper.ownerDocument,'mousemove',s),Ie(r.scroller,'dragstart',d),Ie(r.scroller,'drop',i),a||(Pe(l),!o.addNew&&yr(t.doc,n,null,null,o.extend),Ni||wi&&9==Ii?setTimeout(function(){r.wrapper.ownerDocument.body.focus(),r.input.focus()},20):r.input.focus())}),s=function(t){a=a||10<=gi(e.clientX-t.clientX)+gi(e.clientY-t.clientY)},d=function(){return a=!0};Ni&&(r.scroller.draggable=!0),t.state.draggingText=i,i.copy=!o.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),ss(r.wrapper.ownerDocument,'mouseup',i),ss(r.wrapper.ownerDocument,'mousemove',s),ss(r.scroller,'dragstart',d),ss(r.scroller,'drop',i),Mn(t),setTimeout(function(){return r.input.focus()},20)}function Ba(e,t,n){if('char'==n)return new Ms(t,t);if('word'==n)return e.findWordAt(t);if('line'==n)return new Ms(M(t.line,0),q(e.doc,M(t.line+1,0)));var o=n(e,t);return new Ms(o.from,o.to)}function Ua(t,e,n,o){function r(e){if(0!=F(y,e))if(y=e,'rectangle'==o.unit){for(var r=[],a=t.options.tabSize,i=u(N(l,n.line).text,n.ch,a),s=u(N(l,e.line).text,e.ch,a),d=vi(i,s),c=fi(i,s),f=vi(n.line,e.line),b=vi(t.lastLine(),fi(n.line,e.line));f<=b;f++){var v=N(l,f).text,x=m(v,d,a);d==c?r.push(new Ms(M(f,x),M(f,x))):v.length>x&&r.push(new Ms(M(f,x),M(f,m(v,c,a))))}r.length||r.push(new Ms(n,n)),Er(l,Ho(p.ranges.slice(0,g).concat(r),g),{origin:'*mouse',scroll:!1}),t.scrollIntoView(e)}else{var C=h,S=Ba(t,e,o.unit),E=C.anchor,k;0=p.to||i.lineb.bottom?20:0;c&&setTimeout(yo(t,function(){v!=e||(d.scroller.scrollTop+=c,a(n))}),50)}}function i(n){t.state.selectingText=!1,v=Infinity,Pe(n),d.input.focus(),Ie(d.wrapper.ownerDocument,'mousemove',x),Ie(d.wrapper.ownerDocument,'mouseup',C),l.history.lastSelOrigin=null}var d=t.display,l=t.doc;Pe(e);var p=l.sel,c=p.ranges,h,g;if(o.addNew&&!o.extend?(g=l.sel.contains(n),h=-1c:0=yi(t.display.gutters.getBoundingClientRect().right))return!1;o&&Pe(n);var s=t.display,d=s.lineDiv.getBoundingClientRect();if(a>d.bottom||!Re(t,e))return _e(n);a-=d.top-s.viewOffset;for(var l=0,i;l=r){var p=P(t.doc,a),c=t.options.gutters[l];return Ne(t,e,t,p,c,n),_e(n)}}function Ha(t,n){return Wa(t,n,'gutterClick',!0)}function qa(t,n){Mt(t.display,n)||ja(t,n)||Ae(t,n,'contextmenu')||t.display.input.onContextMenu(n)}function ja(t,n){return!!Re(t,'gutterContextMenu')&&Wa(t,n,'gutterContextMenu',!1)}function za(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,'')+e.options.theme.replace(/(^|\s)\s*/g,' cm-s-'),nn(e)}function Ka(e){Fo(e),xo(e),Hn(e)}function Ga(e,t,n){if(!t!=!(n&&n!=Zs)){var o=e.display.dragFunctions,r=t?ss:Ie;r(e.display.scroller,'dragstart',o.start),r(e.display.scroller,'dragenter',o.enter),r(e.display.scroller,'dragover',o.over),r(e.display.scroller,'dragleave',o.leave),r(e.display.scroller,'drop',o.drop)}}function Xa(e){e.options.lineWrapping?(d(e.display.wrapper,'CodeMirror-wrap'),e.display.sizer.style.minWidth='',e.display.sizerWidth=null):(ji(e.display.wrapper,'CodeMirror-wrap'),Se(e)),wn(e),xo(e),nn(e),setTimeout(function(){return ro(e)},100)}function Qa(e,t){var n=this;if(!(this instanceof Qa))return new Qa(e,t);this.options=t=t?c(t):{},c(ed,t,!1),Bo(t);var o=t.value;'string'==typeof o&&(o=new Hs(o,t.mode,null,t.lineSeparator,t.direction)),this.doc=o;var r=new Qa.inputStyles[t.inputStyle](this),a=this.display=new I(e,o,r);for(var s in a.wrapper.CodeMirror=this,Fo(this),za(this),t.lineWrapping&&(this.display.wrapper.className+=' CodeMirror-wrap'),io(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Gi,keySeq:null,specialChars:null},t.autofocus&&!Fi&&a.input.focus(),wi&&11>Ii&&setTimeout(function(){return n.display.input.reset(!0)},20),Ya(this),ra(),so(this),this.curOp.forceUpdate=!0,er(this,o),t.autofocus&&!Fi||this.hasFocus()?setTimeout(p(Fn,this),20):Bn(this),td)td.hasOwnProperty(s)&&td[s](n,t[s],Zs);qn(this),t.finishInit&&t.finishInit(this);for(var d=0;d=e.radiusX&&1>=e.radiusY}function r(e,t){if(null==t.left)return!0;var n=t.left-e.left,o=t.top-e.top;return 400Ii?ss(a.scroller,'dblclick',yo(t,function(n){if(!Ae(t,n)){var e=In(t,n);if(!(!e||Ha(t,n)||Mt(t.display,n))){Pe(n);var o=t.findWordAt(e);yr(t.doc,o.anchor,o.head)}}})):ss(a.scroller,'dblclick',function(n){return Ae(t,n)||Pe(n)}),qi||ss(a.scroller,'contextmenu',function(n){return qa(t,n)});var i={end:0},s;ss(a.scroller,'touchstart',function(n){if(!Ae(t,n)&&!o(n)&&!Ha(t,n)){a.input.ensurePolled(),clearTimeout(s);var e=+new Date;a.activeTouch={start:e,moved:!1,prev:300>=e-i.end?i:null},1==n.touches.length&&(a.activeTouch.left=n.touches[0].pageX,a.activeTouch.top=n.touches[0].pageY)}}),ss(a.scroller,'touchmove',function(){a.activeTouch&&(a.activeTouch.moved=!0)}),ss(a.scroller,'touchend',function(o){var e=a.activeTouch;if(e&&!Mt(a,o)&&null!=e.left&&!e.moved&&300>new Date-e.start){var i=t.coordsChar(a.activeTouch,'page'),s;s=!e.prev||r(e,e.prev)?new Ms(i,i):!e.prev.prev||r(e,e.prev.prev)?t.findWordAt(i):new Ms(M(i.line,0),q(t.doc,M(i.line+1,0))),t.setSelection(s.anchor,s.head),t.focus(),Pe(o)}n()}),ss(a.scroller,'touchcancel',n),ss(a.scroller,'scroll',function(){a.scroller.clientHeight&&(eo(t,a.scroller.scrollTop),no(t,a.scroller.scrollLeft,!0),Ne(t,'scroll',t))}),ss(a.scroller,'mousewheel',function(n){return Wo(t,n)}),ss(a.scroller,'DOMMouseScroll',function(n){return Wo(t,n)}),ss(a.wrapper,'scroll',function(){return a.wrapper.scrollTop=a.wrapper.scrollLeft=0}),a.dragFunctions={enter:function(n){Ae(t,n)||Me(n)},over:function(n){Ae(t,n)||(ta(t,n),Me(n))},start:function(n){return ea(t,n)},drop:yo(t,Zr),leave:function(n){Ae(t,n)||na(t)}};var e=a.input.getField();ss(e,'keyup',function(n){return La.call(t,n)}),ss(e,'keydown',yo(t,Na)),ss(e,'keypress',yo(t,Ra)),ss(e,'focus',function(n){return Fn(t,n)}),ss(e,'blur',function(n){return Bn(t,n)})}function Ja(e,t,n,o){var r=e.doc,a;null==n&&(n='add'),'smart'==n&&(r.mode.indent?a=Je(e,t).state:n='prev');var s=e.options.tabSize,d=N(r,t),l=u(d.text,null,s);d.stateAfter&&(d.stateAfter=null);var p=d.text.match(/^\s*/)[0],c;if(!o&&!/\S/.test(d.text))c=0,n='not';else if('smart'==n&&(c=r.mode.indent(a,d.text.slice(p.length),d.text),c==Qi||150r.first?c=u(N(r,t-1).text,null,s):c=0:'add'==n?c=l+e.options.indentUnit:'subtract'==n?c=l-e.options.indentUnit:'number'==typeof n&&(c=l+n),c=fi(0,c);var h='',m=0;if(e.options.indentWithTabs)for(var f=yi(c/s);f;--f)m+=s,h+='\t';if(m=e.first+e.size?!1:(t=new M(o,t.ch,t.sticky),p=N(e,o))}function i(o){var i;if(i=r?ba(e.cm,p,t,n):fa(p,t,n),null!=i)t=i;else if(!o&&a())t=ya(r,e.cm,p,t.line,n);else return!1;return!0}var s=t,d=n,p=N(e,t.line);if('char'==o)i();else if('column'==o)i(!0);else if('word'==o||'group'==o)for(var l=null,c='group'==o,u=e.cm&&e.cm.getHelper(t,'wordChars'),h=!0;;h=!1){if(0>n&&!i(!h))break;var m=p.text.charAt(t.ch)||'\n',g=S(m,u)?'w':c&&'\n'==m?'n':!c||/\s/.test(m)?null:'p';if(!c||h||g||(g='s'),l&&l!=g){0>n&&(n=1,i(),t.sticky='after');break}if(g&&(l=g),0n?0>=i:i>=r.height){l.hitSide=!0;break}i+=5*n}return l}function si(e,t){var n=Gt(e,t.line);if(!n||n.hidden)return null;var o=N(e.doc,t.line),r=jt(n,o,t.line),a=Te(o,e.doc.direction),i='left';if(a){var s=ke(a,t.ch);i=s%2?'right':'left'}var d=Yt(r.map,t.ch,i);return d.offset='right'==d.collapse?d.end:d.start,d}function di(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function li(e,t){return t&&(e.bad=!0),e}function pi(e,t,n,o,r){function a(e){return function(t){return t.id==e}}function s(){p&&(i+=c,p=!1)}function d(e){e&&(s(),i+=e)}function l(t){if(1==t.nodeType){var n=t.getAttribute('cm-text');if(null!=n)return void d(n||t.textContent.replace(/\u200b/g,''));var u=t.getAttribute('cm-marker'),h;if(u){var m=e.findMarks(M(o,0),M(r+1,0),a(+u));return void(m.length&&(h=m[0].find(0))&&d(A(e.doc,h.from,h.to).join(c)))}if('false'==t.getAttribute('contenteditable'))return;var g=/^(pre|div|p)$/i.test(t.nodeName);g&&s();for(var f=0;fr?p.map:c[r];for(var i=0,s;ir?e.line:e.rest[r]),l=a[i]+o;return(0>o||s!=t)&&(l=a[i+(o?1:0)]),M(d,l)}}}var r=e.text.firstChild,i=!1;if(!t||!a(r,t))return li(M(O(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var s=e.rest?f(e.rest):e.line;return li(M(O(s),s.text.length),i)}var d=3==t.nodeType?t:null,l=t;for(d||1!=t.childNodes.length||3!=t.firstChild.nodeType||(d=t.firstChild,n&&(n=d.nodeValue.length));l.parentNode!=r;)l=l.parentNode;var p=e.measure,c=p.maps,u=o(d,l,n);if(u)return li(u,i);for(var h=l.nextSibling,m=d?d.nodeValue.length-n:0;h;h=h.nextSibling){if(u=o(h,h.firstChild,0),u)return li(M(u.line,u.ch-m),i);m+=h.textContent.length}for(var g=l.previousSibling,y=n;g;g=g.previousSibling){if(u=o(g,g.firstChild,-1),u)return li(M(u.line,u.ch+y),i);y+=g.textContent.length}}var hi=String.fromCharCode,mi=Math.round,gi=Math.abs,fi=Math.max,yi=Math.floor,bi=Math.ceil,vi=Math.min,xi=navigator.userAgent,Ci=navigator.platform,Si=/gecko\/\d/i.test(xi),Ei=/MSIE \d/.test(xi),ki=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xi),Ti=/Edge\/(\d+)/.exec(xi),wi=Ei||ki||Ti,Ii=wi&&(Ei?document.documentMode||6:+(Ti||ki)[1]),Ni=!Ti&&/WebKit\//.test(xi),Ai=Ni&&/Qt\/\d+\.\d+/.test(xi),Li=!Ti&&/Chrome\//.test(xi),Ri=/Opera\//.test(xi),Oi=/Apple Computer/.test(navigator.vendor),Pi=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(xi),Di=/PhantomJS/.test(xi),_i=!Ti&&/AppleWebKit/.test(xi)&&/Mobile\/\w+/.test(xi),Mi=/Android/.test(xi),Fi=_i||Mi||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(xi),Bi=_i||/Mac/.test(Ci),Ui=/\bCrOS\b/.test(xi),Vi=/win/i.test(Ci),Wi=Ri&&xi.match(/Version\/(\d*\.\d*)/);Wi&&(Wi=+Wi[1]),Wi&&15<=Wi&&(Ri=!1,Ni=!0);var Hi=Bi&&(Ai||Ri&&(null==Wi||12.11>Wi)),qi=Si||wi&&9<=Ii,ji=function(t,n){var o=t.className,r=e(n).exec(o);if(r){var a=o.slice(r.index+r[0].length);t.className=o.slice(0,r.index)+(a?r[1]+a:'')}},zi;zi=document.createRange?function(e,t,n,o){var a=document.createRange();return a.setEnd(o||e,n),a.setStart(e,t),a}:function(e,t,n){var o=document.body.createTextRange();try{o.moveToElementText(e.parentNode)}catch(t){return o}return o.collapse(!0),o.moveEnd('character',n),o.moveStart('character',t),o};var Ki=function(e){e.select()};_i?Ki=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:wi&&(Ki=function(e){try{e.select()}catch(e){}});var Gi=function(){this.id=null};Gi.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Xi=30,Qi={toString:function(){return'CodeMirror.Pass'}},Yi={scroll:!1},Ji={origin:'*mouse'},$i={origin:'+move'},Zi=[''],es=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,ts=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,ns=!1,os=!1,rs=null,as=function(){function e(e){return 247>=e?n.charAt(e):1424<=e&&1524>=e?'R':1536<=e&&1785>=e?o.charAt(e-1536):1774<=e&&2220>=e?'r':8192<=e&&8203>=e?'w':8204==e?'b':'L'}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n='bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN',o='nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111',r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,i=/[LRr]/,s=/[Lb1n]/,d=/[1n]/;return function(n,o){var l='ltr'==o?'L':'R';if(0==n.length||'ltr'==o&&!r.test(n))return!1;for(var p=n.length,c=[],u=0;uIi)return!1;var e=o('div');return'draggable'in e||'dragDrop'in e}(),ds=3=='\n\nb'.split(/\n/).length?function(e){return e.split(/\r\n?|\n/)}:function(e){for(var t=0,n=[],o=e.length,r;t<=o;){r=e.indexOf('\n',t),-1==r&&(r=e.length);var a=e.slice(t,'\r'==e.charAt(r-1)?r-1:r),i=a.indexOf('\r');-1==i?(n.push(a),t=r+1):(n.push(a.slice(0,i)),t+=i+1)}return n},ls=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(t){}return t&&t.parentElement()==e&&0!=t.compareEndPoints('StartToEnd',t)},ps=function(){var t=o('div');return!!('oncopy'in t)||(t.setAttribute('oncopy','return;'),'function'==typeof t.oncopy)}(),cs=null,us={},hs={},ms={},gs=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n},fs,ys;gs.prototype.eol=function(){return this.pos>=this.string.length},gs.prototype.sol=function(){return this.pos==this.lineStart},gs.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},gs.prototype.next=function(){if(this.post},gs.prototype.eatSpace=function(){for(var e=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++e.pos;return this.pos>t},gs.prototype.skipToEnd=function(){this.pos=this.string.length},gs.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1this.maxLookAhead&&(this.maxLookAhead=e),t},vs.prototype.baseToken=function(e){var t=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)t.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,''),size:this.baseTokens[this.baseTokenPos]-e}},vs.prototype.nextLine=function(){this.line++,0Ii&&(this.horiz.style.minHeight=this.vert.style.minWidth='18px')},Ns;Is.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,o=e.nativeBarWidth;if(n){this.vert.style.display='block',this.vert.style.bottom=t?o+'px':'0';var r=e.viewHeight-(t?o:0);this.vert.firstChild.style.height=fi(0,e.scrollHeight-e.clientHeight+r)+'px'}else this.vert.style.display='',this.vert.firstChild.style.height='0';if(t){this.horiz.style.display='block',this.horiz.style.right=n?o+'px':'0',this.horiz.style.left=e.barLeft+'px';var a=e.viewWidth-e.barLeft-(n?o:0);this.horiz.firstChild.style.width=fi(0,e.scrollWidth-e.clientWidth+a)+'px'}else this.horiz.style.display='',this.horiz.firstChild.style.width='0';return!this.checkedZeroWidth&&0=F(e,r.to()))return o;return-1};var Ms=function(e,t){this.anchor=e,this.head=t};Ms.prototype.from=function(){return W(this.anchor,this.head)},Ms.prototype.to=function(){return V(this.anchor,this.head)},Ms.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},jr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=this,o=e,r;othis.size-t&&(1=this.children.length)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new zr(t);if(!e.parent){var o=new zr(e.children);o.parent=e,e.children=[o,n],e=o}else{e.size-=n.size,e.height-=n.height;var r=h(e.parent.children,e);e.parent.children.splice(r+1,0,n)}n.parent=e.parent}while(10t.display.maxLineLength&&(t.display.maxLine=p,t.display.maxLineLength=c,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&xo(t,r,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&wr(t.doc)),t&&Ct(t,'markerCleared',t,this,r,a),n&&lo(t),this.parent&&this.parent.clear()}},Us.prototype.find=function(e,t){var n=this;null==e&&'bookmark'==this.type&&(e=1);for(var o=0,r,a;o=e.ch)&&t.push(r.marker.parent||r.marker);return t},findMarks:function(e,t,n){e=q(this,e),t=q(this,t);var o=[],r=e.line;return this.iter(e.line,t.line+1,function(a){var s=a.markedSpans;if(s)for(var d=0,i;d=i.to||null==i.from&&r!=e.line||null!=i.from&&r==t.line&&i.from>=t.ch||n&&!n(i.marker)||o.push(i.marker.parent||i.marker);++r}),o},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var o=0;oe?(o=e,!0):void(e-=a,++t)}),q(this,M(t,o))},indexFromPos:function(e){e=q(this,e);var t=e.ch;if(e.linee.ch)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new Hs(L(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.toKs;Ks++)zs[Ks+48]=zs[Ks+96]=Ks+'';for(var i=65;90>=i;i++)zs[i]=hi(i);for(var Gs=1;12>=Gs;Gs++)zs[Gs+111]=zs[Gs+63235]='F'+Gs;var Xs={};Xs.basic={Left:'goCharLeft',Right:'goCharRight',Up:'goLineUp',Down:'goLineDown',End:'goLineEnd',Home:'goLineStartSmart',PageUp:'goPageUp',PageDown:'goPageDown',Delete:'delCharAfter',Backspace:'delCharBefore',"Shift-Backspace":'delCharBefore',Tab:'defaultTab',"Shift-Tab":'indentAuto',Enter:'newlineAndIndent',Insert:'toggleOverwrite',Esc:'singleSelection'},Xs.pcDefault={"Ctrl-A":'selectAll',"Ctrl-D":'deleteLine',"Ctrl-Z":'undo',"Shift-Ctrl-Z":'redo',"Ctrl-Y":'redo',"Ctrl-Home":'goDocStart',"Ctrl-End":'goDocEnd',"Ctrl-Up":'goLineUp',"Ctrl-Down":'goLineDown',"Ctrl-Left":'goGroupLeft',"Ctrl-Right":'goGroupRight',"Alt-Left":'goLineStart',"Alt-Right":'goLineEnd',"Ctrl-Backspace":'delGroupBefore',"Ctrl-Delete":'delGroupAfter',"Ctrl-S":'save',"Ctrl-F":'find',"Ctrl-G":'findNext',"Shift-Ctrl-G":'findPrev',"Shift-Ctrl-F":'replace',"Shift-Ctrl-R":'replaceAll',"Ctrl-[":'indentLess',"Ctrl-]":'indentMore',"Ctrl-U":'undoSelection',"Shift-Ctrl-U":'redoSelection',"Alt-U":'redoSelection',fallthrough:'basic'},Xs.emacsy={"Ctrl-F":'goCharRight',"Ctrl-B":'goCharLeft',"Ctrl-P":'goLineUp',"Ctrl-N":'goLineDown',"Alt-F":'goWordRight',"Alt-B":'goWordLeft',"Ctrl-A":'goLineStart',"Ctrl-E":'goLineEnd',"Ctrl-V":'goPageDown',"Shift-Ctrl-V":'goPageUp',"Ctrl-D":'delCharAfter',"Ctrl-H":'delCharBefore',"Alt-D":'delWordAfter',"Alt-Backspace":'delWordBefore',"Ctrl-K":'killLine',"Ctrl-T":'transposeChars',"Ctrl-O":'openLine'},Xs.macDefault={"Cmd-A":'selectAll',"Cmd-D":'deleteLine',"Cmd-Z":'undo',"Shift-Cmd-Z":'redo',"Cmd-Y":'redo',"Cmd-Home":'goDocStart',"Cmd-Up":'goDocStart',"Cmd-End":'goDocEnd',"Cmd-Down":'goDocEnd',"Alt-Left":'goGroupLeft',"Alt-Right":'goGroupRight',"Cmd-Left":'goLineLeft',"Cmd-Right":'goLineRight',"Alt-Backspace":'delGroupBefore',"Ctrl-Alt-Backspace":'delGroupAfter',"Alt-Delete":'delGroupAfter',"Cmd-S":'save',"Cmd-F":'find',"Cmd-G":'findNext',"Shift-Cmd-G":'findPrev',"Cmd-Alt-F":'replace',"Shift-Cmd-Alt-F":'replaceAll',"Cmd-[":'indentLess',"Cmd-]":'indentMore',"Cmd-Backspace":'delWrappedLineLeft',"Cmd-Delete":'delWrappedLineRight',"Cmd-U":'undoSelection',"Shift-Cmd-U":'redoSelection',"Ctrl-Up":'goDocStart',"Ctrl-Down":'goDocEnd',fallthrough:['basic','emacsy']},Xs['default']=Bi?Xs.macDefault:Xs.pcDefault;var Qs={selectAll:Rr,singleSelection:function(e){return e.setSelection(e.getCursor('anchor'),e.getCursor('head'),Yi)},killLine:function(e){return ma(e,function(t){if(t.empty()){var n=N(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.linee.doc.first){var i=N(e.doc,r.line-1).text;i&&(r=new M(r.line,1),e.replaceRange(a.charAt(0)+e.doc.lineSeparator()+i.charAt(i.length-1),M(r.line-1,i.length-1),r,'+transpose'))}n.push(new Ms(r,r))}e.setSelections(n)})},newlineAndIndent:function(e){return fo(e,function(){for(var t=e.listSelections(),n=t.length-1;0<=n;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,'+input');t=e.listSelections();for(var o=0;oe&&0==F(t,this.pos)&&n==this.button};var Zs={toString:function(){return'CodeMirror.Init'}},ed={},td={},nd,od;Qa.defaults=ed,Qa.optionHandlers=td;var rd=[];Qa.defineInitHook=function(e){return rd.push(e)};var ad=null,id=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Gi,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};id.prototype.init=function(e){function t(t){if(!Ae(r,t)){if(r.somethingSelected())$a({lineWise:!1,text:r.getSelections()}),'cut'==t.type&&r.replaceSelection('',null,'cut');else{if(!r.options.lineWiseCopyCut)return;var e=ni(r);$a({lineWise:!0,text:e.text}),'cut'==t.type&&r.operation(function(){r.setSelections(e.ranges,0,Yi),r.replaceSelection('',null,'cut')})}if(t.clipboardData){t.clipboardData.clearData();var n=ad.text.join('\n');if(t.clipboardData.setData('Text',n),t.clipboardData.getData('Text')==n)return void t.preventDefault()}var i=ri(),s=i.firstChild;r.display.lineSpace.insertBefore(i,r.display.lineSpace.firstChild),s.value=ad.text.join('\n');var d=document.activeElement;Ki(s),setTimeout(function(){r.display.lineSpace.removeChild(i),d.focus(),d==a&&o.showPrimarySelection()},50)}}var n=this,o=this,r=o.cm,a=o.div=e.lineDiv;oi(a,r.options.spellcheck),ss(a,'paste',function(t){Ae(r,t)||ei(t,r)||11>=Ii&&setTimeout(yo(r,function(){return n.updateFromDOM()}),20)}),ss(a,'compositionstart',function(t){n.composing={data:t.data,done:!1}}),ss(a,'compositionupdate',function(t){n.composing||(n.composing={data:t.data,done:!1})}),ss(a,'compositionend',function(t){n.composing&&(t.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),ss(a,'touchstart',function(){return o.forceCompositionEnd()}),ss(a,'input',function(){n.composing||n.readFromDOMSoon()}),ss(a,'copy',t),ss(a,'cut',t)},id.prototype.prepareSelection=function(){var e=Ln(this.cm,!1);return e.focus=this.cm.state.focused,e},id.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},id.prototype.showPrimarySelection=function(){var e=window.getSelection(),t=this.cm,n=t.doc.sel.primary(),o=n.from(),r=n.to();if(t.display.viewTo==t.display.viewFrom||o.line>=t.display.viewTo||r.line=t.display.viewFrom&&si(t,o)||{node:s[0].measure.map[2],offset:0},l=r.linee.firstLine()&&(o=M(o.line-1,N(e.doc,o.line-1).length)),r.ch==N(e.doc,r.line).text.length&&r.linet.viewTo-1)return!1;var a,i,s;o.line==t.viewFrom||0==(a=Nn(e,o.line))?(i=O(t.view[0].line),s=t.view[0].node):(i=O(t.view[a].line),s=t.view[a-1].node.nextSibling);var d=Nn(e,r.line),l,p;if(d==t.view.length-1?(l=t.viewTo-1,p=t.lineDiv.lastChild):(l=O(t.view[d+1].line)-1,p=t.view[d+1].node.previousSibling),!s)return!1;for(var c=e.doc.splitLines(pi(e,s,p,i,l)),u=A(e.doc,M(i,0),M(l,N(e.doc,l).text.length));1o.ch&&v.charCodeAt(v.length-m-1)==x.charCodeAt(x.length-m-1);)h--,m++;c[c.length-1]=v.slice(0,v.length-m).replace(/^\u200b+/,''),c[0]=c[0].slice(h).replace(/\u200b+$/,'');var S=M(i,h),E=M(l,u.length?f(u).length-m:0);if(1Ii&&a.scrollbars.setScrollTop(a.scroller.scrollTop=d),null!=s.selectionStart){(!wi||wi&&9>Ii)&&e();var t=0,n=function(){a.selForContextMenu==r.doc.sel&&0==s.selectionStart&&0t++?a.detectingSelectAll=setTimeout(n,500):(a.selForContextMenu=null,a.input.reset())};a.detectingSelectAll=setTimeout(n,200)}}var o=this,r=o.cm,a=r.display,s=o.textarea,i=In(r,t),d=a.scroller.scrollTop;if(i&&!Ri){var l=r.options.resetSelectionOnContextMenu;l&&-1==r.doc.sel.contains(i)&&yo(r,Er)(r.doc,qo(i),Yi);var p=s.style.cssText,c=o.wrapper.style.cssText;o.wrapper.style.cssText='position: absolute';var u=o.wrapper.getBoundingClientRect();s.style.cssText='position: absolute; width: 30px; height: 30px;\n top: '+(t.clientY-u.top-5)+'px; left: '+(t.clientX-u.left-5)+'px;\n z-index: 1000; background: '+(wi?'rgba(255, 255, 255, .05)':'transparent')+';\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);';var h;if(Ni&&(h=window.scrollY),a.input.focus(),Ni&&window.scrollTo(null,h),a.input.reset(),r.somethingSelected()||(s.value=o.prevInput=' '),o.contextMenuPending=!0,a.selForContextMenu=r.doc.sel,clearTimeout(a.detectingSelectAll),wi&&9<=Ii&&e(),qi){Me(t);var m=function(){Ie(window,'mouseup',m),setTimeout(n,20)};ss(window,'mouseup',m)}else setTimeout(n,50)}},sd.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled='nocursor'==e},sd.prototype.setUneditable=function(){},sd.prototype.needsContentAttribute=!1,function(e){function t(t,o,r,a){e.defaults[t]=o,r&&(n[t]=a?function(e,t,n){n!=Zs&&r(e,t,n)}:r)}var n=e.optionHandlers;e.defineOption=t,e.Init=Zs,t('value','',function(e,t){return e.setValue(t)},!0),t('mode',null,function(e,t){e.doc.modeOption=t,Qo(e)},!0),t('indentUnit',2,Qo,!0),t('indentWithTabs',!1),t('smartIndent',!0),t('tabSize',4,function(e){Yo(e),nn(e),xo(e)},!0),t('lineSeparator',null,function(e,t){if(e.doc.lineSep=t,!!t){var n=[],o=e.doc.first;e.doc.iter(function(e){for(var r=0,a;;){if(a=e.text.indexOf(t,r),-1==a)break;r=a+t.length,n.push(M(o,a))}o++});for(var r=n.length-1;0<=r;r--)Ur(e.doc,t,n[r],M(n[r].line,n[r].ch+t.length))}}),t('specialChars',/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test('\t')?'':'|\t'),'g'),n!=Zs&&e.refresh()}),t('specialCharPlaceholder',pt,function(e){return e.refresh()},!0),t('electricChars',!0),t('inputStyle',Fi?'contenteditable':'textarea',function(){throw new Error('inputStyle can not (yet) be changed in a running editor')},!0),t('spellcheck',!1,function(e,t){return e.getInputField().spellcheck=t},!0),t('rtlMoveVisually',!Vi),t('wholeLineUpdateBefore',!0),t('theme','default',function(e){za(e),Ka(e)},!0),t('keyMap','default',function(e,t,n){var o=ha(t),r=n!=Zs&&ha(n);r&&r.detach&&r.detach(e,o),o.attach&&o.attach(e,r||null)}),t('extraKeys',null),t('configureMouse',null),t('lineWrapping',!1,Xa,!0),t('gutters',[],function(e){Bo(e.options),Ka(e)},!0),t('fixedGutter',!0,function(e,t){e.display.gutters.style.left=t?kn(e.display)+'px':'0',e.refresh()},!0),t('coverGutterNextToScrollbar',!1,function(e){return ro(e)},!0),t('scrollbarStyle','native',function(e){io(e),ro(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t('lineNumbers',!1,function(e){Bo(e.options),Ka(e)},!0),t('firstLineNumber',1,Ka,!0),t('lineNumberFormatter',function(e){return e},Ka,!0),t('showCursorWhenSelecting',!1,An,!0),t('resetSelectionOnContextMenu',!0),t('lineWiseCopyCut',!0),t('pasteLinesPerSelection',!0),t('readOnly',!1,function(e,t){'nocursor'==t&&(Bn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),t('disableInput',!1,function(e,t){t||e.display.input.reset()},!0),t('dragDrop',!0,Ga),t('allowDropFileTypes',null),t('cursorBlinkRate',530),t('cursorScrollMargin',0),t('cursorHeight',1,An,!0),t('singleCursorHeightPerLine',!0,An,!0),t('workTime',100),t('workDelay',100),t('flattenSpans',!0,Yo,!0),t('addModeClass',!1,Yo,!0),t('pollInterval',100),t('undoDepth',200,function(e,t){return e.doc.history.undoDepth=t}),t('historyEventDelay',1250),t('viewportMargin',10,function(e){return e.refresh()},!0),t('maxHighlightLength',1e4,Yo,!0),t('moveInputWithCursor',!0,function(e,t){t||e.display.input.resetPosition()}),t('tabindex',null,function(e,t){return e.display.input.getField().tabIndex=t||''}),t('autofocus',null),t('direction','ltr',function(e,t){return e.doc.setDirection(t)},!0)}(Qa),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var o=this.options,r=o[e];o[e]==n&&'mode'!=e||(o[e]=n,t.hasOwnProperty(e)&&yo(this,t[e])(this,n,r),Ne(this,'optionChange',this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?'push':'unshift'](ha(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;no&&(Ja(t,a.head.line,e,!0),o=a.head.line,r==t.doc.sel.primIndex&&Qn(t))}),getTokenAt:function(e,t){return tt(this,e,t)},getLineTokens:function(e,t){return tt(this,M(e),t,!0)},getTokenTypeAt:function(e){e=q(this.doc,e);var t=Ye(this,N(this.doc,e.line)),n=0,o=(t.length-1)/2,r=e.ch,a;if(0==r)a=t[2];else for(;;){var i=n+o>>1;if((i?t[2*i-1]:0)>=r)o=i;else if(t[2*i+1]s?a:0==s?null:a.slice(0,s-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var o=this,r=[];if(!n.hasOwnProperty(t))return r;var a=n[t],s=this.getModeAt(e);if('string'==typeof s[t])a[s[t]]&&r.push(a[s[t]]);else if(s[t])for(var d=0,i;da&&(e=a,o=!0),r=N(this.doc,e)}else r=e;return dn(this,r,{top:0,left:0},t||'page',n||o).top+(o?this.doc.height-xe(r):0)},defaultTextHeight:function(){return Cn(this.display)},defaultCharWidth:function(){return Sn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,o,r){var a=this.display;e=cn(this,q(this.doc,e));var i=e.bottom,s=e.left;if(t.style.position='absolute',t.setAttribute('cm-ignore-events','true'),this.display.input.setUneditable(t),a.sizer.appendChild(t),'over'==o)i=e.top;else if('above'==o||'near'==o){var d=fi(a.wrapper.clientHeight,this.doc.height),l=fi(a.sizer.clientWidth,a.lineSpace.clientWidth);('above'==o||e.bottom+t.offsetHeight>d)&&e.top>t.offsetHeight?i=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=d&&(i=e.bottom),s+t.offsetWidth>l&&(s=l-t.offsetWidth)}t.style.top=i+'px',t.style.left=t.style.right='','right'==r?(s=a.sizer.clientWidth-t.offsetWidth,t.style.right='0px'):('left'==r?s=0:'middle'==r&&(s=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+'px'),n&&Kn(this,{left:s,top:i,right:s+t.offsetWidth,bottom:i+t.offsetHeight})},triggerOnKeyDown:bo(Na),triggerOnKeyPress:bo(Ra),triggerOnKeyUp:La,triggerOnMouseDown:bo(Pa),execCommand:function(e){if(Qs.hasOwnProperty(e))return Qs[e].call(null,this)},triggerElectric:bo(function(e){ti(this,e)}),findPosH:function(e,t,n,o){var r=this,a=1;0>t&&(a=-1,t=-t);for(var s=q(this.doc,e),d=0;de?o.from():o.to()},$i)}),deleteH:bo(function(e,t){var n=this.doc.sel,o=this.doc;n.somethingSelected()?o.replaceSelection('',null,'+delete'):ma(this,function(n){var r=ai(o,n.head,e,t,!1);return 0>e?{from:r,to:n.head}:{from:n.head,to:r}})}),findPosV:function(e,t,n,o){var r=this,a=1,s=o;0>t&&(a=-1,t=-t);for(var d=q(this.doc,e),l=0,i;le?i.from():i.to();var s=cn(n,i.head,'div');null!=i.goalColumn&&(s.left=i.goalColumn),r.push(s.left);var d=ii(n,s,e,t);return'page'==t&&i==o.sel.primary()&&Xn(n,pn(n,d,'div').top-s.top),d},$i),r.length)for(var s=0;sh(dd,ld)&&(Qa.prototype[ld]=function(e){return function(){return e.apply(this.doc,arguments)}}(Hs.prototype[ld]));return Oe(Hs),Qa.inputStyles={textarea:sd,contenteditable:id},Qa.defineMode=function(e){Qa.defaults.mode||'null'==e||(Qa.defaults.mode=e),He.apply(this,arguments)},Qa.defineMIME=function(e,t){hs[e]=t},Qa.defineMode('null',function(){return{token:function(e){return e.skipToEnd()}}}),Qa.defineMIME('text/plain','null'),Qa.defineExtension=function(e,t){Qa.prototype[e]=t},Qa.defineDocExtension=function(e,t){Hs.prototype[e]=t},Qa.fromTextArea=function(e,t){function n(){e.value=d.getValue()}if(t=t?c(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var o=s();t.autofocus=o==e||null!=e.getAttribute('autofocus')&&o==document.body}var r;if(e.form&&(ss(e.form,'submit',n),!t.leaveSubmitMethodAlone)){var a=e.form;r=a.submit;try{var i=a.submit=function(){n(),a.submit=r,a.submit(),a.submit=i}}catch(t){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display='',e.form&&(Ie(e.form,'submit',n),'function'==typeof e.form.submit&&(e.form.submit=r))}},e.style.display='none';var d=Qa(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return d},function(e){e.off=Ie,e.on=ss,e.wheelEventPixels=Vo,e.Doc=Hs,e.splitLines=ds,e.countColumn=u,e.findColumn=m,e.isWordChar=C,e.Pass=Qi,e.signal=Ne,e.Line=Cs,e.changeEnd=jo,e.scrollbarModel=Ls,e.Pos=M,e.cmpPos=F,e.modes=us,e.mimeModes=hs,e.resolveMode=qe,e.getMode=je,e.modeExtensions=ms,e.extendMode=ze,e.copyState=Ke,e.startState=Xe,e.innerMode=Ge,e.commands=Qs,e.keyMap=Xs,e.keyName=ua,e.isModifierKey=pa,e.lookupKey=la,e.normalizeKeyMap=da,e.StringStream=gs,e.SharedTextMarker=Vs,e.TextMarker=Us,e.LineWidget=Fs,e.e_preventDefault=Pe,e.e_stopPropagation=De,e.e_stop=Me,e.addClass=d,e.contains=a,e.rmClass=ji,e.keyNames=zs}(Qa),Qa.version='5.36.1',Qa}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){function t(e,t,o,r){var a=e.getLineHandle(t.line),d=t.ch-1,l=0<=d&&s[a.text.charAt(d)]||s[a.text.charAt(++d)];if(!l)return null;var p='>'==l.charAt(1)?1:-1;if(o&&0a))for(u==t.line&&(m=t.ch-(0>n?1:0));m!=g;m+=n){var f=h.charAt(m);if(p.test(f)&&(void 0===o||e.getTokenTypeAt(i(u,m+1))==o)){var y=s[f];if('>'==y.charAt(1)==0document.documentMode),i=e.Pos,s={"(":')>',")":'(<',"[":']>',"]":'[<',"{":'}>',"}":'{<'},d=null;e.defineOption('matchBrackets',!1,function(t,n,o){o&&o!=e.Init&&t.off('cursorActivity',r),n&&(t.state.matchBrackets='object'==typeof n?n:{},t.on('cursorActivity',r))}),e.defineExtension('matchBrackets',function(){o(this,!0)}),e.defineExtension('findMatchingBracket',function(e,n,o){return t(this,e,n,o)}),e.defineExtension('scanForBracket',function(e,t,o,r){return n(this,e,t,o,r)})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror'),require('../fold/xml-fold')):'function'==typeof define&&define.amd?define(['../../lib/codemirror','../fold/xml-fold'],e):e(CodeMirror)}(function(e){'use strict';function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function n(n){n.state.failedTagMatch=!1,n.operation(function(){if(t(n),!n.somethingSelected()){var o=n.getCursor(),r=n.getViewport();r.from=Math.min(r.from,o.line),r.to=Math.max(o.line+1,r.to);var a=e.findMatchingTag(n,o,r);if(a){if(n.state.matchBothTags){var i='open'==a.at?a.open:a.close;i&&(n.state.tagHit=n.markText(i.from,i.to,{className:'CodeMirror-matchingtag'}))}var s='close'==a.at?a.open:a.close;s?n.state.tagOther=n.markText(s.from,s.to,{className:'CodeMirror-matchingtag'}):n.state.failedTagMatch=!0}}})}function o(e){e.state.failedTagMatch&&n(e)}e.defineOption('matchTags',!1,function(r,a,i){i&&i!=e.Init&&(r.off('cursorActivity',n),r.off('viewportChange',o),t(r)),a&&(r.state.matchBothTags='object'==typeof a&&a.bothTags,r.on('cursorActivity',n),r.on('viewportChange',o),n(r))}),e.commands.toMatchingTag=function(t){var n=e.findMatchingTag(t,t.getCursor());if(n){var o='close'==n.at?n.open:n.close;o&&t.extendSelection(o.to,o.from)}}}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){function t(e,t){return'pairs'==t&&'string'==typeof e?e:'object'==typeof e&&null!=e[t]?e[t]:u[t]}function n(e){return function(t){return d(t,e)}}function o(e){var t=e.state.closeBrackets;if(!t)return null;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function r(n){var r=o(n);if(!r||n.getOption('disableInput'))return e.Pass;for(var a=t(r,'pairs'),s=n.listSelections(),d=0;d=x.ch||n.getRange(h(x.line,x.ch-3),h(x.line,x.ch-2))!=r))C='addFour';else if(m){if(!e.isWordChar(i)&&c(n,x,r))C='both';else return e.Pass;}else if(f&&(n.getLine(x.line).length==x.ch||l(i,d)||/\s/.test(i)))C='both';else return e.Pass;if(!b)b=C;else if(b!=C)return e.Pass}var S=p%2?d.charAt(p-1):r,E=p%2?r:d.charAt(p+1);n.operation(function(){if('skip'==b)n.execCommand('goCharRight');else if('skipThree'==b)for(var e=0;3>e;e++)n.execCommand('goCharRight');else if('surround'==b){for(var t=n.getSelections(),e=0;e=n.ch+1)return /\bstring2?\b/.test(s);i.start=i.pos}}var u={pairs:'()[]{}\'\'""',triples:'',explode:'[]{}'},h=e.Pos;e.defineOption('autoCloseBrackets',!1,function(t,n,o){o&&o!=e.Init&&(t.removeKeyMap(g),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(g))});for(var m=u.pairs+'`',g={Backspace:r,Enter:a},f=0;fi.ch&&(y=y.slice(0,y.length-p.end+i.ch));var b=y.toLowerCase();if(!y||'string'==p.type&&(p.end!=i.ch||!/[\"\']/.test(p.string.charAt(p.string.length-1))||1==p.string.length)||'tag'==p.type&&'closeTag'==u.type||p.string.indexOf('/')==p.string.length-1||g&&-1'+(v?'\n\n':'')+'',newPos:v?e.Pos(i.line+1,0):e.Pos(i.line,i.ch+1)}}for(var l=n.length-1,x;0<=l;l--){x=o[l],t.replaceRange(x.text,n[l].head,n[l].anchor,'+insert');var C=t.listSelections().slice(0);C[l]={head:x.newPos,anchor:x.newPos},t.setSelections(C),x.indent&&(t.indentLine(x.newPos.line,null,!0),t.indentLine(x.newPos.line+1,null,!0))}}function n(t,n){for(var o=t.listSelections(),r=[],s=n?'/':''!=t.getLine(i.line).charAt(l.end)&&(u+='>'),r[d]=u}t.replaceSelections(r),o=t.listSelections();for(var d=0;d\'']=function(e){return t(e)}),n.addKeyMap(i)}});var s=['area','base','br','col','command','embed','hr','img','input','keygen','link','meta','param','source','track','wbr'],d=['applet','blockquote','body','button','div','dl','fieldset','form','frameset','h1','h2','h3','h4','h5','h6','head','html','iframe','layer','legend','object','ol','p','select','table','ul'];e.commands.closeTag=function(e){return n(e)}}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){'use strict';function t(e){var t=e.search(a);return-1==t?0:t}function n(e,t,n){return /\bstring\b/.test(e.getTokenTypeAt(s(t.line,0)))&&!/^[\'\"`]/.test(n)}var o=Math.min,r={},a=/[^\s\u00a0]/,s=e.Pos;e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension('toggleComment',function(e){e||(e=r);for(var t=this,n=Infinity,o=this.listSelections(),a=null,d=o.length-1;0<=d;d--){var i=o[d].from(),l=o[d].to();i.line>=n||(l.line>=n&&(l=s(n,0)),n=i.line,null==a?t.uncomment(i,l,e)?a='un':(t.lineComment(i,l,e),a='line'):'un'==a?t.uncomment(i,l,e):t.lineComment(i,l,e))}}),e.defineExtension('lineComment',function(e,i,d){d||(d=r);var l=this,p=l.getModeAt(e),c=l.getLine(e.line);if(!(null==c||n(l,e,c))){var u=d.lineComment||p.lineComment;if(!u)return void((d.blockCommentStart||p.blockCommentStart)&&(d.fullLines=!0,l.blockComment(e,i,d)));var h=o(0!=i.ch||i.line==e.line?i.line+1:i.line,l.lastLine()+1),m=null==d.padding?' ':d.padding,g=d.commentBlankLines||e.line==i.line;l.operation(function(){if(d.indent){for(var n=null,o=e.line;oi.length)&&(n=i)}for(var o=e.line;ou||d.operation(function(){if(!1!=n.fullLines){var o=a.test(d.getLine(u));d.replaceRange(h+c,s(u)),d.replaceRange(p+h,s(e.line,0));var r=n.blockCommentLead||l.blockCommentLead;if(null!=r)for(var m=e.line+1;m<=u;++m)(m!=u||o)&&d.replaceRange(r+h,s(m,0))}else d.replaceRange(c,t),d.replaceRange(p,e)})}),e.defineExtension('uncomment',function(e,t,n){n||(n=r);var d=this,l=d.getModeAt(e),p=o(0!=t.ch||t.line==e.line?t.line:t.line-1,d.lastLine()),c=o(e.line,p),u=n.lineComment||l.lineComment,h=[],m=null==n.padding?' ':n.padding,g;lineComment:{if(!u)break lineComment;for(var f=c;f<=p;++f){var i=d.getLine(f),y=i.indexOf(u);if(-1n||(t.slice(o,o+m.length)==m&&(o+=m.length),g=!0,d.replaceRange('',s(e,n),s(e,o)))}}),g)return!0}var b=n.blockCommentStart||l.blockCommentStart,v=n.blockCommentEnd||l.blockCommentEnd;if(!b||!v)return!1;var x=n.blockCommentLead||l.blockCommentLead,C=d.getLine(c),S=p==c?C:d.getLine(p),E=C.indexOf(b),k=S.lastIndexOf(v);if(-1==k&&c!=p&&(S=d.getLine(--p),k=S.lastIndexOf(v)),-1==E||-1==k||!/comment/.test(d.getTokenTypeAt(s(c,E+1)))||!/comment/.test(d.getTokenTypeAt(s(p,k+1))))return!1;var T=C.lastIndexOf(b,e.ch),w=-1==T?-1:C.slice(0,e.ch).indexOf(v,T+b.length);if(-1!=T&&-1!=w&&w+v.length!=e.ch)return!1;w=S.indexOf(v,t.ch);var I=S.slice(t.ch).lastIndexOf(b,w-t.ch);return(T=-1==w||-1==I?-1:t.ch+I,-1==w||-1==T||T==t.ch)&&(d.operation(function(){d.replaceRange('',s(p,k-(m&&S.slice(k-m.length,k)==m?m.length:0)),s(p,k+v.length));var e=E+b.length;if(m&&C.slice(e,e+m.length)==m&&(e+=m.length),d.replaceRange('',s(c,E),s(c,e)),x)for(var t=c+1;t<=p;++t){var n=d.getLine(t),o=n.indexOf(x);if(!(-1==o||a.test(n.slice(0,o)))){var r=o+x.length;m&&n.slice(r,r+m.length)==m&&(r+=m.length),d.replaceRange('',s(t,o),s(t,r))}}}),!0)})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(t){'use strict';function e(e,r,a,s){function i(t){var n=d(e,r);if(!n||n.to.line-n.from.linee.firstLine();)r=t.Pos(r.line-1,0),p=i(!1);if(p&&!p.cleared&&'unfold'!==s){var c=n(e,a);t.on(c,'mousedown',function(n){u.clear(),t.e_preventDefault(n)});var u=e.markText(p.from,p.to,{replacedWith:c,clearOnEnter:!0,__isFold:!0});u.on('clear',function(n,o){t.signal(e,'unfold',e,n,o)}),t.signal(e,'fold',e,p.from,p.to)}}function n(e,t){var n=o(e,t,'widget');if('string'==typeof n){var r=document.createTextNode(n);n=document.createElement('span'),n.appendChild(r),n.className='CodeMirror-foldmarker'}return n}function o(e,t,n){if(t&&t[n]!==void 0)return t[n];var o=e.options.foldOptions;return o&&void 0!==o[n]?o[n]:r[n]}t.newFoldFunction=function(t,n){return function(o,r){e(o,r,{rangeFinder:t,widget:n})}},t.defineExtension('foldCode',function(t,n,o){e(this,t,n,o)}),t.defineExtension('isFolded',function(e){for(var t=this.findMarksAt(e),n=0;n=s&&(n=r(a.indicatorOpen))}e.setGutterMarker(t,a.gutter,n),++i})}function i(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){a(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function s(e,t,n){var r=e.state.foldGutter;if(r){var a=r.options;if(n==a.gutter){var i=o(e,t);i?i.clear():e.foldCode(c(t,0),a.rangeFinder)}}}function d(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){i(e)},n.foldOnChangeTimeSpan||600)}}function l(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||20t.to&&(a(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}}function p(e,t){var n=e.state.foldGutter;if(n){var o=t.line;o>=n.from&&o=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function a(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function s(e){for(;;){var t=e.text.indexOf('>',e.ch);if(-1==t)if(r(e))continue;else return;if(!o(e,t+1)){e.ch=t+1;continue}var n=e.text.lastIndexOf('/',t),a=-1',e.ch-1):-1;if(-1==t)if(a(e))continue;else return;if(!o(e,t+1)){e.ch=t;continue}var n=e.text.lastIndexOf('/',t),r=-1p&&(!t||t==o[2]))return{tag:o[2],from:u(r,a),to:u(e.line,e.ch)}}else n.push(o[2])}}function c(e,t){for(var n=[];;){var o=p(e);if(!o)return;if('selfClose'==o){d(e);continue}var r=e.line,a=e.ch,s=d(e);if(!s)return;if(s[1])n.push(s[2]);else{for(var l=n.length-1;0<=l;--l)if(n[l]==s[2]){n.length=l;break}if(0>l&&(!t||t==s[2]))return{tag:s[2],from:u(e.line,e.ch),to:u(r,a)}}}}var u=e.Pos,h=/<(\/?)([A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD-:.0-9\u00B7\u0300-\u036F\u203F-\u2040]*)/g;e.registerHelper('fold','xml',function(e,t){for(var o=new n(e,t.line,0);;){var r=l(o),a;if(!r||o.line!=t.line||!(a=s(o)))return;if(!r[1]&&'selfClose'!=a){var t=u(o.line,o.ch),d=i(o,r[2]);return d&&{from:t,to:d.from}}}}),e.findMatchingTag=function(e,o,r){var a=new n(e,o.line,o.ch,r);if(-1!=a.text.indexOf('>')||-1!=a.text.indexOf('<')){var l=s(a),p=l&&u(a.line,a.ch),h=l&&d(a);if(l&&h&&!(0s)d=l;else if(!/\S/.test(p));else break}if(d)return{from:e.Pos(n.line,r.length),to:e.Pos(d,t.getLine(d).length)}}})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){'use strict';e.registerGlobalHelper('fold','comment',function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,n){var o=t.getModeAt(n),r=o.blockCommentStart,a=o.blockCommentEnd;if(r&&a){for(var s=n.line,d=t.getLine(s),l=n.ch,p=0,c,u;;){if(u=0>=l?-1:d.lastIndexOf(r,l-1),-1==u){if(1==p)return;p=1,l=d.length;continue}if(1==p&&uv&&(v=i.length),0>x&&(x=i.length),b=Math.min(v,x),b==i.length)break;if(b==v)++h;else if(! --h){g=y,f=b;break outer}++b}return null==g||s==g&&f==c?void 0:{from:e.Pos(s,c),to:e.Pos(g,f)}}})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(t){'use strict';var n=Math.min;t.registerHelper('fold','brace',function(e,o){function r(n){for(var r=o.ch,i=0,d;;){if(d=0>=r?-1:s.lastIndexOf(n,r-1),-1==d){if(1==i)break;i=1,r=s.length;continue}if(1==i&&db&&(b=i.length),0>v&&(v=i.length),y=n(b,v),y==i.length)break;if(e.getTokenTypeAt(t.Pos(f,y+1))==c)if(y==b)++u;else if(! --u){m=f,g=y;break outer}++y}return null==m||a==m&&g==p?void 0:{from:t.Pos(a,p),to:t.Pos(m,g)}}}),t.registerHelper('fold','import',function(o,e){function r(r){if(ro.lastLine())return null;var a=o.getTokenAt(t.Pos(r,1));if(/\S/.test(a.string)||(a=o.getTokenAt(t.Pos(r,a.end+1))),'keyword'!=a.type||'import'!=a.string)return null;for(var s=r,i=n(o.lastLine(),r+10);s<=i;++s){var e=o.getLine(s),d=e.indexOf(';');if(-1!=d)return{startCh:a.end,end:t.Pos(s,d)}}}var e=e.line,a=r(e),i;if(!a||r(e-1)||(i=r(e-2))&&i.end.line==e-1)return null;for(var s=a.end,d;;){if(d=r(s.line+1),null==d)break;s=d.end}return{from:o.clipPos(t.Pos(e,a.startCh+1)),to:s}}),t.registerHelper('fold','include',function(e,n){function o(n){if(ne.lastLine())return null;var o=e.getTokenAt(t.Pos(n,1));if(/\S/.test(o.string)||(o=e.getTokenAt(t.Pos(n,o.end+1))),'meta'==o.type&&'#include'==o.string.slice(0,8))return o.start+8}var n=n.line,r=o(n);if(null==r||null!=o(n-1))return null;for(var a=n,i;;){if(i=o(a+1),null==i)break;++a}return{from:t.Pos(n,r+1),to:e.clipPos(t.Pos(a))}})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror'),'cjs'):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],function(t){e(t,'amd')}):e(CodeMirror,'plain')}(function(e,t){function n(e,t){var n=t;return function(){0==--n&&e()}}function o(t,o){var r=e.modes[t].dependencies;if(!r)return o();for(var a=[],s=0;sS){d.style.height=S-5+'px',d.style.top=(v=y.bottom-E.top)+'px';var I=s.getCursor();t.from.ch!=I.ch&&(y=s.cursorCoords(I),d.style.left=(b=y.left)+'px',E=d.getBoundingClientRect())}}var N=E.right-C;if(0C&&(d.style.width=C-5+'px',N-=E.right-E.left-C),d.style.left=(b=y.left-N)+'px'),s.addKeyMap(this.keyMap=a(n,{moveFocus:function(e,t){o.changeActive(o.selectedHint+e,t)},setFocus:function(e){o.changeActive(e)},menuSize:function(){return o.screenAmount()},length:l.length,close:function(){n.close()},pick:function(){o.pick()},data:t})),n.options.closeOnUnfocus){var A;s.on('blur',this.onBlur=function(){A=setTimeout(function(){n.close()},100)}),s.on('focus',this.onFocus=function(){clearTimeout(A)})}var L=s.getScrollInfo();return s.on('scroll',this.onScroll=function(){var e=s.getScrollInfo(),t=s.getWrapperElement().getBoundingClientRect(),o=v+L.top-e.top,r=o-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return x||(r+=d.offsetHeight),r<=t.top||r>=t.bottom?n.close():void(d.style.top=o+'px',d.style.left=b+L.left-e.left+'px')}),e.on(d,'dblclick',function(n){var e=i(d,n.target||n.srcElement);e&&null!=e.hintId&&(o.changeActive(e.hintId),o.pick())}),e.on(d,'click',function(r){var e=i(d,r.target||r.srcElement);e&&null!=e.hintId&&(o.changeActive(e.hintId),n.options.completeOnSingleClick&&o.pick())}),e.on(d,'mousedown',function(){setTimeout(function(){s.focus()},20)}),e.signal(t,'select',l[0],d.firstChild),!0}function d(e,t){if(!e.somethingSelected())return t;for(var n=[],o=0;o=this.data.list.length?t=n?this.data.list.length-1:0:0>t&&(t=n?0:this.data.list.length-1),this.selectedHint!=t){var o=this.hints.childNodes[this.selectedHint];o.className=o.className.replace(' '+u,''),o=this.hints.childNodes[this.selectedHint=t],o.className+=' '+u,o.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=o.offsetTop+o.offsetHeight-this.hints.clientHeight+3),e.signal(this.data,'select',this.data.list[this.selectedHint],o)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper('hint','auto',{resolve:function(t,n){var o=t.getHelpers(n,'hint'),r;if(o.length){var a=function(e,t,n){function r(o){return o==a.length?t(null):void l(a[o],e,n,function(e){e&&0,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};e.defineOption('hintOptions',null)}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){function t(t,n){for(var o=0,r=t.length;os.ch&&(d.end=s.ch,d.string=d.string.slice(0,s.ch-d.start)):d={start:s.ch,end:s.ch,string:'',state:d.state,type:'.'==d.string?'property':null};for(var l=d;'property'==l.type;){if(l=o(t,i(s.line,l.start)),'.'!=l.string)return;if(l=o(t,i(s.line,l.start)),!p)var p=[];p.push(l)}return{list:a(d,p,n,r),from:i(s.line,d.start),to:i(s.line,d.end)}}}function r(e,t){var n=e.getTokenAt(t);return t.ch==n.start+1&&'.'==n.string.charAt(0)?(n.end=n.start,n.string='.',n.type='property'):/^\.[\w$_]*$/.test(n.string)&&(n.type='property',n.start++,n.string=n.string.replace(/\./,'')),n}function a(e,o,r,a){function i(e){0!=e.lastIndexOf(u,0)||n(c,e)||c.push(e)}function p(e){for(var n in'string'==typeof e?t(s,i):e instanceof Array?t(d,i):e instanceof Function&&t(l,i),e)i(n)}var c=[],u=e.string,h=a&&a.globalScope||window;if(o&&o.length){var m=o.pop(),g;for(m.type&&0===m.type.indexOf('variable')?(a&&a.additionalContext&&(g=a.additionalContext[m.string]),(!a||!1!==a.useGlobalScope)&&(g=g||h[m.string])):'string'==m.type?g='':'atom'==m.type?g=1:'function'==m.type&&(null!=h.jQuery&&('$'==m.string||'jQuery'==m.string)&&'function'==typeof h.jQuery?g=h.jQuery():null!=h._&&'_'==m.string&&'function'==typeof h._&&(g=h._()));null!=g&&o.length;)g=g[o.pop().string];null!=g&&p(g)}else{for(var f=e.state.localVars;f;f=f.next)i(f.name);for(var f=e.state.globalVars;f;f=f.next)i(f.name);a&&!1===a.useGlobalScope||p(h),t(r,i)}return c}var i=e.Pos;e.registerHelper('hint','javascript',function(e,t){return o(e,p,function(t,e){return t.getTokenAt(e)},t)}),e.registerHelper('hint','coffeescript',function(e,t){return o(e,c,r,t)});var s='charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search'.split(' '),d='length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight '.split(' '),l=['prototype','apply','call','bind'],p='break case catch continue debugger default delete do else false finally for function if in instanceof new null return switch throw true try typeof var void while with'.split(' '),c='and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes'.split(' ')}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){'use strict';var t=Math.max,o=e.Pos;e.registerHelper('hint','xml',function(r,a){var s=a&&a.schemaInfo,d=a&&a.quoteChar||'"';if(s){var l=r.getCursor(),p=r.getTokenAt(l);p.end>l.ch&&(p.end=l.ch,p.string=p.string.slice(0,l.ch-p.start));var c=e.innerMode(r.getMode(),p.state);if('xml'==c.mode.name){var u=[],h=!1,m=/\btag\b/.test(p.type)&&!/>$/.test(p.string),g=m&&/^\w/.test(p.string),f,y;if(g){var b=r.getLine(l.line).slice(t(0,p.start-2),p.start),v=/<\/$/.test(b)?'close':/<$/.test(b)?'open':null;v&&(y=p.start-('close'==v?2:1))}else m&&'<'==p.string?v='open':m&&'')}else{var C=s[c.state.tagName],k=C&&C.attrs,T=s['!attrs'];if(!k&&!T)return;if(!k)k=T;else if(T){var w={};for(var I in T)T.hasOwnProperty(I)&&(w[I]=T[I]);for(var I in k)k.hasOwnProperty(I)&&(w[I]=k[I]);k=w}if('string'==p.type||'='==p.string){var b=r.getRange(o(l.line,t(0,l.ch-60)),o(l.line,'string'==p.type?p.start:p.end)),N=b.match(/([^\s\u00a0=<>\"\']+)=$/),A;if(!N||!k.hasOwnProperty(N[1])||!(A=k[N[1]]))return;if('function'==typeof A&&(A=A.call(this,r)),'string'==p.type){f=p.string;var L=0;/['"]/.test(p.string.charAt(0))&&(d=p.string.charAt(0),f=p.string.slice(1),L++);var n=p.string.length;/['"]/.test(p.string.charAt(n-1))&&(d=p.string.charAt(n-1),f=p.string.substr(L,n-2)),h=!0}for(var E=0;E][<][=] [X]','device-aspect-ratio: X/Y','orientation:portrait','orientation:landscape','device-height: [X]','device-width: [X]'],l={attrs:{}},p={a:{attrs:{href:null,ping:null,type:null,media:d,target:o,hreflang:n}},abbr:l,acronym:l,address:l,applet:l,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:d,hreflang:n,type:null,shape:['default','rect','circle','poly']}},article:l,aside:l,audio:{attrs:{src:null,mediagroup:null,crossorigin:['anonymous','use-credentials'],preload:['none','metadata','auto'],autoplay:['','autoplay'],loop:['','loop'],controls:['','controls']}},b:l,base:{attrs:{href:null,target:o}},basefont:l,bdi:l,bdo:l,big:l,blockquote:{attrs:{cite:null}},body:l,br:l,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:['','autofocus'],disabled:['','autofocus'],formenctype:i,formmethod:a,formnovalidate:['','novalidate'],formtarget:o,type:['submit','reset','button']}},canvas:{attrs:{width:null,height:null}},caption:l,center:l,cite:l,code:l,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:['command','checkbox','radio'],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:['','disabled'],checked:['','checked']}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:['','disabled'],multiple:['','multiple']}},datalist:{attrs:{data:null}},dd:l,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:['','open']}},dfn:l,dir:l,div:l,dl:l,dt:l,em:l,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:['','disabled'],form:null,name:null}},figcaption:l,figure:l,font:l,footer:l,form:{attrs:{action:null,name:null,"accept-charset":r,autocomplete:['on','off'],enctype:i,method:a,novalidate:['','novalidate'],target:o}},frame:l,frameset:l,h1:l,h2:l,h3:l,h4:l,h5:l,h6:l,head:{attrs:{},children:['title','base','link','style','meta','script','noscript','command']},header:l,hgroup:l,hr:l,html:{attrs:{manifest:null},children:['head','body']},i:l,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:['allow-top-navigation','allow-same-origin','allow-forms','allow-scripts'],seamless:['','seamless']}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:['anonymous','use-credentials']}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:['audio/*','video/*','image/*'],autocomplete:['on','off'],autofocus:['','autofocus'],checked:['','checked'],disabled:['','disabled'],formenctype:i,formmethod:a,formnovalidate:['','novalidate'],formtarget:o,multiple:['','multiple'],readonly:['','readonly'],required:['','required'],type:['hidden','text','search','tel','url','email','password','datetime','date','month','week','time','datetime-local','number','range','color','checkbox','radio','file','submit','image','reset','button']}},ins:{attrs:{cite:null,datetime:null}},kbd:l,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:['','autofocus'],disabled:['','disabled'],keytype:['RSA']}},label:{attrs:{for:null,form:null}},legend:l,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:n,media:d,sizes:['all','16x16','16x16 32x32','16x16 32x32 64x64']}},map:{attrs:{name:null}},mark:l,menu:{attrs:{label:null,type:['list','context','toolbar']}},meta:{attrs:{content:null,charset:r,name:['viewport','application-name','author','description','generator','keywords'],"http-equiv":['content-language','content-type','default-style','refresh']}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:l,noframes:l,noscript:l,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:['','typemustmatch']}},ol:{attrs:{reversed:['','reversed'],start:null,type:['1','a','A','i','I']}},optgroup:{attrs:{disabled:['','disabled'],label:null}},option:{attrs:{disabled:['','disabled'],label:null,selected:['','selected'],value:null}},output:{attrs:{for:null,form:null,name:null}},p:l,param:{attrs:{name:null,value:null}},pre:l,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:l,rt:l,ruby:l,s:l,samp:l,script:{attrs:{type:['text/javascript'],src:null,async:['','async'],defer:['','defer'],charset:r}},section:l,select:{attrs:{form:null,name:null,size:null,autofocus:['','autofocus'],disabled:['','disabled'],multiple:['','multiple']}},small:l,source:{attrs:{src:null,type:null,media:null}},span:l,strike:l,strong:l,style:{attrs:{type:['text/css'],media:d,scoped:null}},sub:l,summary:l,sup:l,table:l,tbody:l,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:['','autofocus'],disabled:['','disabled'],readonly:['','readonly'],required:['','required'],wrap:['soft','hard']}},tfoot:l,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:['row','col','rowgroup','colgroup']}},thead:l,time:{attrs:{datetime:null}},title:l,tr:l,track:{attrs:{src:null,label:null,default:null,kind:['subtitles','captions','descriptions','chapters','metadata'],srclang:n}},tt:l,u:l,ul:l,var:l,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:['anonymous','use-credentials'],preload:['auto','metadata','none'],autoplay:['','autoplay'],mediagroup:['movie'],muted:['','muted'],controls:['','controls']}},wbr:l},c={accesskey:['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9'],class:null,contenteditable:['true','false'],contextmenu:null,dir:['ltr','rtl','auto'],draggable:['true','false','auto'],dropzone:['copy','move','link','string:','file:'],hidden:['hidden'],id:null,inert:['inert'],itemid:null,itemprop:null,itemref:null,itemscope:['itemscope'],itemtype:null,lang:['en','es'],spellcheck:['true','false'],style:null,tabindex:['1','2','3','4','5','6','7','8','9'],title:null,translate:['yes','no'],onclick:null,rel:['stylesheet','alternate','author','bookmark','help','license','next','nofollow','noreferrer','prefetch','prev','search','tag']};for(var u in t(l),p)p.hasOwnProperty(u)&&p[u]!=l&&t(p[u]);e.htmlSchema=p,e.registerHelper('hint','html',function(t,n){var o={schemaInfo:p};if(n)for(var r in n)o[r]=n[r];return e.hint.xml(t,o)})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror'),require('../../mode/css/css')):'function'==typeof define&&define.amd?define(['../../lib/codemirror','../../mode/css/css'],e):e(CodeMirror)}(function(e){'use strict';var t={link:1,visited:1,active:1,hover:1,focus:1,"first-letter":1,"first-line":1,"first-child":1,before:1,after:1,lang:1};e.registerHelper('hint','css',function(n){function o(e){for(var t in e)l&&0!=t.lastIndexOf(l,0)||c.push(t)}var r=n.getCursor(),a=n.getTokenAt(r),i=e.innerMode(n.getMode(),a.state);if('css'==i.mode.name){if('keyword'==a.type&&0=='!important'.indexOf(a.string))return{list:['!important'],from:e.Pos(r.line,a.start),to:e.Pos(r.line,a.end)};var s=a.start,d=r.ch,l=a.string.slice(0,d-s);/[^\w$_-]/.test(l)&&(l='',s=d=r.ch);var p=e.resolveMode('text/css'),c=[],u=i.state.state;if('pseudo'==u||'variable-3'==a.type?o(t):'block'==u||'maybeprop'==u?o(p.propertyKeywords):'prop'==u||'parens'==u||'at'==u||'params'==u?(o(p.valueKeywords),o(p.colorKeywords)):('media'==u||'media_parens'==u)&&(o(p.mediaTypes),o(p.mediaFeatures)),c.length)return{list:c,from:e.Pos(r.line,s),to:e.Pos(r.line,d)}}})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){'use strict';function t(e){for(var t=0;te.lastLine())){var i=e.getLine(n.line),u=i.length-l[0].length;if(s(i.slice(u))==d[0]){for(var h=o(n.line,u),p=n.line+1,c=1;cn)--o;else return o}var o=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=o(e,0);return n.pos={from:t,to:t},n.atOccurrence=!1,!1}for(var n=this,r=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,r))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!r.line)return t(0);r=o(r.line-1,this.doc.getLine(r.line-1).length)}else{var a=this.doc.lineCount();if(r.line==a-1)return t(a);r=o(r.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t,n){if(this.atOccurrence){var r=e.splitLines(t);this.doc.replaceRange(r,this.pos.from,this.pos.to,n),this.pos.to=o(this.pos.from.line+r.length-1,r[r.length-1].length+(1==r.length?this.pos.from.ch:0))}}},e.defineExtension('getSearchCursor',function(e,n,o){return new t(this.doc,e,n,o)}),e.defineDocExtension('getSearchCursor',function(e,n,o){return new t(this,e,n,o)}),e.defineExtension('selectMatches',function(t,n){for(var o=[],r=this.getSearchCursor(t,this.getCursor('from'),n);r.findNext()&&!(0n.line&&document.querySelector&&(o=t.display.wrapper.querySelector('.CodeMirror-dialog'))&&o.getBoundingClientRect().bottom-4>t.cursorCoords(n,'window').top&&((l=o).style.opacity=.4)}))})}else s(t,y,'Search for:',d,function(e){e&&!a.query&&t.operation(function(){c(t,a,e),a.posFrom=a.posTo=t.getCursor(),h(t,n)})})}function h(t,n,r){t.operation(function(){var i=o(t),s=a(t,i.query,n?i.posFrom:i.posTo);!s.find(n)&&(s=a(t,i.query,n?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),!s.find(n))||(t.setSelection(s.from(),s.to()),t.scrollIntoView({from:s.from(),to:s.to()},20),i.posFrom=s.from(),i.posTo=s.to(),r&&r(s.from(),s.to()))})}function m(e){e.operation(function(){var t=o(e);t.lastQuery=t.query;t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function g(e,t,n){e.operation(function(){for(var o=a(e,t);o.findNext();)if('string'!=typeof t){var r=e.getRange(o.from(),o.to()).match(t);o.replace(n.replace(/\$(\d)/g,function(e,t){return r[t]}))}else o.replace(n)})}function f(e,t){if(!e.getOption('readOnly')){var n=e.getSelection()||o(e).lastQuery,r=t?'Replace all:':'Replace:';s(e,r+b,r,n,function(n){n&&(n=p(n),s(e,v,'Replace with:','',function(o){if(o=l(o),t)g(e,n,o);else{m(e);var r=a(e,n,e.getCursor('from')),i=function(){var t=r.from(),l;!(l=r.findNext())&&(r=a(e,n),!(l=r.findNext())||t&&r.from().line==t.line&&r.from().ch==t.ch)||(e.setSelection(r.from(),r.to()),e.scrollIntoView({from:r.from(),to:r.to()}),d(e,x,'Replace?',[function(){s(l)},i,function(){g(e,n,o)}]))},s=function(e){r.replace('string'==typeof n?o:o.replace(/\$(\d)/g,function(t,n){return e[n]})),i()};i()}}))})}}var y='Search: (Use /re/ syntax for regexp search)',b=' (Use /re/ syntax for regexp search)',v='With: ',x='Replace? ';e.commands.find=function(e){m(e),u(e)},e.commands.findPersistent=function(e){m(e),u(e,!1,!0)},e.commands.findNext=u,e.commands.findPrev=function(e){u(e,!0)},e.commands.clearSearch=m,e.commands.replace=f,e.commands.replaceAll=function(e){f(e,!0)}}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(t){function e(e,t,n){var o=e.getWrapperElement(),r;return r=o.appendChild(document.createElement('div')),r.className=n?'CodeMirror-dialog CodeMirror-dialog-bottom':'CodeMirror-dialog CodeMirror-dialog-top','string'==typeof t?r.innerHTML=t:r.appendChild(t),r}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}t.defineExtension('openDialog',function(o,r,a){function i(e){if('string'==typeof e)p.value=e;else{if(d)return;d=!0,s.parentNode.removeChild(s),l.focus(),a.onClose&&a.onClose(s)}}a||(a={}),n(this,null);var s=e(this,o,a.bottom),d=!1,l=this,p=s.getElementsByTagName('input')[0],c;return p?(p.focus(),a.value&&(p.value=a.value,!1!==a.selectValueOnOpen&&p.select()),a.onInput&&t.on(p,'input',function(t){a.onInput(t,p.value,i)}),a.onKeyUp&&t.on(p,'keyup',function(t){a.onKeyUp(t,p.value,i)}),t.on(p,'keydown',function(n){a&&a.onKeyDown&&a.onKeyDown(n,p.value,i)||((27==n.keyCode||!1!==a.closeOnEnter&&13==n.keyCode)&&(p.blur(),t.e_stop(n),i()),13==n.keyCode&&r(p.value,n))}),!1!==a.closeOnBlur&&t.on(p,'blur',i)):(c=s.getElementsByTagName('button')[0])&&(t.on(c,'click',function(){i(),l.focus()}),!1!==a.closeOnBlur&&t.on(c,'blur',i),c.focus()),i}),t.defineExtension('openConfirm',function(o,r,a){function s(){p||(p=!0,d.parentNode.removeChild(d),c.focus())}n(this,null);var d=e(this,o,a&&a.bottom),l=d.getElementsByTagName('button'),p=!1,c=this,u=1;l[0].focus();for(var h=0,i;h=u&&s()},200)}),t.on(i,'focus',function(){++u})}),t.defineExtension('openNotification',function(o,r){function a(){s||(s=!0,clearTimeout(l),i.parentNode.removeChild(i))}n(this,a);var i=e(this,o,r&&r.bottom),s=!1,d=r&&'undefined'!=typeof r.duration?r.duration:5e3,l;return t.on(i,'click',function(n){t.e_preventDefault(n),a()}),d&&(l=setTimeout(a,d)),a})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror'),require('../dialog/dialog')):'function'==typeof define&&define.amd?define(['../../lib/codemirror','../dialog/dialog'],e):e(CodeMirror)}(function(e){'use strict';function t(e,t,n,o,r){e.openDialog?e.openDialog(t,r,{value:o,selectValueOnOpen:!0}):r(prompt(n,o))}function n(e,t){var n=+t;return /^[-+]/.test(t)?e.getCursor().line+n:n-1}e.commands.jumpToLine=function(e){var o=e.getCursor();t(e,'Jump to line: (Use line:column or scroll% syntax)','Jump to line:',o.line+1+':'+o.ch,function(t){if(t){var r;if(r=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(t))e.setCursor(n(e,r[1]),+r[2]);else if(r=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(t)){var a=Math.round(e.lineCount()*+r[1]/100);/^[-+]/.test(r[1])&&(a=o.line+a+1),e.setCursor(a-1,o.ch)}else(r=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(t))&&e.setCursor(n(e,r[1]),o.ch)}})},e.keyMap['default']['Alt-G']='jumpToLine'}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){'use strict';var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},n={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode('xml',function(o,r){function a(e,t){function n(n){return t.tokenize=n,n(e,t)}var o=e.next();if('<'==o)return e.eat('!')?e.eat('[')?e.match('CDATA[')?n(d('atom',']]>')):null:e.match('--')?n(d('comment','-->')):e.match('DOCTYPE',!0,!0)?(e.eatWhile(/[\w\._\-]/),n(l(1))):null:e.eat('?')?(e.eatWhile(/[\w\._\-]/),t.tokenize=d('meta','?>'),'meta'):(w=e.eat('/')?'closeTag':'openTag',t.tokenize=i,'tag bracket');if('&'==o){var r;return r=e.eat('#')?e.eat('x')?e.eatWhile(/[a-fA-F\d]/)&&e.eat(';'):e.eatWhile(/[\d]/)&&e.eat(';'):e.eatWhile(/[\w\.\-:]/)&&e.eat(';'),r?'atom':'error'}return e.eatWhile(/[^&<]/),null}function i(e,t){var n=e.next();if('>'==n||'/'==n&&e.eat('>'))return t.tokenize=a,w='>'==n?'endTag':'selfcloseTag','tag bracket';if('='==n)return w='equals',null;if('<'==n){t.tokenize=a,t.state=h,t.tagName=t.tagStart=null;var o=t.tokenize(e,t);return o?o+' tag error':'tag error'}return /[\'\"]/.test(n)?(t.tokenize=s(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),'word')}function s(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=i;break}return'string'};return t.isInAttribute=!0,t}function d(e,t){return function(n,o){for(;!n.eol();){if(n.match(t)){o.tokenize=a;break}n.next()}return e}}function l(e){return function(t,n){for(var o;null!=(o=t.next());){if('<'==o)return n.tokenize=l(e+1),n.tokenize(t,n);if('>'==o)if(1==e){n.tokenize=a;break}else return n.tokenize=l(e-1),n.tokenize(t,n)}return'meta'}}function p(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(E.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function c(e){e.context&&(e.context=e.context.prev)}function u(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!E.contextGrabbers.hasOwnProperty(n)||!E.contextGrabbers[n].hasOwnProperty(t))return;c(e)}}function h(e,t,n){return'openTag'==e?(n.tagStart=t.column(),m):'closeTag'==e?g:h}function m(e,t,n){return'word'==e?(n.tagName=t.current(),I='tag',b):(I='error',m)}function g(e,t,n){if('word'==e){var o=t.current();return n.context&&n.context.tagName!=o&&E.implicitlyClosed.hasOwnProperty(n.context.tagName)&&c(n),n.context&&n.context.tagName==o||!1===E.matchClosing?(I='tag',f):(I='tag error',y)}return I='error',y}function f(e,t,n){return'endTag'==e?(c(n),h):(I='error',f)}function y(e,t,n){return I='error',f(e,t,n)}function b(e,t,n){if('word'==e)return I='attribute',v;if('endTag'==e||'selfcloseTag'==e){var o=n.tagName,r=n.tagStart;return n.tagName=n.tagStart=null,'selfcloseTag'==e||E.autoSelfClosers.hasOwnProperty(o)?u(n,o):(u(n,o),n.context=new p(n,o,r==n.indented)),h}return I='error',b}function v(e,t,n){return'equals'==e?x:(E.allowMissing||(I='error'),b(e,t,n))}function x(e,t,n){return'string'==e?C:'word'==e&&E.allowUnquoted?(I='string',b):(I='error',b(e,t,n))}function C(e,t,n){return'string'==e?C:b(e,t,n)}var S=o.indentUnit,E={},k=r.htmlMode?t:n;for(var T in k)E[T]=k[T];for(var T in r)E[T]=r[T];var w,I;return a.isInText=!0,{startState:function(e){var t={tokenize:a,state:h,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;w=null;var n=t.tokenize(e,t);return(n||w)&&'comment'!=n&&(I=null,t.state=t.state(w||n,e,t),I&&(n='error'==I?n+' error':I)),n},indent:function(t,n,o){var r=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+S;if(r&&r.noIndent)return e.Pass;if(t.tokenize!=i&&t.tokenize!=a)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1===E.multilineTagIndentPastTag?t.tagStart+S*(E.multilineTagIndentFactor||1):t.tagStart+t.tagName.length+2;if(E.alignCDATA&&/$/,blockCommentStart:'',configuration:E.htmlMode?'html':'xml',helperType:E.htmlMode?'html':'xml',skipAttribute:function(e){e.state==x&&(e.state=b)}}}),e.defineMIME('text/xml','xml'),e.defineMIME('application/xml','xml'),e.mimeModes.hasOwnProperty('text/html')||e.defineMIME('text/html',{name:'xml',htmlMode:!0})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){'use strict';function t(e,t,n){return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||'quasi'==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}e.defineMode('javascript',function(n,o){function r(e){for(var t=!1,n=!1,o;null!=(o=e.next());){if(!t){if('/'==o&&!n)return;'['==o?n=!0:n&&']'==o&&(n=!1)}t=!t&&'\\'==o}}function a(e,t,n){return Pe=e,De=n,t}function s(e,n){var o=e.next();if('"'==o||'\''==o)return n.tokenize=i(o),n.tokenize(e,n);if('.'==o&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return a('number','number');if('.'==o&&e.match('..'))return a('spread','meta');if(/[\[\]{}\(\),;\:\.]/.test(o))return a(o);if('='==o&&e.eat('>'))return a('=>','operator');if('0'==o&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),a('number','number');if('0'==o&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),a('number','number');if('0'==o&&e.eat(/b/i))return e.eatWhile(/[01]/i),a('number','number');if(/\d/.test(o))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),a('number','number');if('/'==o)return e.eat('*')?(n.tokenize=d,d(e,n)):e.eat('/')?(e.skipToEnd(),a('comment','comment')):t(e,n,1)?(r(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),a('regexp','string-2')):(e.eatWhile(Ie),a('operator','operator',e.current()));if('`'==o)return n.tokenize=l,l(e,n);if('#'==o)return e.skipToEnd(),a('error','error');if(Ie.test(o))return e.eatWhile(Ie),a('operator','operator',e.current());if(Te.test(o)){e.eatWhile(Te);var s=e.current(),p=we.propertyIsEnumerable(s)&&we[s];return p&&'.'!=n.lastType?a(p.type,p.style,s):a('variable','variable',s)}}function i(e){return function(t,n){var o=!1,r;if(Se&&'@'==t.peek()&&t.match(Ne))return n.tokenize=s,a('jsonld-keyword','meta');for(;null!=(r=t.next())&&(r!=e||o);)o=!o&&'\\'==r;return o||(n.tokenize=s),a('string','string')}}function d(e,t){for(var n=!1,o;o=e.next();){if('/'==o&&n){t.tokenize=s;break}n='*'==o}return a('comment','comment')}function l(e,t){for(var n=!1,o;null!=(o=e.next());){if(!n&&('`'==o||'$'==o&&e.eat('{'))){t.tokenize=s;break}n=!n&&'\\'==o}return a('quasi','string-2',e.current())}function p(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf('=>',e.start);if(!(0>n)){for(var o=0,r=!1,a=n-1;0<=a;--a){var i=e.string.charAt(a),s=Ae.indexOf(i);if(0<=s&&3>s){if(!o){++a;break}if(0==--o)break}else if(3<=s&&6>s)++o;else if(Te.test(i))r=!0;else{if(/["'\/]/.test(i))return;if(r&&!o){++a;break}}}r&&!o&&(t.fatArrowAt=a)}}function c(e,t,n,o,r,a){this.indented=e,this.column=t,this.type=n,this.prev=r,this.info=a,null!=o&&(this.align=o)}function u(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var o=e.context;o;o=o.prev)for(var n=o.vars;n;n=n.next)if(n.name==t)return!0}function h(e,t,n,o,r){var a=e.cc;for(Re.state=e,Re.stream=r,Re.marked=null,Re.cc=a,Re.style=t,e.lexical.hasOwnProperty('align')||(e.lexical.align=!0);;){var i=a.length?a.pop():Ee?E:S;if(i(n,o)){for(;a.length&&a[a.length-1].lex;)a.pop()();return Re.marked?Re.marked:'variable'==n&&u(e,o)?'variable-2':t}}}function m(){for(var e=arguments.length-1;0<=e;e--)Re.cc.push(arguments[e])}function g(){return m.apply(null,arguments),!0}function f(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var n=Re.state;if(Re.marked='def',n.context){if(t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;o.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function y(){Re.state.context={prev:Re.state.context,vars:Re.state.localVars},Re.state.localVars=Oe}function b(){Re.state.localVars=Re.state.context.vars,Re.state.context=Re.state.context.prev}function v(e,t){var n=function(){var n=Re.state,o=n.indented;if('stat'==n.lexical.type)o=n.lexical.indented;else for(var r=n.lexical;r&&')'==r.type&&r.align;r=r.prev)o=r.indented;n.lexical=new c(o,Re.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function x(){var e=Re.state;e.lexical.prev&&(')'==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function C(e){function t(n){return n==e?g():';'==e?m():g(t)}return t}function S(e,t){return'var'==e?g(v('vardef',t.length),X,C(';'),x):'keyword a'==e?g(v('form'),E,S,x):'keyword b'==e?g(v('form'),S,x):'{'==e?g(v('}'),j,x):';'==e?g():'if'==e?('else'==Re.state.lexical.info&&Re.state.cc[Re.state.cc.length-1]==x&&Re.state.cc.pop()(),g(v('form'),E,S,x,Z)):'function'==e?g(ae):'for'==e?g(v('form'),ee,S,x):'variable'==e?g(v('stat'),F):'switch'==e?g(v('form'),E,v('}','switch'),C('{'),j,x,x):'case'==e?g(E,C(':')):'default'==e?g(C(':')):'catch'==e?g(v('form'),y,C('('),ie,C(')'),S,x,b):'class'==e?g(v('form'),se,x):'export'==e?g(v('stat'),ce,x):'import'==e?g(v('stat'),ue,x):'module'==e?g(v('form'),Q,v('}'),C('{'),j,x,x):m(v('stat'),E,C(';'),x)}function E(e){return T(e,!1)}function k(e){return T(e,!0)}function T(e,t){if(Re.state.fatArrowAt==Re.stream.start){var n=t?P:O;if('('==e)return g(y,v(')'),H(Q,')'),x,C('=>'),n,b);if('variable'==e)return m(y,Q,C('=>'),n,b)}var o=t?A:N;return Le.hasOwnProperty(e)?g(o):'function'==e?g(ae,o):'keyword c'==e?g(t?I:w):'('==e?g(v(')'),w,be,C(')'),x,o):'operator'==e||'spread'==e?g(t?k:E):'['==e?g(v(']'),fe,x,o):'{'==e?q(U,'}',null,o):'quasi'==e?m(L,o):'new'==e?g(D(t)):g()}function w(e){return e.match(/[;\}\)\],]/)?m():m(E)}function I(e){return e.match(/[;\}\)\],]/)?m():m(k)}function N(e,t){return','==e?g(E):A(e,t,!1)}function A(e,t,n){var o=!1==n?N:A,r=!1==n?E:k;return'=>'==e?g(y,n?P:O,b):'operator'==e?/\+\+|--/.test(t)?g(o):'?'==t?g(E,C(':'),r):g(r):'quasi'==e?m(L,o):';'==e?void 0:'('==e?q(k,')','call',o):'.'==e?g(B,o):'['==e?g(v(']'),w,C(']'),x,o):void 0}function L(e,t){return'quasi'==e?'${'==t.slice(t.length-2)?g(E,R):g(L):m()}function R(e){if('}'==e)return Re.marked='string-2',Re.state.tokenize=l,g(L)}function O(e){return p(Re.stream,Re.state),m('{'==e?S:E)}function P(e){return p(Re.stream,Re.state),m('{'==e?S:k)}function D(e){return function(t){return'.'==t?g(e?M:_):m(e?k:E)}}function _(e,t){if('target'==t)return Re.marked='keyword',g(N)}function M(e,t){if('target'==t)return Re.marked='keyword',g(A)}function F(e){return':'==e?g(x,S):m(N,C(';'),x)}function B(e){if('variable'==e)return Re.marked='property',g()}function U(e,t){return'variable'==e||'keyword'==Re.style?(Re.marked='property','get'==t||'set'==t?g(V):g(W)):'number'==e||'string'==e?(Re.marked=Se?'property':Re.style+' property',g(W)):'jsonld-keyword'==e?g(W):'modifier'==e?g(U):'['==e?g(E,C(']'),W):'spread'==e?g(E):void 0}function V(e){return'variable'==e?(Re.marked='property',g(ae)):m(W)}function W(e){return':'==e?g(k):'('==e?m(ae):void 0}function H(e,t){function n(o){if(','==o){var r=Re.state.lexical;return'call'==r.info&&(r.pos=(r.pos||0)+1),g(e,n)}return o==t?g():g(C(t))}return function(o){return o==t?g():m(e,n)}}function q(e,t,n){for(var o=3;o!?|~^]/,Ne=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ae='([{}])',Le={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0},Re={state:null,column:null,marked:null,cc:null},Oe={name:'this',next:{name:'arguments'}},Pe,De;return x.lex=!0,{startState:function(e){var t={tokenize:s,lastType:'sof',cc:[],lexical:new c((e||0)-xe,0,'block',!1),localVars:o.localVars,context:o.localVars&&{vars:o.localVars},indented:e||0};return o.globalVars&&'object'==typeof o.globalVars&&(t.globalVars=o.globalVars),t},token:function(e,t){if(e.sol()&&(!t.lexical.hasOwnProperty('align')&&(t.lexical.align=!1),t.indented=e.indentation(),p(e,t)),t.tokenize!=d&&e.eatSpace())return null;var n=t.tokenize(e,t);return'comment'==Pe?n:(t.lastType='operator'==Pe&&('++'==De||'--'==De)?'incdec':Pe,h(t,n,Pe,De,e))},indent:function(t,n){if(t.tokenize==d)return e.Pass;if(t.tokenize!=s)return 0;var r=n&&n.charAt(0),a=t.lexical;if(!/^\s*else\b/.test(n))for(var l=t.cc.length-1,i;0<=l;--l)if(i=t.cc[l],i==x)a=a.prev;else if(i!=Z)break;'stat'==a.type&&'}'==r&&(a=a.prev),Ce&&')'==a.type&&'stat'==a.prev.type&&(a=a.prev);var p=a.type,c=r==p;return'vardef'==p?a.indented+('operator'==t.lastType||','==t.lastType?a.info+1:0):'form'==p&&'{'==r?a.indented:'form'==p?a.indented+xe:'stat'==p?a.indented+(ve(t,n)?Ce||xe:0):'switch'!=a.info||c||!1==o.doubleIndentSwitch?a.align?a.column+(c?0:1):a.indented+(c?0:xe):a.indented+(/^(?:case|default)\b/.test(n)?xe:2*xe)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ee?null:'/*',blockCommentEnd:Ee?null:'*/',lineComment:Ee?null:'//',fold:'brace',closeBrackets:'()[]{}\'\'""``',helperType:Ee?'json':'javascript',jsonldMode:Se,jsonMode:Ee,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];(t==E||t==k)&&e.cc.pop()}}}),e.registerHelper('wordChars','javascript',/[\w$]/),e.defineMIME('text/javascript','javascript'),e.defineMIME('text/ecmascript','javascript'),e.defineMIME('application/javascript','javascript'),e.defineMIME('application/x-javascript','javascript'),e.defineMIME('application/ecmascript','javascript'),e.defineMIME('application/json',{name:'javascript',json:!0}),e.defineMIME('application/x-json',{name:'javascript',json:!0}),e.defineMIME('application/ld+json',{name:'javascript',jsonld:!0}),e.defineMIME('text/typescript',{name:'javascript',typescript:!0}),e.defineMIME('application/typescript',{name:'javascript',typescript:!0})}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],e):e(CodeMirror)}(function(e){'use strict';function t(e){for(var t={},n=0;n*\/]/.test(n)?o(null,'select-op'):'.'==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?o('qualifier','qualifier'):/[:;{}\[\]\(\)]/.test(n)?o(null,n):'u'==n&&e.match(/rl(-prefix)?\(/)||'d'==n&&e.match('omain(')||'r'==n&&e.match('egexp(')?(e.backUp(1),t.tokenize=i,o('property','word')):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),o('property','word')):o(null,null)}function a(e){return function(t,n){for(var r=!1,a;null!=(a=t.next());){if(a==e&&!r){')'==e&&t.backUp(1);break}r=!r&&'\\'==a}return a!=e&&(r||')'==e)||(n.tokenize=null),o('string','string')}}function i(e,t){return e.next(),t.tokenize=e.match(/\s*[\"\')]/,!1)?null:a(')'),o(null,'(')}function s(e,t,n){this.type=e,this.indent=t,this.prev=n}function d(e,t,n,o){return e.context=new s(n,t.indentation()+(!1===o?0:m),e.context),n}function l(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function p(e,t,n){return N[n.context.type](e,t,n)}function c(e,t,o,r){for(var n=r||1;0','i')}function a(e,t){for(var n in e)for(var o=t[n]||(t[n]=[]),r=e[n],a=r.length-1;0<=a;a--)o.unshift(r[a])}function i(e,t){for(var n=0,r;n\s\/]/.test(o.current())&&(u=a.htmlState.tagName&&a.htmlState.tagName.toLowerCase())&&p.hasOwnProperty(u))a.inTag=u+' ';else if(a.inTag&&c&&/>$/.test(o.current())){var h=/^([\S]+) (.*)/.exec(a.inTag);a.inTag=null;var m='>'==o.current()&&i(p[h[1]],h[2]),g=e.getMode(n,m),f=r(h[1],!0),y=r(h[1],!1);a.token=function(e,n){return e.match(f,!1)?(n.token=d,n.localState=n.localMode=null,null):t(e,y,n.localMode.token(e,n.localState))},a.localMode=g,a.localState=e.startState(g,l.indent(a.htmlState,''))}else a.inTag&&(a.inTag+=o.current(),o.eol()&&(a.inTag+=' '));return s}var l=e.getMode(n,{name:'xml',htmlMode:!0,multilineTagIndentFactor:o.multilineTagIndentFactor,multilineTagIndentPastTag:o.multilineTagIndentPastTag}),p={},c=o&&o.tags,u=o&&o.scriptTypes;if(a(s,p),c&&a(c,p),u)for(var h=u.length-1;0<=h;h--)p.script.unshift(['type',u[h].matches,u[h].mode]);return{startState:function(){var e=l.startState();return{token:d,inTag:null,localMode:null,localState:null,htmlState:e}},copyState:function(t){var n;return t.localState&&(n=e.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:n,htmlState:e.copyState(l,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,n){return!t.localMode||/^\s*<\//.test(n)?l.indent(t.htmlState,n):t.localMode.indent?t.localMode.indent(t.localState,n):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}},'xml','javascript','css'),e.defineMIME('text/html','htmlmixed')}),function(e){'object'==typeof exports&&'object'==typeof module?e(require('../lib/codemirror'),require('../addon/search/searchcursor'),require('../addon/edit/matchbrackets')):'function'==typeof define&&define.amd?define(['../lib/codemirror','../addon/search/searchcursor','../addon/edit/matchbrackets'],e):e(CodeMirror)}(function(e){'use strict';function t(t,n,o){if(0>o&&0==n.ch)return t.clipPos(u(n.line-1));var r=t.getLine(n.line);if(0=r.length)return t.clipPos(u(n.line+1,0));for(var a='start',s=n.ch,d=0>o?0:r.length,l=0,i;s!=d;s+=o,l++){var p=r.charAt(0>o?s-1:s),c='_'!=p&&e.isWordChar(p)?'w':'o';if('w'==c&&p.toUpperCase()==p&&(c='W'),'start'==a)'o'!=c&&(a='in',i=c);else if('in'==a&&i!=c){if('w'==i&&'W'==c&&0>o&&s--,'W'==i&&'w'==c&&0n?o.from():o.to()})}function o(t,n){return t.isReadOnly()?e.Pass:void t.operation(function(){for(var e=t.listSelections().length,o=[],r=-1,a=0,i;a=n&&e.execCommand('goLineUp')}e.scrollTo(null,t.top-e.defaultTextHeight())},c[p[g+'Down']='scrollLineDown']=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top,'local')+1;e.getCursor().line<=n&&e.execCommand('goLineDown')}e.scrollTo(null,t.top+e.defaultTextHeight())},c[p['Shift-'+m+'L']='splitSelectionByLine']=function(e){for(var t=e.listSelections(),n=[],o=0;or.line&&i==a.line&&0==a.ch||n.push({anchor:i==r.line?r:u(i,0),head:i==a.line?a:u(i)});e.setSelections(n,0)},p['Shift-Tab']='indentLess',c[p.Esc='singleSelectionTop']=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},c[p[m+'L']='selectLine']=function(e){for(var t=e.listSelections(),n=[],o=0,r;or?o.push(d,l):o.length&&(o[o.length-1]=l),r=l}t.operation(function(){for(var e=0;et.lastLine()?t.replaceRange('\n'+i,u(t.lastLine()),null,'+swapLine'):t.replaceRange(i+'\n',u(r,0),null,'+swapLine')}t.setSelections(a),t.scrollIntoView()})},c[p[y+'Down']='swapLineDown']=function(t){if(t.isReadOnly())return e.Pass;for(var n=t.listSelections(),o=[],r=t.lastLine()+1,a=n.length-1;0<=a;a--){var i=n[a],s=i.to().line+1,d=i.from().line;0!=i.to().ch||i.empty()||s--,se.firstLine()&&e.addSelection(u(o.head.line-1,o.head.ch))})},c[p['Shift-Alt-Down']='selectLinesDownward']=function(e){e.operation(function(){for(var t=e.listSelections(),n=0,o;n',type:'keyToKey',toKeys:'h'},{keys:'',type:'keyToKey',toKeys:'l'},{keys:'',type:'keyToKey',toKeys:'k'},{keys:'',type:'keyToKey',toKeys:'j'},{keys:'',type:'keyToKey',toKeys:'l'},{keys:'',type:'keyToKey',toKeys:'h',context:'normal'},{keys:'',type:'keyToKey',toKeys:'W'},{keys:'',type:'keyToKey',toKeys:'B',context:'normal'},{keys:'',type:'keyToKey',toKeys:'w'},{keys:'',type:'keyToKey',toKeys:'b',context:'normal'},{keys:'',type:'keyToKey',toKeys:'j'},{keys:'',type:'keyToKey',toKeys:'k'},{keys:'',type:'keyToKey',toKeys:''},{keys:'',type:'keyToKey',toKeys:''},{keys:'',type:'keyToKey',toKeys:'',context:'insert'},{keys:'',type:'keyToKey',toKeys:'',context:'insert'},{keys:'s',type:'keyToKey',toKeys:'cl',context:'normal'},{keys:'s',type:'keyToKey',toKeys:'c',context:'visual'},{keys:'S',type:'keyToKey',toKeys:'cc',context:'normal'},{keys:'S',type:'keyToKey',toKeys:'VdO',context:'visual'},{keys:'',type:'keyToKey',toKeys:'0'},{keys:'',type:'keyToKey',toKeys:'$'},{keys:'',type:'keyToKey',toKeys:''},{keys:'',type:'keyToKey',toKeys:''},{keys:'',type:'keyToKey',toKeys:'j^',context:'normal'},{keys:'',type:'action',action:'toggleOverwrite',context:'insert'},{keys:'H',type:'motion',motion:'moveToTopLine',motionArgs:{linewise:!0,toJumplist:!0}},{keys:'M',type:'motion',motion:'moveToMiddleLine',motionArgs:{linewise:!0,toJumplist:!0}},{keys:'L',type:'motion',motion:'moveToBottomLine',motionArgs:{linewise:!0,toJumplist:!0}},{keys:'h',type:'motion',motion:'moveByCharacters',motionArgs:{forward:!1}},{keys:'l',type:'motion',motion:'moveByCharacters',motionArgs:{forward:!0}},{keys:'j',type:'motion',motion:'moveByLines',motionArgs:{forward:!0,linewise:!0}},{keys:'k',type:'motion',motion:'moveByLines',motionArgs:{forward:!1,linewise:!0}},{keys:'gj',type:'motion',motion:'moveByDisplayLines',motionArgs:{forward:!0}},{keys:'gk',type:'motion',motion:'moveByDisplayLines',motionArgs:{forward:!1}},{keys:'w',type:'motion',motion:'moveByWords',motionArgs:{forward:!0,wordEnd:!1}},{keys:'W',type:'motion',motion:'moveByWords',motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:'e',type:'motion',motion:'moveByWords',motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:'E',type:'motion',motion:'moveByWords',motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:'b',type:'motion',motion:'moveByWords',motionArgs:{forward:!1,wordEnd:!1}},{keys:'B',type:'motion',motion:'moveByWords',motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:'ge',type:'motion',motion:'moveByWords',motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:'gE',type:'motion',motion:'moveByWords',motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:'{',type:'motion',motion:'moveByParagraph',motionArgs:{forward:!1,toJumplist:!0}},{keys:'}',type:'motion',motion:'moveByParagraph',motionArgs:{forward:!0,toJumplist:!0}},{keys:'',type:'motion',motion:'moveByPage',motionArgs:{forward:!0}},{keys:'',type:'motion',motion:'moveByPage',motionArgs:{forward:!1}},{keys:'',type:'motion',motion:'moveByScroll',motionArgs:{forward:!0,explicitRepeat:!0}},{keys:'',type:'motion',motion:'moveByScroll',motionArgs:{forward:!1,explicitRepeat:!0}},{keys:'gg',type:'motion',motion:'moveToLineOrEdgeOfDocument',motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:'G',type:'motion',motion:'moveToLineOrEdgeOfDocument',motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:'0',type:'motion',motion:'moveToStartOfLine'},{keys:'^',type:'motion',motion:'moveToFirstNonWhiteSpaceCharacter'},{keys:'+',type:'motion',motion:'moveByLines',motionArgs:{forward:!0,toFirstChar:!0}},{keys:'-',type:'motion',motion:'moveByLines',motionArgs:{forward:!1,toFirstChar:!0}},{keys:'_',type:'motion',motion:'moveByLines',motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:'$',type:'motion',motion:'moveToEol',motionArgs:{inclusive:!0}},{keys:'%',type:'motion',motion:'moveToMatchedSymbol',motionArgs:{inclusive:!0,toJumplist:!0}},{keys:'f',type:'motion',motion:'moveToCharacter',motionArgs:{forward:!0,inclusive:!0}},{keys:'F',type:'motion',motion:'moveToCharacter',motionArgs:{forward:!1}},{keys:'t',type:'motion',motion:'moveTillCharacter',motionArgs:{forward:!0,inclusive:!0}},{keys:'T',type:'motion',motion:'moveTillCharacter',motionArgs:{forward:!1}},{keys:';',type:'motion',motion:'repeatLastCharacterSearch',motionArgs:{forward:!0}},{keys:',',type:'motion',motion:'repeatLastCharacterSearch',motionArgs:{forward:!1}},{keys:'\'',type:'motion',motion:'goToMark',motionArgs:{toJumplist:!0,linewise:!0}},{keys:'`',type:'motion',motion:'goToMark',motionArgs:{toJumplist:!0}},{keys:']`',type:'motion',motion:'jumpToMark',motionArgs:{forward:!0}},{keys:'[`',type:'motion',motion:'jumpToMark',motionArgs:{forward:!1}},{keys:']\'',type:'motion',motion:'jumpToMark',motionArgs:{forward:!0,linewise:!0}},{keys:'[\'',type:'motion',motion:'jumpToMark',motionArgs:{forward:!1,linewise:!0}},{keys:']p',type:'action',action:'paste',isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:'[p',type:'action',action:'paste',isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:']',type:'motion',motion:'moveToSymbol',motionArgs:{forward:!0,toJumplist:!0}},{keys:'[',type:'motion',motion:'moveToSymbol',motionArgs:{forward:!1,toJumplist:!0}},{keys:'|',type:'motion',motion:'moveToColumn'},{keys:'o',type:'motion',motion:'moveToOtherHighlightedEnd',context:'visual'},{keys:'O',type:'motion',motion:'moveToOtherHighlightedEnd',motionArgs:{sameLine:!0},context:'visual'},{keys:'d',type:'operator',operator:'delete'},{keys:'y',type:'operator',operator:'yank'},{keys:'c',type:'operator',operator:'change'},{keys:'>',type:'operator',operator:'indent',operatorArgs:{indentRight:!0}},{keys:'<',type:'operator',operator:'indent',operatorArgs:{indentRight:!1}},{keys:'g~',type:'operator',operator:'changeCase'},{keys:'gu',type:'operator',operator:'changeCase',operatorArgs:{toLower:!0},isEdit:!0},{keys:'gU',type:'operator',operator:'changeCase',operatorArgs:{toLower:!1},isEdit:!0},{keys:'n',type:'motion',motion:'findNext',motionArgs:{forward:!0,toJumplist:!0}},{keys:'N',type:'motion',motion:'findNext',motionArgs:{forward:!1,toJumplist:!0}},{keys:'x',type:'operatorMotion',operator:'delete',motion:'moveByCharacters',motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:'X',type:'operatorMotion',operator:'delete',motion:'moveByCharacters',motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:'D',type:'operatorMotion',operator:'delete',motion:'moveToEol',motionArgs:{inclusive:!0},context:'normal'},{keys:'D',type:'operator',operator:'delete',operatorArgs:{linewise:!0},context:'visual'},{keys:'Y',type:'operatorMotion',operator:'yank',motion:'expandToLine',motionArgs:{linewise:!0},context:'normal'},{keys:'Y',type:'operator',operator:'yank',operatorArgs:{linewise:!0},context:'visual'},{keys:'C',type:'operatorMotion',operator:'change',motion:'moveToEol',motionArgs:{inclusive:!0},context:'normal'},{keys:'C',type:'operator',operator:'change',operatorArgs:{linewise:!0},context:'visual'},{keys:'~',type:'operatorMotion',operator:'changeCase',motion:'moveByCharacters',motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:'normal'},{keys:'~',type:'operator',operator:'changeCase',context:'visual'},{keys:'',type:'operatorMotion',operator:'delete',motion:'moveByWords',motionArgs:{forward:!1,wordEnd:!1},context:'insert'},{keys:'',type:'action',action:'jumpListWalk',actionArgs:{forward:!0}},{keys:'',type:'action',action:'jumpListWalk',actionArgs:{forward:!1}},{keys:'',type:'action',action:'scroll',actionArgs:{forward:!0,linewise:!0}},{keys:'',type:'action',action:'scroll',actionArgs:{forward:!1,linewise:!0}},{keys:'a',type:'action',action:'enterInsertMode',isEdit:!0,actionArgs:{insertAt:'charAfter'},context:'normal'},{keys:'A',type:'action',action:'enterInsertMode',isEdit:!0,actionArgs:{insertAt:'eol'},context:'normal'},{keys:'A',type:'action',action:'enterInsertMode',isEdit:!0,actionArgs:{insertAt:'endOfSelectedArea'},context:'visual'},{keys:'i',type:'action',action:'enterInsertMode',isEdit:!0,actionArgs:{insertAt:'inplace'},context:'normal'},{keys:'I',type:'action',action:'enterInsertMode',isEdit:!0,actionArgs:{insertAt:'firstNonBlank'},context:'normal'},{keys:'I',type:'action',action:'enterInsertMode',isEdit:!0,actionArgs:{insertAt:'startOfSelectedArea'},context:'visual'},{keys:'o',type:'action',action:'newLineAndEnterInsertMode',isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:'normal'},{keys:'O',type:'action',action:'newLineAndEnterInsertMode',isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:'normal'},{keys:'v',type:'action',action:'toggleVisualMode'},{keys:'V',type:'action',action:'toggleVisualMode',actionArgs:{linewise:!0}},{keys:'',type:'action',action:'toggleVisualMode',actionArgs:{blockwise:!0}},{keys:'',type:'action',action:'toggleVisualMode',actionArgs:{blockwise:!0}},{keys:'gv',type:'action',action:'reselectLastSelection'},{keys:'J',type:'action',action:'joinLines',isEdit:!0},{keys:'p',type:'action',action:'paste',isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:'P',type:'action',action:'paste',isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:'r',type:'action',action:'replace',isEdit:!0},{keys:'@',type:'action',action:'replayMacro'},{keys:'q',type:'action',action:'enterMacroRecordMode'},{keys:'R',type:'action',action:'enterInsertMode',isEdit:!0,actionArgs:{replace:!0}},{keys:'u',type:'action',action:'undo',context:'normal'},{keys:'u',type:'operator',operator:'changeCase',operatorArgs:{toLower:!0},context:'visual',isEdit:!0},{keys:'U',type:'operator',operator:'changeCase',operatorArgs:{toLower:!1},context:'visual',isEdit:!0},{keys:'',type:'action',action:'redo'},{keys:'m',type:'action',action:'setMark'},{keys:'"',type:'action',action:'setRegister'},{keys:'zz',type:'action',action:'scrollToCursor',actionArgs:{position:'center'}},{keys:'z.',type:'action',action:'scrollToCursor',actionArgs:{position:'center'},motion:'moveToFirstNonWhiteSpaceCharacter'},{keys:'zt',type:'action',action:'scrollToCursor',actionArgs:{position:'top'}},{keys:'z',type:'action',action:'scrollToCursor',actionArgs:{position:'top'},motion:'moveToFirstNonWhiteSpaceCharacter'},{keys:'z-',type:'action',action:'scrollToCursor',actionArgs:{position:'bottom'}},{keys:'zb',type:'action',action:'scrollToCursor',actionArgs:{position:'bottom'},motion:'moveToFirstNonWhiteSpaceCharacter'},{keys:'.',type:'action',action:'repeatLastEdit'},{keys:'',type:'action',action:'incrementNumberToken',isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:'',type:'action',action:'incrementNumberToken',isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:'',type:'action',action:'indent',actionArgs:{indentRight:!0},context:'insert'},{keys:'',type:'action',action:'indent',actionArgs:{indentRight:!1},context:'insert'},{keys:'a',type:'motion',motion:'textObjectManipulation'},{keys:'i',type:'motion',motion:'textObjectManipulation',motionArgs:{textObjectInner:!0}},{keys:'/',type:'search',searchArgs:{forward:!0,querySrc:'prompt',toJumplist:!0}},{keys:'?',type:'search',searchArgs:{forward:!1,querySrc:'prompt',toJumplist:!0}},{keys:'*',type:'search',searchArgs:{forward:!0,querySrc:'wordUnderCursor',wholeWordOnly:!0,toJumplist:!0}},{keys:'#',type:'search',searchArgs:{forward:!1,querySrc:'wordUnderCursor',wholeWordOnly:!0,toJumplist:!0}},{keys:'g*',type:'search',searchArgs:{forward:!0,querySrc:'wordUnderCursor',toJumplist:!0}},{keys:'g#',type:'search',searchArgs:{forward:!1,querySrc:'wordUnderCursor',toJumplist:!0}},{keys:':',type:'ex'}],d=[{name:'colorscheme',shortName:'colo'},{name:'map'},{name:'imap',shortName:'im'},{name:'nmap',shortName:'nm'},{name:'vmap',shortName:'vm'},{name:'unmap'},{name:'write',shortName:'w'},{name:'undo',shortName:'u'},{name:'redo',shortName:'red'},{name:'set',shortName:'se'},{name:'set',shortName:'se'},{name:'setlocal',shortName:'setl'},{name:'setglobal',shortName:'setg'},{name:'sort',shortName:'sor'},{name:'substitute',shortName:'s',possiblyAsync:!0},{name:'nohlsearch',shortName:'noh'},{name:'yank',shortName:'y'},{name:'delmarks',shortName:'delm'},{name:'registers',shortName:'reg',excludeFromCommandHistory:!0},{name:'global',shortName:'g'}],l=t.Pos;t.Vim=function(){function i(e){e.setOption('disableInput',!0),e.setOption('showCursorWhenSelecting',!1),t.signal(e,'vim-mode-change',{mode:'normal'}),e.on('cursorActivity',tt),N(e),t.on(e.getInputField(),'paste',g(e))}function p(e){e.setOption('disableInput',!1),e.off('cursorActivity',tt),t.off(e.getInputField(),'paste',g(e)),e.state.vim=null}function c(e,n){this==t.keyMap.vim&&t.rmClass(e.getWrapperElement(),'cm-fat-cursor'),n&&n.attach==u||p(e,!1)}function u(e,n){this==t.keyMap.vim&&t.addClass(e.getWrapperElement(),'cm-fat-cursor'),n&&n.attach==u||i(e)}function h(e,n){if(n){if(this[e])return this[e];var o=m(e);if(!o)return!1;var r=t.Vim.findKey(n,o);return'function'==typeof r&&t.signal(n,'vim-keypress',o),r}}function m(e){if('\''==e.charAt(0))return e.charAt(1);var t=e.split(/-(?!$)/),n=t[t.length-1];if(1==t.length&&1==t[0].length)return!1;if(2==t.length&&'Shift'==t[0]&&1==n.length)return!1;for(var o=!1,r=0,a;r')}function g(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(B(e.getCursor(),0,1)),wt.enterInsertMode(e,{},t))}),t.onPasteFn}function f(t,n){for(var o=[],r=t;r=e.firstLine()&&t<=e.lastLine()}function b(e){return /^[a-z]$/.test(e)}function v(e){return-1!='()[]{}'.indexOf(e)}function x(e){return pt.test(e)}function C(e){return /^[A-Z]$/.test(e)}function S(e){return /^\s*$/.test(e)}function E(e,t){for(var n=0;n'==t.slice(-11)){var n=t.length-11,o=e.slice(0,n),r=t.slice(0,n);return o==r&&e.length>n?'full':0==r.indexOf(o)&&'partial'}return e==t?'full':0==t.indexOf(e)&&'partial'}function H(e){var t=/^.*(<[\w\-]+>)$/.exec(e),n=t?t[1]:e.slice(-1);if(1':n='\n';break;case'':n=' ';break;default:}return n}function q(e,t,n){return function(){for(var o=0;op?u:0,m=r[h].anchor,g=a(m.line,i.line),f=o(m.line,i.line),y=m.ch,b=i.ch,v=r[h].head.ch-y,x=b-y;0=x?(y++,!s&&b--):0>v&&0<=x?(y--,!c&&b++):0>v&&-1==x&&(y--,b++);for(var C=g,S;C<=f;C++)S={anchor:new l(C,y),head:new l(C,b)},n.push(S);return p=i.line==f?n.length-1:0,e.setSelections(n),t.ch=b,m.ch=y,m}function te(e,t,n){for(var o=[],r=0,a;ru&&(s.line=u),s.ch=Y(e,s.line)}else s.ch=0,d.ch=Y(e,d.line);return{ranges:[{anchor:d,head:s}],primary:0}}if('block'==n){for(var h=a(d.line,s.line),m=a(d.ch,s.ch),g=o(d.line,s.line),f=o(d.ch,s.ch)+1,y=g-h+1,b=s.line==h?0:y-1,v=[],x=0;x=i.length)return null;o?d=ut[0]:(d=ct[0],!d(i.charAt(s))&&(d=ct[1]));for(var p=s,c=s;d(i.charAt(p))&&pc&&!f?f=!0:r=!1,u=d;u>p&&(r&&a(u)!=f&&u!=d||!s(u,-1,!0));u--);return i=new l(u,0),{start:i,end:h}}function ke(e,t,n,o){var r=t,a={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[n],i={"(":'(',")":'(',"[":'[',"]":'[',"{":'{',"}":'{'}[n],s=e.getLine(r.line).charAt(r.ch),d=s===i?1:0,p,c;if(p=e.scanForBracket(l(r.line,r.ch+d),-1,null,{bracketRegex:a}),c=e.scanForBracket(l(r.line,r.ch+d),1,null,{bracketRegex:a}),!p||!c)return{start:r,end:r};if(p=p.pos,c=c.pos,p.line==c.line&&p.ch>c.ch||p.line>c.line){var u=p;p=c,c=u}return o?c.ch+=1:p.ch+=1,{start:p,end:c}}function Te(e,t,n,o){var r=j(t),a=e.getLine(r.line),s=a.split(''),d=s.indexOf(n),p,c,u,i;if(r.ch'+t+'',{bottom:!0,duration:5e3}):alert(t)}function Me(e,t){var n=''+(e||'')+'';return t&&(n+=' '+t+''),n}function Fe(e,t){var n=(t.prefix||'')+' '+(t.desc||''),o=Me(t.prefix,t.desc);Ne(e,o,n,t.onClose,t)}function Be(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var n=['global','multiline','ignoreCase','source'],o=0,r;o=t&&e<=n:e==t}function ze(e){var t=e.getScrollInfo(),n=e.coordsChar({left:0,top:6+t.top},'local'),o=t.clientHeight-10+t.top,r=e.coordsChar({left:0,top:o},'local');return{top:n.line,bottom:r.line}}function Ke(e,t,n){if('\''==n){var o=e.doc.history.done,r=o[o.length-2];return r&&r.ranges&&r.ranges[0].head}var a=t.marks[n];return a&&a.find()}function Ge(e,n,o,r,a,i,s,d,l){function p(){e.operation(function(){for(;!m;)c(),u();h()})}function c(){var t=e.getRange(i.from(),i.to()),n=t.replace(s,d);i.replace(n)}function u(){for(;i.findNext()&&je(i.from(),r,a);)if(o||!g||i.from().line!=g.line)return e.scrollIntoView(i.from(),30),e.setSelection(i.from(),i.to()),g=i.from(),void(m=!1);m=!0}function h(t){if(t&&t(),e.focus(),g){e.setCursor(g);var n=e.state.vim;n.exMode=!1,n.lastHPos=n.lastHSPos=g.ch}l&&l()}e.state.vim.exMode=!0;var m=!1,g=i.from();return u(),m?void _e(e,'No matches for '+s.source):n?void Fe(e,{prefix:'replace with '+d+' (y/n/a/q/l)',onKeyDown:function(n,o,r){t.e_stop(n);var a=t.keyName(n);switch(a){case'Y':c(),u();break;case'N':u();break;case'A':var i=l;l=void 0,e.operation(p),l=i;break;case'L':c();case'Q':case'Esc':case'Ctrl-C':case'Ctrl-[':h(r);}return m&&h(r),!0}}):(p(),void(l&&l()))}function Xe(e){var n=e.state.vim,o=Ct.macroModeState,r=Ct.registerController.getRegister('.'),a=o.isPlaying,s=o.lastInsertModeChanges,d=[];if(!a){for(var l=s.inVisualBlock?n.lastSelection.visualBlock.height:1,p=s.changes,d=[],c=0;c|<\w+>|./.exec(i),c=p[0],i=i.substring(p.index+c.length),t.Vim.handleKey(e,c,'macro'),n.insertMode){var u=a.insertModeChanges[d++].changes;Ct.macroModeState.lastInsertModeChanges.changes=u,st(e,u,1),Xe(e)}o.isPlaying=!1}function Je(e,t){if(!e.isPlaying){var n=e.latestRegister,o=Ct.registerController.getRegister(n);o&&o.pushText(t)}}function $e(e){if(!e.isPlaying){var t=e.latestRegister,n=Ct.registerController.getRegister(t);n&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)}}function Ze(e,t){if(!e.isPlaying){var n=e.latestRegister,o=Ct.registerController.getRegister(n);o&&o.pushSearchQuery&&o.pushSearchQuery(t)}}function et(e,t){var n=Ct.macroModeState,o=n.lastInsertModeChanges;if(!n.isPlaying)for(;t;){if(o.expectCursorActivityForChange=!0,'+input'==t.origin||'paste'==t.origin||void 0===t.origin){var r=t.text.join('\n');o.maybeReset&&(o.changes=[],o.maybeReset=!1),o.changes.push(r)}t=t.next}}function tt(e){var t=e.state.vim;if(t.insertMode){var n=Ct.macroModeState;if(n.isPlaying)return;var o=n.lastInsertModeChanges;o.expectCursorActivityForChange?o.expectCursorActivityForChange=!1:o.maybeReset=!0}else e.curOp.isVimOp||ot(e,t);t.visualMode&&nt(e)}function nt(e){var t=e.state.vim,n=M(e,j(t.sel.head)),o=B(n,0,1);t.fakeCursor&&t.fakeCursor.clear(),t.fakeCursor=e.markText(n,o,{className:'cm-animate-fat-cursor'})}function ot(e,n){var o=e.getCursor('anchor'),r=e.getCursor('head');if(n.visualMode&&!e.somethingSelected()?le(e,!1):!n.visualMode&&!n.insertMode&&e.somethingSelected()&&(n.visualMode=!0,n.visualLine=!1,t.signal(e,'vim-mode-change',{mode:'visual'})),n.visualMode){var a=K(r,o)?0:-1,i=K(r,o)?-1:0;r=B(r,0,a),o=B(o,0,i),n.sel={anchor:o,head:r},Ce(e,n,'<',G(r,o)),Ce(e,n,'>',X(r,o))}else n.insertMode||(n.lastHPos=e.getCursor().ch)}function rt(e){this.keyName=e}function at(n){var e=Ct.macroModeState,o=e.lastInsertModeChanges,r=t.keyName(n);r&&(-1==r.indexOf('Delete')&&-1==r.indexOf('Backspace')||t.lookupKey(r,'vim-insert',function(){return o.maybeReset&&(o.changes=[],o.maybeReset=!1),o.changes.push(new rt(r)),!0}))}function it(e,t,n,o){function r(){d?Et.processAction(e,t,t.lastEditActionCommand):Et.evalInput(e,t)}function a(n){if(0']),yt=[].concat(ht,mt,gt,['-','"','.',':','/']),bt={};k('filetype',void 0,'string',['ft'],function(e,t){if(void 0!==t){if(void 0===e){var n=t.getOption('mode');return'null'==n?'':n}var n=''==e?'null':e;t.setOption('mode',n)}});var vt=function(){var e=100,t=-1,n=0,o=0,r=Array(e);return{cachedCursor:void 0,add:function(a,i,s){function d(n){var o=++t%e,i=r[o];i&&i.clear(),r[o]=a.setBookmark(n)}var l=t%e,p=r[l];if(p){var c=p.find();c&&!z(c,i)&&d(i)}else d(i);d(s),n=t,o=t-e+1,0>o&&(o=0)},move:function(a,i){t+=i,t>n?t=n:to)}return s}}},xt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};I.prototype={exitMacroRecordMode:function(){var e=Ct.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var n=Ct.registerController.getRegister(t);n&&(n.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog('(recording)['+t+']',null,{bottom:!0})),this.isRecording=!0)}};var Ct,St;L.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},L.prototype.getRepeat=function(){var e=0;return(0=n.length?(this.iterator=n.length,this.initialPrefix):0>r?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);-1'==i.keys.slice(-11)&&(n.selectedCharacter=H(e)),{type:'full',command:i}},processCommand:function(e,t,n){switch(t.inputState.repeatOverride=n.repeatOverride,n.type){case'motion':this.processMotion(e,t,n);break;case'operator':this.processOperator(e,t,n);break;case'operatorMotion':this.processOperatorMotion(e,t,n);break;case'action':this.processAction(e,t,n);break;case'search':this.processSearch(e,t,n);break;case'ex':case'keyToEx':this.processEx(e,t,n);break;default:}},processMotion:function(e,t,n){t.inputState.motion=n.motion,t.inputState.motionArgs=F(n.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,n){var o=t.inputState;if(o.operator){if(o.operator==n.operator)return o.motion='expandToLine',o.motionArgs={linewise:!0},void this.evalInput(e,t);R(e)}o.operator=n.operator,o.operatorArgs=F(n.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,n){var o=t.visualMode,r=F(n.operatorMotionArgs);r&&o&&r.visualLine&&(t.visualLine=!0),this.processOperator(e,t,n),o||this.processMotion(e,t,n)},processAction:function(e,t,n){var o=t.inputState,r=o.getRepeat(),a=F(n.actionArgs)||{};o.selectedCharacter&&(a.selectedCharacter=o.selectedCharacter),n.operator&&this.processOperator(e,t,n),n.motion&&this.processMotion(e,t,n),(n.motion||n.operator)&&this.evalInput(e,t),a.repeat=r||1,a.repeatIsExplicit=!!r,a.registerName=o.registerName,R(e),t.lastMotion=null,n.isEdit&&this.recordLastEdit(t,o,n),wt[n.action](e,a,t)},processSearch:function(n,e,o){function r(t,r,a){Ct.searchHistoryController.pushInput(t),Ct.searchHistoryController.reset();try{Ue(n,t,r,a)}catch(o){return _e(n,'Invalid regex: '+t),void R(n)}Et.processMotion(n,e,{type:'motion',motion:'findNext',motionArgs:{forward:!0,toJumplist:o.searchArgs.toJumplist}})}function i(e){n.scrollTo(h.left,h.top),r(e,!0,!0);var t=Ct.macroModeState;t.isRecording&&Ze(t,e)}function s(o,e,r){var i=t.keyName(o),s,d;'Up'==i||'Down'==i?(s='Up'==i,d=o.target?o.target.selectionEnd:0,e=Ct.searchHistoryController.nextMatch(e,s)||'',r(e),d&&o.target&&(o.target.selectionEnd=o.target.selectionStart=a(d,o.target.value.length))):'Left'!=i&&'Right'!=i&&'Ctrl'!=i&&'Alt'!=i&&'Shift'!=i&&Ct.searchHistoryController.reset();var p;try{p=Ue(n,e,!0,!0)}catch(t){}p?n.scrollIntoView(He(n,!l,p),30):(qe(n),n.scrollTo(h.left,h.top))}function d(o,e,r){var a=t.keyName(o);'Esc'==a||'Ctrl-C'==a||'Ctrl-['==a||'Backspace'==a&&''==e?(Ct.searchHistoryController.pushInput(e),Ct.searchHistoryController.reset(),Ue(n,u),qe(n),n.scrollTo(h.left,h.top),t.e_stop(o),R(n),r(),n.focus()):'Up'==a||'Down'==a?t.e_stop(o):'Ctrl-U'==a&&(t.e_stop(o),r(''))}if(n.getSearchCursor){var l=o.searchArgs.forward,p=o.searchArgs.wholeWordOnly;Ie(n).setReversed(!l);var c=l?'/':'?',u=Ie(n).getQuery(),h=n.getScrollInfo();switch(o.searchArgs.querySrc){case'prompt':var m=Ct.macroModeState;if(m.isPlaying){var g=m.replaySearchQueries.shift();r(g,!0,!1)}else Fe(n,{onClose:i,prefix:c,desc:Rt,onKeyUp:s,onKeyDown:d});break;case'wordUnderCursor':var f=he(n,!1,!0,!1,!0),y=!0;if(f||(f=he(n,!1,!0,!1,!1),y=!1),!f)return;var g=n.getLine(f.start.line).substring(f.start.ch,f.end.ch);g=y&&p?'\\b'+g+'\\b':$(g),Ct.jumpList.cachedCursor=n.getCursor(),n.setCursor(f.start),r(g,!0,!1);}}},processEx:function(n,e,o){function r(e){Ct.exCommandHistoryController.pushInput(e),Ct.exCommandHistoryController.reset(),Dt.processCommand(n,e)}function i(o,e,r){var i=t.keyName(o),s,d;('Esc'==i||'Ctrl-C'==i||'Ctrl-['==i||'Backspace'==i&&''==e)&&(Ct.exCommandHistoryController.pushInput(e),Ct.exCommandHistoryController.reset(),t.e_stop(o),R(n),r(),n.focus()),'Up'==i||'Down'==i?(t.e_stop(o),s='Up'==i,d=o.target?o.target.selectionEnd:0,e=Ct.exCommandHistoryController.nextMatch(e,s)||'',r(e),d&&o.target&&(o.target.selectionEnd=o.target.selectionStart=a(d,o.target.value.length))):'Ctrl-U'==i?(t.e_stop(o),r('')):'Left'!=i&&'Right'!=i&&'Ctrl'!=i&&'Alt'!=i&&'Shift'!=i&&Ct.exCommandHistoryController.reset()}'keyToEx'==o.type?Dt.processCommand(n,o.exArgs.input):e.visualMode?Fe(n,{onClose:r,prefix:':',value:'\'<,\'>',onKeyDown:i}):Fe(n,{onClose:r,prefix:':',onKeyDown:i})},evalInput:function(e,t){var o=t.inputState,r=o.motion,a=o.motionArgs||{},s=o.operator,d=o.operatorArgs||{},p=o.registerName,c=t.sel,u=j(t.visualMode?M(e,c.head):e.getCursor('head')),h=j(t.visualMode?M(e,c.anchor):e.getCursor('anchor')),m=j(u),g=j(h),f,y,b;if(s&&this.recordLastEdit(t,o),b=void 0===o.repeatOverride?o.getRepeat():o.repeatOverride,0',K(y,f)?f:y)):!s&&(f=M(e,f),e.setCursor(f.line,f.ch))}if(s){if(d.lastSel){y=g;var S=d.lastSel,E=n(S.head.line-S.anchor.line),k=n(S.head.ch-S.anchor.ch);f=S.visualLine?l(g.line+E,g.ch):S.visualBlock?l(g.line+E,g.ch+k):S.head.line==S.anchor.line?l(g.line,g.ch+k):l(g.line+E,g.ch),t.visualMode=!0,t.visualLine=S.visualLine,t.visualBlock=S.visualBlock,c=t.sel={anchor:y,head:f},ie(e)}else t.visualMode&&(d.lastSel={anchor:j(c.anchor),head:j(c.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var T,w,I,N,A;if(!t.visualMode){if(T=j(y||g),w=j(f||m),K(w,T)){var L=T;T=w,w=L}I=a.linewise||d.linewise,I?ce(e,T,w):a.forward&&pe(e,T,w),N='char';var O=!a.inclusive||I;A=se(e,{anchor:T,head:w},N,O)}else if(T=G(c.head,c.anchor),w=X(c.head,c.anchor),I=t.visualLine||d.linewise,N=t.visualBlock?'block':I?'line':'char',A=se(e,{anchor:T,head:w},N),I){var P=A.ranges;if('block'==N)for(var D=0;Dp&&r.line==p?this.moveToEol(e,t,n,o):(n.toFirstChar&&(a=ue(e.getLine(s)),o.lastHPos=a),o.lastHSPos=e.charCoords(l(s,a),'div').left,l(s,a))},moveByDisplayLines:function(e,t,n,o){var r=t;switch(o.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:o.lastHSPos=e.charCoords(r,'div').left;}var a=n.repeat,i=e.findPosV(r,n.forward?a:-a,'line',o.lastHSPos);if(i.hitSide)if(n.forward)var s=e.charCoords(i,'div'),d={top:s.top+8,left:o.lastHSPos},i=e.coordsChar(d,'div');else{var p=e.charCoords(l(e.firstLine(),0),'div');p.left=o.lastHSPos,i=e.coordsChar(p,'div')}return o.lastHPos=i.ch,i},moveByPage:function(e,t,n){var o=n.repeat;return e.findPosV(t,n.forward?o:-o,'page')},moveByParagraph:function(e,t,n){var o=n.forward?1:-1;return Ee(e,t,n.repeat,o)},moveByScroll:function(e,t,n,o){var r=e.getScrollInfo(),a=null,i=n.repeat;i||(i=r.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,'local');n.repeat=i;var a=kt.moveByDisplayLines(e,t,n,o);if(!a)return null;var d=e.charCoords(a,'local');return e.scrollTo(null,r.top+d.top-s.top),a},moveByWords:function(e,t,n){return be(e,t,n.repeat,!!n.forward,!!n.wordEnd,!!n.bigWord)},moveTillCharacter:function(e,t,n){var o=n.repeat,r=ve(e,o,n.forward,n.selectedCharacter),a=n.forward?-1:1;return(ge(a,n),!r)?null:(r.ch+=a,r)},moveToCharacter:function(e,t,n){var o=n.repeat;return ge(0,n),ve(e,o,n.forward,n.selectedCharacter)||t},moveToSymbol:function(e,t,n){var o=n.repeat;return fe(e,o,n.forward,n.selectedCharacter)||t},moveToColumn:function(e,t,n,o){var r=n.repeat;return o.lastHPos=r-1,o.lastHSPos=e.charCoords(t,'div').left,xe(e,r)},moveToEol:function(e,t,n,o){o.lastHPos=Infinity;var r=l(t.line+n.repeat-1,Infinity),a=e.clipPos(r);return a.ch--,o.lastHSPos=e.charCoords(a,'div').left,r},moveToFirstNonWhiteSpaceCharacter:function(e,t){var n=t;return l(n.line,ue(e.getLine(n.line)))},moveToMatchedSymbol:function(e,t){var n=t,o=n.line,r=n.ch,a=e.getLine(o),i;do if(i=a.charAt(r++),i&&v(i)){var s=e.getTokenTypeAt(l(o,r));if('string'!==s&&'comment'!==s)break}while(i);if(i){var d=e.findMatchingBracket(l(o,r));return d.to}return n},moveToStartOfLine:function(e,t){return l(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,n){var o=n.forward?e.lastLine():e.firstLine();return n.repeatIsExplicit&&(o=n.repeat-e.getOption('firstLineNumber')),l(o,ue(e.getLine(o)))},textObjectManipulation:function(e,t,n,o){var r=n.selectedCharacter;'b'==r?r='(':'B'==r&&(r='{');var a=!n.textObjectInner,i;if({"(":')',")":'(',"{":'}',"}":'{',"[":']',"]":'['}[r])i=ke(e,t,r,a);else if({"'":!0,'"':!0}[r])i=Te(e,t,r,a);else if('W'===r)i=he(e,a,!0,!0);else if('w'===r)i=he(e,a,!0,!1);else{if('p'!==r)return null;if(i=Ee(e,t,n.repeat,0,a),n.linewise=!0,o.visualMode)o.visualLine||(o.visualLine=!0);else{var s=o.inputState.operatorArgs;s&&(s.linewise=!0),i.end.line--}}return e.state.vim.visualMode?ae(e,i.start,i.end):[i.start,i.end]},repeatLastCharacterSearch:function(e,t,n){var o=Ct.lastCharacterSearch,r=n.repeat,a=n.forward===o.forward,i=(o.increment?1:0)*(a?-1:1);e.moveH(-i,'char'),n.inclusive=!!a;var s=ve(e,r,a,o.selectedCharacter);return s?(s.ch+=i,s):(e.moveH(i,'char'),t)}},Tt={change:function(e,n,o){var r=Number.MAX_VALUE,a=e.state.vim,i,s;if(Ct.macroModeState.lastInsertModeChanges.inVisualBlock=a.visualBlock,!a.visualMode){var d=o[0].anchor,p=o[0].head;s=e.getRange(d,p);var c=a.lastEditInputState||{};if('moveByWords'==c.motion&&!S(s)){var u=/\s+$/.exec(s);u&&c.motionArgs&&c.motionArgs.forward&&(p=B(p,0,-u[0].length),s=s.slice(0,-u[0].length))}var h=new l(d.line-1,r),m=e.firstLine()==e.lastLine();p.line>e.lastLine()&&n.linewise&&!m?e.replaceRange('',h,p):e.replaceRange('',d,p),n.linewise&&(!m&&(e.setCursor(h),t.commands.newlineAndIndent(e)),d.ch=r),i=d}else{s=e.getSelection();var g=_('',o.length);e.replaceSelections(g),i=G(o[0].head,o[0].anchor)}Ct.registerController.pushText(n.registerName,'change',s,n.linewise,1p.top?(l.line+=(d-p.top)/a,l.line=Math.ceil(l.line),e.setCursor(l),p=e.charCoords(l,'local'),e.scrollTo(null,p.top)):e.scrollTo(null,d);else{var c=d+e.getScrollInfo().clientHeight;c=d.anchor.line?p=B(d.head,0,1):p=l(d.anchor.line,0);else if('inplace'==s&&i.visualMode)return;e.setOption('disableInput',!1),r&&r.replace?(e.toggleOverwrite(!0),e.setOption('keyMap','vim-replace'),t.signal(e,'vim-mode-change',{mode:'replace'})):(e.toggleOverwrite(!1),e.setOption('keyMap','vim-insert'),t.signal(e,'vim-mode-change',{mode:'insert'})),Ct.macroModeState.isPlaying||(e.on('change',et),t.on(e.getInputField(),'keydown',at)),i.visualMode&&le(e),te(e,p,c)}},toggleVisualMode:function(e,n,o){var r=n.repeat,a=e.getCursor(),i;o.visualMode?o.visualLine^n.linewise||o.visualBlock^n.blockwise?(o.visualLine=!!n.linewise,o.visualBlock=!!n.blockwise,t.signal(e,'vim-mode-change',{mode:'visual',subMode:o.visualLine?'linewise':o.visualBlock?'blockwise':''}),ie(e)):le(e):(o.visualMode=!0,o.visualLine=!!n.linewise,o.visualBlock=!!n.blockwise,i=M(e,l(a.line,a.ch+r-1),!0),o.sel={anchor:a,head:i},t.signal(e,'vim-mode-change',{mode:'visual',subMode:o.visualLine?'linewise':o.visualBlock?'blockwise':''}),ie(e),Ce(e,o,'<',G(a,i)),Ce(e,o,'>',X(a,i)))},reselectLastSelection:function(e,n,o){var r=o.lastSelection;if(o.visualMode&&re(e,o),r){var a=r.anchorMark.find(),i=r.headMark.find();if(!a||!i)return;o.sel={anchor:a,head:i},o.visualMode=!0,o.visualLine=r.visualLine,o.visualBlock=r.visualBlock,ie(e),Ce(e,o,'<',G(a,i)),Ce(e,o,'>',X(a,i)),t.signal(e,'vim-mode-change',{mode:'visual',subMode:o.visualLine?'linewise':o.visualBlock?'blockwise':''})}},joinLines:function(e,t,n){var r,a;if(n.visualMode){if(r=e.getCursor('anchor'),a=e.getCursor('head'),K(a,r)){var s=a;a=r,r=s}a.ch=Y(e,a.line)-1}else{var d=o(t.repeat,2);r=e.getCursor(),a=M(e,l(r.line+d-1,Infinity))}for(var p=0,c=r.line;cn)return'';if(e.getOption('indentWithTabs')){var o=r(n/d);return Array(o+1).join('\t')}return Array(n+1).join(' ')});s+=m?'\n':''}if(1e.lastLine()&&e.replaceRange('\n',l(I,0));var N=Y(e,I);Np.length&&(s=p.length),d=l(a.line,s)}if('\n'==r)o.visualMode||e.replaceRange('',a,d),(t.commands.newlineAndIndentContinueComment||t.commands.newlineAndIndent)(e);else{var c=e.getRange(a,d);if(c=c.replace(/[^\n]/g,r),o.visualBlock){var u=Array(e.getOption('tabSize')+1).join(' ');c=e.getSelection(),c=c.replace(/\t/g,u).replace(/[^\n]/g,r).split('\n'),e.replaceSelections(c)}else e.replaceRange(c,a,d);o.visualMode?(a=K(i[0].anchor,i[0].head)?i[0].anchor:i[0].head,e.setCursor(a),le(e,!1)):e.setCursor(B(d,0,-1))}},incrementNumberToken:function(e,t){for(var n=e.getCursor(),o=e.getLine(n.line),r=/-?\d+/g,a,i,s,d,p;null!==(a=r.exec(o))&&(p=a[0],i=a.index,s=i+p.length,!(n.cht.args.length?void _e(e,e.getOption('theme')):void e.setOption('theme',t.args[0])},map:function(e,t,n){var o=t.args;return!o||2>o.length?void(e&&_e(e,'Invalid mapping: '+t.input)):void Dt.map(o[0],o[1],n)},imap:function(e,t){this.map(e,t,'insert')},nmap:function(e,t){this.map(e,t,'normal')},vmap:function(e,t){this.map(e,t,'visual')},unmap:function(e,t,n){var o=t.args;return!o||1>o.length?void(e&&_e(e,'No such mapping: '+t.input)):void Dt.unmap(o[0],n)},move:function(e,t){Et.processCommand(e,e.state.vim,{type:'motion',motion:'moveToLineOrEdgeOfDocument',motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var n=t.args,o=t.setCfg||{};if(!n||1>n.length)return void(e&&_e(e,'Invalid mapping: '+t.input));var r=n[0].split('='),a=r[0],i=r[1],s=!1;if('?'==a.charAt(a.length-1)){if(i)throw Error('Trailing characters: '+t.argString);a=a.substring(0,a.length-1),s=!0}void 0===i&&'no'==a.substring(0,2)&&(a=a.substring(2),i=!1);var d=bt[a]&&'boolean'==bt[a].type;if(d&&void 0==i&&(i=!0),!d&&void 0===i||s){var l=w(a,e,o);!0===l||!1===l?_e(e,' '+(l?'':'no')+a):_e(e,' '+a+'='+l)}else T(a,i,e,o)},setlocal:function(e,t){t.setCfg={scope:'local'},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:'global'},this.set(e,t)},registers:function(e,t){var n=t.args,o=Ct.registerController.registers,r='----------Registers----------

';if(!n)for(var a in o){var s=o[a].toString();s.length&&(r+='"'+a+' '+s+'
')}else{var a;n=n.join('');for(var d=0;d'}}_e(e,r)},sort:function(e,n){function o(e,t){if(s){var n;n=e,e=t,t=n}d&&(e=e.toLowerCase(),t=t.toLowerCase());var o=c&&v.exec(e),r=c&&v.exec(t);return o?(o=parseInt((o[1]+o[2]).toLowerCase(),x),r=parseInt((r[1]+r[2]).toLowerCase(),x),o-r):e');if(!d)return void _e(e,c);var h=0,m=function(){if(h=c)return void _e(n,'Invalid argument: '+o.argString.substring(i));for(var u=0,h;u<=c-p;u++)h=e(p+u),delete r.marks[h]}else return void _e(n,'Invalid argument: '+d+'-')}else delete r.marks[s]}}},Dt=new Ot;return t.keyMap.vim={attach:u,detach:c,call:h},k('insertModeEscKeysTimeout',200,'number'),t.keyMap['vim-insert']={fallthrough:['default'],attach:u,detach:c,call:h},t.keyMap['vim-replace']={Backspace:'goCharLeft',fallthrough:['vim-insert'],attach:u,detach:c,call:h},(A(),{buildKeyMap:function(){},getRegisterController:function(){return Ct.registerController},resetVimGlobalState_:A,getVimGlobalState_:function(){return Ct},maybeInitVimState_:N,suppressErrorLogging:!1,InsertModeKey:rt,map:function(e,t,n){Dt.map(e,t,n)},unmap:function(e,t){Dt.unmap(e,t)},setOption:T,getOption:w,defineOption:k,defineEx:function(e,t,n){if(!t)t=e;else if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');Pt[e]=n,Dt.commandMap_[t]={name:e,shortName:t,type:'api'}},handleKey:function(e,t,n){var o=this.findKey(e,t,n);if('function'==typeof o)return o()},findKey:function(n,e,o){function r(){var t=Ct.macroModeState;if(t.isRecording){if('q'==e)return t.exitMacroRecordMode(),R(n),!0;'mapping'!=o&&Je(t,e)}}function a(){if(''==e)return R(n),d.visualMode?le(n):d.insertMode&&Xe(n),!0}function i(o){for(var r;o;)r=/<\w+-.+?>|<\w+>|./.exec(o),e=r[0],o=o.substring(r.index+e.length),t.Vim.handleKey(n,e,'mapping')}var d=N(n),l;return l=d.insertMode?function(){if(a())return!0;for(var t=d.inputState.keyBuffer+=e,o=1==e.length,r=Et.matchCommand(t,s,d.inputState,'insert');1=e}function a(e){return 47e}function s(e){return e===Tr||e===zr}function l(t){return t&&t!==Rr&&!s(t)&&!te(t)}function c(s,l,e){l=jr(s.length,_r(0,null==l?s.length:l)),null!=e&&!0!==e||(l=u(s,l));var n=new $r(s),i;n.pos=l;for(var r=[];!n.sol();){if(i=n.peek(),h(i))r.push(i);else if(!d(i)){if(t(r,Wr)||t(r,Br)){n.pos--;continue}if(Lr(n)||!p(i))break}else if(r.pop()!==Yr.get(i))break;n.pos--}if(!r.length&&n.pos!==l){var o=s.slice(n.pos,l).replace(/^[\*\+\>\^]+/,'');return{abbreviation:o,location:l-o.length}}}function u(t,e){for(te(t.charCodeAt(e))&&e++;h(t.charCodeAt(e));)e++;return e}function t(n,t){return-1!==n.indexOf(t)}function p(e){return 64e||96e||47e||Dr.has(e)}function d(e){return e===Fr||e===Pr||e===Ir}function h(e){return e===Wr||e===Ur||e===Br}function m(n,t){return t&&(n='upper'===t?n.toUpperCase():n.toLowerCase()),n}function g(n,o){return n instanceof Jr?n:'string'==typeof n?new Jr(n,o):n&&'object'==typeof n?new Jr(n.name,n.value,n.options):void 0}function f(e){return(e+'').trim()}function y(o,t,e){return o&&e.indexOf(o)===t}function b(e){return e===ia||e===sa}function v(e){return 47e}function x(o,t,e){return t=t||65,e=e||90,(o&=-33)>=t&&o<=e}function k(e){return v(e)||x(e)}function C(e){return 32===e||9===e||160===e}function w(e){return C(e)||10===e||13===e}function A(s,t,e,n){n=n?Object.assign({},$a,n):$a;var r=s.pos;if(s.eat(t)){for(var i=1,a;!s.eof();)if(!Ca(s,n))if((a=s.next())===t)i++;else if(!(a===e))a===n.escape&&s.next();else if(! --i)return s.start=r,!0;if(s.pos=r,n.throws)throw s.error('Unable to find matching pair for '+Or(t))}return!1}function O(o){var r={};o.charCodeAt(0)===ai&&(o=o.slice(1),r.implied=!0),o.charCodeAt(o.length-1)===ii&&(o=o.slice(0,o.length-1),r.boolean=!0);var e={name:o};return Object.keys(r).length&&(e.options=r),e}function _(n){var t=n.pos;if(n.eatWhile(S))return n.start=t,!0}function S(e){return!w(e)&&!b(e)&&e!==di&&e!==li&&e!==si}function E(e){return e.start=e.pos,e.eatWhile(q),e.current()}function q(e){return k(e)||45===e||58===e||36===e||64===e||33===e||95===e||37===e}function j(d){for(var t=new aa(d.trim()),n=new Kr,r=n,i=[],o;!t.eof();)if(!((o=t.peek())!==hi)){var e=new Kr,l=i.length?T(i)[0]:r;i.push([e,l,t.pos]),r=e,t.next()}else if(o!==mi){var p=ui(t);if(r.appendChild(p),t.eof())break;switch(t.peek()){case gi:t.next();continue;case fi:t.next(),r=p;continue;case yi:for(;t.eat(yi);)r=r.parent||r;continue;}}else{var a=i.pop();if(!a)throw t.error('Unexpected ")" group end');var c=a[0];if(r=a[1],t.next(),c.repeat=ei(t))r.appendChild(c);else{for(;c.firstChild;)r.appendChild(c.firstChild);t.eat(gi)}}if(i.length)throw t.pos=i.pop()[2],t.error('Expected group close');return n}function T(e){return e[e.length-1]}function M(o){if(o.repeat&&o.repeat.count){for(var t=1,e;tn&&(n=e.index)}),-1!==n&&(a.index=n+1),e}function Ct(d,l){if(null==d)return d;for(var e=[],t=function(e,t,n,o){return null==l[n]?'':t+l[n]+o},o='',a=0,i=0,s,n;i=t.get('inlineBreak'))return!0}for(var o=0,a=d.children.length;on?0:n}function Ut(a,t){var e=a.node;if(t.enabled&&t.trigger&&e.name)for(var n=a.node.attributes.reduce(function(n,t){return t.name&&null!=t.value&&(n[t.name.toUpperCase().replace(/-/g,'_')]=t.value),n},{}),r=0,i=t.trigger.length;rt?0:t}function zt(o,t){var e=o.node;return!e.isTextOnly&&e.value&&(o.beforeText=ho.test(e.value)?o.newline+o.indent+t.indent(1):' '),o}function Vt(o,t){if(null!=o.value&&ho.test(o.value)){var e=wt(o.value),n=t.indent(1),r=e.reduce(function(n,t){return _r(n,t.length)},0);return e.map(function(o,t){return''+(t?n:'')+Xt(o,r)+' |'}).join('\n')}return o.value}function Xt(n,t){for(;n.length>4).toString(16)}function ae(e){return se(e.toString(16),2)}function se(n,t){for(;n.length=r&&(r=a,n=o)}return n}function qe(o,a){var e=o&&'object'==typeof o?o[a]:o,n=(e||'').match(/^[\w-@]+/);return n?n[0]:e}function ze(o,t){for(var e=0,n=0;en&&(t=t.slice(0,n-1).concat(t.slice(n-1).join(', ')));t.length;){var r=t.shift(),i=e.fields.shift(),o=r.length-i.length;e.string=e.string.slice(0,i.location)+r+e.string.slice(i.location+i.length);for(var a=0,s=e.fields.length;aa.length)return a;a=a.slice();var t=a.length,e=/,$/,n=0;n=3=t?Be(0,1):6=t?Be(0,2):Be(1,4);for(var r=0,i=void 0;rgn(t,o.to):0<=gn(t,o.from)&&0>=gn(t,o.to)}function gn(n,t){return n.line-t.line||n.ch-t.ch}function fn(o,t,e){return Zt(o,Object.assign({syntax:an(t),field:xa},Cn(t),e))}function yn(n,t){return en(n,Object.assign({syntax:an(t)},Cn(t)))}function bn(n,t){return t=t||t.getCursor(),c(n.getLine(t.line),t.ch,!0)}function vn(n,o){try{return{ast:yn(n,o),abbreviation:n,snippet:fn(n,o)}}catch(e){return null}}function xn(d,t,l){var n=!1,p=0,o;try{o=fn(t,d,{field:function(o,t){return void 0===t&&(t=''),n||(n=!0,p=t.length,t=ya+t),t}})}catch(e){return!1}var e=d.getLine(l.from.line),r=e.match(/^\s+/);o=cn(d,o,r&&r[0]);var a=o.length;return n&&(a=o.indexOf(ya),o=o.slice(0,a)+o.slice(a+ya.length)),d.operation(function(){d.replaceRange(o,l.from,l.to);var t=d.indexFromPos(l.from),e=d.posFromIndex(a+t);return p?d.setSelection(e,{line:e.line,ch:e.ch+p}):d.setCursor(e),!0})}function Cn(o,t){var e=o.getModeAt(t||o.getCursor()),n=o.getOption('emmet'),r=n&&n.profile;return'xml'===e.name&&(r=Object.assign({selfClosingStyle:e.configuration},r)),Object.assign({profile:r,snippets:kn(o,an(o,t))},n)}function kn(o,t){var e=o.getOption('emmet');if(e)return on(t)?e.stylesheetSnippets:e.markupSnippets}function wn(n){var t=An(n,n.getCursor());t&&_n(n,t)||(Sn(n),ln(n)&&On(n,n.getCursor()))}function An(o,t){for(var e=o.findMarksAt(t),n=0;n\^\+\(\)]/.test(o[t-r.length-1]))?r:null}function Bn(e){return e===qa||e===za}function Dn(e){return 47e}function jn(o,t,e){return t=t||65,e=e||90,(o&=-33)>=t&&o<=e}function zn(e){return Dn(e)||jn(e)}function Vn(e){return 32===e||9===e||160===e}function Gn(e){return Vn(e)||10===e||13===e}function Hn(s,t,e,n){n=n?Object.assign({},Ra,n):Ra;var r=s.pos;if(s.eat(t)){for(var i=1,a;!s.eof();)if(!Ma(s,n))if((a=s.next())===t)i++;else if(!(a===e))a===n.escape&&s.next();else if(! --i)return s.start=r,!0;if(s.pos=r,n.throws)throw s.error('Unable to find matching pair for '+Or(t))}return!1}function Xn(o,t){var e=o.pos;return o.eatWhile(t)?new Wa(o,e,o.pos):void(o.pos=e)}function Qn(e){return Ia(e)||Fa(e,Kn)}function Yn(a){var t=a.pos;if(Ma(a)){var e=a.pos,i,n;a.pos=t,a.next(),i=a.start=a.pos,a.pos=e,a.backUp(1),n=a.pos;var r=Fa(a,i,n);return a.pos=e,r}return Ia(a)||$n(a)}function Kn(e){return e!==Da&&!Jn(e)&&!Gn(e)}function Jn(e){return e===Ya||e===Ba}function $n(e){return Fa(e,Zn)}function Zn(e){return!(isNaN(e)||Bn(e)||Gn(e)||Jn(e))}function er(e){return Fa(e,tr)}function tr(e){return zn(e)||e===Ha||e===Xa||e===Va||e===Za}function nr(o,t){for(var e=o.pos,n=0;n'))},new Map),u=[o],l,n,r;!e.eof();)if(!(l=ir(e)))e.next();else if(r=lr(l),'open'===l.type)n=new La(e,'tag',l),pr(u).addChild(n),s.has(r)?n.close=sr(e,s.get(r)):function(e,t){return e.selfClosing||!p.xml&&a.has(t)}(l,r)||u.push(n);else if('close'===l.type){for(var i=u.length-1;0','/'].map(Nr)),Yr=new Map().set(Fr,Wr).set(Pr,Ur).set(Ir,Br),Gr={indent:'\t',tagCase:'',attributeCase:'',attributeQuotes:'double',format:!0,formatSkip:['html'],formatForce:['body'],inlineBreak:3,compactBooleanAttributes:!1,booleanAttributes:['contenteditable','seamless','async','autofocus','autoplay','checked','controls','defer','disabled','formnovalidate','hidden','ismap','loop','multiple','muted','novalidate','readonly','required','reversed','selected','typemustmatch'],selfClosingStyle:'html',inlineElements:['a','abbr','acronym','applet','b','basefont','bdo','big','br','button','cite','code','del','dfn','em','font','i','iframe','img','input','ins','kbd','label','map','object','q','s','samp','select','small','span','strike','strong','sub','sup','textarea','tt','u','var']},Vr=function(e){this.options=Object.assign({},Gr,e),this.quoteChar='single'===this.options.attributeQuotes?'\'':'"'};Vr.prototype.get=function(e){return this.options[e]},Vr.prototype.quote=function(e){return''+this.quoteChar+(null==e?'':e)+this.quoteChar},Vr.prototype.name=function(e){return m(e,this.options.tagCase)},Vr.prototype.attribute=function(e){return m(e,this.options.attributeCase)},Vr.prototype.isBooleanAttribute=function(e){return e.options.boolean||-1!==this.get('booleanAttributes').indexOf((e.name||'').toLowerCase())},Vr.prototype.selfClose=function(){switch(this.options.selfClosingStyle){case'xhtml':return' /';case'xml':return'/';default:return'';}},Vr.prototype.indent=function(o){var t=this;o=o||0;for(var e='';o--;)e+=t.options.indent;return e},Vr.prototype.isInline=function(e){return'string'==typeof e?-1!==this.get('inlineElements').indexOf(e.toLowerCase()):null==e.name?e.isTextOnly:this.isInline(e.name)},Vr.prototype.field=function(n,t){return this.options.field(n,t)};var Xr=function(n,t){this.key=n,this.value=t},Hr=function(e){this._string=new Map,this._regexp=new Map,this._disabled=!1,this.load(e)},Zr={disabled:{}};Zr.disabled.get=function(){return this._disabled},Hr.prototype.disable=function(){this._disabled=!0},Hr.prototype.enable=function(){this._disabled=!1},Hr.prototype.set=function(o,r){var e=this;if('string'==typeof o)o.split('|').forEach(function(n){return e._string.set(n,new Xr(n,r))});else{if(!(o instanceof RegExp))throw new Error('Unknow snippet key: '+o);this._regexp.set(o,new Xr(o,r))}return this},Hr.prototype.get=function(o){var t=this;if(!this.disabled){if(this._string.has(o))return this._string.get(o);for(var e=Array.from(this._regexp.keys()),n=0,r=e.length;nt||t>this.children.length)throw new Error('Unable to insert node: position is out of child list range');var e=this.children[t-1],n=this.children[t];o.remove(),o.parent=this,this.children.splice(t,0,o),e&&(o.previous=e,e.next=o),n&&(o.next=n,n.previous=o)},Kr.prototype.removeChild=function(n){var t=this.children.indexOf(n);-1!==t&&(this.children.splice(t,1),n.previous&&(n.previous.next=n.next),n.next&&(n.next.previous=n.previous),n.parent=n.next=n.previous=null)},Kr.prototype.remove=function(){this.parent&&this.parent.removeChild(this)},Kr.prototype.clone=function(n){var o=new Kr(this.name);return o.value=this.value,o.selfClosing=this.selfClosing,this.repeat&&(o.repeat=Object.assign({},this.repeat)),this._attributes.forEach(function(e){return o.setAttribute(e.clone())}),n&&this.children.forEach(function(e){return o.appendChild(e.clone(!0))}),o},Kr.prototype.walk=function(o,t){t=t||0;for(var e=this.firstChild,n;e;){if(n=e.next,!1===o(e,t)||!1===e.walk(o,t+1))return!1;e=n}},Kr.prototype.use=function(o){for(var t=arguments,e=[this],n=1;n=this.end},aa.prototype.limit=function(n,t){return new this.constructor(this.string,n,t)},aa.prototype.peek=function(){return this.string.charCodeAt(this.pos)},aa.prototype.next=function(){if(this.pos'},lo=/^id$/i,co=/^class$/i,fo={primary:function(e){return e.join('')},secondary:function(e){return e.map(function(e){return e.isBoolean?e.name:e.name+'='+e.value}).join(', ')}},ji={open:null,close:null,omitName:/^div$/i,attributes:fo},ho=/\n|\r/,mo=/\n|\r/,go={none:'[ SECONDARY_ATTRS]',round:'[(SECONDARY_ATTRS)]',curly:'[{SECONDARY_ATTRS}]',square:'[[SECONDARY_ATTRS]'},bo=/\n|\r/,vo={html:function(o,a,e){return e=Object.assign({},e),e.comment=Object.assign({},uo,e.comment),bt(o,e.field,function(n){if(n=jt(n,a),!St(n)){var t=n.node;if(t.name){var r=a.name(t.name),i=Nt(n,a);n.open='<'+r+i+(t.selfClosing?a.selfClose():'')+'>',t.selfClosing||(n.close=''),Ut(n,e.comment)}!t.value&&(t.children.length||t.selfClosing)||(n.text=n.renderFields(t.value))}return n})},haml:function(o,a,e){e=e||{};var i={open:'[%NAME][PRIMARY_ATTRS][(SECONDARY_ATTRS)][SELF_CLOSE]',selfClose:'/',attributes:{secondary:function(e){return e.map(function(e){return e.isBoolean?e.name+(a.get('compactBooleanAttributes')?'':'=true'):e.name+'='+a.quote(e.value)}).join(' ')}}};return bt(o,e.field,function(e){if(e=It(e,a,i),e=zt(e,a),!St(e)){var t=e.node;!t.value&&(t.children.length||t.selfClosing)||(e.text=e.renderFields(Vt(t,a)))}return e})},slim:function(a,s,e){e=e||{};var t=e.attributeWrap&&go[e.attributeWrap]||go.none,n=t===go.none?function(e){return e.name+'=true'}:function(e){return e.name},i={open:'[NAME][PRIMARY_ATTRS]'+t+'[SELF_CLOSE]',selfClose:'/',attributes:{secondary:function(e){return e.map(function(e){return e.isBoolean?n(e):e.name+'='+s.quote(e.value)}).join(' ')}}};return bt(a,e.field,function(e){if(e=It(e,s,i),e=Ht(e,s),!St(e)){var t=e.node;!t.value&&(t.children.length||t.selfClosing)||(e.text=e.renderFields(Qt(t,s)))}return e})},pug:function(o,a,e){e=e||{};var i={open:'[NAME][PRIMARY_ATTRS][(SECONDARY_ATTRS)]',attributes:{secondary:function(e){return e.map(function(e){return e.isBoolean?e.name:e.name+'='+a.quote(e.value)}).join(', ')}}};return bt(o,e.field,function(e){if(e=It(e,a,i),e=Kt(e,a),!St(e)){var t=e.node;!t.value&&(t.children.length||t.selfClosing)||(e.text=e.renderFields(ee(t,a)))}return e})}},yo=function(o,t,e,a){return'object'==typeof e&&(a=e,e=null),ne(e)||(e='html'),vo[e](o,t,a)},xo=function(){this.type='css-value',this.value=[]},wo={size:{}};wo.size.get=function(){return this.value.length},xo.prototype.add=function(e){this.value.push(e)},xo.prototype.has=function(e){return-1!==this.value.indexOf(e)},xo.prototype.toString=function(){return this.value.join(' ')},Object.defineProperties(xo.prototype,wo);var ko=function(n){if(35===n.peek()){n.start=n.pos,n.next(),n.eat(116)||n.eatWhile(re);var t=n.current();if(n.start=n.pos,n.eat(46)&&!n.eatWhile(v))throw n.error('Unexpected character for alpha value of color');return new $o(t,n.current())}},$o=function(o,t){this.type='color',this.raw=o,this.alpha=+(null!=t&&''!==t?t:1),o=o.slice(1);var e=0,n=0,r=0;if('t'===o)this.alpha=0;else switch(o.length){case 0:break;case 1:e=n=r=o+o;break;case 2:e=n=r=o;break;case 3:e=o[0]+o[0],n=o[1]+o[1],r=o[2]+o[2];break;default:o+=o,e=o.slice(0,2),n=o.slice(2,4),r=o.slice(4,6);}this.r=parseInt(e,16),this.g=parseInt(n,16),this.b=parseInt(r,16)};$o.prototype.toHex=function(n){var t=n&&ie(this.r)&&ie(this.g)&&ie(this.b)?oe:ae;return'#'+t(this.r)+t(this.g)+t(this.b)},$o.prototype.toRGB=function(){var e=[this.r,this.g,this.b];return 1!==this.alpha&&e.push(this.alpha.toFixed(8).replace(/\.?0+$/,'')),(3===e.length?'rgb':'rgba')+'('+e.join(', ')+')'},$o.prototype.toString=function(e){return this.r||this.g||this.b||this.alpha?1===this.alpha?this.toHex(e):this.toRGB():'transparent'};var Co=46,Ao=45,Oo=function(n){if(n.start=n.pos,ce(n)){var t=n.current();return n.start=n.pos,n.eat(37)||n.eatWhile(le),new jo(t,n.current())}},jo=function(n,o){this.type='numeric',this.value=+n,this.unit=o||''};jo.prototype.toString=function(){return''+this.value+this.unit};var _o=45,So=function(n,t){return n.start=n.pos,n.eat(36)||n.eat(64)?n.eatWhile(pe):t?n.eatWhile(le):n.eatWhile(fe),n.start===n.pos?null:new Eo(n.current())},Eo=function(e){this.type='keyword',this.value=e};Eo.prototype.toString=function(){return this.value};var qo={throws:!0},zo=function(e){if(Ca(e,qo))return new To(e.current())},To=function(e){this.type='string',this.value=e};To.prototype.toString=function(){return this.value};var Mo=40,Ro=41,Lo=44,No=function(n,t){this.type='function',this.name=n,this.args=t||[]};No.prototype.toString=function(){return this.name+'('+this.args.join(', ')+')'};var Fo=33,Wo=36,Po=45,Uo=58,Io=64,Bo=function(a){for(var t=new Kr,e=new aa(a),n;!e.eof();){n=new Kr(ge(e)),n.value=be(e);var r=he(e);if(r)for(var i=0;isrc:m+img',"ri:t|ri:type":'pic>src:t+img',"!!!":'{}',doc:'html[lang=${lang}]>(head>meta[charset=${charset}]+meta:vp+meta:edge+title{${1:Document}})+body',"!|html:5":'!!!+doc',c:'{}',"cc:ie":'{}',"cc:noie":'{${0}}'},css:{"@f":'@font-face {\n\tfont-family: ${1};\n\tsrc: url(${1});\n}',"@ff":'@font-face {\n\tfont-family: \'${1:FontName}\';\n\tsrc: url(\'${2:FileName}.eot\');\n\tsrc: url(\'${2:FileName}.eot?#iefix\') format(\'embedded-opentype\'),\n\t\t url(\'${2:FileName}.woff\') format(\'woff\'),\n\t\t url(\'${2:FileName}.ttf\') format(\'truetype\'),\n\t\t url(\'${2:FileName}.svg#${1:FontName}\') format(\'svg\');\n\tfont-style: ${3:normal};\n\tfont-weight: ${4:normal};\n}',"@i|@import":'@import url(${0});',"@kf":'@keyframes ${1:identifier} {\n\t${2}\n}',"@m|@media":'@media ${1:screen} {\n\t${0}\n}',ac:'align-content:flex-start|flex-end|center|space-between|space-around|stretch',ai:'align-items:flex-start|flex-end|center|baseline|stretch',anim:'animation:${1:name} ${2:duration} ${3:timing-function} ${4:delay} ${5:iteration-count} ${6:direction} ${7:fill-mode}',animdel:'animation-delay:${1:time}',animdir:'animation-direction:normal|reverse|alternate|alternate-reverse',animdur:'animation-duration:${1:0}s',animfm:'animation-fill-mode:both|forwards|backwards',animic:'animation-iteration-count:1|infinite',animn:'animation-name',animps:'animation-play-state:running|paused',animtf:'animation-timing-function:linear|ease|ease-in|ease-out|ease-in-out|cubic-bezier(${1:0.1}, ${2:0.7}, ${3:1.0}, ${3:0.1})',ap:'appearance:none',as:'align-self:auto|flex-start|flex-end|center|baseline|stretch',b:'bottom',bd:'border:${1:1px} ${2:solid} ${3:#000}',bdb:'border-bottom:${1:1px} ${2:solid} ${3:#000}',bdbc:'border-bottom-color:#${1:000}',bdbi:'border-bottom-image:url(${0})',bdbk:'border-break:close',bdbli:'border-bottom-left-image:url(${0})|continue',bdblrs:'border-bottom-left-radius',bdbri:'border-bottom-right-image:url(${0})|continue',bdbrrs:'border-bottom-right-radius',bdbs:'border-bottom-style',bdbw:'border-bottom-width',bdc:'border-color:#${1:000}',bdci:'border-corner-image:url(${0})|continue',bdcl:'border-collapse:collapse|separate',bdf:'border-fit:repeat|clip|scale|stretch|overwrite|overflow|space',bdi:'border-image:url(${0})',bdl:'border-left:${1:1px} ${2:solid} ${3:#000}',bdlc:'border-left-color:#${1:000}',bdlen:'border-length',bdli:'border-left-image:url(${0})',bdls:'border-left-style',bdlw:'border-left-width',bdr:'border-right:${1:1px} ${2:solid} ${3:#000}',bdrc:'border-right-color:#${1:000}',bdri:'border-right-image:url(${0})',bdrs:'border-radius',bdrst:'border-right-style',bdrw:'border-right-width',bds:'border-style:hidden|dotted|dashed|solid|double|dot-dash|dot-dot-dash|wave|groove|ridge|inset|outset',bdsp:'border-spacing',bdt:'border-top:${1:1px} ${2:solid} ${3:#000}',bdtc:'border-top-color:#${1:000}',bdti:'border-top-image:url(${0})',bdtli:'border-top-left-image:url(${0})|continue',bdtlrs:'border-top-left-radius',bdtri:'border-top-right-image:url(${0})|continue',bdtrrs:'border-top-right-radius',bdts:'border-top-style',bdtw:'border-top-width',bdw:'border-width',bfv:'backface-visibility:hidden|visible',bg:'background:#${1:000}',bga:'background-attachment:fixed|scroll',bgbk:'background-break:bounding-box|each-box|continuous',bgc:'background-color:#${1:fff}',bgcp:'background-clip:padding-box|border-box|content-box|no-clip',bgi:'background-image:url(${0})',bgo:'background-origin:padding-box|border-box|content-box',bgp:'background-position:${1:0} ${2:0}',bgpx:'background-position-x',bgpy:'background-position-y',bgr:'background-repeat:no-repeat|repeat-x|repeat-y|space|round',bgsz:'background-size:contain|cover',bxsh:'box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} ${5:color}|none',bxsz:'box-sizing:border-box|content-box|border-box',c:'color:#${1:000}',cl:'clear:both|left|right|none',cm:'/* ${0} */',cnt:'content:\'${0}\'|normal|open-quote|no-open-quote|close-quote|no-close-quote|attr(${0})|counter(${0})|counters({$0})',coi:'counter-increment',colm:'columns',colmc:'column-count',colmf:'column-fill',colmg:'column-gap',colmr:'column-rule',colmrc:'column-rule-color',colmrs:'column-rule-style',colmrw:'column-rule-width',colms:'column-span',colmw:'column-width',cor:'counter-reset',cp:'clip:auto|rect(${1:top} ${2:right} ${3:bottom} ${4:left})',cps:'caption-side:top|bottom',cur:'cursor:pointer|auto|default|crosshair|hand|help|move|pointer|text',d:'display:block|none|flex|inline-flex|inline|inline-block|list-item|run-in|compact|table|inline-table|table-caption|table-column|table-column-group|table-header-group|table-footer-group|table-row|table-row-group|table-cell|ruby|ruby-base|ruby-base-group|ruby-text|ruby-text-group',ec:'empty-cells:show|hide',f:'font:${1:1em} ${2:sans-serif}',fef:'font-effect:none|engrave|emboss|outline',fem:'font-emphasize',femp:'font-emphasize-position:before|after',fems:'font-emphasize-style:none|accent|dot|circle|disc',ff:'font-family:serif|sans-serif|cursive|fantasy|monospace',fl:'float:left|right|none',fs:'font-style:italic|normal|oblique',fsm:'font-smoothing:antialiased|subpixel-antialiased|none',fst:'font-stretch:normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded',fv:'font-variant:normal|small-caps',fw:'font-weight:normal|bold|bolder|lighter',fx:'flex',fxb:'flex-basis:fill|max-content|min-content|fit-content|content',fxd:'flex-direction:row|row-reverse|column|column-reverse',fxf:'flex-flow',fxg:'flex-grow',fxsh:'flex-shrink',fxw:'flex-wrap:nowrap|wrap|wrap-reverse',fz:'font-size',fza:'font-size-adjust',h:'height',jc:'justify-content:flex-start|flex-end|center|space-between|space-around',l:'left',lg:'background-image:linear-gradient(${1})',lh:'line-height',lis:'list-style',lisi:'list-style-image',lisp:'list-style-position:inside|outside',list:'list-style-type:disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman',lts:'letter-spacing:normal',m:'margin',mah:'max-height',mar:'max-resolution',maw:'max-width',mb:'margin-bottom',mih:'min-height',mir:'min-resolution',miw:'min-width',ml:'margin-left',mr:'margin-right',mt:'margin-top',ol:'outline',olc:'outline-color:#${1:000}|invert',olo:'outline-offset',ols:'outline-style:none|dotted|dashed|solid|double|groove|ridge|inset|outset',olw:'outline-width|thin|medium|thick',op:'opacity',ord:'order',ori:'orientation:landscape|portrait',orp:'orphans',ov:'overflow:hidden|visible|hidden|scroll|auto',ovs:'overflow-style:scrollbar|auto|scrollbar|panner|move|marquee',ovx:'overflow-x:hidden|visible|hidden|scroll|auto',ovy:'overflow-y:hidden|visible|hidden|scroll|auto',p:'padding',pb:'padding-bottom',pgba:'page-break-after:auto|always|left|right',pgbb:'page-break-before:auto|always|left|right',pgbi:'page-break-inside:auto|avoid',pl:'padding-left',pos:'position:relative|absolute|relative|fixed|static',pr:'padding-right',pt:'padding-top',q:'quotes',qen:'quotes:\'\\201C\' \'\\201D\' \'\\2018\' \'\\2019\'',qru:'quotes:\'\\00AB\' \'\\00BB\' \'\\201E\' \'\\201C\'',r:'right',rsz:'resize:none|both|horizontal|vertical',t:'top',ta:'text-align:left|center|right|justify',tal:'text-align-last:left|center|right',tbl:'table-layout:fixed',td:'text-decoration:none|underline|overline|line-through',te:'text-emphasis:none|accent|dot|circle|disc|before|after',th:'text-height:auto|font-size|text-size|max-size',ti:'text-indent',tj:'text-justify:auto|inter-word|inter-ideograph|inter-cluster|distribute|kashida|tibetan',to:'text-outline:${1:0} ${2:0} ${3:#000}',tov:'text-overflow:ellipsis|clip',tr:'text-replace',trf:'transform:${1}|skewX(${1:angle})|skewY(${1:angle})|scale(${1:x}, ${2:y})|scaleX(${1:x})|scaleY(${1:y})|scaleZ(${1:z})|scale3d(${1:x}, ${2:y}, ${3:z})|rotate(${1:angle})|rotateX(${1:angle})|rotateY(${1:angle})|rotateZ(${1:angle})|translate(${1:x}, ${2:y})|translateX(${1:x})|translateY(${1:y})|translateZ(${1:z})|translate3d(${1:tx}, ${2:ty}, ${3:tz})',trfo:'transform-origin',trfs:'transform-style:preserve-3d',trs:'transition:${1:prop} ${2:time}',trsde:'transition-delay:${1:time}',trsdu:'transition-duration:${1:time}',trsp:'transition-property:${1:prop}',trstf:'transition-timing-function:${1:fn}',tsh:'text-shadow:${1:hoff} ${2:voff} ${3:blur} ${4:#000}',tt:'text-transform:uppercase|lowercase|capitalize|none',tw:'text-wrap:none|normal|unrestricted|suppress',us:'user-select:none',v:'visibility:hidden|visible|collapse',va:'vertical-align:top|super|text-top|middle|baseline|bottom|text-bottom|sub',w:'width',whs:'white-space:nowrap|pre|pre-wrap|pre-line|normal',whsc:'white-space-collapse:normal|keep-all|loose|break-strict|break-all',wid:'widows',wm:'writing-mode:lr-tb|lr-tb|lr-bt|rl-tb|rl-bt|tb-rl|tb-lr|bt-lr|bt-rl',wob:'word-break:normal|keep-all|break-all',wos:'word-spacing',wow:'word-wrap:none|unrestricted|suppress|break-word|normal',z:'z-index',zom:'zoom:1'}},oa={latin:{common:['lorem','ipsum','dolor','sit','amet','consectetur','adipisicing','elit'],words:['exercitationem','perferendis','perspiciatis','laborum','eveniet','sunt','iure','nam','nobis','eum','cum','officiis','excepturi','odio','consectetur','quasi','aut','quisquam','vel','eligendi','itaque','non','odit','tempore','quaerat','dignissimos','facilis','neque','nihil','expedita','vitae','vero','ipsum','nisi','animi','cumque','pariatur','velit','modi','natus','iusto','eaque','sequi','illo','sed','ex','et','voluptatibus','tempora','veritatis','ratione','assumenda','incidunt','nostrum','placeat','aliquid','fuga','provident','praesentium','rem','necessitatibus','suscipit','adipisci','quidem','possimus','voluptas','debitis','sint','accusantium','unde','sapiente','voluptate','qui','aspernatur','laudantium','soluta','amet','quo','aliquam','saepe','culpa','libero','ipsa','dicta','reiciendis','nesciunt','doloribus','autem','impedit','minima','maiores','repudiandae','ipsam','obcaecati','ullam','enim','totam','delectus','ducimus','quis','voluptates','dolores','molestiae','harum','dolorem','quia','voluptatem','molestias','magni','distinctio','omnis','illum','dolorum','voluptatum','ea','quas','quam','corporis','quae','blanditiis','atque','deserunt','laboriosam','earum','consequuntur','hic','cupiditate','quibusdam','accusamus','ut','rerum','error','minus','eius','ab','ad','nemo','fugit','officia','at','in','id','quos','reprehenderit','numquam','iste','fugiat','sit','inventore','beatae','repellendus','magnam','recusandae','quod','explicabo','doloremque','aperiam','consequatur','asperiores','commodi','optio','dolor','labore','temporibus','repellat','veniam','architecto','est','esse','mollitia','nulla','a','similique','eos','alias','dolore','tenetur','deleniti','porro','facere','maxime','corrupti']},ru:{common:['\u0434\u0430\u043B\u0435\u043A\u043E-\u0434\u0430\u043B\u0435\u043A\u043E','\u0437\u0430','\u0441\u043B\u043E\u0432\u0435\u0441\u043D\u044B\u043C\u0438','\u0433\u043E\u0440\u0430\u043C\u0438','\u0432 \u0441\u0442\u0440\u0430\u043D\u0435','\u0433\u043B\u0430\u0441\u043D\u044B\u0445','\u0438 \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u044B\u0445','\u0436\u0438\u0432\u0443\u0442','\u0440\u044B\u0431\u043D\u044B\u0435','\u0442\u0435\u043A\u0441\u0442\u044B'],words:['\u0432\u0434\u0430\u043B\u0438','\u043E\u0442 \u0432\u0441\u0435\u0445','\u043E\u043D\u0438','\u0431\u0443\u043A\u0432\u0435\u043D\u043D\u044B\u0445','\u0434\u043E\u043C\u0430\u0445','\u043D\u0430 \u0431\u0435\u0440\u0435\u0433\u0443','\u0441\u0435\u043C\u0430\u043D\u0442\u0438\u043A\u0430','\u0431\u043E\u043B\u044C\u0448\u043E\u0433\u043E','\u044F\u0437\u044B\u043A\u043E\u0432\u043E\u0433\u043E','\u043E\u043A\u0435\u0430\u043D\u0430','\u043C\u0430\u043B\u0435\u043D\u044C\u043A\u0438\u0439','\u0440\u0443\u0447\u0435\u0435\u043A','\u0434\u0430\u043B\u044C','\u0436\u0443\u0440\u0447\u0438\u0442','\u043F\u043E \u0432\u0441\u0435\u0439','\u043E\u0431\u0435\u0441\u043F\u0435\u0447\u0438\u0432\u0430\u0435\u0442','\u0435\u0435','\u0432\u0441\u0435\u043C\u0438','\u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u043C\u0438','\u043F\u0440\u0430\u0432\u0438\u043B\u0430\u043C\u0438','\u044D\u0442\u0430','\u043F\u0430\u0440\u0430\u0434\u0438\u0433\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F','\u0441\u0442\u0440\u0430\u043D\u0430','\u043A\u043E\u0442\u043E\u0440\u043E\u0439','\u0436\u0430\u0440\u0435\u043D\u043D\u044B\u0435','\u043F\u0440\u0435\u0434\u043B\u043E\u0436\u0435\u043D\u0438\u044F','\u0437\u0430\u043B\u0435\u0442\u0430\u044E\u0442','\u043F\u0440\u044F\u043C\u043E','\u0440\u043E\u0442','\u0434\u0430\u0436\u0435','\u0432\u0441\u0435\u043C\u043E\u0433\u0443\u0449\u0430\u044F','\u043F\u0443\u043D\u043A\u0442\u0443\u0430\u0446\u0438\u044F','\u043D\u0435','\u0438\u043C\u0435\u0435\u0442','\u0432\u043B\u0430\u0441\u0442\u0438','\u043D\u0430\u0434','\u0440\u044B\u0431\u043D\u044B\u043C\u0438','\u0442\u0435\u043A\u0441\u0442\u0430\u043C\u0438','\u0432\u0435\u0434\u0443\u0449\u0438\u043C\u0438','\u0431\u0435\u0437\u043E\u0440\u0444\u043E\u0433\u0440\u0430\u0444\u0438\u0447\u043D\u044B\u0439','\u043E\u0431\u0440\u0430\u0437','\u0436\u0438\u0437\u043D\u0438','\u043E\u0434\u043D\u0430\u0436\u0434\u044B','\u043E\u0434\u043D\u0430','\u043C\u0430\u043B\u0435\u043D\u044C\u043A\u0430\u044F','\u0441\u0442\u0440\u043E\u0447\u043A\u0430','\u0440\u044B\u0431\u043D\u043E\u0433\u043E','\u0442\u0435\u043A\u0441\u0442\u0430','\u0438\u043C\u0435\u043D\u0438','lorem','ipsum','\u0440\u0435\u0448\u0438\u043B\u0430','\u0432\u044B\u0439\u0442\u0438','\u0431\u043E\u043B\u044C\u0448\u043E\u0439','\u043C\u0438\u0440','\u0433\u0440\u0430\u043C\u043C\u0430\u0442\u0438\u043A\u0438','\u0432\u0435\u043B\u0438\u043A\u0438\u0439','\u043E\u043A\u0441\u043C\u043E\u043A\u0441','\u043F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0430\u043B','\u043E','\u0437\u043B\u044B\u0445','\u0437\u0430\u043F\u044F\u0442\u044B\u0445','\u0434\u0438\u043A\u0438\u0445','\u0437\u043D\u0430\u043A\u0430\u0445','\u0432\u043E\u043F\u0440\u043E\u0441\u0430','\u043A\u043E\u0432\u0430\u0440\u043D\u044B\u0445','\u0442\u043E\u0447\u043A\u0430\u0445','\u0437\u0430\u043F\u044F\u0442\u043E\u0439','\u043D\u043E','\u0442\u0435\u043A\u0441\u0442','\u0434\u0430\u043B','\u0441\u0431\u0438\u0442\u044C','\u0441\u0435\u0431\u044F','\u0442\u043E\u043B\u043A\u0443','\u043E\u043D','\u0441\u043E\u0431\u0440\u0430\u043B','\u0441\u0435\u043C\u044C','\u0441\u0432\u043E\u0438\u0445','\u0437\u0430\u0433\u043B\u0430\u0432\u043D\u044B\u0445','\u0431\u0443\u043A\u0432','\u043F\u043E\u0434\u043F\u043E\u044F\u0441\u0430\u043B','\u0438\u043D\u0438\u0446\u0438\u0430\u043B','\u0437\u0430','\u043F\u043E\u044F\u0441','\u043F\u0443\u0441\u0442\u0438\u043B\u0441\u044F','\u0434\u043E\u0440\u043E\u0433\u0443','\u0432\u0437\u043E\u0431\u0440\u0430\u0432\u0448\u0438\u0441\u044C','\u043F\u0435\u0440\u0432\u0443\u044E','\u0432\u0435\u0440\u0448\u0438\u043D\u0443','\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u044B\u0445','\u0433\u043E\u0440','\u0431\u0440\u043E\u0441\u0438\u043B','\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0439','\u0432\u0437\u0433\u043B\u044F\u0434','\u043D\u0430\u0437\u0430\u0434','\u0441\u0438\u043B\u0443\u044D\u0442','\u0441\u0432\u043E\u0435\u0433\u043E','\u0440\u043E\u0434\u043D\u043E\u0433\u043E','\u0433\u043E\u0440\u043E\u0434\u0430','\u0431\u0443\u043A\u0432\u043E\u0433\u0440\u0430\u0434','\u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A','\u0434\u0435\u0440\u0435\u0432\u043D\u0438','\u0430\u043B\u0444\u0430\u0432\u0438\u0442','\u043F\u043E\u0434\u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A','\u0441\u0432\u043E\u0435\u0433\u043E','\u043F\u0435\u0440\u0435\u0443\u043B\u043A\u0430','\u0433\u0440\u0443\u0441\u0442\u043D\u044B\u0439','\u0440\u0435\u0442\u043E\u0440\u0438\u0447\u0435\u0441\u043A\u0438\u0439','\u0432\u043E\u043F\u0440\u043E\u0441','\u0441\u043A\u0430\u0442\u0438\u043B\u0441\u044F','\u0435\u0433\u043E','\u0449\u0435\u043A\u0435','\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u043B','\u0441\u0432\u043E\u0439','\u043F\u0443\u0442\u044C','\u0434\u043E\u0440\u043E\u0433\u0435','\u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043B','\u0440\u0443\u043A\u043E\u043F\u0438\u0441\u044C','\u043E\u043D\u0430','\u043F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0434\u0438\u043B\u0430','\u043C\u043E\u0435\u0439','\u0432\u0441\u0435','\u043F\u0435\u0440\u0435\u043F\u0438\u0441\u044B\u0432\u0430\u0435\u0442\u0441\u044F','\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E','\u0440\u0430\u0437','\u0435\u0434\u0438\u043D\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0435','\u0447\u0442\u043E','\u043C\u0435\u043D\u044F','\u043E\u0441\u0442\u0430\u043B\u043E\u0441\u044C','\u044D\u0442\u043E','\u043F\u0440\u0438\u0441\u0442\u0430\u0432\u043A\u0430','\u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0439\u0441\u044F','\u0442\u044B','\u043B\u0443\u0447\u0448\u0435','\u0441\u0432\u043E\u044E','\u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0443\u044E','\u0441\u0442\u0440\u0430\u043D\u0443','\u043F\u043E\u0441\u043B\u0443\u0448\u0430\u0432\u0448\u0438\u0441\u044C','\u0440\u0443\u043A\u043E\u043F\u0438\u0441\u0438','\u043D\u0430\u0448','\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u043B','\u0441\u0432\u043E\u0439','\u043F\u0443\u0442\u044C','\u0432\u0441\u043A\u043E\u0440\u0435','\u0435\u043C\u0443','\u043F\u043E\u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043B\u0441\u044F','\u043A\u043E\u0432\u0430\u0440\u043D\u044B\u0439','\u0441\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044C','\u0440\u0435\u043A\u043B\u0430\u043C\u043D\u044B\u0445','\u0442\u0435\u043A\u0441\u0442\u043E\u0432','\u043D\u0430\u043F\u043E\u0438\u0432\u0448\u0438\u0439','\u044F\u0437\u044B\u043A\u043E\u043C','\u0440\u0435\u0447\u044C\u044E','\u0437\u0430\u043C\u0430\u043D\u0438\u0432\u0448\u0438\u0439','\u0441\u0432\u043E\u0435','\u0430\u0433\u0435\u043D\u0442\u0441\u0442\u0432\u043E','\u043A\u043E\u0442\u043E\u0440\u043E\u0435','\u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043B\u043E','\u0441\u043D\u043E\u0432\u0430','\u0441\u043D\u043E\u0432\u0430','\u0441\u0432\u043E\u0438\u0445','\u043F\u0440\u043E\u0435\u043A\u0442\u0430\u0445','\u0435\u0441\u043B\u0438','\u043F\u0435\u0440\u0435\u043F\u0438\u0441\u0430\u043B\u0438','\u0442\u043E','\u0436\u0438\u0432\u0435\u0442','\u0442\u0430\u043C','\u0434\u043E','\u0441\u0438\u0445','\u043F\u043E\u0440']},sp:{common:['mujer','uno','dolor','m\xE1s','de','poder','mismo','si'],words:['ejercicio','preferencia','perspicacia','laboral','pa\xF1o','suntuoso','molde','namibia','planeador','mirar','dem\xE1s','oficinista','excepci\xF3n','odio','consecuencia','casi','auto','chicharra','velo','elixir','ataque','no','odio','temporal','cu\xF3rum','dign\xEDsimo','facilismo','letra','nihilista','expedici\xF3n','alma','alveolar','aparte','le\xF3n','animal','como','paria','belleza','modo','natividad','justo','ataque','s\xE9quito','pillo','sed','ex','y','voluminoso','temporalidad','verdades','racional','asunci\xF3n','incidente','marejada','placenta','amanecer','fuga','previsor','presentaci\xF3n','lejos','necesariamente','sospechoso','adiposidad','quind\xEDo','p\xF3cima','voluble','d\xE9bito','sinti\xF3','accesorio','falda','sapiencia','volutas','queso','permacultura','laudo','soluciones','entero','pan','litro','tonelada','culpa','libertario','mosca','dictado','reincidente','nascimiento','dolor','escolar','impedimento','m\xEDnima','mayores','repugnante','dulce','obcecado','monta\xF1a','enigma','total','delet\xE9reo','d\xE9cima','c\xE1bala','fotograf\xEDa','dolores','molesto','olvido','paciencia','resiliencia','voluntad','molestias','magn\xEDfico','distinci\xF3n','ovni','marejada','cerro','torre','y','abogada','manantial','corporal','agua','crep\xFAsculo','ataque','desierto','laboriosamente','angustia','afortunado','alma','encefalograma','materialidad','cosas','o','renuncia','error','menos','conejo','abad\xEDa','analfabeto','remo','fugacidad','oficio','en','alm\xE1cigo','vos','pan','represi\xF3n','n\xFAmeros','triste','refugiado','trote','inventor','corchea','repelente','magma','recusado','patr\xF3n','expl\xEDcito','paloma','s\xEDndrome','inmune','autoinmune','comodidad','ley','vietnamita','demonio','tasmania','repeler','ap\xE9ndice','arquitecto','columna','yugo','computador','mula','a','prop\xF3sito','fantas\xEDa','alias','rayo','tenedor','deleznable','ventana','cara','anemia','corrupto']}},la={wordCount:30,skipCommon:!1,lang:'latin'},ca=function(o,t){t=Object.assign({},la,t);var e=oa[t.lang]||oa.latin,n=!t.skipCommon&&!Ze(o);return o.repeat||Ie(o.parent)?(o.value=He(e,t.wordCount,n),o.name=P(o.parent.name)):(o.parent.value=He(e,t.wordCount,n),o.remove()),o},fa=/^lorem([a-z]*)(\d*)$/,pa=function(o,t){var a=[na[o]||na.html];Array.isArray(t)?t.forEach(function(e){a.push('string'==typeof e?na[e]:e)}):'object'==typeof t&&a.push(t);var n=new Qr(a.filter(Boolean));return'css'!==o&&n.get(0).set(fa,$t),n},ha={lang:'en',locale:'en-US',charset:'UTF-8'},da=new Set(['css','sass','scss','less','stylus','sss']),ma={syntax:'html',field:function(n,t){return t||''},text:null,profile:null,variables:{},snippets:{},addons:null,format:null},ga=new Set(['html','xml','xsl','jsx','js','pug','slim','haml','css','sass','scss','less','sss','stylus']),ba=function(o,t){var e=o.getTokenTypeAt(t||o.getCursor());return e&&/^property\b/.test(e)},zi={html:function(n,t){return null===n.getTokenTypeAt(t||n.getCursor())},css:ba,less:ba,sass:ba,scss:ba},ya='[[::emmet-cursor::]]',xa=function(n,t){return void 0===t&&(t=''),t},Ki='emmet-abbreviation',Gi=45,Aa=function(e){return qn(e.map(function(e){return new Oa(e.key,e.value)}))},Oa=function(o,t){this.key=o,this.value=t,this.property=null;var e=t&&t.match(/^([a-z\-]+)(?:\s*:\s*([^\n\r]+))?$/);e&&(this.property=e[1],this.value=e[2]),this.dependencies=[]},ja={defaulValue:{}};Oa.prototype.addDependency=function(e){this.dependencies.push(e)},ja.defaulValue.get=function(){return null==this.value?null:Rn(this.value)[0]},Oa.prototype.keywords=function(){var d=[],n=new Set,r=0,i,t;for(this.property&&d.push(this);r=this.end},Ea.prototype.limit=function(n,t){return new this.constructor(this.string,n,t)},Ea.prototype.peek=function(){return this.string.charCodeAt(this.pos)},Ea.prototype.next=function(){if(this.pos'),Xi=function(o){var t=o.pos;if(or(o,Ja,Ka,!0)){var e=Fa(o,t);return e.type='comment',e}return null},Qi=rr(''),Ji=function(o){var t=o.pos;if(or(o,Qi,Yi,!0)){var e=Fa(o,t);return e.type='cdata',e}return null},$i={xml:!1,special:['script','style'],empty:['img','meta','link','br','base','hr','area','wbr']},Zi=function(o,t,e){this.dom=o,this.type=t,this.syntax=e};Zi.prototype.nodeForPoint=function(o,t){for(var e=this.dom.firstChild,n=null;e;)mn(cr(e),o,t)?(n=e,e=e.firstChild):e=e.nextSibling;return n};var es=function(o,r,e){null==e&&'string'==typeof o&&(e=o.length),this.string=o,this.pos=this.start=r||0,this.end=e};es.prototype.eof=function(){return this.pos>=this.end},es.prototype.limit=function(n,t){return new this.constructor(this.string,n,t)},es.prototype.peek=function(){return this.string.charCodeAt(this.pos)},es.prototype.next=function(){if(this.pos=gn(this.pos,this._sof)},t.prototype.eof=function(){return 0<=gn(this.pos,this._eof)},t.prototype.limit=function(n,o){return new this.constructor(this.editor,n,{from:n,to:o})},t.prototype.peek=function(){var o=this.pos,t=(o.line,o.ch),e=this.editor.getLine(this.pos.line);return t=this._lineLength(this.pos.line)&&(this.pos.line++,this.pos.ch=0),this.eof()&&(this.pos=Object.assign({},this._eof)),e}return NaN},t.prototype.backUp=function(a){var t=this,e=this.editor.constructor,n=this.pos,r=n.line,i=n.ch;for(i-=a||1;0<=r&&0>i;)r--,i+=t._lineLength(r);return this.pos=0>r||0>i?e.Pos(0,0):e.Pos(r,i),this.peek()},t.prototype.current=function(){return this.substring(this.start,this.pos)},t.prototype.substring=function(n,t){return this.editor.getRange(n,t)},t.prototype.error=function(n){var t=new Error(n+' at line '+this.pos.line+', column '+this.pos.ch);return t.originalMessage=n,t.pos=this.pos,t.string=this.string,t},t.prototype._lineLength=function(n){var t=n===this.editor.lastLine();return this.editor.getLine(n).length+(t?0:1)},t}(es),ns='emmet-open-tag',os='emmet-close-tag',rs={emmetExpandAbbreviation:function(a){if(a.somethingSelected())return a.constructor.Pass;var t=a.getCursor(),e=An(a,t),n=!1;if(e)n=xn(a,e.model.ast,e.find());else{var r=bn(a,t);if(r){var i={from:{line:t.line,ch:r.location},to:{line:t.line,ch:r.location+r.abbreviation.length}};n=xn(a,r.abbreviation,i)}}return Sn(a),n||a.constructor.Pass},emmetInsertLineBreak:function(d){var t=d.getCursor();if('xml'===d.getModeAt(t).name){var e=(Object.assign({},t,{ch:t.ch+1}),d.getTokenAt(t)),n=d.getTokenAt(Object.assign({},t,{ch:t.ch+1}));if('tag bracket'===e.type&&'>'===e.string&&'tag bracket'===n.type&&'t.alpha||0.5>=t.size))&&(1===A?n(t):2===A&&o(t))}function a(e,t){return t||(t=e,e=0),e+~~(Math.random()*(t-e+1))}function i(e,t){var n=!1;return function(){n||(e.apply(this,arguments),n=!0,setTimeout(function(){n=!1},t))}}function s(){h&&(O.clearRect(0,0,k,T),P=new Date().getTime(),!y&&(y=P),D=(P-y)/1e3,y=P,0=this.size-(this.bMin+p.snapOffset+this.bGutterSize)&&(e=this.size-(this.bMin+this.bGutterSize)),k.call(this,e),p.onDrag&&p.onDrag())},E=function(){var e=t.getComputedStyle(this.parent),n=this.parent[m]-parseFloat(e[b])-parseFloat(e[v]);this.size=this.a[s]()[u]+this.b[s]()[u]+this.aGutterSize+this.bGutterSize,this.percentage=Math.min(100*(this.size/n),100),this.start=this.a[s]()[f]},k=function(e){this.a.style[u]=a+'('+e/this.size*this.percentage+'% - '+this.aGutterSize+'px)',this.b.style[u]=a+'('+(this.percentage-e/this.size*this.percentage)+'% - '+this.bGutterSize+'px)'},T=function(){var e=this,t=e.a,n=e.b;t[s]()[u]n?n+1:16*n?e+6*((t-e)*n):1>2*n?t:2>3*n?e+6*((t-e)*(.66666-n)):e},c=function(t,n,o){var r,a;return a=.5>=o?o*(n+1):o+n-o*n,r=2*o-a,{r:f(r,a,t+.33333),g:f(r,a,t),b:f(r,a,t-.33333)}},x=function(t,n,o){var r,a,s,d,l,p,c;return d=C(t,n,o),l=S(t,n,o),r=d-l,c=d+l,a=l===d?0:t===d?(60*(n-o)/r+360)%360:n===d?60*(o-t)/r+120:60*(t-n)/r+240,s=c/2,p=0===s?0:1===s?1:.5>=s?r/c:r/(2-c),{h:a,s:p,l:s}},y=function(n,o,r,a){return null==a?'hsl('+m(t(180*n/s),360)+','+t(100*o)+'%,'+t(100*r)+'%)':'hsla('+m(t(180*n/s),360)+','+t(100*o)+'%,'+t(100*r)+'%,'+a+')'},u=function(t){var n,o,r,a,e,i;return i=document.createElement('span'),document.body.appendChild(i),i.style.backgroundColor=t,e=getComputedStyle(i).backgroundColor,document.body.removeChild(i),r=/^rgb\((\d+), (\d+), (\d+)\)$/.exec(e),r||(r=/^rgba\((\d+), (\d+), (\d+), ([\d.]+)\)$/.exec(e)),a=parseInt(r[1]),o=parseInt(r[2]),n=parseInt(r[3]),r[4]?{r:a/255,g:o/255,b:n/255,a:parseFloat(r[4])}:{r:a/255,g:o/255,b:n/255}},e=function(e){var t,n;return n=document.createElement('span'),document.body.appendChild(n),n.style.backgroundColor=e,t=0e&&(e+=t),e},v=function(e,t,n){return t+(n-t)*S(1,C(0,e))},p=function(){function e(f,E,b){var T,d,e,g,h,i,I,k,l,m,N,A,p,L,r,R,t,u,v,w,x;for(this.radius=f,this.width=E,this.lightness=b,L=this.radius,v=this.width,d=this.canvas=document.createElement('canvas'),d.width=d.height=2*L,e=d.getContext('2d'),N=e.createImageData(d.width,d.height),h=N.data,(x=m=0,r=d.height);0<=r?mr;x=0<=r?++m:--m)for(w=A=0,R=d.width;0<=R?AR;w=0<=R?++A:--A)I=x-L,i=w-L,g=o(I*I+i*i),g>L+1.5||(g-=10,u=C(0,S(1,g/(L-v/2-10))),l=n(I,i)/(2*s),t=c(l,u,this.lightness),p=t.r,k=t.g,T=t.b,h[4*(x*d.width+w)+0]=255*p,h[4*(x*d.width+w)+1]=255*k,h[4*(x*d.width+w)+2]=255*T,h[4*(x*d.width+w)+3]=255);e.putImageData(N,0,0)}return e.prototype.drawHSLCircle=function(t,n){var o,r,a,e;return t.width=t.height=2*this.radius,o=t.getContext('2d'),e=this.width,a=this.radius,r=v(n,e,a),o.save(),o.fillStyle='rgba(0,0,0,0.3)',o.beginPath(),o.arc(a,a,a,0,2*s),o.fill(),o.fillStyle='black',o.beginPath(),o.arc(a,a,r,0,2*s),o.arc(a,a,r-e,0,2*s,!0),o.fill(),o.globalCompositeOperation='source-in',o.drawImage(this.canvas,0,0),o.restore()},e}(),i=function(e){return'string'==typeof e&&(e=u(e)),null!=e.r&&null!=e.g&&null!=e.b?(e=x(e.r,e.g,e.b),e.h=e.h*s/180):null!=e.h&&null!=e.s&&null!=e.l&&(e.h=e.h*s/180),e},a=function(){function e(e){this.color=i(e),this.refColor=this.color,this.el=E(),this.circleContainer=this.el.appendChild(l.call(this)),this.lSlider=this.el.appendChild(b.call(this)),this.colorPreview=this.el.appendChild(f.call(this)),d.call(this),this.setLightness(this.color.l)}var d,l,f,h,b,E,T,w;return T=80,w=25,e.prototype.setHue=function(e){var n,o,r;return this.color.h=e,r=v(this.color.s,w,T)-w/2,o=T-w/2,g(this.hueKnob,{left:t(o+Math.cos(e)*r+6-1)+'px',top:t(o+Math.sin(e)*r+6-1)+'px'}),this.colorPreview.style.backgroundColor=this.lKnob.style.backgroundColor=this.hueKnob.style.backgroundColor=y(this.color.h,this.color.s,this.color.l),n=y(this.color.h,this.color.s,.5),this.lSlider.style.backgroundImage='-webkit-linear-gradient(bottom, black, '+n+' 50%, white)',this.lSlider.style.backgroundImage='-moz-linear-gradient(bottom, black, '+n+' 50%, white)',this.emit('changed')},e.prototype.setSaturation=function(e){return this.color.s=e,this.circle.drawHSLCircle(this.circleCanvas,e),this.setHue(this.color.h)},e.prototype.setLightness=function(e){return this.color.l=e,this.circle=new p(T,w,e),this.lKnob.style.top=(1-e)*this.lSlider._height-11+'px',this.setSaturation(this.color.s)},e.prototype.setHSL=function(e,t,n){return this.color.h=m(e,360)*s/180,this.color.s=C(0,S(1,t)),n=C(0,S(1,n)),this.setLightness(n)},e.prototype.getHSL=function(){return{h:m(180*this.color.h/s,360),s:this.color.s,l:this.color.l}},e.prototype.setRGB=function(t,n,o){var r,a,e,i;return e=x(t,n,o),r=e.h,i=e.s,a=e.l,this.setHSL(r,i,a)},e.prototype.getRGB=function(){return c(this.color.h/(2*s),this.color.s,this.color.l)},e.prototype.getCSS=function(){return y(this.color.h,this.color.s,this.color.l)},e.prototype.setCSS=function(t){var n,o,r,e;return e=u(t),r=e.r,o=e.g,n=e.b,this.setRGB(r,o,n)},e.prototype.on=function(e,t){var n;return null==this._listeners&&(this._listeners={}),(null==(n=this._listeners)[e]?n[e]=[]:n[e]).push(t)},e.prototype.emit=function(){var t,n,o,a,i,e,s,d;if(n=arguments[0],t=2<=arguments.length?r.call(arguments,1):[],this._listeners){for(s=null==(e=this._listeners[n])?[]:e,d=[],(o=0,i=s.length);o=7*s/8||p<=-7*s/8?t.style.cursor='ew-resize':s/8<=p&&p<3*s/8||-7*s/8HSL":'HEX24>RGB>HSL',"HEX32>HSLA":'HEX32>RGBA>HSLA',"HEX24>CMYK":'HEX24>RGB>CMY>CMYK',"RGB>CMYK":'RGB>CMY>CMYK'},i=Color.Space=function(t,n){s[n]&&(n=s[n]);var o=n.split('>');if('object'==typeof t&&0<=t[0]){for(var r=o[0],d={},l=0,p;l>0)+','+(e.G>>0)+','+(e.B>>0)+')'},i.RGBA_W3=function(e){var t='number'==typeof e.A?e.A/255:1;return'rgba('+(e.R>>0)+','+(e.G>>0)+','+(e.B>>0)+','+t+')'},i.W3_RGB=function(e){return e=e.substr(4,e.length-5).split(','),{R:parseInt(e[0],10),G:parseInt(e[1],10),B:parseInt(e[2],10)}},i.W3_RGBA=function(e){return e=e.substr(5,e.length-6).split(','),{R:parseInt(e[0],10),G:parseInt(e[1],10),B:parseInt(e[2],10),A:255*parseFloat(e[3])}},i.HSL_W3=function(e){return'hsl('+(e.H+.5>>0)+','+(e.S+.5>>0)+'%,'+(e.L+.5>>0)+'%)'},i.HSLA_W3=function(e){var t='number'==typeof e.A?e.A/255:1;return'hsla('+(e.H+.5>>0)+','+(e.S+.5>>0)+'%,'+(e.L+.5>>0)+'%,'+t+')'},i.W3_HSL=function(e){var t=e.indexOf('(')+1,n=e.indexOf(')');return e=e.substr(t,n-t).split(','),{H:parseInt(e[0],10),S:parseInt(e[1],10),L:parseInt(e[2],10)}},i.W3_HSLA=function(e){var t=e.indexOf('(')+1,n=e.indexOf(')');return e=e.substr(t,n-t).split(','),{H:parseInt(e[0],10),S:parseInt(e[1],10),L:parseInt(e[2],10),A:255*parseFloat(e[3],10)}},i.W3_HEX=i.W3_HEX24=function(e){return'#'===e.substr(0,1)&&(e=e.substr(1)),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),parseInt('0x'+e,16)},i.W3_HEX32=function(e){return'#'===e.substr(0,1)&&(e=e.substr(1)),6===e.length?parseInt('0xFF'+e,10):parseInt('0x'+e,16)},i.HEX_W3=i.HEX24_W3=function(e,t){t||(t=6),e||(e=0);var n=e.toString(16),o;for(o=n.length;ot;)n=n.substr(1),o--;return'#'+n},i.HEX32_W3=function(e){return i.HEX_W3(e,8)},i.HEX_RGB=i.HEX24_RGB=function(e){return{R:e>>16,G:255&e>>8,B:255&e}},i.HEX32_RGBA=function(e){return{R:255&e>>>16,G:255&e>>>8,B:255&e,A:e>>>24}},i.RGBA_HEX32=function(e){return(e.A<<24|e.R<<16|e.G<<8|e.B)>>>0},i.RGB_HEX24=i.RGB_HEX=function(e){return 0>e.R&&(e.R=0),0>e.G&&(e.G=0),0>e.B&&(e.B=0),255c?p/(e+d):p/(2-e-d);var i=((e-o)/6+p/2)/p,g=((e-a)/6+p/2)/p,l=((e-s)/6+p/2)/p;o===e?u=l-g:a===e?u=1/3+i-l:s===e&&(u=2/3+g-i),0>u&&(u+=1),1c&&(c+=1),1r?r*(1+o):r+o-o*r,d=2*r-l,i=n+1/3,0>i&&(i+=1),16*i?d+6*(l-d)*i:1>2*i?l:2>3*i?d+6*((l-d)*(2/3-i)):d,i=n,0>i&&(i+=1),16*i?d+6*(l-d)*i:1>2*i?l:2>3*i?d+6*((l-d)*(2/3-i)):d,i=n-1/3,0>i&&(i+=1),16*i?d+6*(l-d)*i:1>2*i?l:2>3*i?d+6*((l-d)*(2/3-i)):d),{R:255*a,G:255*e,B:255*s,A:t.A}},i.HSVA_RGBA=i.HSV_RGB=function(n){var r=n.H/360,a=n.S/100,s=n.V/100,d,l,p,c,u,i;if(0==a)d=l=p=t(255*s);else switch(1<=r&&(r=0),r=6*r,c=r-o(r),u=t(255*s*(1-a)),p=t(255*s*(1-a*c)),i=t(255*s*(1-a*(1-c))),s=t(255*s),o(r)){case 0:d=s,l=i,p=u;break;case 1:d=p,l=s,p=u;break;case 2:d=u,l=s,p=i;break;case 3:d=u,l=p,p=s;break;case 4:d=i,l=u,p=s;break;case 5:d=s,l=u,p=p;}return{R:d,G:l,B:p,A:n.A}}}(),Inlet=function(){function e(b,C){function c(){var e=d.value+'',t=N.getCursor(!0),n=w(t,'number');if(n){var o={line:t.line,ch:n.start},r={line:t.line,ch:n.end};N.dragging=!0,N.replaceRange(e,o,r)}}function S(n){if(!N.somethingSelected()){I=n.target;var a=N.getCursor(!0),d=N.getTokenAt(a);cursorOffset=N.cursorCoords(!0,'page');var l=N.cursorCoords(!0,L).left,o=w(a,'number'),p=w(a,'hsl'),r=w(a,'hex'),s=w(a,'rgb'),t=w(a,'boolean'),c=cursorOffset.top-h;cursorOffset.topHSL>RGB>HEX24>W3'),P(picked,'hex')})}else if(p){var g=p.string;e=new thistle.Picker(g),e.setCSS(g),e.presentModal(m,c),e.on('changed',function(){picked=e.getCSS(),P(picked,'hsl')})}else if(s){var g=s.string;e=new thistle.Picker(g),e.setCSS(g),e.presentModal(m,c),e.on('changed',function(){picked=e.getCSS(),picked=Color.Space(picked,'W3>HSL>RGB>W3'),P(picked,'rgb')})}}}function T(e){var t,n;return t=0===e?[-100,100]:[3*-e,5*e],t[0]=d&&t.ch<=l)return e=null,{start:d,end:l,string:a};e=o.exec(r)}}}var N=b,d,e,A;C||(C={}),C.picker||(C.picker={}),C.slider||(C.slider={}),C.clicker||(C.clicker={});var g=C.container||document.body,h=C.picker.topOffset||220,i=C.picker.bottomOffset||16,f=C.picker.topBoundary||250,k=C.picker.leftOffset||75,l=C.slider.yOffset||15,m=C.slider.xOffset||0,n=C.slider.width,L=C.horizontalMode||'page',o=C.fixedContainer,p=C.slider.callback||function(){},r=C.picker.callback||function(){},s=C.clicker.callback||function(){},t=N.getWrapperElement();t.addEventListener('mouseup',S),document.body.addEventListener('mouseup',function(e){e.target===I||e.target===v||e.target===d||e.target===u||e.target===A||(v.style.visibility='hidden',u.style.visibility='hidden')}),N.setOption('onKeyEvent',function(){if(event=1==arguments.length?arguments[0]:arguments[1],event.keyCode==y||event.keyCode==O){if('visible'===v.style.visibility)return d.stepDown(1),c(),!0;event.altKey&&S()}else if(event.keyCode==E||event.keyCode==R){if('visible'===v.style.visibility)return d.stepUp(1),c(),!0;event.altKey&&S()}else v.style.visibility='hidden'});var u=document.createElement('div');u.className='inlet_clicker',u.style.visibility='hidden',u.style.position='absolute',g.appendChild(u);var A=document.createElement('input');A.className='checkbox',A.setAttribute('type','checkbox'),A.addEventListener('change',function(){var t=A.checked+'',n=N.getCursor(!0),o=w(n,'boolean');if(o){var e={line:n.line,ch:o.start},r={line:n.line,ch:o.end};N.replaceRange(t,e,r)}}),u.appendChild(A);var v=document.createElement('div');v.className='inlet_slider',v.style.visibility='hidden',n&&(v.style.width=n),v.style.position=o?'fixed':'absolute',v.style.top=0,g.appendChild(v);var d=document.createElement('input');d.className='range',d.setAttribute('type','range'),d.addEventListener('input',c),d.addEventListener('change',c);var x=-1=a.start&&(n.unshift(a.comment),this.leading.splice(r,1),this.trailing.splice(r,1));n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e,t){var n=[];if(0=t.end.offset&&n.unshift(r.comment);return this.trailing.length=0,n}var a=this.stack[this.stack.length-1];if(a&&a.node.trailingComments){var i=a.node.trailingComments[0];i&&i.range[0]>=t.end.offset&&(n=a.node.trailingComments,delete a.node.trailingComments)}return n},e.prototype.findLeadingComments=function(e,t){for(var n=[],o,r;0=t.start.offset);)o=this.stack.pop().node;if(o){for(var a=o.leadingComments?o.leadingComments.length:0,s=a-1,i;0<=s;--s)i=o.leadingComments[s],i.range[1]<=t.start.offset&&(n.unshift(i),o.leadingComments.splice(s,1));return o.leadingComments&&0===o.leadingComments.length&&delete o.leadingComments,n}for(var s=this.leading.length-1,r;0<=s;--s)r=this.leading[s],r.start<=t.start.offset&&(n.unshift(r.comment),this.leading.splice(s,1));return n},e.prototype.visitNode=function(e,t){if(!(e.type===o.Syntax.Program&&0":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.sourceType=t&&'module'===t.sourceType?'module':'script',this.lookahead=null,this.hasLineTerminator=!1,this.context={allowIn:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:'module'===this.sourceType},this.tokens=[],this.startMarker={index:0,lineNumber:this.scanner.lineNumber,lineStart:0},this.lastMarker={index:0,lineNumber:this.scanner.lineNumber,lineStart:0},this.nextToken(),this.lastMarker={index:this.scanner.index,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n>='===e||'>>>='===e||'&='===e||'^='===e||'|='===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,o=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var r=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=o,r},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,o=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var r=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=o||this.context.firstCoverInitializedNameError,r},e.prototype.consumeSemicolon=function(){this.match(';')?this.nextToken():!this.hasLineTerminator&&(this.lookahead.type!==i.Token.EOF&&!this.match('}')&&this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.lineNumber=this.startMarker.lineNumber,this.lastMarker.lineStart=this.startMarker.lineStart)},e.prototype.parsePrimaryExpression=function(){var e=this.createNode(),t,n,o,a;switch(this.lookahead.type){case i.Token.Identifier:'module'===this.sourceType&&'await'===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),t=this.finalize(e,new l.Identifier(this.nextToken().value));break;case i.Token.NumericLiteral:case i.Token.StringLiteral:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,r.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,o=this.nextToken(),a=this.getTokenRaw(o),t=this.finalize(e,new l.Literal(o.value,a));break;case i.Token.BooleanLiteral:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,o=this.nextToken(),o.value='true'===o.value,a=this.getTokenRaw(o),t=this.finalize(e,new l.Literal(o.value,a));break;case i.Token.NullLiteral:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,o=this.nextToken(),o.value=null,a=this.getTokenRaw(o),t=this.finalize(e,new l.Literal(o.value,a));break;case i.Token.Template:t=this.parseTemplateLiteral();break;case i.Token.Punctuator:n=this.lookahead.value,'('===n?(this.context.isBindingElement=!1,t=this.inheritCoverGrammar(this.parseGroupExpression)):'['===n?t=this.inheritCoverGrammar(this.parseArrayInitializer):'{'===n?t=this.inheritCoverGrammar(this.parseObjectInitializer):'/'===n||'/='===n?(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,o=this.nextRegexToken(),a=this.getTokenRaw(o),t=this.finalize(e,new l.RegexLiteral(o.value,a,o.regex))):this.throwUnexpectedToken(this.nextToken());break;case i.Token.Keyword:!this.context.strict&&this.context.allowYield&&this.matchKeyword('yield')?t=this.parseIdentifierName():!this.context.strict&&this.matchKeyword('let')?t=this.finalize(e,new l.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword('function')?t=this.parseFunctionExpression():this.matchKeyword('this')?(this.nextToken(),t=this.finalize(e,new l.ThisExpression)):this.matchKeyword('class')?t=this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:this.throwUnexpectedToken(this.nextToken());}return t},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect('...');var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new l.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect('[');!this.match(']');)if(this.match(','))this.nextToken(),t.push(null);else if(this.match('...')){var n=this.parseSpreadElement();this.match(']')||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(',')),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match(']')||this.expect(',');return this.expect(']'),this.finalize(e,new l.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,n},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!1;var n=this.parseFormalParameters(),o=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new l.FunctionExpression(null,n.params,o,!1))},e.prototype.parseObjectPropertyKey=function(){var e=this.createNode(),t=this.nextToken(),n=null;switch(t.type){case i.Token.StringLiteral:case i.Token.NumericLiteral:this.context.strict&&t.octal&&this.tolerateUnexpectedToken(t,r.Messages.StrictOctalLiteral);var o=this.getTokenRaw(t);n=this.finalize(e,new l.Literal(t.value,o));break;case i.Token.Identifier:case i.Token.BooleanLiteral:case i.Token.NullLiteral:case i.Token.Keyword:n=this.finalize(e,new l.Identifier(t.value));break;case i.Token.Punctuator:'['===t.value?(n=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect(']')):this.throwUnexpectedToken(t);break;default:this.throwUnexpectedToken(t);}return n},e.prototype.isPropertyKey=function(e,t){return e.type===d.Syntax.Identifier&&e.name===t||e.type===d.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t=this.createNode(),n=this.lookahead,o=!1,a=!1,s=!1,d,p,c;n.type===i.Token.Identifier?(this.nextToken(),p=this.finalize(t,new l.Identifier(n.value))):this.match('*')?this.nextToken():(o=this.match('['),p=this.parseObjectPropertyKey());var u=this.qualifiedPropertyName(this.lookahead);if(n.type===i.Token.Identifier&&'get'===n.value&&u)d='get',o=this.match('['),p=this.parseObjectPropertyKey(),this.context.allowYield=!1,c=this.parseGetterMethod();else if(n.type===i.Token.Identifier&&'set'===n.value&&u)d='set',o=this.match('['),p=this.parseObjectPropertyKey(),c=this.parseSetterMethod();else if(n.type===i.Token.Punctuator&&'*'===n.value&&u)d='init',o=this.match('['),p=this.parseObjectPropertyKey(),c=this.parseGeneratorMethod(),a=!0;else if(p||this.throwUnexpectedToken(this.lookahead),d='init',this.match(':'))!o&&this.isPropertyKey(p,'__proto__')&&(e.value&&this.tolerateError(r.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),c=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match('('))c=this.parsePropertyMethodFunction(),a=!0;else if(n.type===i.Token.Identifier){var h=this.finalize(t,new l.Identifier(n.value));if(this.match('=')){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),s=!0;var m=this.isolateCoverGrammar(this.parseAssignmentExpression);c=this.finalize(t,new l.AssignmentPattern(h,m))}else s=!0,c=h}else this.throwUnexpectedToken(this.nextToken());return this.finalize(t,new l.Property(d,p,o,c,a,s))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect('{');for(var t=[],n={value:!1};!this.match('}');)t.push(this.parseObjectProperty(n)),this.match('}')||this.expectCommaSeparator();return this.expect('}'),this.finalize(e,new l.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){o.assert(this.lookahead.head,'Template literal must start with a template head');var e=this.createNode(),t=this.nextToken(),n={raw:t.value.raw,cooked:t.value.cooked};return this.finalize(e,new l.TemplateElement(n,t.tail))},e.prototype.parseTemplateElement=function(){this.lookahead.type!==i.Token.Template&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n={raw:t.value.raw,cooked:t.value.cooked};return this.finalize(e,new l.TemplateElement(n,t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],o=this.parseTemplateHead();for(n.push(o);!o.tail;)t.push(this.parseExpression()),o=this.parseTemplateElement(),n.push(o);return this.finalize(e,new l.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case d.Syntax.Identifier:case d.Syntax.MemberExpression:case d.Syntax.RestElement:case d.Syntax.AssignmentPattern:break;case d.Syntax.SpreadElement:e.type=d.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case d.Syntax.ArrayExpression:e.type=d.Syntax.ArrayPattern;for(var t=0;t')||this.expect('=>'),e={type:p,params:[]};else{var t=this.lookahead,n=[];if(this.match('...'))e=this.parseRestElement(n),this.expect(')'),this.match('=>')||this.expect('=>'),e={type:p,params:[e]};else{var o=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(',')){var r=[];for(this.context.isAssignmentTarget=!1,r.push(e);this.startMarker.index')||this.expect('=>'),this.context.isBindingElement=!1;for(var a=0;a')&&(e.type===d.Syntax.Identifier&&'yield'===e.name&&(o=!0,e={type:p,params:[e]}),!o)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===d.Syntax.SequenceExpression)for(var a=0;a=o);){for(;2')){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=this.reinterpretAsCoverFormalsList(e);if(o){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var a=this.context.strict,i=this.context.allowYield;this.context.allowYield=!0;var s=this.startNode(t);this.expect('=>');var c=this.match('{')?this.parseFunctionSourceElements():this.isolateCoverGrammar(this.parseAssignmentExpression),u=c.type!==d.Syntax.BlockStatement;this.context.strict&&o.firstRestricted&&this.throwUnexpectedToken(o.firstRestricted,o.message),this.context.strict&&o.stricted&&this.tolerateUnexpectedToken(o.stricted,o.message),e=this.finalize(s,new l.ArrowFunctionExpression(o.params,c,u)),this.context.strict=a,this.context.allowYield=i}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(r.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===d.Syntax.Identifier){var h=e;this.scanner.isRestrictedWord(h.name)&&this.tolerateUnexpectedToken(n,r.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(h.name)&&this.tolerateUnexpectedToken(n,r.Messages.StrictReservedWord)}this.match('=')?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),n=this.nextToken();var m=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new l.AssignmentExpression(n.value,e,m)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(',')){for(var n=[t];this.startMarker.index',t.TokenName[n.Identifier]='Identifier',t.TokenName[n.Keyword]='Keyword',t.TokenName[n.NullLiteral]='Null',t.TokenName[n.NumericLiteral]='Numeric',t.TokenName[n.Punctuator]='Punctuator',t.TokenName[n.StringLiteral]='String',t.TokenName[n.RegularExpression]='RegularExpression',t.TokenName[n.Template]='Template'},function(t,n,o){'use strict';function r(e){return'0123456789abcdef'.indexOf(e.toLowerCase())}function a(e){return'01234567'.indexOf(e)}var i=o(4),s=o(5),d=o(9),l=o(7),p=function(){function t(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.length=e.length,this.index=0,this.lineNumber=0=this.length},t.prototype.throwUnexpectedToken=function(e){void 0===e&&(e=s.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},t.prototype.tolerateUnexpectedToken=function(){this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,s.Messages.UnexpectedTokenIllegal)},t.prototype.skipSingleLineComment=function(e){var t,n,o;for(this.trackComment&&(t=[],n=this.index-e,o={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(++this.index,d.Character.isLineTerminator(r)){if(this.trackComment){o.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[n+e,this.index-1],range:[n,this.index-1],loc:o};t.push(a)}return 13===r&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t}}if(this.trackComment){o.end={line:this.lineNumber,column:this.index-this.lineStart};var a={multiLine:!1,slice:[n+e,this.index],range:[n,this.index],loc:o};t.push(a)}return t},t.prototype.skipMultiLineComment=function(){var e,t,n;for(this.trackComment&&(e=[],t=this.index-2,n={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var o=this.source.charCodeAt(this.index);if(d.Character.isLineTerminator(o))13===o&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===o){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart};var r={multiLine:!0,slice:[t+2,this.index-2],range:[t,this.index],loc:n};e.push(r)}return e}++this.index}else++this.index}if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart};var r={multiLine:!0,slice:[t+2,this.index],range:[t,this.index],loc:n};e.push(r)}return this.tolerateUnexpectedToken(),e},t.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index,n;!this.eof();)if(n=this.source.charCodeAt(this.index),d.Character.isWhiteSpace(n))++this.index;else if(d.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n){if(n=this.source.charCodeAt(this.index+1),47===n){this.index+=2;var o=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(o)),t=!0}else if(42===n){this.index+=2;var o=this.skipMultiLineComment();this.trackComment&&(e=e.concat(o))}else break;}else if(t&&45===n){if(45===this.source.charCodeAt(this.index+1)&&62===this.source.charCodeAt(this.index+2)){this.index+=3;var o=this.skipSingleLineComment(3);this.trackComment&&(e=e.concat(o))}else break;}else if(60!==n)break;else if('!--'===this.source.slice(this.index+1,this.index+4)){this.index+=4;var o=this.skipSingleLineComment(4);this.trackComment&&(e=e.concat(o))}else break;return e},t.prototype.isFutureReservedWord=function(e){return'enum'===e||'export'===e||'import'===e||'super'===e},t.prototype.isStrictModeReservedWord=function(e){return'implements'===e||'interface'===e||'package'===e||'private'===e||'protected'===e||'public'===e||'static'===e||'yield'===e||'let'===e},t.prototype.isRestrictedWord=function(e){return'eval'===e||'arguments'===e},t.prototype.isKeyword=function(e){switch(e.length){case 2:return'if'===e||'in'===e||'do'===e;case 3:return'var'===e||'for'===e||'new'===e||'try'===e||'let'===e;case 4:return'this'===e||'else'===e||'case'===e||'void'===e||'with'===e||'enum'===e;case 5:return'while'===e||'break'===e||'catch'===e||'throw'===e||'const'===e||'yield'===e||'class'===e||'super'===e;case 6:return'return'===e||'typeof'===e||'delete'===e||'switch'===e||'export'===e||'import'===e;case 7:return'default'===e||'finally'===e||'extends'===e;case 8:return'function'===e||'continue'===e||'debugger'===e;case 10:return'instanceof'===e;default:return!1;}},t.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(55296<=t&&56319>=t){var n=this.source.charCodeAt(e+1);if(56320<=n&&57343>=n){var o=t;t=1024*(o-55296)+n-56320+65536}}return t},t.prototype.scanHexEscape=function(t){for(var n='u'===t?4:2,o=0,a=0;at)return this.index=e,this.getComplexIdentifier();if(d.Character.isIdentifierPart(t))++this.index;else break}return this.source.slice(e,this.index)},t.prototype.getComplexIdentifier=function(){var e=this.codePointAt(this.index),t=d.Character.fromCodePoint(e);this.index+=t.length;var n;for(92===e&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,'{'===this.source[this.index]?(++this.index,n=this.scanUnicodeCodePointEscape()):(n=this.scanHexEscape('u'),e=n.charCodeAt(0),(!n||'\\'===n||!d.Character.isIdentifierStart(e))&&this.throwUnexpectedToken()),t=n);!this.eof()&&(e=this.codePointAt(this.index),!!d.Character.isIdentifierPart(e));)n=d.Character.fromCodePoint(e),t+=n,this.index+=n.length,92===e&&(t=t.substr(0,t.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,'{'===this.source[this.index]?(++this.index,n=this.scanUnicodeCodePointEscape()):(n=this.scanHexEscape('u'),e=n.charCodeAt(0),(!n||'\\'===n||!d.Character.isIdentifierPart(e))&&this.throwUnexpectedToken()),t+=n);return t},t.prototype.octalToDecimal=function(e){var t='0'!==e,n=a(e);return!this.eof()&&d.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+a(this.source[this.index++]),0<='0123'.indexOf(e)&&!this.eof()&&d.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+a(this.source[this.index++]))),{code:n,octal:t}},t.prototype.scanIdentifier=function(){var e=this.index,t=92===this.source.charCodeAt(e)?this.getComplexIdentifier():this.getIdentifier(),n;return n=1===t.length?l.Token.Identifier:this.isKeyword(t)?l.Token.Keyword:'null'===t?l.Token.NullLiteral:'true'===t||'false'===t?l.Token.BooleanLiteral:l.Token.Identifier,{type:n,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},t.prototype.scanPunctuator=function(){var e={type:l.Token.Punctuator,value:'',lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index},t=this.source[this.index];return'('===t||'{'===t?('{'===t&&this.curlyStack.push('{'),++this.index):'.'===t?(++this.index,'.'===this.source[this.index]&&'.'===this.source[this.index+1]&&(this.index+=2,t='...')):'}'===t?(++this.index,this.curlyStack.pop()):')'===t||';'===t||','===t||'['===t||']'===t||':'===t||'?'===t||'~'===t?++this.index:(t=this.source.substr(this.index,4),'>>>='===t?this.index+=4:(t=t.substr(0,3),'==='===t||'!=='===t||'>>>'===t||'<<='===t||'>>='===t||'**='===t?this.index+=3:(t=t.substr(0,2),'&&'===t||'||'===t||'=='===t||'!='===t||'+='===t||'-='===t||'*='===t||'/='===t||'++'===t||'--'===t||'<<'===t||'>>'===t||'&='===t||'|='===t||'^='===t||'%='===t||'<='===t||'>='===t||'=>'===t||'**'===t?this.index+=2:(t=this.source[this.index],0<='<>=!+-*%&|^/'.indexOf(t)&&++this.index)))),this.index===e.start&&this.throwUnexpectedToken(),e.end=this.index,e.value=t,e},t.prototype.scanHexLiteral=function(e){for(var t='';!this.eof()&&!!d.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),d.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:l.Token.NumericLiteral,value:parseInt('0x'+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},t.prototype.scanBinaryLiteral=function(e){for(var t='',n;!this.eof()&&(n=this.source[this.index],'0'===n||'1'===n);)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),this.eof()||(n=this.source.charCodeAt(this.index),(d.Character.isIdentifierStart(n)||d.Character.isDecimalDigit(n))&&this.throwUnexpectedToken()),{type:l.Token.NumericLiteral,value:parseInt(t,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},t.prototype.scanOctalLiteral=function(e,t){var n='',o=!1;for(d.Character.isOctalDigit(e.charCodeAt(0))?(o=!0,n='0'+this.source[this.index++]):++this.index;!this.eof()&&!!d.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return o||0!==n.length||this.throwUnexpectedToken(),(d.Character.isIdentifierStart(this.source.charCodeAt(this.index))||d.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:l.Token.NumericLiteral,value:parseInt(n,8),octal:o,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},t.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1,t;e=i?e(i):o}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,o));try{RegExp(r)}catch(t){this.throwUnexpectedToken(s.Messages.InvalidRegExp)}try{return new RegExp(t,n)}catch(e){return null}},t.prototype.scanRegExpBody=function(){var e=this.source[this.index];i.assert('/'===e,'Regular expression literal must start with a slash');for(var t=this.source[this.index++],n=!1,o=!1;!this.eof();)if(e=this.source[this.index++],t+=e,'\\'===e)e=this.source[this.index++],d.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(s.Messages.UnterminatedRegExp),t+=e;else if(d.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(s.Messages.UnterminatedRegExp);else if(n)']'===e&&(n=!1);else if('/'===e){o=!0;break}else'['===e&&(n=!0);o||this.throwUnexpectedToken(s.Messages.UnterminatedRegExp);var r=t.substr(1,t.length-2);return{value:r,literal:t}},t.prototype.scanRegExpFlags=function(){for(var e='',t='',n;!this.eof()&&(n=this.source[this.index],!!d.Character.isIdentifierPart(n.charCodeAt(0)));)if(++this.index,'\\'!==n||this.eof())t+=n,e+=n;else if(n=this.source[this.index],'u'===n){++this.index;var o=this.index;if(n=this.scanHexEscape('u'),n)for(t+=n,e+='\\u';oe&&d.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},t)}();n.Scanner=p},function(t,n){'use strict';var o={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};n.Character={fromCodePoint:function(t){return 65536>t?e(t):e(55296+(t-65536>>10))+e(56320+(1023&t-65536))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||5760<=e&&0<=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||65<=e&&90>=e||97<=e&&122>=e||92===e||128<=e&&o.NonAsciiIdentifierStart.test(n.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||65<=e&&90>=e||97<=e&&122>=e||48<=e&&57>=e||92===e||128<=e&&o.NonAsciiIdentifierPart.test(n.Character.fromCodePoint(e))},isDecimalDigit:function(e){return 48<=e&&57>=e},isHexDigit:function(e){return 48<=e&&57>=e||65<=e&&70>=e||97<=e&&102>=e},isOctalDigit:function(e){return 48<=e&&55>=e}}},function(e,t,n){'use strict';var o=n(2),r=function(){return function(e){this.type=o.Syntax.ArrayExpression,this.elements=e}}();t.ArrayExpression=r;var a=function(){return function(e){this.type=o.Syntax.ArrayPattern,this.elements=e}}();t.ArrayPattern=a;var i=function(){return function(e,t,n){this.type=o.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n}}();t.ArrowFunctionExpression=i;var s=function(){return function(e,t,n){this.type=o.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n}}();t.AssignmentExpression=s;var d=function(){return function(e,t){this.type=o.Syntax.AssignmentPattern,this.left=e,this.right=t}}();t.AssignmentPattern=d;var l=function(){return function(e,t,n){this.type='||'===e||'&&'===e?o.Syntax.LogicalExpression:o.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n}}();t.BinaryExpression=l;var p=function(){return function(e){this.type=o.Syntax.BlockStatement,this.body=e}}();t.BlockStatement=p;var c=function(){return function(e){this.type=o.Syntax.BreakStatement,this.label=e}}();t.BreakStatement=c;var u=function(){return function(e,t){this.type=o.Syntax.CallExpression,this.callee=e,this.arguments=t}}();t.CallExpression=u;var h=function(){return function(e,t){this.type=o.Syntax.CatchClause,this.param=e,this.body=t}}();t.CatchClause=h;var m=function(){return function(e){this.type=o.Syntax.ClassBody,this.body=e}}();t.ClassBody=m;var g=function(){return function(e,t,n){this.type=o.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n}}();t.ClassDeclaration=g;var f=function(){return function(e,t,n){this.type=o.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n}}();t.ClassExpression=f;var y=function(){return function(e,t){this.type=o.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t}}();t.ComputedMemberExpression=y;var b=function(){return function(e,t,n){this.type=o.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n}}();t.ConditionalExpression=b;var v=function(){return function(e){this.type=o.Syntax.ContinueStatement,this.label=e}}();t.ContinueStatement=v;var x=function(){return function(){this.type=o.Syntax.DebuggerStatement}}();t.DebuggerStatement=x;var C=function(){return function(e,t){this.type=o.Syntax.ExpressionStatement,this.expression=e,this.directive=t}}();t.Directive=C;var S=function(){return function(e,t){this.type=o.Syntax.DoWhileStatement,this.body=e,this.test=t}}();t.DoWhileStatement=S;var E=function(){return function(){this.type=o.Syntax.EmptyStatement}}();t.EmptyStatement=E;var k=function(){return function(e){this.type=o.Syntax.ExportAllDeclaration,this.source=e}}();t.ExportAllDeclaration=k;var T=function(){return function(e){this.type=o.Syntax.ExportDefaultDeclaration,this.declaration=e}}();t.ExportDefaultDeclaration=T;var w=function(){return function(e,t,n){this.type=o.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n}}();t.ExportNamedDeclaration=w;var I=function(){return function(e,t){this.type=o.Syntax.ExportSpecifier,this.exported=t,this.local=e}}();t.ExportSpecifier=I;var N=function(){return function(e){this.type=o.Syntax.ExpressionStatement,this.expression=e}}();t.ExpressionStatement=N;var A=function(){return function(e,t,n){this.type=o.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1}}();t.ForInStatement=A;var L=function(){return function(e,t,n){this.type=o.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n}}();t.ForOfStatement=L;var R=function(){return function(e,t,n,r){this.type=o.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=r}}();t.ForStatement=R;var O=function(){return function(e,t,n,r){this.type=o.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=r,this.expression=!1}}();t.FunctionDeclaration=O;var P=function(){return function(e,t,n,r){this.type=o.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=r,this.expression=!1}}();t.FunctionExpression=P;var D=function(){return function(e){this.type=o.Syntax.Identifier,this.name=e}}();t.Identifier=D;var _=function(){return function(e,t,n){this.type=o.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n}}();t.IfStatement=_;var M=function(){return function(e,t){this.type=o.Syntax.ImportDeclaration,this.specifiers=e,this.source=t}}();t.ImportDeclaration=M;var F=function(){return function(e){this.type=o.Syntax.ImportDefaultSpecifier,this.local=e}}();t.ImportDefaultSpecifier=F;var B=function(){return function(e){this.type=o.Syntax.ImportNamespaceSpecifier,this.local=e}}();t.ImportNamespaceSpecifier=B;var U=function(){return function(e,t){this.type=o.Syntax.ImportSpecifier,this.local=e,this.imported=t}}();t.ImportSpecifier=U;var V=function(){return function(e,t){this.type=o.Syntax.LabeledStatement,this.label=e,this.body=t}}();t.LabeledStatement=V;var W=function(){return function(e,t){this.type=o.Syntax.Literal,this.value=e,this.raw=t}}();t.Literal=W;var H=function(){return function(e,t){this.type=o.Syntax.MetaProperty,this.meta=e,this.property=t}}();t.MetaProperty=H;var q=function(){return function(e,t,n,r,a){this.type=o.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=r,this.static=a}}();t.MethodDefinition=q;var j=function(){return function(e,t){this.type=o.Syntax.NewExpression,this.callee=e,this.arguments=t}}();t.NewExpression=j;var z=function(){return function(e){this.type=o.Syntax.ObjectExpression,this.properties=e}}();t.ObjectExpression=z;var K=function(){return function(e){this.type=o.Syntax.ObjectPattern,this.properties=e}}();t.ObjectPattern=K;var G=function(){return function(e,t){this.type=o.Syntax.Program,this.body=e,this.sourceType=t}}();t.Program=G;var X=function(){return function(e,t,n,r,a,i){this.type=o.Syntax.Property,this.key=t,this.computed=n,this.value=r,this.kind=e,this.method=a,this.shorthand=i}}();t.Property=X;var Q=function(){return function(e,t,n){this.type=o.Syntax.Literal,this.value=e,this.raw=t,this.regex=n}}();t.RegexLiteral=Q;var Y=function(){return function(e){this.type=o.Syntax.RestElement,this.argument=e}}();t.RestElement=Y;var J=function(){return function(e){this.type=o.Syntax.ReturnStatement,this.argument=e}}();t.ReturnStatement=J;var $=function(){return function(e){this.type=o.Syntax.SequenceExpression,this.expressions=e}}();t.SequenceExpression=$;var Z=function(){return function(e){this.type=o.Syntax.SpreadElement,this.argument=e}}();t.SpreadElement=Z;var ee=function(){return function(e,t){this.type=o.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t}}();t.StaticMemberExpression=ee;var te=function(){return function(){this.type=o.Syntax.Super}}();t.Super=te;var ne=function(){return function(e,t){this.type=o.Syntax.SwitchCase,this.test=e,this.consequent=t}}();t.SwitchCase=ne;var oe=function(){return function(e,t){this.type=o.Syntax.SwitchStatement,this.discriminant=e,this.cases=t}}();t.SwitchStatement=oe;var re=function(){return function(e,t){this.type=o.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t}}();t.TaggedTemplateExpression=re;var ae=function(){return function(e,t){this.type=o.Syntax.TemplateElement,this.value=e,this.tail=t}}();t.TemplateElement=ae;var ie=function(){return function(e,t){this.type=o.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t}}();t.TemplateLiteral=ie;var se=function(){return function(){this.type=o.Syntax.ThisExpression}}();t.ThisExpression=se;var de=function(){return function(e){this.type=o.Syntax.ThrowStatement,this.argument=e}}();t.ThrowStatement=de;var le=function(){return function(e,t,n){this.type=o.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n}}();t.TryStatement=le;var pe=function(){return function(e,t){this.type=o.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0}}();t.UnaryExpression=pe;var ce=function(){return function(e,t,n){this.type=o.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n}}();t.UpdateExpression=ce;var ue=function(){return function(e,t){this.type=o.Syntax.VariableDeclaration,this.declarations=e,this.kind=t}}();t.VariableDeclaration=ue;var he=function(){return function(e,t){this.type=o.Syntax.VariableDeclarator,this.id=e,this.init=t}}();t.VariableDeclarator=he;var me=function(){return function(e,t){this.type=o.Syntax.WhileStatement,this.test=e,this.body=t}}();t.WhileStatement=me;var ge=function(){return function(e,t){this.type=o.Syntax.WithStatement,this.object=e,this.body=t}}();t.WithStatement=ge;var fe=function(){return function(e,t){this.type=o.Syntax.YieldExpression,this.argument=e,this.delegate=t}}();t.YieldExpression=fe},function(t,n,o){'use strict';function r(e){var t;switch(e.type){case p.JSXSyntax.JSXIdentifier:t=e.name;break;case p.JSXSyntax.JSXNamespacedName:var n=e;t=r(n.namespace)+':'+r(n.name);break;case p.JSXSyntax.JSXMemberExpression:var o=e;t=r(o.object)+'.'+r(o.property);}return t}var a=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=o(9),s=o(7),d=o(3),l=o(12),p=o(13),c=o(10),u=o(14),h;(function(e){e[e.Identifier=100]='Identifier',e[e.Text=101]='Text'})(h||(h={})),s.TokenName[h.Identifier]='JSXIdentifier',s.TokenName[h.Text]='JSXText';var m=function(t){function n(e,n,o){t.call(this,e,n,o)}return a(n,t),n.prototype.parsePrimaryExpression=function(){return this.match('<')?this.parseJSXRoot():t.prototype.parsePrimaryExpression.call(this)},n.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.lineNumber,this.scanner.lineStart=this.startMarker.lineStart},n.prototype.finishJSX=function(){this.nextToken()},n.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},n.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},n.prototype.scanXHTMLEntity=function(){for(var t='&',n='',o;!this.scanner.eof();){if(o=this.scanner.source[this.scanner.index++],';'===o){if('#'===n[0]){n=n.substr(1);var r='x'===n[0],a=r?parseInt('0'+n,16):parseInt(n,10);t=e(a)}else l.XHTMLEntities[n]?t=l.XHTMLEntities[n]:t+=o;break}n+=o,t+=o}return t},n.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e){var t=this.scanner.source[this.scanner.index++];return{type:s.Token.Punctuator,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(34===e||39===e){for(var n=this.scanner.index,o=this.scanner.source[this.scanner.index++],r='',a;!this.scanner.eof()&&(a=this.scanner.source[this.scanner.index++],a!==o);)r+='&'===a?this.scanXHTMLEntity():a;return{type:s.Token.StringLiteral,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:n,end:this.scanner.index}}if(46===e){var d=this.scanner.source.charCodeAt(this.scanner.index+1),l=this.scanner.source.charCodeAt(this.scanner.index+2),t=46===d&&46===l?'...':'.',n=this.scanner.index;return this.scanner.index+=t.length,{type:s.Token.Punctuator,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:n,end:this.scanner.index}}if(i.Character.isIdentifierStart(e)&&92!==e){var n=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){var a=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(a)&&92!==a)++this.scanner.index;else if(45===a)++this.scanner.index;else break}var p=this.scanner.source.slice(n,this.scanner.index);return{type:h.Identifier,value:p,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:n,end:this.scanner.index}}this.scanner.throwUnexpectedToken()},n.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},n.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;for(var e=this.scanner.index,t='',n;!this.scanner.eof()&&(n=this.scanner.source[this.scanner.index],'{'!==n&&'<'!==n);)++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,'\r'===n&&'\n'===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index);this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart;var o={type:h.Text,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return 0');)t=this.matchJSX('{')?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute(),e.push(t);return e},n.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX('<');var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),o=this.matchJSX('/');return o&&this.expectJSX('/'),this.expectJSX('>'),this.finalize(e,new u.JSXOpeningElement(t,o,n))},n.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX('<'),this.matchJSX('/')){this.expectJSX('/');var t=this.parseJSXElementName();return this.expectJSX('>'),this.finalize(e,new u.JSXClosingElement(t))}var n=this.parseJSXElementName(),o=this.parseJSXAttributes(),r=this.matchJSX('/');return r&&this.expectJSX('/'),this.expectJSX('>'),this.finalize(e,new u.JSXOpeningElement(n,r,o))},n.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.finalize(e,new u.JSXEmptyExpression)},n.prototype.parseJSXExpression=function(){var e;return this.matchJSX('}')?e=this.parseJSXEmptyExpression():(this.finishJSX(),e=this.parseAssignmentExpression(),this.startJSX()),e},n.prototype.parseJSXExpressionContainer=function(){var e=this.createJSXNode();this.expectJSX('{');var t=this.parseJSXExpression();return this.expectJSX('}'),this.finalize(e,new u.JSXExpressionContainer(t))},n.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start',nbsp:'\xA0',iexcl:'\xA1',cent:'\xA2',pound:'\xA3',curren:'\xA4',yen:'\xA5',brvbar:'\xA6',sect:'\xA7',uml:'\xA8',copy:'\xA9',ordf:'\xAA',laquo:'\xAB',not:'\xAC',shy:'\xAD',reg:'\xAE',macr:'\xAF',deg:'\xB0',plusmn:'\xB1',sup2:'\xB2',sup3:'\xB3',acute:'\xB4',micro:'\xB5',para:'\xB6',middot:'\xB7',cedil:'\xB8',sup1:'\xB9',ordm:'\xBA',raquo:'\xBB',frac14:'\xBC',frac12:'\xBD',frac34:'\xBE',iquest:'\xBF',Agrave:'\xC0',Aacute:'\xC1',Acirc:'\xC2',Atilde:'\xC3',Auml:'\xC4',Aring:'\xC5',AElig:'\xC6',Ccedil:'\xC7',Egrave:'\xC8',Eacute:'\xC9',Ecirc:'\xCA',Euml:'\xCB',Igrave:'\xCC',Iacute:'\xCD',Icirc:'\xCE',Iuml:'\xCF',ETH:'\xD0',Ntilde:'\xD1',Ograve:'\xD2',Oacute:'\xD3',Ocirc:'\xD4',Otilde:'\xD5',Ouml:'\xD6',times:'\xD7',Oslash:'\xD8',Ugrave:'\xD9',Uacute:'\xDA',Ucirc:'\xDB',Uuml:'\xDC',Yacute:'\xDD',THORN:'\xDE',szlig:'\xDF',agrave:'\xE0',aacute:'\xE1',acirc:'\xE2',atilde:'\xE3',auml:'\xE4',aring:'\xE5',aelig:'\xE6',ccedil:'\xE7',egrave:'\xE8',eacute:'\xE9',ecirc:'\xEA',euml:'\xEB',igrave:'\xEC',iacute:'\xED',icirc:'\xEE',iuml:'\xEF',eth:'\xF0',ntilde:'\xF1',ograve:'\xF2',oacute:'\xF3',ocirc:'\xF4',otilde:'\xF5',ouml:'\xF6',divide:'\xF7',oslash:'\xF8',ugrave:'\xF9',uacute:'\xFA',ucirc:'\xFB',uuml:'\xFC',yacute:'\xFD',thorn:'\xFE',yuml:'\xFF',OElig:'\u0152',oelig:'\u0153',Scaron:'\u0160',scaron:'\u0161',Yuml:'\u0178',fnof:'\u0192',circ:'\u02C6',tilde:'\u02DC',Alpha:'\u0391',Beta:'\u0392',Gamma:'\u0393',Delta:'\u0394',Epsilon:'\u0395',Zeta:'\u0396',Eta:'\u0397',Theta:'\u0398',Iota:'\u0399',Kappa:'\u039A',Lambda:'\u039B',Mu:'\u039C',Nu:'\u039D',Xi:'\u039E',Omicron:'\u039F',Pi:'\u03A0',Rho:'\u03A1',Sigma:'\u03A3',Tau:'\u03A4',Upsilon:'\u03A5',Phi:'\u03A6',Chi:'\u03A7',Psi:'\u03A8',Omega:'\u03A9',alpha:'\u03B1',beta:'\u03B2',gamma:'\u03B3',delta:'\u03B4',epsilon:'\u03B5',zeta:'\u03B6',eta:'\u03B7',theta:'\u03B8',iota:'\u03B9',kappa:'\u03BA',lambda:'\u03BB',mu:'\u03BC',nu:'\u03BD',xi:'\u03BE',omicron:'\u03BF',pi:'\u03C0',rho:'\u03C1',sigmaf:'\u03C2',sigma:'\u03C3',tau:'\u03C4',upsilon:'\u03C5',phi:'\u03C6',chi:'\u03C7',psi:'\u03C8',omega:'\u03C9',thetasym:'\u03D1',upsih:'\u03D2',piv:'\u03D6',ensp:'\u2002',emsp:'\u2003',thinsp:'\u2009',zwnj:'\u200C',zwj:'\u200D',lrm:'\u200E',rlm:'\u200F',ndash:'\u2013',mdash:'\u2014',lsquo:'\u2018',rsquo:'\u2019',sbquo:'\u201A',ldquo:'\u201C',rdquo:'\u201D',bdquo:'\u201E',dagger:'\u2020',Dagger:'\u2021',bull:'\u2022',hellip:'\u2026',permil:'\u2030',prime:'\u2032',Prime:'\u2033',lsaquo:'\u2039',rsaquo:'\u203A',oline:'\u203E',frasl:'\u2044',euro:'\u20AC',image:'\u2111',weierp:'\u2118',real:'\u211C',trade:'\u2122',alefsym:'\u2135',larr:'\u2190',uarr:'\u2191',rarr:'\u2192',darr:'\u2193',harr:'\u2194',crarr:'\u21B5',lArr:'\u21D0',uArr:'\u21D1',rArr:'\u21D2',dArr:'\u21D3',hArr:'\u21D4',forall:'\u2200',part:'\u2202',exist:'\u2203',empty:'\u2205',nabla:'\u2207',isin:'\u2208',notin:'\u2209',ni:'\u220B',prod:'\u220F',sum:'\u2211',minus:'\u2212',lowast:'\u2217',radic:'\u221A',prop:'\u221D',infin:'\u221E',ang:'\u2220',and:'\u2227',or:'\u2228',cap:'\u2229',cup:'\u222A',int:'\u222B',there4:'\u2234',sim:'\u223C',cong:'\u2245',asymp:'\u2248',ne:'\u2260',equiv:'\u2261',le:'\u2264',ge:'\u2265',sub:'\u2282',sup:'\u2283',nsub:'\u2284',sube:'\u2286',supe:'\u2287',oplus:'\u2295',otimes:'\u2297',perp:'\u22A5',sdot:'\u22C5',lceil:'\u2308',rceil:'\u2309',lfloor:'\u230A',rfloor:'\u230B',loz:'\u25CA',spades:'\u2660',clubs:'\u2663',hearts:'\u2665',diams:'\u2666',lang:'\u27E8',rang:'\u27E9'}},function(e,t){'use strict';t.JSXSyntax={JSXAttribute:'JSXAttribute',JSXClosingElement:'JSXClosingElement',JSXElement:'JSXElement',JSXEmptyExpression:'JSXEmptyExpression',JSXExpressionContainer:'JSXExpressionContainer',JSXIdentifier:'JSXIdentifier',JSXMemberExpression:'JSXMemberExpression',JSXNamespacedName:'JSXNamespacedName',JSXOpeningElement:'JSXOpeningElement',JSXSpreadAttribute:'JSXSpreadAttribute',JSXText:'JSXText'}},function(e,t,n){'use strict';var o=n(13),r=function(){return function(e){this.type=o.JSXSyntax.JSXClosingElement,this.name=e}}();t.JSXClosingElement=r;var a=function(){return function(e,t,n){this.type=o.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n}}();t.JSXElement=a;var i=function(){return function(){this.type=o.JSXSyntax.JSXEmptyExpression}}();t.JSXEmptyExpression=i;var s=function(){return function(e){this.type=o.JSXSyntax.JSXExpressionContainer,this.expression=e}}();t.JSXExpressionContainer=s;var d=function(){return function(e){this.type=o.JSXSyntax.JSXIdentifier,this.name=e}}();t.JSXIdentifier=d;var l=function(){return function(e,t){this.type=o.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t}}();t.JSXMemberExpression=l;var p=function(){return function(e,t){this.type=o.JSXSyntax.JSXAttribute,this.name=e,this.value=t}}();t.JSXAttribute=p;var c=function(){return function(e,t){this.type=o.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t}}();t.JSXNamespacedName=c;var u=function(){return function(e,t,n){this.type=o.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n}}();t.JSXOpeningElement=u;var h=function(){return function(e){this.type=o.JSXSyntax.JSXSpreadAttribute,this.argument=e}}();t.JSXSpreadAttribute=h;var m=function(){return function(e,t){this.type=o.JSXSyntax.JSXText,this.value=e,this.raw=t}}();t.JSXText=m},function(e,t,n){'use strict';var o=n(8),r=n(6),a=n(7),i=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return 0<=['(','{','[','in','typeof','instanceof','new','return','case','delete','throw','void','=','+=','-=','*=','**=','/=','%=','<<=','>>=','>>>=','&=','|=','^=',',','+','-','*','**','/','%','++','--','<<','>>','>>>','&','|','^','!','~','&&','||','?',':','===','==','>=','<=','<','>','!=','!=='].indexOf(e)},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case'this':case']':t=!1;break;case')':var n=this.values[this.paren-1];t='if'===n||'while'===n||'for'===n||'with'===n;break;case'}':if(t=!1,'function'===this.values[this.curly-3]){var o=this.values[this.curly-4];t=!!o&&!this.beforeFunctionExpression(o)}else if('function'===this.values[this.curly-4]){var r=this.values[this.curly-5];t=!r||!this.beforeFunctionExpression(r)}}return t},(e.prototype.push=function(e){e.type===a.Token.Punctuator||e.type===a.Token.Keyword?('{'===e.value?this.curly=this.values.length:'('===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e)}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&'boolean'==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&'boolean'==typeof t.comment&&t.comment,this.trackRange=!!t&&'boolean'==typeof t.range&&t.range,this.trackLoc=!!t&&'boolean'==typeof t.loc&&t.loc,this.buffer=[],this.reader=new i}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var t=this.scanner.scanComments();if(this.scanner.trackComment)for(var n=0;nn?e[t++]=n:2048>n?(e[t++]=192|n>>6,e[t++]=128|63&n):55296==(64512&n)&&r+1>18,e[t++]=128|63&n>>12,e[t++]=128|63&n>>6,e[t++]=128|63&n):(e[t++]=224|n>>12,e[t++]=128|63&n>>6,e[t++]=128|63&n);return e},n=function(l){for(var e=[],t=0,r=0,n;tn)e[r++]=d(n);else if(191n){var o=l[t++];e[r++]=d((31&n)<<6|63&o)}else if(239n){var o=l[t++],i=l[t++],a=l[t++],p=((7&n)<<18|(63&o)<<12|(63&i)<<6|63&a)-65536;e[r++]=d(55296+(p>>10)),e[r++]=d(56320+(1023&p))}else{var o=l[t++],i=l[t++];e[r++]=d((15&n)<<12|(63&o)<<6|63&i)}return e.join('')};a.base64={y:null,b:null,_:null,g:null,ENCODED_VALS_BASE:'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',get ENCODED_VALS(){return this.ENCODED_VALS_BASE+'+/='},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+'-_.'},HAS_NATIVE_SUPPORT:'function'==typeof atob,encodeByteArray:function(d,e){if(!Array.isArray(d))throw Error('encodeByteArray takes an array as a parameter');this.O();for(var t=e?this._:this.y,r=[],n=0;n>6,l=63&s;c||(l=64,i||(u=64)),r.push(t[o>>2],t[(3&o)<<4|a>>4],t[u],t[l])}return r.join('')},encodeString:function(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(i(n),e)},decodeString:function(o,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(o):n(this.decodeStringToByteArray(o,e))},decodeStringToByteArray:function(d,e){this.O();for(var t=e?this.g:this.b,r=[],n=0;n>4),64!=s){if(r.push(240&a<<4|s>>2),64!=c){r.push(192&s<<6|c)}}}return r},O:function(){if(!this.y){this.y={},this.b={},this._={},this.g={};for(var t=0;t=this.ENCODED_VALS_BASE.length&&(this.b[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.g[this.ENCODED_VALS.charAt(t)]=t)}}},a.base64Encode=function(t){var e=i(t);return a.base64.encodeByteArray(e,!0)},a.base64Decode=function(t){try{return a.base64.decodeString(t,!0)}catch(t){console.error('base64Decode failed: ',t)}return null}},function(n,e){'use strict';Object.defineProperty(e,'__esModule',{value:!0}),e.jsonEval=function(t){return JSON.parse(t)},e.stringify=function(t){return JSON.stringify(t)}},function(n,a){'use strict';Object.defineProperty(a,'__esModule',{value:!0}),a.contains=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},a.safeGet=function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]},a.forEach=function(n,e){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])},a.extend=function(n,e){return a.forEach(e,function(e,t){n[e]=t}),n},a.clone=function(t){return a.extend({},t)},a.isNonNullObject=function(t){return'object'==typeof t&&null!==t},a.isEmpty=function(n){for(var e in n)return!1;return!0},a.getCount=function(n){var e=0;for(var t in n)e++;return e},a.map=function(a,e,t){var r={};for(var n in a)r[n]=e.call(t,a[n],n,a);return r},a.findKey=function(o,e,t){for(var r in o)if(e.call(t,o[r],r,o))return r},a.findValue=function(t,e,r){var n=a.findKey(t,e,r);return n&&t[n]},a.getAnyKey=function(n){for(var e in n)return e},a.getValues=function(o){var e=[],t=0;for(var r in o)e[t++]=o[r];return e},a.every=function(n,e){for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&!e(t,n[t]))return!1;return!0}},,,,,,,,,,,,,,,,,,,,,,,,,,function(n,e,t){t(58),n.exports=t(6).default},function(a,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var r=t(59),n=(t.n(r),t(63)),o=(t.n(n),t(64));t.n(o)},function(e,t,o){(function(e){var t=function(){if(void 0!==e)return e;if(void 0!==a)return a;if('undefined'!=typeof self)return self;throw Error('unable to locate global object')}();'undefined'==typeof Promise&&(t.Promise=Promise=o(60))}).call(t,o(12))},function(d,e,t){(function(p){!function(e){function m(){}function n(n,e){return function(){n.apply(e,arguments)}}function o(t){if('object'!=typeof this)throw new TypeError('Promises must be constructed via new');if('function'!=typeof t)throw new TypeError('not a function');this._state=0,this._handled=!1,this._value=void 0,this.T=[],g(t,this)}function i(i,s){for(;3===i._state;)i=i._value;return 0===i._state?void i.T.push(s):void(i._handled=!0,o.A(function(){var e=1===i._state?s.onFulfilled:s.onRejected;if(null===e)return void(1===i._state?a:c)(s.promise,i._value);var t;try{t=e(i._value)}catch(t){return void c(s.promise,t)}a(s.promise,t)}))}function a(a,e){try{if(e===a)throw new TypeError('A promise cannot be resolved with itself.');if(e&&('object'==typeof e||'function'==typeof e)){var i=e.then;if(e instanceof o)return a._state=3,a._value=e,void s(a);if('function'==typeof i)return void g(n(i,e),a)}a._state=1,a._value=e,s(a)}catch(e){c(a,e)}}function c(n,e){n._state=2,n._value=e,s(n)}function s(n){2===n._state&&0===n.T.length&&o.A(function(){n._handled||o.j(n._value)});for(var e=0,t=n.T.length;e>>0;if('function'!=typeof a)throw new TypeError('predicate must be a function');for(var r=arguments[1],n=0,o;n>>0;if('function'!=typeof a)throw new TypeError('predicate must be a function');for(var r=arguments[1],n=0,o;n':''+o}),n=this.serviceName+': '+n+' ('+t+').';var o=new s(t,n);for(var r in d)d.hasOwnProperty(r)&&'_'!==r.slice(-1)&&(o[r]=d[r]);return o},t}();e.ErrorFactory=a},function(a,s,e){'use strict';Object.defineProperty(s,'__esModule',{value:!0});var d=e(29),n=e(30);s.decode=function(o){var e={},s={},l={},p='';try{var u=o.split('.');e=n.jsonEval(d.base64Decode(u[0])||''),s=n.jsonEval(d.base64Decode(u[1])||''),p=u[2],l=s.d||{},delete s.d}catch(t){}return{header:e,claims:s,data:l,signature:p}},s.isValidTimestamp=function(t){var e=s.decode(t).claims,a=Math.floor(new Date().getTime()/1e3),i,r;return'object'==typeof e&&(e.hasOwnProperty('nbf')?i=e.nbf:e.hasOwnProperty('iat')&&(i=e.iat),r=e.hasOwnProperty('exp')?e.exp:i+86400),a&&i&&r&&a>=i&&a<=r},s.issuedAtTime=function(t){var e=s.decode(t).claims;return'object'==typeof e&&e.hasOwnProperty('iat')?e.iat:null},s.isValidFormat=function(t){var e=s.decode(t),o=e.claims;return!!e.signature&&!!o&&'object'==typeof o&&o.hasOwnProperty('iat')},s.isAdmin=function(t){var e=s.decode(t).claims;return'object'==typeof e&&!0===e.admin}},function(o,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var r=t(31);e.querystring=function(n){var o=[];return r.forEach(n,function(t,e){Array.isArray(e)?e.forEach(function(e){o.push(encodeURIComponent(t)+'='+encodeURIComponent(e))}):o.push(encodeURIComponent(t)+'='+encodeURIComponent(e))}),o.length?'&'+o.join('&'):''},e.querystringDecode=function(n){var o={};return n.replace(/^\?/,'').split('&').forEach(function(t){if(t){var e=t.split('=');o[e[0]]=e[1]}}),o}},function(a,e,t){'use strict';var r=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t])};return function(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(e,'__esModule',{value:!0});var n=t(72),o=function(n){function e(){var e=n.call(this)||this;e.D=[],e.I=[],e.x=[],e.F=[],e.L=0,e.R=0,e.blockSize=64,e.F[0]=128;for(var o=1;or;r++)t[r]=d.charCodeAt(l)<<24|d.charCodeAt(l+1)<<16|d.charCodeAt(l+2)<<8|d.charCodeAt(l+3),l+=4;else for(var r=0;16>r;r++)t[r]=d[l]<<24|d[l+1]<<16|d[l+2]<<8|d[l+3],l+=4;for(var r=16,n;80>r;r++)n=t[r-3]^t[r-8]^t[r-14]^t[r-16],t[r]=4294967295&(n<<1|n>>>31);for(var o=this.D[0],p=this.D[1],s=this.D[2],c=this.D[3],u=this.D[4],r=0,h,i;80>r;r++){40>r?20>r?(h=c^p&(s^c),i=1518500249):(h=p^s^c,i=1859775393):60>r?(h=p&s|c&(p|s),i=2400959708):(h=p^s^c,i=3395469782);var n=4294967295&(o<<5|o>>>27)+h+u+i+t[r];u=c,c=s,s=4294967295&(p<<30|p>>>2),p=o,o=n}this.D[0]=4294967295&this.D[0]+o,this.D[1]=4294967295&this.D[1]+p,this.D[2]=4294967295&this.D[2]+s,this.D[3]=4294967295&this.D[3]+c,this.D[4]=4294967295&this.D[4]+u},e.prototype.update=function(a,s){if(null!=a){void 0===s&&(s=a.length);for(var t=s-this.blockSize,r=0,n=this.I,o=this.L;rthis.L?this.update(this.F,56-this.L):this.update(this.F,this.blockSize-(this.L-56));for(var t=this.blockSize-1;56<=t;t--)this.I[t]=255&e,e/=256;this.B(this.I);for(var r=0,t=0;5>t;t++)for(var n=24;0<=n;n-=8)a[r]=255&this.D[t]>>n,++r;return a},e}(n.Hash);e.Sha1=o},function(o,e){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var t=function(){return function(){this.blockSize=-1}}();e.Hash=t},function(n,e){'use strict';function s(a,i){if('object'!=typeof a||null===a)return!1;for(var t=0,r=i,n;t 4. Need to update it?');}var i=a+' failed: ';return i+=r+' argument '}function t(n,e,t,i){if((!i||t)&&'string'!=typeof t)throw Error(a(n,e,i)+'must be a valid firebase namespace.')}Object.defineProperty(e,'__esModule',{value:!0}),e.validateArgCount=function(a,e,t,r){var n;if(rt&&(n=0===t?'none':'no more than '+t),n){var o=a+' failed: Was called with '+r+(1===r?' argument.':' arguments.')+' Expects '+n+'.';throw Error(o)}},e.errorPrefix=a,e.validateNamespace=t,e.validateCallback=function(n,e,t,i){if((!i||t)&&'function'!=typeof t)throw Error(a(n,e,i)+'must be a valid function.')},e.validateContextObject=function(n,e,t,i){if((!i||t)&&('object'!=typeof t||null===t))throw Error(a(n,e,i)+'must be a valid context object.')}},function(o,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var r=t(28);e.stringToByteArray=function(n){for(var e=[],t=0,s=0,o;s=o){var i=o-55296;s++,r.assert(so?e[t++]=o:2048>o?(e[t++]=192|o>>6,e[t++]=128|63&o):65536>o?(e[t++]=224|o>>12,e[t++]=128|63&o>>6,e[t++]=128|63&o):(e[t++]=240|o>>18,e[t++]=128|63&o>>12,e[t++]=128|63&o>>6,e[t++]=128|63&o)}return e},e.stringLength=function(o){for(var e=0,t=0,r;tr?e++:2048>r?e+=2:55296<=r&&56319>=r?(e+=4,t++):e+=3;return e}}])}().default;try{webpackJsonpFirebase([4],{76:function(o,t,n){n(77)},77:function(o,t,Kn){var d=Math.max,ed=Math.floor;(function(e){(function(){function td(e){return'string'==typeof e}function e(e){return'boolean'==typeof e}function nd(){}function i(o){var r=typeof o;if('object'==r){if(!o)return'null';if(o instanceof Array)return'array';if(o instanceof Object)return r;var n=Object.prototype.toString.call(o);if('[object Window]'==n)return'object';if('[object Array]'==n||'number'==typeof o.length&&void 0!==o.splice&&void 0!==o.propertyIsEnumerable&&!o.propertyIsEnumerable('splice'))return'array';if('[object Function]'==n||void 0!==o.call&&void 0!==o.propertyIsEnumerable&&!o.propertyIsEnumerable('call'))return'function'}else if('function'==r&&void 0===o.call)return'object';return r}function r(e){return null===e}function od(e){return'array'==i(e)}function rd(e){var t=i(e);return'array'==t||'object'==t&&'number'==typeof e.length}function a(e){return'function'==i(e)}function ad(e){var o=typeof e;return'object'==o&&null!=e||'function'==o}function s(e){return e.call.apply(e.bind,arguments)}function h(o,r){if(!o)throw Error();if(2')&&(e=e.replace(Bd,'>')),-1!=e.indexOf('"')&&(e=e.replace(Ud,'"')),-1!=e.indexOf('\'')&&(e=e.replace(Vd,''')),-1!=e.indexOf('\0')&&(e=e.replace(Wd,'�')),e):e}function g(e,t){return-1!=e.indexOf(t)}function b(e,t){return et?1:0}function w(e,t){t.unshift(e),p.call(this,v.apply(null,t)),t.shift()}function y(e){throw new w('Failure'+(e?': '+e:''),Array.prototype.slice.call(arguments,1))}function I(t,n){var e=t.length,o=td(t)?t.split(''):t;for(--e;0<=e;--e)e in o&&n.call(void 0,o[e],e,t)}function T(t){t:{for(var n=Te,e=t.length,a=td(t)?t.split(''):t,r=0;rn?null:td(t)?t.charAt(n):t[n]}function A(e,t){return 0<=qd(e,t)}function k(o,t){t=qd(o,t);var n;return(n=0<=t)&&Array.prototype.splice.call(o,t,1),n}function E(o,t){var n=0;I(o,function(e,a){t.call(void 0,e,a,o)&&1==Array.prototype.splice.call(o,a,1).length&&n++})}function N(){return Array.prototype.concat.apply([],arguments)}function S(o){var t=o.length;if(0'),n=n.join('')}return n=t.createElement(n),o&&(td(o)?n.className=o:od(o)?n.className=o.join(' '):Dt(n,o)),2e.keyCode||void 0!=e.returnValue)){t:{var i=!1;if(0==e.keyCode)try{e.keyCode=-1;break t}catch(e){i=!0}(i||void 0==e.returnValue)&&(e.returnValue=!0)}for(e=[],i=t.b;i;i=i.parentNode)e.push(i);for(a=a.type,i=e.length-1;0<=i;i--){t.b=e[i];var r=on(e[i],a,!0,t);s=s&&r}for(i=0;i>4),64!=o&&(t(240&r<<4|o>>2),64!=a&&t(192&o<<6|a))}}function Pn(){if(!Yl){Yl={},Jl={};for(var e=0;65>e;e++)Yl[e]='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.charAt(e),Jl[Yl[e]]=e,62<=e&&(Jl['ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.'.charAt(e)]=e)}}function Cn(e,t){this.g=[],this.v=e,this.o=t||null,this.f=this.a=!1,this.c=void 0,this.u=this.w=this.i=!1,this.h=0,this.b=null,this.l=0}function Rn(o,t,r){o.a=!0,o.c=r,o.f=!t,Un(o)}function _n(e){if(e.a){if(!e.u)throw new jn;e.u=!1}}function Dn(e,t){Ln(e,null,t,void 0)}function Ln(o,t,n,e){o.g.push([t,n,e]),o.a&&Un(o)}function xn(e){return Kd(e.g,function(e){return a(e[1])})}function Un(d){if(d.h&&d.a&&xn(d)){var t=d.h,n=$l[t];n&&(Ld.clearTimeout(n.a),delete $l[t]),d.h=0}d.b&&(d.b.l--,delete d.b),t=d.c;for(var e=n=!1;d.g.length&&!d.i;){var i=d.g.shift(),r=i[0],o=i[1];if(i=i[2],r=d.f?o:r)try{var a=r.call(i||d.o,t);void 0!==a&&(d.f=d.f&&(a==t||a instanceof Error),d.c=t=a),(K(t)||'function'==typeof Ld.Promise&&t instanceof Ld.Promise)&&(e=!0,d.i=!0)}catch(e){t=e,d.f=!0,xn(d)||(n=!0)}}d.c=t,e&&(a=f(d.m,d,!0),e=f(d.m,d,!1),t instanceof Cn?(Ln(t,a,e),t.w=!0):t.then(a,e)),n&&(t=new Vn(t),$l[t.a]=t,d.h=t.a)}function jn(){p.call(this)}function Mn(){p.call(this)}function Vn(e){this.a=Ld.setTimeout(f(this.c,this),0),this.b=e}function Fn(e,t){this.b=-1,this.b=ep,this.f=Ld.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=e,this.h=t,this.l=Ld.Int32Array?new Int32Array(64):Array(64),Zl||(Zl=Ld.Int32Array?new Int32Array(rp):rp),this.reset()}function qn(d){for(var t=d.f,n=d.l,e=0,i=0;it;t++){i=0|n[t-15],e=0|n[t-2];var r=0|(0|n[t-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3),o=0|(0|n[t-7])+((e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10);n[t]=0|r+o}e=0|d.a[0],i=0|d.a[1];var a=0|d.a[2],s=0|d.a[3],p=0|d.a[4],u=0|d.a[5],h=0|d.a[6];for(r=0|d.a[7],t=0;64>t;t++){var m=0|((e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10))+(e&i^e&a^i&a);o=p&u^~p&h,r=0|r+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7)),o=0|o+(0|Zl[t]),o=0|r+(0|o+(0|n[t])),r=h,h=u,u=p,p=0|s+o,s=a,a=i,i=e,e=0|o+m}d.a[0]=0|d.a[0]+e,d.a[1]=0|d.a[1]+i,d.a[2]=0|d.a[2]+a,d.a[3]=0|d.a[3]+s,d.a[4]=0|d.a[4]+p,d.a[5]=0|d.a[5]+u,d.a[6]=0|d.a[6]+h,d.a[7]=0|d.a[7]+r}function Xn(t,n,e){void 0===e&&(e=n.length);var i=0,r=t.c;if(td(n))for(;i=o&&o==(0|o)))throw Error('message must be a byte array');t.f[r++]=o,r==t.b&&(qn(t),r=0)}}t.c=r,t.g+=e}function Bn(){Fn.call(this,8,ap)}function Hn(t){if(t.P&&'function'==typeof t.P)return t.P();if(td(t))return t.split('');if(rd(t)){for(var n=[],e=t.length,o=0;ot)throw Error('Bad port number '+t);e.i=t}else e.i=null}function Zn(o,t,n){t instanceof ae?(o.a=t,pe(o.a,o.f)):(n||(t=re(t,pp)),o.a=new ae(t,0,o.f))}function Qn(o,t,n){o.a.set(t,n)}function te(e,t){return e.a.get(t)}function ne(e){return e instanceof Jn?new Jn(e):new Jn(e,void 0)}function ee(o,t){var n=new Jn(null,void 0);return Yn(n,'https'),o&&(n.b=o),t&&(n.g=t),n}function ie(e,t){return e?t?decodeURI(e.replace(/%25/g,'%2525')):decodeURIComponent(e):''}function re(t,n,e){return td(t)?(t=encodeURI(t).replace(n,oe),e&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,'%$1')),t):null}function oe(e){return e=e.charCodeAt(0),'%'+(15&e>>4).toString(16)+(15&e).toString(16)}function ae(o,t,n){this.b=this.a=null,this.c=o||null,this.f=!!n}function se(o){o.a||(o.a=new Tn,o.b=0,o.c&&zn(o.c,function(t,n){ce(o,decodeURIComponent(t.replace(/\+/g,' ')),n)}))}function ue(a){var t=Wn(a);if(void 0===t)throw Error('Keys are undefined');var n=new ae(null,0,void 0);a=Hn(a);for(var e=0;e2*e.c&&An(e)))}function fe(e,t){return se(e),t=de(e,t),kn(e.a.b,t)}function le(o,t,n){he(o,t),0n;n++){e=t[n];try{return new ActiveXObject(e),o.f=e}catch(e){}}throw Error('Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed')}return o.f}function we(e){hn.call(this),this.headers=new Tn,this.w=e||null,this.b=!1,this.v=this.a=null,this.g=this.I=this.i='',this.c=this.G=this.h=this.A=!1,this.f=0,this.m=null,this.l=hp,this.o=this.N=!1}function ye(a,t,n,e,i){if(a.a)throw Error('[goog.net.XhrIo] Object is active with another request='+a.i+'; newUri='+t);n=n?n.toUpperCase():'GET',a.i=t,a.g='',a.I=n,a.A=!1,a.b=!0,a.a=a.w?a.w.a():up.a(),a.v=me(a.w?a.w:up),a.a.onreadystatechange=f(a.Ab,a);try{En(a.J,Re(a,'Opening Xhr')),a.G=!0,a.a.open(n,t+'',!0),a.G=!1}catch(e){return En(a.J,Re(a,'Error opening Xhr: '+e.message)),void Ae(a,e)}t=e||'';var r=new Tn(a.headers);i&&Gn(i,function(e,t){r.set(t,e)}),i=T(r.S()),e=Ld.FormData&&t instanceof Ld.FormData,!A(yp,n)||i||e||r.set('Content-Type','application/x-www-form-urlencoded;charset=utf-8'),r.forEach(function(e,t){this.a.setRequestHeader(t,e)},a),a.l&&(a.a.responseType=a.l),'withCredentials'in a.a&&a.a.withCredentials!==a.N&&(a.a.withCredentials=a.N);try{Se(a),0e||$d&&ll&&!(9',s=Rt(s),o.document.write(Ct(s)),o.document.close())):o=s.open(Nt(t),d,o),o)try{o.focus()}catch(e){}return o}function ze(o){return new $(function(t){function n(){mn(2e3).then(function(){return o&&!o.closed?n():void t()})}return n()})}function Je(){var e=null;return new $(function(t){'complete'==Ld.document.readyState?t():(e=function(){t()},tn(window,'load',e))}).s(function(t){throw nn(window,'load',e),t})}function Ye(){return $e(void 0)?Je().then(function(){return new $(function(o,t){var n=Ld.document,e=setTimeout(function(){t(Error('Cordova framework is not ready.'))},1e3);n.addEventListener('deviceready',function(){clearTimeout(e),o()},!1)})}):nt(Error('Cordova must run in an Android or iOS file scheme.'))}function $e(e){return e=e||ii(),'file:'===ui()&&e.toLowerCase().match(/iphone|ipad|ipod|android/)}function Ze(){var e=Ld.window;try{return e&&e!=e.top}catch(e){return!1}}function Qe(){return Nd.INTERNAL.hasOwnProperty('reactNative')?'ReactNative':Nd.INTERNAL.hasOwnProperty('node')?'Node':'Browser'}function ti(){var e=Qe();return'ReactNative'===e||'Node'===e}function ni(e){var t=e.toLowerCase();return g(t,'opera/')||g(t,'opr/')||g(t,'opios/')?'Opera':g(t,'iemobile')?'IEMobile':g(t,'msie')||g(t,'trident/')?'IE':g(t,'edge/')?'Edge':g(t,'firefox/')?Sp:g(t,'silk/')?'Silk':g(t,'blackberry')?'Blackberry':g(t,'webos')?'Webos':!g(t,'safari/')||g(t,'chrome/')||g(t,'crios/')||g(t,'android')?(g(t,'chrome/')||g(t,'crios/'))&&!g(t,'edge/')?Ep:g(t,'android')?'Android':(e=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==e.length?e[1]:'Other':'Safari'}function ei(o,t){t=t||[];var n=[],a={},r;for(r in kp)a[kp[r]]=!0;for(r=0;rt)throw Error('Short delay should be less than long delay!');this.c=o,this.b=t,o=n||ii(),e=e||Qe(),this.a=He(o)||'ReactNative'===e}function bi(){var e=Ld.document;return!e||void 0===e.visibilityState||'visible'==e.visibilityState}function wi(){var o=Ld.document,r=null;return bi()||!o?tt():new $(function(t){r=function(){bi()&&(o.removeEventListener('visibilitychange',r,!1),t())},o.addEventListener('visibilitychange',r,!1)}).s(function(t){throw o.removeEventListener('visibilitychange',r,!1),t})}function yi(e){try{var t=new Date(parseInt(e,10));if(!isNaN(t.getTime())&&!/[^0-9]/.test(e))return t.toUTCString()}catch(e){}return null}function Ii(o,t,n){wp?Object.defineProperty(o,t,{configurable:!0,enumerable:!0,value:n}):o[t]=n}function Ti(o,t){if(t)for(var n in t)t.hasOwnProperty(n)&&Ii(o,n,t[n])}function Ai(e){var t={};return Ti(t,e),t}function ki(o){var t={},e;for(e in o)o.hasOwnProperty(e)&&(t[e]=o[e]);return t}function Ei(o,r){if(!r||!r.length)return!0;if(!o)return!1;for(var a=0,e;a Auth section -> Sign in method tab.',o):'http'==n||'https'==n?r=v('This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.',o):t='operation-not-supported-in-this-environment',Oi.call(this,t,r)}function lr(o,t,n){Oi.call(this,o,n),o=t||{},o.sb&&Ii(this,'email',o.sb),o.Y&&Ii(this,'phoneNumber',o.Y),o.credential&&Ii(this,'credential',o.credential)}function dr(o){if(o.code){var t=o.code||'';0==t.indexOf(_p)&&(t=t.substring(_p.length));var n={credential:sr(o)};if(o.email)n.sb=o.email;else{if(!o.phoneNumber)return new Oi(t,o.message||void 0);n.Y=o.phoneNumber}return new lr(t,n,o.message)}return null}function pr(e){this.f=e}function vr(o,t,n){var e='Node'==Qe();if(!(e=Ld.XMLHttpRequest||e&&Nd.INTERNAL.node&&Nd.INTERNAL.node.XMLHttpRequest))throw new Oi('internal-error','The XMLHttpRequest compatibility library was not found.');this.b=o,o=t||{},this.i=o.secureTokenEndpoint||'https://securetoken.googleapis.com/v1/token',this.l=o.secureTokenTimeout||Jp,this.c=L(o.secureTokenHeaders||$p),this.g=o.firebaseEndpoint||'https://www.googleapis.com/identitytoolkit/v3/relyingparty/',this.h=o.firebaseTimeout||Zp,this.a=L(o.firebaseHeaders||ec),n&&(this.a['X-Client-Version']=n,this.c['X-Client-Version']=n),this.f=new je,this.o=new pr(e)}function mr(e,t){t?e.a['X-Firebase-Locale']=t:delete e.a['X-Firebase-Locale']}function gr(e,t){t?(e.a['X-Client-Version']=t,e.c['X-Client-Version']=t):(delete e.a['X-Client-Version'],delete e.c['X-Client-Version'])}function br(s,t,n,e,i,r,o){mi()?(Be()?s=f(s.m,s):(tc||(tc=new $(function(e,t){wr(e,t)})),s=f(s.u,s)),s(t,n,e,i,r,o)):n&&n(null)}function wr(e,t){((window.gapi||{}).client||{}).request?e():(Ld[oc]=function(){((window.gapi||{}).client||{}).request?e():t(Error('CORS_UNSUPPORTED'))},Dn(_e(At(nc,{onload:oc})),function(){t(Error('CORS_UNSUPPORTED'))}))}function yr(o,t){return new $(function(n,e){'refresh_token'==t.grant_type&&t.refresh_token||'authorization_code'==t.grant_type&&t.code?br(o,o.i+'?key='+encodeURIComponent(o.b),function(o){o?o.error?e(Mr(o)):o.access_token&&o.refresh_token?n(o):e(new Oi('internal-error')):e(new Oi('network-request-failed'))},'POST',''+ue(t),o.c,o.l.get()):e(new Oi('internal-error'))})}function Ir(d,t,l,e,i,n){var r=ne(d.g+t);Qn(r,'key',d.b),n&&Qn(r,'cb',''+Pd());var a='GET'==l;if(a)for(var o in e)e.hasOwnProperty(o)&&Qn(r,o,e[o]);return new $(function(s,n){br(d,''+r,function(e){e?e.error?n(Mr(e,i||{})):s(e):n(new Oi('network-request-failed'))},l,a?void 0:jt(fi(e)),d.a,d.h.get())})}function Tr(e){if(!bp.test(e.email))throw new Oi('invalid-email')}function Ar(e){'email'in e&&Tr(e)}function ud(e,t){return yd(e,dc,{identifier:t,continueUri:si()?Ke():'http://localhost'}).then(function(e){return e.allProviders||[]})}function Er(e){return yd(e,mc,{}).then(function(e){return e.authorizedDomains||[]})}function Nr(e){if(!e[Yp])throw new Oi('internal-error')}function hd(e){if(!(e.phoneNumber||e.temporaryProof)){if(!e.sessionInfo)throw new Oi('missing-verification-id');if(!e.code)throw new Oi('missing-verification-code')}else if(!e.phoneNumber||!e.temporaryProof)throw new Oi('internal-error')}function md(e,t){return yd(e,bc,t)}function Pr(o,t,r){return yd(o,pc,{idToken:t,deleteProvider:r})}function Cr(e){if(!e.requestUri||!e.sessionId&&!e.postBody)throw new Oi('internal-error')}function gd(e){var t=null;if(e.needConfirmation?(e.code='account-exists-with-different-credential',t=dr(e)):'FEDERATED_USER_ID_ALREADY_LINKED'==e.errorMessage?(e.code='credential-already-in-use',t=dr(e)):'EMAIL_EXISTS'==e.errorMessage?(e.code='email-already-in-use',t=dr(e)):e.errorMessage&&(t=jr(e.errorMessage)),t)throw t;if(!e[Yp])throw new Oi('internal-error')}function fd(e,t){return t.returnIdpCredential=!0,yd(e,Ec,t)}function Dr(e,t){return t.returnIdpCredential=!0,yd(e,Tc,t)}function Lr(e,t){return t.returnIdpCredential=!0,t.autoCreate=!1,yd(e,kc,t)}function xr(e){if(!e.oobCode)throw new Oi('invalid-action-code')}function yd(o,t,n){if(!Ei(n,t.ea))return nt(new Oi('internal-error'));var e=t.zb||'POST',r;return tt(n).then(t.D).then(function(){return t.T&&(n.returnSecureToken=!0),Ir(o,t.endpoint,e,n,t.Pb,t.nb||!1)}).then(function(e){return r=e}).then(t.O).then(function(){if(!t.ga)return r;if(!(t.ga in r))throw new Oi('internal-error');return r[t.ga]})}function jr(e){return Mr({error:{errors:[{message:e}],code:400,message:e}})}function Mr(o,t){var a=(o.error&&o.error.errors&&o.error.errors[0]||{}).reason||'',e={keyInvalid:'invalid-api-key',ipRefererBlocked:'app-not-authorized'};if(a=e[a]?new Oi(e[a]):null)return a;for(var i in a=o.error&&o.error.message||'',e={INVALID_CUSTOM_TOKEN:'invalid-custom-token',CREDENTIAL_MISMATCH:'custom-token-mismatch',MISSING_CUSTOM_TOKEN:'internal-error',INVALID_IDENTIFIER:'invalid-email',MISSING_CONTINUE_URI:'internal-error',INVALID_EMAIL:'invalid-email',INVALID_PASSWORD:'wrong-password',USER_DISABLED:'user-disabled',MISSING_PASSWORD:'internal-error',EMAIL_EXISTS:'email-already-in-use',PASSWORD_LOGIN_DISABLED:'operation-not-allowed',INVALID_IDP_RESPONSE:'invalid-credential',FEDERATED_USER_ID_ALREADY_LINKED:'credential-already-in-use',INVALID_MESSAGE_PAYLOAD:'invalid-message-payload',INVALID_RECIPIENT_EMAIL:'invalid-recipient-email',INVALID_SENDER:'invalid-sender',EMAIL_NOT_FOUND:'user-not-found',EXPIRED_OOB_CODE:'expired-action-code',INVALID_OOB_CODE:'invalid-action-code',MISSING_OOB_CODE:'internal-error',CREDENTIAL_TOO_OLD_LOGIN_AGAIN:'requires-recent-login',INVALID_ID_TOKEN:'invalid-user-token',TOKEN_EXPIRED:'user-token-expired',USER_NOT_FOUND:'user-token-expired',CORS_UNSUPPORTED:'cors-unsupported',DYNAMIC_LINK_NOT_ACTIVATED:'dynamic-link-not-activated',INVALID_APP_ID:'invalid-app-id',TOO_MANY_ATTEMPTS_TRY_LATER:'too-many-requests',WEAK_PASSWORD:'weak-password',OPERATION_NOT_ALLOWED:'operation-not-allowed',USER_CANCELLED:'user-cancelled',CAPTCHA_CHECK_FAILED:'captcha-check-failed',INVALID_APP_CREDENTIAL:'invalid-app-credential',INVALID_CODE:'invalid-verification-code',INVALID_PHONE_NUMBER:'invalid-phone-number',INVALID_SESSION_INFO:'invalid-verification-id',INVALID_TEMPORARY_PROOF:'invalid-credential',MISSING_APP_CREDENTIAL:'missing-app-credential',MISSING_CODE:'missing-verification-code',MISSING_PHONE_NUMBER:'missing-phone-number',MISSING_SESSION_INFO:'missing-verification-id',QUOTA_EXCEEDED:'quota-exceeded',SESSION_EXPIRED:'code-expired',INVALID_CONTINUE_URI:'invalid-continue-uri',MISSING_ANDROID_PACKAGE_NAME:'missing-android-pkg-name',MISSING_IOS_BUNDLE_ID:'missing-ios-bundle-id',UNAUTHORIZED_DOMAIN:'unauthorized-continue-uri',INVALID_OAUTH_CLIENT_ID:'invalid-oauth-client-id',INVALID_CERT_HASH:'invalid-cert-hash'},x(e,t||{}),t=(t=a.match(/^[^\s]+\s*:\s*(.*)$/))&&1t.c?Xn(t,op,56-t.c):Xn(t,op,t.b-(t.c-56));for(var e=63;56<=e;e--)t.f[e]=255&n,n/=256;for(qn(t),e=n=0;e>a;return Nn(o)}function jo(d,t,n,e){var i=xo(),r=new cr(t,e,null,i,new Oi('no-auth-event')),o=ri('BuildInfo.packageName',Ld);if('string'!=typeof o)throw new Oi('invalid-cordova-configuration');var l=ri('BuildInfo.displayName',Ld),s={};if(ii().toLowerCase().match(/iphone|ipad|ipod/))s.ibi=o;else{if(!ii().toLowerCase().match(/android/))return nt(new Oi('operation-not-supported-in-this-environment'));s.apn=o}l&&(s.appDisplayName=l),i=Uo(i),s.sessionId=i;var p=Zr(d.u,d.i,d.l,t,n,null,e,d.m,s,d.o);return d.ba().then(function(){var e=d.h;return d.A.a.set(jc,r.B(),e)}).then(function(){var t=ri('cordova.plugins.browsertab.isAvailable',Ld);if('function'!=typeof t)throw new Oi('invalid-cordova-configuration');var o=null;t(function(e){if(e){if('function'!=typeof(o=ri('cordova.plugins.browsertab.openUrl',Ld)))throw new Oi('invalid-cordova-configuration');o(p)}else{if('function'!=typeof(o=ri('cordova.InAppBrowser.open',Ld)))throw new Oi('invalid-cordova-configuration');e=ii(),e=e.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||e.match(/(iPad|iPhone|iPod).*OS 8_\d/i),d.a=o(p,e?'_blank':'_system','location=yes')}})})}function Mo(o,t){for(var n=0;ne.f&&(e.a=e.f),t)}function la(e,t){da(e),e.b=mn(fa(e,t)).then(function(){return e.l?tt():wi()}).then(function(){return e.h()}).then(function(){la(e,!0)}).s(function(t){e.i(t)&&la(e,!1)})}function da(e){e.b&&(e.b.cancel(),e.b=null)}function pa(e){this.f=e,this.b=this.a=null,this.c=0}function va(o,t){var n=t[Yp],e=t.refreshToken;t=ma(t.expiresIn),o.b=n,o.c=t,o.a=e}function ma(e){return Pd()+1e3*parseInt(e,10)}function ga(e,t){return yr(e.f,t).then(function(t){return e.b=t.access_token,e.c=ma(t.expires_in),e.a=t.refresh_token,{accessToken:e.b,expirationTime:e.c,refreshToken:e.a}}).s(function(t){throw'auth/user-token-expired'==t.code&&(e.a=null),t})}function ba(e,t){this.a=e||null,this.b=t||null,Ti(this,{lastSignInTime:yi(t||null),creationTime:yi(e||null)})}function wa(e){return new ba(e.a,e.b)}function ya(a,s,d,e,i,r){Ti(this,{uid:a,displayName:e||null,photoURL:i||null,email:d||null,phoneNumber:r||null,providerId:s})}function Ia(o,t){for(var n in Xt.call(this,o),t)this[n]=t[n]}function Ta(o,t,n){this.A=[],this.G=o.apiKey,this.o=o.appName,this.w=o.authDomain||null,o=Nd.SDK_VERSION?ei(Nd.SDK_VERSION):null,this.c=new vr(this.G,Vr(Oc),o),this.h=new pa(this.c),Ca(this,t[Yp]),va(this.h,t),Ii(this,'refreshToken',this.h.a),La(this,n||{}),hn.call(this),this.I=!1,this.w&&ai()&&(this.a=Zo(this.w,this.G,this.o)),this.N=[],this.i=null,this.l=Sa(this),this.U=f(this.Ga,this);var e=this;this.ha=null,this.ra=function(n){e.na(n.h)},this.W=null,this.R=[],this.qa=function(n){ka(e,n.f)},this.V=null}function Sd(e,t){e.W&&nn(e.W,'languageCodeChanged',e.ra),(e.W=t)&&$t(t,'languageCodeChanged',e.ra)}function ka(e,t){e.R=t,gr(e.c,Nd.SDK_VERSION?ei(Nd.SDK_VERSION,e.R):null)}function Ea(e,t){e.V&&nn(e.V,'frameworkChanged',e.qa),(e.V=t)&&$t(t,'frameworkChanged',e.qa)}function Na(e){try{return Nd.app(e.o).auth()}catch(t){throw new Oi('internal-error','No firebase.auth.Auth instance is available for the Firebase App \''+e.o+'\'!')}}function Sa(e){return new ha(function(){return e.F(!0)},function(e){return e&&'auth/network-request-failed'==e.code},function(){var t=e.h.c-Pd()-3e5;return 0i||i>=Jc.length)throw new Oi('internal-error','Argument validator received an unsupported number of arguments.');n=Jc[i],e=(e?'':n+' argument ')+(t.name?'"'+t.name+'" ':'')+'must be '+t.K+'.';break t}e=null}}if(e)throw new Oi('argument-error',s+' failed: '+e)}function Ds(o,n){return{name:o||'',K:'a valid string',optional:!!n,M:td}}function Ls(){return{name:'opt_forceRefresh',K:'a boolean',optional:!0,M:e}}function xs(e,t){return{name:e||'',K:'a valid object',optional:!!t,M:ad}}function Us(e,t){return{name:e||'',K:'a function',optional:!!t,M:a}}function js(e,t){return{name:e||'',K:'null',optional:!!t,M:r}}function Ms(){return{name:'',K:'an HTML element',optional:!1,M:function(e){return!!(e&&e instanceof Element)}}}function Vs(){return{name:'auth',K:'an instance of Firebase Auth',optional:!0,M:function(e){return!!(e&&e instanceof ps)}}}function Fs(){return{name:'app',K:'an instance of Firebase App',optional:!0,M:function(e){return!!(e&&e instanceof Nd.app.App)}}}function Ks(o){return{name:o?o+'Credential':'credential',K:o?'a valid '+o+' credential':'a valid credential',optional:!1,M:function(r){if(!r)return!1;var a=!o||r.providerId===o;return r.wa&&a}}}function qs(){return{name:'authProvider',K:'a valid Auth provider',optional:!1,M:function(e){return!!(e&&e.providerId&&e.hasOwnProperty&&e.hasOwnProperty('isOAuthProvider'))}}}function Xs(){return{name:'applicationVerifier',K:'an implementation of firebase.auth.ApplicationVerifier',optional:!1,M:function(e){return!!(e&&td(e.type)&&a(e.verify))}}}function Bs(o,t,n,e){return{name:n||'',K:o.K+' or '+t.K,optional:!!e,M:function(n){return o.M(n)||t.M(n)}}}function Hs(d,t,n,e,i,r){if(Ii(this,'type','recaptcha'),this.b=this.c=null,this.m=!1,this.l=t,this.a=n||{theme:'light',type:'image'},this.g=[],this.a[eu])throw new Oi('argument-error','sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.');if(this.h='invisible'===this.a[tu],!_t(t)||!this.h&&_t(t).hasChildNodes())throw new Oi('argument-error','reCAPTCHA container is either not found or already contains inner elements!');this.u=new vr(d,r||null,i||null),this.o=e||function(){return null};var o=this;this.i=[];var a=this.a[$c];this.a[$c]=function(e){if(Ws(o,e),'function'==typeof a)a(e);else if('string'==typeof a){var t=ri(a,Ld);'function'==typeof t&&t(e)}};var l=this.a[Zc];this.a[Zc]=function(){if(Ws(o,null),'function'==typeof l)l();else if('string'==typeof l){var e=ri(l,Ld);'function'==typeof e&&e()}}}function Ws(o,t){for(var n=0;n>>0),Od=0,Pd=Date.now||function(){return+new Date},Dd;id(p,Error),p.prototype.name='CustomError';var _d=String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,'')},Md=/&/g,Fd=//g,Ud=/"/g,Vd=/'/g,Wd=/\x00/g,Hd=/[\x00&<>"']/;id(w,p),w.prototype.name='AssertionError';var qd=Array.prototype.indexOf?function(o,t,n){return Array.prototype.indexOf.call(o,t,n)}:function(t,n,e){if(e=null==e?0:0>e?d(0,t.length+e):e,td(t))return td(n)&&1==n.length?t.indexOf(n,e):-1;for(;eparseFloat(rl)){ol=il+'';break t}}ol=rl}var sl={},dl=Ld.document,ll;ll=dl&&$d?M()||('CSS1Compat'==dl.compatMode?parseInt(ol,10):5):void 0,q.prototype.get=function(){if(0'),Rt(''),Rt('
');var Nl={cellpadding:'cellPadding',cellspacing:'cellSpacing',colspan:'colSpan',frameborder:'frameBorder',height:'height',maxlength:'maxLength',nonce:'nonce',role:'role',rowspan:'rowSpan',type:'type',usemap:'useMap',valign:'vAlign',width:'width'},Al={'"':'\\"',"\\":'\\\\',"/":'\\/',"":'\\b'," ":'\\f',"\n":'\\n',"\r":'\\r'," ":'\\t'," ":'\\u000b'},Ll=/\uffff/.test('\uFFFF')?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,Rl=0,Ol={};Kt.prototype.oa=!1,Kt.prototype.ta=function(){if(this.Fa)for(;this.Fa.length;)this.Fa.shift()()};var Pl=Object.freeze||function(e){return e},Dl=!$d||9<=+ll,_l=$d&&!V('9'),Ml=function(){if(!Ld.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},'passive',{get:function(){e=!0}});return Ld.addEventListener('test',nd,t),Ld.removeEventListener('test',nd,t),e}();Xt.prototype.c=function(){this.Bb=!1},id(Bt,Xt);var Fl=Pl({2:'touch',3:'pen',4:'mouse'});Bt.prototype.c=function(){Bt.ib.c.call(this);var e=this.a;if(e.preventDefault)e.preventDefault();else if(e.returnValue=!1,_l)try{(e.ctrlKey||112<=e.keyCode&&123>=e.keyCode)&&(e.keyCode=-1)}catch(e){}},Bt.prototype.g=function(){return this.a};var Bl='closure_listenable_'+(0|1e6*Math.random()),Ul=0,Vl='closure_lm_'+(0|1e6*Math.random()),Wl={},Hl=0,ql='__closure_events_fn_'+(1e9*Math.random()>>>0);id(hn,Kt),hn.prototype[Bl]=!0,hn.prototype.removeEventListener=function(o,t,n,e){nn(this,o,t,n,e)},hn.prototype.ta=function(){if(hn.ib.ta.call(this),this.u){var o=this.u,n=0,e;for(e in o.a){for(var t=o.a[e],a=0;a=yn(this).value)for(a(t)&&(t=t()),o=new gn(o,t+'',this.f),n&&(o.a=n),n='log:'+o.b,(o=Ld.console)&&o.timeStamp&&o.timeStamp(n),(o=Ld.msWriteProfilerMark)&&o(n),n=this;n;)n=n.a};var Xl={},Ql=null;Dd=Tn.prototype,Dd.P=function(){An(this);for(var e=[],t=0;t=--t.l&&t.cancel()}this.v?this.v.call(this.o,this):this.u=!0,this.a||(e=new Mn,_n(this),Rn(this,!1,e))}},Cn.prototype.m=function(e,t){this.i=!1,Rn(this,e,t)},Cn.prototype.A=function(e){_n(this),Rn(this,!0,e)},Cn.prototype.then=function(a,t,n){var e=new $(function(e,t){o=e,i=t}),o,i;return Ln(this,o,function(n){n instanceof Mn?e.cancel():i(n)}),e.then(a,t,n)},F(Cn),id(jn,p),jn.prototype.message='Deferred has already fired',jn.prototype.name='AlreadyCalledError',id(Mn,p),Mn.prototype.message='Deferred was canceled',Mn.prototype.name='CanceledError',Vn.prototype.c=function(){throw delete $l[this.a],this.b};var $l={},Zl;id(Fn,function(){this.b=-1});for(var ep=64,tp=[],np=0;npthis.c-3e4?this.a?ga(this,{grant_type:'refresh_token',refresh_token:this.a}):tt(null):tt({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},ba.prototype.B=function(){return{lastLoginAt:this.b,createdAt:this.a}},id(Ia,Xt),id(Ta,hn),Ta.prototype.na=function(e){this.ha=e,mr(this.c,e)},Ta.prototype.$=function(){return this.ha},Ta.prototype.Ka=function(){return S(this.R)},Ta.prototype.Ga=function(){this.l.b&&(da(this.l),this.l.start())},Ii(Ta.prototype,'providerId','firebase'),Dd=Ta.prototype,Dd.reload=function(){var e=this;return Za(this,Ua(this).then(function(){return qa(e).then(function(){return _a(e)}).then(xa)}))},Dd.F=function(e){var o=this;return Za(this,Ua(this).then(function(){return o.h.getToken(e)}).then(function(e){if(!e)throw new Oi('internal-error');return e.accessToken!=o.pa&&(Ca(o,e.accessToken),fn(o,new Ia('tokenChanged'))),Fa(o,'refreshToken',e.refreshToken),e.accessToken}))},Dd.getToken=function(e){return Tp['firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead.']||(Tp['firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead.']=!0,'undefined'!=typeof console&&'function'==typeof console.warn&&console.warn('firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead.')),this.F(e)},Dd.kc=function(o){if(!(o=o.users)||!o.length)throw new Oi('internal-error');o=o[0],La(this,{uid:o.localId,displayName:o.displayName,photoURL:o.photoUrl,email:o.email,emailVerified:!!o.emailVerified,phoneNumber:o.phoneNumber,lastLoginAt:o.lastLoginAt,createdAt:o.createdAt});for(var t=Ha(o),n=0;nthis.o&&(this.o=0),0==this.o&&Ss(this)&&Pa(Ss(this)),this.removeAuthTokenListener(o)},Dd.addAuthTokenListener=function(e){var t=this;this.m.push(e),Rs(this,this.i.then(function(){t.l||A(t.m,e)&&e(Os(t))}))},Dd.removeAuthTokenListener=function(e){E(this.m,function(t){return t==e})},Dd.delete=function(){this.l=!0;for(var e=0;et?n.push(o.substring(r,t)):n.push(o.substring(r,r+e));return n},m.each=function(o,a){if(Array.isArray(o))for(var e=0;er,r=Math.abs(r),2.2250738585072014e-308<=r?(o=Math.min(g(Math.log(r)/Math.LN2),1023),n=o+1023,i=t(r*Math.pow(2,52-o)-4503599627370496)):(n=0,i=t(r/5e-324))),s=[],a=52;a;a-=1)s.push(i%2?1:0),i=g(i/2);for(a=11;a;a-=1)s.push(n%2?1:0),n=g(n/2);s.push(e?1:0),s.reverse(),d=s.join('');var l='';for(a=0;64>a;a+=8){var p=parseInt(d.substr(a,8),2).toString(16);1===p.length&&(p='0'+p),l+=p}return l.toLowerCase()},m.isChromeExtensionContentScript=function(){return'object'==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href)},m.isWindowsStoreApp=function(){return'object'==typeof Windows&&'object'==typeof Windows.UI},m.errorForServerCode=function(o,e){var t='Unknown Error';'too_big'===o?t='The data requested exceeds the maximum size that can be accessed with a single request.':'permission_denied'==o?t='Client doesn\'t have permission to access the desired data.':'unavailable'==o&&(t='The service is unavailable');var n=Error(o+' at '+e.path+': '+t);return n.code=o.toUpperCase(),n},m.e=/^-?\d{1,10}$/,m.tryParseInt=function(t){if(m.e.test(t)){var o=+t;if(-2147483648<=o&&2147483647>=o)return o}return null},m.exceptionGuard=function(t){try{t()}catch(t){setTimeout(function(){var e=t.stack||'';throw m.warn('Exception was thrown by user callback.',e),t},0)}},m.callUserCallback=function(t){for(var o=[],n=1;n=this.n.length?null:this.n[this.i]},o.prototype.getLength=function(){return this.n.length-this.i},o.prototype.popFront=function(){var e=this.i;return e=this.n.length)return null;for(var e=[],t=this.i;t=this.n.length},o.relativePath=function(e,t){var n=e.getFront(),r=t.getFront();if(null===n)return t;if(n===r)return o.relativePath(e.popFront(),t.popFront());throw Error('INTERNAL ERROR: innerPath ('+t+') is not within outerPath ('+e+')')},o.comparePaths=function(r,e){for(var t=r.slice(),n=e.slice(),i=0,o;io.getLength())return!1;for(;et.MAX_PATH_LENGTH_BYTES)throw Error(this.o+'has a key path longer than '+t.MAX_PATH_LENGTH_BYTES+' bytes ('+this.l+').');if(this.u.length>t.MAX_PATH_DEPTH)throw Error(this.o+'path specified exceeds the maximum depth that can be written ('+t.MAX_PATH_DEPTH+') or object contains a cycle '+this.toErrorString())},t.prototype.toErrorString=function(){return 0==this.u.length?'':'in property \''+this.u.join('.')+'\''},t}();e.ValidationPath=o},function(r,e,t){'use strict';var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,'__esModule',{value:!0});var o=t(15),d=t(1),i=t(5),l=t(16),c,a;e.setNodeFromJSON=function(t){c=t},e.setMaxNode=function(t){a=t};var s=function(o){function e(){return null!==o&&o.apply(this,arguments)||this}return n(e,o),e.prototype.compare=function(o,e){var t=o.node.getPriority(),n=e.node.getPriority(),r=t.compareTo(n);return 0===r?d.nameCompare(o.name,e.name):r},e.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},e.prototype.indexedValueChanged=function(n,e){return!n.getPriority().equals(e.getPriority())},e.prototype.minPost=function(){return i.NamedNode.MIN},e.prototype.maxPost=function(){return new i.NamedNode(d.MAX_NAME,new l.LeafNode('[PRIORITY-POST]',a))},e.prototype.makePost=function(o,e){var t=c(o);return new i.NamedNode(e,new l.LeafNode('[PRIORITY-POST]',t))},e.prototype.toString=function(){return'.priority'},e}(o.Index);e.PriorityIndex=s,e.PRIORITY_INDEX=new s},function(m,g,e){'use strict';var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(g,'__esModule',{value:!0});var b=e(0),t=e(1),o=e(17),v=e(5),r=e(37),l=e(3),a=e(10),s=e(39),p=e(16),d=e(41),c=function(){function p(o,a,t){this._=o,this.y=a,this.g=t,this.m=null,this.y&&r.validatePriorityNode(this.y),this._.isEmpty()&&b.assert(!this.y||this.y.isEmpty(),'An empty node cannot have a priority')}return Object.defineProperty(p,'EMPTY_NODE',{get:function(){return u||(u=new p(new o.SortedMap(d.NAME_COMPARATOR),null,s.IndexMap.Default))},enumerable:!0,configurable:!0}),p.prototype.isLeafNode=function(){return!1},p.prototype.getPriority=function(){return this.y||u},p.prototype.updatePriority=function(e){return this._.isEmpty()?this:new p(this._,e,this.g)},p.prototype.getImmediateChild=function(n){if('.priority'===n)return this.getPriority();var e=this._.get(n);return null===e?u:e},p.prototype.getChild=function(n){var e=n.getFront();return null===e?this:this.getImmediateChild(e).getChild(n.popFront())},p.prototype.hasChild=function(t){return null!==this._.get(t)},p.prototype.updateImmediateChild=function(e,t){if(b.assert(t,'We should always be passing snapshot nodes'),'.priority'===e)return this.updatePriority(t);var n=new v.NamedNode(e,t),o,r,a;return t.isEmpty()?(o=this._.remove(e),r=this.g.removeFromIndexes(n,this._)):(o=this._.insert(e,t),r=this.g.addToIndexes(n,this._)),a=o.isEmpty()?u:this.y,new p(o,a,r)},p.prototype.updateChild=function(o,e){var t=o.getFront();if(null===t)return e;b.assert('.priority'!==o.getFront()||1===o.getLength(),'.priority must be the last token in a path');var n=this.getImmediateChild(t).updateChild(o.popFront(),e);return this.updateImmediateChild(t,n)},p.prototype.isEmpty=function(){return this._.isEmpty()},p.prototype.numChildren=function(){return this._.count()},p.prototype.val=function(e){if(this.isEmpty())return null;var d={},n=0,r=0,i=!0;if(this.forEachChild(l.PRIORITY_INDEX,function(t,o){d[t]=o.val(e),n++,i&&p.e.test(t)?r=Math.max(r,+t):i=!1}),!e&&i&&r<2*n){var o=[];for(var a in d)o[a]=d[a];return o}return e&&!this.getPriority().isEmpty()&&(d['.priority']=this.getPriority().val()),d},p.prototype.hash=function(){if(null===this.m){var o='';this.getPriority().isEmpty()||(o+='priority:'+r.priorityHashText(this.getPriority().val())+':'),this.forEachChild(l.PRIORITY_INDEX,function(e,t){var n=t.hash();''!==n&&(o+=':'+e+':'+n)}),this.m=''==o?'':t.sha1(o)}return this.m},p.prototype.getPredecessorChildName=function(o,e,t){var n=this.C(t);if(n){var r=n.getPredecessorKey(new v.NamedNode(o,e));return r?r.name:null}return this._.getPredecessorKey(o)},p.prototype.getFirstChildName=function(o){var e=this.C(o);if(e){var t=e.minKey();return t&&t.name}return this._.minKey()},p.prototype.getFirstChild=function(n){var e=this.getFirstChildName(n);return e?new v.NamedNode(e,this._.get(e)):null},p.prototype.getLastChildName=function(o){var e=this.C(o);if(e){var t=e.maxKey();return t&&t.name}return this._.maxKey()},p.prototype.getLastChild=function(n){var e=this.getLastChildName(n);return e?new v.NamedNode(e,this._.get(e)):null},p.prototype.forEachChild=function(o,r){var e=this.C(o);return e?e.inorderTraversal(function(t){return r(t.name,t.node)}):this._.inorderTraversal(r)},p.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},p.prototype.getIteratorFrom=function(o,e){var t=this.C(e);if(t)return t.getIteratorFrom(o,function(t){return t});for(var n=this._.getIteratorFrom(o.name,v.NamedNode.Wrap),r=n.peek();null!=r&&0>e.compare(r,o);)n.getNext(),r=n.peek();return n},p.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},p.prototype.getReverseIteratorFrom=function(o,e){var t=this.C(e);if(t)return t.getReverseIteratorFrom(o,function(t){return t});for(var n=this._.getReverseIteratorFrom(o.name,v.NamedNode.Wrap),r=n.peek();null!=r&&0p.S/3&&o.stringLength(e)>p.S)throw Error(i+'contains a string greater than '+p.S+' utf8 bytes '+a.toErrorString()+' (\''+e.substring(0,50)+'...\')');if(e&&'object'==typeof e){var s=!1,d=!1;if(c.forEach(e,function(e,t){if('.value'===e)s=!0;else if('.priority'!==e&&'.sv'!==e&&(d=!0,!p.isValidKey(e)))throw Error(i+' contains an invalid key ('+e+') '+a.toErrorString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');a.push(e),p.validateFirebaseData(i,t,a),a.pop()}),s&&d)throw Error(i+' contains ".value" child '+a.toErrorString()+' in addition to actual children.')}},p.validateFirebaseMergePaths=function(r,e){var n,i;for(n=0;ni)a=this.I?a.left:a.right;else{if(0===i){this.O.push(a);break}this.O.push(a),a=this.I?a.right:a.left}}return t.prototype.getNext=function(){if(0===this.O.length)return null;var n=this.O.pop(),t;if(t=this.R?this.R(n.key,n.value):{key:n.key,value:n.value},this.I)for(n=n.left;!n.isEmpty();)this.O.push(n),n=n.right;else for(n=n.right;!n.isEmpty();)this.O.push(n),n=n.left;return t},t.prototype.hasNext=function(){return 0n?r.copy(null,null,null,r.left.insert(o,e,t),null):0===n?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(o,e,t)),r.D()},a.prototype.M=function(){if(this.left.isEmpty())return d.EMPTY_NODE;var t=this;return t.left.L()||t.left.left.L()||(t=t.F()),t=t.copy(null,null,null,t.left.M(),null),t.D()},a.prototype.remove=function(o,e){var t,n;if(t=this,0>e(o,t.key))t.left.isEmpty()||t.left.L()||t.left.left.L()||(t=t.F()),t=t.copy(null,null,null,t.left.remove(o,e),null);else{if(t.left.L()&&(t=t.x()),t.right.isEmpty()||t.right.L()||t.right.left.L()||(t=t.k()),0===e(o,t.key)){if(t.right.isEmpty())return d.EMPTY_NODE;n=t.right.A(),t=t.copy(n.key,n.value,null,null,t.right.M())}t=t.copy(null,null,null,null,t.right.remove(o,e))}return t.D()},a.prototype.L=function(){return this.color},a.prototype.D=function(){var t=this;return t.right.L()&&!t.left.L()&&(t=t.W()),t.left.L()&&t.left.left.L()&&(t=t.x()),t.left.L()&&t.right.L()&&(t=t.j()),t},a.prototype.F=function(){var t=this.j();return t.right.left.L()&&(t=t.copy(null,null,null,null,t.right.x()),t=t.W(),t=t.j()),t},a.prototype.k=function(){var t=this.j();return t.left.left.L()&&(t=t.x(),t=t.j()),t},a.prototype.W=function(){var e=this.copy(null,null,a.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},a.prototype.x=function(){var e=this.copy(null,null,a.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},a.prototype.j=function(){var n=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,n,e)},a.prototype.V=function(){var t=this.Q();return Math.pow(2,t)<=this.count()+1},a.prototype.Q=function(){var t;if(this.L()&&this.left.L())throw Error('Red node has red child('+this.key+','+this.value+')');if(this.right.L())throw Error('Right child of ('+this.key+','+this.value+') is red');if((t=this.left.Q())!==this.right.Q())throw Error('Black depths differ');return t+(this.L()?0:1)},a.RED=!0,a.BLACK=!1,a}();e.LLRBNode=r;var t=function(){function t(){}return t.prototype.copy=function(){return this},t.prototype.insert=function(n,e){return new r(n,e,null)},t.prototype.remove=function(){return this},t.prototype.count=function(){return 0},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(){return!1},t.prototype.reverseTraversal=function(){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.Q=function(){return 0},t.prototype.L=function(){return!1},t}();e.LLRBEmptyNode=t;var d=function(){function o(e,t){void 0===t&&(t=o.EMPTY_NODE),this.U=e,this.B=t}return o.prototype.insert=function(e,t){return new o(this.U,this.B.insert(e,t,this.U).copy(null,null,r.BLACK,null,null))},o.prototype.remove=function(e){return new o(this.U,this.B.remove(e,this.U).copy(null,null,r.BLACK,null,null))},o.prototype.get=function(o){for(var e=this.B,n;!e.isEmpty();){if(0===(n=this.U(o,e.key)))return e.value;0>n?e=e.left:0r?e=e.left:0.firebaseio.com instead'),n&&'undefined'!=n||o.fatal('Cannot parse Firebase url. Please use https://.firebaseio.com'),e.secure||o.warnIfPageIsSecure();var r='ws'===e.scheme||'wss'===e.scheme;return{repoInfo:new i.RepoInfo(e.host,e.secure,n,r),path:new t.Path(e.pathString)}},d.parseURL=function(r){var d='',m='',g='',f='',y=!0,b='https',v=443;if('string'==typeof r){var x=r.indexOf('//');0<=x&&(b=r.substring(0,x-1),r=r.substring(x+2));var l=r.indexOf('/');-1===l&&(l=r.length),d=r.substring(0,l),f=p(r.substring(l));var h=d.split('.');3===h.length?(m=h[1],g=h[0].toLowerCase()):2===h.length&&(m=h[0]),0<=(x=d.indexOf(':'))&&(y='https'===b||'wss'===b,v=parseInt(d.substring(x+1),10))}return{host:d,port:v,domain:m,subdomain:g,secure:y,scheme:b,pathString:f}}},function(d,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var l=t(0),r=t(0),p=t(13),i=t(14),n=function(){function t(o,a,t,n,r){void 0===r&&(r=''),this.secure=a,this.namespace=t,this.webSocketOnly=n,this.persistenceKey=r,this.host=o.toLowerCase(),this.domain=this.host.substr(this.host.indexOf('.')+1),this.internalHost=p.PersistentStorage.get('host:'+o)||this.host}return t.prototype.needsQueryParam=function(){return this.host!==this.internalHost},t.prototype.isCacheableHost=function(){return's-'===this.internalHost.substr(0,2)},t.prototype.isDemoHost=function(){return'firebaseio-demo.com'===this.domain},t.prototype.isCustomHost=function(){return'firebaseio.com'!==this.domain&&'firebaseio-demo.com'!==this.domain},t.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&p.PersistentStorage.set('host:'+this.host,this.internalHost))},t.prototype.connectionURL=function(a,s){l.assert('string'==typeof a,'typeof type must == string'),l.assert('object'==typeof s,'typeof params must == object');var d;if(a===i.WEBSOCKET)d=(this.secure?'wss://':'ws://')+this.internalHost+'/.ws?';else{if(a!==i.LONG_POLLING)throw Error('Unknown connection type: '+a);d=(this.secure?'https://':'http://')+this.internalHost+'/.lp?'}this.needsQueryParam()&&(s.ns=this.namespace);var n=[];return r.forEach(s,function(o,e){n.push(o+'='+e)}),d+n.join('&')},t.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+='<'+this.persistenceKey+'>'),t},t.prototype.toURLString=function(){return(this.secure?'https://':'http://')+this.host},t}();e.RepoInfo=n},function(d,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var l=t(0),r=t(7),i=t(1),p=t(0),n=function(){function t(n,o){this.Ie=n,this.Oe=o}return t.prototype.cancel=function(n){l.validateArgCount('OnDisconnect.cancel',0,1,arguments.length),l.validateCallback('OnDisconnect.cancel',1,n,!0);var e=new p.Deferred;return this.Ie.onDisconnectCancel(this.Oe,e.wrapCallback(n)),e.promise},t.prototype.remove=function(n){l.validateArgCount('OnDisconnect.remove',0,1,arguments.length),r.validateWritablePath('OnDisconnect.remove',this.Oe),l.validateCallback('OnDisconnect.remove',1,n,!0);var e=new p.Deferred;return this.Ie.onDisconnectSet(this.Oe,null,e.wrapCallback(n)),e.promise},t.prototype.set=function(o,e){l.validateArgCount('OnDisconnect.set',1,2,arguments.length),r.validateWritablePath('OnDisconnect.set',this.Oe),r.validateFirebaseDataArg('OnDisconnect.set',1,o,this.Oe,!1),l.validateCallback('OnDisconnect.set',2,e,!0);var t=new p.Deferred;return this.Ie.onDisconnectSet(this.Oe,o,t.wrapCallback(e)),t.promise},t.prototype.setWithPriority=function(a,e,t){l.validateArgCount('OnDisconnect.setWithPriority',2,3,arguments.length),r.validateWritablePath('OnDisconnect.setWithPriority',this.Oe),r.validateFirebaseDataArg('OnDisconnect.setWithPriority',1,a,this.Oe,!1),r.validatePriority('OnDisconnect.setWithPriority',2,e,!1),l.validateCallback('OnDisconnect.setWithPriority',3,t,!0);var n=new p.Deferred;return this.Ie.onDisconnectSetWithPriority(this.Oe,a,e,n.wrapCallback(t)),n.promise},t.prototype.update=function(o,e){if(l.validateArgCount('OnDisconnect.update',1,2,arguments.length),r.validateWritablePath('OnDisconnect.update',this.Oe),Array.isArray(o)){for(var t={},n=0;n=e)throw Error('Query.limitToFirst: First argument must be a positive integer.');if(this.Ae.hasLimit())throw Error('Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).');return new h(this.repo,this.path,this.Ae.limitToFirst(e),this.De)},h.prototype.limitToLast=function(e){if(c.validateArgCount('Query.limitToLast',1,1,arguments.length),'number'!=typeof e||n(e)!==e||0>=e)throw Error('Query.limitToLast: First argument must be a positive integer.');if(this.Ae.hasLimit())throw Error('Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).');return new h(this.repo,this.path,this.Ae.limitToLast(e),this.De)},h.prototype.orderByChild=function(e){if(c.validateArgCount('Query.orderByChild',1,1,arguments.length),'$key'===e)throw Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if('$priority'===e)throw Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if('$value'===e)throw Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');y.validatePathString('Query.orderByChild',1,e,!1),this.Fe('Query.orderByChild');var t=new l.Path(e);if(t.isEmpty())throw Error('Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.');var n=new s.PathIndex(t),o=this.Ae.orderBy(n);return h.Me(o),new h(this.repo,this.path,o,!0)},h.prototype.orderByKey=function(){c.validateArgCount('Query.orderByKey',0,0,arguments.length),this.Fe('Query.orderByKey');var e=this.Ae.orderBy(i.KEY_INDEX);return h.Me(e),new h(this.repo,this.path,e,!0)},h.prototype.orderByPriority=function(){c.validateArgCount('Query.orderByPriority',0,0,arguments.length),this.Fe('Query.orderByPriority');var e=this.Ae.orderBy(o.PRIORITY_INDEX);return h.Me(e),new h(this.repo,this.path,e,!0)},h.prototype.orderByValue=function(){c.validateArgCount('Query.orderByValue',0,0,arguments.length),this.Fe('Query.orderByValue');var e=this.Ae.orderBy(a.VALUE_INDEX);return h.Me(e),new h(this.repo,this.path,e,!0)},h.prototype.startAt=function(e,t){void 0===e&&(e=null),c.validateArgCount('Query.startAt',0,2,arguments.length),y.validateFirebaseDataArg('Query.startAt',1,e,this.path,!0),y.validateKey('Query.startAt',2,t,!0);var n=this.Ae.startAt(e,t);if(h.Le(n),h.Me(n),this.Ae.hasStart())throw Error('Query.startAt: Starting point was already set (by another call to startAt or equalTo).');return void 0===e&&(e=null,t=null),new h(this.repo,this.path,n,this.De)},h.prototype.endAt=function(e,t){void 0===e&&(e=null),c.validateArgCount('Query.endAt',0,2,arguments.length),y.validateFirebaseDataArg('Query.endAt',1,e,this.path,!0),y.validateKey('Query.endAt',2,t,!0);var n=this.Ae.endAt(e,t);if(h.Le(n),h.Me(n),this.Ae.hasEnd())throw Error('Query.endAt: Ending point was already set (by another call to endAt or equalTo).');return new h(this.repo,this.path,n,this.De)},h.prototype.equalTo=function(n,e){if(c.validateArgCount('Query.equalTo',1,2,arguments.length),y.validateFirebaseDataArg('Query.equalTo',1,n,this.path,!1),y.validateKey('Query.equalTo',2,e,!0),this.Ae.hasStart())throw Error('Query.equalTo: Starting point was already set (by another call to startAt or equalTo).');if(this.Ae.hasEnd())throw Error('Query.equalTo: Ending point was already set (by another call to endAt or equalTo).');return this.startAt(n,e).endAt(n,e)},h.prototype.toString=function(){return c.validateArgCount('Query.toString',0,0,arguments.length),''+this.repo+this.path.toUrlEncodedString()},h.prototype.toJSON=function(){return c.validateArgCount('Query.toJSON',0,1,arguments.length),''+this},h.prototype.queryObject=function(){return this.Ae.getQueryObject()},h.prototype.queryIdentifier=function(){var n=this.queryObject(),e=u.ObjectToUniqueKey(n);return'{}'===e?'default':e},h.prototype.isEqual=function(e){if(c.validateArgCount('Query.isEqual',1,1,arguments.length),!(e instanceof h))throw Error('Query.isEqual failed: First argument must be an instance of firebase.database.Query.');var t=this.repo===e.repo,n=this.path.equals(e.path),o=this.queryIdentifier()===e.queryIdentifier();return t&&n&&o},h.xe=function(o,e,a){var n={cancel:null,context:null};if(e&&a)n.cancel=e,c.validateCallback(o,3,n.cancel,!0),n.context=a,c.validateContextObject(o,4,n.context,!0);else if(e)if('object'==typeof e&&null!==e)n.context=e;else{if('function'!=typeof e)throw Error(c.errorPrefix(o,3,!0)+' must either be a cancel callback or a context object.');n.cancel=e}return n},Object.defineProperty(h.prototype,'ref',{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),h}(),f;e.Query=h},function(r,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var n=t(0),o=t(1),a=t(0),s;e.setMaxNode=function(t){s=t},e.priorityHashText=function(t){return'number'==typeof t?'number:'+o.doubleToIEEE754String(t):'string:'+t},e.validatePriorityNode=function(o){if(o.isLeafNode()){var e=o.val();n.assert('string'==typeof e||'number'==typeof e||'object'==typeof e&&a.contains(e,'.sv'),'Priority must be a string or number.')}else n.assert(o===s||o.isEmpty(),'priority of unexpected type.');n.assert(o===s||o.getPriority().isEmpty(),'Priority nodes can\'t have a priority of their own.')}},function(d,e,t){'use strict';var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,'__esModule',{value:!0});var r=t(15),i=t(5),o=t(1),a=t(11),s=function(r){function e(){return null!==r&&r.apply(this,arguments)||this}return n(e,r),e.prototype.compare=function(r,e){var t=r.node.compareTo(e.node);return 0===t?o.nameCompare(r.name,e.name):t},e.prototype.isDefinedOn=function(){return!0},e.prototype.indexedValueChanged=function(n,e){return!n.equals(e)},e.prototype.minPost=function(){return i.NamedNode.MIN},e.prototype.maxPost=function(){return i.NamedNode.MAX},e.prototype.makePost=function(o,e){var t=a.nodeFromJSON(o);return new i.NamedNode(e,t)},e.prototype.toString=function(){return'.value'},e}(r.Index);e.ValueIndex=s,e.VALUE_INDEX=new s},function(d,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var m=t(0),i=t(40),o=t(0),a=t(5),n=t(3),s=t(10),g={},l=function(){function l(n,o){this.ke=n,this.We=o}return Object.defineProperty(l,'Default',{get:function(){return m.assert(n.PRIORITY_INDEX,'ChildrenNode.ts has not been loaded'),p=p||new l({".priority":g},{".priority":n.PRIORITY_INDEX})},enumerable:!0,configurable:!0}),l.prototype.get=function(n){var e=o.safeGet(this.ke,n);if(!e)throw Error('No index defined for '+n);return e===g?null:e},l.prototype.hasIndex=function(t){return o.contains(this.We,''+t)},l.prototype.addIndex=function(e,t){m.assert(e!==s.KEY_INDEX,'KeyIndex always exists and isn\'t meant to be added to the IndexMap.');for(var n=[],r=!1,u=t.getIterator(a.NamedNode.Wrap),c=u.getNext();c;)r=r||e.isDefinedOn(c.node),n.push(c),c=u.getNext();var p=r?i.buildChildSet(n,e.getCompare()):g;var d=''+e,h=o.clone(this.We);h[d]=e;var f=o.clone(this.ke);return f[d]=p,new l(f,h)},l.prototype.addToIndexes=function(s,t){var n=this;return new l(o.map(this.ke,function(r,e){var u=o.safeGet(n.We,e);if(m.assert(u,'Missing index implementation for '+e),r===g){if(u.isDefinedOn(s.node)){for(var l=[],c=t.getIterator(a.NamedNode.Wrap),p=c.getNext();p;)p.name!=s.name&&l.push(p),p=c.getNext();return l.push(s),i.buildChildSet(l,u.getCompare())}return g}var d=t.get(s.name),h=r;return d&&(h=h.remove(new a.NamedNode(s.name,d))),h.insert(s,s.node)}),this.We)},l.prototype.removeFromIndexes=function(i,t){return new l(o.map(this.ke,function(n){if(n===g)return n;var e=t.get(i.name);return e?n.remove(new a.NamedNode(i.name,e)):n}),this.We)},l}(),p;e.IndexMap=l},function(o,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var d=t(17),r=t(17),i=function(){function t(n){this.count=function(t){return parseInt(Math.log(t)/0.6931471805599453,10)}(n+1),this.je=this.count-1;var o=function(t){return parseInt(Array(t+1).join('1'),2)}(this.count);this.Ve=n+1&o}return t.prototype.nextBitIsOne=function(){var t=!(this.Ve&1<=this.pn?(this.de('Secondary connection is healthy.'),this.nn=!0,this.tn.markConnectionHealthy(),this.dn()):(this.de('sending ping on secondary.'),this.tn.send({t:'c',d:{t:'p',d:{}}}))},t.prototype.dn=function(){this.tn.start(),this.de('sending client ack on secondary'),this.tn.send({t:'c',d:{t:'a',d:{}}}),this.de('Ending transmission on primary'),this.Yt.send({t:'c',d:{t:'n',d:{}}}),this.Zt=this.tn,this.tryCleanupConnection()},t.prototype.sn=function(o){var e=l.requireKey('t',o),t=l.requireKey('d',o);'c'==e?this.fn(t):'d'==e&&this.wt(t)},t.prototype.wt=function(t){this._n(),this.Ut(t)},t.prototype._n=function(){this.nn||0>=--this.zt&&(this.de('Primary connection is healthy.'),this.nn=!0,this.Yt.markConnectionHealthy())},t.prototype.fn=function(o){var e=l.requireKey('t',o);if('d'in o){var t=o.d;if('h'===e)this.yn(t);else if('n'===e){this.de('recvd end transmission on primary'),this.en=this.tn;for(var n=0;ndocument.domain="'+document.domain+'";');var d=''+s+'';try{this.myIFrame.doc.open(),this.myIFrame.doc.write(d),this.myIFrame.doc.close()}catch(t){m.log('frame writing exception'),t.stack&&m.log(t.stack),m.log(t)}}}return a.Dn=function(){var n=document.createElement('iframe');if(n.style.display='none',!document.body)throw'Document body has not initialized. Wait to initialize Firebase until after the document is ready.';document.body.appendChild(n);try{n.contentWindow.document||m.log('No IE domain setting required')}catch(t){var e=document.domain;n.src='javascript:void((function(){document.open();document.domain=\''+e+'\';document.close();})())'}return n.contentDocument?n.doc=n.contentDocument:n.contentWindow?n.doc=n.contentWindow.document:n.document&&(n.doc=n.document),n},a.prototype.close=function(){var e=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML='',setTimeout(function(){null!==e.myIFrame&&(document.body.removeChild(e.myIFrame),e.myIFrame=null)},0)),f.isNodeSdk()&&this.myID){var t={};t[p.FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM]='t',t[p.FIREBASE_LONGPOLL_ID_PARAM]=this.myID,t[p.FIREBASE_LONGPOLL_PW_PARAM]=this.myPW;var n=this.urlFn(t);a.nodeRestRequest(n)}var r=this.onDisconnect;r&&(this.onDisconnect=null,r())},a.prototype.startLongPoll=function(n,e){for(this.myID=n,this.myPW=e,this.alive=!0;this.Mn(););},a.prototype.Mn=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(0=this.pendingSegs[0].d.length+30+n.length;)a=this.pendingSegs.shift(),n=n+'&'+p.FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM+r+'='+a.seg+'&'+p.FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET+r+'='+a.ts+'&'+p.FIREBASE_LONGPOLL_DATA_PARAM+r+'='+a.d,r++;return e+=n,this.Ln(e,this.currentSerial),!0}return!1},a.prototype.enqueueSegment=function(o,r,a){this.pendingSegs.push({seg:o,ts:r,d:a}),this.alive&&this.Mn()},a.prototype.Ln=function(o,e){var t=this;this.outstandingRequests.add(e,1);var n=function(){t.outstandingRequests.remove(e),t.Mn()},r=setTimeout(n,25000);this.addTag(o,function(){clearTimeout(r),n()})},a.prototype.addTag=function(o,r){var e=this;f.isNodeSdk()?this.doNodeLongPoll(o,r):setTimeout(function(){try{if(!e.sendNewPolls)return;var t=e.myIFrame.doc.createElement('script');t.type='text/javascript',t.async=!0,t.src=o,t.onload=t.onreadystatechange=function(){var n=t.readyState;n&&'loaded'!==n&&'complete'!==n||(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),r())},t.onerror=function(){m.log('Long-poll script failed to load: '+o),e.sendNewPolls=!1,e.close()},e.myIFrame.doc.body.appendChild(t)}catch(t){}},1)},a}();p.FirebaseIFrameScriptHolder=l},function(o,r,t){'use strict';(function(n){Object.defineProperty(r,'__esModule',{value:!0});var e=t(6),i=t(0),o=t(1),a=t(25),m=t(14),u=t(0),l=t(13),s=t(0),h=t(0),p=null;'undefined'==typeof MozWebSocket?'undefined'!=typeof WebSocket&&(p=WebSocket):p=MozWebSocket,r.setWebSocketImpl=function(t){p=t};var d=function(){function d(t,e,n,r){this.connId=t,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.de=o.logWrapper(this.connId),this.$=a.StatsManager.getCollection(e),this.connURL=d.Fn(e,n,r)}return d.Fn=function(o,e,t){var n={};return n[m.VERSION_PARAM]=m.PROTOCOL_VERSION,!h.isNodeSdk()&&'undefined'!=typeof location&&location.href&&-1!==location.href.indexOf(m.FORGE_DOMAIN)&&(n[m.REFERER_PARAM]=m.FORGE_REF),e&&(n[m.TRANSPORT_SESSION_PARAM]=e),t&&(n[m.LAST_SESSION_PARAM]=t),o.connectionURL(m.WEBSOCKET,n)},d.prototype.open=function(i,t){var d=this;this.onDisconnect=t,this.onMessage=i,this.de('Websocket connecting to '+this.connURL),this.bn=!1,l.PersistentStorage.set('previous_websocket_failure',!0);try{if(h.isNodeSdk()){var r=u.CONSTANTS.NODE_ADMIN?'AdminNode':'Node',o={headers:{"User-Agent":'Firebase/'+m.PROTOCOL_VERSION+'/'+e.default.SDK_VERSION+'/'+n.platform+'/'+r}},a=n.env,s=0==this.connURL.indexOf('wss://')?a.HTTPS_PROXY||a.https_proxy:a.HTTP_PROXY||a.http_proxy;s&&(o.proxy={origin:s}),this.mySock=new p(this.connURL,[],o)}else this.mySock=new p(this.connURL)}catch(t){this.de('Error instantiating WebSocket.');var g=t.message||t.data;return g&&this.de(g),void this.wn()}this.mySock.onopen=function(){d.de('Websocket connected.'),d.bn=!0},this.mySock.onclose=function(){d.de('Websocket connection was disconnected.'),d.mySock=null,d.wn()},this.mySock.onmessage=function(t){d.handleIncomingFrame(t)},this.mySock.onerror=function(n){d.de('WebSocket error. Closing connection.');var e=n.message||n.data;e&&d.de(e),d.wn()}},d.prototype.start=function(){},d.forceDisallow=function(){d.On=!0},d.isAvailable=function(){var t=!1;if('undefined'!=typeof navigator&&navigator.userAgent){var o=/Android ([0-9]{0,}\.[0-9]{0,})/,n=navigator.userAgent.match(o);n&&1parseFloat(n[1])&&(t=!0)}return!t&&null!==p&&!d.On},d.previouslyFailed=function(){return l.PersistentStorage.isInMemoryStorage||!0===l.PersistentStorage.get('previous_websocket_failure')},d.prototype.markConnectionHealthy=function(){l.PersistentStorage.remove('previous_websocket_failure')},d.prototype.xn=function(o){if(this.frames.push(o),this.frames.length==this.totalFrames){var e=this.frames.join('');this.frames=null;var t=s.jsonEval(e);this.onMessage(t)}},d.prototype.kn=function(t){this.totalFrames=t,this.frames=[]},d.prototype.Wn=function(n){if(i.assert(null===this.frames,'We already have a frame buffer'),6>=n.length){var o=+n;if(!isNaN(o))return this.kn(o),null}return this.kn(1),n},d.prototype.handleIncomingFrame=function(o){if(null!==this.mySock){var e=o.data;if(this.bytesReceived+=e.length,this.$.incrementCounter('bytes_received',e.length),this.resetKeepAlive(),null!==this.frames)this.xn(e);else{var t=this.Wn(e);null!==t&&this.xn(t)}}},d.prototype.send=function(a){this.resetKeepAlive();var e=s.stringify(a);this.bytesSent+=e.length,this.$.incrementCounter('bytes_sent',e.length);var t=o.splitStringBySize(e,16384);1=this.me.compare(this.getStartPost(),t)&&0>=this.me.compare(t,this.getEndPost())},r.prototype.updateChild=function(a,e,t,n,r,i){return this.matches(new p.NamedNode(e,t))||(t=o.ChildrenNode.EMPTY_NODE),this.Vn.updateChild(a,e,t,n,r,i)},r.prototype.updateFullNode=function(a,e,t){e.isLeafNode()&&(e=o.ChildrenNode.EMPTY_NODE);var n=e.withIndex(this.me);n=n.updatePriority(o.ChildrenNode.EMPTY_NODE);var r=this;return e.forEachChild(l.PRIORITY_INDEX,function(a,e){r.matches(new p.NamedNode(a,e))||(n=n.updateImmediateChild(a,o.ChildrenNode.EMPTY_NODE))}),this.Vn.updateFullNode(a,n,t)},r.prototype.updatePriority=function(t){return t},r.prototype.filtersNodes=function(){return!0},r.prototype.getIndexedFilter=function(){return this.Vn},r.prototype.getIndex=function(){return this.me},r.qn=function(n){if(n.hasStart()){var e=n.getIndexStartName();return n.getIndex().makePost(n.getIndexStartValue(),e)}return n.getIndex().minPost()},r.Bn=function(n){if(n.hasEnd()){var e=n.getIndexEndName();return n.getIndex().makePost(n.getIndexEndValue(),e)}return n.getIndex().maxPost()},r}();e.RangedFilter=r},,,,,,,,,,,,,,,,,,,,,,function(o,e,t){o.exports=t(79)},function(m,e,t){'use strict';function n(e){var t=e.INTERNAL.registerService('database',function(o,e,t){return u.RepoManager.getInstance().databaseFromApp(o,t)},{Reference:a.Reference,Query:o.Query,Database:i.Database,enableLogging:s.enableLogging,INTERNAL:l,ServerValue:p,TEST_ACCESS:g},null,!0);y.isNodeSdk()&&(m.exports=t)}Object.defineProperty(e,'__esModule',{value:!0});var r=t(6),i=t(32);e.Database=i.Database;var o=t(36);e.Query=o.Query;var a=t(21);e.Reference=a.Reference;var s=t(1);e.enableLogging=s.enableLogging;var u=t(26),l=t(111),g=t(112),y=t(0),p=i.Database.ServerValue;e.ServerValue=p,e.registerDatabase=n,n(r.default);var b=t(22);e.DataSnapshot=b.DataSnapshot;var f=t(35);e.OnDisconnect=f.OnDisconnect},function(o,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var n=t(0),r=function(){function t(t){this.Hn=t,this.Gn='firebase:'}return t.prototype.set=function(o,e){null==e?this.Hn.removeItem(this.Kn(o)):this.Hn.setItem(this.Kn(o),n.stringify(e))},t.prototype.get=function(o){var e=this.Hn.getItem(this.Kn(o));return null==e?null:n.jsonEval(e)},t.prototype.remove=function(t){this.Hn.removeItem(this.Kn(t))},t.prototype.Kn=function(t){return this.Gn+t},t.prototype.toString=function(){return''+this.Hn},t}();e.DOMStorageWrapper=r},function(o,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var n=t(0),r=function(){function t(){this.Yn={},this.isInMemoryStorage=!0}return t.prototype.set=function(n,e){null==e?delete this.Yn[n]:this.Yn[n]=e},t.prototype.get=function(t){return n.contains(this.Yn,t)?this.Yn[t]:null},t.prototype.remove=function(t){delete this.Yn[t]},t}();e.MemoryStorage=r},function(o,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var n=t(0),r=function(){function t(n,o){this.committed=n,this.snapshot=o}return t.prototype.toJSON=function(){return n.validateArgCount('TransactionResult.toJSON',0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},t}();e.TransactionResult=r},function(o,e,t){'use strict';var d=Math.floor;Object.defineProperty(e,'__esModule',{value:!0});var l=t(0);e.nextPushId=function(){var o='-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',e=0,t=[];return function(n){var r=n===e;e=n;var i=Array(8),s;for(s=7;0<=s;s--)i[s]=o.charAt(n%64),n=d(n/64);l.assert(0===n,'Cannot push at time == 0');var a=i.join('');if(r){for(s=11;0<=s&&63===t[s];s--)t[s]=0;t[s]++}else for(s=0;12>s;s++)t[s]=d(64*Math.random());for(s=0;12>s;s++)a+=o.charAt(t[s]);return l.assert(20===a.length,'nextPushId: Length should be 20.'),a}}()},function(d,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var l=t(22),r=t(85),p=t(0),i=t(0),n=function(){function n(o,r,t){this.Xn=o,this.zn=r,this.Jn=t}return n.prototype.respondsTo=function(t){return'value'===t},n.prototype.createEvent=function(o,e){var t=e.getQueryParams().getIndex();return new r.DataEvent('value',this,new l.DataSnapshot(o.snapshotNode,e.getRef(),t))},n.prototype.getEventRunner=function(o){var e=this.Jn;if('cancel'===o.getEventType()){i.assert(this.zn,'Raising a cancel event on a listener with no cancel callback');var t=this.zn;return function(){t.call(e,o.error)}}var n=this.Xn;return function(){n.call(e,o.snapshot)}},n.prototype.createCancelEvent=function(n,e){return this.zn?new r.CancelEvent(this,n,e):null},n.prototype.matches=function(e){return e instanceof n&&(!e.Xn||!this.Xn||e.Xn===this.Xn&&e.Jn===this.Jn)},n.prototype.hasAnyCallback=function(){return null!==this.Xn},n}();e.ValueEventRegistration=n;var o=function(){function o(o,r,t){this.$n=o,this.zn=r,this.Jn=t}return o.prototype.respondsTo=function(n){var e='children_added'===n?'child_added':n;return e='children_removed'==e?'child_removed':e,p.contains(this.$n,e)},o.prototype.createCancelEvent=function(n,e){return this.zn?new r.CancelEvent(this,n,e):null},o.prototype.createEvent=function(a,e){i.assert(null!=a.childName,'Child events should have a childName.');var t=e.getRef().child(a.childName),n=e.getQueryParams().getIndex();return new r.DataEvent(a.type,this,new l.DataSnapshot(a.snapshotNode,t,n),a.prevName)},o.prototype.getEventRunner=function(o){var e=this.Jn;if('cancel'===o.getEventType()){i.assert(this.zn,'Raising a cancel event on a listener with no cancel callback');var t=this.zn;return function(){t.call(e,o.error)}}var n=this.$n[o.eventType];return function(){n.call(e,o.snapshot,o.prevName)}},o.prototype.matches=function(a){if(a instanceof o){if(!this.$n||!a.$n)return!0;if(this.Jn===a.Jn){var e=p.getCount(a.$n);if(e===p.getCount(this.$n)){if(1===e){var t=p.getAnyKey(a.$n),n=p.getAnyKey(this.$n);return!(n!==t||a.$n[t]&&this.$n[n]&&a.$n[t]!==this.$n[n])}return p.every(this.$n,function(t,e){return a.$n[t]===e})}}}return!1},o.prototype.hasAnyCallback=function(){return null!==this.$n},o}();e.ChildEventRegistration=o},function(a,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var n=t(0),r=function(){function t(o,a,t,n){this.eventType=o,this.eventRegistration=a,this.snapshot=t,this.prevName=n}return t.prototype.getPath=function(){var t=this.snapshot.getRef();return'value'===this.eventType?t.path:t.getParent().path},t.prototype.getEventType=function(){return this.eventType},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.getPath()+':'+this.eventType+':'+n.stringify(this.snapshot.exportVal())},t}();e.DataEvent=r;var i=function(){function t(o,r,t){this.eventRegistration=o,this.error=r,this.path=t}return t.prototype.getPath=function(){return this.path},t.prototype.getEventType=function(){return'cancel'},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.path+':cancel'},t}();e.CancelEvent=i},function(m,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var g=t(0),b=t(1),i=t(87),r=t(4),o=t(0),v=t(23),n=t(88),u=t(89),h=t(8),c=t(46),x=t(2),a=t(47),s=t(95),d=function(){function m(t){this.Zn=t,this.er=v.ImmutableTree.Empty,this.tr=new s.WriteTree,this.nr={},this.rr={}}return m.prototype.applyUserOverwrite=function(o,e,t,n){return this.tr.addOverwrite(o,e,t,n),n?this.ir(new c.Overwrite(h.OperationSource.User,o,e)):[]},m.prototype.applyUserMerge=function(o,e,t){this.tr.addMerge(o,e,t);var n=v.ImmutableTree.fromObject(e);return this.ir(new u.Merge(h.OperationSource.User,o,n))},m.prototype.ackUserWrite=function(a,e){void 0===e&&(e=!1);var t=this.tr.getWrite(a);if(this.tr.removeWrite(a)){var n=v.ImmutableTree.Empty;return null==t.snap?o.forEach(t.children,function(o,e){n=n.set(new x.Path(o),e)}):n=n.set(x.Path.Empty,!0),this.ir(new i.AckUserWrite(t.path,n,e))}return[]},m.prototype.applyServerOverwrite=function(n,e){return this.ir(new c.Overwrite(h.OperationSource.Server,n,e))},m.prototype.applyServerMerge=function(o,e){var t=v.ImmutableTree.fromObject(e);return this.ir(new u.Merge(h.OperationSource.Server,o,t))},m.prototype.applyListenComplete=function(t){return this.ir(new n.ListenComplete(h.OperationSource.Server,t))},m.prototype.applyTaggedQueryOverwrite=function(e,t,n){var r=this.or(n);if(null!=r){var i=m.ar(r),o=i.path,a=i.queryId,s=x.Path.relativePath(o,e),d=new c.Overwrite(h.OperationSource.forServerTaggedQuery(a),s,t);return this.sr(o,d)}return[]},m.prototype.applyTaggedQueryMerge=function(e,t,n){var r=this.or(n);if(r){var i=m.ar(r),o=i.path,a=i.queryId,s=x.Path.relativePath(o,e),d=v.ImmutableTree.fromObject(t),l=new u.Merge(h.OperationSource.forServerTaggedQuery(a),s,d);return this.sr(o,l)}return[]},m.prototype.applyTaggedListenComplete=function(e,t){var d=this.or(t);if(d){var r=m.ar(d),i=r.path,o=r.queryId,a=x.Path.relativePath(i,e),s=new n.ListenComplete(h.OperationSource.forServerTaggedQuery(o),a);return this.sr(i,s)}return[]},m.prototype.addEventRegistration=function(e,t){var d=e.path,i=null,o=!1;this.er.foreachOnPath(d,function(r,e){var t=x.Path.relativePath(r,d);i=i||e.getCompleteServerCache(t),o=o||e.hasCompleteView()});var n=this.er.get(d);n?(o=o||n.hasCompleteView(),i=i||n.getCompleteServerCache(x.Path.Empty)):(n=new a.SyncPoint,this.er=this.er.set(d,n));var u;null==i?(u=!1,i=r.ChildrenNode.EMPTY_NODE,this.er.subtree(d).foreachChild(function(o,e){var t=e.getCompleteServerCache(x.Path.Empty);t&&(i=i.updateImmediateChild(o,t))})):u=!0;var l=n.viewExistsForQuery(e);if(!l&&!e.getQueryParams().loadsAllData()){var f=m.ur(e);g.assert(!(f in this.rr),'View does not exist, but we have a tag');var c=m.lr();this.rr[f]=c,this.nr['_'+c]=f}var p=this.tr.childWrites(d),b=n.addEventRegistration(e,t,p,i,u);if(!l&&!o){var y=n.viewForQuery(e);b=b.concat(this.hr(e,y))}return b},m.prototype.removeEventRegistration=function(e,t,n){var r=this,i=e.path,o=this.er.get(i),a=[];if(o&&('default'===e.queryIdentifier()||o.viewExistsForQuery(e))){var s=o.removeEventRegistration(e,t,n);o.isEmpty()&&(this.er=this.er.remove(i));var u=s.removed;a=s.events;var l=-1!==u.findIndex(function(t){return t.getQueryParams().loadsAllData()}),h=this.er.findOnPath(i,function(n,e){return e.hasCompleteView()});if(l&&!h){var g=this.er.subtree(i);if(!g.isEmpty())for(var p=this.cr(g),d=0;dthis.Gr,'Stacking an older write on top of newer ones'),void 0===s&&(s=!0),this.Hr.push({path:o,snap:a,writeId:i,visible:s}),s&&(this.Br=this.Br.addWrite(o,a)),this.Gr=i},d.prototype.addMerge=function(o,r,a){m.assert(a>this.Gr,'Stacking an older merge on top of newer ones'),this.Hr.push({path:o,children:r,writeId:a,visible:!0}),this.Br=this.Br.addWrites(o,r),this.Gr=a},d.prototype.getWrite=function(o){for(var e=0,t;e=e&&this.Kr(d,t.path)?o=!1:t.path.contains(d.path)&&(a=!0)),s--;if(o){if(a)return this.Yr(),!0;if(t.snap)this.Br=this.Br.removeWrite(t.path);else{var l=t.children;n.forEach(l,function(n){i.Br=i.Br.removeWrite(t.path.child(n))})}return!0}return!1},d.prototype.getCompleteWriteData=function(t){return this.Br.getCompleteNode(t)},d.prototype.calcCompleteEventCache=function(o,e,t,n){if(t||n){var u=this.Br.childCompoundWrite(o);if(!n&&u.isEmpty())return e;if(n||null!=e||u.hasCompleteWrite(g.Path.Empty)){var a=function(a){return(a.visible||n)&&(!t||!~t.indexOf(a.writeId))&&(a.path.contains(o)||o.contains(a.path))},s=d.Xr(this.Hr,a,o),l=e||c.ChildrenNode.EMPTY_NODE;return s.apply(l)}return null}var h=this.Br.getCompleteNode(o);if(null!=h)return h;var m=this.Br.childCompoundWrite(o);if(m.isEmpty())return e;if(null!=e||m.hasCompleteWrite(g.Path.Empty)){var l=e||c.ChildrenNode.EMPTY_NODE;return m.apply(l)}return null},d.prototype.calcCompleteEventChildren=function(o,e){var s=c.ChildrenNode.EMPTY_NODE,t=this.Br.getCompleteNode(o);if(t)return t.isLeafNode()||t.forEachChild(a.PRIORITY_INDEX,function(n,e){s=s.updateImmediateChild(n,e)}),s;if(e){var n=this.Br.childCompoundWrite(o);return e.forEachChild(a.PRIORITY_INDEX,function(o,e){var t=n.childCompoundWrite(new g.Path(o)).apply(e);s=s.updateImmediateChild(o,t)}),n.getCompleteChildren().forEach(function(t){s=s.updateImmediateChild(t.name,t.node)}),s}return this.Br.childCompoundWrite(o).getCompleteChildren().forEach(function(t){s=s.updateImmediateChild(t.name,t.node)}),s},d.prototype.calcEventCacheAfterServerOverwrite=function(i,e,t,n){m.assert(t||n,'Either existingEventSnap or existingServerSnap must exist');var r=i.child(e);if(this.Br.hasCompleteWrite(r))return null;var o=this.Br.childCompoundWrite(r);return o.isEmpty()?n.getChild(e):o.apply(n.getChild(e))},d.prototype.calcCompleteChild=function(o,e,t){var n=o.child(e),r=this.Br.getCompleteNode(n);return null==r?t.isCompleteForChild(e)?this.Br.childCompoundWrite(n).apply(t.getNode().getImmediateChild(e)):null:r},d.prototype.shadowingWrite=function(t){return this.Br.getCompleteNode(t)},d.prototype.calcIndexedSlice=function(o,e,t,n,r,i){var a=this.Br.childCompoundWrite(o),u=a.getCompleteNode(g.Path.Empty),l;if(null!=u)l=u;else{if(null==e)return[];l=a.apply(e)}if(l=l.withIndex(i),l.isEmpty()||l.isLeafNode())return[];for(var s=[],h=i.getCompare(),c=r?l.getReverseIteratorFrom(t,i):l.getIteratorFrom(t,i),p=c.getNext();p&&s.lengthl.status){try{r=o.jsonEval(l.responseText)}catch(t){p.warn('Failed to parse JSON response for '+s+': '+l.responseText)}t(null,r)}else 401!==l.status&&404!==l.status&&p.warn('Got unsuccessful REST response for '+s+' Status: '+l.status),t(l.status);t=null}},l.open('GET',s,!0),l.send()})},d}(i.ServerActions);e.ReadonlyRestClient=s},function(m,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var g=t(0),n=t(1),r=t(10),o=t(3),a=t(38),s=t(42),i=t(24),l=t(108),u=t(56),c=t(0),p=function(){function d(){this.fi=!1,this._i=!1,this.yi=!1,this.vi=!1,this.gi=!1,this.mi=0,this.Ci='',this.Ei=null,this.Ni='',this.Pi=null,this.bi='',this.me=o.PRIORITY_INDEX}return d.prototype.hasStart=function(){return this._i},d.prototype.isViewFromLeft=function(){return''===this.Ci?this._i:this.Ci===d.Si.VIEW_FROM_LEFT},d.prototype.getIndexStartValue=function(){return g.assert(this._i,'Only valid if start has been set'),this.Ei},d.prototype.getIndexStartName=function(){return g.assert(this._i,'Only valid if start has been set'),this.yi?this.Ni:n.MIN_NAME},d.prototype.hasEnd=function(){return this.vi},d.prototype.getIndexEndValue=function(){return g.assert(this.vi,'Only valid if end has been set'),this.Pi},d.prototype.getIndexEndName=function(){return g.assert(this.vi,'Only valid if end has been set'),this.gi?this.bi:n.MAX_NAME},d.prototype.hasLimit=function(){return this.fi},d.prototype.hasAnchoredLimit=function(){return this.fi&&''!==this.Ci},d.prototype.getLimit=function(){return g.assert(this.fi,'Only valid if limit has been set'),this.mi},d.prototype.getIndex=function(){return this.me},d.prototype.Ti=function(){var e=new d;return e.fi=this.fi,e.mi=this.mi,e._i=this._i,e.Ei=this.Ei,e.yi=this.yi,e.Ni=this.Ni,e.vi=this.vi,e.Pi=this.Pi,e.gi=this.gi,e.bi=this.bi,e.me=this.me,e.Ci=this.Ci,e},d.prototype.limit=function(n){var e=this.Ti();return e.fi=!0,e.mi=n,e.Ci='',e},d.prototype.limitToFirst=function(e){var t=this.Ti();return t.fi=!0,t.mi=e,t.Ci=d.Si.VIEW_FROM_LEFT,t},d.prototype.limitToLast=function(e){var t=this.Ti();return t.fi=!0,t.mi=e,t.Ci=d.Si.VIEW_FROM_RIGHT,t},d.prototype.startAt=function(o,e){var t=this.Ti();return t._i=!0,void 0===o&&(o=null),t.Ei=o,null==e?(t.yi=!1,t.Ni=''):(t.yi=!0,t.Ni=e),t},d.prototype.endAt=function(o,e){var t=this.Ti();return t.vi=!0,void 0===o&&(o=null),t.Pi=o,void 0===e?(t.gi=!1,t.bi=''):(t.gi=!0,t.bi=e),t},d.prototype.orderBy=function(n){var e=this.Ti();return e.me=n,e},d.prototype.getQueryObject=function(){var e=d.Si,t={};if(this._i&&(t[e.INDEX_START_VALUE]=this.Ei,this.yi&&(t[e.INDEX_START_NAME]=this.Ni)),this.vi&&(t[e.INDEX_END_VALUE]=this.Pi,this.gi&&(t[e.INDEX_END_NAME]=this.bi)),this.fi){t[e.LIMIT]=this.mi;var n=this.Ci;''===n&&(n=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),t[e.VIEW_FROM]=n}return this.me!==o.PRIORITY_INDEX&&(t[e.INDEX]=''+this.me),t},d.prototype.loadsAllData=function(){return!(this._i||this.vi||this.fi)},d.prototype.isDefault=function(){return this.loadsAllData()&&this.me==o.PRIORITY_INDEX},d.prototype.getNodeFilter=function(){return this.loadsAllData()?new i.IndexedFilter(this.getIndex()):this.hasLimit()?new l.LimitedFilter(this):new u.RangedFilter(this)},d.prototype.toRestQueryStringParameters=function(){var e=d.wi,t={};if(this.isDefault())return t;var n;return this.me===o.PRIORITY_INDEX?n=e.PRIORITY_INDEX:this.me===a.VALUE_INDEX?n=e.VALUE_INDEX:this.me===r.KEY_INDEX?n=e.KEY_INDEX:(g.assert(this.me instanceof s.PathIndex,'Unrecognized index type!'),n=''+this.me),t[e.ORDER_BY]=c.stringify(n),this._i&&(t[e.START_AT]=c.stringify(this.Ei),this.yi&&(t[e.START_AT]+=','+c.stringify(this.Ni))),this.vi&&(t[e.END_AT]=c.stringify(this.Pi),this.gi&&(t[e.END_AT]+=','+c.stringify(this.bi))),this.fi&&(this.isViewFromLeft()?t[e.LIMIT_TO_FIRST]=this.mi:t[e.LIMIT_TO_LAST]=this.mi),t},d.Si={INDEX_START_VALUE:'sp',INDEX_START_NAME:'sn',INDEX_END_VALUE:'ep',INDEX_END_NAME:'en',LIMIT:'l',VIEW_FROM:'vf',VIEW_FROM_LEFT:'l',VIEW_FROM_RIGHT:'r',INDEX:'i'},d.wi={ORDER_BY:'orderBy',PRIORITY_INDEX:'$priority',VALUE_INDEX:'$value',KEY_INDEX:'$key',START_AT:'startAt',END_AT:'endAt',LIMIT_TO_FIRST:'limitToFirst',LIMIT_TO_LAST:'limitToLast'},d.DEFAULT=new d,d}();e.QueryParams=p},function(d,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var n=t(56),m=t(4),i=t(5),o=t(0),a=t(9),r=function(){function t(t){this.Ii=new n.RangedFilter(t),this.me=t.getIndex(),this.mi=t.getLimit(),this.Ri=!t.isViewFromLeft()}return t.prototype.updateChild=function(o,e,t,n,r,a){return this.Ii.matches(new i.NamedNode(e,t))||(t=m.ChildrenNode.EMPTY_NODE),o.getImmediateChild(e).equals(t)?o:o.numChildren()=this.me.compare(this.Ii.getStartPost(),a):0>=this.me.compare(a,this.Ii.getEndPost())))break;n=n.updateImmediateChild(a.name,a.node),o++}}else{n=e.withIndex(this.me),n=n.updatePriority(m.ChildrenNode.EMPTY_NODE);var r=void 0,u,l,h;if(this.Ri){r=n.getReverseIterator(this.me),u=this.Ii.getEndPost(),l=this.Ii.getStartPost();var c=this.me.getCompare();h=function(n,e){return c(e,n)}}else r=n.getIterator(this.me),u=this.Ii.getStartPost(),l=this.Ii.getEndPost(),h=this.me.getCompare();for(var o=0,p=!1,a;r.hasNext();){a=r.getNext(),!p&&0>=h(u,a)&&(p=!0);var s=p&&o=h(a,l);s?o++:n=n.updateImmediateChild(a.name,m.ChildrenNode.EMPTY_NODE)}}return this.Ii.getIndexedFilter().updateFullNode(i,n,t)},t.prototype.updatePriority=function(t){return t},t.prototype.filtersNodes=function(){return!0},t.prototype.getIndexedFilter=function(){return this.Ii.getIndexedFilter()},t.prototype.getIndex=function(){return this.me},t.prototype.Oi=function(s,e,t,n,r){var u;if(this.Ri){var l=this.me.getCompare();u=function(n,e){return l(e,n)}}else u=this.me.getCompare();var h=s;o.assert(h.numChildren()==this.mi,'');var c=new i.NamedNode(e,t),p=this.Ri?h.getFirstChild(this.me):h.getLastChild(this.me),d=this.Ii.matches(c);if(h.hasChild(e)){for(var f=h.getImmediateChild(e),b=n.getChildAfterChild(this.me,p,this.Ri);null!=b&&(b.name==e||h.hasChild(b.name));)b=n.getChildAfterChild(this.me,b,this.Ri);var y=null==b?1:u(b,c);if(d&&!t.isEmpty()&&0<=y)return null!=r&&r.trackChildChange(a.Change.childChangedChange(e,t,f)),h.updateImmediateChild(e,t);null!=r&&r.trackChildChange(a.Change.childRemovedChange(e,f));var v=h.updateImmediateChild(e,m.ChildrenNode.EMPTY_NODE);return null!=b&&this.Ii.matches(b)?(null!=r&&r.trackChildChange(a.Change.childAddedChange(b.name,b.node)),v.updateImmediateChild(b.name,b.node)):v}return t.isEmpty()?s:d&&0<=u(p,c)?(null!=r&&(r.trackChildChange(a.Change.childRemovedChange(p.name,p.node)),r.trackChildChange(a.Change.childAddedChange(e,t))),h.updateImmediateChild(e,t).updateImmediateChild(p.name,m.ChildrenNode.EMPTY_NODE)):s},t}();e.LimitedFilter=r},function(m,e,t){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var x=t(0),i=t(21),o=t(22),a=t(2),n=t(110),s=t(3),l=t(1),h=t(43),c=t(7),p=t(0),d=t(11),u=t(4),f=t(18),k;!function(t){t[t.RUN=0]='RUN',t[t.SENT=1]='SENT',t[t.COMPLETED=2]='COMPLETED',t[t.SENT_NEEDS_ABORT=3]='SENT_NEEDS_ABORT',t[t.NEEDS_ABORT=4]='NEEDS_ABORT'}(k=e.TransactionStatus||(e.TransactionStatus={})),f.Repo.Ai=25,f.Repo.prototype.ie=function(){this.Di=new n.Tree},f.Repo.prototype.startTransaction=function(r,a,f,v){this.de('transaction on '+r);var A=function(){},L=new i.Reference(this,r);L.on('value',A);var y={path:r,update:a,onComplete:f,status:null,order:l.LUIDGenerator(),applyLocally:v,retryCount:0,unwatcher:function(){L.off('value',A)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},g=this.Mi(r);y.currentInputSnapshot=g;var m=y.update(g.val());if(!(void 0===m)){c.validateFirebaseData('transaction failed: Data returned ',m,y.path),y.status=k.RUN;var R=this.Di.subTree(r),N=R.getValue()||[];N.push(y),R.setValue(N);var O;'object'==typeof m&&null!==m&&p.contains(m,'.priority')?(O=p.safeGet(m,'.priority'),x.assert(c.isValidPriority(O),'Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.')):O=(this.ue.calcCompleteEventCache(r)||u.ChildrenNode.EMPTY_NODE).getPriority().val(),O=O;var b=this.generateServerValues(),S=d.nodeFromJSON(m,O),T=h.resolveDeferredValueSnapshot(S,b);y.currentOutputSnapshotRaw=S,y.currentOutputSnapshotResolved=T,y.currentWriteId=this.pe();var w=this.ue.applyUserOverwrite(r,T,y.currentWriteId,y.applyLocally);this.K.raiseEventsForChangedPath(r,w),this.Li()}else if(y.unwatcher(),y.currentOutputSnapshotRaw=null,y.currentOutputSnapshotResolved=null,y.onComplete){var I=new o.DataSnapshot(y.currentInputSnapshot,new i.Reference(this,y.path),s.PRIORITY_INDEX);y.onComplete(null,!1,I)}},f.Repo.prototype.Mi=function(n,e){return this.ue.calcCompleteEventCache(n,e)||u.ChildrenNode.EMPTY_NODE},f.Repo.prototype.Li=function(o){var r=this;if(void 0===o&&(o=this.Di),o||this.Fi(o),null!==o.getValue()){var e=this.xi(o);x.assert(0=f.Repo.Ai)C=!0,E='maxretry',n=n.concat(this.ue.ackUserWrite(g.currentWriteId,!0));else{var N=this.Mi(g.path,y);g.currentInputSnapshot=N;var L=r[v].update(N.val());if(void 0!==L){c.validateFirebaseData('transaction failed: Data returned ',L,g.path);var P=d.nodeFromJSON(L),S='object'==typeof L&&null!=L&&p.contains(L,'.priority');S||(P=P.updatePriority(N.getPriority()));var T=g.currentWriteId,w=this.generateServerValues(),I=h.resolveDeferredValueSnapshot(P,w);g.currentOutputSnapshotRaw=P,g.currentOutputSnapshotResolved=I,g.currentWriteId=this.pe(),y.splice(y.indexOf(T),1),n=n.concat(this.ue.applyUserOverwrite(g.path,I,g.currentWriteId,g.applyLocally)),n=n.concat(this.ue.ackUserWrite(T,!0))}else C=!0,E='nodata',n=n.concat(this.ue.ackUserWrite(g.currentWriteId,!0))}if(this.K.raiseEventsForChangedPath(e,n),n=[],C&&(r[v].status=k.COMPLETED,function(t){setTimeout(t,0)}(r[v].unwatcher),r[v].onComplete))if('nodata'===E){var R=new i.Reference(this,r[v].path),O=r[v].currentInputSnapshot,A=new o.DataSnapshot(O,R,s.PRIORITY_INDEX);t.push(r[v].onComplete.bind(null,null,!1,A))}else t.push(r[v].onComplete.bind(null,Error(E),!1,null))}this.Fi(this.Di);for(var v=0;v=n)t.push(n);else if(2047>=n)t.push(192|n>>6,128|63&n);else if(55296==(64512&n)){var r=e>18,128|63&n>>12,128|63&n>>6,128|63&n)}else t.push(239,191,189)}else 56320==(64512&n)?t.push(239,191,189):t.push(224|n>>12,128|63&n>>6,128|63&n);return new Uint8Array(t)}function w(n){var t;try{t=decodeURIComponent(n)}catch(e){throw g(ee.DATA_URL,'Malformed data URL.')}return E(t)}function T(d,t){switch(d){case ee.BASE64:var e=-1!==t.indexOf('-'),n=-1!==t.indexOf('_');if(e||n){var r=e?'-':'_';throw g(d,'Invalid character \''+r+'\' found: is it base64url encoded?')}break;case ee.BASE64URL:var o=-1!==t.indexOf('+'),i=-1!==t.indexOf('/');if(o||i){var r=o?'+':'/';throw g(d,'Invalid character \''+r+'\' found: is it base64 encoded?')}t=t.replace(/-/g,'+').replace(/_/g,'/');}var a;try{a=atob(t)}catch(t){throw g(d,'Invalid character found')}for(var s=new Uint8Array(a.length),l=0;l=t.length)&&n.substring(n.length-t.length)===t}function C(e){switch(e){case It.RUNNING:case It.PAUSING:case It.CANCELING:return ae.RUNNING;case It.PAUSED:return ae.PAUSED;case It.SUCCESS:return ae.SUCCESS;case It.CANCELED:return ae.CANCELED;case It.ERROR:default:return ae.ERROR;}}function S(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function k(o,t){for(var e in o)S(o,e)&&t(e,o[e])}function I(n){if(null==n)return{};var o={};return k(n,function(e,t){o[e]=t}),o}function L(e){return new Promise(e)}function O(e){return Promise.resolve(e)}function x(e){return Promise.reject(e)}function P(e){return null!=e}function D(e){return void 0!==e}function _(e){return'function'==typeof e}function M(e){return'object'==typeof e}function B(e){return M(e)&&null!==e}function U(e){return M(e)&&!Array.isArray(e)}function W(e){return'string'==typeof e||e instanceof String}function F(e){return'number'==typeof e||e instanceof Number}function H(e){return q()&&e instanceof Blob}function q(){return'undefined'!=typeof Blob}function j(n){var t;try{t=JSON.parse(n)}catch(e){return null}return U(t)?t:null}function V(n){if(0==n.length)return null;var t=n.lastIndexOf('/');return-1===t?'':n.slice(0,t)}function z(o,t){var e=t.split('/').filter(function(e){return 0e.length?e:(e=e,K(e))}function Z(){function a(n,o){return $(o)}function t(n,t){return P(t)?+t:t}function e(a,t){if(!(W(t)&&0t;t++)n+=(''+Math.random()).slice(2);return n}();i['Content-Type']='multipart/related; boundary='+a;var s=it(t,n,r),u=De(s,e),c='--'+a+'\r\nContent-Type: application/json; charset=utf-8\r\n\r\n'+u+'\r\n--'+a+'\r\nContent-Type: '+s.contentType+'\r\n\r\n',l=fe.getBlob(c,n,'\r\n--'+a+'--');if(null===l)throw ke();var p={name:s.fullPath},d=Q(o),m=h.maxUploadRetryTime(),g=new de(d,'POST',Ze(h,e),m);return g.urlParams=p,g.headers=i,g.body=l.uploadData(),g.errorHandler=et(t),g}function dt(o,t){var e;try{e=o.getResponseHeader('X-Goog-Upload-Status')}catch(e){$e(!1)}return $e(Qe(t||['active'],e)),e}function lt(i,t,e,n,r){var o=t.bucketOnlyServerUrl(),a=it(t,n,r),s={name:a.fullPath},d=Q(o),c={"X-Goog-Upload-Protocol":'resumable',"X-Goog-Upload-Command":'start',"X-Goog-Upload-Header-Content-Length":n.size(),"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":'application/json; charset=utf-8'},l=De(a,e),u=i.maxUploadRetryTime(),p=new de(d,'POST',function(e){dt(e);var t;try{t=e.getResponseHeader('X-Goog-Upload-URL')}catch(e){$e(!1)}return $e(W(t)),t},u);return p.urlParams=s,p.headers=c,p.body=l,p.errorHandler=et(t),p}function pt(i,t,e,d){function n(e){var t=dt(e,['active','final']),r;try{r=e.getResponseHeader('X-Goog-Upload-Size-Received')}catch(e){$e(!1)}var n=parseInt(r,10);return $e(!isNaN(n)),new _e(n,d.size(),'final'===t)}var o=i.maxUploadRetryTime(),r=new de(e,'POST',n,o);return r.headers={"X-Goog-Upload-Command":'query'},r.errorHandler=et(t),r}function ct(d,x,e,C,t,r,n,o){function a(e,t){var n=dt(e,['active','final']),a=i.current+l,s=C.size(),d;return d='final'===n?Ze(x,r)(e,t):null,new _e(a,s,'final'===n,d)}var i=new _e(0,0);if(n?(i.current=n.current,i.total=n.total):(i.current=0,i.total=C.size()),C.size()!==i.total)throw f();var s=i.total-i.current,l=s;0s&&(s*=2);var d;1===l?(l=2,d=0):d=1e3*(s+Math.random()),o(d)}}function a(e){m||(m=!0,h||(null===u?e||(l=1):(e||(l=2),clearTimeout(u),o(0))))}var s=1,u=null,c=!1,l=0,h=!1,m=!1;return o(0),setTimeout(function(){c=!0,a(!0)},e),a}function mt(e){e(!1)}function gt(n,t){null!==t&&0][;base64],');var e=r[1]||null;null!=e&&(this.base64=R(e,';base64'),this.contentType=this.base64?e.substring(0,e.length-7):e),this.rest=o.substring(o.indexOf(',')+1)}return e}(),oe={STATE_CHANGED:'state_changed'},It={RUNNING:'running',PAUSING:'pausing',PAUSED:'paused',SUCCESS:'success',CANCELING:'canceling',CANCELED:'canceled',ERROR:'error'},ae={RUNNING:'running',PAUSED:'paused',SUCCESS:'success',CANCELED:'canceled',ERROR:'error'},Nt;!function(e){e[e.NO_ERROR=0]='NO_ERROR',e[e.NETWORK_ERROR=1]='NETWORK_ERROR',e[e.ABORT=2]='ABORT'}(Nt||(Nt={}));var At=function(){function e(){var n=this;this.o=!1,this.i=new XMLHttpRequest,this.a=Nt.NO_ERROR,this.s=L(function(t){n.i.addEventListener('abort',function(){n.a=Nt.ABORT,t(n)}),n.i.addEventListener('error',function(){n.a=Nt.NETWORK_ERROR,t(n)}),n.i.addEventListener('load',function(){t(n)})})}return e.prototype.send=function(a,t,e,n){var r=this;if(this.o)throw y('cannot .send() more than once');return this.o=!0,this.i.open(t,a,!0),P(n)&&k(n,function(n,t){r.i.setRequestHeader(n,''+t)}),P(e)?this.i.send(e):this.i.send(),this.s},e.prototype.getErrorCode=function(){if(!this.o)throw y('cannot .getErrorCode() before sending');return this.a},e.prototype.getStatus=function(){if(!this.o)throw y('cannot .getStatus() before sending');try{return this.i.status}catch(e){return-1}},e.prototype.getResponseText=function(){if(!this.o)throw y('cannot .getResponseText() before sending');return this.i.responseText},e.prototype.abort=function(){this.i.abort()},e.prototype.getResponseHeader=function(e){return this.i.getResponseHeader(e)},e.prototype.addUploadProgressListener=function(e){P(this.i.upload)&&this.i.upload.addEventListener('progress',e)},e.prototype.removeUploadProgressListener=function(e){P(this.i.upload)&&this.i.upload.removeEventListener('progress',e)},e}(),ue=function(){function e(){}return e.prototype.createXhrIo=function(){return new At},e}(),ce=function(){function r(n,o){this.bucket=n,this.u=o}return Object.defineProperty(r.prototype,'path',{get:function(){return this.u},enumerable:!0,configurable:!0}),r.prototype.fullServerUrl=function(){var e=encodeURIComponent;return'/b/'+e(this.bucket)+'/o/'+e(this.path)},r.prototype.bucketOnlyServerUrl=function(){return'/b/'+encodeURIComponent(this.bucket)+'/o'},r.makeFromBucketSpec=function(t){var e;try{e=r.makeFromUrl(t)}catch(e){return new r(t,'')}if(''===e.path)return e;throw l(t)},r.makeFromUrl=function(t){function e(e){'/'===e.path.charAt(e.path.length-1)&&(e.u=e.u.slice(0,-1))}function h(e){e.u=decodeURIComponent(e.path)}for(var m=null,o=/^gs:\/\/([A-Za-z0-9.\-]+)(\/(.*))?$/i,g={bucket:1,path:3},y=/^https?:\/\/firebasestorage\.googleapis\.com\/v[A-Za-z0-9_]+\/b\/([A-Za-z0-9.\-]+)\/o(\/([^?#]*).*)?$/i,b={bucket:1,path:3},v=[{regex:o,indices:g,postModify:e},{regex:y,indices:b,postModify:h}],c=0;c262144*this.g&&(this.g*=2)},e.prototype.q=function(){var o=this;this.z(function(t){var e=nt(o.U,o.T,o.O),n=o.U.makeRequest(e,t);o.m=n,n.getPromise().then(function(t){o.m=null,o.N=t,o.P(It.SUCCESS)},o.x)})},e.prototype.H=function(){var o=this;this.z(function(t){var e=st(o.U,o.T,o.O,o.A,o.N),n=o.U.makeRequest(e,t);o.m=n,n.getPromise().then(function(t){o.m=null,o.N=t,o.B(o.A.size()),o.P(It.SUCCESS)},o.I)})},e.prototype.B=function(n){var t=this.p;this.p=n,this.p!==t&&this.V()},e.prototype.P=function(n){if(this.k!==n)switch(n){case It.CANCELING:case It.PAUSING:this.k=n,null!==this.m&&this.m.cancel();break;case It.RUNNING:var t=this.k===It.PAUSED;this.k=n,t&&(this.V(),this.M());break;case It.PAUSED:this.k=n,this.V();break;case It.CANCELED:this.v=c(),this.k=n,this.V();break;case It.ERROR:case It.SUCCESS:this.k=n,this.V();}},e.prototype.L=function(){switch(this.k){case It.PAUSING:this.P(It.PAUSED);break;case It.CANCELING:this.P(It.CANCELED);break;case It.RUNNING:this.M();}},Object.defineProperty(e.prototype,'snapshot',{get:function(){var e=C(this.k);return new be(this.p,this.A.size(),e,this.N,this,this.w)},enumerable:!0,configurable:!0}),e.prototype.on=function(o,t,e,s){function n(e){try{return void i(e)}catch(e){}try{if(d(e),!(D(e.next)||D(e.error)||D(e.complete)))throw''}catch(e){throw a}}function r(o){function t(t,r){null!==o&&Fe('on',o,arguments);var n=new ve(t,r,s);return l.K(n),function(){l.Z(n)}}return t}void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===s&&(s=void 0);var a='Expected a function or an Object with one of `next`, `error`, `complete` properties.',i=ze(!0).validator,d=je(null,!0).validator;Fe('on',[Ve(function(){if(o!==oe.STATE_CHANGED)throw'Expected one of the event types: ['+oe.STATE_CHANGED+'].'}),je(n,!0),ze(!0),ze(!0)],arguments);var l=this,c=[je(function(e){if(null===e)throw a;n(e)}),ze(!0),ze(!0)];return D(t)||D(e)||D(s)?r(null)(t,e,s):r(c)},e.prototype.then=function(n,t){return this.D.then(n,t)},e.prototype.catch=function(e){return this.then(null,e)},e.prototype.K=function(e){this._.push(e),this.J(e)},e.prototype.Z=function(e){Je(this._,e)},e.prototype.V=function(){var n=this;this.Q(),Ye(this._).forEach(function(t){n.J(t)})},e.prototype.Q=function(){if(null!==this.y){var e=!0;switch(C(this.k)){case ae.SUCCESS:ut(this.y.bind(null,this.snapshot))();break;case ae.CANCELED:case ae.ERROR:ut(this.R.bind(null,this.v))();break;default:e=!1;}e&&(this.y=null,this.R=null)}},e.prototype.J=function(e){switch(C(this.k)){case ae.RUNNING:case ae.PAUSED:null!==e.next&&ut(e.next.bind(e,this.snapshot))();break;case ae.SUCCESS:null!==e.complete&&ut(e.complete.bind(e))();break;case ae.CANCELED:case ae.ERROR:null!==e.error&&ut(e.error.bind(e,this.v))();break;default:null!==e.error&&ut(e.error.bind(e,this.v))();}},e.prototype.resume=function(){Fe('resume',[],arguments);var e=this.k===It.PAUSED||this.k===It.PAUSING;return e&&this.P(It.RUNNING),e},e.prototype.pause=function(){Fe('pause',[],arguments);var e=this.k===It.RUNNING;return e&&this.P(It.PAUSING),e},e.prototype.cancel=function(){Fe('cancel',[],arguments);var e=this.k===It.RUNNING||this.k===It.PAUSING;return e&&this.P(It.CANCELING),e},e}(),ge=function(){function o(n,o){this.authWrapper=n,this.location=o instanceof ce?o:ce.makeFromUrl(o)}return o.prototype.toString=function(){return Fe('toString',[],arguments),'gs://'+this.location.bucket+'/'+this.location.path},o.prototype.newRef=function(t,e){return new o(t,e)},o.prototype.mappings=function(){return Z()},o.prototype.child=function(o){Fe('child',[Ve()],arguments);var t=z(this.location.path,o),e=new ce(this.location.bucket,t);return this.newRef(this.authWrapper,e)},Object.defineProperty(o.prototype,'parent',{get:function(){var n=V(this.location.path);if(null===n)return null;var t=new ce(this.location.bucket,n);return this.newRef(this.authWrapper,t)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,'root',{get:function(){var e=new ce(this.location.bucket,'');return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,'bucket',{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,'fullPath',{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,'name',{get:function(){return K(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,'storage',{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),o.prototype.put=function(n,t){return void 0===t&&(t=null),Fe('put',[We(),He(!0)],arguments),this.Y('put'),new me(this,this.authWrapper,this.location,this.mappings(),new fe(n),t)},o.prototype.putString=function(a,t,e){void 0===t&&(t=ee.RAW),Fe('putString',[Ve(),Ve(b,!0),He(!0)],arguments),this.Y('putString');var n=v(t,a),r=I(e);return!P(r.contentType)&&P(n.contentType)&&(r.contentType=n.contentType),new me(this,this.authWrapper,this.location,this.mappings(),new fe(n.data,!0),r)},o.prototype.delete=function(){Fe('delete',[],arguments),this.Y('delete');var o=this;return this.authWrapper.getAuthToken().then(function(t){var e=rt(o.authWrapper,o.location);return o.authWrapper.makeRequest(e,t).getPromise()})},o.prototype.getMetadata=function(){Fe('getMetadata',[],arguments),this.Y('getMetadata');var o=this;return this.authWrapper.getAuthToken().then(function(t){var e=nt(o.authWrapper,o.location,o.mappings());return o.authWrapper.makeRequest(e,t).getPromise()})},o.prototype.updateMetadata=function(o){Fe('updateMetadata',[He()],arguments),this.Y('updateMetadata');var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=ot(t.authWrapper,t.location,o,t.mappings());return t.authWrapper.makeRequest(n,e).getPromise()})},o.prototype.getDownloadURL=function(){return Fe('getDownloadURL',[],arguments),this.Y('getDownloadURL'),this.getMetadata().then(function(n){var t=n.downloadURLs[0];if(P(t))return t;throw d()})},o.prototype.Y=function(e){if(''===this.location.path)throw m(e)},o}(),Lt=function(){function e(e){this.D=x(e)}return e.prototype.getPromise=function(){return this.D},e.prototype.cancel=function(e){void 0===e&&(e=!1)},e}(),Re=function(){function e(){this.$={},this.tt=-9007199254740991}return e.prototype.addRequest=function(o){function t(){delete n.$[e]}var e=this.tt;this.tt++,this.$[e]=o;var n=this;o.getPromise().then(t,t)},e.prototype.clear=function(){k(this.$,function(n,t){t&&t.cancel(!0)}),this.$={}},e}(),Ee=function(){function e(t,s,n,r,o){if(this.et=null,this.nt=!1,this.rt=t,null!==this.rt){var i=this.rt.options;P(i)&&(this.et=e.ot(i))}this.it=s,this.at=n,this.st=o,this.ut=r,this.ct=12e4,this.lt=6e4,this.ht=new Re}return e.ot=function(n){var t=n.storageBucket||null;return null==t?null:ce.makeFromBucketSpec(t).bucket},e.prototype.getAuthToken=function(){return null!==this.rt&&P(this.rt.INTERNAL)&&P(this.rt.INTERNAL.getToken)?this.rt.INTERNAL.getToken().then(function(e){return null===e?null:e.accessToken},function(){return null}):O(null)},e.prototype.bucket=function(){if(this.nt)throw h();return this.et},e.prototype.service=function(){return this.ut},e.prototype.makeStorageReference=function(e){return this.it(this,e)},e.prototype.makeRequest=function(o,t){if(this.nt)return new Lt(h());var e=this.at(o,t,this.st);return this.ht.addRequest(e),e},e.prototype.deleteApp=function(){this.nt=!0,this.rt=null,this.ht.clear()},e.prototype.maxUploadRetryTime=function(){return this.lt},e.prototype.setMaxUploadRetryTime=function(e){this.lt=e},e.prototype.maxOperationRetryTime=function(){return this.ct},e.prototype.setMaxOperationRetryTime=function(e){this.ct=e},e}(),we=function(){function e(d,p,e,n,r,o,i,a,s,u,c){this.pt=null,this.ft=null,this.y=null,this.R=null,this.dt=!1,this._t=!1,this.vt=d,this.bt=p,this.mt=e,this.gt=n,this.yt=r.slice(),this.Rt=o.slice(),this.Et=i,this.wt=a,this.Ut=u,this.Tt=s,this.st=c;var l=this;this.D=L(function(n,t){l.y=n,l.R=t,l.M()})}return e.prototype.M=function(){function o(n,a){function l(n){var t=n.loaded,e=n.lengthComputable?n.total:-1;null!==d.Ut&&d.Ut(t,e)}if(a)return void n(!1,new Ue(!1,null,!0));var e=d.st.createXhrIo();d.pt=e,null!==d.Ut&&e.addUploadProgressListener(l),e.send(d.vt,d.bt,d.gt,d.mt).then(function(t){null!==d.Ut&&t.removeUploadProgressListener(l),d.pt=null,t=t;var e=t.getErrorCode()===Nt.NO_ERROR,r=t.getStatus();if(!e||d.At(r)){var i=t.getErrorCode()===Nt.ABORT;return void n(!1,new Ue(!1,null,i))}var a=Qe(d.yt,r);n(!0,new Ue(a,t))})}function t(n,t){var o=d.y,l=d.R,i=t.xhr;if(t.wasSuccessCode)try{var a=d.Et(i,i.getResponseText());D(a)?o(a):o()}catch(e){l(e)}else if(null!==i){var p=r();p.setServerResponseProp(i.getResponseText()),l(d.wt?d.wt(i,p):p)}else if(t.canceled){var p=d._t?h():c();l(p)}else{var p=s();l(p)}}var d=this;this.dt?t(!1,new Ue(!1,null,!0)):this.ft=ht(o,t,this.Tt)},e.prototype.getPromise=function(){return this.D},e.prototype.cancel=function(e){this.dt=!0,this._t=e||!1,null!==this.ft&&mt(this.ft),null!==this.pt&&this.pt.abort()},e.prototype.At=function(e){var t=Qe([408,429],e),n=Qe(this.Rt,e);return 500<=e&&600>e||t||n},e}(),Ue=function(){function e(o,r,e){this.wasSuccessCode=o,this.xhr=r,this.canceled=!!e}return e}(),Te=function(){function e(r,a,e){if(this.et=null,this.U=new Ee(r,function(n,t){return new ge(n,t)},yt,this,a),this.rt=r,null!=e)this.et=ce.makeFromBucketSpec(e);else{var n=this.U.bucket();null!=n&&(this.et=new ce(n,''))}this.Nt=new Rt(this)}return e.prototype.ref=function(e){if(Fe('ref',[Ve(function(e){if(/^[A-Za-z]+:\/\//.test(e))throw'Expected child path but got a URL, use refFromURL instead.'},!0)],arguments),null==this.et)throw Error('No Storage Bucket defined in Firebase Options.');var t=new ge(this.U,this.et);return null==e?t:t.child(e)},e.prototype.refFromURL=function(e){return Fe('refFromURL',[Ve(function(e){if(!/^[A-Za-z]+:\/\//.test(e))throw'Expected full URL but got a child path, use ref instead.';try{ce.makeFromUrl(e)}catch(e){throw'Expected valid full URL but got an invalid one.'}},!1)],arguments),new ge(this.U,e)},Object.defineProperty(e.prototype,'maxUploadRetryTime',{get:function(){return this.U.maxUploadRetryTime()},enumerable:!0,configurable:!0}),e.prototype.setMaxUploadRetryTime=function(e){Fe('setMaxUploadRetryTime',[qe()],arguments),this.U.setMaxUploadRetryTime(e)},Object.defineProperty(e.prototype,'maxOperationRetryTime',{get:function(){return this.U.maxOperationRetryTime()},enumerable:!0,configurable:!0}),e.prototype.setMaxOperationRetryTime=function(e){Fe('setMaxOperationRetryTime',[qe()],arguments),this.U.setMaxOperationRetryTime(e)},Object.defineProperty(e.prototype,'app',{get:function(){return this.rt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'INTERNAL',{get:function(){return this.Nt},enumerable:!0,configurable:!0}),e}(),Rt=function(){function e(e){this.ut=e}return e.prototype.delete=function(){return this.ut.U.deleteApp(),O(void 0)},e}();t.registerStorage=vt;var Ne='storage';vt(xt.default)}},[118])}catch(e){throw Error('Cannot instantiate firebase-storage.js - be sure to load firebase-app.js first.')}try{webpackJsonpFirebase([1],{113:function(o,t,e){e(114)},114:function(Mn,t,e){'use strict';function n(){return qt}function r(e){qt=e}function So(s,t){for(var e=[],n=2;nn)throw new Ht(Gt.INVALID_ARGUMENT,'Function '+o+'() requires between '+e+' and '+n+' arguments, but was called with '+O(t.length,'argument')+'.')}function y(o,t,e,n){if(!(t instanceof Array)||t.lengthr.indexOf(t))throw new Ht(Gt.INVALID_ARGUMENT,'Unknown option \''+t+'\' passed to function '+o+'(). Available options: '+r.join(', '))})}function A(a,t,e,n){var r=k(n);return new Ht(Gt.INVALID_ARGUMENT,'Function '+a+'() requires its '+R(e)+' argument to be a '+t+', but it was: '+r)}function R(e){return 1===e?'first':2===e?'second':3===e?'third':e+'th'}function O(n,t){return n+' '+t+(1===n?'':'s')}function P(n,t){return nt?1:0}function L(n,t){return null!==n&&void 0!==n?t&&n.equals(t):n===t}function x(o,t){if(o.length!==t.length)return!1;for(var e=0;et?1:n===t?0:isNaN(n)?isNaN(t)?0:-1:1}function U(n,t){return n===t?0!==n||1/n==1/t:n!==n&&t!==t}function V(e){return null===e||void 0===e}function q(e){return _e(e)&&e<=Me&&e>=Oe}function W(o,t,e){if(e.equals(ge.INSTANCE)){if(t!==Le.EQUAL)throw new Ht(Gt.INVALID_ARGUMENT,'Invalid query. You can only perform equals comparisons on null.');return new Be(o)}if(e.equals(Ie.NAN)){if(t!==Le.EQUAL)throw new Ht(Gt.INVALID_ARGUMENT,'Invalid query. You can only perform equals comparisons on NaN.');return new Ue(o)}return new xe(o,t,e)}function j(e){return e===Gt.OK?Wo('Treated status OK as error'):e===Gt.CANCELLED||e===Gt.UNKNOWN||e===Gt.DEADLINE_EXCEEDED||e===Gt.RESOURCE_EXHAUSTED||e===Gt.INTERNAL||e===Gt.UNAVAILABLE||e===Gt.UNAUTHENTICATED?!1:e===Gt.INVALID_ARGUMENT||e===Gt.NOT_FOUND||e===Gt.ALREADY_EXISTS||e===Gt.PERMISSION_DENIED||e===Gt.FAILED_PRECONDITION||e===Gt.ABORTED||e===Gt.OUT_OF_RANGE||e===Gt.UNIMPLEMENTED||e===Gt.DATA_LOSS||Wo('Unknown status code: '+e)}function H(n){var t=cn[n];if(void 0!==t)return z(t)}function z(e){if(void 0===e)return o('GRPC error has no .code'),Gt.UNKNOWN;return e===cn.OK?Gt.OK:e===cn.CANCELLED?Gt.CANCELLED:e===cn.UNKNOWN?Gt.UNKNOWN:e===cn.DEADLINE_EXCEEDED?Gt.DEADLINE_EXCEEDED:e===cn.RESOURCE_EXHAUSTED?Gt.RESOURCE_EXHAUSTED:e===cn.INTERNAL?Gt.INTERNAL:e===cn.UNAVAILABLE?Gt.UNAVAILABLE:e===cn.UNAUTHENTICATED?Gt.UNAUTHENTICATED:e===cn.INVALID_ARGUMENT?Gt.INVALID_ARGUMENT:e===cn.NOT_FOUND?Gt.NOT_FOUND:e===cn.ALREADY_EXISTS?Gt.ALREADY_EXISTS:e===cn.PERMISSION_DENIED?Gt.PERMISSION_DENIED:e===cn.FAILED_PRECONDITION?Gt.FAILED_PRECONDITION:e===cn.ABORTED?Gt.ABORTED:e===cn.OUT_OF_RANGE?Gt.OUT_OF_RANGE:e===cn.UNIMPLEMENTED?Gt.UNIMPLEMENTED:e===cn.DATA_LOSS?Gt.DATA_LOSS:Wo('Unknown status code: '+e)}function K(e){if(void 0===e)return cn.OK;return e===Gt.OK?cn.OK:e===Gt.CANCELLED?cn.CANCELLED:e===Gt.UNKNOWN?cn.UNKNOWN:e===Gt.DEADLINE_EXCEEDED?cn.DEADLINE_EXCEEDED:e===Gt.RESOURCE_EXHAUSTED?cn.RESOURCE_EXHAUSTED:e===Gt.INTERNAL?cn.INTERNAL:e===Gt.UNAVAILABLE?cn.UNAVAILABLE:e===Gt.UNAUTHENTICATED?cn.UNAUTHENTICATED:e===Gt.INVALID_ARGUMENT?cn.INVALID_ARGUMENT:e===Gt.NOT_FOUND?cn.NOT_FOUND:e===Gt.ALREADY_EXISTS?cn.ALREADY_EXISTS:e===Gt.PERMISSION_DENIED?cn.PERMISSION_DENIED:e===Gt.FAILED_PRECONDITION?cn.FAILED_PRECONDITION:e===Gt.ABORTED?cn.ABORTED:e===Gt.OUT_OF_RANGE?cn.OUT_OF_RANGE:e===Gt.UNIMPLEMENTED?cn.UNIMPLEMENTED:e===Gt.DATA_LOSS?cn.DATA_LOSS:Wo('Unknown status code: '+e)}function G(e){return 200===e?Gt.OK:400===e?Gt.INVALID_ARGUMENT:401===e?Gt.UNAUTHENTICATED:403===e?Gt.PERMISSION_DENIED:404===e?Gt.NOT_FOUND:409===e?Gt.ABORTED:416===e?Gt.OUT_OF_RANGE:429===e?Gt.RESOURCE_EXHAUSTED:499===e?Gt.CANCELLED:500===e?Gt.UNKNOWN:501===e?Gt.UNIMPLEMENTED:503===e?Gt.UNAVAILABLE:504===e?Gt.DEADLINE_EXCEEDED:200<=e&&300>e?Gt.OK:400<=e&&500>e?Gt.FAILED_PRECONDITION:500<=e&&600>e?Gt.INTERNAL:Gt.UNKNOWN}function X(){return ln}function Q(){return fn}function Y(){return dn}function J(){return pn}function $(n,t){0i||i>t-2)&&Wo('Invalid encoded resource path: "'+n+'"'),n.charAt(i+1)){case ir:var a=n.substring(o,i),s=void 0;0===r.length?s=a:(r+=a,s=r,r=''),e.push(s);break;case sr:r+=n.substring(o,i),r+='\0';break;case lr:r+=n.substring(o,i+1);break;default:Wo('Invalid encoded resource path: "'+n+'"');}o=i+2}return new re(e)}function lt(n,t){Ho(0===t,'Unexpected upgrade from version '+t),n.createObjectStore(pr.store,{keyPath:pr.keyPath}),n.createObjectStore(ur.store,{keyPath:ur.keyPath}),n.createObjectStore(yr.store,{keyPath:yr.keyPath}).createIndex(yr.documentTargetsIndex,yr.documentTargetsKeyPath,{unique:!0}),n.createObjectStore(fr.store,{keyPath:fr.keyPath}).createIndex(fr.queryTargetsIndexName,fr.queryTargetsKeyPath,{unique:!0}),n.createObjectStore(hr.store),n.createObjectStore(gr.store),n.createObjectStore(dr.store),n.createObjectStore(br.store)}function ct(o){return new Gn(function(r,e){o.onsuccess=function(e){var t=e.target.result;r(t)},o.onerror=function(n){e(n.target.error)}})}function dt(e){return Ho('string'==typeof e,'Persisting non-string stream token not supported.'),e}function pt(e){return mt(e,ur.store)}function ut(e){return mt(e,hr.store)}function ht(e){return mt(e,pr.store)}function mt(n,t){return n instanceof Cr?n.store(t):Wo('Invalid transaction object provided!')}function gt(e){return bt(e,fr.store)}function ft(e){return bt(e,br.store)}function yt(e){return bt(e,yr.store)}function bt(n,t){return n instanceof Cr?n.store(t):Wo('Invalid transaction object provided!')}function vt(e){return e instanceof Cr?e.store(gr.store):Wo('Invalid transaction object provided!')}function Et(e){return e.path.toArray()}function St(e){return void 0!==e.documents}function Ct(e){if(!e)return new ao;switch(e.type){case'gapi':return new co(e.client,e.sessionIndex||'0');case'provider':return e.client;default:throw new Ht(Gt.INVALID_ARGUMENT,'makeCredentialsProvider failed due to invalid credential type');}}function Tt(e){return kt(e,['next','error','complete'])}function kt(a,s){if('object'!=typeof a||null===a)return!1;for(var e=a,n=0,r=s,o;nt.query.docComparator(r,a.doc),'Got added events in wrong order'),r=a.doc,{type:'added',doc:o,oldIndex:-1,newIndex:e++}})}var d=t.oldDocs;return t.docChanges.map(function(e){var n=new Oo(s,e.doc.key,e.doc,t.fromCache),o=-1,l=-1;return e.type!==Ln.Added&&(o=d.indexOf(e.doc.key),Ho(0<=o,'Index for document not found'),d=d.delete(e.doc.key)),e.type!==Ln.Removed&&(d=d.add(e.doc),l=d.indexOf(e.doc.key)),{type:Dt(e.type),doc:n,oldIndex:o,newIndex:l}})}function Dt(e){return e===Ln.Added?'added':e===Ln.Modified||e===Ln.Metadata?'modified':e===Ln.Removed?'removed':Wo('Unknown change type: '+e)}function _t(e){e.INTERNAL.registerService('firestore',function(e){return new ko(e)},h(na))}function Mt(e){_t(e)}var Ft=Number.POSITIVE_INFINITY,Bt=String.fromCharCode,Ut=Math.floor,Vt=Math.min;Object.defineProperty(t,'__esModule',{value:!0});var zo=e(6),jt=zo.default.SDK_VERSION,Qt;!function(e){e[e.DEBUG=0]='DEBUG',e[e.ERROR=1]='ERROR',e[e.SILENT=2]='SILENT'}(Qt||(Qt={}));var qt=Qt.ERROR,Kt=function(){function n(){}return n.setPlatform=function(t){n.platform&&Wo('Platform already defined'),n.platform=t},n.getPlatform=function(){return n.platform||Wo('Platform not set'),n.platform},n}(),Wt=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),Gt={OK:'ok',CANCELLED:'cancelled',UNKNOWN:'unknown',INVALID_ARGUMENT:'invalid-argument',DEADLINE_EXCEEDED:'deadline-exceeded',NOT_FOUND:'not-found',ALREADY_EXISTS:'already-exists',PERMISSION_DENIED:'permission-denied',UNAUTHENTICATED:'unauthenticated',RESOURCE_EXHAUSTED:'resource-exhausted',FAILED_PRECONDITION:'failed-precondition',ABORTED:'aborted',OUT_OF_RANGE:'out-of-range',UNIMPLEMENTED:'unimplemented',INTERNAL:'internal',UNAVAILABLE:'unavailable',DATA_LOSS:'data-loss'},Ht=function(o){function t(t,a){var n=o.call(this,a)||this;return n.code=t,n.message=a,n.name='FirebaseError',n.toString=function(){return n.name+': [code='+n.code+']: '+n.message},n}return Wt(t,o),t}(Error),zt=function(){function e(){}return e.newId=function(){for(var o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',t='',e=0;20>e;e++)t+=o.charAt(Ut(Math.random()*o.length));return Ho(20===t.length,'Invalid auto ID: '+t),t},e}(),Xt=function(){function n(e){F(),this.e=e}return n.fromBase64String=function(t){m('Blob.fromBase64String',arguments,1),b('Blob.fromBase64String','string',1,t),F();try{return new n(Kt.getPlatform().atob(t))}catch(e){throw new Ht(Gt.INVALID_ARGUMENT,'Failed to construct Blob from Base64 string: '+e)}},n.fromUint8Array=function(t){if(m('Blob.fromUint8Array',arguments,1),M(),!(t instanceof Uint8Array))throw A('Blob.fromUint8Array','Uint8Array',1,t);return new n(Array.prototype.map.call(t,function(e){return Bt(e)}).join(''))},n.prototype.toBase64=function(){return m('Blob.toBase64',arguments,0),F(),Kt.getPlatform().btoa(this.e)},n.prototype.toUint8Array=function(){m('Blob.toUint8Array',arguments,0),M();for(var n=new Uint8Array(this.e.length),t=0;tn||90o||180o.length&&Wo('offset '+t+' out of range '+o.length),void 0===e?e=o.length-t:e>o.length-t&&Wo('length '+e+' out of range '+(o.length-t)),this.segments=o,this.offset=t,this.len=e},o.prototype.construct=function(o,t,e){var n=Object.create(Object.getPrototypeOf(this));return n.init(o,t,e),n},Object.defineProperty(o.prototype,'length',{get:function(){return this.len},enumerable:!0,configurable:!0}),o.prototype.equals=function(t){return 0===o.comparator(this,t)},o.prototype.child=function(t){var r=this.segments.slice(this.offset,this.limit());return t instanceof o?t.forEach(function(e){r.push(e)}):'string'==typeof t?r.push(t):Wo('Unknown parameter type for Path.child(): '+t),this.construct(r)},o.prototype.limit=function(){return this.offset+this.length},o.prototype.popFirst=function(e){return e=void 0===e?1:e,Ho(this.length>=e,'Can\'t call popFirst() with less segments'),this.construct(this.segments,this.offset+e,this.length-e)},o.prototype.popLast=function(){return Ho(!this.isEmpty(),'Can\'t call popLast() on empty path'),this.construct(this.segments,this.offset,this.length-1)},o.prototype.firstSegment=function(){return Ho(!this.isEmpty(),'Can\'t call firstSegment() on empty path'),this.segments[this.offset]},o.prototype.lastSegment=function(){return Ho(!this.isEmpty(),'Can\'t call lastSegment() on empty path'),this.segments[this.limit()-1]},o.prototype.get=function(e){return Ho(eo)return 1}return a.lengtht.length?1:0},o}(),re=function(n){function o(){return null!==n&&n.apply(this,arguments)||this}return ee(o,n),o.prototype.canonicalString=function(){return this.toArray().join('/')},o.prototype.toString=function(){return this.canonicalString()},o.fromString=function(e){if(0<=e.indexOf('//'))throw new Ht(Gt.INVALID_ARGUMENT,'Invalid path ('+e+'). Paths must not contain // in them.');return new o(e.split('/').filter(function(e){return 0e?t=t.left:0n?t=t.left:0n?e=e.left:(t+=e.left.size+1,e=e.right)}return-1},o.prototype.isEmpty=function(){return this.root.isEmpty()},Object.defineProperty(o.prototype,'size',{get:function(){return this.root.size},enumerable:!0,configurable:!0}),o.prototype.minKey=function(){return this.root.minKey()},o.prototype.maxKey=function(){return this.root.maxKey()},o.prototype.inorderTraversal=function(e){return this.root.inorderTraversal(e)},o.prototype.forEach=function(o){this.inorderTraversal(function(t,e){return o(t,e),!1})},o.prototype.reverseTraversal=function(e){return this.root.reverseTraversal(e)},o.prototype.getIterator=function(e){return new he(this.root,null,this.comparator,!1,e)},o.prototype.getIteratorFrom=function(n,t){return new he(this.root,n,this.comparator,!1,t)},o.prototype.getReverseIterator=function(e){return new he(this.root,null,this.comparator,!0,e)},o.prototype.getReverseIteratorFrom=function(n,t){return new he(this.root,n,this.comparator,!0,t)},o}(),he=function(){function e(a,s,e,n,r){this.resultGenerator=r||null,this.isReverse=n,this.nodeStack=[];for(var o=1;!a.isEmpty();)if(o=s?e(a.key,s):1,n&&(o*=-1),0>o)a=this.isReverse?a.left:a.right;else{if(0===o){this.nodeStack.push(a);break}this.nodeStack.push(a),a=this.isReverse?a.right:a.left}}return e.prototype.getNext=function(){Ho(0r?n.copy(null,null,null,n.left.insert(a,t,e),null):0===r?n.copy(null,t,null,null,null):n.copy(null,null,null,null,n.right.insert(a,t,e)),n.fixUp()},a.prototype.removeMin=function(){if(this.left.isEmpty())return a.EMPTY;var t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()},a.prototype.remove=function(t,e){var n=this,o;if(0>e(t,n.key))n.left.isEmpty()||n.left.isRed()||n.left.left.isRed()||(n=n.moveRedLeft()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed()&&(n=n.rotateRight()),n.right.isEmpty()||n.right.isRed()||n.right.left.isRed()||(n=n.moveRedRight()),0===e(t,n.key)){if(n.right.isEmpty())return a.EMPTY;o=n.right.min(),n=n.copy(o.key,o.value,null,null,n.right.removeMin())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp()},a.prototype.isRed=function(){return this.color},a.prototype.fixUp=function(){var e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e},a.prototype.moveRedLeft=function(){var e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e},a.prototype.moveRedRight=function(){var e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e},a.prototype.rotateLeft=function(){var t=this.copy(null,null,a.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},a.prototype.rotateRight=function(){var t=this.copy(null,null,a.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},a.prototype.colorFlip=function(){var n=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,n,t)},a.prototype.checkMaxDepth=function(){var e=this.check();return Math.pow(2,e)<=this.size+1},a.prototype.check=function(){if(this.isRed()&&this.left.isRed())throw Wo('Red node has red child('+this.key+','+this.value+')');if(this.right.isRed())throw Wo('Right child of ('+this.key+','+this.value+') is red');var e=this.left.check();if(e!==this.right.check())throw Wo('Black depths differ');return e+(this.isRed()?0:1)},a.EMPTY=null,a.RED=!0,a.BLACK=!1,a}(),fe=function(){function e(){this.size=0}return e.prototype.copy=function(){return this},e.prototype.insert=function(n,t){return new le(n,t)},e.prototype.remove=function(){return this},e.prototype.isEmpty=function(){return!0},e.prototype.inorderTraversal=function(){return!1},e.prototype.reverseTraversal=function(){return!1},e.prototype.minKey=function(){return null},e.prototype.maxKey=function(){return null},e.prototype.isRed=function(){return!1},e.prototype.checkMaxDepth=function(){return!0},e.prototype.check=function(){return 0},e}();le.EMPTY=new fe;var de=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),ye;!function(e){e[e.NullValue=0]='NullValue',e[e.BooleanValue=1]='BooleanValue',e[e.NumberValue=2]='NumberValue',e[e.TimestampValue=3]='TimestampValue',e[e.StringValue=4]='StringValue',e[e.BlobValue=5]='BlobValue',e[e.RefValue=6]='RefValue',e[e.GeoPointValue=7]='GeoPointValue',e[e.ArrayValue=8]='ArrayValue',e[e.ObjectValue=9]='ObjectValue'}(ye||(ye={}));var pe=function(){function e(){}return e.prototype.toString=function(){var e=this.value();return null===e?'null':''+e},e.prototype.defaultCompareTo=function(e){return Ho(this.typeOrder!==e.typeOrder,'Default compareTo should not be used for values of same type.'),P(this.typeOrder,e.typeOrder)},e}(),ge=function(n){function o(){var t=n.call(this)||this;return t.typeOrder=ye.NullValue,t.internalValue=null,t}return de(o,n),o.prototype.value=function(){return null},o.prototype.equals=function(e){return e instanceof o},o.prototype.compareTo=function(e){return e instanceof o?0:this.defaultCompareTo(e)},o.INSTANCE=new o,o}(pe),ve=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.BooleanValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.equals=function(e){return e instanceof n&&this.internalValue===e.internalValue},n.prototype.compareTo=function(e){return e instanceof n?P(this,e):this.defaultCompareTo(e)},n.of=function(e){return e?n.TRUE:n.FALSE},n.TRUE=new n(!0),n.FALSE=new n(!1),n}(pe),be=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.NumberValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.compareTo=function(e){return e instanceof n?B(this.internalValue,e.internalValue):this.defaultCompareTo(e)},n}(pe),we=function(n){function o(t){return n.call(this,t)||this}return de(o,n),o.prototype.equals=function(e){return e instanceof o&&U(this.internalValue,e.internalValue)},o}(be),Ie=function(o){function n(t){var r=o.call(this,t)||this;return r.internalValue=t,r}return de(n,o),n.prototype.equals=function(e){return e instanceof n&&U(this.internalValue,e.internalValue)},n.NAN=new n(NaN),n.POSITIVE_INFINITY=new n(1/0),n.NEGATIVE_INFINITY=new n(-1/0),n}(be),Te=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.StringValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.equals=function(e){return e instanceof n&&this.internalValue===e.internalValue},n.prototype.compareTo=function(e){return e instanceof n?P(this.internalValue,e.internalValue):this.defaultCompareTo(e)},n}(pe),Ee=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.TimestampValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue.toDate()},n.prototype.equals=function(e){return e instanceof n&&this.internalValue.equals(e.internalValue)},n.prototype.compareTo=function(e){return e instanceof n?this.internalValue.compareTo(e.internalValue):e instanceof Se?-1:this.defaultCompareTo(e)},n}(pe),Se=function(o){function n(t){var r=o.call(this)||this;return r.localWriteTime=t,r.typeOrder=ye.TimestampValue,r}return de(n,o),n.prototype.value=function(){return null},n.prototype.equals=function(e){return e instanceof n&&this.localWriteTime.equals(e.localWriteTime)},n.prototype.compareTo=function(e){return e instanceof n?this.localWriteTime.compareTo(e.localWriteTime):e instanceof Ee?1:this.defaultCompareTo(e)},n.prototype.toString=function(){return''},n}(pe),Ce=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.BlobValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.equals=function(e){return e instanceof n&&this.internalValue.n(e.internalValue)},n.prototype.compareTo=function(e){return e instanceof n?this.internalValue.r(e.internalValue):this.defaultCompareTo(e)},n}(pe),De=function(o){function r(t,a){var n=o.call(this)||this;return n.databaseId=t,n.key=a,n.typeOrder=ye.RefValue,n}return de(r,o),r.prototype.value=function(){return this.key},r.prototype.equals=function(e){return e instanceof r&&this.key.equals(e.key)&&this.databaseId.equals(e.databaseId)},r.prototype.compareTo=function(e){if(e instanceof r){var t=this.databaseId.compareTo(e.databaseId);return 0===t?ae.comparator(this.key,e.key):t}return this.defaultCompareTo(e)},r}(pe),ke=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.GeoPointValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.equals=function(e){return e instanceof n&&this.internalValue.n(e.internalValue)},n.prototype.compareTo=function(e){return e instanceof n?this.internalValue.r(e.internalValue):this.defaultCompareTo(e)},n}(pe),Ne=function(o){function s(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.ObjectValue,r}return de(s,o),s.prototype.value=function(){var o={};return this.internalValue.inorderTraversal(function(t,e){o[t]=e.value()}),o},s.prototype.forEach=function(e){this.internalValue.inorderTraversal(e)},s.prototype.equals=function(e){if(e instanceof s){for(var t=this.internalValue.getIterator(),n=e.internalValue.getIterator();t.hasNext()&&n.hasNext();){var r=t.getNext(),o=n.getNext();if(r.key!==o.key||!r.value.equals(o.value))return!1}return!t.hasNext()&&!n.hasNext()}return!1},s.prototype.compareTo=function(e){if(e instanceof s){for(var t=this.internalValue.getIterator(),n=e.internalValue.getIterator();t.hasNext()&&n.hasNext();){var r=t.getNext(),o=n.getNext(),i=P(r.key,o.key)||r.value.compareTo(o.value);if(i)return i}return P(t.hasNext(),n.hasNext())}return this.defaultCompareTo(e)},s.prototype.set=function(e,t){if(Ho(!e.isEmpty(),'Cannot set field for empty path on ObjectValue'),1===e.length)return this.setChild(e.firstSegment(),t);var n=this.child(e.firstSegment());n instanceof s||(n=s.EMPTY);var r=n.set(e.popFirst(),t);return this.setChild(e.firstSegment(),r)},s.prototype.delete=function(e){if(Ho(!e.isEmpty(),'Cannot delete field for empty path on ObjectValue'),1===e.length)return new s(this.internalValue.remove(e.firstSegment()));var t=this.child(e.firstSegment());if(t instanceof s){var n=t.delete(e.popFirst());return new s(this.internalValue.insert(e.firstSegment(),n))}return this},s.prototype.contains=function(e){return void 0!==this.field(e)},s.prototype.field=function(e){Ho(!e.isEmpty(),'Can\'t get field of empty path');var o=this;return e.forEach(function(e){o=o instanceof s?o.internalValue.get(e)||void 0:void 0}),o},s.prototype.toString=function(){return JSON.stringify(this.value())},s.prototype.child=function(e){return this.internalValue.get(e)||void 0},s.prototype.setChild=function(e,t){return new s(this.internalValue.insert(e,t))},s.EMPTY=new s(new ce(P)),s}(pe),Ae=function(o){function a(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.ArrayValue,r}return de(a,o),a.prototype.value=function(){return this.internalValue.map(function(e){return e.value()})},a.prototype.forEach=function(e){this.internalValue.forEach(e)},a.prototype.equals=function(e){if(e instanceof a){if(this.internalValue.length!==e.internalValue.length)return!1;for(var t=0;t='===t?n.GREATER_THAN_OR_EQUAL:'>'===t?n.GREATER_THAN:Wo('Unknown relation: '+t)},n.prototype.toString=function(){return this.name},n.prototype.equals=function(e){return this.name===e.name},n.LESS_THAN=new n('<'),n.LESS_THAN_OR_EQUAL=new n('<='),n.EQUAL=new n('=='),n.GREATER_THAN=new n('>'),n.GREATER_THAN_OR_EQUAL=new n('>='),n}(),xe=function(){function n(o,r,e){this.field=o,this.op=r,this.value=e}return n.prototype.matches=function(o){if(this.field.isKeyField()){Ho(this.value instanceof De,'Comparing on key, but filter value not a RefValue');var t=this.value,e=ae.comparator(o.key,t.key);return this.matchesComparison(e)}var n=o.field(this.field);return void 0!==n&&this.matchesValue(n)},n.prototype.matchesValue=function(e){return this.value.typeOrder===e.typeOrder&&this.matchesComparison(e.compareTo(this.value))},n.prototype.matchesComparison=function(e){switch(this.op){case Le.LESS_THAN:return 0>e;case Le.LESS_THAN_OR_EQUAL:return 0>=e;case Le.EQUAL:return 0===e;case Le.GREATER_THAN:return 0=e:0>e},e.prototype.equals=function(o){if(null===o)return!1;if(this.before!==o.before||this.position.length!==o.position.length)return!1;for(var t=0;to,'timestamp nanoseconds out of range'+o),Ho(-62135596800<=n,'timestamp seconds out of range: '+n),Ho(253402300800>n,'timestamp seconds out of range'+n)}return a.now=function(){return a.fromEpochMilliseconds(Date.now())},a.fromDate=function(t){return a.fromEpochMilliseconds(t.getTime())},a.fromEpochMilliseconds=function(t){var e=Ut(t/1e3);return new a(e,1e6*(t-1e3*e))},a.fromISOString=function(t){var e=0,n=Ke.exec(t);if(Ho(!!n,'invalid timestamp: '+t),n[1]){var s=n[1];s=(s+'000000000').substr(0,9),e=parseInt(s,10)}var o=new Date(t);return new a(Ut(o.getTime()/1e3),e)},a.prototype.toDate=function(){return new Date(this.toEpochMilliseconds())},a.prototype.toEpochMilliseconds=function(){return 1e3*this.seconds+this.nanos/1e6},a.prototype.compareTo=function(e){return this.seconds===e.seconds?P(this.nanos,e.nanos):P(this.seconds,e.seconds)},a.prototype.equals=function(e){return e.seconds===this.seconds&&e.nanos===this.nanos},a.prototype.toString=function(){return'Timestamp(seconds='+this.seconds+', nanos='+this.nanos+')'},a}(),Ge=function(){function o(e){this.timestamp=e}return o.fromMicroseconds=function(t){var e=Ut(t/1e6);return new o(new We(e,1e3*(t%1e6)))},o.fromTimestamp=function(t){return new o(t)},o.forDeletedDoc=function(){return o.MIN},o.prototype.compareTo=function(e){return this.timestamp.compareTo(e.timestamp)},o.prototype.equals=function(e){return this.timestamp.equals(e.timestamp)},o.prototype.toMicroseconds=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanos/1e3},o.prototype.toString=function(){return'SnapshotVersion('+this.timestamp+')'},o.prototype.toTimestamp=function(){return this.timestamp},o.MIN=new o(new We(0,0)),o}(),He;!function(e){e[e.Listen=0]='Listen',e[e.ExistenceFilterMismatch=1]='ExistenceFilterMismatch',e[e.LimboResolution=2]='LimboResolution'}(He||(He={}));var me=function(){function n(a,s,e,n,r){void 0===n&&(n=Ge.MIN),void 0===r&&(r=i()),this.query=a,this.targetId=s,this.purpose=e,this.snapshotVersion=n,this.resumeToken=r}return n.prototype.update=function(t){return new n(this.query,this.targetId,this.purpose,t.snapshotVersion,t.resumeToken)},n.prototype.equals=function(e){return this.targetId===e.targetId&&this.purpose===e.purpose&&this.snapshotVersion.equals(e.snapshotVersion)&&this.resumeToken===e.resumeToken&&this.query.equals(e.query)},n}(),Xe=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ye=function(){function e(e){this.fields=e}return e.prototype.equals=function(e){return x(this.fields,e.fields)},e}(),Je=function(){function n(){}return n.prototype.equals=function(t){return t instanceof n},n.instance=new n,n}(),$e=function(){function e(n,o){this.field=n,this.transform=o}return e.prototype.equals=function(e){return this.field.equals(e.field)&&this.transform.equals(e.transform)},e}(),Ze=function(){function e(n,o){this.version=n,this.transformResults=o}return e}(),tn;!function(e){e[e.Set=0]='Set',e[e.Patch=1]='Patch',e[e.Transform=2]='Transform',e[e.Delete=3]='Delete'}(tn||(tn={}));var ze=function(){function n(n,o){this.updateTime=n,this.exists=o,Ho(void 0===n||void 0===o,'Precondition can specify "exists" or "updateTime" but not both')}return n.exists=function(t){return new n(void 0,t)},n.updateTime=function(t){return new n(t)},Object.defineProperty(n.prototype,'isNone',{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!0,configurable:!0}),n.prototype.isValidFor=function(e){return void 0===this.updateTime?void 0===this.exists?(Ho(this.isNone,'Precondition should be empty'),!0):this.exists?e instanceof se:null===e||e instanceof ue:e instanceof se&&e.version.equals(this.updateTime)},n.prototype.equals=function(e){return L(this.updateTime,e.updateTime)&&this.exists===e.exists},n.NONE=new n,n}(),nn=function(){function e(){}return e.prototype.verifyKeyMatches=function(e){null!=e&&Ho(e.key.equals(this.key),'Can only apply a mutation to a document with the same key')},e.getPostMutationVersion=function(e){return e instanceof se?e.version:Ge.MIN},e}(),rn=function(a){function n(t,i,n){var r=a.call(this)||this;return r.key=t,r.value=i,r.precondition=n,r.type=tn.Set,r}return Xe(n,a),n.prototype.applyToRemoteDocument=function(o,t){this.verifyKeyMatches(o),Ho(null==t.transformResults,'Transform results received by SetMutation.');var e=nn.getPostMutationVersion(o);return new se(this.key,e,this.value,{hasLocalMutations:!1})},n.prototype.applyToLocalView=function(e){if(this.verifyKeyMatches(e),!this.precondition.isValidFor(e))return e;var t=nn.getPostMutationVersion(e);return new se(this.key,t,this.value,{hasLocalMutations:!0})},n.prototype.equals=function(e){return e instanceof n&&this.key.equals(e.key)&&this.value.equals(e.value)&&this.precondition.equals(e.precondition)},n}(nn),on=function(a){function n(t,s,n,r){var o=a.call(this)||this;return o.key=t,o.data=s,o.fieldMask=n,o.precondition=r,o.type=tn.Patch,o}return Xe(n,a),n.prototype.applyToRemoteDocument=function(o,t){if(this.verifyKeyMatches(o),Ho(null==t.transformResults,'Transform results received by PatchMutation.'),!this.precondition.isValidFor(o))return o;var e=nn.getPostMutationVersion(o),n=this.patchDocument(o);return new se(this.key,e,n,{hasLocalMutations:!1})},n.prototype.applyToLocalView=function(e){if(this.verifyKeyMatches(e),!this.precondition.isValidFor(e))return e;var t=nn.getPostMutationVersion(e),n=this.patchDocument(e);return new se(this.key,t,n,{hasLocalMutations:!0})},n.prototype.equals=function(e){return e instanceof n&&this.key.equals(e.key)&&this.fieldMask.equals(e.fieldMask)&&this.precondition.equals(e.precondition)},n.prototype.patchDocument=function(n){var t;return t=n instanceof se?n.data:Ne.EMPTY,this.patchObject(t)},n.prototype.patchObject=function(a){for(var t=0,e=this.fieldMask.fields;t>Jn<=o?e|this.generatorId:(e|this.generatorId)-(1<',o),e=this.store.put(o)):(So('SimpleDb','PUT',this.store.name,o,t),e=this.store.put(t,o)),ct(e)},e.prototype.get=function(o){var t=this;return ct(this.store.get(o)).next(function(e){return void 0===e&&(e=null),So('SimpleDb','GET',t.store.name,o,e),e})},e.prototype.delete=function(e){return So('SimpleDb','DELETE',this.store.name,e),ct(this.store.delete(e))},e.prototype.loadAll=function(o,t){var e=this.cursor(this.options(o,t)),n=[];return this.iterateCursor(e,function(o,t){n.push(t)}).next(function(){return n})},e.prototype.deleteAll=function(o,t){So('SimpleDb','DELETE ALL',this.store.name);var e=this.options(o,t);e.keysOnly=!1;var n=this.cursor(e);return this.iterateCursor(n,function(o,t,e){return e.delete()})},e.prototype.iterate=function(o,t){var e;t?e=o:(e={},t=o);var n=this.cursor(e);return this.iterateCursor(n,t)},e.prototype.iterateCursor=function(a,s){var e=[];return new Gn(function(n,r){a.onerror=function(e){r(e.target.error)},a.onsuccess=function(r){var t=r.target.result;if(!t)return void n();var d=new Sr(t),i=s(t.primaryKey,t.value,d);i instanceof Gn&&e.push(i),d.isDone?n():null===d.skipToKey?t.continue():t.continue(d.skipToKey)}}).next(function(){return Gn.waitFor(e)})},e.prototype.options=function(o,r){var a;return void 0!==o&&('string'==typeof o?a=o:(Ho(void 0===r,'3rd argument must not be defined if 2nd is a range.'),r=o)),{index:a,range:r}},e.prototype.cursor=function(o){var t='next';if(o.reverse&&(t='prev'),o.index){var e=this.store.index(o.index);return o.keysOnly?e.openKeyCursor(o.range,t):e.openCursor(o.range,t)}return this.store.openCursor(o.range,t)},e}(),kr=function(){function o(n,o){this.userId=n,this.serializer=o,this.garbageCollector=null}return o.forUser=function(t,e){return Ho(''!==t.uid,'UserID must not be an empty string.'),new o(t.isUnauthenticated()?'':t.uid,e)},o.prototype.start=function(r){var e=this;return o.loadNextBatchIdFromDb(r).next(function(n){return e.nextBatchId=n,ht(r).get(e.userId)}).next(function(n){return n||(n=new pr(e.userId,nr,'')),e.metadata=n,e.metadata.lastAcknowledgedBatchId>=e.nextBatchId?e.checkEmpty(r).next(function(n){return Ho(n,'Reset nextBatchID is only possible when the queue is empty'),e.metadata.lastAcknowledgedBatchId=nr,ht(r).put(e.metadata)}):Gn.resolve()})},o.loadNextBatchIdFromDb=function(n){var a=nr;return pt(n).iterate({reverse:!0},function(e,t,n){var r=e[0];if(e[1]>a&&(a=t.batchId),''===r)n.done();else{var o=D(r);n.skip([o])}}).next(function(){return a+1})},o.prototype.checkEmpty=function(o){var a=!0,e=IDBKeyRange.bound(this.keyForBatchId(Number.NEGATIVE_INFINITY),this.keyForBatchId(Number.POSITIVE_INFINITY));return pt(o).iterate({range:e},function(e,t,n){a=!1,n.done()}).next(function(){return a})},o.prototype.getNextBatchId=function(){return Gn.resolve(this.nextBatchId)},o.prototype.getHighestAcknowledgedBatchId=function(){return Gn.resolve(this.metadata.lastAcknowledgedBatchId)},o.prototype.acknowledgeBatch=function(o,t,e){var n=t.batchId;return Ho(n>this.metadata.lastAcknowledgedBatchId,'Mutation batchIDs must be acknowledged in order'),this.metadata.lastAcknowledgedBatchId=n,this.metadata.lastStreamToken=dt(e),ht(o).put(this.metadata)},o.prototype.getLastStreamToken=function(){return Gn.resolve(this.metadata.lastStreamToken)},o.prototype.setLastStreamToken=function(n,t){return this.metadata.lastStreamToken=dt(t),ht(n).put(this.metadata)},o.prototype.addMutationBatch=function(d,t,e){var n=this,r=this.nextBatchId;this.nextBatchId++;var o=new or(r,t,e),i=this.serializer.toDbMutationBatch(this.userId,o);return pt(d).put(i).next(function(){for(var t=[],o=0,i=e;os,'Should have found mutation after '+s),n=e.serializer.fromDbMutationBatch(t)),r.done()}).next(function(){return n})},o.prototype.getAllMutationBatches=function(o){var r=this,e=IDBKeyRange.bound(this.keyForBatchId(nr),this.keyForBatchId(Number.POSITIVE_INFINITY));return pt(o).loadAll(e).next(function(e){return e.map(function(e){return r.serializer.fromDbMutationBatch(e)})})},o.prototype.getAllMutationBatchesThroughBatchId=function(o,t){var e=this,n=IDBKeyRange.bound(this.keyForBatchId(nr),this.keyForBatchId(t));return pt(o).loadAll(n).next(function(n){return n.map(function(n){return e.serializer.fromDbMutationBatch(n)})})},o.prototype.getAllMutationBatchesAffectingDocumentKey=function(d,t){var e=this,n=hr.prefixForPath(this.userId,t.path),r=IDBKeyRange.lowerBound(n),a=[];return ut(d).iterate({range:r},function(n,r,o){var i=n[0],s=n[1],p=n[2],c=st(s);if(i!==e.userId||!t.path.equals(c))return void o.done();var l=e.keyForBatchId(p);return pt(d).get(l).next(function(o){null===o&&Wo('Dangling document-mutation reference found: '+n+' which points to '+l),a.push(e.serializer.fromDbMutationBatch(o))})}).next(function(){return a})},o.prototype.getAllMutationBatchesAffectingQuery=function(d,t){var l=this;Ho(!t.isDocumentQuery(),'Document queries shouldn\'t go down this path');var n=t.path,r=n.length+1,e=hr.prefixForPath(this.userId,n),o=(e[1],IDBKeyRange.lowerBound(e)),p=new en(P);return ut(d).iterate({range:o},function(o,t,e){var i=o[0],a=o[1],s=o[2],d=st(a);return i===l.userId&&n.isPrefixOf(d)?void(d.length===r&&(p=p.add(s))):void e.done()}).next(function(){var n=[],e=[];return p.forEach(function(t){var o=l.keyForBatchId(t);e.push(pt(d).get(o).next(function(e){null===e&&Wo('Dangling document-mutation reference found, which points to '+o),n.push(l.serializer.fromDbMutationBatch(e))}))}),Gn.waitFor(e).next(function(){return n})})},o.prototype.removeMutationBatches=function(d,t){for(var p=pt(d),e=ut(d),n=[],o=this,r=0,a=t,i;rthis.metadata.highestTargetId?(this.metadata.highestTargetId=n,r.next(function(){return ft(a).put(br.key,e.metadata)})):r},e.prototype.removeQueryData=function(n,t){return this.removeMatchingKeysForTargetId(n,t.targetId).next(function(){gt(n).delete(t.targetId)})},e.prototype.getQueryData=function(a,s){var e=this,t=s.canonicalId(),n=IDBKeyRange.bound([t,Number.NEGATIVE_INFINITY],[t,Ft]),d=null;return gt(a).iterate({range:n,index:fr.queryTargetsIndexName},function(n,t,r){var o=e.serializer.fromDbTarget(t);s.equals(o.query)&&(d=o,r.done())}).next(function(){return d})},e.prototype.addMatchingKeys=function(a,t,i){var n=[],r=yt(a);return t.forEach(function(o){var t=rt(o.path);n.push(r.put(new yr(i,t)))}),Gn.waitFor(n)},e.prototype.removeMatchingKeys=function(a,t,s){var n=this,r=[],o=yt(a);return t.forEach(function(a){var t=rt(a.path);r.push(o.delete([s,t])),null!==n.garbageCollector&&n.garbageCollector.addPotentialGarbageKey(a)}),Gn.waitFor(r)},e.prototype.removeMatchingKeysForTargetId=function(o,t){var e=yt(o),n=IDBKeyRange.bound([t],[t+1],!1,!0);return this.notifyGCForRemovedKeys(o,n).next(function(){return e.delete(n)})},e.prototype.notifyGCForRemovedKeys=function(o,t){var a=this,n=yt(o);return null!==this.garbageCollector&&this.garbageCollector.isEager?n.iterate({range:t,keysOnly:!0},function(e){var t=st(e[1]),n=new ae(t);Ho(null!==a.garbageCollector,'GarbageCollector for query cache set to null during key removal.'),a.garbageCollector.addPotentialGarbageKey(n)}):Gn.resolve()},e.prototype.getMatchingKeysForTargetId=function(a,t){var e=IDBKeyRange.bound([t],[t+1],!1,!0),i=yt(a),s=J();return i.iterate({range:e,keysOnly:!0},function(e){var t=st(e[1]),n=new ae(t);s=s.add(n)}).next(function(){return s})},e.prototype.setGarbageCollector=function(e){this.garbageCollector=e},e.prototype.containsKey=function(a,t){Ho(null!==a,'Persistence Transaction cannot be null for query cache containsKey');var e=rt(t.path),n=IDBKeyRange.bound([e],[_(e)],!1,!0),i=0;return yt(a).iterate({index:yr.documentTargetsIndex,keysOnly:!0,range:n},function(o,t,e){i++,e.done()}).next(function(){return 0t?(o('Persistence owner-lease is in the future. Discarding.',n),1):n.ownerId===this.getZombiedOwnerId()))},r.prototype.scheduleOwnerLeaseRefreshes=function(){var n=this;this.ownerLeaseRefreshHandle=setInterval(function(){n.runTransaction('Refresh owner timestamp',function(t){return t.store(dr.store).put('owner',new dr(n.ownerId,Date.now()))}).catch(function(t){o(t),n.stopOwnerLeaseRefreshes()})},4e3)},r.prototype.stopOwnerLeaseRefreshes=function(){this.ownerLeaseRefreshHandle&&(clearInterval(this.ownerLeaseRefreshHandle),this.ownerLeaseRefreshHandle=null)},r.prototype.attachWindowUnloadHook=function(){var e=this;this.windowUnloadHandler=function(){e.setZombiedOwnerId(e.ownerId),e.shutdown()},window.addEventListener('unload',this.windowUnloadHandler)},r.prototype.detachWindowUnloadHook=function(){this.windowUnloadHandler&&(window.removeEventListener('unload',this.windowUnloadHandler),this.windowUnloadHandler=null)},r.prototype.getZombiedOwnerId=function(){try{var e=window.localStorage.getItem(this.zombiedOwnerLocalStorageKey());return So('IndexedDbPersistence','Zombied ownerID from LocalStorage:',e),e}catch(e){return o('Failed to get zombie owner id.',e),null}},r.prototype.setZombiedOwnerId=function(e){try{null===e?window.localStorage.removeItem(this.zombiedOwnerLocalStorageKey()):window.localStorage.setItem(this.zombiedOwnerLocalStorageKey(),e)}catch(e){o('Failed to set zombie owner id.',e)}},r.prototype.zombiedOwnerLocalStorageKey=function(){return this.localStoragePrefix+'zombiedOwnerId'},r.prototype.generateOwnerId=function(){return zt.newId()},r.MAIN_DATABASE='main',r}(),Or=function(){function e(n,o){this.remoteDocumentCache=n,this.mutationQueue=o}return e.prototype.getDocument=function(o,t){var e=this;return this.remoteDocumentCache.getEntry(o,t).next(function(n){return e.computeLocalDocument(o,t,n)})},e.prototype.getDocuments=function(a,t){var i=this,n=[],r=X();return t.forEach(function(o){n.push(i.getDocument(a,o).next(function(e){e||(e=new ue(o,Ge.forDeletedDoc())),r=r.insert(o,e)}))}),Gn.waitFor(n).next(function(){return r})},e.prototype.getDocumentsMatchingQuery=function(n,t){return ae.isDocumentKey(t.path)?this.getDocumentsMatchingDocumentQuery(n,t.path):this.getDocumentsMatchingCollectionQuery(n,t)},e.prototype.getDocumentsMatchingDocumentQuery=function(n,t){return this.getDocument(n,new ae(t)).next(function(n){var t=Q();return n instanceof se&&(t=t.insert(n.key,n)),t})},e.prototype.getDocumentsMatchingCollectionQuery=function(a,i){var t=this,e;return this.remoteDocumentCache.getDocumentsMatchingQuery(a,i).next(function(n){return t.computeLocalDocuments(a,n)}).next(function(n){return e=n,t.mutationQueue.getAllMutationBatchesAffectingQuery(a,i)}).next(function(n){for(var r=J(),o=0,i=n;on,'Acknowledged batches can\'t be rejected.'),t})}).next(function(){return i.removeMutationBatch(e,t)}).next(function(o){return n=o,i.mutationQueue.performConsistencyCheck(e)}).next(function(){return i.localDocuments.getDocuments(e,n)})})},e.prototype.getLastStreamToken=function(){var n=this;return this.persistence.runTransaction('Get last stream token',function(t){return n.mutationQueue.getLastStreamToken(t)})},e.prototype.setLastStreamToken=function(o){var t=this;return this.persistence.runTransaction('Set last stream token',function(e){return t.mutationQueue.setLastStreamToken(e,o)})},e.prototype.getLastRemoteSnapshotVersion=function(){return this.queryCache.getLastRemoteSnapshotVersion()},e.prototype.applyRemoteEvent=function(i){var p=this,e=new Pr(this.remoteDocuments);return this.persistence.runTransaction('Apply remote event',function(c){var r=[];d(i.targetChanges,function(e,t){var n=p.targetIds[e];if(n){var o=t.mapping;if(o)if(o instanceof vn)r.push(p.queryCache.removeMatchingKeysForTargetId(c,e).next(function(){return p.queryCache.addMatchingKeys(c,o.documents,e)}));else{if(!(o instanceof bn))return Wo('Unknown mapping type: '+JSON.stringify(o));r.push(p.queryCache.removeMatchingKeys(c,o.removedDocuments,e).next(function(){return p.queryCache.addMatchingKeys(c,o.addedDocuments,e)}))}var a=t.resumeToken;0=n.compareTo(t)||u(this.targetIds)},e.prototype.shouldHoldBatchResult=function(e){return!this.isRemoteUpToVersion(e)||0r.version.compareTo(l))&&(r=n.applyToRemoteDocument(d,r,s),r?e.addEntry(r):Ho(!o,'Mutation batch '+n+' applied to document '+o+' resulted in null'))})}),r},e}(),xr=function(){function e(){this.mutationQueue=[],this.nextBatchId=1,this.highestAcknowledgedBatchId=nr,this.lastStreamToken=i(),this.garbageCollector=null,this.batchesByDocumentKey=new en(Yn.compareByKey)}return e.prototype.start=function(){return 0===this.mutationQueue.length&&(this.nextBatchId=1,this.highestAcknowledgedBatchId=nr),Ho(this.highestAcknowledgedBatchIdthis.highestAcknowledgedBatchId,'Mutation batchIDs must be acknowledged in order');var r=this.indexOfExistingBatchId(n,'acknowledged'),o=this.mutationQueue[r];return Ho(n===o.batchId,'Queue ordering failure: expected batch '+n+', got batch '+o.batchId),Ho(!o.isTombstone(),'Can\'t acknowledge a previously removed batch'),this.highestAcknowledgedBatchId=n,this.lastStreamToken=e,Gn.resolve()},e.prototype.getLastStreamToken=function(){return Gn.resolve(this.lastStreamToken)},e.prototype.setLastStreamToken=function(n,t){return this.lastStreamToken=t,Gn.resolve()},e.prototype.addMutationBatch=function(d,t,e){Ho(0!==e.length,'Mutation batches should not be empty');var n=this.nextBatchId;this.nextBatchId++,0n?0:n,o;rn?n=0:n>=e?n=e:n++,Gn.resolve(this.getAllLiveMutationBatchesBeforeIndex(n))},e.prototype.getAllMutationBatchesAffectingDocumentKey=function(a,s){var e=this,t=new Yn(s,0),n=new Yn(s,Ft),o=[];return this.batchesByDocumentKey.forEachInRange([t,n],function(n){Ho(s.equals(n.key),'Should only iterate over a single key\'s batches');var t=e.findMutationBatch(n.targetOrBatchId);Ho(null!==t,'Batches in the index must exist in the main table'),o.push(t)}),Gn.resolve(o)},e.prototype.getAllMutationBatchesAffectingQuery=function(d,t){var l=this,n=t.path,r=n.length+1,e=n;ae.isDocumentKey(e)||(e=e.child(''));var o=new Yn(new ae(e),0),a=new en(P);this.batchesByDocumentKey.forEachWhile(function(o){var t=o.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(a=a.add(o.targetOrBatchId)),!0)},o);var i=[];return a.forEach(function(n){var t=l.findMutationBatch(n);null!==t&&i.push(t)}),Gn.resolve(i)},e.prototype.removeMutationBatches=function(c,t){var e=t.length;Ho(0t||t>=this.mutationQueue.length)return null;var e=this.mutationQueue[t];return Ho(e.batchId===o,'If found batch must match'),e.isTombstone()?null:e},e}(),Dr=function(){function e(){this.queries=new jn(function(e){return e.canonicalId()}),this.lastRemoteSnapshotVersion=Ge.MIN,this.highestTargetId=0,this.references=new Xn}return e.prototype.start=function(){return Gn.resolve()},e.prototype.getLastRemoteSnapshotVersion=function(){return this.lastRemoteSnapshotVersion},e.prototype.getHighestTargetId=function(){return this.highestTargetId},e.prototype.setLastRemoteSnapshotVersion=function(n,t){return this.lastRemoteSnapshotVersion=t,Gn.resolve()},e.prototype.addQueryData=function(o,t){this.queries.set(t.query,t);var e=t.targetId;return e>this.highestTargetId&&(this.highestTargetId=e),Gn.resolve()},e.prototype.removeQueryData=function(n,t){return this.queries.delete(t.query),this.references.removeReferencesForId(t.targetId),Gn.resolve()},e.prototype.getQueryData=function(o,t){var e=this.queries.get(t)||null;return Gn.resolve(e)},e.prototype.addMatchingKeys=function(o,t,e){return this.references.addReferences(t,e),Gn.resolve()},e.prototype.removeMatchingKeys=function(o,t,e){return this.references.removeReferences(t,e),Gn.resolve()},e.prototype.removeMatchingKeysForTargetId=function(n,t){return this.references.removeReferencesForId(t),Gn.resolve()},e.prototype.getMatchingKeysForTargetId=function(o,t){var e=this.references.referencesForId(t);return Gn.resolve(e)},e.prototype.setGarbageCollector=function(e){this.references.setGarbageCollector(e)},e.prototype.containsKey=function(n,t){return this.references.containsKey(n,t)},e}(),_r=function(){function e(){this.docs=X()}return e.prototype.addEntry=function(n,t){return this.docs=this.docs.insert(t.key,t),Gn.resolve()},e.prototype.removeEntry=function(n,t){return this.docs=this.docs.remove(t),Gn.resolve()},e.prototype.getEntry=function(n,t){return Gn.resolve(this.docs.get(t))},e.prototype.getDocumentsMatchingQuery=function(d,t){for(var e=Q(),n=new ae(t.path.child('')),r=this.docs.getIteratorFrom(n);r.hasNext();){var o=r.getNext(),i=o.key,a=o.value;if(!t.path.isPrefixOf(i.path))break;a instanceof se&&t.matches(a)&&(e=e.insert(a.key,a))}return Gn.resolve(e)},e}(),Mr=function(){function e(){this.mutationQueues={},this.remoteDocumentCache=new _r,this.queryCache=new Dr,this.started=!1}return e.prototype.start=function(){return Ho(!this.started,'MemoryPersistence double-started!'),this.started=!0,Promise.resolve()},e.prototype.shutdown=function(){return Ho(this.started,'MemoryPersistence shutdown without start!'),this.started=!1,Promise.resolve()},e.prototype.getMutationQueue=function(n){var t=this.mutationQueues[n.toKey()];return t||(t=new xr,this.mutationQueues[n.toKey()]=t),t},e.prototype.getQueryCache=function(){return this.queryCache},e.prototype.getRemoteDocumentCache=function(){return this.remoteDocumentCache},e.prototype.runTransaction=function(n,t){return So('MemoryPersistence','Starting transaction:',n),t(new Fr).toPromise()},e}(),Fr=function(){return function(){}}(),Br=function(){function e(){this.isEager=!1}return e.prototype.addGarbageSource=function(){},e.prototype.removeGarbageSource=function(){},e.prototype.addPotentialGarbageKey=function(){},e.prototype.collectGarbage=function(){return Gn.resolve(J())},e}(),Ur=function(){function e(){var o=this;this.promise=new Promise(function(t,e){o.resolve=t,o.reject=e})}return e}(),Vr=function(){function e(o,r,e){this.initialDelayMs=o,this.backoffFactor=r,this.maxDelayMs=e,this.reset()}return e.prototype.reset=function(){this.currentBaseMs=0},e.prototype.resetToMax=function(){this.currentBaseMs=this.maxDelayMs},e.prototype.backoffAndWait=function(){var n=new Ur,t=this.currentBaseMs+this.jitterDelayMs();return 0this.maxDelayMs&&(this.currentBaseMs=this.maxDelayMs),n.promise},e.prototype.jitterDelayMs=function(){return(Math.random()-.5)*this.currentBaseMs},e}(),Hr=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),Wr;!function(e){e[e.Initial=0]='Initial',e[e.Auth=1]='Auth',e[e.Open=2]='Open',e[e.Error=3]='Error',e[e.Backoff=4]='Backoff',e[e.Stopped=5]='Stopped'}(Wr||(Wr={}));var Zn=function(){function e(o,a,e,n){this.queue=o,this.connection=a,this.credentialsProvider=e,this.idle=!1,this.stream=null,this.listener=null,this.backoff=new Vr(n||1e3,1.5,6e4),this.state=Wr.Initial}return e.prototype.isStarted=function(){return this.state===Wr.Backoff||this.state===Wr.Auth||this.state===Wr.Open},e.prototype.isOpen=function(){return this.state===Wr.Open},e.prototype.start=function(e){return this.state===Wr.Error?void this.performBackoff(e):void(Ho(this.state===Wr.Initial,'Already started'),this.listener=e,this.auth())},e.prototype.stop=function(){this.isStarted()&&this.close(Wr.Stopped)},e.prototype.inhibitBackoff=function(){Ho(!this.isStarted(),'Can only inhibit backoff in a stopped state'),this.state=Wr.Initial,this.backoff.reset()},e.prototype.markIdle=function(){var e=this;this.idle=!0,this.queue.schedule(function(){return e.handleIdleCloseTimer()},6e4).catch(function(e){Ho(e.code===Gt.CANCELLED,'Received unexpected error in idle timeout closure. Expected CANCELLED, but was: '+e)})},e.prototype.sendRequest=function(e){this.cancelIdleCheck(),this.stream.send(e)},e.prototype.handleIdleCloseTimer=function(){return this.isOpen()&&this.idle?this.close(Wr.Initial):Promise.resolve()},e.prototype.cancelIdleCheck=function(){this.idle=!1},e.prototype.close=function(r,t){Ho(r==Wr.Error||V(t),'Can\'t provide an error when not in an error state.'),this.cancelIdleCheck(),r==Wr.Error?t&&t.code===Gt.RESOURCE_EXHAUSTED&&(o(''+t),o('Using maximum backoff delay to prevent overloading the backend.'),this.backoff.resetToMax()):this.backoff.reset(),null!==this.stream&&(this.tearDown(),this.stream.close(),this.stream=null),this.state=r;var e=this.listener;return this.listener=null,r==Wr.Stopped?Promise.resolve():e.onClose(t)},e.prototype.tearDown=function(){},e.prototype.auth=function(){var o=this;Ho(this.state===Wr.Initial,'Must be in initial state to auth'),this.state=Wr.Auth,this.credentialsProvider.getToken(!1).then(function(t){o.startStream(t)},function(t){o.queue.schedule(function(){if(o.state!==Wr.Stopped){var e=new Ht(Gt.UNKNOWN,'Fetching auth token failed: '+t.message);return o.handleStreamClose(e)}return Promise.resolve()})})},e.prototype.startStream=function(o){var a=this;if(this.state!==Wr.Stopped){Ho(this.state===Wr.Auth,'Trying to start stream in a non-auth state');var e=function(e,t){a.queue.schedule(function(){return a.stream===e?t():Promise.resolve()})};if(null!==this.listener){var n=this.startRpc(o);this.stream=n,this.stream.onOpen(function(){e(n,function(){return Ho(a.state===Wr.Auth,'Expected stream to be in state auth, but was '+a.state),a.state=Wr.Open,a.listener.onOpen()})}),this.stream.onClose(function(o){e(n,function(){return a.handleStreamClose(o)})}),this.stream.onMessage(function(o){e(n,function(){return a.onMessage(o)})})}}},e.prototype.performBackoff=function(n){var t=this;Ho(this.state===Wr.Error,'Should only perform backoff in an error case'),this.state=Wr.Backoff,this.backoff.backoffAndWait().then(function(){t.queue.schedule(function(){return t.state===Wr.Stopped?Promise.resolve():(t.state=Wr.Initial,t.start(n),Ho(t.isStarted(),'PersistentStream should have started'),Promise.resolve())})})},e.prototype.handleStreamClose=function(e){return Ho(this.isStarted(),'Can\'t handle server close on non-started stream'),So('PersistentStream','close with error: '+e),this.stream=null,this.close(Wr.Error,e)},e}(),qr=function(d){function t(t,l,n,r,o,i){var a=d.call(this,l,n,r,i)||this;return a.databaseInfo=t,a.serializer=o,a}return Hr(t,d),t.prototype.startRpc=function(e){return this.connection.openStream('Listen',e)},t.prototype.onMessage=function(o){this.backoff.reset();var t=this.serializer.fromWatchChange(o),e=this.serializer.versionFromListenResponse(o);return this.listener.onWatchChange(t,e)},t.prototype.watch=function(o){var t={database:this.serializer.encodedDatabaseId,addTarget:this.serializer.toTarget(o)},e=this.serializer.toListenRequestLabels(o);e&&(t.labels=e),this.sendRequest(t)},t.prototype.unwatch=function(n){var t={};t.database=this.serializer.encodedDatabaseId,t.removeTarget=n,this.sendRequest(t)},t}(Zn),jr=function(d){function t(t,l,n,r,o,i){var a=d.call(this,l,n,r,i)||this;return a.databaseInfo=t,a.serializer=o,a.y=!1,a}return Hr(t,d),Object.defineProperty(t.prototype,'handshakeComplete',{get:function(){return this.y},enumerable:!0,configurable:!0}),t.prototype.start=function(t){this.y=!1,d.prototype.start.call(this,t)},t.prototype.tearDown=function(){this.y&&this.writeMutations([])},t.prototype.startRpc=function(e){return this.connection.openStream('Write',e)},t.prototype.onMessage=function(o){if(Ho(!!o.streamToken,'Got a write response without a stream token'),this.lastStreamToken=o.streamToken,this.y){this.backoff.reset();var t=this.serializer.fromWriteResults(o.writeResults),e=this.serializer.fromVersion(o.commitTime);return this.listener.onMutationResult(e,t)}return Ho(!o.writeResults||0===o.writeResults.length,'Got mutation results for handshake'),this.y=!0,this.listener.onHandshakeComplete()},t.prototype.writeHandshake=function(){Ho(this.isOpen(),'Writing handshake requires an opened stream'),Ho(!this.y,'Handshake already completed');var e={};e.database=this.serializer.encodedDatabaseId,this.sendRequest(e)},t.prototype.writeMutations=function(o){var r=this;Ho(this.isOpen(),'Writing mutations requires an opened stream'),Ho(this.y,'Handshake must be complete before writing mutations'),Ho(0this.pendingWrites.length},e.prototype.outstandingWrites=function(){return this.pendingWrites.length},e.prototype.commit=function(e){Ho(this.canWriteMutations(),'commit called when batches can\'t be written'),this.lastBatchSeen=e.batchId,this.pendingWrites.push(e),this.shouldStartWriteStream()?this.startWriteStream():this.isNetworkEnabled()&&this.writeStream.handshakeComplete&&this.writeStream.writeMutations(e.mutations)},e.prototype.shouldStartWriteStream=function(){return this.isNetworkEnabled()&&!this.writeStream.isStarted()&&0t.indexOf('Firestore Test Simulated Error')&&setTimeout(function(){throw e},0),e}).then(function(){r.operationInProgress=!1})}),this.tail},e.prototype.verifyOperationInProgress=function(){Ho(this.operationInProgress,'verifyOpInProgress() called when no op in progress on this queue.')},e.prototype.drain=function(o){var t=this;return this.delayedOperations.forEach(function(e){e.handle&&(clearTimeout(e.handle),o?t.scheduleInternal(e.op).then(e.deferred.resolve,e.deferred.reject):e.deferred.reject(new Ht(Gt.CANCELLED,'Operation cancelled by shutdown')))}),this.delayedOperations=[],this.delayedOperationsCount=0,this.schedule(function(){return Promise.resolve()})},e}(),oo=function(){function e(e){this.uid=e}return e.prototype.isUnauthenticated=function(){return null==this.uid},e.prototype.toKey=function(){return this.isUnauthenticated()?'anonymous-user':'uid:'+this.uid},e.prototype.equals=function(e){return e.uid===this.uid},e.UNAUTHENTICATED=new e(null),e.GOOGLE_CREDENTIALS=new e('google-credentials-uid'),e.FIRST_PARTY=new e('first-party-uid'),e}(),io=function(){function e(n,o){this.user=o,this.type='OAuth',this.authHeaders={Authorization:'Bearer '+n}}return e}(),ao=function(){function e(){this.userListener=null}return e.prototype.getToken=function(){return Promise.resolve(null)},e.prototype.setUserChangeListener=function(e){Ho(!this.userListener,'Can only call setUserChangeListener() once.'),this.userListener=e,e(oo.UNAUTHENTICATED)},e.prototype.removeUserChangeListener=function(){Ho(null!==this.userListener,'removeUserChangeListener() when no listener registered'),this.userListener=null},e}(),so=function(){function e(n){var o=this;this.app=n,this.tokenListener=null,this.userCounter=0,this.userListener=null,this.tokenListener=function(){var e=o.getUser();o.currentUser&&e.equals(o.currentUser)||(o.currentUser=e,o.userCounter++,o.userListener&&o.userListener(o.currentUser))},this.userCounter=0,this.app.INTERNAL.addAuthTokenListener(this.tokenListener)}return e.prototype.getToken=function(o){var r=this;Ho(null!=this.tokenListener,'getToken cannot be called after listener removed.');var e=this.userCounter;return this.app.INTERNAL.getToken(o).then(function(n){if(r.userCounter!==e)throw new Ht(Gt.ABORTED,'getToken aborted due to uid change.');return n?(Ho('string'==typeof n.accessToken,'Invalid tokenData returned from getToken():'+n),new io(n.accessToken,r.currentUser)):null})},e.prototype.setUserChangeListener=function(e){Ho(!this.userListener,'Can only call setUserChangeListener() once.'),this.userListener=e,this.currentUser&&e(this.currentUser)},e.prototype.removeUserChangeListener=function(){Ho(null!=this.tokenListener,'removeUserChangeListener() called twice'),Ho(null!==this.userListener,'removeUserChangeListener() called when no listener registered'),this.app.INTERNAL.removeAuthTokenListener(this.tokenListener),this.tokenListener=null,this.userListener=null},e.prototype.getUser=function(){'function'!=typeof this.app.INTERNAL.getUid&&Wo('This version of the Firestore SDK requires at least version 3.7.0 of firebase.js.');var e=this.app.INTERNAL.getUid();return Ho(null===e||'string'==typeof e,'Received invalid UID: '+e),new oo(e)},e}(),uo=function(){function e(n,o){this.gapi=n,this.sessionIndex=o,this.type='FirstParty',this.user=oo.FIRST_PARTY,Ho(this.gapi&&this.gapi.auth&&this.gapi.auth.getAuthHeaderValueForFirstParty,'unexpected gapi interface')}return Object.defineProperty(e.prototype,'authHeaders',{get:function(){return{Authorization:this.gapi.auth.getAuthHeaderValueForFirstParty([]),"X-Goog-AuthUser":this.sessionIndex}},enumerable:!0,configurable:!0}),e}(),co=function(){function e(n,o){this.gapi=n,this.sessionIndex=o,Ho(this.gapi&&this.gapi.auth&&this.gapi.auth.getAuthHeaderValueForFirstParty,'unexpected gapi interface')}return e.prototype.getToken=function(){return Promise.resolve(new uo(this.gapi,this.sessionIndex))},e.prototype.setUserChangeListener=function(e){e(oo.FIRST_PARTY)},e.prototype.removeUserChangeListener=function(){},e}(),ho=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),lo=function(){function e(){}return e.delete=function(){return fo.instance},e.serverTimestamp=function(){return po.instance},e}(),fo=function(n){function t(){return n.call(this)||this}return ho(t,n),t.instance=new t,t}(lo),po=function(n){function t(){return n.call(this)||this}return ho(t,n),t.instance=new t,t}(lo),yo=s(lo,'Use FieldValue.() instead.'),Xr=/^__.*__$/,go=function(){function e(o,r,e){this.data=o,this.fieldMask=r,this.fieldTransforms=e}return e.prototype.toMutations=function(o,t){var e=[];return null===this.fieldMask?e.push(new rn(o,this.data,t)):e.push(new on(o,this.data,this.fieldMask,t)),0=n.docs.size,'Too many documents returned on a document query');var t=n.docs.get(e.q);s.next(new Oo(e.firestore,e.q,t,n.fromCache))}},error:t}),o=this._.listen(Pe.atPath(this.q.path),n,a);return function(){n.mute(),e._.unlisten(o)}},o.prototype.get=function(){var o=this;return m('DocumentReference.get',arguments,0),new Promise(function(a,e){var i=o.onSnapshotInternal({includeQueryMetadataChanges:!0,includeDocumentMetadataChanges:!0,waitForSyncWhenOnline:!0},{next:function(n){i(),!n.exists&&n.metadata.fromCache?e(new Ht(Gt.ABORTED,'Failed to get document because the client is offline.')):a(n)},error:e})})},o}(),Oo=function(){function e(o,a,e,n){this.Q=o,this.q=a,this.nt=e,this.rt=n}return e.prototype.data=function(){if(m('DocumentSnapshot.data',arguments,0),!this.nt)throw new Ht(Gt.NOT_FOUND,'This document doesn\'t exist. Check doc.exists to make sure the document exists before calling doc.data().');return this.convertObject(this.nt.data)},e.prototype.get=function(n){if(m('DocumentSnapshot.get',arguments,1),!this.nt)throw new Ht(Gt.NOT_FOUND,'This document doesn\'t exist. Check doc.exists to make sure the document exists before calling doc.get().');var t=this.nt.data.field(At('DocumentSnapshot.get',n));return void 0===t?void 0:this.convertValue(t)},Object.defineProperty(e.prototype,'id',{get:function(){return this.q.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'ref',{get:function(){return new Ro(this.q,this.Q)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'exists',{get:function(){return null!==this.nt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'metadata',{get:function(){return{hasPendingWrites:null!==this.nt&&this.nt.hasLocalMutations,fromCache:this.rt}},enumerable:!0,configurable:!0}),e.prototype.convertObject=function(o){var a=this,e={};return o.forEach(function(n,t){e[n]=a.convertValue(t)}),e},e.prototype.convertValue=function(r){if(r instanceof Ne)return this.convertObject(r);if(r instanceof Ae)return this.convertArray(r);if(r instanceof De){var t=r.value(),e=this.Q.ensureClientConfigured().databaseId();return r.databaseId.equals(e)||o('Document '+this.q.path+' contains a document reference within a different database ('+r.databaseId.projectId+'/'+r.databaseId.database+') which is not supported. It will be treated as a reference in the current database ('+e.projectId+'/'+e.database+') instead.'),new Ro(t,this.Q)}return r.value()},e.prototype.convertArray=function(n){var o=this;return n.internalValue.map(function(e){return o.convertValue(e)})},e}(),Mo=function(){function s(n,o){this.ot=n,this.firestore=o}return s.prototype.where=function(t,e,n){m('Query.where',arguments,3),b('Query.where','string',2,e),I('Query.where',3,n);var d=At('Query.where',t),i;if(!d.isKeyField())i=this.firestore._dataConverter.parseQueryValue('Query.where',n);else if('string'==typeof n){if(-1!==n.indexOf('/'))throw new Ht(Gt.INVALID_ARGUMENT,'Function Query.where() requires its third parameter to be a valid document ID if the first parameter is FieldPath.documentId(), but it contains a slash.');if(''===n)throw new Ht(Gt.INVALID_ARGUMENT,'Function Query.where() requires its third parameter to be a valid document ID if the first parameter is FieldPath.documentId(), but it was an empty string.');var o=this.ot.path.child(new re([n]));Ho(0==o.length%2,'Path should be a document key'),i=new De(this.firestore._databaseId,new ae(o))}else{if(!(n instanceof Ro))throw new Ht(Gt.INVALID_ARGUMENT,'Function Query.where() requires its third parameter to be a string or a DocumentReference if the first parameter is FieldPath.documentId(), but it was: '+k(n)+'.');i=new De(this.firestore._databaseId,n.q)}var a=W(d,Le.fromString(e),i);return this.validateNewFilter(a),new s(this.ot.addFilter(a),this.firestore)},s.prototype.orderBy=function(t,e){f('Query.orderBy',arguments,1,2),v('Query.orderBy','string',2,e);var n;if(void 0===e||'asc'===e)n=Fe.ASCENDING;else{if('desc'!==e)throw new Ht(Gt.INVALID_ARGUMENT,'Function Query.orderBy() has unknown direction \''+e+'\', expected \'asc\' or \'desc\'.');n=Fe.DESCENDING}if(null!==this.ot.startAt)throw new Ht(Gt.INVALID_ARGUMENT,'Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().');if(null!==this.ot.endAt)throw new Ht(Gt.INVALID_ARGUMENT,'Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().');var r=At('Query.orderBy',t),o=new qe(r,n);return this.validateNewOrderBy(o),new s(this.ot.addOrderBy(o),this.firestore)},s.prototype.limit=function(t){if(m('Query.limit',arguments,1),b('Query.limit','number',1,t),0>=t)throw new Ht(Gt.INVALID_ARGUMENT,'Invalid Query. Query limit ('+t+') is invalid. Limit must be positive.');return new s(this.ot.withLimit(t),this.firestore)},s.prototype.startAt=function(t){for(var e=[],n=1;nn.length)throw new Ht(Gt.INVALID_ARGUMENT,'Too many arguments provided to '+d+'(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses');for(var r=[],o=0,i;o, or >=) must be on the same field. But you have inequality filters on \''+t+'\' and \''+o.field+'\'');var e=this.ot.getFirstOrderByField();null!==e&&this.validateOrderByAndInequalityMatch(o.field,e)}},s.prototype.validateNewOrderBy=function(n){if(null===this.ot.getFirstOrderByField()){var t=this.ot.getInequalityFilterField();null!==t&&this.validateOrderByAndInequalityMatch(t,n.field)}},s.prototype.validateOrderByAndInequalityMatch=function(n,t){if(!t.equals(n))throw new Ht(Gt.INVALID_ARGUMENT,'Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field \''+n+'\' and so you must also use \''+n+'\' as your first Query.orderBy(), but your first Query.orderBy() is on field \''+t+'\' instead.')},s}(),_o=function(){function e(o,r,e){this.Q=o,this.it=r,this.at=e,this._cachedChanges=null,this.metadata={fromCache:e.fromCache,hasPendingWrites:e.hasPendingWrites}}return Object.defineProperty(e.prototype,'docs',{get:function(){var n=[];return this.forEach(function(t){return n.push(t)}),n},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'empty',{get:function(){return this.at.docs.isEmpty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'size',{get:function(){return this.at.docs.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(o,t){var e=this;f('QuerySnapshot.forEach',arguments,1,2),b('QuerySnapshot.forEach','function',1,o),this.at.docs.forEach(function(n){o.call(t,e.convertToDocumentImpl(n))})},Object.defineProperty(e.prototype,'query',{get:function(){return new Mo(this.it,this.Q)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'docChanges',{get:function(){return this._cachedChanges||(this._cachedChanges=xt(this.Q,this.at)),this._cachedChanges},enumerable:!0,configurable:!0}),e.prototype.convertToDocumentImpl=function(e){return new Oo(this.Q,e.key,e,this.metadata.fromCache)},e}(),Po=function(o){function t(t,a){var n=o.call(this,Pe.atPath(t),a)||this;if(1!=t.length%2)throw new Ht(Gt.INVALID_ARGUMENT,'Invalid collection reference. Collection references must have an odd number of segments, but '+t.canonicalString()+' has '+t.length);return n}return To(t,o),Object.defineProperty(t.prototype,'id',{get:function(){return this.ot.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,'parent',{get:function(){var e=this.ot.path.popLast();return e.isEmpty()?null:new Ro(new ae(e),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,'path',{get:function(){return this.ot.path.canonicalString()},enumerable:!0,configurable:!0}),t.prototype.doc=function(n){if(f('CollectionReference.doc',arguments,0,1),0===arguments.length&&(n=zt.newId()),b('CollectionReference.doc','string',1,n),''===n)throw new Ht(Gt.INVALID_ARGUMENT,'Document path must be a non-empty string');var t=re.fromString(n);return Ro.forPath(this.ot.path.child(t),this.firestore)},t.prototype.add=function(n){m('CollectionReference.add',arguments,1),b('CollectionReference.add','object',1,n);var t=this.doc();return t.set(n).then(function(){return t})},t}(Mo),Lo=s(ko,'Use firebase.firestore() instead.'),Qr=s(No,'Use firebase.firestore().runTransaction() instead.'),Yr=s(Ao,'Use firebase.firestore().batch() instead.'),Jr=s(Ro,'Use firebase.firestore().doc() instead.'),$r=s(Oo),Zr=s(Mo),ea=s(_o),ta=s(Po,'Use firebase.firestore().collection() instead.'),na={Firestore:Lo,GeoPoint:Go,Blob:Yt,Transaction:Qr,WriteBatch:Yr,DocumentReference:Jr,DocumentSnapshot:$r,Query:Zr,QuerySnapshot:ea,CollectionReference:ta,FieldPath:Pn,FieldValue:yo,setLogLevel:ko.setLogLevel};t.registerFirestore=Mt,Mt(zo.default)},115:function(e,t,n){var d=Math.max,a=Math.floor;(function(t){(function(){function s(e){return'string'==typeof e}function o(){}function i(o){var r=typeof o;if('object'==r){if(!o)return'null';if(o instanceof Array)return'array';if(o instanceof Object)return r;var e=Object.prototype.toString.call(o);if('[object Window]'==e)return'object';if('[object Array]'==e||'number'==typeof o.length&&void 0!==o.splice&&void 0!==o.propertyIsEnumerable&&!o.propertyIsEnumerable('splice'))return'array';if('[object Function]'==e||void 0!==o.call&&void 0!==o.propertyIsEnumerable&&!o.propertyIsEnumerable('call'))return'function'}else if('function'==r&&void 0===o.call)return'object';return r}function l(e){return'array'==i(e)}function c(n){var t=i(n);return'array'==t||'object'==t&&'number'==typeof n.length}function h(e){return'function'==i(e)}function m(n){var o=typeof n;return'object'==o&&null!=n||'function'==o}function n(e){return e.call.apply(e.bind,arguments)}function p(o,a){if(!o)throw Error();if(2t?1:0}function j(n,t){t.unshift(n),u.call(this,v.apply(null,t)),t.shift()}function G(e){throw new j('Failure'+(e?': '+e:''),Array.prototype.slice.call(arguments,1))}function $(){0!=Ao&&(Lo[this[k]||(this[k]=++q)]=this),this.i=this.i,this.w=this.w}function w(a){t:{for(var t=qe,e=a.length,n=s(a)?a.split(''):a,r=0;rt?null:s(a)?a.charAt(t):a[t]}function Z(n){if(!l(n))for(var t=n.length-1;0<=t;t--)delete n[t];n.length=0}function _e(){return Array.prototype.concat.apply([],arguments)}function et(o){var t=o.length;if(0n.keyCode||void 0!=n.returnValue)){t:{var r=!1;if(0==n.keyCode)try{n.keyCode=-1;break t}catch(e){r=!0}(r||void 0==n.returnValue)&&(n.returnValue=!0)}for(n=[],r=t.a;r;r=r.parentNode)n.push(r);for(a=a.type,r=n.length-1;0<=r;r--){t.a=n[r];var o=Tt(n[r],a,!0,t);s=s&&o}for(r=0;rt.b&&(t.b++,n.next=t.a,t.a=n)}dr=!1}function zt(t,e){Lt.call(this),this.b=t||1,this.a=e||Io,this.f=f(this.ib,this),this.g=No()}function Kt(e){e.$=!1,e.K&&(e.a.clearTimeout(e.K),e.K=null)}function Gt(o,r,a){if(h(o))a&&(o=f(o,a));else{if(!o||'function'!=typeof o.handleEvent)throw Error('Invalid listener argument');o=f(o.handleEvent,o)}return 2147483647<+r?-1:Io.setTimeout(o,r||0)}function Xt(o,t,e){$.call(this),this.f=null==e?o:f(o,e),this.c=t,this.b=f(this.bb,this),this.a=[]}function Qt(e){e.X=Gt(e.b,e.c),e.f.apply(null,e.a)}function Yt(e){$.call(this),this.b=e,this.a={}}function C(e){y(e.a,function(n,t){this.a.hasOwnProperty(t)&&Et(n)},e),e.a={}}function Jt(o,t,e){this.reset(o,t,e,void 0,void 0)}function $t(e){this.f=e,this.b=this.c=this.a=null}function Zt(n,t){this.name=n,this.value=t}function D(e){return e.c?e.c:e.a?D(e.a):(G('Root logger has no level set.'),null)}function en(o){xr||(xr=new $t(''),vr['']=xr,xr.c=yr);var t;if(!(t=vr[o])){t=new $t(o);var e=o.lastIndexOf('.'),n=o.substr(e+1);e=en(o.substr(0,e)),e.b||(e.b={}),e.b[n]=t,t.a=e,vr[o]=t}return t}function tn(n,t){n&&n.log(gr,t,void 0)}function E(n,t){n&&n.log(fr,t,void 0)}function nn(n,t){n&&n.log(br,t,void 0)}function F(){this.a=en('goog.labs.net.webChannel.WebChannelDebug'),this.b=!0}function on(d,t,e,n,r,o){ln(d,function(){if(!d.b)i=o;else if(o){for(var i='',a=o.split('&'),s=0,p;so.length)){var i=o[1];if(l(i)&&!(1>i.length)){var a=i[0];if('noop'!=a&&'stop'!=a&&'close'!=a)for(var s=1;se;e++){n=t[e];try{return new ActiveXObject(n),o.b=n}catch(e){}}throw Error('Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed')}return o.b}function Sn(o,t,e,n){this.i=o,this.b=t,this.f=e,this.T=n||1,this.N=new Yt(this),this.S=Tr,o=this.H=new zt,o.b=wr,o.K&&o.$?(Kt(o),o.start()):o.K&&Kt(o),this.j=null,this.c=!1,this.m=this.g=this.h=this.J=this.D=this.U=this.w=null,this.s=[],this.a=null,this.F=0,this.l=this.o=null,this.C=-1,this.B=!1,this.P=0,this.I=null,this.M=!1}function K(n,t){return 0===n?'Non-200 return code ('+t+')':1===n?'XMLHTTP failure (no data)':2===n?'HttpConnection timeout':'Unknown error'}function En(o,t,e){o.J=1,o.h=Gn(P(t)),o.m=e,o.M=!0,Tn(o,null)}function kn(o,t,e,n){o.J=1,o.h=Gn(P(t)),o.m=null,o.M=e,Tn(o,n)}function Tn(t,e){t.D=No(),Ln(t),t.g=P(t.h),Q(t.g,'t',t.T),t.F=0,t.a=t.i.da(t.i.ia()?e:null),0t)&&(3!=t||Mo||a.a.V())){a.B||4!=t||7==e||un(8==e||0>=n?3:2),On(a);var r=a.a.W();a.C=r,(e=a.a.V())||dn(a.b,function(){return'No response text for uri '+a.g+' status '+r}),a.c=200==r,rn(a.b,a.o,a.g,a.f,a.T,t,r),a.c?(a.M?(In(a,t,e),Mo&&a.c&&3==t&&Nn(a)):(an(a.b,a.f,e,null),_n(a,e)),4==t&&Dn(a),a.c&&!a.B&&(4==t?a.i.ua(a):(a.c=!1,Ln(a)))):(400==r&&0t.length?Nr:(t=t.substr(n,e),o.F=n+e,t))}function Ln(t){t.U=No()+t.S,Rn(t,t.S)}function Rn(n,t){if(null!=n.w)throw Error('WatchDog timer not null');n.w=fn(f(n.cb,n),t)}function On(e){e.w&&(Io.clearTimeout(e.w),e.w=null)}function Pn(e){e.i.Ja()||e.B||e.i.ua(e)}function Dn(n){On(n);var t=n.I;t&&'function'==typeof t.Z&&t.Z(),n.I=null,Kt(n.H),C(n.N),n.a&&(t=n.a,n.a=null,t.abort(),t.Z())}function _n(n,t){try{n.i.Ma(n,t),un(4)}catch(t){I(n.b,t,'Error in httprequest callback')}}function Mn(o){if(o.v&&'function'==typeof o.v)return o.v();if(s(o))return o.split('');if(c(o)){for(var t=[],e=o.length,n=0;n2*n.c&&Vn(n),!0)}function Vn(a){if(a.c!=a.a.length){for(var t=0,e=0,n;tt)throw Error('Bad port number '+t);n.i=t}else n.i=null}function zn(o,t,e){t instanceof Zn?(o.c=t,ao(o.c,o.h)):(e||(t=Jn(t,Pr)),o.c=new Zn(t,o.h))}function Kn(o,t,e){o.c.set(t,e)}function Q(n,t,e){l(e)||(e=[e+'']),no(n.c,t,e)}function Gn(t){return Kn(t,'zx',a(2147483648*Math.random()).toString(36)+Math.abs(a(2147483648*Math.random())^No()).toString(36)),t}function Xn(e){return e instanceof Hn?P(e):new Hn(e,void 0)}function Qn(a,t,e,n){var r=new Hn(null,void 0);return a&&L(r,a),t&&qn(r,t),e&&jn(r,e),n&&(r.a=n),r}function Yn(n,t){return n?t?decodeURI(n.replace(/%25/g,'%2525')):decodeURIComponent(n):''}function Jn(o,t,e){return s(o)?(o=encodeURI(o).replace(t,$n),e&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,'%$1')),o):null}function $n(e){return e=e.charCodeAt(0),'%'+(15&e>>4).toString(16)+(15&e).toString(16)}function Zn(n,t){this.b=this.a=null,this.c=n||null,this.f=!!t}function eo(o){o.a||(o.a=new Bn,o.b=0,o.c&&O(o.c,function(t,e){o.add(decodeURIComponent(t.replace(/\+/g,' ')),e)}))}function R(n,t){eo(n),t=ro(n,t),Wn(n.a.b,t)&&(n.c=null,n.b-=n.a.get(t).length,Un(n.a,t))}function to(n,t){return eo(n),t=ro(n,t),Wn(n.a.b,t)}function no(o,t,e){R(o,t),0=e.f}function be(n,t){return n.b?n.b==t:!!n.a&&n.a.contains(t)}function ce(n,t){n.a?n.a.add(t):n.b=t}function ae(n,t){n.b&&n.b==t?n.b=null:n.a&&n.a.contains(t)&&Un(n.a.a,S(t))}function de(n){if(null!=n.b)return n.c.concat(n.b.s);if(null!=n.a&&0!=n.a.a.c){var o=n.c;return Oo(n.a.v(),function(e){o=o.concat(e.s)}),o}return et(n.c)}function ee(n,t){n.c=n.c.concat(t)}function fe(){}function ge(){this.a=new fe}function he(o,a,e){var i=e||'';try{Fn(o,function(e,t){var n=e;m(e)&&(n=Pt(e)),a.push(i+t+'='+encodeURIComponent(n))})}catch(e){throw a.push(i+'type='+encodeURIComponent('_badmap')),e}}function ie(o,t){var e=new F;dn(e,'TestLoadImage: loading '+o);var n=new Image;n.onload=b(je,e,n,'TestLoadImage: loaded',!0,t),n.onerror=b(je,e,n,'TestLoadImage: error',!1,t),n.onabort=b(je,e,n,'TestLoadImage: abort',!1,t),n.ontimeout=b(je,e,n,'TestLoadImage: timeout',!1,t),Io.setTimeout(function(){n.ontimeout&&n.ontimeout()},1e4),n.src=o}function je(a,t,e,n,r){try{dn(a,e),t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,r(n)}catch(t){I(a,t)}}function ke(e){Lt.call(this),this.headers=new Bn,this.F=e||null,this.f=!1,this.D=this.a=null,this.M=this.s='',this.j=0,this.g='',this.h=this.I=this.o=this.H=!1,this.l=0,this.B=null,this.N=Br,this.C=this.m=!1}function T(e){return Fo&<(9)&&'number'==typeof e.timeout&&void 0!==e.ontimeout}function qe(e){return'content-type'==e.toLowerCase()}function Co(n,t){n.f=!1,n.a&&(n.h=!0,n.a.abort(),n.h=!1),n.g=t,n.j=5,oe(n),te(n)}function oe(e){e.H||(e.H=!0,e.dispatchEvent('complete'),e.dispatchEvent('error'))}function re(s){if(s.f&&void 0!==wo)if(s.D[1]&&4==pe(s)&&2==s.W())nn(s.b,M(s,'Local request error detected and ignored'));else if(s.o&&4==pe(s))Gt(s.La,0,s);else if(s.dispatchEvent('readystatechange'),4==pe(s)){nn(s.b,M(s,'Request complete')),s.f=!1;try{var t=s.W();t:switch(t){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break t;default:e=!1;}var n;if(!(n=e)){var r;if(r=0===t){var o=(s.s+'').match(Ar)[1]||null;if(!o&&Io.self&&Io.self.location){var d=Io.self.location.protocol;o=d.substr(0,d.length-1)}r=!le.test(o?o.toLowerCase():'')}n=r}n?(s.dispatchEvent('complete'),s.dispatchEvent('success')):(s.j=6,s.g=s.Ga()+' ['+s.W()+']',oe(s))}finally{te(s)}}}function te(a,t){if(a.a){se(a);var e=a.a,n=a.D[0]?o:null;a.a=null,a.D=null,t||a.dispatchEvent('ready');try{e.onreadystatechange=n}catch(t){(a=a.b)&&a.log(mr,'Problem encountered resetting onreadystatechange: '+t.message,void 0)}}}function se(e){e.a&&e.C&&(e.a.ontimeout=null),e.B&&(Io.clearTimeout(e.B),e.B=null)}function pe(e){return e.a?e.a.readyState:0}function M(n,t){return t+' ['+n.M+' '+n.s+' '+n.W()+']'}function U(n){var o='';return y(n,function(e,t){o+=t,o+=':',o+=e,o+='\r\n'}),o}function ue(a,t,e){t:{for(n in e){var n=!1;break t}n=!0}if(n)return a;if(e=U(e),s(a)){if(t=encodeURIComponent(t+''),e=null==e?'':'='+encodeURIComponent(e+''),t+=e){if(e=a.indexOf('#'),0>e&&(e=a.length),0>(n=a.indexOf('?'))||n>e){n=e;var r=''}else r=a.substring(n+1,e);a=[a.substr(0,n),r,a.substr(e)],e=a[1],a[1]=t?e?e+'&'+t:t:e,a=a[0]+(a[1]?'?'+a[1]:'')+a[2]}return a}return Kn(a,t,e),a}function ve(e){this.ya=0,this.g=[],this.a=new F,this.H=new go,this.ja=this.wa=this.F=this.ka=this.b=this.J=this.j=this.U=this.h=this.M=this.i=null,this.Ua=this.P=0,this.la=this.B=this.o=this.m=this.l=this.f=null,this.s=this.xa=this.N=-1,this.T=this.w=this.C=0,this.S=e&&e.supportsCrossDomainXhr||!1,this.I='',this.c=new bo(e&&e.concurrentRequestLimit),this.ma=new ge,this.D=!e||void 0===e.backgroundChannelTest||e.backgroundChannelTest,this.Ta=e&&e.fastHandshake||!1,e&&e.Ea&&this.a.Ea()}function we(t){if(dn(t.a,'disconnect()'),xe(t),3==t.G){var e=t.P++,n=P(t.F);Kn(n,'SID',t.I),Kn(n,'RID',e),Kn(n,'TYPE','terminate'),He(t,n),e=new Sn(t,t.a,e,void 0),e.J=2,e.h=Gn(P(n)),n=!1,Io.navigator&&Io.navigator.sendBeacon&&(n=Io.navigator.sendBeacon(''+e.h,'')),!n&&Io.Image&&(new Image().src=e.h,n=!0),n||(e.a=e.i.da(null),e.a.fa(e.h)),e.D=No(),Ln(e)}V(t)}function xe(e){e.B&&(e.B.abort(),e.B=null),e.b&&(e.b.cancel(),e.b=null),e.m&&(Io.clearTimeout(e.m),e.m=null),Eo(e),e.c.cancel(),e.l&&(Io.clearTimeout(e.l),e.l=null)}function ye(n,t){1e3==n.g.length&&H(n.a,function(){return'Already have 1000 queued maps upon queueing '+Pt(t)}),n.g.push(new yo(n.Ua++,t)),3==n.G&&Ce(n)}function Ce(e){xo(e.c)||e.l||(e.l=fn(f(e.Oa,e),0),e.C=0)}function De(o,t){var e=o.c;return(e.b?1:e.a?e.a.u():0)>=o.c.f-(o.l?1:0)?(H(o.a,'Unexpected retry request is scheduled.'),!1):o.l?(dn(o.a,'Use the retry request that is already scheduled.'),o.g=t.s.concat(o.g),!0):!(1==o.G||2==o.G||2<=o.C||(dn(o.a,'Going to retry POST'),o.l=fn(f(o.Oa,o,t),Be(o,o.C)),o.C++,0))}function Ee(o,t){var e=t?t.f:o.P++;var n=P(o.F);Kn(n,'SID',o.I),Kn(n,'RID',e),Kn(n,'AID',o.N),He(o,n),o.h&&o.i&&ue(n,o.h,o.i),e=new Sn(o,o.a,e,o.C+1),null===o.h&&(e.j=o.i),t&&(o.g=t.s.concat(o.g)),t=ze(o,e),e.setTimeout(10000+Math.round(1e4*Math.random())),ce(o.c,e),En(e,n,t)}function He(n,o){n.f&&Fn({},function(e,t){Kn(o,t,e)})}function ze(r,t){var e=Math.min(r.g.length,1e3),n=r.f?f(r.f.Va,r.f,r):null;t:for(var o=r.g,i=-1,a;;){a=['count='+e],-1==i?0(c-=i))i=d(0,o[p].a-100),s=!1;else try{he(u,a,'req'+c+'_')}catch(e){n&&n(u)}}if(s){n=a.join('&');break t}}return r=r.g.splice(0,e),t.s=r,n}function Ge(n){if(!n.b&&!n.m){n.T=1;var t=n.Na;cr||qt(),dr||(cr(),dr=!0),lr.add(t,n),n.w=0}}function Ie(e){return e.b||e.m?(H(e.a,'Request already in progress'),!1):!(3<=e.w||(dn(e.a,'Going to retry GET'),e.T++,e.m=fn(f(e.Na,e),Be(e,e.w)),e.w++,0))}function Je(o,t,e){dn(o.a,'Test Connection Finished');var n=t.m;n&&vo(o.c,n),o.la=e,o.s=t.f,dn(o.a,'connectChannel_()'),o.F=Ae(o,o.ka),Ce(o)}function So(n,t){dn(n.a,'Test Connection Failed'),n.s=t.f,Fe(n,2)}function Eo(e){null!=e.o&&(Io.clearTimeout(e.o),e.o=null)}function Be(o,t){var e=5e3+a(1e4*Math.random());return o.ra()||(dn(o.a,'Inactive channel'),e*=2),e*t}function Fe(r,t){if(ln(r.a,'Error code '+t),2==t){var e=null;r.f&&(e=null);var n=f(r.hb,r);e||(e=new Hn('//www.google.com/images/cleardot.gif'),Io.location&&'http'==Io.location.protocol||L(e,'https'),Gn(e)),ie(''+e,n)}else mn(2);dn(r.a,'HttpChannel: error - '+t),r.G=0,r.f&&r.f.Ba(t),V(r),xe(r)}function V(n){if(n.G=0,n.s=-1,n.f){var t=de(n.c);0==t.length&&0==n.g.length||(dn(n.a,function(){return'Number of undelivered maps, pending: '+t.length+', outgoing: '+n.g.length}),n.c.c.length=0,et(n.g),n.g.length=0),n.f.Aa()}}function Ae(n,t){return t=ko(n,null,t),dn(n.a,'GetForwardChannelUri: '+t),t}function Ke(o,t,e){return t=ko(o,o.ia()?t:null,e),dn(o.a,'GetBackChannelUri: '+t),t}function ko(a,t,e){var n=Xn(e);if(''!=n.b)t&&qn(n,t+'.'+n.b),jn(n,n.i);else{var r=Io.location,i;i=t?t+'.'+r.hostname:r.hostname,n=Qn(r.protocol,i,r.port,e)}return a.U&&y(a.U,function(o,t){Kn(n,t,o)}),t=a.j,e=a.J,t&&e&&Kn(n,t,e),Kn(n,'VER',a.oa),He(a,n),n}function Le(){}function Me(){for(var t=arguments[0],e=1,n;ethis.c)throw Error(Ur);this.a=new Pe,this.b=new fo,this.g=null,this.ba()}function Ve(n){if('function'==typeof n.Z)n.Z();else for(var t in n)n[t]=null}function Xe(n,t){this.a=n,this.b=t}function Ye(o){if(this.a=[],o)t:{if(o instanceof Ye){var t=o.O();if(o=o.v(),0>=this.u()){for(var e=this.a,n=0;n>1,o[n].a>e.a);)o[t]=o[n],t=n;o[t]=e}function $e(){Ye.call(this)}function To(n,t){this.f=new $e,Ue.call(this,n,t)}function X(o,t,e,n){this.l=o,this.j=!!n,To.call(this,t,e)}var wo=wo||{},Io=this,k='closure_uid_'+(1e9*Math.random()>>>0),q=0,No=Date.now||function(){return+new Date},t;r(u,Error),u.prototype.name='CustomError';var g=String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,'')};r(j,u),j.prototype.name='AssertionError';var Ao=0,Lo={};$.prototype.i=!1,$.prototype.Z=function(){},$.prototype.A=function(){if(this.w)for(;this.w.length;)this.w.shift()()};var Ro=Array.prototype.indexOf?function(n,t){return Array.prototype.indexOf.call(n,t,void 0)}:function(o,t){if(s(o))return s(t)&&1==t.length?o.indexOf(t,0):-1;for(var e=0;eparseFloat(Ho)){Wo=jo+'';break t}}Wo=Ho}var zo={},Ko=Io.document,Go;Go=Ko&&Fo?dt()||('CSS1Compat'==Ko.compatMode?parseInt(Wo,10):5):void 0;var Xo=Object.freeze||function(e){return e},Qo=!Fo||9<=+Go,Yo=Fo&&!lt('9'),Jo=function(){if(!Io.addEventListener||!Object.defineProperty)return!1;var n=!1,t=Object.defineProperty({},'passive',{get:function(){n=!0}});return Io.addEventListener('test',o,t),Io.removeEventListener('test',o,t),n}();pt.prototype.b=function(){this.Pa=!1},r(A,pt);var $o=Xo({2:'touch',3:'pen',4:'mouse'});A.prototype.b=function(){A.L.b.call(this);var e=this.c;if(e.preventDefault)e.preventDefault();else if(e.returnValue=!1,Yo)try{(e.ctrlKey||112<=e.keyCode&&123>=e.keyCode)&&(e.keyCode=-1)}catch(e){}};var Zo='closure_listenable_'+(0|1e6*Math.random()),er=0;mt.prototype.add=function(s,t,e,n,d){var o=''+s;(s=this.a[o])||(s=this.a[o]=[],this.b++);var i=yt(s,t,n,d);return-1>>0);r(Lt,$),Lt.prototype[Zo]=!0,t=Lt.prototype,t.addEventListener=function(o,t,e,n){bt(this,o,t,e,n)},t.removeEventListener=function(o,t,e,n){St(this,o,t,e,n)},t.dispatchEvent=function(d){var t=this.J,n;if(t)for(n=[];t;t=t.J)n.push(t);t=this.P;var e=d.type||d;if(s(d))d=new pt(d,t);else if(d instanceof pt)d.target=d.target||t;else{var r=d;d=new pt(e,t),at(d,r)}if(r=!0,n)for(var o=n.length-1,i;0<=o;o--)i=d.a=n[o],r=B(i,e,!0,d)&&r;if(i=d.a=t,r=B(i,e,!0,d)&&r,r=B(i,e,!1,d)&&r,n)for(o=0;o=D(this).value)for(h(t)&&(t=t()),o=new Jt(o,t+'',this.f),e&&(o.a=e),e=this;e;)e=e.a};var vr={},xr=null;F.prototype.Ea=function(){this.b=!1};var Cr=new Lt;r(cn,pt),r(hn,pt),r(J,pt);var Sr={NO_ERROR:0,jb:1,qb:2,pb:3,mb:4,ob:5,rb:6,Ra:7,TIMEOUT:8,ub:9},Er={lb:'complete',yb:'success',Sa:'error',Ra:'abort',wb:'ready',xb:'readystatechange',TIMEOUT:'timeout',sb:'incrementaldata',vb:'progress',nb:'downloadprogress',zb:'uploadprogress'};yn.prototype.a=null;var kr;r(vn,yn),kr=new vn;var Tr=45e3,wr=250,Ir={},Nr={};t=Sn.prototype,t.setTimeout=function(e){this.S=e},t.fb=function(n){n=n.target;var t=this.I;t&&3==pe(n)?(dn(this.b,'Throttling readystatechange.'),t.Xa()):this.Qa(n)},t.Qa=function(n){try{n==this.a?wn(this):tn(this.b.a,'Called back with an unexpected xmlhttp')}catch(e){if(dn(this.b,'Failed call to OnXmlHttpReadyStateChanged_'),this.a&&this.a.V()){var t=this;I(this.b,e,function(){return'ResponseText: '+t.a.V()})}else I(this.b,e,'No response text')}},t.eb=function(){var n=pe(this.a),t=this.a.V();this.Ft&&this.la&&0==this.w&&!this.o&&(this.o=fn(f(this.$a,this),6e3)))}else if(this.b==n&&Eo(this),!/^[\s\xa0]*$/.test(t))for(t=e=this.ma.a.parse(t),e=0;et-this.g)){for(var e;0this.c&&0=r)o=void 0;else{if(1==r)Z(n);else{n[0]=n.pop(),n=0,l=l.a,r=l.length;for(var i=l[n];n>1;){var a=2*n+1,s=2*n+2;if(a=si.a)break;l[n]=l[a],n=a}l[n]=i}o=o.b}o.apply(this,[t])}},t.na=function(e){To.L.na.call(this,e),this.sa()},t.ba=function(){To.L.ba.call(this),this.sa()},t.A=function(){To.L.A.call(this),Io.clearTimeout(void 0),Z(this.f.a),this.f=null},r(X,To),X.prototype.qa=function(){var o=new ke,t=this.l;return t&&t.forEach(function(t,e){o.headers.set(e,t)}),this.j&&(o.m=!0),o},X.prototype.ta=function(e){return!e.i&&!e.a},Ne.prototype.createWebChannel=Ne.prototype.a,Oe.prototype.send=Oe.prototype.l,Oe.prototype.open=Oe.prototype.j,Oe.prototype.close=Oe.prototype.close,Sr.NO_ERROR=0,Sr.TIMEOUT=8,Sr.HTTP_ERROR=6,Er.COMPLETE='complete',po.EventType=Mr,Mr.OPEN='a',Mr.CLOSE='b',Mr.ERROR='c',Mr.MESSAGE='d',Lt.prototype.listen=Lt.prototype.aa,X.prototype.getObject=X.prototype.ea,X.prototype.releaseObject=X.prototype.gb,ke.prototype.listenOnce=ke.prototype.Ha,ke.prototype.getLastError=ke.prototype.Za,ke.prototype.getLastErrorCode=ke.prototype.Fa,ke.prototype.getStatus=ke.prototype.W,ke.prototype.getStatusText=ke.prototype.Ga,ke.prototype.getResponseJson=ke.prototype.Ya,ke.prototype.getResponseText=ke.prototype.V,ke.prototype.getResponseText=ke.prototype.V,ke.prototype.send=ke.prototype.fa,e.exports={createWebChannelTransport:ne,ErrorCode:Sr,EventType:Er,WebChannel:po,XhrIoPool:X}}).call(void 0===t?'undefined'==typeof self?'undefined'==typeof window?{}:window:self:t)}).call(t,n(12))}},[113])}catch(e){throw Error('Cannot instantiate firebase-firestore.js - be sure to load firebase-app.js first.')} \ No newline at end of file +/******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ var parentJsonpFunction = window["webpackJsonp"]; +/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, resolves = [], result; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) { +/******/ resolves.push(installedChunks[chunkId][0]); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); +/******/ while(resolves.length) { +/******/ resolves.shift()(); +/******/ } +/******/ if(executeModules) { +/******/ for(i=0; i < executeModules.length; i++) { +/******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // objects to store loaded and loading chunks +/******/ var installedChunks = { +/******/ 2: 0 +/******/ }; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "/"; +/******/ +/******/ // on error function for async loading +/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "/QFk": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; + +// CONCATENATED MODULE: ../node_modules/@emmetio/config/dist/config.es.js +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var defaultSyntaxes = { + markup: 'html', + stylesheet: 'css' +}; + +var knownSyntaxes = { + markup: ['html', 'xml', 'xsl', 'jsx', 'js', 'pug', 'slim', 'haml'], + stylesheet: ['css', 'sass', 'scss', 'less', 'sss', 'stylus'] +}; + +/** + * Config resolver: returns compiled config that can be used in + * `@emmetio/expand-abbreviation` module for expanding abbreviations + * @param {EmmetConfig} config Config object + * @param {EmmetConfigParams} [params] Additional params like `.syntax` and `.project` for + * config resolving + * @returns {Object} + */ +function compileConfig(config, params) { + params = createParams(config, params || {}); + + var resolved = resolveConfig(config, params); + + // Copy extra fields from original config + var knownFields = ['globals', 'syntax', 'project']; + for (var p in config) { + if (knownFields.indexOf(p) === -1) { + resolved[p] = config[p]; + } + } + + return resolved; +} + +/** + * Resolves config for markup syntax + * @param {EmmetConfig} config + * @param {EmmetConfigParams} params + * @return {Object} + */ +function resolveConfig(config, ref) { + var type = ref.type; + var syntax = ref.syntax; + var project = ref.project; + + return { + syntax: syntax, + type: type, + project: project, + format: mergeConfig(config, 'format', type, syntax, project), + profile: mergeConfig(config, 'profile', type, syntax, project), + options: mergeConfig(config, 'options', type, syntax, project), + variables: mergeConfig(config, 'variables', type, syntax, project), + snippets: getConfig(config, 'snippets', type, syntax, project).filter(Boolean) + }; +} + +/** + * @param {EmmetConfig} config + * @param {EmmetConfigParams} params + * @returns {EmmetConfigParams} + */ +function createParams(config, params) { + var type = params.type; + var syntax = params.syntax; + + if (!type && !syntax) { + type = 'markup'; + syntax = defaultSyntaxes[type]; + } else if (!type && syntax) { + if (knownSyntaxes.markup.indexOf(syntax) !== -1) { + type = 'markup'; + } else if (knownSyntaxes.stylesheet.indexOf(syntax) !== -1) { + type = 'stylesheet'; + } else { + type = get(config, ['syntax', syntax, 'type']) || get(config, ['project', params.project, 'syntax', syntax, 'type']); + } + } else if (!syntax) { + syntax = defaultSyntaxes[type]; + } + + return _extends({}, params, { type: type, syntax: syntax }); +} + +function mergeConfig(config, key, type, syntax, project) { + return getConfig(config, key, type, syntax, project).reduce(function (out, obj) { + return _extends({}, out, obj); + }, {}); +} + +function getConfig(config, key, type, syntax, project) { + return [get(config, ['globals', type, key]), get(config, ['project', project, 'globals', type, key]), get(config, ['syntax', syntax, key]), get(config, ['project', project, 'syntax', syntax, key])].filter(Boolean); +} + +/** + * Safe dot-property getter for `obj`: returns value of `obj` by given `key`, + * separated by `.`, but doesn’t throw error if any of the property key exists + * @param {Object} obj + * @param {String[]} key + * @param {*} [defaultValue] + * @return {*} + */ +function get(obj, key, defaultValue) { + var result = obj; + + for (var i = 0; i < key.length; i++) { + if (result == null) { + break; + } + + result = result[key[i]]; + } + + return result != null ? result : defaultValue; +} + +/* harmony default export */ var config_es = (compileConfig); +//# sourceMappingURL=config.es.js.map +// CONCATENATED MODULE: ../node_modules/@emmetio/stream-reader/dist/stream-reader.es.js +/** + * A streaming, character code-based string reader + */ +let StreamReader = class StreamReader { + constructor(string, start, end) { + if (end == null && typeof string === 'string') { + end = string.length; + } + + this.string = string; + this.pos = this.start = start || 0; + this.end = end; + } + + /** + * Returns true only if the stream is at the end of the file. + * @returns {Boolean} + */ + eof() { + return this.pos >= this.end; + } + + /** + * Creates a new stream instance which is limited to given `start` and `end` + * range. E.g. its `eof()` method will look at `end` property, not actual + * stream end + * @param {Point} start + * @param {Point} end + * @return {StreamReader} + */ + limit(start, end) { + return new this.constructor(this.string, start, end); + } + + /** + * Returns the next character code in the stream without advancing it. + * Will return NaN at the end of the file. + * @returns {Number} + */ + peek() { + return this.string.charCodeAt(this.pos); + } + + /** + * Returns the next character in the stream and advances it. + * Also returns undefined when no more characters are available. + * @returns {Number} + */ + next() { + if (this.pos < this.string.length) { + return this.string.charCodeAt(this.pos++); + } + } + + /** + * `match` can be a character code or a function that takes a character code + * and returns a boolean. If the next character in the stream 'matches' + * the given argument, it is consumed and returned. + * Otherwise, `false` is returned. + * @param {Number|Function} match + * @returns {Boolean} + */ + eat(match) { + const ch = this.peek(); + const ok = typeof match === 'function' ? match(ch) : ch === match; + + if (ok) { + this.next(); + } + + return ok; + } + + /** + * Repeatedly calls eat with the given argument, until it + * fails. Returns true if any characters were eaten. + * @param {Object} match + * @returns {Boolean} + */ + eatWhile(match) { + const start = this.pos; + while (!this.eof() && this.eat(match)) {} + return this.pos !== start; + } + + /** + * Backs up the stream n characters. Backing it up further than the + * start of the current token will cause things to break, so be careful. + * @param {Number} n + */ + backUp(n) { + this.pos -= n || 1; + } + + /** + * Get the string between the start of the current token and the + * current stream position. + * @returns {String} + */ + current() { + return this.substring(this.start, this.pos); + } + + /** + * Returns substring for given range + * @param {Number} start + * @param {Number} [end] + * @return {String} + */ + substring(start, end) { + return this.string.slice(start, end); + } + + /** + * Creates error object with current stream state + * @param {String} message + * @return {Error} + */ + error(message) { + const err = new Error(`${message} at char ${this.pos + 1}`); + err.originalMessage = message; + err.pos = this.pos; + err.string = this.string; + return err; + } +}; + + +/* harmony default export */ var stream_reader_es = (StreamReader); +// CONCATENATED MODULE: ../node_modules/@emmetio/stream-reader-utils/dist/stream-reader-utils.es.js +var stream_reader_utils_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +/** + * Methods for consuming quoted values + */ + +const SINGLE_QUOTE = 39; // ' +const DOUBLE_QUOTE = 34; // " + +const defaultOptions = { + escape: 92, // \ character + throws: false +}; + +/** + * Consumes 'single' or "double"-quoted string from given string, if possible + * @param {StreamReader} stream + * @param {Number} options.escape A character code of quote-escape symbol + * @param {Boolean} options.throws Throw error if quotes string can’t be properly consumed + * @return {Boolean} `true` if quoted string was consumed. The contents + * of quoted string will be availabe as `stream.current()` + */ +var eatQuoted = function (stream, options) { + options = options ? stream_reader_utils_es__extends({}, defaultOptions, options) : defaultOptions; + const start = stream.pos; + const quote = stream.peek(); + + if (stream.eat(isQuote)) { + while (!stream.eof()) { + switch (stream.next()) { + case quote: + stream.start = start; + return true; + + case options.escape: + stream.next(); + break; + } + } + + // If we’re here then stream wasn’t properly consumed. + // Revert stream and decide what to do + stream.pos = start; + + if (options.throws) { + throw stream.error('Unable to consume quoted string'); + } + } + + return false; +}; + +function isQuote(code) { + return code === SINGLE_QUOTE || code === DOUBLE_QUOTE; +} + +/** + * Check if given code is a number + * @param {Number} code + * @return {Boolean} + */ +function isNumber(code) { + return code > 47 && code < 58; +} + +/** + * Check if given character code is alpha code (letter through A to Z) + * @param {Number} code + * @param {Number} [from] + * @param {Number} [to] + * @return {Boolean} + */ +function isAlpha(code, from, to) { + from = from || 65; // A + to = to || 90; // Z + code &= ~32; // quick hack to convert any char code to uppercase char code + + return code >= from && code <= to; +} + +/** + * Check if given character code is alpha-numeric (letter through A to Z or number) + * @param {Number} code + * @return {Boolean} + */ +function isAlphaNumeric(code) { + return isNumber(code) || isAlpha(code); +} + +function isWhiteSpace(code) { + return code === 32 /* space */ + || code === 9 /* tab */ + || code === 160; /* non-breaking space */ +} + +/** + * Check if given character code is a space + * @param {Number} code + * @return {Boolean} + */ +function isSpace(code) { + return isWhiteSpace(code) || code === 10 /* LF */ + || code === 13; /* CR */ +} + +const defaultOptions$1 = { + escape: 92, // \ character + throws: false +}; + +/** + * Eats paired characters substring, for example `(foo)` or `[bar]` + * @param {StreamReader} stream + * @param {Number} open Character code of pair openinig + * @param {Number} close Character code of pair closing + * @param {Object} [options] + * @return {Boolean} Returns `true` if chacarter pair was successfully + * consumed, it’s content will be available as `stream.current()` + */ +function eatPair(stream, open, close, options) { + options = options ? stream_reader_utils_es__extends({}, defaultOptions$1, options) : defaultOptions$1; + const start = stream.pos; + + if (stream.eat(open)) { + let stack = 1, + ch; + + while (!stream.eof()) { + if (eatQuoted(stream, options)) { + continue; + } + + ch = stream.next(); + if (ch === open) { + stack++; + } else if (ch === close) { + stack--; + if (!stack) { + stream.start = start; + return true; + } + } else if (ch === options.escape) { + stream.next(); + } + } + + // If we’re here then paired character can’t be consumed + stream.pos = start; + + if (options.throws) { + throw stream.error(`Unable to find matching pair for ${String.fromCharCode(open)}`); + } + } + + return false; +} + + +// CONCATENATED MODULE: ../node_modules/@emmetio/field-parser/dist/field-parser.es.js + + + +const DOLLAR = 36; // $ +const COLON = 58; // : +const ESCAPE = 92; // \ +const OPEN_BRACE = 123; // { +const CLOSE_BRACE = 125; // } + +/** + * Finds fields in given string and returns object with field-less string + * and array of fields found + * @param {String} string + * @return {Object} + */ +function parse(string) { + const stream = new stream_reader_es(string); + const fields = []; + let cleanString = '', + offset = 0, + pos = 0; + let code, field; + + while (!stream.eof()) { + code = stream.peek(); + pos = stream.pos; + + if (code === ESCAPE) { + stream.next(); + stream.next(); + } else if (field = consumeField(stream, cleanString.length + pos - offset)) { + fields.push(field); + cleanString += stream.string.slice(offset, pos) + field.placeholder; + offset = stream.pos; + } else { + stream.next(); + } + } + + return new FieldString(cleanString + stream.string.slice(offset), fields); +} + +/** + * Marks given `string` with `fields`: wraps each field range with + * `${index:placeholder}` (by default) or any other token produced by `token` + * function, if provided + * @param {String} string String to mark + * @param {Array} fields Array of field descriptor. A field descriptor is a + * `{index, location, length}` array. It is important that fields in array + * must be ordered by their location in string: some fields my refer the same + * location so they must appear in order that user expects. + * @param {Function} [token] Function that generates field token. This function + * received two arguments: `index` and `placeholder` and should return string + * @return {String} String with marked fields + */ +function mark(string, fields, token) { + token = token || createToken; + + // order fields by their location and appearence + // NB field ranges should not overlap! (not supported yet) + const ordered = fields.map((field, order) => ({ order, field, end: field.location + field.length })).sort((a, b) => a.end - b.end || a.order - b.order); + + // mark ranges in string + let offset = 0; + const result = ordered.map(item => { + const placeholder = string.substr(item.field.location, item.field.length); + const prefix = string.slice(offset, item.field.location); + offset = item.end; + return prefix + token(item.field.index, placeholder); + }); + + return result.join('') + string.slice(offset); +} + +/** + * Creates field token for string + * @param {Number} index Field index + * @param {String} placeholder Field placeholder, could be empty string + * @return {String} + */ +function createToken(index, placeholder) { + return placeholder ? `\${${index}:${placeholder}}` : `\${${index}}`; +} + +/** + * Consumes field from current stream position: it can be an `$index` or + * or `${index}` or `${index:placeholder}` + * @param {StreamReader} stream + * @param {Number} location Field location in *clean* string + * @return {Field} Object with `index` and `placeholder` properties if + * field was successfully consumed, `null` otherwise + */ +function consumeField(stream, location) { + const start = stream.pos; + + if (stream.eat(DOLLAR)) { + // Possible start of field + let index = consumeIndex(stream); + let placeholder = ''; + + // consumed $index placeholder + if (index != null) { + return new Field(index, placeholder, location); + } + + if (stream.eat(OPEN_BRACE)) { + index = consumeIndex(stream); + if (index != null) { + if (stream.eat(COLON)) { + placeholder = consumePlaceholder(stream); + } + + if (stream.eat(CLOSE_BRACE)) { + return new Field(index, placeholder, location); + } + } + } + } + + // If we reached here then there’s no valid field here, revert + // back to starting position + stream.pos = start; +} + +/** + * Consumes a placeholder: value right after `:` in field. Could be empty + * @param {StreamReader} stream + * @return {String} + */ +function consumePlaceholder(stream) { + let code; + const stack = []; + stream.start = stream.pos; + + while (!stream.eof()) { + code = stream.peek(); + + if (code === OPEN_BRACE) { + stack.push(stream.pos); + } else if (code === CLOSE_BRACE) { + if (!stack.length) { + break; + } + stack.pop(); + } + stream.next(); + } + + if (stack.length) { + throw stream.error('Unable to find matching "}" for curly brace at ' + stack.pop()); + } + + return stream.current(); +} + +/** + * Consumes integer from current stream position + * @param {StreamReader} stream + * @return {Number} + */ +function consumeIndex(stream) { + stream.start = stream.pos; + if (stream.eatWhile(isNumber)) { + return Number(stream.current()); + } +} + +let Field = class Field { + constructor(index, placeholder, location) { + this.index = index; + this.placeholder = placeholder; + this.location = location; + this.length = this.placeholder.length; + } +}; +let FieldString = class FieldString { + /** + * @param {String} string + * @param {Field[]} fields + */ + constructor(string, fields) { + this.string = string; + this.fields = fields; + } + + mark(token) { + return mark(this.string, this.fields, token); + } + + toString() { + return this.string; + } +}; + + +/* harmony default export */ var field_parser_es = (parse); + +//# sourceMappingURL=field-parser.es.js.map +// CONCATENATED MODULE: ../node_modules/@emmetio/extract-abbreviation/dist/extract-abbreviation.es.js +var extract_abbreviation_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +/** + * Minimalistic backwards stream reader + */ +let extract_abbreviation_es_StreamReader = class StreamReader { + constructor(string, start) { + this.string = string; + this.start = start || 0; + this.pos = this.string.length; + } + + sol() { + return this.pos === this.start; + } + + peek(offset) { + return this.string.charCodeAt(this.pos - 1 + (offset || 0)); + } + + prev() { + if (!this.sol()) { + return this.string.charCodeAt(--this.pos); + } + } + + eat(match) { + if (this.sol()) { + return false; + } + + const ok = typeof match === 'function' ? match(this.peek()) : match === this.peek(); + + if (ok) { + this.pos--; + } + + return ok; + } + + eatWhile(match) { + const start = this.pos; + while (this.eat(match)) {} + return this.pos < start; + } +}; + +/** + * Quotes-related utilities + */ + +const extract_abbreviation_es_SINGLE_QUOTE = 39; // ' +const extract_abbreviation_es_DOUBLE_QUOTE = 34; // " +const extract_abbreviation_es_ESCAPE = 92; // \ + +/** + * Check if given character code is a quote + * @param {Number} c + * @return {Boolean} + */ +function extract_abbreviation_es_isQuote(c) { + return c === extract_abbreviation_es_SINGLE_QUOTE || c === extract_abbreviation_es_DOUBLE_QUOTE; +} + +/** + * Consumes quoted value, if possible + * @param {StreamReader} stream + * @return {Boolean} Returns `true` is value was consumed + */ +function extract_abbreviation_es_eatQuoted(stream) { + const start = stream.pos; + const quote = stream.prev(); + + if (extract_abbreviation_es_isQuote(quote)) { + while (!stream.sol()) { + if (stream.prev() === quote && stream.peek() !== extract_abbreviation_es_ESCAPE) { + return true; + } + } + } + + stream.pos = start; + return false; +} + +const TAB = 9; +const SPACE = 32; +const DASH = 45; // - +const SLASH = 47; // / +const extract_abbreviation_es_COLON = 58; // : +const EQUALS = 61; // = +const ANGLE_LEFT = 60; // < +const ANGLE_RIGHT = 62; // > + +/** + * Check if given reader’s current position points at the end of HTML tag + * @param {StreamReader} stream + * @return {Boolean} + */ +var isAtHTMLTag = function (stream) { + const start = stream.pos; + + if (!stream.eat(ANGLE_RIGHT)) { + return false; + } + + let ok = false; + stream.eat(SLASH); // possibly self-closed element + + while (!stream.sol()) { + stream.eatWhile(extract_abbreviation_es_isWhiteSpace); + + if (eatIdent(stream)) { + // ate identifier: could be a tag name, boolean attribute or unquoted + // attribute value + if (stream.eat(SLASH)) { + // either closing tag or invalid tag + ok = stream.eat(ANGLE_LEFT); + break; + } else if (stream.eat(ANGLE_LEFT)) { + // opening tag + ok = true; + break; + } else if (stream.eat(extract_abbreviation_es_isWhiteSpace)) { + // boolean attribute + continue; + } else if (stream.eat(EQUALS)) { + // simple unquoted value or invalid attribute + if (eatIdent(stream)) { + continue; + } + break; + } else if (eatAttributeWithUnquotedValue(stream)) { + // identifier was a part of unquoted value + ok = true; + break; + } + + // invalid tag + break; + } + + if (eatAttribute(stream)) { + continue; + } + + break; + } + + stream.pos = start; + return ok; +}; + +/** + * Eats HTML attribute from given string. + * @param {StreamReader} state + * @return {Boolean} `true` if attribute was consumed. + */ +function eatAttribute(stream) { + return eatAttributeWithQuotedValue(stream) || eatAttributeWithUnquotedValue(stream); +} + +/** + * @param {StreamReader} stream + * @return {Boolean} + */ +function eatAttributeWithQuotedValue(stream) { + const start = stream.pos; + if (extract_abbreviation_es_eatQuoted(stream) && stream.eat(EQUALS) && eatIdent(stream)) { + return true; + } + + stream.pos = start; + return false; +} + +/** + * @param {StreamReader} stream + * @return {Boolean} + */ +function eatAttributeWithUnquotedValue(stream) { + const start = stream.pos; + if (stream.eatWhile(isUnquotedValue) && stream.eat(EQUALS) && eatIdent(stream)) { + return true; + } + + stream.pos = start; + return false; +} + +/** + * Eats HTML identifier from stream + * @param {StreamReader} stream + * @return {Boolean} + */ +function eatIdent(stream) { + return stream.eatWhile(isIdent); +} + +/** + * Check if given character code belongs to HTML identifier + * @param {Number} c + * @return {Boolean} + */ +function isIdent(c) { + return c === extract_abbreviation_es_COLON || c === DASH || extract_abbreviation_es_isAlpha(c) || extract_abbreviation_es_isNumber(c); +} + +/** + * Check if given character code is alpha code (letter though A to Z) + * @param {Number} c + * @return {Boolean} + */ +function extract_abbreviation_es_isAlpha(c) { + c &= ~32; // quick hack to convert any char code to uppercase char code + return c >= 65 && c <= 90; // A-Z +} + +/** + * Check if given code is a number + * @param {Number} c + * @return {Boolean} + */ +function extract_abbreviation_es_isNumber(c) { + return c > 47 && c < 58; +} + +/** + * Check if given code is a whitespace + * @param {Number} c + * @return {Boolean} + */ +function extract_abbreviation_es_isWhiteSpace(c) { + return c === SPACE || c === TAB; +} + +/** + * Check if given code may belong to unquoted attribute value + * @param {Number} c + * @return {Boolean} + */ +function isUnquotedValue(c) { + return c && c !== EQUALS && !extract_abbreviation_es_isWhiteSpace(c) && !extract_abbreviation_es_isQuote(c); +} + +const extract_abbreviation_es_code = ch => ch.charCodeAt(0); +const SQUARE_BRACE_L = extract_abbreviation_es_code('['); +const SQUARE_BRACE_R = extract_abbreviation_es_code(']'); +const ROUND_BRACE_L = extract_abbreviation_es_code('('); +const ROUND_BRACE_R = extract_abbreviation_es_code(')'); +const CURLY_BRACE_L = extract_abbreviation_es_code('{'); +const CURLY_BRACE_R = extract_abbreviation_es_code('}'); + +const specialChars = new Set('#.*:$-_!@%^+>/'.split('').map(extract_abbreviation_es_code)); +const bracePairs = new Map().set(SQUARE_BRACE_L, SQUARE_BRACE_R).set(ROUND_BRACE_L, ROUND_BRACE_R).set(CURLY_BRACE_L, CURLY_BRACE_R); + +const extract_abbreviation_es_defaultOptions = { + syntax: 'markup', + lookAhead: null, + prefix: '' +}; + +/** + * Extracts Emmet abbreviation from given string. + * The goal of this module is to extract abbreviation from current editor’s line, + * e.g. like this: `.foo[title=bar|]` -> `.foo[title=bar]`, where + * `|` is a current caret position. + * @param {String} line A text line where abbreviation should be expanded + * @param {Number} [pos] Caret position in line. If not given, uses end-of-line + * @param {Object} [options] + * @param {Boolean} [options.lookAhead] Allow parser to look ahead of `pos` index for + * searching of missing abbreviation parts. Most editors automatically inserts + * closing braces for `[`, `{` and `(`, which will most likely be right after + * current caret position. So in order to properly expand abbreviation, user + * must explicitly move caret right after auto-inserted braces. With this option + * enabled, parser will search for closing braces right after `pos`. Default is `true` + * @param {String} [options.syntax] Name of context syntax of expanded abbreviation. + * Either 'markup' (default) or 'stylesheet'. In 'stylesheet' syntax, braces `[]` + * and `{}` are not supported thus not extracted. + * @param {String} [options.prefix] A string that should precede abbreviation in + * order to make it successfully extracted. If given, the abbreviation will be + * extracted from the nearest `prefix` occurrence. + * @return {Object} Object with `abbreviation` and its `location` in given line + * if abbreviation can be extracted, `null` otherwise + */ +function extractAbbreviation(line, pos, options) { + // make sure `pos` is within line range + pos = Math.min(line.length, Math.max(0, pos == null ? line.length : pos)); + + if (typeof options === 'boolean') { + options = extract_abbreviation_es__extends({}, extract_abbreviation_es_defaultOptions, { lookAhead: options }); + } else { + options = extract_abbreviation_es__extends({}, extract_abbreviation_es_defaultOptions, options); + } + + if (options.lookAhead == null || options.lookAhead === true) { + pos = offsetPastAutoClosed(line, pos, options); + } + + let c; + const start = getStartOffset(line, pos, options.prefix); + if (start === -1) { + return null; + } + + const stream = new extract_abbreviation_es_StreamReader(line, start); + stream.pos = pos; + const stack = []; + + while (!stream.sol()) { + c = stream.peek(); + + if (isCloseBrace(c, options.syntax)) { + stack.push(c); + } else if (isOpenBrace(c, options.syntax)) { + if (stack.pop() !== bracePairs.get(c)) { + // unexpected brace + break; + } + } else if (has(stack, SQUARE_BRACE_R) || has(stack, CURLY_BRACE_R)) { + // respect all characters inside attribute sets or text nodes + stream.pos--; + continue; + } else if (isAtHTMLTag(stream) || !isAbbreviation(c)) { + break; + } + + stream.pos--; + } + + if (!stack.length && stream.pos !== pos) { + // found something, remove some invalid symbols from the + // beginning and return abbreviation + const abbreviation = line.slice(stream.pos, pos).replace(/^[*+>^]+/, ''); + return { + abbreviation, + location: pos - abbreviation.length, + start: options.prefix ? start - options.prefix.length : pos - abbreviation.length, + end: pos + }; + } +} + +/** + * Returns new `line` index which is right after characters beyound `pos` that + * editor will likely automatically close, e.g. }, ], and quotes + * @param {String} line + * @param {Number} pos + * @return {Number} + */ +function offsetPastAutoClosed(line, pos, options) { + // closing quote is allowed only as a next character + if (extract_abbreviation_es_isQuote(line.charCodeAt(pos))) { + pos++; + } + + // offset pointer until non-autoclosed character is found + while (isCloseBrace(line.charCodeAt(pos), options.syntax)) { + pos++; + } + + return pos; +} + +/** + * Returns start offset (left limit) in `line` where we should stop looking for + * abbreviation: it’s nearest to `pos` location of `prefix` token + * @param {String} line + * @param {Number} pos + * @param {String} prefix + * @return {Number} + */ +function getStartOffset(line, pos, prefix) { + if (!prefix) { + return 0; + } + + const stream = new extract_abbreviation_es_StreamReader(line); + const compiledPrefix = String(prefix).split('').map(extract_abbreviation_es_code); + stream.pos = pos; + let result; + + while (!stream.sol()) { + if (consumePair(stream, SQUARE_BRACE_R, SQUARE_BRACE_L) || consumePair(stream, CURLY_BRACE_R, CURLY_BRACE_L)) { + continue; + } + + result = stream.pos; + if (consumeArray(stream, compiledPrefix)) { + return result; + } + + stream.pos--; + } + + return -1; +} + +/** + * Consumes full character pair, if possible + * @param {StreamReader} stream + * @param {Number} close + * @param {Number} open + * @return {Boolean} + */ +function consumePair(stream, close, open) { + const start = stream.pos; + if (stream.eat(close)) { + while (!stream.sol()) { + if (stream.eat(open)) { + return true; + } + + stream.pos--; + } + } + + stream.pos = start; + return false; +} + +/** + * Consumes all character codes from given array, right-to-left, if possible + * @param {StreamReader} stream + * @param {Number[]} arr + */ +function consumeArray(stream, arr) { + const start = stream.pos; + let consumed = false; + + for (let i = arr.length - 1; i >= 0 && !stream.sol(); i--) { + if (!stream.eat(arr[i])) { + break; + } + + consumed = i === 0; + } + + if (!consumed) { + stream.pos = start; + } + + return consumed; +} + +function has(arr, value) { + return arr.indexOf(value) !== -1; +} + +function isAbbreviation(c) { + return c > 64 && c < 91 || // uppercase letter + c > 96 && c < 123 // lowercase letter + || c > 47 && c < 58 // number + || specialChars.has(c); // special character +} + +function isOpenBrace(c, syntax) { + return c === ROUND_BRACE_L || syntax === 'markup' && (c === SQUARE_BRACE_L || c === CURLY_BRACE_L); +} + +function isCloseBrace(c, syntax) { + return c === ROUND_BRACE_R || syntax === 'markup' && (c === SQUARE_BRACE_R || c === CURLY_BRACE_R); +} + +/* harmony default export */ var extract_abbreviation_es = (extractAbbreviation); +// CONCATENATED MODULE: ../node_modules/@emmetio/node/dist/node.es.js +var node_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +/** + * Attribute descriptor of parsed abbreviation node + * @param {String} name Attribute name + * @param {String} value Attribute value + * @param {Object} options Additional custom attribute options + * @param {Boolean} options.boolean Attribute is boolean (e.g. name equals value) + * @param {Boolean} options.implied Attribute is implied (e.g. must be outputted + * only if contains non-null value) + */ +let Attribute = class Attribute { + constructor(name, value, options) { + this.name = name; + this.value = value != null ? value : null; + this.options = options || {}; + } + + /** + * Create a copy of current attribute + * @return {Attribute} + */ + clone() { + return new Attribute(this.name, this.value, node_es__extends({}, this.options)); + } + + /** + * A string representation of current node + */ + valueOf() { + return `${this.name}="${this.value}"`; + } +}; + +/** + * A parsed abbreviation AST node. Nodes build up an abbreviation AST tree + */ + +let Node = class Node { + /** + * Creates a new node + * @param {String} [name] Node name + * @param {Array} [attributes] Array of attributes to add + */ + constructor(name, attributes) { + // own properties + this.name = name || null; + this.value = null; + this.repeat = null; + this.selfClosing = false; + + this.children = []; + + /** @type {Node} Pointer to parent node */ + this.parent = null; + + /** @type {Node} Pointer to next sibling */ + this.next = null; + + /** @type {Node} Pointer to previous sibling */ + this.previous = null; + + this._attributes = []; + + if (Array.isArray(attributes)) { + attributes.forEach(attr => this.setAttribute(attr)); + } + } + + /** + * Array of current node attributes + * @return {Attribute[]} Array of attributes + */ + get attributes() { + return this._attributes; + } + + /** + * A shorthand to retreive node attributes as map + * @return {Object} + */ + get attributesMap() { + return this.attributes.reduce((out, attr) => { + out[attr.name] = attr.options.boolean ? attr.name : attr.value; + return out; + }, {}); + } + + /** + * Check if current node is a grouping one, e.g. has no actual representation + * and is used for grouping subsequent nodes only + * @return {Boolean} + */ + get isGroup() { + return !this.name && !this.value && !this._attributes.length; + } + + /** + * Check if given node is a text-only node, e.g. contains only value + * @return {Boolean} + */ + get isTextOnly() { + return !this.name && !!this.value && !this._attributes.length; + } + + /** + * Returns first child node + * @return {Node} + */ + get firstChild() { + return this.children[0]; + } + + /** + * Returns last child of current node + * @return {Node} + */ + get lastChild() { + return this.children[this.children.length - 1]; + } + + /** + * Return index of current node in its parent child list + * @return {Number} Returns -1 if current node is a root one + */ + get childIndex() { + return this.parent ? this.parent.children.indexOf(this) : -1; + } + + /** + * Returns next sibling of current node + * @return {Node} + */ + get nextSibling() { + return this.next; + } + + /** + * Returns previous sibling of current node + * @return {Node} + */ + get previousSibling() { + return this.previous; + } + + /** + * Returns array of unique class names in current node + * @return {String[]} + */ + get classList() { + const attr = this.getAttribute('class'); + return attr && attr.value ? attr.value.split(/\s+/g).filter(uniqueClass) : []; + } + + /** + * Convenient alias to create a new node instance + * @param {String} [name] Node name + * @param {Object} [attributes] Attributes hash + * @return {Node} + */ + create(name, attributes) { + return new Node(name, attributes); + } + + /** + * Sets given attribute for current node + * @param {String|Object|Attribute} name Attribute name or attribute object + * @param {String} [value] Attribute value + */ + setAttribute(name, value) { + const attr = createAttribute(name, value); + const curAttr = this.getAttribute(name); + if (curAttr) { + this.replaceAttribute(curAttr, attr); + } else { + this._attributes.push(attr); + } + } + + /** + * Check if attribute with given name exists in node + * @param {String} name + * @return {Boolean} + */ + hasAttribute(name) { + return !!this.getAttribute(name); + } + + /** + * Returns attribute object by given name + * @param {String} name + * @return {Attribute} + */ + getAttribute(name) { + if (typeof name === 'object') { + name = name.name; + } + + for (var i = 0; i < this._attributes.length; i++) { + const attr = this._attributes[i]; + if (attr.name === name) { + return attr; + } + } + } + + /** + * Replaces attribute with new instance + * @param {String|Attribute} curAttribute Current attribute name or instance + * to replace + * @param {String|Object|Attribute} newName New attribute name or attribute object + * @param {String} [newValue] New attribute value + */ + replaceAttribute(curAttribute, newName, newValue) { + if (typeof curAttribute === 'string') { + curAttribute = this.getAttribute(curAttribute); + } + + const ix = this._attributes.indexOf(curAttribute); + if (ix !== -1) { + this._attributes.splice(ix, 1, createAttribute(newName, newValue)); + } + } + + /** + * Removes attribute with given name + * @param {String|Attribute} attr Atrtibute name or instance + */ + removeAttribute(attr) { + if (typeof attr === 'string') { + attr = this.getAttribute(attr); + } + + const ix = this._attributes.indexOf(attr); + if (ix !== -1) { + this._attributes.splice(ix, 1); + } + } + + /** + * Removes all attributes from current node + */ + clearAttributes() { + this._attributes.length = 0; + } + + /** + * Adds given class name to class attribute + * @param {String} token Class name token + */ + addClass(token) { + token = normalize(token); + + if (!this.hasAttribute('class')) { + this.setAttribute('class', token); + } else if (token && !this.hasClass(token)) { + this.setAttribute('class', this.classList.concat(token).join(' ')); + } + } + + /** + * Check if current node contains given class name + * @param {String} token Class name token + * @return {Boolean} + */ + hasClass(token) { + return this.classList.indexOf(normalize(token)) !== -1; + } + + /** + * Removes given class name from class attribute + * @param {String} token Class name token + */ + removeClass(token) { + token = normalize(token); + if (this.hasClass(token)) { + this.setAttribute('class', this.classList.filter(name => name !== token).join(' ')); + } + } + + /** + * Appends child to current node + * @param {Node} node + */ + appendChild(node) { + this.insertAt(node, this.children.length); + } + + /** + * Inserts given `newNode` before `refNode` child node + * @param {Node} newNode + * @param {Node} refNode + */ + insertBefore(newNode, refNode) { + this.insertAt(newNode, this.children.indexOf(refNode)); + } + + /** + * Insert given `node` at `pos` position of child list + * @param {Node} node + * @param {Number} pos + */ + insertAt(node, pos) { + if (pos < 0 || pos > this.children.length) { + throw new Error('Unable to insert node: position is out of child list range'); + } + + const prev = this.children[pos - 1]; + const next = this.children[pos]; + + node.remove(); + node.parent = this; + this.children.splice(pos, 0, node); + + if (prev) { + node.previous = prev; + prev.next = node; + } + + if (next) { + node.next = next; + next.previous = node; + } + } + + /** + * Removes given child from current node + * @param {Node} node + */ + removeChild(node) { + const ix = this.children.indexOf(node); + if (ix !== -1) { + this.children.splice(ix, 1); + if (node.previous) { + node.previous.next = node.next; + } + + if (node.next) { + node.next.previous = node.previous; + } + + node.parent = node.next = node.previous = null; + } + } + + /** + * Removes current node from its parent + */ + remove() { + if (this.parent) { + this.parent.removeChild(this); + } + } + + /** + * Creates a detached copy of current node + * @param {Boolean} deep Clone node contents as well + * @return {Node} + */ + clone(deep) { + const clone = new Node(this.name); + clone.value = this.value; + clone.selfClosing = this.selfClosing; + if (this.repeat) { + clone.repeat = node_es__extends({}, this.repeat); + } + + this._attributes.forEach(attr => clone.setAttribute(attr.clone())); + + if (deep) { + this.children.forEach(child => clone.appendChild(child.clone(true))); + } + + return clone; + } + + /** + * Walks on each descendant node and invokes given `fn` function on it. + * The function receives two arguments: the node itself and its depth level + * from current node. If function returns `false`, it stops walking + * @param {Function} fn + */ + walk(fn, _level) { + _level = _level || 0; + let ctx = this.firstChild; + + while (ctx) { + // in case if context node will be detached during `fn` call + const next = ctx.next; + + if (fn(ctx, _level) === false || ctx.walk(fn, _level + 1) === false) { + return false; + } + + ctx = next; + } + } + + /** + * A helper method for transformation chaining: runs given `fn` function on + * current node and returns the same node + */ + use(fn) { + const args = [this]; + for (var i = 1; i < arguments.length; i++) { + args.push(arguments[i]); + } + + fn.apply(null, args); + return this; + } + + toString() { + const attrs = this.attributes.map(attr => { + attr = this.getAttribute(attr.name); + const opt = attr.options; + let out = `${opt && opt.implied ? '!' : ''}${attr.name || ''}`; + if (opt && opt.boolean) { + out += '.'; + } else if (attr.value != null) { + out += `="${attr.value}"`; + } + return out; + }); + + let out = `${this.name || ''}`; + if (attrs.length) { + out += `[${attrs.join(' ')}]`; + } + + if (this.value != null) { + out += `{${this.value}}`; + } + + if (this.selfClosing) { + out += '/'; + } + + if (this.repeat) { + out += `*${this.repeat.count ? this.repeat.count : ''}`; + if (this.repeat.value != null) { + out += `@${this.repeat.value}`; + } + } + + return out; + } +}; + +/** + * Attribute factory + * @param {String|Attribute|Object} name Attribute name or attribute descriptor + * @param {*} value Attribute value + * @return {Attribute} + */ + +function createAttribute(name, value) { + if (name instanceof Attribute) { + return name; + } + + if (typeof name === 'string') { + return new Attribute(name, value); + } + + if (name && typeof name === 'object') { + return new Attribute(name.name, name.value, name.options); + } +} + +/** + * @param {String} str + * @return {String} + */ +function normalize(str) { + return String(str).trim(); +} + +function uniqueClass(item, i, arr) { + return item && arr.indexOf(item) === i; +} + +/* harmony default export */ var node_es = (Node); +// CONCATENATED MODULE: ../node_modules/@emmetio/abbreviation/dist/abbreviation.es.js + + + + +const ASTERISK = 42; // * + +/** + * Consumes node repeat token from current stream position and returns its + * parsed value + * @param {StringReader} stream + * @return {Object} + */ +function consumeRepeat(stream) { + if (stream.eat(ASTERISK)) { + stream.start = stream.pos; + + // XXX think about extending repeat syntax with through numbering + return { count: stream.eatWhile(isNumber) ? +stream.current() : null }; + } +} + +const opt = { throws: true }; + +/** + * Consumes quoted literal from current stream position and returns it’s inner, + * unquoted, value + * @param {StringReader} stream + * @return {String} Returns `null` if unable to consume quoted value from current + * position + */ +function consumeQuoted(stream) { + if (eatQuoted(stream, opt)) { + return stream.current().slice(1, -1); + } +} + +const TEXT_START = 123; // { +const TEXT_END = 125; // } +const abbreviation_es_ESCAPE = 92; // \ character + +/** + * Consumes text node `{...}` from stream + * @param {StreamReader} stream + * @return {String} Returns consumed text value (without surrounding braces) or + * `null` if there’s no text at starting position + */ +function consumeText(stream) { + // NB using own implementation instead of `eatPair()` from @emmetio/stream-reader-utils + // to disable quoted value consuming + const start = stream.pos; + + if (stream.eat(TEXT_START)) { + let stack = 1, + ch; + let result = ''; + let offset = stream.pos; + + while (!stream.eof()) { + ch = stream.next(); + if (ch === TEXT_START) { + stack++; + } else if (ch === TEXT_END) { + stack--; + if (!stack) { + stream.start = start; + return result + stream.substring(offset, stream.pos - 1); + } + } else if (ch === abbreviation_es_ESCAPE) { + ch = stream.next(); + if (ch === TEXT_START || ch === TEXT_END) { + result += stream.substring(offset, stream.pos - 2) + String.fromCharCode(ch); + offset = stream.pos; + } + } + } + + // If we’re here then paired character can’t be consumed + stream.pos = start; + throw stream.error(`Unable to find closing ${String.fromCharCode(TEXT_END)} for text start`); + } + + return null; +} + +const EXCL = 33; // . +const DOT = 46; // . +const abbreviation_es_EQUALS = 61; // = +const ATTR_OPEN = 91; // [ +const ATTR_CLOSE = 93; // ] + +const reAttributeName = /^\!?[\w\-:\$@]+\.?$/; + +/** + * Consumes attributes defined in square braces from given stream. + * Example: + * [attr col=3 title="Quoted string" selected. support={react}] + * @param {StringReader} stream + * @returns {Array} Array of consumed attributes + */ +function consumeAttributes(stream) { + if (!stream.eat(ATTR_OPEN)) { + return null; + } + + const result = []; + let token, attr; + + while (!stream.eof()) { + stream.eatWhile(isWhiteSpace); + + if (stream.eat(ATTR_CLOSE)) { + return result; // End of attribute set + } else if ((token = consumeQuoted(stream)) != null) { + // Consumed quoted value: anonymous attribute + result.push({ + name: null, + value: token + }); + } else if (eatUnquoted(stream)) { + // Consumed next word: could be either attribute name or unquoted default value + token = stream.current(); + if (!reAttributeName.test(token)) { + // anonymous attribute + result.push({ name: null, value: token }); + } else { + // Looks like a regular attribute + attr = parseAttributeName(token); + result.push(attr); + + if (stream.eat(abbreviation_es_EQUALS)) { + // Explicitly defined value. Could be a word, a quoted string + // or React-like expression + if ((token = consumeQuoted(stream)) != null) { + attr.value = token; + } else if ((token = consumeText(stream)) != null) { + attr.value = token; + attr.options = { + before: '{', + after: '}' + }; + } else if (eatUnquoted(stream)) { + attr.value = stream.current(); + } + } + } + } else { + throw stream.error('Expected attribute name'); + } + } + + throw stream.error('Expected closing "]" brace'); +} + +function parseAttributeName(name) { + const options = {}; + + // If a first character in attribute name is `!` — it’s an implied + // default attribute + if (name.charCodeAt(0) === EXCL) { + name = name.slice(1); + options.implied = true; + } + + // Check for last character: if it’s a `.`, user wants boolean attribute + if (name.charCodeAt(name.length - 1) === DOT) { + name = name.slice(0, name.length - 1); + options.boolean = true; + } + + const attr = { name }; + if (Object.keys(options).length) { + attr.options = options; + } + + return attr; +} + +/** + * Eats token that can be an unquoted value from given stream + * @param {StreamReader} stream + * @return {Boolean} + */ +function eatUnquoted(stream) { + const start = stream.pos; + if (stream.eatWhile(isUnquoted)) { + stream.start = start; + return true; + } +} + +function isUnquoted(code) { + return !isSpace(code) && !isQuote(code) && code !== ATTR_OPEN && code !== ATTR_CLOSE && code !== abbreviation_es_EQUALS; +} + +const HASH = 35; // # +const DOT$1 = 46; // . +const abbreviation_es_SLASH = 47; // / + +/** + * Consumes a single element node from current abbreviation stream + * @param {StringReader} stream + * @return {Node} + */ +function consumeElement(stream) { + // consume element name, if provided + const start = stream.pos; + const node = new node_es(eatName(stream)); + let next; + + while (!stream.eof()) { + if (stream.eat(DOT$1)) { + node.addClass(eatName(stream)); + } else if (stream.eat(HASH)) { + node.setAttribute('id', eatName(stream)); + } else if (stream.eat(abbreviation_es_SLASH)) { + // A self-closing indicator must be at the end of non-grouping node + if (node.isGroup) { + stream.backUp(1); + throw stream.error('Unexpected self-closing indicator'); + } + node.selfClosing = true; + if (next = consumeRepeat(stream)) { + node.repeat = next; + } + break; + } else if (next = consumeAttributes(stream)) { + for (let i = 0, il = next.length; i < il; i++) { + node.setAttribute(next[i]); + } + } else if ((next = consumeText(stream)) !== null) { + node.value = next; + } else if (next = consumeRepeat(stream)) { + node.repeat = next; + } else { + break; + } + } + + if (start === stream.pos) { + throw stream.error(`Unable to consume abbreviation node, unexpected ${stream.peek()}`); + } + + return node; +} + +function eatName(stream) { + stream.start = stream.pos; + stream.eatWhile(isName); + return stream.current(); +} + +function isName(code) { + return isAlphaNumeric(code) || code === 45 /* - */ + || code === 58 /* : */ + || code === 36 /* $ */ + || code === 64 /* @ */ + || code === 33 /* ! */ + || code === 95 /* _ */ + || code === 37 /* % */; +} + +const GROUP_START = 40; // ( +const GROUP_END = 41; // ) +const OP_SIBLING = 43; // + +const OP_CHILD = 62; // > +const OP_CLIMB = 94; // ^ + +/** + * Parses given string into a node tree + * @param {String} str Abbreviation to parse + * @return {Node} + */ +function abbreviation_es_parse(str) { + const stream = new stream_reader_es(str.trim()); + const root = new node_es(); + let ctx = root, + groupStack = [], + ch; + + while (!stream.eof()) { + ch = stream.peek(); + + if (ch === GROUP_START) { + // start of group + // The grouping node should be detached to properly handle + // out-of-bounds `^` operator. Node will be attached right on group end + const node = new node_es(); + groupStack.push([node, ctx, stream.pos]); + ctx = node; + stream.next(); + continue; + } else if (ch === GROUP_END) { + // end of group + const lastGroup = groupStack.pop(); + if (!lastGroup) { + throw stream.error('Unexpected ")" group end'); + } + + const node = lastGroup[0]; + ctx = lastGroup[1]; + stream.next(); + + // a group can have a repeater + if (node.repeat = consumeRepeat(stream)) { + ctx.appendChild(node); + } else { + // move all children of group into parent node + while (node.firstChild) { + ctx.appendChild(node.firstChild); + } + } + // for convenience, groups can be joined with optional `+` operator + stream.eat(OP_SIBLING); + + continue; + } + + const node = consumeElement(stream); + ctx.appendChild(node); + + if (stream.eof()) { + break; + } + + switch (stream.peek()) { + case OP_SIBLING: + stream.next(); + continue; + + case OP_CHILD: + stream.next(); + ctx = node; + continue; + + case OP_CLIMB: + // it’s perfectly valid to have multiple `^` operators + while (stream.eat(OP_CLIMB)) { + ctx = ctx.parent || ctx; + } + continue; + } + } + + if (groupStack.length) { + stream.pos = groupStack.pop()[2]; + throw stream.error('Expected group close'); + } + + return root; +} + +/** + * Parses given abbreviation and un-rolls it into a full tree: recursively + * replaces repeated elements with actual nodes + * @param {String} abbr + * @return {Node} + */ +function index(abbr) { + const tree = abbreviation_es_parse(abbr); + tree.walk(unroll); + return tree; +} + +function unroll(node) { + if (!node.repeat || !node.repeat.count) { + return; + } + + const parent = node.parent; + let ix = parent.children.indexOf(node); + + for (let i = 0; i < node.repeat.count; i++) { + const clone = node.clone(true); + clone.repeat.value = i + 1; + clone.walk(unroll); + + if (clone.isGroup) { + while (clone.children.length > 0) { + clone.firstChild.repeat = clone.repeat; + parent.insertAt(clone.firstChild, ix++); + } + } else { + parent.insertAt(clone, ix++); + } + } + + node.parent.removeChild(node); +} + +/* harmony default export */ var abbreviation_es = (index); +//# sourceMappingURL=abbreviation.es.js.map +// CONCATENATED MODULE: ../node_modules/@emmetio/html-snippets-resolver/dist/html-snippets-resolver.es.js +var html_snippets_resolver_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + + +/** + * For every node in given `tree`, finds matching snippet from `registry` and + * resolves it into a parsed abbreviation. Resolved node is then updated or + * replaced with matched abbreviation tree. + * + * A HTML registry basically contains aliases to another Emmet abbreviations, + * e.g. a predefined set of name, attribues and so on, possibly a complex + * abbreviation with multiple elements. So we have to get snippet, parse it + * and recursively resolve it. + * + * @param {Node} tree Parsed Emmet abbreviation + * @param {SnippetsRegistry} registry Registry with all available snippets + * @return {Node} Updated tree + */ + +var html_snippets_resolver_es_index = function (tree, registry) { + tree.walk(node => resolveNode(node, registry)); + return tree; +}; + +function resolveNode(node, registry) { + const stack = new Set(); + const resolve = node => { + const snippet = registry.resolve(node.name); + // A snippet in stack means circular reference. + // It can be either a user error or a perfectly valid snippet like + // "img": "img[src alt]/", e.g. an element with predefined shape. + // In any case, simply stop parsing and keep element as is + if (!snippet || stack.has(snippet)) { + return; + } + + // In case if matched snippet is a function, pass control into it + if (typeof snippet.value === 'function') { + return snippet.value(node, registry, resolve); + } + + const tree = abbreviation_es(snippet.value); + + stack.add(snippet); + tree.walk(resolve); + stack.delete(snippet); + + // move current node contents into new tree + const childTarget = findDeepestNode(tree); + merge(childTarget, node); + + while (tree.firstChild) { + node.parent.insertBefore(tree.firstChild, node); + } + + childTarget.parent.insertBefore(node, childTarget); + childTarget.remove(); + }; + + resolve(node); +} + +/** + * Adds data from first node into second node and returns it + * @param {Node} from + * @param {Node} to + * @return {Node} + */ +function merge(from, to) { + to.name = from.name; + + if (from.selfClosing) { + to.selfClosing = true; + } + + if (from.value != null) { + to.value = from.value; + } + + if (from.repeat) { + to.repeat = html_snippets_resolver_es__extends({}, from.repeat); + } + + return mergeAttributes(from, to); +} + +/** + * Transfer attributes from first element to second one and preserve first + * element’s attributes order + * @param {Node} from + * @param {Node} to + * @return {Node} + */ +function mergeAttributes(from, to) { + mergeClassNames(from, to); + + // It’s important to preserve attributes order: ones in `from` have higher + // pripority than in `to`. Collect attributes in map in order they should + // appear in `to` + const attrMap = new Map(); + + let attrs = from.attributes; + for (let i = 0; i < attrs.length; i++) { + attrMap.set(attrs[i].name, attrs[i].clone()); + } + + attrs = to.attributes.slice(); + for (let i = 0, attr, a; i < attrs.length; i++) { + attr = attrs[i]; + if (attrMap.has(attr.name)) { + a = attrMap.get(attr.name); + a.value = attr.value; + + // If user explicitly wrote attribute in abbreviation, it’s no longer + // implied and should be outputted even if value is empty + if (a.options.implied) { + a.options.implied = false; + } + } else { + attrMap.set(attr.name, attr); + } + + to.removeAttribute(attr); + } + + const newAttrs = Array.from(attrMap.values()); + for (let i = 0; i < newAttrs.length; i++) { + to.setAttribute(newAttrs[i]); + } + + return to; +} + +/** + * Adds class names from first node to second one + * @param {Node} from + * @param {Node} to + * @return {Node} + */ +function mergeClassNames(from, to) { + const classNames = from.classList; + for (let i = 0; i < classNames.length; i++) { + to.addClass(classNames[i]); + } + + return to; +} + +/** + * Finds node which is the deepest for in current node or node iteself. + * @param {Node} node + * @return {Node} + */ +function findDeepestNode(node) { + while (node.children.length) { + node = node.children[node.children.length - 1]; + } + + return node; +} + +/* harmony default export */ var html_snippets_resolver_es = (html_snippets_resolver_es_index); +// CONCATENATED MODULE: ../node_modules/@emmetio/implicit-tag/dist/implicit-tag.es.js +const inlineElements = new Set('a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'.split(',')); +const elementMap = { + p: 'span', + ul: 'li', + ol: 'li', + table: 'tr', + tr: 'td', + tbody: 'tr', + thead: 'tr', + tfoot: 'tr', + colgroup: 'col', + select: 'option', + optgroup: 'option', + audio: 'source', + video: 'source', + object: 'param', + map: 'area' +}; + +/** + * Returns best child node name for given parent node name + * @param {String} parentName Name of parent node + * @return {String} + */ +function resolveImplicitName(parentName) { + parentName = (parentName || '').toLowerCase(); + return elementMap[parentName] || (inlineElements.has(parentName) ? 'span' : 'div'); +} + +/* harmony default export */ var implicit_tag_es = (resolveImplicitName); +// CONCATENATED MODULE: ../node_modules/@emmetio/html-transform/dist/html-transform.es.js +var html_transform_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + + +/** + * Adds missing tag names for given tree depending on node’s parent name + */ +var implicitTags = function (tree) { + tree.walk(node => { + // resolve only nameless nodes without content + if (node.name == null && node.attributes.length) { + node.name = implicit_tag_es(node.parent.name); + } + }); + return tree; +}; + +/** + * Locates all occurances of given `token` which are not escaped (e.g. are not + * preceded with `\`) given in `str` + * @param {String} str + * @return {Array} Array of token ranges + */ +function findUnescapedTokens(str, token) { + const result = new Set(); + const tlen = token.length; + + // 1. Find all occurances of tokens + let pos = 0; + while ((pos = str.indexOf(token, pos)) !== -1) { + result.add(pos); + pos += tlen; + } + + if (result.size) { + // 2. Remove ones that escaped + let pos = 0; + const len = str.length; + + while (pos < len) { + if (str[pos++] === '\\') { + result.delete(pos++); + } + } + } + + return Array.from(result).map(ix => html_transform_es_range(ix, tlen)); +} + +/** + * Replaces `ranges`, generated by `range()` function, with given `value` in `str` + * @param {String} str Where to replace ranges + * @param {Array} ranges Ranes, created by `range()` function + * @param {String|Function} value Replacement value. If it’s a function, it + * will take a range value as argument and should return a new string + * @return {String} + */ +function replaceRanges(str, ranges, value) { + // should walk from the end of array to keep ranges valid after replacement + for (let i = ranges.length - 1; i >= 0; i--) { + const r = ranges[i]; + + let offset = 0; + let offsetLength = 0; + let descendingOrder = false; + + if (str.substr(r[0] + r[1], 1) === '@') { + if (str.substr(r[0] + r[1] + 1, 1) === '-') { + descendingOrder = true; + } + const matches = str.substr(r[0] + r[1] + 1 + Number(descendingOrder)).match(/^(\d+)/); + if (matches) { + offsetLength = matches[1].length + 1 + Number(descendingOrder); + offset = parseInt(matches[1]) - 1; + } else { + offsetLength = 2; + } + } + + str = str.substring(0, r[0]) + (typeof value === 'function' ? value(str.substr(r[0], r[1]), offset, descendingOrder) : value) + str.substring(r[0] + r[1] + offsetLength); + } + + return str; +} + +function html_transform_es_range(start, length) { + return [start, length]; +} + +const numberingToken = '$'; + +/** + * Numbering of expanded abbreviation: finds all nodes with `$` in value + * or attributes and replaces its occurances with repeater value + */ +var applyNumbering = function (tree) { + tree.walk(applyNumbering$1); + return tree; +}; + +/** + * Applies numbering for given node: replaces occurances of numbering token + * in node’s name, content and attributes + * @param {Node} node + * @return {Node} + */ +function applyNumbering$1(node) { + const repeater = findRepeater(node); + + if (repeater && repeater.value != null) { + // NB replace numbering in nodes with explicit repeater only: + // it solves issues with abbreviations like `xsl:if[test=$foo]` where + // `$foo` is preferred output + const value = repeater.value; + const count = repeater.count; + + node.name = replaceNumbering(node.name, value, count); + node.value = replaceNumbering(node.value, value, count); + node.attributes.forEach(attr => { + const copy = node.getAttribute(attr.name).clone(); + copy.name = replaceNumbering(attr.name, value, count); + copy.value = replaceNumbering(attr.value, value, count); + node.replaceAttribute(attr.name, copy); + }); + } + + return node; +} + +/** + * Returns repeater object for given node + * @param {Node} node + * @return {Object} + */ +function findRepeater(node) { + while (node) { + if (node.repeat) { + return node.repeat; + } + + node = node.parent; + } +} + +/** + * Replaces numbering in given string + * @param {String} str + * @param {Number} value + * @return {String} + */ +function replaceNumbering(str, value, count) { + // replace numbering in strings only: skip explicit wrappers that could + // contain unescaped numbering tokens + if (typeof str === 'string') { + const ranges = getNumberingRanges(str); + return replaceNumberingRanges(str, ranges, value, count); + } + + return str; +} + +/** + * Returns numbering ranges, e.g. ranges of `$` occurances, in given string. + * Multiple adjacent ranges are combined + * @param {String} str + * @return {Array} + */ +function getNumberingRanges(str) { + return findUnescapedTokens(str || '', numberingToken).reduce((out, range$$1) => { + // skip ranges that actually belongs to output placeholder or tabstops + if (!/[#{]/.test(str[range$$1[0] + 1] || '')) { + const lastRange = out[out.length - 1]; + if (lastRange && lastRange[0] + lastRange[1] === range$$1[0]) { + lastRange[1] += range$$1[1]; + } else { + out.push(range$$1); + } + } + + return out; + }, []); +} + +/** + * @param {String} str + * @param {Array} ranges + * @param {Number} value + * @return {String} + */ +function replaceNumberingRanges(str, ranges, value, count) { + const replaced = replaceRanges(str, ranges, (token, offset, descendingOrder) => { + let _value = descendingOrder ? String(offset + count - value + 1) : String(value + offset); + // pad values for multiple numbering tokens, e.g. 3 for $$$ becomes 003 + while (_value.length < token.length) { + _value = '0' + _value; + } + return _value; + }); + + // unescape screened numbering tokens + return unescapeString(replaced); +} + +/** + * Unescapes characters, screened with `\`, in given string + * @param {String} str + * @return {String} + */ +function unescapeString(str) { + let i = 0, + result = ''; + const len = str.length; + + while (i < len) { + const ch = str[i++]; + result += ch === '\\' ? str[i++] || '' : ch; + } + + return result; +} + +/** Placeholder for inserted content */ +const placeholder = '$#'; + +/** Placeholder for caret */ +const caret = '|'; + +const reUrl = /^((?:https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/; +const reEmail = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/; +const reProto = /^([a-z]+:)?\/\//i; + +/** + * Inserts content into node with implicit repeat count: this node is then + * duplicated for each content item and content itself is inserted either into + * deepest child or instead of a special token. + * + * This method uses two distinct steps: `prepare()` and `insert()` since most + * likely these steps will be used separately to properly insert content + * with unescaped `$` numbering markers. + * + * @param {Node} tree Parsed abbreviation + * @param {String[]} content Array of content items to insert + * @return {Node} + */ +/** + * Finds nodes with implicit repeat and creates `amount` copies of it in tree + * @param {Node} tree + * @param {Number} amount + * @return {Node} + */ +function prepare(tree, amount) { + amount = amount || 1; + tree.walk(node => { + if (node.repeat && node.repeat.count === null) { + for (let i = 0; i < amount; i++) { + const clone = node.clone(true); + clone.repeat.implicit = true; + clone.repeat.count = amount; + clone.repeat.value = i + 1; + clone.repeat.index = i; + node.parent.insertBefore(clone, node); + } + + node.remove(); + } + }); + + return tree; +} + +/** + * Inserts content into implicitly repeated nodes, created by `prepare()` method + * @param {Node} tree + * @param {String[]} content + * @return {Node} + */ +function insert(tree, content) { + if (Array.isArray(content) && content.length) { + let updated = false; + tree.walk(node => { + if (node.repeat && node.repeat.implicit) { + updated = true; + insertContent(node, content[node.repeat.index]); + } + }); + + if (!updated) { + // no node with implicit repeat was found, insert content as + // deepest child + setNodeContent(html_transform_es_findDeepestNode(tree), content.join('\n')); + } + } + + return tree; +} + +/** + * Inserts `content` into given `node`: either replaces output placeholders + * or inserts it into deepest child node + * @param {Node} node + * @param {String} content + * @return {Node} + */ +function insertContent(node, content) { + let inserted = insertContentIntoPlaceholder(node, content); + node.walk(child => inserted |= insertContentIntoPlaceholder(child, content)); + + if (!inserted) { + // no placeholders were found in node, insert content into deepest child + setNodeContent(html_transform_es_findDeepestNode(node), content); + } + + return node; +} + +/** + * Inserts given `content` into placeholders for given `node`. Placeholders + * might be available in attribute values and node content + * @param {Node} node + * @param {String} content + * @return {Boolean} Returns `true` if placeholders were found and replaced in node + */ +function insertContentIntoPlaceholder(node, content) { + const state = { replaced: false }; + + node.value = replacePlaceholder(node.value, content, state); + node.attributes.forEach(attr => { + if (attr.value) { + node.setAttribute(attr.name, replacePlaceholder(attr.value, content, state)); + } + }); + + return state.replaced; +} + +/** + * Replaces all placeholder occurances in given `str` with `value` + * @param {String} str + * @param {String} value + * @param {Object} [_state] If provided, set `replaced` property of given + * object to `true` if placeholder was found and replaced + * @return {String} + */ +function replacePlaceholder(str, value, _state) { + if (typeof str === 'string') { + const ranges = findUnescapedTokens(str, placeholder); + if (ranges.length) { + if (_state) { + _state.replaced = true; + } + + str = replaceRanges(str, ranges, value); + } + } + + return str; +} + +/** + * Finds node which is the deepest for in current node or node iteself. + * @param {Node} node + * @return {Node} + */ +function html_transform_es_findDeepestNode(node) { + while (node.children.length) { + node = node.children[node.children.length - 1]; + } + + return node; +} + +/** + * Updates content of given node + * @param {Node} node + * @param {String} content + */ +function setNodeContent(node, content) { + // find caret position and replace it with content, if possible + if (node.value) { + const ranges = findUnescapedTokens(node.value, caret); + if (ranges.length) { + node.value = replaceRanges(node.value, ranges, content); + return; + } + } + + if (node.name.toLowerCase() === 'a' || node.hasAttribute('href')) { + // special case: inserting content into `` tag + if (reUrl.test(content)) { + node.setAttribute('href', (reProto.test(content) ? '' : 'http://') + content); + } else if (reEmail.test(content)) { + node.setAttribute('href', 'mailto:' + content); + } + } + + node.value = content; +} + +const html_transform_es_defaultOptions = { + element: '__', + modifier: '_' +}; + +const reElement = /^(-+)([a-z0-9]+[a-z0-9-]*)/i; +const reModifier = /^(_+)([a-z0-9]+[a-z0-9-_]*)/i; +const blockCandidates1 = className => /^[a-z]\-/i.test(className); +const blockCandidates2 = className => /^[a-z]/i.test(className); + +/** + * BEM transformer: updates class names written as `-element` and + * `_modifier` into full class names as described in BEM specs. Also adds missing + * class names: fir example, if node contains `.block_modifier` class, ensures + * that element contains `.block` class as well + */ +var bem = function (tree, options) { + options = html_transform_es__extends({}, html_transform_es_defaultOptions, options); + + tree.walk(node => expandClassNames(node, options)); + + const lookup = createBlockLookup(tree); + tree.walk(node => expandShortNotation(node, lookup, options)); + + return tree; +}; + +/** + * Expands existing class names in BEM notation in given `node`. + * For example, if node contains `b__el_mod` class name, this method ensures + * that element contains `b__el` class as well + * @param {Node} node + * @param {Object} options + * @return {Set} + */ +function expandClassNames(node, options) { + const classNames = node.classList.reduce((out, cl) => { + // remove all modifiers and element prefixes from class name to get a base element name + const ix = cl.indexOf('_'); + if (ix > 0 && !cl.startsWith('-')) { + out.add(cl.slice(0, ix)); + out.add(cl.slice(ix)); + return out; + } + + return out.add(cl); + }, new Set()); + + if (classNames.size) { + node.setAttribute('class', Array.from(classNames).join(' ')); + } +} + +/** + * Expands short BEM notation, e.g. `-element` and `_modifier` + * @param {Node} node Parsed Emmet abbreviation node + * @param {Map} lookup BEM block name lookup + * @param {Object} options + */ +function expandShortNotation(node, lookup, options) { + const classNames = node.classList.reduce((out, cl) => { + let prefix, m; + const originalClass = cl; + + // parse element definition (could be only one) + if (m = cl.match(reElement)) { + prefix = getBlockName(node, lookup, m[1]) + options.element + m[2]; + out.add(prefix); + cl = cl.slice(m[0].length); + } + + // parse modifiers definitions + if (m = cl.match(reModifier)) { + if (!prefix) { + prefix = getBlockName(node, lookup, m[1]); + out.add(prefix); + } + + out.add(`${prefix}${options.modifier}${m[2]}`); + cl = cl.slice(m[0].length); + } + + if (cl === originalClass) { + // class name wasn’t modified: it’s not a BEM-specific class, + // add it as-is into output + out.add(originalClass); + } + + return out; + }, new Set()); + + const arrClassNames = Array.from(classNames).filter(Boolean); + if (arrClassNames.length) { + node.setAttribute('class', arrClassNames.join(' ')); + } +} + +/** + * Creates block name lookup for each node in given tree, e.g. finds block + * name explicitly for each node + * @param {Node} tree + * @return {Map} + */ +function createBlockLookup(tree) { + const lookup = new Map(); + + tree.walk(node => { + const classNames = node.classList; + if (classNames.length) { + // guess best block name from class or use parent’s block name + lookup.set(node, find(classNames, blockCandidates1) || find(classNames, blockCandidates2) || lookup.get(node.parent)); + } + }); + + return lookup; +} + +/** + * Returns block name for given `node` by `prefix`, which tells the depth of + * of parent node lookup + * @param {Node} node + * @param {Map} lookup + * @param {String} prefix + * @return {String} + */ +function getBlockName(node, lookup, prefix) { + let depth = prefix.length > 1 ? prefix.length : 0; + + // NB don’t walk up to root node, stay at first root child in case of + // too deep prefix + while (node.parent && node.parent.parent && depth--) { + node = node.parent; + } + + return lookup.get(node) || ''; +} + +function find(arr, filter) { + for (let i = 0; i < arr.length; i++) { + if (reElement.test(arr[i]) || reModifier.test(arr[i])) { + break; + } + if (filter(arr[i])) { + return arr[i]; + } + } +} + +/** + * JSX transformer: replaces `class` and `for` attributes with `className` and + * `htmlFor` attributes respectively + */ +var jsx = function (tree) { + tree.walk(node => { + replace(node, 'class', 'className'); + replace(node, 'for', 'htmlFor'); + }); + return tree; +}; + +function replace(node, oldName, newName) { + let attr = node.getAttribute(oldName); + if (attr) { + attr.name = newName; + } +} + +const reSupporterNames = /^xsl:(variable|with\-param)$/i; + +/** + * XSL transformer: removes `select` attributes from certain nodes that contain + * children + */ +var xsl = function (tree) { + tree.walk(node => { + if (reSupporterNames.test(node.name || '') && (node.children.length || node.value)) { + node.removeAttribute('select'); + } + }); + return tree; +}; + +const supportedAddons = { bem, jsx, xsl }; + +/** + * Runs additional transforms on given tree. + * These transforms may introduce side-effects and unexpected result + * so they are not applied by default, authors must specify which addons + * in `addons` argument as `{addonName: addonOptions}` + * @param {Node} tree Parsed Emmet abbreviation + * @param {Object} addons Add-ons to apply and their options + */ +var addons = function (tree, addons) { + Object.keys(addons || {}).forEach(key => { + if (key in supportedAddons) { + const addonOpt = typeof addons[key] === 'object' ? addons[key] : null; + tree = tree.use(supportedAddons[key], addonOpt); + } + }); + + return tree; +}; + +/** + * Applies basic HTML-specific transformations for given parsed abbreviation: + * – resolve implied tag names + * – insert repeated content + * – resolve node numbering + */ +var html_transform_es_index = function (tree, content, appliedAddons) { + if (typeof content === 'string') { + content = [content]; + } else if (content && typeof content === 'object' && !Array.isArray(content)) { + appliedAddons = content; + content = null; + } + + return tree.use(implicitTags).use(prepare, Array.isArray(content) ? content.length : null).use(applyNumbering).use(insert, content).use(addons, appliedAddons); +}; + +/* harmony default export */ var html_transform_es = (html_transform_es_index); +// CONCATENATED MODULE: ../node_modules/@emmetio/variable-resolver/dist/variable-resolver.es.js +/** + * Replaces all unescaped ${variable} occurances in given parsed abbreviation + * `tree` with values provided in `variables` hash. Precede `$` with `\` to + * escape it and skip replacement + * @param {Node} tree Parsed abbreviation tree + * @param {Object} variables Variables values + * @return {Node} + */ +function replaceVariables(tree, variables) { + variables = variables || {}; + tree.walk(node => replaceInNode(node, variables)); + return tree; +} + +function replaceInNode(node, variables) { + // Replace variables in attributes. + const attrs = node.attributes; + + for (let i = 0, il = attrs.length; i < il; i++) { + const attr = attrs[i]; + if (typeof attr.value === 'string') { + node.setAttribute(attr.name, replaceInString(attr.value, variables)); + } + } + + if (node.value != null) { + node.value = replaceInString(node.value, variables); + } + + return node; +} + +/** + * Replaces all unescaped `${variable}` occurances in given string with values + * from `variables` object + * @param {String} string + * @param {Object} variables + * @return {String} + */ +function replaceInString(string, variables) { + const model = createModel(string); + let offset = 0; + let output = ''; + + for (let i = 0, il = model.variables.length; i < il; i++) { + const v = model.variables[i]; + let value = v.name in variables ? variables[v.name] : v.name; + if (typeof value === 'function') { + value = value(model.string, v, offset + v.location); + } + + output += model.string.slice(offset, v.location) + value; + offset = v.location + v.length; + } + + return output + model.string.slice(offset); +} + +/** + * Creates variable model from given string. The model contains a `string` with + * all escaped variable tokens written without escape symbol and `variables` + * property with all unescaped variables and their ranges + * @param {String} string + * @return {Object} + */ +function createModel(string) { + const reVariable = /\$\{([a-z][\w\-]*)\}/ig; + const escapeCharCode = 92; // `\` symbol + const variables = []; + + // We have to replace unescaped (e.g. not preceded with `\`) tokens. + // Instead of writing a stream parser, we’ll cut some edges here: + // 1. Find all tokens + // 2. Walk string char-by-char and resolve only tokens that are not escaped + const tokens = new Map(); + let m; + while (m = reVariable.exec(string)) { + tokens.set(m.index, m); + } + + if (tokens.size) { + let start = 0, + pos = 0, + len = string.length; + let output = ''; + while (pos < len) { + if (string.charCodeAt(pos) === escapeCharCode && tokens.has(pos + 1)) { + // Found escape symbol that escapes variable: we should + // omit this symbol in output string and skip variable + const token = tokens.get(pos + 1); + output += string.slice(start, pos) + token[0]; + start = pos = token.index + token[0].length; + tokens.delete(pos + 1); + continue; + } + + pos++; + } + + string = output + string.slice(start); + + // Not using `.map()` here to reduce memory allocations + const validMatches = Array.from(tokens.values()); + for (let i = 0, il = validMatches.length; i < il; i++) { + const token = validMatches[i]; + variables.push({ + name: token[1], + location: token.index, + length: token[0].length + }); + } + } + + return { string, variables }; +} + +/* harmony default export */ var variable_resolver_es = (replaceVariables); +// CONCATENATED MODULE: ../node_modules/@emmetio/output-renderer/dist/output-renderer.es.js +var output_renderer_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + + +const defaultFieldsRenderer = text => text; + +/** + * Output node is an object containing generated output for given Emmet + * abbreviation node. Output node can be passed to various processors that + * may shape-up final node output. The final output is simply a concatenation + * of `.open`, `.text` and `.close` properties and its `.before*` and `.after*` + * satellites + * @param {Node} node Parsed Emmet abbreviation node + * @param {Function} fieldsRenderer A function for rendering fielded text (text with + * tabstops) for current node. @see ./render.js for details + */ +let OutputNode = class OutputNode { + constructor(node, fieldsRenderer, options) { + if (typeof fieldsRenderer === 'object') { + options = fieldsRenderer; + fieldsRenderer = null; + } + + this.node = node; + this._fieldsRenderer = fieldsRenderer || defaultFieldsRenderer; + + this.open = null; + this.beforeOpen = ''; + this.afterOpen = ''; + + this.close = null; + this.beforeClose = ''; + this.afterClose = ''; + + this.text = null; + this.beforeText = ''; + this.afterText = ''; + + this.indent = ''; + this.newline = ''; + + if (options) { + output_renderer_es__extends(this, options); + } + } + + clone() { + return new this.constructor(this.node, this); + } + + /** + * Properly indents given multiline text + * @param {String} text + */ + indentText(text) { + const lines = splitByLines(text); + if (lines.length === 1) { + // no newlines, nothing to indent + return text; + } + + // No newline and no indent means no formatting at all: + // in this case we should replace newlines with spaces + const nl = !this.newline && !this.indent ? ' ' : this.newline; + return lines.map((line, i) => i ? this.indent + line : line).join(nl); + } + + /** + * Renders given text with fields + * @param {String} text + * @return {String} + */ + renderFields(text) { + return this._fieldsRenderer(text); + } + + toString(children) { + const open = this._wrap(this.open, this.beforeOpen, this.afterOpen); + const close = this._wrap(this.close, this.beforeClose, this.afterClose); + const text = this._wrap(this.text, this.beforeText, this.afterText); + + return open + text + (children != null ? children : '') + close; + } + + _wrap(str, before, after) { + before = before != null ? before : ''; + after = after != null ? after : ''; + + // automatically trim whitespace for non-empty wraps + if (str != null) { + str = before ? str.replace(/^\s+/, '') : str; + str = after ? str.replace(/\s+$/, '') : str; + return before + this.indentText(str) + after; + } + + return ''; + } +}; + +/** + * Splits given text by lines + * @param {String} text + * @return {String[]} + */ + +function splitByLines(text) { + return (text || '').split(/\r\n|\r|\n/g); +} + +/** + * Default output of field (tabstop) + * @param {Number} index Field index + * @param {String} placeholder Field placeholder, can be null + * @return {String} + */ +const defaultField = (index, placeholder) => placeholder || ''; + +/** + * Renders given parsed abbreviation `tree` via `formatter` function. + + * @param {Node} tree Parsed Emmet abbreviation + * @param {Function} [field] Optional function to format field/tabstop (@see `defaultField`) + * @param {Function} formatter Output formatter function. It takes an output node— + * a special wrapper for parsed node that holds formatting and output properties— + * and updates its output properties to shape-up node’s output. + * Function arguments: + * – `outNode`: OutputNode + * – `renderFields`: a helper function that parses fields/tabstops from given + * text and replaces them with `field` function output. + * It also takes care about field indicies and ensures that the same indicies + * from different nodes won’t collide + */ +function render(tree, field, formatter) { + if (typeof formatter === 'undefined') { + formatter = field; + field = null; + } + + field = field || defaultField; + + // Each node may contain fields like `${1:placeholder}`. + // Since most modern editors will link all fields with the same + // index, we have to ensure that different nodes has their own indicies. + // We’ll use this `fieldState` object to globally increment field indices + // during output + const fieldState = { index: 1 }; + + const fieldsRenderer = text => text == null ? field(fieldState.index++) : getFieldsModel(text, fieldState).mark(field); + + return run(tree.children, formatter, fieldsRenderer); +} + +function run(nodes, formatter, fieldsRenderer) { + return nodes.map(node => { + const outNode = formatter(new OutputNode(node, fieldsRenderer)); + return outNode ? outNode.toString(run(node.children, formatter, fieldsRenderer)) : ''; + }).join(''); +} + +/** + * Returns fields (tab-stops) model with properly updated indices that won’t + * collide with fields in other nodes of foprmatted tree + * @param {String|Object} text Text to get fields model from or model itself + * @param {Object} fieldState Abbreviation tree-wide field state reference + * @return {Object} Field model + */ +function getFieldsModel(text, fieldState) { + const model = typeof text === 'object' ? text : field_parser_es(text); + let largestIndex = -1; + + model.fields.forEach(field => { + field.index += fieldState.index; + if (field.index > largestIndex) { + largestIndex = field.index; + } + }); + + if (largestIndex !== -1) { + fieldState.index = largestIndex + 1; + } + + return model; +} + +/* harmony default export */ var output_renderer_es = (render); +// CONCATENATED MODULE: ../node_modules/@emmetio/markup-formatters/dist/markup-formatters.es.js +var markup_formatters_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + + + +const TOKEN = /^(.*?)([A-Z_]+)(.*?)$/; +const TOKEN_OPEN = 91; // [ +const TOKEN_CLOSE = 93; // ] + +/** + * A basic templating engine. + * Takes every `[TOKEN]` from given string and replaces it with + * `TOKEN` value from given `data` attribute. The token itself may contain + * various characters between `[`, token name and `]`. Contents of `[...]` will + * be outputted only if `TOKEN` value is not empty. Also, only `TOKEN` name will + * be replaced with actual value, all other characters will remain as is. + * + * Example: + * ``` + * template('[]', {NAME: 'foo'}) -> "" + * template('[]', {}) -> "" + * ``` + */ +function template(str, data) { + if (str == null) { + return str; + } + + // NB since token may contain inner `[` and `]`, we can’t just use regexp + // for replacement, should manually parse string instead + const stack = []; + const replacer = (str, left, token, right) => data[token] != null ? left + data[token] + right : ''; + + let output = ''; + let offset = 0, + i = 0; + let code, lastPos; + + while (i < str.length) { + code = str.charCodeAt(i); + if (code === TOKEN_OPEN) { + stack.push(i); + } else if (code === TOKEN_CLOSE) { + lastPos = stack.pop(); + if (!stack.length) { + output += str.slice(offset, lastPos) + str.slice(lastPos + 1, i).replace(TOKEN, replacer); + offset = i + 1; + } + } + + i++; + } + + return output + str.slice(offset); +} + +/** + * Various utility methods used by formatters + */ + +/** + * Splits given text by lines + * @param {String} text + * @return {String[]} + */ +function markup_formatters_es_splitByLines(text) { + return (text || '').split(/\r\n|\r|\n/g); +} + +/** + * Check if given node is a first child in its parent + * @param {Node} node + * @return {Boolean} + */ +function isFirstChild(node) { + return node.parent.firstChild === node; +} + +/** + * Check if given node is a root node + * @param {Node} node + * @return {Boolean} + */ +function isRoot(node) { + return node && !node.parent; +} + +/** + * Check if given node is a pseudo-snippet: a text-only node with explicitly + * defined children + * @param {Node} node + * @return {Boolean} + */ +function isPseudoSnippet(node) { + return node.isTextOnly && !!node.children.length; +} + +/** + * Handles pseudo-snippet node. + * A pseudo-snippet is a text-only node with explicitly defined children. + * For such case, we have to figure out if pseudo-snippet contains fields + * (tab-stops) in node value and “split” it: make contents before field with + * lowest index node’s “open” part and contents after lowest index — “close” + * part. With this trick a final output will look like node’s children + * are nested inside node value + * @param {OutputNode} outNode + * @return {Boolean} Returns “true” if given node is a pseudo-snippets, + * `false` otherwise + */ +function handlePseudoSnippet(outNode) { + const node = outNode.node; // original abbreviaiton node + + if (isPseudoSnippet(node)) { + const fieldsModel = field_parser_es(node.value); + const field = findLowestIndexField(fieldsModel); + if (field) { + const parts = splitFieldsModel(fieldsModel, field); + outNode.open = outNode.renderFields(parts[0]); + outNode.close = outNode.renderFields(parts[1]); + } else { + outNode.text = outNode.renderFields(fieldsModel); + } + + return true; + } + + return false; +} + +/** + * Finds field with lowest index in given text + * @param {Object} model + * @return {Object} + */ +function findLowestIndexField(model) { + return model.fields.reduce((result, field) => !result || field.index < result.index ? field : result, null); +} + +/** + * Splits given fields model in two parts by given field + * @param {Object} model + * @param {Object} field + * @return {Array} Two-items array + */ +function splitFieldsModel(model, field) { + const ix = model.fields.indexOf(field); + + const left = new model.constructor(model.string.slice(0, field.location), model.fields.slice(0, ix)); + + const right = new model.constructor(model.string.slice(field.location + field.length), model.fields.slice(ix + 1)); + + return [left, right]; +} + +const commentOptions = { + // enable node commenting + enabled: false, + + // attributes that should trigger node commenting on specific node, + // if commenting is enabled + trigger: ['id', 'class'], + + // comment before opening tag + before: '', + + // comment after closing tag + after: '\n' +}; + +/** + * Renders given parsed Emmet abbreviation as HTML, formatted according to + * `profile` options + * @param {Node} tree Parsed Emmet abbreviation + * @param {Profile} profile Output profile + * @param {Object} [options] Additional formatter options + * @return {String} + */ +function html(tree, profile, options) { + options = markup_formatters_es__extends({}, options); + const format = getFormatOptions(options); + + return output_renderer_es(tree, options.field, outNode => { + outNode = setFormatting(outNode, profile); + + if (!handlePseudoSnippet(outNode)) { + const node = outNode.node; + + if (node.name) { + const name = profile.name(node.name); + const attrs = formatAttributes(outNode, profile); + + outNode.open = `<${name}${attrs}${node.selfClosing ? profile.selfClose() : ''}>`; + if (!node.selfClosing) { + outNode.close = ``; + } + + commentNode(outNode, format.comment); + } + + // Do not generate fields for nodes with empty value and children + // or if node is self-closed + if (node.value || !node.children.length && !node.selfClosing) { + outNode.text = outNode.renderFields(node.value); + } + } + + return outNode; + }); +} + +/** + * Updates formatting properties for given output node + * @param {OutputNode} outNode Output wrapper of farsed abbreviation node + * @param {Profile} profile Output profile + * @return {OutputNode} + */ +function setFormatting(outNode, profile) { + const node = outNode.node; + + if (shouldFormatNode(node, profile)) { + outNode.indent = profile.indent(getIndentLevel(node, profile)); + outNode.newline = '\n'; + const prefix = outNode.newline + outNode.indent; + + // do not format the very first node in output + if (!isRoot(node.parent) || !isFirstChild(node)) { + outNode.beforeOpen = prefix; + if (node.isTextOnly) { + outNode.beforeText = prefix; + } + } + + if (hasInnerFormatting(node, profile)) { + if (!node.isTextOnly) { + outNode.beforeText = prefix + profile.indent(1); + } + outNode.beforeClose = prefix; + } + } + + return outNode; +} + +/** + * Check if given node should be formatted + * @param {Node} node + * @param {Profile} profile + * @return {Boolean} + */ +function shouldFormatNode(node, profile) { + if (!profile.get('format')) { + return false; + } + + if (node.parent.isTextOnly && node.parent.children.length === 1 && field_parser_es(node.parent.value).fields.length) { + // Edge case: do not format the only child of text-only node, + // but only if parent contains fields + return false; + } + + return isInline(node, profile) ? shouldFormatInline(node, profile) : true; +} + +/** + * Check if given inline node should be formatted as well, e.g. it contains + * enough adjacent siblings that should force formatting + * @param {Node} node + * @param {Profile} profile + * @return {Boolean} + */ +function shouldFormatInline(node, profile) { + if (!isInline(node, profile)) { + return false; + } + + if (isPseudoSnippet(node)) { + return true; + } + + // check if inline node is the next sibling of block-level node + if (node.childIndex === 0) { + // first node in parent: format if it’s followed by a block-level element + let next = node; + while (next = next.nextSibling) { + if (!isInline(next, profile)) { + return true; + } + } + } else if (!isInline(node.previousSibling, profile)) { + // node is right after block-level element + return true; + } + + if (profile.get('inlineBreak')) { + // check for adjacent inline elements before and after current element + let adjacentInline = 1; + let before = node, + after = node; + + while (isInlineElement(before = before.previousSibling, profile)) { + adjacentInline++; + } + + while (isInlineElement(after = after.nextSibling, profile)) { + adjacentInline++; + } + + if (adjacentInline >= profile.get('inlineBreak')) { + return true; + } + } + + // Another edge case: inline node contains node that should receive foramtting + for (let i = 0, il = node.children.length; i < il; i++) { + if (shouldFormatNode(node.children[i], profile)) { + return true; + } + } + + return false; +} + +/** + * Check if given node contains inner formatting, e.g. any of its children should + * be formatted + * @param {Node} node + * @param {Profile} profile + * @return {Boolean} + */ +function hasInnerFormatting(node, profile) { + // check if node if forced for inner formatting + const nodeName = (node.name || '').toLowerCase(); + if (profile.get('formatForce').indexOf(nodeName) !== -1) { + return true; + } + + // check if any of children should receive formatting + // NB don’t use `childrent.some()` to reduce memory allocations + for (let i = 0; i < node.children.length; i++) { + if (shouldFormatNode(node.children[i], profile)) { + return true; + } + } + + return false; +} + +/** + * Outputs attributes of given abbreviation node as HTML attributes + * @param {OutputNode} outNode + * @param {Profile} profile + * @return {String} + */ +function formatAttributes(outNode, profile) { + const node = outNode.node; + + return node.attributes.map(attr => { + if (attr.options.implied && attr.value == null) { + return null; + } + + const attrName = profile.attribute(attr.name); + let attrValue = null; + + // handle boolean attributes + if (attr.options.boolean || profile.get('booleanAttributes').indexOf(attrName.toLowerCase()) !== -1) { + if (profile.get('compactBooleanAttributes') && attr.value == null) { + return ` ${attrName}`; + } else if (attr.value == null) { + attrValue = attrName; + } + } + + if (attrValue == null) { + attrValue = outNode.renderFields(attr.value); + } + + return ` ${attrName}=${profile.quote(attrValue)}`; + }).join(''); +} + +/** + * Check if given node is inline-level + * @param {Node} node + * @param {Profile} profile + * @return {Boolean} + */ +function isInline(node, profile) { + return node && node.isTextOnly || isInlineElement(node, profile); +} + +/** + * Check if given node is inline-level element, e.g. element with explicitly + * defined node name + * @param {Node} node + * @param {Profile} profile + * @return {Boolean} + */ +function isInlineElement(node, profile) { + return node && profile.isInline(node); +} + +/** + * Computes indent level for given node + * @param {Node} node + * @param {Profile} profile + * @param {Number} level + * @return {Number} + */ +function getIndentLevel(node, profile) { + // Increase indent level IF NOT: + // * parent is text-only node + // * there’s a parent node with a name that is explicitly set to decrease level + const skip = profile.get('formatSkip') || []; + let level = node.parent.isTextOnly ? -2 : -1; + let ctx = node; + while (ctx = ctx.parent) { + if (skip.indexOf((ctx.name || '').toLowerCase()) === -1) { + level++; + } + } + + return level < 0 ? 0 : level; +} + +/** + * Comments given output node, if required + * @param {OutputNode} outNode + * @param {Object} options + */ +function commentNode(outNode, options) { + const node = outNode.node; + + if (!options.enabled || !options.trigger || !node.name) { + return; + } + + const attrs = outNode.node.attributes.reduce((out, attr) => { + if (attr.name && attr.value != null) { + out[attr.name.toUpperCase().replace(/-/g, '_')] = attr.value; + } + + return out; + }, {}); + + // add comment only if attribute trigger is present + for (let i = 0, il = options.trigger.length; i < il; i++) { + if (options.trigger[i].toUpperCase() in attrs) { + outNode.open = template(options.before, attrs) + outNode.open; + if (outNode.close) { + outNode.close += template(options.after, attrs); + } + break; + } + } +} + +function getFormatOptions(options) { + const format = markup_formatters_es__extends({}, options && options.format); + format.comment = markup_formatters_es__extends({}, commentOptions, format.comment); + return format; +} + +const reId = /^id$/i; +const reClass = /^class$/i; +const defaultAttrOptions = { + primary: attrs => attrs.join(''), + secondary: attrs => attrs.map(attr => attr.isBoolean ? attr.name : `${attr.name}=${attr.value}`).join(', ') +}; + +const defaultNodeOptions = { + open: null, + close: null, + omitName: /^div$/i, + attributes: defaultAttrOptions +}; + +function indentFormat(outNode, profile, options) { + options = markup_formatters_es__extends({}, defaultNodeOptions, options); + const node = outNode.node; + + outNode.indent = profile.indent(getIndentLevel$1(node, profile)); + outNode.newline = '\n'; + + // Do not format the very first node in output + if (!isRoot(node.parent) || !isFirstChild(node)) { + outNode.beforeOpen = outNode.newline + outNode.indent; + } + + if (node.name) { + const data = markup_formatters_es__extends({ + NAME: profile.name(node.name), + SELF_CLOSE: node.selfClosing ? options.selfClose : null + }, getAttributes(outNode, profile, options.attributes)); + + // omit tag name if node has primary attributes + if (options.omitName && options.omitName.test(data.NAME) && data.PRIMARY_ATTRS) { + data.NAME = null; + } + + if (options.open != null) { + outNode.open = template(options.open, data); + } + + if (options.close != null) { + outNode.close = template(options.close, data); + } + } + + return outNode; +} + +/** + * Formats attributes of given node into a string. + * @param {OutputNode} node Output node wrapper + * @param {Profile} profile Output profile + * @param {Object} options Additional formatting options + * @return {String} + */ +function getAttributes(outNode, profile, options) { + options = markup_formatters_es__extends({}, defaultAttrOptions, options); + const primary = [], + secondary = []; + const node = outNode.node; + + node.attributes.forEach(attr => { + if (attr.options.implied && attr.value == null) { + return null; + } + + const name = profile.attribute(attr.name); + const value = outNode.renderFields(attr.value); + + if (reId.test(name)) { + value && primary.push(`#${value}`); + } else if (reClass.test(name)) { + value && primary.push(`.${value.replace(/\s+/g, '.')}`); + } else { + const isBoolean = attr.value == null && (attr.options.boolean || profile.get('booleanAttributes').indexOf(name.toLowerCase()) !== -1); + + secondary.push({ name, value, isBoolean }); + } + }); + + return { + PRIMARY_ATTRS: options.primary(primary) || null, + SECONDARY_ATTRS: options.secondary(secondary) || null + }; +} + +/** + * Computes indent level for given node + * @param {Node} node + * @return {Number} + */ +function getIndentLevel$1(node) { + let level = node.parent.isTextOnly ? -2 : -1; + let ctx = node; + while (ctx = ctx.parent) { + level++; + } + + return level < 0 ? 0 : level; +} + +const reNl = /\n|\r/; + +/** + * Renders given parsed Emmet abbreviation as HAML, formatted according to + * `profile` options + * @param {Node} tree Parsed Emmet abbreviation + * @param {Profile} profile Output profile + * @param {Object} [options] Additional formatter options + * @return {String} + */ +function haml(tree, profile, options) { + options = options || {}; + const nodeOptions = { + open: '[%NAME][PRIMARY_ATTRS][(SECONDARY_ATTRS)][SELF_CLOSE]', + selfClose: '/', + attributes: { + secondary(attrs) { + return attrs.map(attr => attr.isBoolean ? `${attr.name}${profile.get('compactBooleanAttributes') ? '' : '=true'}` : `${attr.name}=${profile.quote(attr.value)}`).join(' '); + } + } + }; + + return output_renderer_es(tree, options.field, outNode => { + outNode = indentFormat(outNode, profile, nodeOptions); + outNode = updateFormatting(outNode, profile); + + if (!handlePseudoSnippet(outNode)) { + const node = outNode.node; + + // Do not generate fields for nodes with empty value and children + // or if node is self-closed + if (node.value || !node.children.length && !node.selfClosing) { + outNode.text = outNode.renderFields(formatNodeValue(node, profile)); + } + } + + return outNode; + }); +} + +/** + * Updates formatting properties for given output node + * NB Unlike HTML, HAML is indent-based format so some formatting options from + * `profile` will not take effect, otherwise output will be broken + * @param {OutputNode} outNode Output wrapper of parsed abbreviation node + * @param {Profile} profile Output profile + * @return {OutputNode} + */ +function updateFormatting(outNode, profile) { + const node = outNode.node; + + if (!node.isTextOnly && node.value) { + // node with text: put a space before single-line text + outNode.beforeText = reNl.test(node.value) ? outNode.newline + outNode.indent + profile.indent(1) : ' '; + } + + return outNode; +} +/** + * Formats value of given node: for multiline text we should add a ` |` suffix + * at the end of each line. Also ensure that text is perfectly aligned. + * @param {Node} node + * @param {Profile} profile + * @return {String|null} + */ +function formatNodeValue(node, profile) { + if (node.value != null && reNl.test(node.value)) { + const lines = markup_formatters_es_splitByLines(node.value); + const indent = profile.indent(1); + const maxLength = lines.reduce((prev, line) => Math.max(prev, line.length), 0); + + return lines.map((line, i) => `${i ? indent : ''}${pad(line, maxLength)} |`).join('\n'); + } + + return node.value; +} + +function pad(text, len) { + while (text.length < len) { + text += ' '; + } + + return text; +} + +const reNl$1 = /\n|\r/; +const secondaryAttrs = { + none: '[ SECONDARY_ATTRS]', + round: '[(SECONDARY_ATTRS)]', + curly: '[{SECONDARY_ATTRS}]', + square: '[[SECONDARY_ATTRS]' +}; + +/** + * Renders given parsed Emmet abbreviation as Slim, formatted according to + * `profile` options + * @param {Node} tree Parsed Emmet abbreviation + * @param {Profile} profile Output profile + * @param {Object} [options] Additional formatter options + * @return {String} + */ +function slim(tree, profile, options) { + options = options || {}; + const SECONDARY_ATTRS = options.attributeWrap && secondaryAttrs[options.attributeWrap] || secondaryAttrs.none; + + const booleanAttr = SECONDARY_ATTRS === secondaryAttrs.none ? attr => `${attr.name}=true` : attr => attr.name; + + const nodeOptions = { + open: `[NAME][PRIMARY_ATTRS]${SECONDARY_ATTRS}[SELF_CLOSE]`, + selfClose: '/', + attributes: { + secondary(attrs) { + return attrs.map(attr => attr.isBoolean ? booleanAttr(attr) : `${attr.name}=${profile.quote(attr.value)}`).join(' '); + } + } + }; + + return output_renderer_es(tree, options.field, outNode => { + outNode = indentFormat(outNode, profile, nodeOptions); + outNode = updateFormatting$1(outNode, profile); + + if (!handlePseudoSnippet(outNode)) { + const node = outNode.node; + + // Do not generate fields for nodes with empty value and children + // or if node is self-closed + if (node.value || !node.children.length && !node.selfClosing) { + outNode.text = outNode.renderFields(formatNodeValue$1(node, profile)); + } + } + + return outNode; + }); +} + +/** + * Updates formatting properties for given output node + * NB Unlike HTML, Slim is indent-based format so some formatting options from + * `profile` will not take effect, otherwise output will be broken + * @param {OutputNode} outNode Output wrapper of farsed abbreviation node + * @param {Profile} profile Output profile + * @return {OutputNode} + */ +function updateFormatting$1(outNode, profile) { + const node = outNode.node; + const parent = node.parent; + + // Edge case: a single inline-level child inside node without text: + // allow it to be inlined + if (profile.get('inlineBreak') === 0 && isInline$1(node, profile) && !isRoot(parent) && parent.value == null && parent.children.length === 1) { + outNode.beforeOpen = ': '; + } + + if (!node.isTextOnly && node.value) { + // node with text: put a space before single-line text + outNode.beforeText = reNl$1.test(node.value) ? outNode.newline + outNode.indent + profile.indent(1) : ' '; + } + + return outNode; +} + +/** + * Formats value of given node: for multiline text we should precede each + * line with `| ` with one-level deep indent + * @param {Node} node + * @param {Profile} profile + * @return {String|null} + */ +function formatNodeValue$1(node, profile) { + if (node.value != null && reNl$1.test(node.value)) { + const indent = profile.indent(1); + return markup_formatters_es_splitByLines(node.value).map((line, i) => `${indent}${i ? ' ' : '|'} ${line}`).join('\n'); + } + + return node.value; +} + +/** + * Check if given node is inline-level + * @param {Node} node + * @param {Profile} profile + * @return {Boolean} + */ +function isInline$1(node, profile) { + return node && (node.isTextOnly || profile.isInline(node)); +} + +const reNl$2 = /\n|\r/; + +/** + * Renders given parsed Emmet abbreviation as Pug, formatted according to + * `profile` options + * @param {Node} tree Parsed Emmet abbreviation + * @param {Profile} profile Output profile + * @param {Object} [options] Additional formatter options + * @return {String} + */ +function pug(tree, profile, options) { + options = options || {}; + const nodeOptions = { + open: '[NAME][PRIMARY_ATTRS][(SECONDARY_ATTRS)]', + attributes: { + secondary(attrs) { + return attrs.map(attr => attr.isBoolean ? attr.name : `${attr.name}=${profile.quote(attr.value)}`).join(', '); + } + } + }; + + return output_renderer_es(tree, options.field, outNode => { + outNode = indentFormat(outNode, profile, nodeOptions); + outNode = updateFormatting$2(outNode, profile); + + if (!handlePseudoSnippet(outNode)) { + const node = outNode.node; + // Do not generate fields for nodes with empty value and children + // or if node is self-closed + if (node.value || !node.children.length && !node.selfClosing) { + outNode.text = outNode.renderFields(formatNodeValue$2(node, profile)); + } + } + + return outNode; + }); +} + +/** + * Updates formatting properties for given output node + * NB Unlike HTML, Pug is indent-based format so some formatting options from + * `profile` will not take effect, otherwise output will be broken + * @param {OutputNode} outNode Output wrapper of parsed abbreviation node + * @param {Profile} profile Output profile + * @return {OutputNode} + */ +function updateFormatting$2(outNode, profile) { + const node = outNode.node; + + if (!node.isTextOnly && node.value) { + // node with text: put a space before single-line text + outNode.beforeText = reNl$2.test(node.value) ? outNode.newline + outNode.indent + profile.indent(1) : ' '; + } + + return outNode; +} + +/** + * Formats value of given node: for multiline text we should precede each + * line with `| ` with one-level deep indent + * @param {Node} node + * @param {Profile} profile + * @return {String|null} + */ +function formatNodeValue$2(node, profile) { + if (node.value != null && reNl$2.test(node.value)) { + const indent = profile.indent(1); + return markup_formatters_es_splitByLines(node.value).map(line => `${indent}| ${line}`).join('\n'); + } + + return node.value; +} + +const supportedSyntaxes = { html, haml, slim, pug }; + +/** + * Outputs given parsed abbreviation in specified syntax + * @param {Node} tree Parsed abbreviation tree + * @param {Profile} profile Output profile + * @param {String} [syntax] Output syntax. If not given, `html` syntax is used + * @param {Function} options.field A function to output field/tabstop for + * host editor. This function takes two arguments: `index` and `placeholder` and + * should return a string that represents tabstop in host editor. By default + * only a placeholder is returned + * @example + * { + * field(index, placeholder) { + * // return field in TextMate-style, e.g. ${1} or ${2:foo} + * return `\${${index}${placeholder ? ':' + placeholder : ''}}`; + * } + * } + * @return {String} + */ +function markup_formatters_es_index(tree, profile, syntax, options) { + if (typeof syntax === 'object') { + options = syntax; + syntax = null; + } + + if (!supports(syntax)) { + // fallback to HTML if given syntax is not supported + syntax = 'html'; + } + + return supportedSyntaxes[syntax](tree, profile, options); +} + +/** + * Check if given syntax is supported + * @param {String} syntax + * @return {Boolean} + */ +function supports(syntax) { + return !!syntax && syntax in supportedSyntaxes; +} + +/* harmony default export */ var markup_formatters_es = (markup_formatters_es_index); + +//# sourceMappingURL=markup-formatters.es.js.map +// CONCATENATED MODULE: ../node_modules/@emmetio/css-abbreviation/dist/css-abbreviation.es.js + + + + +/** + * A wrapper for holding CSS value + */ +let CSSValue = class CSSValue { + constructor() { + this.type = 'css-value'; + this.value = []; + } + + get size() { + return this.value.length; + } + + add(value) { + this.value.push(value); + } + + has(value) { + return this.value.indexOf(value) !== -1; + } + + toString() { + return this.value.join(' '); + } +}; + + +const css_abbreviation_es_HASH = 35; // # +const css_abbreviation_es_DOT = 46; // . + +/** + * Consumes a color token from given string + * @param {StreamReader} stream + * @return {Color} Returns consumend color object, `undefined` otherwise + */ +function consumeColor(stream) { + // supported color variations: + // #abc → #aabbccc + // #0 → #000000 + // #fff.5 → rgba(255, 255, 255, 0.5) + // #t → transparent + if (stream.peek() === css_abbreviation_es_HASH) { + stream.start = stream.pos; + stream.next(); + + stream.eat(116) /* t */ || stream.eatWhile(isHex); + const base = stream.current(); + + // a hex color can be followed by `.num` alpha value + stream.start = stream.pos; + if (stream.eat(css_abbreviation_es_DOT) && !stream.eatWhile(isNumber)) { + throw stream.error('Unexpected character for alpha value of color'); + } + + return new Color(base, stream.current()); + } +} + +let Color = class Color { + constructor(value, alpha) { + this.type = 'color'; + this.raw = value; + this.alpha = Number(alpha != null && alpha !== '' ? alpha : 1); + value = value.slice(1); // remove # + + let r = 0, + g = 0, + b = 0; + + if (value === 't') { + this.alpha = 0; + } else { + switch (value.length) { + case 0: + break; + + case 1: + r = g = b = value + value; + break; + + case 2: + r = g = b = value; + break; + + case 3: + r = value[0] + value[0]; + g = value[1] + value[1]; + b = value[2] + value[2]; + break; + + default: + value += value; + r = value.slice(0, 2); + g = value.slice(2, 4); + b = value.slice(4, 6); + } + } + + this.r = parseInt(r, 16); + this.g = parseInt(g, 16); + this.b = parseInt(b, 16); + } + + /** + * Output current color as hex value + * @param {Boolean} shor Produce short value (e.g. #fff instead of #ffffff), if possible + * @return {String} + */ + toHex(short) { + const fn = short && isShortHex(this.r) && isShortHex(this.g) && isShortHex(this.b) ? toShortHex : toHex; + + return '#' + fn(this.r) + fn(this.g) + fn(this.b); + } + + /** + * Output current color as `rgba?(...)` CSS color + * @return {String} + */ + toRGB() { + const values = [this.r, this.g, this.b]; + if (this.alpha !== 1) { + values.push(this.alpha.toFixed(8).replace(/\.?0+$/, '')); + } + + return `${values.length === 3 ? 'rgb' : 'rgba'}(${values.join(', ')})`; + } + + toString(short) { + if (!this.r && !this.g && !this.b && !this.alpha) { + return 'transparent'; + } + return this.alpha === 1 ? this.toHex(short) : this.toRGB(); + } +}; + +/** + * Check if given code is a hex value (/0-9a-f/) + * @param {Number} code + * @return {Boolean} + */ + +function isHex(code) { + return isNumber(code) || isAlpha(code, 65, 70); // A-F +} + +function isShortHex(hex) { + return !(hex % 17); +} + +function toShortHex(num) { + return (num >> 4).toString(16); +} + +function toHex(num) { + return css_abbreviation_es_pad(num.toString(16), 2); +} + +function css_abbreviation_es_pad(value, len) { + while (value.length < len) { + value = '0' + value; + } + return value; +} + +/** + * @param {Number} code + * @return {Boolean} + */ +function isAlphaNumericWord(code) { + return isNumber(code) || isAlphaWord(code); +} + +/** + * @param {Number} code + * @return {Boolean} + */ +function isAlphaWord(code) { + return code === 95 /* _ */ || isAlpha(code); +} + +const PERCENT = 37; // % +const css_abbreviation_es_DOT$1 = 46; // . +const css_abbreviation_es_DASH = 45; // - + +/** + * Consumes numeric CSS value (number with optional unit) from current stream, + * if possible + * @param {StreamReader} stream + * @return {NumericValue} + */ +function consumeNumericValue(stream) { + stream.start = stream.pos; + if (eatNumber(stream)) { + const num = stream.current(); + stream.start = stream.pos; + + // eat unit, which can be a % or alpha word + stream.eat(PERCENT) || stream.eatWhile(isAlphaWord); + return new NumericValue(num, stream.current()); + } +} + +/** + * A numeric CSS value with optional unit + */ +let NumericValue = class NumericValue { + constructor(value, unit) { + this.type = 'numeric'; + this.value = Number(value); + this.unit = unit || ''; + } + + toString() { + return `${this.value}${this.unit}`; + } +}; + +/** + * Eats number value from given stream + * @param {StreamReader} stream + * @return {Boolean} Returns `true` if number was consumed + */ + +function eatNumber(stream) { + const start = stream.pos; + const negative = stream.eat(css_abbreviation_es_DASH); + const afterNegative = stream.pos; + + stream.eatWhile(isNumber); + + const prevPos = stream.pos; + if (stream.eat(css_abbreviation_es_DOT$1) && !stream.eatWhile(isNumber)) { + // Number followed by a dot, but then no number + stream.pos = prevPos; + } + + // Edge case: consumed dash only: not a number, bail-out + if (stream.pos === afterNegative) { + stream.pos = start; + } + + return stream.pos !== start; +} + +const css_abbreviation_es_DOLLAR = 36; // $ +const DASH$1 = 45; // - +const AT = 64; // @ + +/** + * Consumes a keyword: either a variable (a word that starts with $ or @) or CSS + * keyword or shorthand + * @param {StreamReader} stream + * @param {Boolean} [short] Use short notation for consuming value. + * The difference between “short” and “full” notation is that first one uses + * alpha characters only and used for extracting keywords from abbreviation, + * while “full” notation also supports numbers and dashes + * @return {String} Consumed variable + */ +function consumeKeyword(stream, short) { + stream.start = stream.pos; + + if (stream.eat(css_abbreviation_es_DOLLAR) || stream.eat(AT)) { + // SCSS or LESS variable + stream.eatWhile(isVariableName); + } else if (short) { + stream.eatWhile(isAlphaWord); + } else { + stream.eatWhile(isKeyword); + } + + return stream.start !== stream.pos ? new Keyword(stream.current()) : null; +} + +let Keyword = class Keyword { + constructor(value) { + this.type = 'keyword'; + this.value = value; + } + + toString() { + return this.value; + } +}; + + +function isKeyword(code) { + return isAlphaNumericWord(code) || code === DASH$1; +} + +function isVariableName(code) { + return code === 45 /* - */ || isAlphaNumericWord(code); +} + +const css_abbreviation_es_opt = { throws: true }; + +/** + * Consumes 'single' or "double"-quoted string from given string, if possible + * @param {StreamReader} stream + * @return {String} + */ +function css_abbreviation_es_consumeQuoted(stream) { + if (eatQuoted(stream, css_abbreviation_es_opt)) { + return new QuotedString(stream.current()); + } +} + +let QuotedString = class QuotedString { + constructor(value) { + this.type = 'string'; + this.value = value; + } + + toString() { + return this.value; + } +}; + + +const LBRACE = 40; // ( +const RBRACE = 41; // ) +const COMMA = 44; // , + +/** + * Consumes arguments from given string. + * Arguments are comma-separated list of CSS values inside round braces, e.g. + * `(1, a2, 'a3')`. Nested lists and quoted strings are supported + * @param {StreamReader} stream + * @return {Array} Array of arguments, `null` if arguments cannot be consumed + */ +function consumeArgumentList(stream) { + if (!stream.eat(LBRACE)) { + // not an argument list + return null; + } + + let arg; + const argsList = []; + + while (!stream.eof()) { + if (arg = consumeArgument(stream)) { + argsList.push(arg); + } else { + // didn’t consumed argument, expect argument separator or end-of-arguments + stream.eatWhile(isWhiteSpace); + + if (stream.eat(RBRACE)) { + // end of arguments list + break; + } + + if (!stream.eat(COMMA)) { + throw stream.error('Expected , or )'); + } + } + } + + return argsList; +} + +/** + * Consumes a single argument. An argument is a `CSSValue`, e.g. it could be + * a space-separated string of value + * @param {StreamReader} stream + * @return {CSSValue} + */ +function consumeArgument(stream) { + const result = new CSSValue(); + let value; + + while (!stream.eof()) { + stream.eatWhile(isWhiteSpace); + value = consumeNumericValue(stream) || consumeColor(stream) || css_abbreviation_es_consumeQuoted(stream) || consumeKeywordOrFunction(stream); + + if (!value) { + break; + } + + result.add(value); + } + + return result.size ? result : null; +} + +/** + * Consumes either function call like `foo()` or keyword like `foo` + * @param {StreamReader} stream + * @return {Keyword|FunctionCall} + */ +function consumeKeywordOrFunction(stream) { + const kw = consumeKeyword(stream); + if (kw) { + const args = consumeArgumentList(stream); + return args ? new FunctionCall(kw.toString(), args) : kw; + } +} + +let FunctionCall = class FunctionCall { + /** + * @param {String} name Function name + * @param {Array} args Function arguments + */ + constructor(name, args) { + this.type = 'function'; + this.name = name; + this.args = args || []; + } + + toString() { + return `${this.name}(${this.args.join(', ')})`; + } +}; + + +const css_abbreviation_es_EXCL = 33; // ! +const DOLLAR$1 = 36; // $ +const PLUS = 43; // + +const DASH$2 = 45; // - +const css_abbreviation_es_COLON = 58; // : +const AT$1 = 64; // @ + +/** + * Parses given Emmet CSS abbreviation and returns it as parsed Node tree + * @param {String} abbr + * @return {Node} + */ +function css_abbreviation_es_index(abbr) { + const root = new node_es(); + const stream = new stream_reader_es(abbr); + + while (!stream.eof()) { + let node = new node_es(consumeIdent(stream)); + node.value = consumeValue(stream); + + const args = consumeArgumentList(stream); + if (args) { + // technically, arguments in CSS are anonymous Emmet Node attributes, + // but since Emmet can support only one anonymous, `null`-name + // attribute (for good reasons), we’ll use argument index as name + for (let i = 0; i < args.length; i++) { + node.setAttribute(String(i), args[i]); + } + } + + // Consume `!important` modifier at the end of expression + if (stream.eat(css_abbreviation_es_EXCL)) { + node.value.add('!'); + } + + root.appendChild(node); + + // CSS abbreviations cannot be nested, only listed + if (!stream.eat(PLUS)) { + break; + } + } + + if (!stream.eof()) { + throw stream.error('Unexpected character'); + } + + return root; +} + +/** + * Consumes CSS property identifier from given stream + * @param {StreamReader} stream + * @return {String} + */ +function consumeIdent(stream) { + stream.start = stream.pos; + stream.eatWhile(isIdentPrefix); + stream.eatWhile(css_abbreviation_es_isIdent); + return stream.start !== stream.pos ? stream.current() : null; +} + +/** + * Consumes embedded value from Emmet CSS abbreviation stream + * @param {StreamReader} stream + * @return {CSSValue} + */ +function consumeValue(stream) { + const values = new CSSValue(); + let value; + + while (!stream.eof()) { + // use colon as value separator + stream.eat(css_abbreviation_es_COLON); + if (value = consumeNumericValue(stream) || consumeColor(stream)) { + // edge case: a dash after unit-less numeric value or color should + // be treated as value separator, not negative sign + if (!value.unit) { + stream.eat(DASH$2); + } + } else { + stream.eat(DASH$2); + value = consumeKeyword(stream, true); + } + + if (!value) { + break; + } + + values.add(value); + } + + return values; +} + +/** + * @param {Number} code + * @return {Boolean} + */ +function css_abbreviation_es_isIdent(code) { + return isAlphaWord(code); +} + +/** + * @param {Number} code + * @return {Boolean} + */ +function isIdentPrefix(code) { + return code === AT$1 || code === DOLLAR$1 || code === css_abbreviation_es_EXCL; +} + +/* harmony default export */ var css_abbreviation_es = (css_abbreviation_es_index); +// CONCATENATED MODULE: ../node_modules/@emmetio/expand-abbreviation/node_modules/@emmetio/css-snippets-resolver/dist/css-snippets-resolver.es.js +var css_snippets_resolver_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +const css_snippets_resolver_es_DASH = 45; // - + +/** + * Calculates fuzzy match score of how close `abbr` matches given `string`. + * @param {String} abbr Abbreviation to score + * @param {String} string String to match + * @param {Number} [fuzziness] Fuzzy factor + * @return {Number} Match score + */ +function stringScore(abbr, string) { + abbr = abbr.toLowerCase(); + string = string.toLowerCase(); + + if (abbr === string) { + return 1; + } + + // a string MUST start with the same character as abbreviation + if (!string || abbr.charCodeAt(0) !== string.charCodeAt(0)) { + return 0; + } + + const abbrLength = abbr.length; + const stringLength = string.length; + let i = 1, + j = 1, + score = stringLength; + let ch1, ch2, found, acronym; + + while (i < abbrLength) { + ch1 = abbr.charCodeAt(i); + found = false; + acronym = false; + + while (j < stringLength) { + ch2 = string.charCodeAt(j); + + if (ch1 === ch2) { + found = true; + score += (stringLength - j) * (acronym ? 2 : 1); + break; + } + + // add acronym bonus for exactly next match after unmatched `-` + acronym = ch2 === css_snippets_resolver_es_DASH; + j++; + } + + if (!found) { + break; + } + + i++; + } + + return score && score * (i / abbrLength) / sum(stringLength); +} + +/** + * Calculates sum of first `n` natural numbers, e.g. 1+2+3+...n + * @param {Number} n + * @return {Number} + */ +function sum(n) { + return n * (n + 1) / 2; +} + +const reProperty = /^([a-z-]+)(?:\s*:\s*([^\n\r]+))?$/; +const css_snippets_resolver_es_DASH$1 = 45; // - + +/** + * Creates a special structure for resolving CSS properties from plain CSS + * snippets. + * Almost all CSS snippets are aliases for real CSS properties with available + * value variants, optionally separated by `|`. Most values are keywords that + * can be fuzzy-resolved as well. Some CSS properties are shorthands for other, + * more specific properties, like `border` and `border-style`. For such cases + * keywords from more specific properties should be available in shorthands too. + * @param {Snippet[]} snippets + * @return {CSSSnippet[]} + */ +function cssSnippets(snippets) { + return nest(snippets.map(snippet => new CSSSnippet(snippet.key, snippet.value))); +} + +let CSSSnippet = class CSSSnippet { + constructor(key, value) { + this.key = key; + this.value = value; + this.property = null; + + // detect if given snippet is a property + const m = value && value.match(reProperty); + if (m) { + this.property = m[1]; + this.value = m[2]; + } + + this.dependencies = []; + } + + addDependency(dep) { + this.dependencies.push(dep); + } + + get defaultValue() { + return this.value != null ? splitValue(this.value)[0] : null; + } + + /** + * Returns list of unique keywords for current CSS snippet and its dependencies + * @return {String[]} + */ + keywords() { + const stack = []; + const keywords = new Set(); + let i = 0, + item, + candidates; + + if (this.property) { + // scan valid CSS-properties only + stack.push(this); + } + + while (i < stack.length) { + // NB Keep items in stack instead of push/pop to avoid possible + // circular references + item = stack[i++]; + + if (item.value) { + candidates = splitValue(item.value).filter(css_snippets_resolver_es_isKeyword); + + // extract possible keywords from snippet value + for (let j = 0; j < candidates.length; j++) { + keywords.add(candidates[j].trim()); + } + + // add dependencies into scan stack + for (let j = 0, deps = item.dependencies; j < deps.length; j++) { + if (stack.indexOf(deps[j]) === -1) { + stack.push(deps[j]); + } + } + } + } + + return Array.from(keywords); + } +}; + +/** + * Nests more specific CSS properties into shorthand ones, e.g. + * background-position-x -> background-position -> background + * @param {CSSSnippet[]} snippets + * @return {CSSSnippet[]} + */ + +function nest(snippets) { + snippets = snippets.sort(snippetsSort); + const stack = []; + + // For sorted list of CSS properties, create dependency graph where each + // shorthand property contains its more specific one, e.g. + // background -> background-position -> background-position-x + for (let i = 0, cur, prev; i < snippets.length; i++) { + cur = snippets[i]; + + if (!cur.property) { + // not a CSS property, skip it + continue; + } + + // Check if current property belongs to one from parent stack. + // Since `snippets` array is sorted, items are perfectly aligned + // from shorthands to more specific variants + while (stack.length) { + prev = stack[stack.length - 1]; + + if (cur.property.indexOf(prev.property) === 0 && cur.property.charCodeAt(prev.property.length) === css_snippets_resolver_es_DASH$1) { + prev.addDependency(cur); + stack.push(cur); + break; + } + + stack.pop(); + } + + if (!stack.length) { + stack.push(cur); + } + } + + return snippets; +} + +/** + * A sorting function for array of snippets + * @param {CSSSnippet} a + * @param {CSSSnippet} b + * @return {Number} + */ +function snippetsSort(a, b) { + if (a.key === b.key) { + return 0; + } + + return a.key < b.key ? -1 : 1; +} + +/** + * Check if given string is a keyword candidate + * @param {String} str + * @return {Boolean} + */ +function css_snippets_resolver_es_isKeyword(str) { + return (/^\s*[\w-]+/.test(str) + ); +} + +function splitValue(value) { + return String(value).split('|'); +} + +const globalKeywords = ['auto', 'inherit', 'unset']; +const unitlessProperties = ['z-index', 'line-height', 'opacity', 'font-weight', 'zoom', 'flex', 'flex-grow', 'flex-shrink']; + +const css_snippets_resolver_es_defaultOptions = { + intUnit: 'px', + floatUnit: 'em', + unitAliases: { + e: 'em', + p: '%', + x: 'ex', + r: 'rem' + }, + fuzzySearchMinScore: 0 +}; + +/** + * For every node in given `tree`, finds matching snippet from `registry` and + * updates node with snippet data. + * + * This resolver uses fuzzy matching for searching matched snippets and their + * keyword values. + */ + +function css_snippets_resolver_es_index(tree, registry, options) { + options = css_snippets_resolver_es__extends({}, css_snippets_resolver_es_defaultOptions, options); + options.unitAliases = css_snippets_resolver_es__extends({}, css_snippets_resolver_es_defaultOptions.unitAliases, options && options.unitAliases); + + const snippets = convertToCSSSnippets(registry); + + tree.walk(node => css_snippets_resolver_es_resolveNode(node, snippets, options)); + return tree; +} + +function convertToCSSSnippets(registry) { + return cssSnippets(registry.all({ type: 'string' })); +} + +/** + * Resolves given node: finds matched CSS snippets using fuzzy match and resolves + * keyword aliases from node value + * @param {Node} node + * @param {CSSSnippet[]} snippets + * @param {Object} options + * @return {Node} + */ +function css_snippets_resolver_es_resolveNode(node, snippets, options) { + if (options.property) { + // Resolve as value of given CSS property + return resolveAsPropertyValue(node, snippets.find(snippet => snippet.property === options.property), options); + } + + const snippet = findBestMatch(node.name, snippets, 'key', options.fuzzySearchMinScore); + + if (!snippet) { + // Edge case: `!important` snippet + return node.name === '!' ? setNodeAsText(node, '!important') : node; + } + + return snippet.property ? resolveAsProperty(node, snippet, options) : resolveAsSnippet(node, snippet); +} + +/** + * Resolves given parsed abbreviation node as CSS property + * @param {Node} node + * @param {CSSSnippet} snippet + * @param {Object} formatOptions + * @return {Node} + */ +function resolveAsProperty(node, snippet, formatOptions) { + const abbr = node.name; + node.name = snippet.property; + + if (node.value && typeof node.value === 'object') { + // resolve keyword shortcuts + const keywords = snippet.keywords(); + + if (!node.value.size) { + // no value defined, try to resolve unmatched part as a keyword alias + let kw = findBestMatch(getUnmatchedPart(abbr, snippet.key), keywords); + + if (!kw) { + // no matching value, try to get default one + kw = snippet.defaultValue; + if (kw && kw.indexOf('${') === -1) { + // Quick and dirty test for existing field. If not, wrap + // default value in a field + kw = `\${1:${kw}}`; + } + } + + if (kw) { + node.value.add(kw); + } + } else { + // replace keyword aliases in current node value + for (let i = 0, token; i < node.value.value.length; i++) { + token = node.value.value[i]; + + if (token === '!') { + token = `${!i ? '${1} ' : ''}!important`; + } else if (isKeyword$1(token)) { + token = findBestMatch(token.value, keywords) || findBestMatch(token.value, globalKeywords) || token; + } else if (isNumericValue(token)) { + token = resolveNumericValue(node.name, token, formatOptions); + } + + node.value.value[i] = token; + } + } + } + + return node; +} + +/** + * Resolves given parsed abbreviation node as a snippet: a plain code chunk + * @param {Node} node + * @param {CSSSnippet} snippet + * @return {Node} + */ +function resolveAsSnippet(node, snippet) { + return setNodeAsText(node, snippet.value); +} + +/** + * Resolves given parsed abbreviation node as property value of given `snippet`: + * tries to find best matching keyword from CSS snippet + * @param {Node} node + * @param {CSSSnippet} snippet + * @param {Object} options + * @return {Node} + */ +function resolveAsPropertyValue(node, snippet, options) { + // Possible resolved result for CSS property: + // * matched snippet keyword + // * color (starts with #) + // Everything else should result the same as input abbreviation + let keywords = globalKeywords.slice(); + if (snippet) { + keywords = keywords.concat(snippet.keywords()); + } + + const values = [node.name].concat(node.value.value).filter(Boolean).map(value => { + if (typeof value === 'string' || value.type === 'keyword') { + value = String(value); + return findBestMatch(value, keywords, null, options.fuzzySearchMinScore) || value; + } + + return value; + }); + + node.name = null; + node.value.value = values; + + return node; +} + +/** + * Sets given parsed abbreviation node as a text snippet + * @param {Node} node + * @param {String} text + * @return {Node} + */ +function setNodeAsText(node, text) { + node.name = null; + node.value = text; + return node; +} + +/** + * Finds best matching item from `items` array + * @param {String} abbr Abbreviation to match + * @param {Array} items List of items for match + * @param {String} [key] If `items` is a list of objects, use `key` as object + * property to test against + * @param {Number} fuzzySearchMinScore The minimum score the best matched item should have to be a valid match. + * @return {*} + */ +function findBestMatch(abbr, items, key, fuzzySearchMinScore) { + if (!abbr) { + return null; + } + + let matchedItem = null; + let maxScore = 0; + fuzzySearchMinScore = fuzzySearchMinScore || 0; + + for (let i = 0, item; i < items.length; i++) { + item = items[i]; + const score = stringScore(abbr, getScoringPart(item, key)); + + if (score === 1) { + // direct hit, no need to look further + return item; + } + + if (score && score >= maxScore) { + maxScore = score; + matchedItem = item; + } + } + + return maxScore >= fuzzySearchMinScore ? matchedItem : null; +} + +function getScoringPart(item, key) { + const value = item && typeof item === 'object' ? item[key] : item; + const m = (value || '').match(/^[\w-@]+/); + return m ? m[0] : value; +} + +/** + * Returns a part of `abbr` that wasn’t directly matched agains `string`. + * For example, if abbreviation `poas` is matched against `position`, the unmatched part will be `as` + * since `a` wasn’t found in string stream + * @param {String} abbr + * @param {String} string + * @return {String} + */ +function getUnmatchedPart(abbr, string) { + for (let i = 0, lastPos = 0; i < abbr.length; i++) { + lastPos = string.indexOf(abbr[i], lastPos); + if (lastPos === -1) { + return abbr.slice(i); + } + lastPos++; + } + + return ''; +} + +/** + * Check if given CSS value token is a keyword + * @param {*} token + * @return {Boolean} + */ +function isKeyword$1(token) { + return tokenTypeOf(token, 'keyword'); +} + +/** + * Check if given CSS value token is a numeric value + * @param {*} token + * @return {Boolean} + */ +function isNumericValue(token) { + return tokenTypeOf(token, 'numeric'); +} + +function tokenTypeOf(token, type) { + return token && typeof token === 'object' && token.type === type; +} + +/** + * Resolves numeric value for given CSS property + * @param {String} property CSS property name + * @param {NumericValue} token CSS numeric value token + * @param {Object} formatOptions Formatting options for units + * @return {NumericValue} + */ +function resolveNumericValue(property, token, formatOptions) { + if (token.unit) { + token.unit = formatOptions.unitAliases[token.unit] || token.unit; + } else if (token.value !== 0 && unitlessProperties.indexOf(property) === -1) { + // use `px` for integers, `em` for floats + // NB: num|0 is a quick alternative to Math.round(0) + token.unit = token.value === (token.value | 0) ? formatOptions.intUnit : formatOptions.floatUnit; + } + + return token; +} + +/* harmony default export */ var css_snippets_resolver_es = (css_snippets_resolver_es_index); + +//# sourceMappingURL=css-snippets-resolver.es.js.map +// CONCATENATED MODULE: ../node_modules/@emmetio/stylesheet-formatters/dist/stylesheet-formatters.es.js +var stylesheet_formatters_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + + + +const defaultFormatOptions = { + shortHex: true, + between: ': ', + after: ';' +}; + +/** + * Renders given parsed Emmet CSS abbreviation as CSS-like + * stylesheet, formatted according to `profile` options + * @param {Node} tree Parsed Emmet abbreviation + * @param {Profile} profile Output profile + * @param {Object} [options] Additional formatter options + * @return {String} + */ +function css(tree, profile, options) { + options = options || {}; + const formatOpt = stylesheet_formatters_es__extends({}, defaultFormatOptions, options && options.format); + + return output_renderer_es(tree, options.field, outNode => { + const node = outNode.node; + let value = stringifyValue(node, formatOpt); + + if (node.attributes.length) { + const fieldValues = node.attributes.map(attr => stringifyValue(attr, formatOpt)); + value = injectFields(value, fieldValues); + } + + outNode.open = node.name && profile.name(node.name); + outNode.afterOpen = formatOpt.between; + outNode.text = outNode.renderFields(value || null); + + if (outNode.open && (!outNode.text || !outNode.text.endsWith(';'))) { + outNode.afterText = formatOpt.after; + } + + if (profile.get('format')) { + outNode.newline = '\n'; + if (tree.lastChild !== node) { + outNode.afterText += outNode.newline; + } + } + + return outNode; + }); +} + +/** + * Injects given field values at each field of given string + * @param {String} string + * @param {String[]} attributes + * @return {FieldString} + */ +function injectFields(string, values) { + const fieldsModel = field_parser_es(string); + const fieldsAmount = fieldsModel.fields.length; + + if (fieldsAmount) { + values = values.slice(); + if (values.length > fieldsAmount) { + // More values that output fields: collapse rest values into + // a single token + values = values.slice(0, fieldsAmount - 1).concat(values.slice(fieldsAmount - 1).join(', ')); + } + + while (values.length) { + const value = values.shift(); + const field = fieldsModel.fields.shift(); + const delta = value.length - field.length; + + fieldsModel.string = fieldsModel.string.slice(0, field.location) + value + fieldsModel.string.slice(field.location + field.length); + + // Update location of the rest fields in string + for (let i = 0, il = fieldsModel.fields.length; i < il; i++) { + fieldsModel.fields[i].location += delta; + } + } + } + + return fieldsModel; +} + +function stringifyValue(node, options) { + if (node.value && typeof node.value === 'object' && node.value.type === 'css-value') { + return node.value.value.map(token => { + if (token && typeof token === 'object') { + return token.type === 'color' ? token.toString(options.shortHex) : token.toString(); + } + + return String(token); + }).join(' '); + } + + return node.value != null ? String(node.value) : ''; +} + +const syntaxFormat = { + css: { + between: ': ', + after: ';' + }, + scss: 'css', + less: 'css', + sass: { + between: ': ', + after: '' + }, + stylus: { + between: ' ', + after: '' + } +}; + +/** + * Outputs given parsed abbreviation in specified stylesheet syntax + * @param {Node} tree Parsed abbreviation tree + * @param {Profile} profile Output profile + * @param {String} [syntax] Output syntax. If not given, `css` syntax is used + * @param {Function} options.field A function to output field/tabstop for + * host editor. This function takes two arguments: `index` and `placeholder` and + * should return a string that represents tabstop in host editor. By default + * only a placeholder is returned + * @example + * { + * field(index, placeholder) { + * // return field in TextMate-style, e.g. ${1} or ${2:foo} + * return `\${${index}${placeholder ? ':' + placeholder : ''}}`; + * } + * } + * @return {String} + */ +function stylesheet_formatters_es_index(tree, profile, syntax, options) { + if (typeof syntax === 'object') { + options = syntax; + syntax = null; + } + + if (!stylesheet_formatters_es_supports(syntax)) { + // fallback to CSS if given syntax is not supported + syntax = 'css'; + } + + options = stylesheet_formatters_es__extends({}, options, { + format: getFormat(syntax, options) + }); + + // CSS abbreviations doesn’t support nesting so simply + // output root node children + return css(tree, profile, options); +} + +/** + * Check if given syntax is supported + * @param {String} syntax + * @return {Boolean} + */ +function stylesheet_formatters_es_supports(syntax) { + return !!syntax && syntax in syntaxFormat; +} + +/** + * Returns formatter object for given syntax + * @param {String} syntax + * @param {Object} [options] + * @return {Object} Formatter object as defined in `syntaxFormat` + */ +function getFormat(syntax, options) { + let format = syntaxFormat[syntax]; + if (typeof format === 'string') { + format = syntaxFormat[format]; + } + + return stylesheet_formatters_es__extends({}, format, options && options.format); +} + +/* harmony default export */ var stylesheet_formatters_es = (stylesheet_formatters_es_index); + +//# sourceMappingURL=stylesheet-formatters.es.js.map +// CONCATENATED MODULE: ../node_modules/@emmetio/snippets/dist/snippets.es.js +var snippets_es_html = { + "a": "a[href]", + "a:link": "a[href='http://${0}']", + "a:mail": "a[href='mailto:${0}']", + "a:tel": "a[href='tel:+${0}']", + "abbr": "abbr[title]", + "acr|acronym": "acronym[title]", + "base": "base[href]/", + "basefont": "basefont/", + "br": "br/", + "frame": "frame/", + "hr": "hr/", + "bdo": "bdo[dir]", + "bdo:r": "bdo[dir=rtl]", + "bdo:l": "bdo[dir=ltr]", + "col": "col/", + "link": "link[rel=stylesheet href]/", + "link:css": "link[href='${1:style}.css']", + "link:print": "link[href='${1:print}.css' media=print]", + "link:favicon": "link[rel='shortcut icon' type=image/x-icon href='${1:favicon.ico}']", + "link:touch": "link[rel=apple-touch-icon href='${1:favicon.png}']", + "link:rss": "link[rel=alternate type=application/rss+xml title=RSS href='${1:rss.xml}']", + "link:atom": "link[rel=alternate type=application/atom+xml title=Atom href='${1:atom.xml}']", + "link:im|link:import": "link[rel=import href='${1:component}.html']", + "meta": "meta/", + "meta:utf": "meta[http-equiv=Content-Type content='text/html;charset=UTF-8']", + "meta:vp": "meta[name=viewport content='width=${1:device-width}, initial-scale=${2:1.0}']", + "meta:compat": "meta[http-equiv=X-UA-Compatible content='${1:IE=7}']", + "meta:edge": "meta:compat[content='${1:ie=edge}']", + "meta:redirect": "meta[http-equiv=refresh content='0; url=${1:http://example.com}']", + "style": "style", + "script": "script[!src]", + "script:src": "script[src]", + "img": "img[src alt]/", + "img:s|img:srcset": "img[srcset src alt]", + "img:z|img:sizes": "img[sizes srcset src alt]", + "picture": "picture", + "src|source": "source/", + "src:sc|source:src": "source[src type]", + "src:s|source:srcset": "source[srcset]", + "src:t|source:type": "source[srcset type='${1:image/}']", + "src:z|source:sizes": "source[sizes srcset]", + "src:m|source:media": "source[media='(${1:min-width: })' srcset]", + "src:mt|source:media:type": "source:media[type='${2:image/}']", + "src:mz|source:media:sizes": "source:media[sizes srcset]", + "src:zt|source:sizes:type": "source[sizes srcset type='${1:image/}']", + "iframe": "iframe[src frameborder=0]", + "embed": "embed[src type]/", + "object": "object[data type]", + "param": "param[name value]/", + "map": "map[name]", + "area": "area[shape coords href alt]/", + "area:d": "area[shape=default]", + "area:c": "area[shape=circle]", + "area:r": "area[shape=rect]", + "area:p": "area[shape=poly]", + "form": "form[action]", + "form:get": "form[method=get]", + "form:post": "form[method=post]", + "label": "label[for]", + "input": "input[type=${1:text}]/", + "inp": "input[name=${1} id=${1}]", + "input:h|input:hidden": "input[type=hidden name]", + "input:t|input:text": "inp[type=text]", + "input:search": "inp[type=search]", + "input:email": "inp[type=email]", + "input:url": "inp[type=url]", + "input:p|input:password": "inp[type=password]", + "input:datetime": "inp[type=datetime]", + "input:date": "inp[type=date]", + "input:datetime-local": "inp[type=datetime-local]", + "input:month": "inp[type=month]", + "input:week": "inp[type=week]", + "input:time": "inp[type=time]", + "input:tel": "inp[type=tel]", + "input:number": "inp[type=number]", + "input:color": "inp[type=color]", + "input:c|input:checkbox": "inp[type=checkbox]", + "input:r|input:radio": "inp[type=radio]", + "input:range": "inp[type=range]", + "input:f|input:file": "inp[type=file]", + "input:s|input:submit": "input[type=submit value]", + "input:i|input:image": "input[type=image src alt]", + "input:b|input:button": "input[type=button value]", + "input:reset": "input:button[type=reset]", + "isindex": "isindex/", + "select": "select[name=${1} id=${1}]", + "select:d|select:disabled": "select[disabled.]", + "opt|option": "option[value]", + "textarea": "textarea[name=${1} id=${1} cols=${2:30} rows=${3:10}]", + "marquee": "marquee[behavior direction]", + "menu:c|menu:context": "menu[type=context]", + "menu:t|menu:toolbar": "menu[type=toolbar]", + "video": "video[src]", + "audio": "audio[src]", + "html:xml": "html[xmlns=http://www.w3.org/1999/xhtml]", + "keygen": "keygen/", + "command": "command/", + "btn:s|button:s|button:submit": "button[type=submit]", + "btn:r|button:r|button:reset": "button[type=reset]", + "btn:d|button:d|button:disabled": "button[disabled.]", + "fst:d|fset:d|fieldset:d|fieldset:disabled": "fieldset[disabled.]", + + "bq": "blockquote", + "fig": "figure", + "figc": "figcaption", + "pic": "picture", + "ifr": "iframe", + "emb": "embed", + "obj": "object", + "cap": "caption", + "colg": "colgroup", + "fst": "fieldset", + "btn": "button", + "optg": "optgroup", + "tarea": "textarea", + "leg": "legend", + "sect": "section", + "art": "article", + "hdr": "header", + "ftr": "footer", + "adr": "address", + "dlg": "dialog", + "str": "strong", + "prog": "progress", + "mn": "main", + "tem": "template", + "fset": "fieldset", + "datag": "datagrid", + "datal": "datalist", + "kg": "keygen", + "out": "output", + "det": "details", + "cmd": "command", + + "ri:d|ri:dpr": "img:s", + "ri:v|ri:viewport": "img:z", + "ri:a|ri:art": "pic>src:m+img", + "ri:t|ri:type": "pic>src:t+img", + + "!!!": "{}", + "doc": "html[lang=${lang}]>(head>meta[charset=${charset}]+meta:vp+meta:edge+title{${1:Document}})+body", + "!|html:5": "!!!+doc", + + "c": "{}", + "cc:ie": "{}", + "cc:noie": "{${0}}" +}; + +var snippets_es_css = { + "@f": "@font-face {\n\tfont-family: ${1};\n\tsrc: url(${1});\n}", + "@ff": "@font-face {\n\tfont-family: '${1:FontName}';\n\tsrc: url('${2:FileName}.eot');\n\tsrc: url('${2:FileName}.eot?#iefix') format('embedded-opentype'),\n\t\t url('${2:FileName}.woff') format('woff'),\n\t\t url('${2:FileName}.ttf') format('truetype'),\n\t\t url('${2:FileName}.svg#${1:FontName}') format('svg');\n\tfont-style: ${3:normal};\n\tfont-weight: ${4:normal};\n}", + "@i|@import": "@import url(${0});", + "@kf": "@keyframes ${1:identifier} {\n\t${2}\n}", + "@m|@media": "@media ${1:screen} {\n\t${0}\n}", + "ac": "align-content:flex-start|flex-end|center|space-between|space-around|stretch", + "ai": "align-items:flex-start|flex-end|center|baseline|stretch", + "anim": "animation:${1:name} ${2:duration} ${3:timing-function} ${4:delay} ${5:iteration-count} ${6:direction} ${7:fill-mode}", + "animdel": "animation-delay:${1:time}", + "animdir": "animation-direction:normal|reverse|alternate|alternate-reverse", + "animdur": "animation-duration:${1:0}s", + "animfm": "animation-fill-mode:both|forwards|backwards", + "animic": "animation-iteration-count:1|infinite", + "animn": "animation-name", + "animps": "animation-play-state:running|paused", + "animtf": "animation-timing-function:linear|ease|ease-in|ease-out|ease-in-out|cubic-bezier(${1:0.1}, ${2:0.7}, ${3:1.0}, ${3:0.1})", + "ap": "appearance:none", + "as": "align-self:auto|flex-start|flex-end|center|baseline|stretch", + "b": "bottom", + "bd": "border:${1:1px} ${2:solid} ${3:#000}", + "bdb": "border-bottom:${1:1px} ${2:solid} ${3:#000}", + "bdbc": "border-bottom-color:#${1:000}", + "bdbi": "border-bottom-image:url(${0})", + "bdbk": "border-break:close", + "bdbli": "border-bottom-left-image:url(${0})|continue", + "bdblrs": "border-bottom-left-radius", + "bdbri": "border-bottom-right-image:url(${0})|continue", + "bdbrrs": "border-bottom-right-radius", + "bdbs": "border-bottom-style", + "bdbw": "border-bottom-width", + "bdc": "border-color:#${1:000}", + "bdci": "border-corner-image:url(${0})|continue", + "bdcl": "border-collapse:collapse|separate", + "bdf": "border-fit:repeat|clip|scale|stretch|overwrite|overflow|space", + "bdi": "border-image:url(${0})", + "bdl": "border-left:${1:1px} ${2:solid} ${3:#000}", + "bdlc": "border-left-color:#${1:000}", + "bdlen": "border-length", + "bdli": "border-left-image:url(${0})", + "bdls": "border-left-style", + "bdlw": "border-left-width", + "bdr": "border-right:${1:1px} ${2:solid} ${3:#000}", + "bdrc": "border-right-color:#${1:000}", + "bdri": "border-right-image:url(${0})", + "bdrs": "border-radius", + "bdrst": "border-right-style", + "bdrw": "border-right-width", + "bds": "border-style:none|hidden|dotted|dashed|solid|double|dot-dash|dot-dot-dash|wave|groove|ridge|inset|outset", + "bdsp": "border-spacing", + "bdt": "border-top:${1:1px} ${2:solid} ${3:#000}", + "bdtc": "border-top-color:#${1:000}", + "bdti": "border-top-image:url(${0})", + "bdtli": "border-top-left-image:url(${0})|continue", + "bdtlrs": "border-top-left-radius", + "bdtri": "border-top-right-image:url(${0})|continue", + "bdtrrs": "border-top-right-radius", + "bdts": "border-top-style", + "bdtw": "border-top-width", + "bdw": "border-width", + "bfv": "backface-visibility:hidden|visible", + "bg": "background:#${1:000}", + "bga": "background-attachment:fixed|scroll", + "bgbk": "background-break:bounding-box|each-box|continuous", + "bgc": "background-color:#${1:fff}", + "bgcp": "background-clip:padding-box|border-box|content-box|no-clip", + "bgi": "background-image:url(${0})", + "bgo": "background-origin:padding-box|border-box|content-box", + "bgp": "background-position:${1:0} ${2:0}", + "bgpx": "background-position-x", + "bgpy": "background-position-y", + "bgr": "background-repeat:no-repeat|repeat-x|repeat-y|space|round", + "bgsz": "background-size:contain|cover", + "bxsh": "box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} #${5:000}|none", + "bxsz": "box-sizing:border-box|content-box|border-box", + "c": "color:#${1:000}", + "cl": "clear:both|left|right|none", + "cm": "/* ${0} */", + "cnt": "content:'${0}'|normal|open-quote|no-open-quote|close-quote|no-close-quote|attr(${0})|counter(${0})|counters({$0})", + "coi": "counter-increment", + "colm": "columns", + "colmc": "column-count", + "colmf": "column-fill", + "colmg": "column-gap", + "colmr": "column-rule", + "colmrc": "column-rule-color", + "colmrs": "column-rule-style", + "colmrw": "column-rule-width", + "colms": "column-span", + "colmw": "column-width", + "cor": "counter-reset", + "cp": "clip:auto|rect(${1:top} ${2:right} ${3:bottom} ${4:left})", + "cps": "caption-side:top|bottom", + "cur": "cursor:pointer|auto|default|crosshair|hand|help|move|pointer|text", + "d": "display:block|none|flex|inline-flex|inline|inline-block|list-item|run-in|compact|table|inline-table|table-caption|table-column|table-column-group|table-header-group|table-footer-group|table-row|table-row-group|table-cell|ruby|ruby-base|ruby-base-group|ruby-text|ruby-text-group", + "ec": "empty-cells:show|hide", + "f": "font:${1:1em} ${2:sans-serif}", + "fef": "font-effect:none|engrave|emboss|outline", + "fem": "font-emphasize", + "femp": "font-emphasize-position:before|after", + "fems": "font-emphasize-style:none|accent|dot|circle|disc", + "ff": "font-family:serif|sans-serif|cursive|fantasy|monospace", + "fl": "float:left|right|none", + "fs": "font-style:italic|normal|oblique", + "fsm": "font-smoothing:antialiased|subpixel-antialiased|none", + "fst": "font-stretch:normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded", + "fv": "font-variant:normal|small-caps", + "fw": "font-weight:normal|bold|bolder|lighter", + "fx": "flex", + "fxb": "flex-basis:fill|max-content|min-content|fit-content|content", + "fxd": "flex-direction:row|row-reverse|column|column-reverse", + "fxf": "flex-flow", + "fxg": "flex-grow", + "fxsh": "flex-shrink", + "fxw": "flex-wrap:nowrap|wrap|wrap-reverse", + "fz": "font-size", + "fza": "font-size-adjust", + "h": "height", + "jc": "justify-content:flex-start|flex-end|center|space-between|space-around", + "l": "left", + "lg": "background-image:linear-gradient(${1})", + "lh": "line-height", + "lis": "list-style", + "lisi": "list-style-image", + "lisp": "list-style-position:inside|outside", + "list": "list-style-type:disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman", + "lts": "letter-spacing:normal", + "m": "margin", + "mah": "max-height", + "mar": "max-resolution", + "maw": "max-width", + "mb": "margin-bottom", + "mih": "min-height", + "mir": "min-resolution", + "miw": "min-width", + "ml": "margin-left", + "mr": "margin-right", + "mt": "margin-top", + "ol": "outline", + "olc": "outline-color:#${1:000}|invert", + "olo": "outline-offset", + "ols": "outline-style:none|dotted|dashed|solid|double|groove|ridge|inset|outset", + "olw": "outline-width|thin|medium|thick", + "op": "opacity", + "ord": "order", + "ori": "orientation:landscape|portrait", + "orp": "orphans", + "ov": "overflow:hidden|visible|hidden|scroll|auto", + "ovs": "overflow-style:scrollbar|auto|scrollbar|panner|move|marquee", + "ovx": "overflow-x:hidden|visible|hidden|scroll|auto", + "ovy": "overflow-y:hidden|visible|hidden|scroll|auto", + "p": "padding", + "pb": "padding-bottom", + "pgba": "page-break-after:auto|always|left|right", + "pgbb": "page-break-before:auto|always|left|right", + "pgbi": "page-break-inside:auto|avoid", + "pl": "padding-left", + "pos": "position:relative|absolute|relative|fixed|static", + "pr": "padding-right", + "pt": "padding-top", + "q": "quotes", + "qen": "quotes:'\\201C' '\\201D' '\\2018' '\\2019'", + "qru": "quotes:'\\00AB' '\\00BB' '\\201E' '\\201C'", + "r": "right", + "rsz": "resize:none|both|horizontal|vertical", + "t": "top", + "ta": "text-align:left|center|right|justify", + "tal": "text-align-last:left|center|right", + "tbl": "table-layout:fixed", + "td": "text-decoration:none|underline|overline|line-through", + "te": "text-emphasis:none|accent|dot|circle|disc|before|after", + "th": "text-height:auto|font-size|text-size|max-size", + "ti": "text-indent", + "tj": "text-justify:auto|inter-word|inter-ideograph|inter-cluster|distribute|kashida|tibetan", + "to": "text-outline:${1:0} ${2:0} ${3:#000}", + "tov": "text-overflow:ellipsis|clip", + "tr": "text-replace", + "trf": "transform:${1}|skewX(${1:angle})|skewY(${1:angle})|scale(${1:x}, ${2:y})|scaleX(${1:x})|scaleY(${1:y})|scaleZ(${1:z})|scale3d(${1:x}, ${2:y}, ${3:z})|rotate(${1:angle})|rotateX(${1:angle})|rotateY(${1:angle})|rotateZ(${1:angle})|translate(${1:x}, ${2:y})|translateX(${1:x})|translateY(${1:y})|translateZ(${1:z})|translate3d(${1:tx}, ${2:ty}, ${3:tz})", + "trfo": "transform-origin", + "trfs": "transform-style:preserve-3d", + "trs": "transition:${1:prop} ${2:time}", + "trsde": "transition-delay:${1:time}", + "trsdu": "transition-duration:${1:time}", + "trsp": "transition-property:${1:prop}", + "trstf": "transition-timing-function:${1:fn}", + "tsh": "text-shadow:${1:hoff} ${2:voff} ${3:blur} ${4:#000}", + "tt": "text-transform:uppercase|lowercase|capitalize|none", + "tw": "text-wrap:none|normal|unrestricted|suppress", + "us": "user-select:none", + "v": "visibility:hidden|visible|collapse", + "va": "vertical-align:top|super|text-top|middle|baseline|bottom|text-bottom|sub", + "w": "width", + "whs": "white-space:nowrap|pre|pre-wrap|pre-line|normal", + "whsc": "white-space-collapse:normal|keep-all|loose|break-strict|break-all", + "wid": "widows", + "wm": "writing-mode:lr-tb|lr-tb|lr-bt|rl-tb|rl-bt|tb-rl|tb-lr|bt-lr|bt-rl", + "wob": "word-break:normal|keep-all|break-all", + "wos": "word-spacing", + "wow": "word-wrap:none|unrestricted|suppress|break-word|normal", + "z": "z-index", + "zom": "zoom:1" +}; + +var snippets_es_xsl = { + "tm|tmatch": "xsl:template[match mode]", + "tn|tname": "xsl:template[name]", + "call": "xsl:call-template[name]", + "ap": "xsl:apply-templates[select mode]", + "api": "xsl:apply-imports", + "imp": "xsl:import[href]", + "inc": "xsl:include[href]", + "ch": "xsl:choose", + "wh|xsl:when": "xsl:when[test]", + "ot": "xsl:otherwise", + "if": "xsl:if[test]", + "par": "xsl:param[name]", + "pare": "xsl:param[name select]", + "var": "xsl:variable[name]", + "vare": "xsl:variable[name select]", + "wp": "xsl:with-param[name select]", + "key": "xsl:key[name match use]", + "elem": "xsl:element[name]", + "attr": "xsl:attribute[name]", + "attrs": "xsl:attribute-set[name]", + "cp": "xsl:copy[select]", + "co": "xsl:copy-of[select]", + "val": "xsl:value-of[select]", + "for|each": "xsl:for-each[select]", + "tex": "xsl:text", + "com": "xsl:comment", + "msg": "xsl:message[terminate=no]", + "fall": "xsl:fallback", + "num": "xsl:number[value]", + "nam": "namespace-alias[stylesheet-prefix result-prefix]", + "pres": "xsl:preserve-space[elements]", + "strip": "xsl:strip-space[elements]", + "proc": "xsl:processing-instruction[name]", + "sort": "xsl:sort[select order]", + "choose": "xsl:choose>xsl:when+xsl:otherwise", + "xsl": "!!!+xsl:stylesheet[version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform]>{\n|}", + "!!!": "{}" +}; + +var snippets_es_index = { html: snippets_es_html, css: snippets_es_css, xsl: snippets_es_xsl }; + +/* harmony default export */ var snippets_es = (snippets_es_index); +// CONCATENATED MODULE: ../node_modules/@emmetio/lorem/dist/lorem.es.js +var lorem_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + + +var latin = { + "common": ["lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipisicing", "elit"], + "words": ["exercitationem", "perferendis", "perspiciatis", "laborum", "eveniet", "sunt", "iure", "nam", "nobis", "eum", "cum", "officiis", "excepturi", "odio", "consectetur", "quasi", "aut", "quisquam", "vel", "eligendi", "itaque", "non", "odit", "tempore", "quaerat", "dignissimos", "facilis", "neque", "nihil", "expedita", "vitae", "vero", "ipsum", "nisi", "animi", "cumque", "pariatur", "velit", "modi", "natus", "iusto", "eaque", "sequi", "illo", "sed", "ex", "et", "voluptatibus", "tempora", "veritatis", "ratione", "assumenda", "incidunt", "nostrum", "placeat", "aliquid", "fuga", "provident", "praesentium", "rem", "necessitatibus", "suscipit", "adipisci", "quidem", "possimus", "voluptas", "debitis", "sint", "accusantium", "unde", "sapiente", "voluptate", "qui", "aspernatur", "laudantium", "soluta", "amet", "quo", "aliquam", "saepe", "culpa", "libero", "ipsa", "dicta", "reiciendis", "nesciunt", "doloribus", "autem", "impedit", "minima", "maiores", "repudiandae", "ipsam", "obcaecati", "ullam", "enim", "totam", "delectus", "ducimus", "quis", "voluptates", "dolores", "molestiae", "harum", "dolorem", "quia", "voluptatem", "molestias", "magni", "distinctio", "omnis", "illum", "dolorum", "voluptatum", "ea", "quas", "quam", "corporis", "quae", "blanditiis", "atque", "deserunt", "laboriosam", "earum", "consequuntur", "hic", "cupiditate", "quibusdam", "accusamus", "ut", "rerum", "error", "minus", "eius", "ab", "ad", "nemo", "fugit", "officia", "at", "in", "id", "quos", "reprehenderit", "numquam", "iste", "fugiat", "sit", "inventore", "beatae", "repellendus", "magnam", "recusandae", "quod", "explicabo", "doloremque", "aperiam", "consequatur", "asperiores", "commodi", "optio", "dolor", "labore", "temporibus", "repellat", "veniam", "architecto", "est", "esse", "mollitia", "nulla", "a", "similique", "eos", "alias", "dolore", "tenetur", "deleniti", "porro", "facere", "maxime", "corrupti"] +}; + +var ru = { + "common": ["далеко-далеко", "за", "словесными", "горами", "в стране", "гласных", "и согласных", "живут", "рыбные", "тексты"], + "words": ["вдали", "от всех", "они", "буквенных", "домах", "на берегу", "семантика", "большого", "языкового", "океана", "маленький", "ручеек", "даль", "журчит", "по всей", "обеспечивает", "ее", "всеми", "необходимыми", "правилами", "эта", "парадигматическая", "страна", "которой", "жаренные", "предложения", "залетают", "прямо", "рот", "даже", "всемогущая", "пунктуация", "не", "имеет", "власти", "над", "рыбными", "текстами", "ведущими", "безорфографичный", "образ", "жизни", "однажды", "одна", "маленькая", "строчка", "рыбного", "текста", "имени", "lorem", "ipsum", "решила", "выйти", "большой", "мир", "грамматики", "великий", "оксмокс", "предупреждал", "о", "злых", "запятых", "диких", "знаках", "вопроса", "коварных", "точках", "запятой", "но", "текст", "дал", "сбить", "себя", "толку", "он", "собрал", "семь", "своих", "заглавных", "букв", "подпоясал", "инициал", "за", "пояс", "пустился", "дорогу", "взобравшись", "первую", "вершину", "курсивных", "гор", "бросил", "последний", "взгляд", "назад", "силуэт", "своего", "родного", "города", "буквоград", "заголовок", "деревни", "алфавит", "подзаголовок", "своего", "переулка", "грустный", "реторический", "вопрос", "скатился", "его", "щеке", "продолжил", "свой", "путь", "дороге", "встретил", "рукопись", "она", "предупредила", "моей", "все", "переписывается", "несколько", "раз", "единственное", "что", "меня", "осталось", "это", "приставка", "возвращайся", "ты", "лучше", "свою", "безопасную", "страну", "послушавшись", "рукописи", "наш", "продолжил", "свой", "путь", "вскоре", "ему", "повстречался", "коварный", "составитель", "рекламных", "текстов", "напоивший", "языком", "речью", "заманивший", "свое", "агентство", "которое", "использовало", "снова", "снова", "своих", "проектах", "если", "переписали", "то", "живет", "там", "до", "сих", "пор"] +}; + +var sp = { + "common": ["mujer", "uno", "dolor", "más", "de", "poder", "mismo", "si"], + "words": ["ejercicio", "preferencia", "perspicacia", "laboral", "paño", "suntuoso", "molde", "namibia", "planeador", "mirar", "demás", "oficinista", "excepción", "odio", "consecuencia", "casi", "auto", "chicharra", "velo", "elixir", "ataque", "no", "odio", "temporal", "cuórum", "dignísimo", "facilismo", "letra", "nihilista", "expedición", "alma", "alveolar", "aparte", "león", "animal", "como", "paria", "belleza", "modo", "natividad", "justo", "ataque", "séquito", "pillo", "sed", "ex", "y", "voluminoso", "temporalidad", "verdades", "racional", "asunción", "incidente", "marejada", "placenta", "amanecer", "fuga", "previsor", "presentación", "lejos", "necesariamente", "sospechoso", "adiposidad", "quindío", "pócima", "voluble", "débito", "sintió", "accesorio", "falda", "sapiencia", "volutas", "queso", "permacultura", "laudo", "soluciones", "entero", "pan", "litro", "tonelada", "culpa", "libertario", "mosca", "dictado", "reincidente", "nascimiento", "dolor", "escolar", "impedimento", "mínima", "mayores", "repugnante", "dulce", "obcecado", "montaña", "enigma", "total", "deletéreo", "décima", "cábala", "fotografía", "dolores", "molesto", "olvido", "paciencia", "resiliencia", "voluntad", "molestias", "magnífico", "distinción", "ovni", "marejada", "cerro", "torre", "y", "abogada", "manantial", "corporal", "agua", "crepúsculo", "ataque", "desierto", "laboriosamente", "angustia", "afortunado", "alma", "encefalograma", "materialidad", "cosas", "o", "renuncia", "error", "menos", "conejo", "abadía", "analfabeto", "remo", "fugacidad", "oficio", "en", "almácigo", "vos", "pan", "represión", "números", "triste", "refugiado", "trote", "inventor", "corchea", "repelente", "magma", "recusado", "patrón", "explícito", "paloma", "síndrome", "inmune", "autoinmune", "comodidad", "ley", "vietnamita", "demonio", "tasmania", "repeler", "apéndice", "arquitecto", "columna", "yugo", "computador", "mula", "a", "propósito", "fantasía", "alias", "rayo", "tenedor", "deleznable", "ventana", "cara", "anemia", "corrupto"] +}; + +const langs = { latin, ru, sp }; + +const lorem_es_defaultOptions = { + wordCount: 30, + skipCommon: false, + lang: 'latin' +}; + +/** + * Replaces given parsed Emmet abbreviation node with nodes filled with + * Lorem Ipsum stub text. + * @param {Node} node + * @return {Node} + */ +var lorem_es_index = function (node, options) { + options = lorem_es__extends({}, lorem_es_defaultOptions, options); + const dict = langs[options.lang] || langs.latin; + const startWithCommon = !options.skipCommon && !isRepeating(node); + + if (!node.repeat && !lorem_es_isRoot(node.parent)) { + // non-repeating element, insert text stub as a content of parent node + // and remove current one + node.parent.value = paragraph(dict, options.wordCount, startWithCommon); + node.remove(); + } else { + // Replace named node with generated content + node.value = paragraph(dict, options.wordCount, startWithCommon); + node.name = node.parent.name ? implicit_tag_es(node.parent.name) : null; + } + + return node; +}; + +function lorem_es_isRoot(node) { + return !node.parent; +} + +/** + * Returns random integer between from and to values + * @param {Number} from + * @param {Number} to + * @returns {Number} + */ +function rand(from, to) { + return Math.floor(Math.random() * (to - from) + from); +} + +/** + * @param {Array} arr + * @param {Number} count + * @returns {Array} + */ +function sample(arr, count) { + const len = arr.length; + const iterations = Math.min(len, count); + const result = new Set(); + + while (result.size < iterations) { + result.add(arr[rand(0, len)]); + } + + return Array.from(result); +} + +function choice(val) { + return val[rand(0, val.length - 1)]; +} + +function sentence(words, end) { + if (words.length) { + words = [capitalize(words[0])].concat(words.slice(1)); + } + + return words.join(' ') + (end || choice('?!...')); // more dots than question marks +} + +function capitalize(word) { + return word[0].toUpperCase() + word.slice(1); +} + +/** + * Insert commas at randomly selected words. This function modifies values + * inside words array + * @param {Array} words + */ +function insertCommas(words) { + if (words.length < 2) { + return words; + } + + words = words.slice(); + const len = words.length; + const hasComma = /,$/; + let totalCommas = 0; + + if (len > 3 && len <= 6) { + totalCommas = rand(0, 1); + } else if (len > 6 && len <= 12) { + totalCommas = rand(0, 2); + } else { + totalCommas = rand(1, 4); + } + + for (let i = 0, pos, word; i < totalCommas; i++) { + pos = rand(0, len - 2); + if (!hasComma.test(words[pos])) { + words[pos] += ','; + } + } + + return words; +} + +/** + * Generate a paragraph of "Lorem ipsum" text + * @param {Object} dict Words dictionary (see `lang/*.json`) + * @param {Number} wordCount Words count in paragraph + * @param {Boolean} startWithCommon Should paragraph start with common + * "lorem ipsum" sentence. + * @returns {String} + */ +function paragraph(dict, wordCount, startWithCommon) { + const result = []; + let totalWords = 0; + let words; + + if (startWithCommon && dict.common) { + words = dict.common.slice(0, wordCount); + totalWords += words.length; + result.push(sentence(insertCommas(words), '.')); + } + + while (totalWords < wordCount) { + words = sample(dict.words, Math.min(rand(2, 30), wordCount - totalWords)); + totalWords += words.length; + result.push(sentence(insertCommas(words))); + } + + return result.join(' '); +} + +/** + * Check if given node is in repeating context, e.g. node itself or one of its + * parent is repeated + * @param {Node} node + * @return {Boolean} + */ +function isRepeating(node) { + while (node.parent) { + if (node.repeat && node.repeat.value && node.repeat.value > 1) { + return true; + } + + node = node.parent; + } + + return false; +} + +/* harmony default export */ var lorem_es = (lorem_es_index); +// CONCATENATED MODULE: ../node_modules/@emmetio/snippets-registry/dist/snippets-registry.es.js +let Snippet = class Snippet { + constructor(key, value) { + this.key = key; + this.value = value; + } +}; +let SnippetsStorage = class SnippetsStorage { + constructor(data) { + this._string = new Map(); + this._regexp = new Map(); + this._disabled = false; + + this.load(data); + } + + get disabled() { + return this._disabled; + } + + /** + * Disables current store. A disabled store always returns `undefined` + * on `get()` method + */ + disable() { + this._disabled = true; + } + + /** + * Enables current store. + */ + enable() { + this._disabled = false; + } + + /** + * Registers a new snippet item + * @param {String|Regexp} key + * @param {String|Function} value + */ + set(key, value) { + if (typeof key === 'string') { + key.split('|').forEach(k => this._string.set(k, new Snippet(k, value))); + } else if (key instanceof RegExp) { + this._regexp.set(key, new Snippet(key, value)); + } else { + throw new Error('Unknow snippet key: ' + key); + } + + return this; + } + + /** + * Returns a snippet matching given key. It first tries to find snippet + * exact match in a string key map, then tries to match one with regexp key + * @param {String} key + * @return {Snippet} + */ + get(key) { + if (this.disabled) { + return undefined; + } + + if (this._string.has(key)) { + return this._string.get(key); + } + + const keys = Array.from(this._regexp.keys()); + for (let i = 0, il = keys.length; i < il; i++) { + if (keys[i].test(key)) { + return this._regexp.get(keys[i]); + } + } + } + + /** + * Batch load of snippets data + * @param {Object|Map} data + */ + load(data) { + this.reset(); + if (data instanceof Map) { + data.forEach((value, key) => this.set(key, value)); + } else if (data && typeof data === 'object') { + Object.keys(data).forEach(key => this.set(key, data[key])); + } + } + + /** + * Clears all stored snippets + */ + reset() { + this._string.clear(); + this._regexp.clear(); + } + + /** + * Returns all available snippets from given store + */ + values() { + if (this.disabled) { + return []; + } + + const string = Array.from(this._string.values()); + const regexp = Array.from(this._regexp.values()); + return string.concat(regexp); + } +}; + +/** + * A snippets registry. Contains snippets, separated by store and sorted by + * priority: a store with higher priority takes precedence when resolving snippet + * for given key + */ + +let SnippetsRegistry = class SnippetsRegistry { + /** + * Creates snippets registry, filled with given `data` + * @param {Object|Array} data Registry snippets. If array is given, adds items + * from array in order of precedence, registers global snippets otherwise + */ + constructor(data) { + this._registry = []; + + if (Array.isArray(data)) { + data.forEach((snippets, level) => this.add(level, snippets)); + } else if (typeof data === 'object') { + this.add(data); + } + } + + /** + * Return store for given level + * @param {Number} level + * @return {SnippetsStorage} + */ + get(level) { + for (let i = 0; i < this._registry.length; i++) { + const item = this._registry[i]; + if (item.level === level) { + return item.store; + } + } + } + + /** + * Adds new store for given level + * @param {Number} [level] Store level (priority). Store with higher level + * takes precedence when resolving snippets + * @param {Object} [snippets] A snippets data for new store + * @return {SnipetsStorage} + */ + add(level, snippets) { + if (level != null && typeof level === 'object') { + snippets = level; + level = 0; + } + + const store = new SnippetsStorage(snippets); + + // remove previous store from same level + this.remove(level); + + this._registry.push({ level, store }); + this._registry.sort((a, b) => b.level - a.level); + + return store; + } + + /** + * Remove registry with given level or store + * @param {Number|SnippetsStorage} data Either level or snippets store + */ + remove(data) { + this._registry = this._registry.filter(item => item.level !== data && item.store !== data); + } + + /** + * Returns snippet from registry that matches given name + * @param {String} name + * @return {Snippet} + */ + resolve(name) { + for (let i = 0; i < this._registry.length; i++) { + const snippet = this._registry[i].store.get(name); + if (snippet) { + return snippet; + } + } + } + + /** + * Returns all available snippets from current registry. Snippets with the + * same key are resolved by their storage priority. + * @param {Object} options + * @param {Object} options.type Return snippets only of given type: 'string' + * or 'regexp'. Returns all snippets if not defined + * @return {Array} + */ + all(options) { + options = options || {}; + const result = new Map(); + + const fillResult = snippet => { + const type = snippet.key instanceof RegExp ? 'regexp' : 'string'; + if ((!options.type || options.type === type) && !result.has(snippet.key)) { + result.set(snippet.key, snippet); + } + }; + + this._registry.forEach(item => { + item.store.values().forEach(fillResult); + }); + + return Array.from(result.values()); + } + + /** + * Removes all stores from registry + */ + clear() { + this._registry.length = 0; + } +}; + + +/* harmony default export */ var snippets_registry_es = (SnippetsRegistry); +// CONCATENATED MODULE: ../node_modules/@emmetio/output-profile/dist/output-profile.es.js +var output_profile_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +/** + * @type {EmmetOutputProfile} + */ +var output_profile_es_defaultOptions = { + indent: '\t', + tagCase: '', + attributeCase: '', + attributeQuotes: 'double', + format: true, + formatSkip: ['html'], + formatForce: ['body'], + inlineBreak: 3, + compactBooleanAttributes: false, + booleanAttributes: ['contenteditable', 'seamless', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'defer', 'disabled', 'formnovalidate', 'hidden', 'ismap', 'loop', 'multiple', 'muted', 'novalidate', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch'], + selfClosingStyle: 'html', + inlineElements: ['a', 'abbr', 'acronym', 'applet', 'b', 'basefont', 'bdo', 'big', 'br', 'button', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'map', 'object', 'q', 's', 'samp', 'select', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'textarea', 'tt', 'u', 'var'] +}; + +/** + * Creates output profile for given options + */ +let Profile = class Profile { + /** + * @param {EmmetOutputProfile} options + */ + constructor(options) { + /** @type {EmmetOutputProfile} */ + this.options = output_profile_es__extends({}, output_profile_es_defaultOptions, options); + this.quoteChar = this.options.attributeQuotes === 'single' ? '\'' : '"'; + } + + /** + * Returns value of given option name + * @param {String} name + * @return {*} + */ + get(name) { + return this.options[name]; + } + + /** + * Quote given string according to profile + * @param {String} str String to quote + * @return {String} + */ + quote(str) { + return `${this.quoteChar}${str != null ? str : ''}${this.quoteChar}`; + } + + /** + * Output given tag name according to options + * @param {String} name + * @return {String} + */ + name(name) { + return strcase(name, this.options.tagCase); + } + + /** + * Outputs attribute name according to current settings + * @param {String} attr Attribute name + * @return {String} + */ + attribute(attr) { + return strcase(attr, this.options.attributeCase); + } + + /** + * Check if given attribute is boolean + * @param {Object} attr + * @return {Boolean} + */ + isBooleanAttribute(attr) { + return attr.options.boolean || this.get('booleanAttributes').indexOf((attr.name || '').toLowerCase()) !== -1; + } + + /** + * Returns a token for self-closing tag, depending on current options + * @return {String} + */ + selfClose() { + switch (this.options.selfClosingStyle) { + case 'xhtml': + return ' /'; + case 'xml': + return '/'; + default: + return ''; + } + } + + /** + * Returns indent for given level + * @param {Number} level Indentation level + * @return {String} + */ + indent(level) { + level = level || 0; + let output = ''; + while (level--) { + output += this.options.indent; + } + + return output; + } + + /** + * Check if given tag name belongs to inline-level element + * @param {Object|String} node Parsed node or tag name + * @return {Boolean} + */ + isInline(node) { + if (typeof node === 'string') { + return this.get('inlineElements').indexOf(node.toLowerCase()) !== -1; + } + + // inline node is a node either with inline-level name or text-only node + return node.name != null ? this.isInline(node.name) : node.isTextOnly; + } + + /** + * Outputs formatted field for given params + * @param {Number} index Field index + * @param {String} [placeholder] Field placeholder, can be empty + * @return {String} + */ + field(index, placeholder) { + return this.options.field(index, placeholder); + } +}; + +function strcase(string, type) { + if (type) { + return type === 'upper' ? string.toUpperCase() : string.toLowerCase(); + } + + return string; +} + +/* harmony default export */ var output_profile_es = (Profile); +// CONCATENATED MODULE: ../node_modules/@emmetio/expand-abbreviation/dist/expand.es.js +var expand_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + + + + + + + + + + + + + +/** + * Expands given abbreviation into code + * @param {String|Node} abbr Abbreviation to parse or already parsed abbreviation + * @param {Object} config + * @return {String} + */ +function expand(abbr, config) { + config = expand_es__extends({}, config); + + if (typeof abbr === 'string') { + abbr = expand_es_parse(abbr, config); + } + + return markup_formatters_es(abbr, config.profile, config.syntax, config); +} + +/** + * Parses given Emmet abbreviation into a final abbreviation tree with all + * required transformations applied + * @param {String} Abbreviation to parse + * @param {Object} config + * @return {Node} + */ +function expand_es_parse(abbr, config) { + return abbreviation_es(abbr).use(html_snippets_resolver_es, config.snippets).use(variable_resolver_es, config.variables).use(html_transform_es, config.text, config.options); +} + +/** + * Expands given abbreviation into code + * @param {String|Node} abbr Abbreviation to parse or already parsed abbreviation + * @param {Object} config + * @return {String} + */ +function expand$1(abbr, config) { + config = config || {}; + + if (typeof abbr === 'string') { + abbr = parse$1(abbr, config); + } + + return stylesheet_formatters_es(abbr, config.profile, config.syntax, config); +} + +/** + * Parses given Emmet abbreviation into a final abbreviation tree with all + * required transformations applied + * @param {String|Node} abbr Abbreviation to parse or already parsed abbreviation + * @param {Object} config + * @return {Node} + */ +function parse$1(abbr, config) { + if (typeof abbr === 'string') { + abbr = css_abbreviation_es(abbr); + } + + return abbr.use(css_snippets_resolver_es, config.snippets, config.options); +} + +const reLorem = /^lorem([a-z]*)(\d*)$/i; + +/** + * Constructs a snippets registry, filled with snippets, for given options + * @param {String} syntax Abbreviation syntax + * @param {Object|Object[]} snippets Additional snippets + * @return {SnippetsRegistry} + */ +function snippetsRegistryFactory(type, syntax, snippets) { + const registrySnippets = []; + + if (type === 'markup') { + registrySnippets.push(snippets_es.html); + } else if (type === 'stylesheet') { + registrySnippets.push(snippets_es.css); + } + + if (syntax in snippets_es && registrySnippets.indexOf(snippets_es[syntax]) === -1) { + registrySnippets.push(snippets_es[syntax]); + } + + if (Array.isArray(snippets)) { + snippets.forEach(item => { + // if array item is a string, treat it as a reference to globally + // defined snippets + registrySnippets.push(typeof item === 'string' ? snippets_es[item] : item); + }); + } else if (typeof snippets === 'object') { + registrySnippets.push(snippets); + } + + const registry = new snippets_registry_es(registrySnippets.filter(Boolean)); + + // for non-stylesheet syntaxes add Lorem Ipsum generator + if (type !== 'stylesheet') { + registry.get(0).set(reLorem, loremGenerator); + } + + return registry; +} + +function loremGenerator(node) { + const options = {}; + const m = node.name.match(reLorem); + if (m[1]) { + options.lang = m[1]; + } + + if (m[2]) { + options.wordCount = +m[2]; + } + + return lorem_es(node, options); +} + +/** + * Default variables used in snippets to insert common values into predefined snippets + * @type {Object} + */ +const defaultVariables = { + lang: 'en', + locale: 'en-US', + charset: 'UTF-8' +}; + +/** + * A list of syntaxes that should use Emmet CSS abbreviations: + * a variations of default abbreviation that holds values right in abbreviation name + * @type {Array} + */ +const stylesheetSyntaxes = ['css', 'sass', 'scss', 'less', 'stylus', 'sss']; + +const expand_es_defaultOptions = { + /** + * Type of abbreviation to parse: 'markup' or 'stylesheet'. + * Can be auto-detected from `syntax` property. Default is 'markup' + */ + type: null, + + /** + * Abbreviation output syntax + * @type {String} + */ + syntax: 'html', + + /** + * Field/tabstop generator for editor. Most editors support TextMate-style + * fields: ${0} or ${1:item}. So for TextMate-style fields this function + * will look like this: + * @example + * (index, placeholder) => `\${${index}${placeholder ? ':' + placeholder : ''}}` + * + * @param {Number} index Placeholder index. Fields with the same indices + * should be linked + * @param {String} [placeholder] Field placeholder + * @return {String} + */ + field: (index, placeholder) => placeholder || '', + + /** + * Insert given text string(s) into expanded abbreviation + * If array of strings is given, the implicitly repeated element (e.g. `li*`) + * will be repeated by the amount of items in array + * @type {String|String[]} + */ + text: null, + + /** + * Either predefined output profile or options for output profile. Used for + * abbreviation output + * @type {Profile|Object} + */ + profile: null, + + /** + * Custom variables for variable resolver + * @see @emmetio/variable-resolver + * @type {Object} + */ + variables: {}, + + /** + * Custom predefined snippets for abbreviation. The expanded abbreviation + * will try to match given snippets that may contain custom elements, + * predefined attributes etc. + * May also contain array of items: either snippets (Object) or references + * to default syntax snippets (String; the key in default snippets hash) + * @see @emmetio/snippets + * @type {Object|SnippetsRegistry} + */ + snippets: {}, + + /** + * Hash of additional transformations that should be applied to expanded + * abbreviation, like BEM or JSX. Since these transformations introduce + * side-effect, they are disabled by default and should be enabled by + * providing a transform name as a key and transform options as value: + * @example + * { + * bem: {element: '--'}, + * jsx: true // no options, just enable transform + * } + * @see @emmetio/html-transform/lib/addons + * @type {Object} + */ + options: null, + + /** + * Additional options for syntax formatter + * @see @emmetio/markup-formatters + * @type {Object} + */ + format: null +}; + +/** + * Expands given abbreviation into string, formatted according to provided + * syntax and options + * @param {String|Node} abbr Abbreviation string or parsed abbreviation tree + * @param {String|Object} [config] Parsing and formatting options (object) or + * abbreviation syntax (string) + * @return {String} + */ +function expand$2(abbr, config) { + config = createOptions(config); + + return getType(config.type, config.syntax) === 'stylesheet' ? expand$1(abbr, config) : expand(abbr, config); +} + +/** + * Parses given abbreviation into AST tree. This tree can be later formatted to + * string with `expand` function + * @param {String} abbr Abbreviation to parse + * @param {String|Object} [options] Parsing and formatting options (object) or + * abbreviation syntax (string) + * @return {Node} + */ +function parse$2(abbr, options) { + options = createOptions(options); + + return getType(options.type, options.syntax) === 'stylesheet' ? parse$1(abbr, options) : expand_es_parse(abbr, options); +} + +/** + * Creates snippets registry for given syntax and additional `snippets` + * @param {String} type Abbreviation type, 'markup' or 'stylesheet' + * @param {String} syntax Snippets syntax, used for retrieving predefined snippets + * @param {SnippetsRegistry|Object|Object[]} [snippets] Additional snippets + * @return {SnippetsRegistry} + */ +function createSnippetsRegistry(type, syntax, snippets) { + // Backward-compatibility with <0.6 + if (type && type !== 'markup' && type !== 'stylesheet') { + snippets = syntax; + syntax = type; + type = 'markup'; + } + + return snippets instanceof snippets_registry_es ? snippets : snippetsRegistryFactory(type, syntax, snippets); +} + +function createOptions(options) { + if (typeof options === 'string') { + options = { syntax: options }; + } + + options = expand_es__extends({}, expand_es_defaultOptions, options); + if (options.type == null && options.syntax) { + options.type = isStylesheet(options.syntax) ? 'stylesheet' : 'markup'; + } + + options.format = expand_es__extends({ field: options.field }, options.format); + options.profile = createProfile(options); + options.variables = expand_es__extends({}, defaultVariables, options.variables); + options.snippets = createSnippetsRegistry(options.type, options.syntax, options.snippets); + + return options; +} + +/** + * Check if given syntax belongs to stylesheet markup. + * Emmet uses different abbreviation flavours: one is a default markup syntax, + * used for HTML, Slim, Pug etc, the other one is used for stylesheets and + * allows embedded values in abbreviation name + * @param {String} syntax + * @return {Boolean} + */ +function isStylesheet(syntax) { + return stylesheetSyntaxes.indexOf(syntax) !== -1; +} + +/** + * Creates output profile from given options + * @param {Object} options + * @return {Profile} + */ +function createProfile(options) { + return options.profile instanceof output_profile_es ? options.profile : new output_profile_es(options.profile); +} + +/** + * Returns type of abbreviation expander: either 'markup' or 'stylesheet' + * @param {String} type + * @param {String} [syntax] + */ +function getType(type, syntax) { + if (type) { + return type === 'stylesheet' ? 'stylesheet' : 'markup'; + } + + return isStylesheet(syntax) ? 'stylesheet' : 'markup'; +} + + +//# sourceMappingURL=expand.es.js.map +// CONCATENATED MODULE: ../node_modules/@emmetio/css-snippets-resolver/dist/css-snippets-resolver.es.js +var dist_css_snippets_resolver_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +const dist_css_snippets_resolver_es_DASH = 45; // - + +/** + * Calculates fuzzy match score of how close `abbr` matches given `string`. + * @param {String} abbr Abbreviation to score + * @param {String} string String to match + * @param {Number} [fuzziness] Fuzzy factor + * @return {Number} Match score + */ +function css_snippets_resolver_es_stringScore(abbr, string) { + abbr = abbr.toLowerCase(); + string = string.toLowerCase(); + + if (abbr === string) { + return 1; + } + + // a string MUST start with the same character as abbreviation + if (!string || abbr.charCodeAt(0) !== string.charCodeAt(0)) { + return 0; + } + + const abbrLength = abbr.length; + const stringLength = string.length; + let i = 1, + j = 1, + score = stringLength; + let ch1, ch2, found, acronym; + + while (i < abbrLength) { + ch1 = abbr.charCodeAt(i); + found = false; + acronym = false; + + while (j < stringLength) { + ch2 = string.charCodeAt(j); + + if (ch1 === ch2) { + found = true; + score += (stringLength - j) * (acronym ? 2 : 1); + break; + } + + // add acronym bonus for exactly next match after unmatched `-` + acronym = ch2 === dist_css_snippets_resolver_es_DASH; + j++; + } + + if (!found) { + break; + } + + i++; + } + + return score && score * (i / abbrLength) / css_snippets_resolver_es_sum(stringLength); +} + +/** + * Calculates sum of first `n` natural numbers, e.g. 1+2+3+...n + * @param {Number} n + * @return {Number} + */ +function css_snippets_resolver_es_sum(n) { + return n * (n + 1) / 2; +} + +const css_snippets_resolver_es_reProperty = /^([a-z\-]+)(?:\s*:\s*([^\n\r]+))?$/; +const dist_css_snippets_resolver_es_DASH$1 = 45; // - + +/** + * Creates a special structure for resolving CSS properties from plain CSS + * snippets. + * Almost all CSS snippets are aliases for real CSS properties with available + * value variants, optionally separated by `|`. Most values are keywords that + * can be fuzzy-resolved as well. Some CSS properties are shorthands for other, + * more specific properties, like `border` and `border-style`. For such cases + * keywords from more specific properties should be available in shorthands too. + * @param {Snippet[]} snippets + * @return {CSSSnippet[]} + */ +function css_snippets_resolver_es_cssSnippets(snippets) { + return css_snippets_resolver_es_nest(snippets.map(snippet => new css_snippets_resolver_es_CSSSnippet(snippet.key, snippet.value))); +} + +let css_snippets_resolver_es_CSSSnippet = class CSSSnippet { + constructor(key, value) { + this.key = key; + this.value = value; + this.property = null; + + // detect if given snippet is a property + const m = value && value.match(css_snippets_resolver_es_reProperty); + if (m) { + this.property = m[1]; + this.value = m[2]; + } + + this.dependencies = []; + } + + addDependency(dep) { + this.dependencies.push(dep); + } + + get defaultValue() { + return this.value != null ? css_snippets_resolver_es_splitValue(this.value)[0] : null; + } + + /** + * Returns list of unique keywords for current CSS snippet and its dependencies + * @return {String[]} + */ + keywords() { + const stack = []; + const keywords = new Set(); + let i = 0, + item, + candidates; + + if (this.property) { + // scan valid CSS-properties only + stack.push(this); + } + + while (i < stack.length) { + // NB Keep items in stack instead of push/pop to avoid possible + // circular references + item = stack[i++]; + + if (item.value) { + candidates = css_snippets_resolver_es_splitValue(item.value).filter(dist_css_snippets_resolver_es_isKeyword); + + // extract possible keywords from snippet value + for (let j = 0; j < candidates.length; j++) { + keywords.add(candidates[j].trim()); + } + + // add dependencies into scan stack + for (let j = 0, deps = item.dependencies; j < deps.length; j++) { + if (stack.indexOf(deps[j]) === -1) { + stack.push(deps[j]); + } + } + } + } + + return Array.from(keywords); + } +}; + +/** + * Nests more specific CSS properties into shorthand ones, e.g. + * background-position-x -> background-position -> background + * @param {CSSSnippet[]} snippets + * @return {CSSSnippet[]} + */ + +function css_snippets_resolver_es_nest(snippets) { + snippets = snippets.sort(css_snippets_resolver_es_snippetsSort); + const stack = []; + + // For sorted list of CSS properties, create dependency graph where each + // shorthand property contains its more specific one, e.g. + // backgound -> background-position -> background-position-x + for (let i = 0, cur, prev; i < snippets.length; i++) { + cur = snippets[i]; + + if (!cur.property) { + // not a CSS property, skip it + continue; + } + + // Check if current property belongs to one from parent stack. + // Since `snippets` array is sorted, items are perfectly aligned + // from shorthands to more specific variants + while (stack.length) { + prev = stack[stack.length - 1]; + + if (cur.property.indexOf(prev.property) === 0 && cur.property.charCodeAt(prev.property.length) === dist_css_snippets_resolver_es_DASH$1) { + prev.addDependency(cur); + stack.push(cur); + break; + } + + stack.pop(); + } + + if (!stack.length) { + stack.push(cur); + } + } + + return snippets; +} + +/** + * A sorting function for array of snippets + * @param {CSSSnippet} a + * @param {CSSSnippet} b + * @return {Number} + */ +function css_snippets_resolver_es_snippetsSort(a, b) { + if (a.key === b.key) { + return 0; + } + + return a.key < b.key ? -1 : 1; +} + +/** + * Check if given string is a keyword candidate + * @param {String} str + * @return {Boolean} + */ +function dist_css_snippets_resolver_es_isKeyword(str) { + return (/^\s*[\w-]+/.test(str) + ); +} + +function css_snippets_resolver_es_splitValue(value) { + return String(value).split('|'); +} + +const css_snippets_resolver_es_globalKeywords = ['auto', 'inherit', 'unset']; +const css_snippets_resolver_es_unitlessProperties = ['z-index', 'line-height', 'opacity', 'font-weight', 'zoom', 'flex', 'flex-grow', 'flex-shrink']; + +const dist_css_snippets_resolver_es_defaultOptions = { + intUnit: 'px', + floatUnit: 'em', + unitAliases: { + e: 'em', + p: '%', + x: 'ex', + r: 'rem' + }, + fuzzySearchMinScore: 0 +}; + +/** + * For every node in given `tree`, finds matching snippet from `registry` and + * updates node with snippet data. + * + * This resolver uses fuzzy matching for searching matched snippets and their + * keyword values. + */ + +function dist_css_snippets_resolver_es_index(tree, registry, options) { + options = dist_css_snippets_resolver_es__extends({}, dist_css_snippets_resolver_es_defaultOptions, options); + options.unitAliases = dist_css_snippets_resolver_es__extends({}, dist_css_snippets_resolver_es_defaultOptions.unitAliases, options && options.unitAliases); + + const snippets = css_snippets_resolver_es_convertToCSSSnippets(registry); + + tree.walk(node => dist_css_snippets_resolver_es_resolveNode(node, snippets, options)); + return tree; +} + +function css_snippets_resolver_es_convertToCSSSnippets(registry) { + return css_snippets_resolver_es_cssSnippets(registry.all({ type: 'string' })); +} + +/** + * Resolves given node: finds matched CSS snippets using fuzzy match and resolves + * keyword aliases from node value + * @param {Node} node + * @param {CSSSnippet[]} snippets + * @param {Object} options + * @return {Node} + */ +function dist_css_snippets_resolver_es_resolveNode(node, snippets, options) { + const snippet = css_snippets_resolver_es_findBestMatch(node.name, snippets, 'key', options.fuzzySearchMinScore); + + if (!snippet) { + // Edge case: `!important` snippet + return node.name === '!' ? css_snippets_resolver_es_setNodeAsText(node, '!important') : node; + } + + return snippet.property ? css_snippets_resolver_es_resolveAsProperty(node, snippet, options) : css_snippets_resolver_es_resolveAsSnippet(node, snippet); +} + +/** + * Resolves given parsed abbreviation node as CSS property + * @param {Node} node + * @param {CSSSnippet} snippet + * @param {Object} formatOptions + * @return {Node} + */ +function css_snippets_resolver_es_resolveAsProperty(node, snippet, formatOptions) { + const abbr = node.name; + node.name = snippet.property; + + if (node.value && typeof node.value === 'object') { + // resolve keyword shortcuts + const keywords = snippet.keywords(); + + if (!node.value.size) { + // no value defined, try to resolve unmatched part as a keyword alias + let kw = css_snippets_resolver_es_findBestMatch(css_snippets_resolver_es_getUnmatchedPart(abbr, snippet.key), keywords); + + if (!kw) { + // no matching value, try to get default one + kw = snippet.defaultValue; + if (kw && kw.indexOf('${') === -1) { + // Quick and dirty test for existing field. If not, wrap + // default value in a field + kw = `\${1:${kw}}`; + } + } + + if (kw) { + node.value.add(kw); + } + } else { + // replace keyword aliases in current node value + for (let i = 0, token; i < node.value.value.length; i++) { + token = node.value.value[i]; + + if (token === '!') { + token = `${!i ? '${1} ' : ''}!important`; + } else if (css_snippets_resolver_es_isKeyword$1(token)) { + token = css_snippets_resolver_es_findBestMatch(token.value, keywords) || css_snippets_resolver_es_findBestMatch(token.value, css_snippets_resolver_es_globalKeywords) || token; + } else if (css_snippets_resolver_es_isNumericValue(token)) { + token = css_snippets_resolver_es_resolveNumericValue(node.name, token, formatOptions); + } + + node.value.value[i] = token; + } + } + } + + return node; +} + +/** + * Resolves given parsed abbreviation node as a snippet: a plain code chunk + * @param {Node} node + * @param {CSSSnippet} snippet + * @return {Node} + */ +function css_snippets_resolver_es_resolveAsSnippet(node, snippet) { + return css_snippets_resolver_es_setNodeAsText(node, snippet.value); +} + +/** + * Sets given parsed abbreviation node as a text snippet + * @param {Node} node + * @param {String} text + * @return {Node} + */ +function css_snippets_resolver_es_setNodeAsText(node, text) { + node.name = null; + node.value = text; + return node; +} + +/** + * Finds best matching item from `items` array + * @param {String} abbr Abbreviation to match + * @param {Array} items List of items for match + * @param {String} [key] If `items` is a list of objects, use `key` as object + * property to test against + * @param {Number} fuzzySearchMinScore The minimum score the best matched item should have to be a valid match. + * @return {*} + */ +function css_snippets_resolver_es_findBestMatch(abbr, items, key, fuzzySearchMinScore) { + if (!abbr) { + return null; + } + + let matchedItem = null; + let maxScore = 0; + fuzzySearchMinScore = fuzzySearchMinScore || 0; + + for (let i = 0, item; i < items.length; i++) { + item = items[i]; + const score = css_snippets_resolver_es_stringScore(abbr, css_snippets_resolver_es_getScoringPart(item, key)); + + if (score === 1) { + // direct hit, no need to look further + return item; + } + + if (score && score >= maxScore) { + maxScore = score; + matchedItem = item; + } + } + + return maxScore >= fuzzySearchMinScore ? matchedItem : null; +} + +function css_snippets_resolver_es_getScoringPart(item, key) { + const value = item && typeof item === 'object' ? item[key] : item; + const m = (value || '').match(/^[\w-@]+/); + return m ? m[0] : value; +} + +/** + * Returns a part of `abbr` that wasn’t directly matched agains `string`. + * For example, if abbreviation `poas` is matched against `position`, the unmatched part will be `as` + * since `a` wasn’t found in string stream + * @param {String} abbr + * @param {String} string + * @return {String} + */ +function css_snippets_resolver_es_getUnmatchedPart(abbr, string) { + for (let i = 0, lastPos = 0; i < abbr.length; i++) { + lastPos = string.indexOf(abbr[i], lastPos); + if (lastPos === -1) { + return abbr.slice(i); + } + lastPos++; + } + + return ''; +} + +/** + * Check if given CSS value token is a keyword + * @param {*} token + * @return {Boolean} + */ +function css_snippets_resolver_es_isKeyword$1(token) { + return css_snippets_resolver_es_tokenTypeOf(token, 'keyword'); +} + +/** + * Check if given CSS value token is a numeric value + * @param {*} token + * @return {Boolean} + */ +function css_snippets_resolver_es_isNumericValue(token) { + return css_snippets_resolver_es_tokenTypeOf(token, 'numeric'); +} + +function css_snippets_resolver_es_tokenTypeOf(token, type) { + return token && typeof token === 'object' && token.type === type; +} + +/** + * Resolves numeric value for given CSS property + * @param {String} property CSS property name + * @param {NumericValue} token CSS numeric value token + * @param {Object} formatOptions Formatting options for units + * @return {NumericValue} + */ +function css_snippets_resolver_es_resolveNumericValue(property, token, formatOptions) { + if (token.unit) { + token.unit = formatOptions.unitAliases[token.unit] || token.unit; + } else if (token.value !== 0 && css_snippets_resolver_es_unitlessProperties.indexOf(property) === -1) { + // use `px` for integers, `em` for floats + // NB: num|0 is a quick alternative to Math.round(0) + token.unit = token.value === (token.value | 0) ? formatOptions.intUnit : formatOptions.floatUnit; + } + + return token; +} + +/* harmony default export */ var dist_css_snippets_resolver_es = (dist_css_snippets_resolver_es_index); + +//# sourceMappingURL=css-snippets-resolver.es.js.map +// CONCATENATED MODULE: ../node_modules/@emmetio/html-matcher/dist/html-matcher.es.js +var html_matcher_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + + + +let html_matcher_es_Node = class Node { + constructor(stream, type, open, close) { + this.stream = stream; + this.type = type; + this.open = open; + this.close = close; + + this.children = []; + this.parent = null; + } + + /** + * Returns node name + * @return {String} + */ + get name() { + if (this.type === 'tag' && this.open) { + return this.open && this.open.name && this.open.name.value; + } + + return '#' + this.type; + } + + /** + * Returns attributes of current node + * @return {Array} + */ + get attributes() { + return this.open && this.open.attributes; + } + + /** + * Returns node’s start position in stream + * @return {*} + */ + get start() { + return this.open && this.open.start; + } + + /** + * Returns node’s start position in stream + * @return {*} + */ + get end() { + return this.close ? this.close.end : this.open && this.open.end; + } + + get firstChild() { + return this.children[0]; + } + + get nextSibling() { + const ix = this.getIndex(); + return ix !== -1 ? this.parent.children[ix + 1] : null; + } + + get previousSibling() { + const ix = this.getIndex(); + return ix !== -1 ? this.parent.children[ix - 1] : null; + } + + /** + * Returns current element’s index in parent list of child nodes + * @return {Number} + */ + getIndex() { + return this.parent ? this.parent.children.indexOf(this) : -1; + } + + /** + * Adds given node as a child + * @param {Node} node + * @return {Node} Current node + */ + addChild(node) { + this.removeChild(node); + this.children.push(node); + node.parent = this; + return this; + } + + /** + * Removes given node from current node’s child list + * @param {Node} node + * @return {Node} Current node + */ + removeChild(node) { + const ix = this.children.indexOf(node); + if (ix !== -1) { + this.children.splice(ix, 1); + node.parent = null; + } + + return this; + } +}; + +/** + * A token factory method + * @param {StreamReader} stream + * @param {Point|Function} start Tokens’ start location or stream consumer + * @param {Point} [end] Tokens’ end location + * @return {Token} + */ + +var html_matcher_es_token = function (stream, start, end) { + return typeof start === 'function' ? eatToken(stream, start) : new Token(stream, start, end); +}; + +/** + * Consumes characters from given stream that matches `fn` call and returns it + * as token, if consumed + * @param {StreamReader} stream + * @param {Function} test + * @return {Token} + */ +function eatToken(stream, test) { + const start = stream.pos; + if (stream.eatWhile(test)) { + return new Token(stream, start, stream.pos); + } + + stream.pos = start; +} + +/** + * A structure describing text fragment in content stream + */ +let Token = class Token { + /** + * @param {ContentStreamReader} stream + * @param {Point} start Tokens’ start location in content stream + * @param {Point} end Tokens’ end location in content stream + */ + constructor(stream, start, end) { + this.stream = stream; + this.start = start != null ? start : stream.start; + this.end = end != null ? end : stream.pos; + this._value = null; + } + + /** + * Returns token textual value + * NB implemented as getter to reduce unnecessary memory allocations for + * strings that not required + * @return {String} + */ + get value() { + if (this._value === null) { + const start = this.stream.start; + const end = this.stream.pos; + + this.stream.start = this.start; + this.stream.pos = this.end; + this._value = this.stream.current(); + + this.stream.start = start; + this.stream.pos = end; + } + + return this._value; + } + + toString() { + return this.value; + } + + valueOf() { + return `${this.value} [${this.start}; ${this.end}]`; + } +}; + + +const LANGLE = 60; +const RANGLE = 62; // < and > +const LSQUARE = 91; +const RSQUARE = 93; // [ and ] +const LROUND = 40; +const RROUND = 41; // ( and ) +const LCURLY = 123; +const RCURLY = 125; // { and } + +const html_matcher_es_opt = { throws: true }; + +/** + * Consumes paired tokens (like `[` and `]`) with respect of nesting and embedded + * quoted values + * @param {StreamReader} stream + * @return {Token} A token with consumed paired character + */ +var eatPaired = function (stream) { + const start = stream.pos; + const consumed = eatPair(stream, LANGLE, RANGLE, html_matcher_es_opt) || eatPair(stream, LSQUARE, RSQUARE, html_matcher_es_opt) || eatPair(stream, LROUND, RROUND, html_matcher_es_opt) || eatPair(stream, LCURLY, RCURLY, html_matcher_es_opt); + + if (consumed) { + return html_matcher_es_token(stream, start); + } +}; + +const SLASH$1 = 47; // / +const html_matcher_es_EQUALS = 61; // = +const RIGHT_ANGLE$1 = 62; // > + +/** + * Consumes attributes from given stream + * @param {StreamReader} stream + * @return {Array} Array of consumed attributes + */ +var eatAttributes = function (stream) { + const result = []; + let name, value, attr; + + while (!stream.eof()) { + stream.eatWhile(isSpace); + attr = { start: stream.pos }; + + // A name could be a regular name or expression: + // React-style –
+ // Angular-style –
+ if (attr.name = eatAttributeName(stream)) { + // Consumed attribute name. Can be an attribute with name + // or boolean attribute. The value can be React-like expression + if (stream.eat(html_matcher_es_EQUALS)) { + attr.value = eatAttributeValue(stream); + } else { + attr.boolean = true; + } + attr.end = stream.pos; + result.push(attr); + } else if (isTerminator(stream.peek())) { + // look for tag terminator in order to skip any other possible characters + // (maybe junk) + break; + } else { + stream.next(); + } + } + + return result; +}; + +/** + * Consumes attribute name from current location + * @param {StreamReader} stream + * @return {Token} + */ +function eatAttributeName(stream) { + return eatPaired(stream) || html_matcher_es_token(stream, isAttributeName); +} + +/** + * Consumes attribute value from given location + * @param {StreamReader} stream + * @return {Token} + */ +function eatAttributeValue(stream) { + const start = stream.pos; + if (eatQuoted(stream)) { + // Should return token that points to unquoted value. + // Use stream readers’ public API to traverse instead of direct + // manipulation + const current = stream.pos; + let valueStart, valueEnd; + + stream.pos = start; + stream.next(); + valueStart = stream.start = stream.pos; + + stream.pos = current; + stream.backUp(1); + valueEnd = stream.pos; + + const result = html_matcher_es_token(stream, valueStart, valueEnd); + stream.pos = current; + return result; + } + + return eatPaired(stream) || html_matcher_es_eatUnquoted(stream); +} + +/** + * Check if given code belongs to attribute name. + * NB some custom HTML variations allow non-default values in name, like `*ngFor` + * @param {Number} code + * @return {Boolean} + */ +function isAttributeName(code) { + return code !== html_matcher_es_EQUALS && !isTerminator(code) && !isSpace(code); +} + +/** + * Check if given code is tag terminator + * @param {Number} code + * @return {Boolean} + */ +function isTerminator(code) { + return code === RIGHT_ANGLE$1 || code === SLASH$1; +} + +/** + * Eats unquoted value from stream + * @param {StreamReader} stream + * @return {Token} + */ +function html_matcher_es_eatUnquoted(stream) { + return html_matcher_es_token(stream, html_matcher_es_isUnquoted); +} + +/** + * Check if given character code is valid unquoted value + * @param {Number} code + * @return {Boolean} + */ +function html_matcher_es_isUnquoted(code) { + return !isNaN(code) && !isQuote(code) && !isSpace(code) && !isTerminator(code); +} + +const html_matcher_es_DASH = 45; // - +const html_matcher_es_DOT = 46; // . +const html_matcher_es_SLASH = 47; // / +const html_matcher_es_COLON = 58; // : +const LEFT_ANGLE = 60; // < +const RIGHT_ANGLE = 62; // > +const UNDERSCORE = 95; // _ + +/** + * Parses tag definition (open or close tag) from given stream state + * @param {StreamReader} stream Content stream reader + * @return {Object} + */ +var tag = function (stream) { + const start = stream.pos; + + if (stream.eat(LEFT_ANGLE)) { + const model = { type: stream.eat(html_matcher_es_SLASH) ? 'close' : 'open' }; + + if (model.name = eatTagName(stream)) { + if (model.type !== 'close') { + model.attributes = eatAttributes(stream); + stream.eatWhile(isSpace); + model.selfClosing = stream.eat(html_matcher_es_SLASH); + } + + if (stream.eat(RIGHT_ANGLE)) { + // tag properly closed + return html_matcher_es__extends(html_matcher_es_token(stream, start), model); + } + } + } + + // invalid tag, revert to original position + stream.pos = start; + return null; +}; + +/** + * Eats HTML identifier (tag or attribute name) from given stream + * @param {StreamReader} stream + * @return {Token} + */ +function eatTagName(stream) { + return html_matcher_es_token(stream, isTagName); +} + +/** + * Check if given character code can be used as HTML/XML tag name + * @param {Number} code + * @return {Boolean} + */ +function isTagName(code) { + return isAlphaNumeric(code) || code === html_matcher_es_COLON // colon is used for namespaces + || code === html_matcher_es_DOT // in rare cases declarative tag names may have dots in names + || code === html_matcher_es_DASH || code === UNDERSCORE; +} + +/** + * Eats array of character codes from given stream + * @param {StreamReader} stream + * @param {Number[]} codes Array of character codes + * @return {Boolean} + */ +function eatArray(stream, codes) { + const start = stream.pos; + + for (let i = 0; i < codes.length; i++) { + if (!stream.eat(codes[i])) { + stream.pos = start; + return false; + } + } + + stream.start = start; + return true; +} + +/** + * Consumes section from given string which starts with `open` character codes + * and ends with `close` character codes + * @param {StreamReader} stream + * @param {Number[]} open + * @param {Number[]} close + * @return {Boolean} Returns `true` if section was consumed + */ +function eatSection(stream, open, close, allowUnclosed) { + const start = stream.pos; + if (eatArray(stream, open)) { + // consumed `'); + +/** + * Consumes HTML comment from given stream + * @param {StreamReader} stream + * @return {Token} + */ +var comment = function (stream) { + const start = stream.pos; + if (eatSection(stream, html_matcher_es_open, html_matcher_es_close, true)) { + const result = html_matcher_es_token(stream, start); + result.type = 'comment'; + return result; + } + + return null; +}; + +const open$1 = toCharCodes(''); + +/** + * Consumes CDATA from given stream + * @param {StreamReader} stream + * @return {Token} + */ +var cdata = function (stream) { + const start = stream.pos; + if (eatSection(stream, open$1, close$1, true)) { + const result = html_matcher_es_token(stream, start); + result.type = 'cdata'; + return result; + } + + return null; +}; + +const html_matcher_es_defaultOptions = { + /** + * Expect XML content in searching content. It alters how should-be-empty + * elements are treated: for example, in XML mode parser will try to locate + * closing pair for `
` tag + * @type {Boolean} + */ + xml: false, + + special: ['script', 'style'], + + /** + * List of elements that should be treated as empty (e.g. without closing tag) + * in non-XML syntax + * @type {Array} + */ + empty: ['img', 'meta', 'link', 'br', 'base', 'hr', 'area', 'wbr', 'col', 'embed', 'input', 'param', 'source', 'track'] +}; + +/** + * Parses given content into a DOM-like structure + * @param {String|StreamReader} content + * @param {Object} options + * @return {Node} + */ +function html_matcher_es_parse(content, options) { + options = html_matcher_es__extends({}, html_matcher_es_defaultOptions, options); + const stream = typeof content === 'string' ? new stream_reader_es(content) : content; + + const root = new html_matcher_es_Node(stream, 'root'); + const empty = new Set(options.empty); + const special = options.special.reduce((map, name) => map.set(name, toCharCodes(``)), new Map()); + const isEmpty = (token, name) => token.selfClosing || !options.xml && empty.has(name); + + let m, + node, + name, + stack = [root]; + + while (!stream.eof()) { + if (m = match(stream)) { + name = getName(m); + + if (m.type === 'open') { + // opening tag + node = new html_matcher_es_Node(stream, 'tag', m); + last(stack).addChild(node); + if (special.has(name)) { + node.close = consumeSpecial(stream, special.get(name)); + } else if (!isEmpty(m, name)) { + stack.push(node); + } + } else if (m.type === 'close') { + // closing tag, find it’s matching opening tag + for (let i = stack.length - 1; i > 0; i--) { + if (stack[i].name.toLowerCase() === name) { + stack[i].close = m; + stack = stack.slice(0, i); + break; + } + } + } else { + last(stack).addChild(new html_matcher_es_Node(stream, m.type, m)); + } + } else { + stream.next(); + } + } + + return root; +} + +/** + * Matches known token in current state of given stream + * @param {ContentStreamReader} stream + * @return {Token} + */ +function match(stream) { + // fast-path optimization: check for `<` code + if (stream.peek() === 60 /* < */) { + return comment(stream) || cdata(stream) || tag(stream); + } +} + +/** + * @param {StreamReader} stream + * @param {Number[]} codes + * @return {Token} + */ +function consumeSpecial(stream, codes) { + const start = stream.pos; + let m; + + while (!stream.eof()) { + if (eatArray(stream, codes)) { + stream.pos = stream.start; + return tag(stream); + } + stream.next(); + } + + stream.pos = start; + return null; +} + +/** + * Returns name of given matched token + * @param {Token} tag + * @return {String} + */ +function getName(tag$$1) { + return tag$$1.name ? tag$$1.name.value.toLowerCase() : `#${tag$$1.type}`; +} + +function last(arr) { + return arr[arr.length - 1]; +} + +/* harmony default export */ var html_matcher_es = (html_matcher_es_parse); +// CONCATENATED MODULE: ../node_modules/@emmetio/codemirror-plugin/dist/emmet-codemirror-plugin.es.js +var emmet_codemirror_plugin_es__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + + + + + + + + + +const editorField = (index, placeholder = '') => `\${${index}${placeholder ? ':' + placeholder : ''}}`; + +/** + * Returns resolved Emmet config for `pos` location of given editor + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} [pos] Point in editor where syntax should be detected. + * Uses `editor.getCursor()` if not given + * @param {Object} [options] Additional options to override before config resolve + * @return {Object} + */ +function createConfig(editor, pos, options) { + pos = pos || editor.getCursor(); + const syntax = getSyntax(editor, pos); + + /** @type {EmmetConfig} */ + const config = config_es(emmet_codemirror_plugin_es__extends({ field: editorField }, editor.getOption('emmet'), options), { syntax }); + + const mode = editor.getModeAt(pos); + if (syntax === 'jsx') { + config.profile = emmet_codemirror_plugin_es__extends({ selfClosingStyle: 'xml' }, config.profile); + config.options = emmet_codemirror_plugin_es__extends({ jsx: true }, config.options); + } else if (mode.name === 'xml') { + config.profile = emmet_codemirror_plugin_es__extends({ selfClosingStyle: mode.configuration }, config.profile); + } + + return config; +} + +/** + * Detect Emmet syntax from given editor’s position. + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} [pos] + * @return {String} Returns `null` if Emmet syntax can’t be detected + */ +function getSyntax(editor, pos) { + const rootMode = editor.getMode(); + if (rootMode.name === 'jsx' || rootMode.name === 'javascript') { + return rootMode.name; + } + + const mode = editor.getModeAt(pos); + return mode.name === 'xml' ? 'html' : mode.name; +} + +const LINE_END = 10; // \n + +/** + * A stream reader for CodeMirror editor + */ +let CodeMirrorStreamReader = class CodeMirrorStreamReader extends stream_reader_es { + /** + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} [pos] + * @param {CodeMirror.Range} [limit] + */ + constructor(editor, pos, limit) { + super(); + const CodeMirror = editor.constructor; + this.editor = editor; + this.start = this.pos = pos || CodeMirror.Pos(0, 0); + + const lastLine = editor.lastLine(); + this._eof = limit ? limit.to : CodeMirror.Pos(lastLine, this._lineLength(lastLine)); + this._sof = limit ? limit.from : CodeMirror.Pos(0, 0); + } + + /** + * Returns true only if the stream is at the beginning of the file. + * @returns {Boolean} + */ + sof() { + return comparePos(this.pos, this._sof) <= 0; + } + + /** + * Returns true only if the stream is at the end of the file. + * @returns {Boolean} + */ + eof() { + return comparePos(this.pos, this._eof) >= 0; + } + + /** + * Creates a new stream instance which is limited to given `start` and `end` + * points for underlying buffer + * @param {CodeMirror.Pos} start + * @param {CodeMirror.Pos} end + * @return {CodeMirrorStreamReader} + */ + limit(from, to) { + return new this.constructor(this.editor, from, { from, to }); + } + + /** + * Returns the next character code in the stream without advancing it. + * Will return NaN at the end of the file. + * @returns {Number} + */ + peek() { + const { line, ch } = this.pos; + const lineStr = this.editor.getLine(line); + return ch < lineStr.length ? lineStr.charCodeAt(ch) : LINE_END; + } + + /** + * Returns the next character in the stream and advances it. + * Also returns NaN when no more characters are available. + * @returns {Number} + */ + next() { + if (!this.eof()) { + const code = this.peek(); + this.pos = emmet_codemirror_plugin_es__extends({}, this.pos, { ch: this.pos.ch + 1 }); + + if (this.pos.ch >= this._lineLength(this.pos.line)) { + this.pos.line++; + this.pos.ch = 0; + } + + if (this.eof()) { + // handle edge case where position can move on next line + // after EOF + this.pos = emmet_codemirror_plugin_es__extends({}, this._eof); + } + + return code; + } + + return NaN; + } + + /** + * Backs up the stream n characters. Backing it up further than the + * start of the current token will cause things to break, so be careful. + * @param {Number} n + */ + backUp(n) { + const CodeMirror = this.editor.constructor; + + let { line, ch } = this.pos; + ch -= n || 1; + + while (line >= 0 && ch < 0) { + line--; + ch += this._lineLength(line); + } + + this.pos = line < 0 || ch < 0 ? CodeMirror.Pos(0, 0) : CodeMirror.Pos(line, ch); + + return this.peek(); + } + + /** + * Get the string between the start of the current token and the + * current stream position. + * @returns {String} + */ + current() { + return this.substring(this.start, this.pos); + } + + /** + * Returns contents for given range + * @param {Point} from + * @param {Point} to + * @return {String} + */ + substring(from, to) { + return this.editor.getRange(from, to); + } + + /** + * Creates error object with current stream state + * @param {String} message + * @return {Error} + */ + error(message) { + const err = new Error(`${message} at line ${this.pos.line}, column ${this.pos.ch}`); + err.originalMessage = message; + err.pos = this.pos; + err.string = this.string; + return err; + } + + /** + * Returns length of given line, including line ending + * @param {Number} line + * @return {Number} + */ + _lineLength(line) { + const isLast = line === this.editor.lastLine(); + return this.editor.getLine(line).length + (isLast ? 0 : 1); + } +}; + + +function comparePos(a, b) { + return a.line - b.line || a.ch - b.ch; +} + +/** + * Returns token used for single indentation in given editor + * @param {CodeMirror.Editor} editor + * @return {String} + */ +function getIndentation(editor) { + if (!editor.getOption('indentWithTabs')) { + return repeatString(' ', editor.getOption('indentUnit')); + } + + return '\t'; +} + +/** + * Normalizes text according to given CodeMirror instance indentation + * preferences + * @param {String} text + * @param {CodeMirror.Editor} editor + * @param {String} [indentation] Applies `indentText()` with given argument, if provided + * @return {String} + */ +function normalizeText(editor, text, indentation) { + let lines = emmet_codemirror_plugin_es_splitByLines(text); + const indent = getIndentation(editor); + + if (indent !== '\t') { + lines = lines.map(line => line.replace(/^\t+/, tabs => repeatString(indent, tabs.length))); + } + + if (indentation) { + lines = lines.map((line, i) => i ? indentation + line : line); + } + + return lines.join('\n'); +} + +/** + * Splits given text by lines + * @param {String} text + * @return {String[]} Lines of text + */ +function emmet_codemirror_plugin_es_splitByLines(text) { + return Array.isArray(text) ? text : text.split(/\r\n|\r|\n/g); +} + +function repeatString(str, count) { + let result = ''; + while (0 < count--) { + result += str; + } + + return result; +} + +/** + * Quick and dirty way to remove fields from given string + * @param {String} str + * @return {String} + */ +function removeFields(str) { + return field_parser_es(str).string; +} + +/** + * Check if given range contains point + * @param {CodeMirror.Range} range + * @param {CodeMirror.Position} pos + * @param {Boolean} [exclude] Exclude range and and start + * @return {Boolean} + */ +function containsPos(range, pos, exclude) { + return exclude ? comparePos$1(pos, range.from) > 0 && comparePos$1(pos, range.to) < 0 : comparePos$1(pos, range.from) >= 0 && comparePos$1(pos, range.to) <= 0; +} + +function comparePos$1(a, b) { + return a.line - b.line || a.ch - b.ch; +} + +function rangeFromNode(node) { + return { + from: node.start, + to: node.end + }; +} + +/** + * Narrows given `{from, to}` range to first non-whitespace characters in given + * editor content + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} from + * @param {CodeMirror.Position} [to] + * @returns {Object} + */ +function narrowToNonSpace(editor, from, to) { + const stream = new CodeMirrorStreamReader(editor, from); + + stream.eatWhile(isSpace); + from = stream.pos; + + if (to) { + stream.pos = to; + stream.backUp(); + + while (!stream.sof() && isSpace(stream.peek())) { + stream.backUp(); + } + + stream.next(); + to = stream.pos; + } else { + to = from; + } + + return { from, to }; +} + +/** + * Returns nearest CSS property name, left to given position + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} pos + * @returns {String} + */ +function getCSSPropertyName(editor, pos) { + const line = pos.line; + let ch = pos.ch, + token; + + while (ch >= 0) { + token = editor.getTokenAt({ line, ch }); + if (token.type === 'property') { + return token.string; + } + + if (token.start !== ch) { + ch = token.start; + } else { + break; + } + } +} + +/** + * Check if given position is inside CSS property value + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} pos + * @return {Boolean} + */ +function isCSSPropertyValue(editor, pos) { + const mode = editor.getModeAt(pos); + if (mode && mode.name === 'css') { + const token = editor.getTokenAt(pos); + const state = token.state && token.state.localState || token.state; + return state && state.context && state.context.type === 'prop'; + } + + return false; +} + +/** + * Context-aware abbreviation extraction from given editor. + * Detects syntax context in `pos` editor location and, if it allows Emmet + * abbreviation to be extracted here, returns object with extracted abbreviation, + * its location and config. + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} pos + */ +function emmet_codemirror_plugin_es_extractAbbreviation(editor, pos, contextAware) { + const config = createConfig(editor, pos); + + if (contextAware && !canExtract(editor, pos, config)) { + return null; + } + + const extracted = extract_abbreviation_es(editor.getLine(pos.line), pos.ch, { + lookAhead: true, + syntax: config.type, + prefix: config.syntax === 'jsx' && editor.getOption('jsxBracket') ? '<' : '' + }); + + if (extracted) { + const from = { + line: pos.line, + ch: extracted.start + }; + const to = { + line: pos.line, + ch: extracted.end + }; + + if (config.type === 'stylesheet' && contextAware) { + // In case of stylesheet syntaxes (CSS, LESS) we should narrow down + // expand context to property value, if possible + if (isCSSPropertyValue(editor, pos)) { + config.options = emmet_codemirror_plugin_es__extends({ property: getCSSPropertyName(editor, pos) }, config.options); + } + } + + return { + abbreviation: extracted.abbreviation, + range: { from, to }, + config + }; + } +} + +/** + * Check if abbreviation can be extracted from given position + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} pos + * @param {Object} config + * @return {Boolean} + */ +function canExtract(editor, pos, config) { + const tokenType = editor.getTokenTypeAt(pos); + + if (config.type === 'stylesheet') { + return tokenType !== 'comment' && tokenType !== 'string'; + } + + if (config.syntax === 'html') { + return tokenType === null; + } + + if (config.syntax === 'slim' || config.syntax === 'pug') { + return tokenType === null || tokenType === 'tag' || tokenType && /attribute/.test(tokenType); + } + + if (config.syntax === 'haml') { + return tokenType === null || tokenType === 'attribute'; + } + + if (config.syntax === 'jsx') { + // JSX a bit tricky, delegate it to caller + return true; + } + + return false; +} + +/** + * Replaces `range` in `editor` with `text` snippet. A snippet is a string containing + * tabstops/fields like `${index:placeholder}`: this function will locate such + * fields and place cursor at first one. + * Inserted snippet will be automatically matched with current editor indentation + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Range} range + * @param {String} text + */ +function insertSnippet(editor, range, text) { + const line = editor.getLine(range.from.line); + const matchIndent = line.match(/^\s+/); + let snippet = normalizeText(editor, text, matchIndent && matchIndent[0]); + const fieldModel = field_parser_es(snippet); + + return editor.operation(() => { + editor.replaceRange(fieldModel.string, range.from, range.to); + + // Position cursor + const startIx = editor.indexFromPos(range.from); + if (fieldModel.fields.length) { + const field = fieldModel.fields[0]; + const from = editor.posFromIndex(field.location + startIx); + const to = editor.posFromIndex(field.location + field.length + startIx); + editor.setSelection(from, to); + } else { + editor.setCursor(editor.posFromIndex(startIx + fieldModel.string.length)); + } + + return true; + }); +} + +const emmetMarkerClass = 'emmet-abbreviation'; + +/** + * Returns parsed abbreviation from given position in `editor`, if possible. + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} pos + * @param {Boolean} [contextAware] Use context-aware abbreviation detection + * @returns {Abbreviation} + */ +function abbreviationFromPosition(editor, pos, contextAware) { + // Try to find abbreviation marker from given position + const marker = findMarker(editor, pos); + if (marker && marker.model) { + return marker.model; + } + + // Try to extract abbreviation from given position + const extracted = emmet_codemirror_plugin_es_extractAbbreviation(editor, pos, contextAware); + if (extracted) { + try { + const abbr = new emmet_codemirror_plugin_es_Abbreviation(extracted.abbreviation, extracted.range, extracted.config); + return abbr.valid(editor, contextAware) ? abbr : null; + } catch (err) { + // skip + // console.warn(err); + } + } +} + +/** + * Returns *valid* Emmet abbreviation marker (if any) for given position of editor + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} [pos] + * @return {CodeMirror.TextMarker} + */ +function findMarker(editor, pos) { + const markers = editor.findMarksAt(pos); + for (let i = 0, marker; i < markers.length; i++) { + marker = markers[i]; + if (marker.className === emmetMarkerClass) { + if (isValidMarker(editor, marker)) { + return marker; + } + + marker.clear(); + } + } +} + +/** + * Removes Emmet abbreviation markers from given editor + * @param {CodeMirror.Editor} editor + */ +function clearMarkers(editor) { + const markers = editor.getAllMarks(); + for (let i = 0; i < markers.length; i++) { + if (markers[i].className === emmetMarkerClass) { + markers[i].clear(); + } + } +} + +/** + * Marks Emmet abbreviation for given editor position, if possible + * @param {CodeMirror.Editor} editor Editor where abbreviation marker should be created + * @param {Abbreviation} model Parsed abbreviation model + * @return {CodeMirror.TextMarker} Returns `undefined` if no valid abbreviation under caret + */ +function createMarker(editor, model) { + const { from, to } = model.range; + const marker = editor.markText(from, to, { + inclusiveLeft: true, + inclusiveRight: true, + clearWhenEmpty: true, + className: emmetMarkerClass + }); + marker.model = model; + return marker; +} + +/** + * Ensures that given editor Emmet abbreviation marker contains valid Emmet abbreviation + * and updates abbreviation model if required + * @param {CodeMirror} editor + * @param {CodeMirror.TextMarket} marker + * @return {Boolean} `true` if marker contains valid abbreviation + */ +function isValidMarker(editor, marker) { + const range = marker.find(); + + // No newlines inside abbreviation + if (range.from.line !== range.to.line) { + return false; + } + + // Make sure marker contains valid abbreviation + let text = editor.getRange(range.from, range.to); + if (!text || /^\s|\s$/g.test(text)) { + return false; + } + + if (marker.model && marker.model.config.syntax === 'jsx' && text[0] === '<') { + text = text.slice(1); + } + + if (!marker.model || marker.model.abbreviation !== text) { + // marker contents was updated, re-parse abbreviation + try { + marker.model = new emmet_codemirror_plugin_es_Abbreviation(text, range, marker.model.config); + if (!marker.model.valid(editor, true)) { + marker.model = null; + } + } catch (err) { + console.warn(err); + marker.model = null; + } + } + + return Boolean(marker.model && marker.model.snippet); +} + +let emmet_codemirror_plugin_es_Abbreviation = class Abbreviation { + /** + * @param {String} abbreviation Abbreviation string + * @param {CodeMirror.Range} range Abbreviation location in editor + * @param {Object} [config] + */ + constructor(abbreviation, range, config) { + this.abbreviation = abbreviation; + this.range = range; + this.config = config; + this.ast = parse$2(abbreviation, config); + this.snippet = expand$2(this.ast, config); + this.preview = removeFields(this.snippet); + } + + /** + * Inserts current expanded abbreviation into given `editor` by replacing + * `range` + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Range} [range] + */ + insert(editor, range) { + return insertSnippet(editor, range || this.range, this.snippet); + } + + /** + * Check if parsed abbreviation is valid + * @param {Boolean} [contextAware] Perform context-aware validation: ensure + * that expanded result is expected at abbreviation location + */ + valid(editor, contextAware) { + if (this.preview && this.abbreviation !== this.preview) { + return contextAware && this.config.type === 'stylesheet' ? this._isValidForStylesheet(editor) : true; + } + + return false; + } + + _isValidForStylesheet(editor) { + const pos = this.range.from; + const token = editor.getTokenAt(pos); + + if (/^[#!]/.test(this.abbreviation)) { + // Abbreviation is a property value + return isCSSPropertyValue(editor, pos); + } + + // All expanded nodes are properties? Properties has names, regular snippets don’t. + const isProperty = this.ast.children.every(node => node.name); + const state = token.state && token.state.localState || token.state; + + if (isProperty) { + // Expanded abbreviation consists of properties: make sure we’re inside + // block context + // NB: in Sass, no actual block context since it’s indetation-based + return this.config.syntax === 'sass' || state && state.context && state.context.type === 'block'; + } + + // Expanded abbreviations are basic snippets: allow them everywhere, but forbid + // if expanded result equals abbreviation (meaningless). + return true; + } +}; + +/** + * Expand abbreviation command + * @param {CodeMirror.Editor} editor + * @param {Boolean} contextAware + */ + +function expandAbbreviation(editor, contextAware) { + if (editor.somethingSelected()) { + return editor.constructor.Pass; + } + + const abbr = abbreviationFromPosition(editor, editor.getCursor(), contextAware); + + if (abbr) { + abbr.insert(editor); + clearMarkers(editor); + return true; + } + + // If no abbreviation was expanded, allow editor to handle different + // action for keyboard shortcut (Tab key mostly) + return editor.constructor.Pass; +} + +function emmetInsertLineBreak(editor) { + const between = editor.listSelections().map(sel => betweenTags(editor, sel)); + + if (!between.some(Boolean)) { + return editor.constructor.Pass; + } + + editor.operation(() => { + let sels = editor.listSelections(); + const singleSep = editor.doc.lineSeparator(); + const doubleSep = singleSep + singleSep; + + // Step 1: insert newlines either single or double depending on selection + for (let i = sels.length - 1; i >= 0; i--) { + editor.replaceRange(between[i] ? doubleSep : singleSep, sels[i].anchor, sels[i].head, '+newline'); + } + + // Step 2: indent inserted lines + sels = editor.listSelections(); + for (let i = 0; i < sels.length; i++) { + editor.indentLine(sels[i].from().line, null, true); + + if (between[i]) { + editor.indentLine(sels[i].from().line - 1, null, true); + } + } + + // Step 3: adjust caret positions + editor.setSelections(editor.listSelections().map((sel, i) => { + if (between[i]) { + const line = sel.from().line - 1; + const cursor = { + line, + ch: editor.getLine(line).length + }; + return { anchor: cursor, head: cursor }; + } + + return sel; + })); + }); +} + +/** + * Check if given range is a single caret between tags + * @param {CodeMirror} editor + * @param {CodeMirror.range} range + */ +function betweenTags(editor, range) { + if (equalCursorPos(range.anchor, range.head)) { + const cursor = range.anchor; + const mode = editor.getModeAt(cursor); + + if (mode.name === 'xml') { + const left = editor.getTokenAt(cursor); + const right = editor.getTokenAt(emmet_codemirror_plugin_es__extends({}, cursor, { ch: cursor.ch + 1 })); + + return left.type === 'tag bracket' && left.string === '>' && right.type === 'tag bracket' && right.string === ' line.trim()); + + prompt(editor, 'Enter abbreviation to wrap with:', abbr => { + if (abbr) { + const model = new emmet_codemirror_plugin_es_Abbreviation(abbr, range, createConfig(editor, range.from, { text })); + model.insert(editor); + } + }); + } else { + console.warn('Nothing to wrap'); + } +} + +/** + * Returns content range that should be wrapped + * @param {CodeMirror} editor + */ +function getWrappingContentRange(editor) { + if (editor.somethingSelected()) { + const sel = editor.listSelections().filter(sel => sel.anchor !== sel.head)[0]; + if (sel) { + return comparePos$1(sel.anchor, sel.head) < 0 ? { from: sel.anchor, to: sel.head } : { from: sel.head, to: sel.anchor }; + } + } + + // Nothing selected, find parent HTML node and return range for its content + return getTagRangeForPos(editor, editor.getCursor()); +} + +/** + * Returns either inner or outer tag range (depending on `pos` location) + * for given position + * @param {CodeMirror} editor + * @param {Object} pos + * @return {Object} + */ +function getTagRangeForPos(editor, pos) { + const model = editor.getEmmetDocumentModel(); + const tag = model && model.nodeForPoint(pos); + + if (!tag) { + return null; + } + + // Depending on given position, return either outer or inner tag range + if (inRange(tag.open, pos) || inRange(tag.close, pos)) { + // Outer range + return rangeFromNode(tag); + } + + // Inner range + const from = tag.open.end; + const to = tag.close ? tag.close.start : tag.open.end; + + return narrowToNonSpace(editor, from, to); +} + +function inRange(tag, pos) { + return tag && containsPos(rangeFromNode(tag), pos); +} + +function defaultPrompt(editor, message, callback) { + callback(window.prompt(message)); +} + +/** + * Marks Emmet abbreviation for given editor position, if possible + * @param {CodeMirror.Editor} editor Editor where abbreviation marker should be created + * @param {CodeMirror.Position} pos Editor position where abbreviation marker + * should be created. Abbreviation will be automatically extracted from given position + * @return {CodeMirror.TextMarker} Returns `undefined` if no valid abbreviation under caret + */ +function markAbbreviation(editor, pos) { + const marker = findMarker(editor, pos); + if (marker) { + // there’s active marker with valid abbreviation + return marker; + } + + // No active marker: remove previous markers and create new one, if possible + clearMarkers(editor); + + const model = abbreviationFromPosition(editor, pos, true); + + if (model) { + return createMarker(editor, model); + } +} + +/** + * Returns available completions from given editor + * @param {CodeMirror.Editor} editor + * @param {Abbreviation} abbrModel Parsed Emmet abbreviation model for which + * completions should be populated + * @param {CodeMirror.Position} abbrPos Abbreviation location in editor + * @param {CodeMirror.Position} [pos] Cursor position in editor + * @return {EmmetCompletion[]} + */ +function autocompleteProvider(editor, pos) { + pos = pos || editor.getCursor(); + let completions = []; + + // Provide two types of completions: + // 1. Expanded abbreviation + // 2. Snippets + + const abbreviation = abbreviationFromPosition(editor, pos, true); + // NB: Check for edge case: expanded abbreviation equals to original + // abbreviation (for example, `li.item` expands to `li.item` in Slim), + // no need to provide completion for this case + if (abbreviation && abbreviation.abbreviation !== abbreviation.snippet) { + completions.push(expandedAbbreviationCompletion(editor, pos, abbreviation)); + } + + const config = abbreviation ? abbreviation.config : createConfig(editor, pos); + + if (config.type === 'stylesheet') { + completions = completions.concat(getStylesheetCompletions(editor, pos, config)); + } else { + completions = completions.concat(getMarkupCompletions(editor, pos, config)); + } + + return { + type: config.type, + syntax: config.syntax, + abbreviation, + completions: completions.filter(Boolean) + }; +} + +/** + * Returns completions for markup syntaxes (HTML, Slim, Pug etc.) + * @param {CodeMirror} editor + * @param {CodeMirror.Position} pos Cursor position in editor + * @param {Object} config Resolved Emmet config + * @return {EmmetCompletion[]} + */ +function getMarkupCompletions(editor, pos, config) { + const line = editor.getLine(pos.line).slice(0, pos.ch); + const prefix = extractPrefix(line, /[\w:\-$@]/); + + // Make sure that current position precedes element name (e.g. not attribute, + // class, id etc.) + if (prefix) { + const prefixRange = { + from: { line: pos.line, ch: pos.ch - prefix.length }, + to: pos + }; + + return getSnippetCompletions(editor, pos, config).filter(completion => completion.key !== prefix && completion.key.indexOf(prefix) === 0).map(completion => new EmmetCompletion('snippet', editor, prefixRange, completion.key, completion.preview, completion.snippet)); + } + + return []; +} + +/** + * Returns completions for stylesheet syntaxes + * @param {CodeMirror} editor + * @param {CodeMirror.Position} pos Cursor position in editor + * @param {Object} config Resolved Emmet config + * @return {EmmetCompletion[]} + */ +function getStylesheetCompletions(editor, pos, config) { + const line = editor.getLine(pos.line).slice(0, pos.ch); + const prefix = extractPrefix(line, /[\w-@$]/); + + if (prefix) { + // Make sure that current position precedes element name (e.g. not attribute, + // class, id etc.) + const prefixRange = { + from: { line: pos.line, ch: pos.ch - prefix.length }, + to: pos + }; + + if (config.options && config.options.property) { + const lowerProp = config.options.property.toLowerCase(); + // Find matching CSS property snippet for keyword completions + const completion = getSnippetCompletions(editor, pos, config).find(item => item.property && item.property === lowerProp); + + if (completion && completion.keywords.length) { + return completion.keywords.map(kw => { + return kw.key.indexOf(prefix) === 0 && new EmmetCompletion('value', editor, prefixRange, kw.key, kw.preview, kw.snippet); + }).filter(Boolean); + } + } else { + return getSnippetCompletions(editor, pos, config).filter(completion => completion.key !== prefix && completion.key.indexOf(prefix) === 0).map(completion => new EmmetCompletion('snippet', editor, prefixRange, completion.key, completion.preview, completion.snippet)); + } + } + + return []; +} + +/** + * Returns all possible snippets completions for given editor context. + * Completions are cached in editor for for re-use + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} pos + * @param {Object} config + * @return {Array} + */ +function getSnippetCompletions(editor, pos, config) { + const { type, syntax } = config; + + if (!editor.state.emmetCompletions) { + editor.state.emmetCompletions = {}; + } + + const cache = editor.state.emmetCompletions; + + if (!(syntax in cache)) { + const registry = createSnippetsRegistry(type, syntax, config.snippets); + + cache[syntax] = type === 'stylesheet' ? getStylesheetSnippets(registry, config) : getMarkupSnippets(registry, config); + } + + return cache[syntax]; +} + +/** + * Returns stylesheet snippets list + * @param {SnippetsRegistry} registry + * @return {Array} + */ +function getStylesheetSnippets(registry) { + return css_snippets_resolver_es_convertToCSSSnippets(registry).map(snippet => { + let preview = snippet.property; + const keywords = snippet.keywords(); + if (keywords.length) { + preview += `: ${removeFields(keywords.join(' | '))}`; + } else if (snippet.value) { + preview += `: ${removeFields(snippet.value)}`; + } + + return { + key: snippet.key, + value: snippet.value, + snippet: snippet.key, + property: snippet.property, + keywords: keywords.map(kw => { + const m = kw.match(/^[\w-]+/); + return m && { + key: m[0], + preview: removeFields(kw), + snippet: kw + }; + }).filter(Boolean), + preview + }; + }); +} + +/** + * Returns markup snippets list + * @param {SnippetsRegistry} registry + * @param {Object} config + * @return {Array} + */ +function getMarkupSnippets(registry, config) { + return registry.all({ type: 'string' }).map(snippet => ({ + key: snippet.key, + value: snippet.value, + preview: removeFields(expand$2(snippet.value, config)), + snippet: snippet.key + })); +} + +function expandedAbbreviationCompletion(editor, pos, abbrModel) { + let preview = abbrModel.preview; + if (preview.length > 500) { + preview = preview.slice(0, 500) + '...'; + } + + return new EmmetCompletion('expanded-abbreviation', editor, abbrModel.range, 'Expand abbreviation', preview, (editor, range) => abbrModel.insert(editor, range)); +} + +/** + * Extracts prefix from the end of given string that matches `match` regexp + * @param {String} str + * @param {RegExp} match + * @return {String} Extracted prefix + */ +function extractPrefix(str, match) { + let offset = str.length; + + while (offset > 0) { + if (!match.test(str[offset - 1])) { + break; + } + offset--; + } + + return str.slice(offset); +} + +let EmmetCompletion = class EmmetCompletion { + /** + * @param {String} type + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Range} range + * @param {String} name + * @param {String} preview + * @param {Function} snippet + */ + constructor(type, editor, range, name, preview, snippet) { + this.type = type; + this.editor = editor; + this.range = range; + this.name = name; + this.preview = preview; + this.snippet = snippet; + + this._inserted = false; + } + + insert() { + if (!this._inserted) { + this._inserted = true; + if (typeof this.snippet === 'function') { + this.snippet(this.editor, this.range); + } else { + insertSnippet(this.editor, this.range, this.snippet); + } + clearMarkers(this.editor); + } + } +}; + +/** + * A syntax-specific model container, used to get unified access to underlying + * parsed document + */ + +let SyntaxModel = class SyntaxModel { + /** + * @param {Object} dom Parsed document tree + * @param {String} type Type of document (html, stylesheet, etc.) + * @param {String} [syntax] Optional document syntax like html, xhtml or xml + */ + constructor(dom, type, syntax) { + this.dom = dom; + this.type = type; + this.syntax = syntax; + } + + /** + * Returns best matching node for given point + * @param {CodeMirror.Pos} pos + * @param {Boolean} [exclude] Exclude node’s start and end positions from + * search + * @return {Node} + */ + nodeForPoint(pos, exclude) { + let ctx = this.dom.firstChild; + let found = null; + + while (ctx) { + if (containsPos(rangeFromNode(ctx), pos, exclude)) { + // Found matching tag. Try to find deeper, more accurate match + found = ctx; + ctx = ctx.firstChild; + } else { + ctx = ctx.nextSibling; + } + } + + return found; + } +}; + +/** + * Creates DOM-like model for given text editor + * @param {CodeMirror} editor + * @param {String} syntax + * @return {Node} + */ + +function create(editor, syntax) { + const stream = new CodeMirrorStreamReader(editor); + const xml = syntax === 'xml'; + + try { + return new SyntaxModel(html_matcher_es(stream, { xml }), 'html', syntax || 'html'); + } catch (err) { + console.warn(err); + } +} + +function getModel(editor) { + const syntax = getSyntax$1(editor); + return create(editor, syntax); +} + +function getCachedModel(editor) { + if (!editor.state._emmetModel) { + editor.state._emmetModel = getModel(editor); + } + + return editor.state._emmetModel; +} + +function resetCachedModel(editor) { + editor.state._emmetModel = null; +} + +/** + * Returns parser-supported syntax of given editor (like 'html', 'css' etc.). + * Returns `null` if editor’s syntax is unsupported + * @param {CodeMirror} editor + * @return {String} + */ +function getSyntax$1(editor) { + const mode = editor.getMode(); + + if (mode.name === 'htmlmixed') { + return 'html'; + } + + return mode.name === 'xml' ? mode.configuration : mode.name; +} + +const openTagMark = 'emmet-open-tag'; +const closeTagMark = 'emmet-close-tag'; + +/** + * Finds matching tag pair for given position in editor + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} pos + * @return {Object} + */ +function matchTag(editor, pos) { + pos = pos || editor.getCursor(); + + // First, check if there are tag markers in editor + const marked = getMarkedTag(editor); + + // If marks found, validate them: make sure cursor is either in open + // or close tag + if (marked) { + if (containsPos(marked.open.find(), pos)) { + // Point is inside open tag, make sure if there’s a closing tag, + // it matches open tag content + if (!marked.close || emmet_codemirror_plugin_es_text(editor, marked.open) === emmet_codemirror_plugin_es_text(editor, marked.close)) { + return marked; + } + } else if (marked.close) { + // There’s a close tag, make sure pointer is inside it and it matches + // open tag + if (containsPos(marked.close.find(), pos) && emmet_codemirror_plugin_es_text(editor, marked.open) === emmet_codemirror_plugin_es_text(editor, marked.close)) { + return marked; + } + } + } + + // Markers are not valid anymore, remove them + clearTagMatch(editor); + + // Find new tag pair from parsed HTML model and mark them + const node = findTagPair(editor, pos); + if (node && node.type === 'tag') { + return { + open: createTagMark(editor, node.open.name, openTagMark), + close: node.close && createTagMark(editor, node.close.name, closeTagMark) + }; + } +} + +function getMarkedTag(editor) { + let open, close; + editor.getAllMarks().forEach(mark => { + if (mark.className === openTagMark) { + open = mark; + } else if (mark.className === closeTagMark) { + close = mark; + } + }); + + return open ? { open, close } : null; +} + +/** + * Removes all matched tag pair markers from editor + * @param {CodeMirror.Editor} editor + */ +function clearTagMatch(editor) { + editor.getAllMarks().forEach(mark => { + if (mark.className === openTagMark || mark.className === closeTagMark) { + mark.clear(); + } + }); +} + +/** + * Finds tag pair (open and close, if any) form parsed HTML model of given editor + * @param {CodeMirror.Editor} editor + * @param {CodeMirror.Position} pos + * @return {Object} + */ +function findTagPair(editor, pos) { + const model = editor.getEmmetDocumentModel(); + return model && model.nodeForPoint(pos || editor.getCursor()); +} + +function createTagMark(editor, tag, className) { + return editor.markText(tag.start, tag.end, { + className, + inclusiveLeft: true, + inclusiveRight: true, + clearWhenEmpty: false + }); +} + +function emmet_codemirror_plugin_es_text(editor, mark) { + const range = mark.find(); + return range ? editor.getRange(range.from, range.to) : ''; +} + +function renameTag(editor, obj) { + const tag = getMarkedTag(editor); + const pos = obj.from; + + if (!tag) { + return; + } + + if (containsPos(tag.open.find(), pos) && tag.close) { + // Update happened inside open tag, update close tag as well + updateTag(editor, tag.open, tag.close); + } else if (tag.close && containsPos(tag.close.find(), pos)) { + // Update happened inside close tag, update open tag as well + updateTag(editor, tag.close, tag.open); + } +} + +function updateTag(editor, source, dest) { + const name = text$1(editor, source); + const range = dest.find(); + const m = name.match(/[\w:.-]+/); + const newName = !name ? '' : m && m[0]; + + if (newName != null) { + if (editor.getRange(range.from, range.to) !== newName) { + editor.replaceRange(newName, range.from, range.to); + } + } else { + // User entered something that wasn’t a valid tag name. + clearTagMatch(editor); + } +} + +function text$1(editor, mark) { + const range = mark.find(); + return range ? editor.getRange(range.from, range.to) : ''; +} + +/** + * Registers Emmet extension on given CodeMirror constructor. + * This file is designed to be imported somehow into the app (CommonJS, ES6, + * Rollup/Webpack/whatever). If you simply want to add a