effective_bootstrap 0.9.6 → 0.9.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ca6a774b911ab73f075f9981ad5f1ebc88a41d00409665e5a0fdd404e7c2d4a
4
- data.tar.gz: 2d97baf8f07f894209b679505bfb82e4a3e1b753a321ba0f38f4c5187f822975
3
+ metadata.gz: dfccd40b53981bf152c50dbcf01e94ba572c9647f7bbdd089a458eb84c18aa6a
4
+ data.tar.gz: 765eab4d79769e5a8bb970a95fcf8275dcd978ebb2aca709869590349cf8db71
5
5
  SHA512:
6
- metadata.gz: 3530d0ccd7a0db06f3b5a76dd1158139a0b1b6b638cce635dea5533bcc7cd93f20896868bbd36a9b341e9cf23a0dff8ca1bb4d25bd79608403f635f3734faad9
7
- data.tar.gz: 140da48f3f67b3fb1b4fbdacaefad449313b37f1df3a4123e366dce6ae29b20be9ec45db64cccb3f831fb820ed562d7f343705146da43a31d7eff97dc8a7bf2d
6
+ metadata.gz: 758307b2718b798b6b5827f8628ed66c037d30612d889edb88f39b79c44028e9a29b0ed7880dc1a79f2321fb62b80bd415d0920642ba44a6e758525fb6df1cbf
7
+ data.tar.gz: 9587c02c77dfbbdf5a454ff1122acca628af9a5556dcca2d6e6780b624d483560fb7f996f8c72e645f0b7beb6c50c2ccb563f16d28bc28fc2178a26384bde0c1
data/README.md CHANGED
@@ -42,8 +42,8 @@ Add the following to your `application.js`:
42
42
  And to your `application.scss`:
43
43
 
44
44
  ```sass
45
- @import 'bootstrap';
46
- @import 'effective_bootstrap';
45
+ @import 'bootstrap'
46
+ @import 'effective_bootstrap'
47
47
  ```
48
48
 
49
49
  ## View Helpers
@@ -362,6 +362,54 @@ And then in any form, instead of a text area:
362
362
  = f.editor :body
363
363
  ```
364
364
 
365
+ ## Custom has_many
366
+
367
+ This custom form input was inspired by [cocoon](https://github.com/nathanvda/cocoon) but works with more magic.
368
+
369
+ This nested form builder allows has_many resources to be created, updated, destroyed and reordered.
370
+
371
+ Just add `has_many` and `accepts_nested_attributes_for` like normal and then use it in the form:
372
+
373
+ ```ruby
374
+ class Author < ApplicationRecord
375
+ has_many :books
376
+ accepts_nested_attributes_for :books, allow_destroy: true
377
+ end
378
+ ```
379
+
380
+ and
381
+
382
+ ```haml
383
+ = effective_form_with(model: author) do |f|
384
+ = f.text_field :name
385
+
386
+ = f.has_many :books do |fb|
387
+ = fb.text_field :title
388
+ = fb.date_field :published_at
389
+ ```
390
+
391
+ If `:books` can be destroyed, a hidden field `_destroy` will automatically be added to each set of fields and a Remove button will be displayed to remove the item.
392
+
393
+ If the `Book` model has an integer `position` attribute, a hidden field `position` will automatically be added to each set of fields and a Reorder button will be displayed to drag&drop reorder items.
394
+
395
+ If the has_many collection is blank?, `.build()` will be automatically called, unless `build: false` is passed.
396
+
397
+ Any errors on the has_many name will be displayed unless `errors: false` is passed.
398
+
399
+ You can customize this behaviour by passing the following:
400
+
401
+ ```haml
402
+ = f.has_many :books, add: true, remove: true, reorder: true, build: true, errors: true do |fb|
403
+ = fb.text_field :title
404
+ ```
405
+
406
+ or add an html class:
407
+
408
+ ```haml
409
+ = f.has_many :books, class: 'tight' do |fb|
410
+ = fb.text_field :title
411
+ ```
412
+
365
413
  ## Custom percent_field
366
414
 
367
415
  This custom form input uses no 3rd party jQuery plugins.
@@ -0,0 +1 @@
1
+ //= link_directory ../images/icons
@@ -15,6 +15,7 @@
15
15
  //= require ./effective_ck_editor/input
16
16
 
17
17
  //= require ./effective_file/input
18
+ //= require ./effective_has_many/input
18
19
  //= require ./effective_integer/input
19
20
  //= require ./effective_number_text/input
20
21
  //= require ./effective_percent/input
@@ -1,4 +1,5 @@
1
1
  //= require ./quill
2
2
  //= require ./image-drop-and-paste
3
3
  //= require ./image-resize
4
+ //= require ./magic-url
4
5
  //= require ./initialize
@@ -0,0 +1,3 @@
1
+ // https://github.com/visualjerk/quill-magic-url
2
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var o in r)("object"==typeof exports?exports:t)[o]=r[o]}}(window,(function(){return function(t){var e={};function r(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,o){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(o,n,function(e){return t[e]}.bind(null,n));return o},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=15)}([function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=r(4),i="function"==typeof Symbol&&"symbol"===o(Symbol("foo")),s=Object.prototype.toString,a=Array.prototype.concat,u=Object.defineProperty,p=u&&function(){var t={};try{for(var e in u(t,"x",{enumerable:!1,value:t}),t)return!1;return t.x===t}catch(t){return!1}}(),c=function(t,e,r,o){var n;(!(e in t)||"function"==typeof(n=o)&&"[object Function]"===s.call(n)&&o())&&(p?u(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},f=function(t,e){var r=arguments.length>2?arguments[2]:{},o=n(e);i&&(o=a.call(o,Object.getOwnPropertySymbols(e)));for(var s=0;s<o.length;s+=1)c(t,o[s],e[o[s]],r[o[s]])};f.supportsDescriptors=!!p,t.exports=f},function(t,e,r){"use strict";var o=r(20);t.exports=Function.prototype.bind||o},function(t,e,r){function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=r(16),i=r(3),s=r(12),a=r(30),u=String.fromCharCode(0),p=function(t){Array.isArray(t)?this.ops=t:null!=t&&Array.isArray(t.ops)?this.ops=t.ops:this.ops=[]};p.prototype.insert=function(t,e){var r={};return 0===t.length?this:(r.insert=t,null!=e&&"object"===o(e)&&Object.keys(e).length>0&&(r.attributes=e),this.push(r))},p.prototype.delete=function(t){return t<=0?this:this.push({delete:t})},p.prototype.retain=function(t,e){if(t<=0)return this;var r={retain:t};return null!=e&&"object"===o(e)&&Object.keys(e).length>0&&(r.attributes=e),this.push(r)},p.prototype.push=function(t){var e=this.ops.length,r=this.ops[e-1];if(t=s(!0,{},t),"object"===o(r)){if("number"==typeof t.delete&&"number"==typeof r.delete)return this.ops[e-1]={delete:r.delete+t.delete},this;if("number"==typeof r.delete&&null!=t.insert&&(e-=1,"object"!==o(r=this.ops[e-1])))return this.ops.unshift(t),this;if(i(t.attributes,r.attributes)){if("string"==typeof t.insert&&"string"==typeof r.insert)return this.ops[e-1]={insert:r.insert+t.insert},"object"===o(t.attributes)&&(this.ops[e-1].attributes=t.attributes),this;if("number"==typeof t.retain&&"number"==typeof r.retain)return this.ops[e-1]={retain:r.retain+t.retain},"object"===o(t.attributes)&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this},p.prototype.chop=function(){var t=this.ops[this.ops.length-1];return t&&t.retain&&!t.attributes&&this.ops.pop(),this},p.prototype.filter=function(t){return this.ops.filter(t)},p.prototype.forEach=function(t){this.ops.forEach(t)},p.prototype.map=function(t){return this.ops.map(t)},p.prototype.partition=function(t){var e=[],r=[];return this.forEach((function(o){(t(o)?e:r).push(o)})),[e,r]},p.prototype.reduce=function(t,e){return this.ops.reduce(t,e)},p.prototype.changeLength=function(){return this.reduce((function(t,e){return e.insert?t+a.length(e):e.delete?t-e.delete:t}),0)},p.prototype.length=function(){return this.reduce((function(t,e){return t+a.length(e)}),0)},p.prototype.slice=function(t,e){t=t||0,"number"!=typeof e&&(e=1/0);for(var r=[],o=a.iterator(this.ops),n=0;n<e&&o.hasNext();){var i;n<t?i=o.next(t-n):(i=o.next(e-n),r.push(i)),n+=a.length(i)}return new p(r)},p.prototype.compose=function(t){var e=a.iterator(this.ops),r=a.iterator(t.ops),o=[],n=r.peek();if(null!=n&&"number"==typeof n.retain&&null==n.attributes){for(var s=n.retain;"insert"===e.peekType()&&e.peekLength()<=s;)s-=e.peekLength(),o.push(e.next());n.retain-s>0&&r.next(n.retain-s)}for(var u=new p(o);e.hasNext()||r.hasNext();)if("insert"===r.peekType())u.push(r.next());else if("delete"===e.peekType())u.push(e.next());else{var c=Math.min(e.peekLength(),r.peekLength()),f=e.next(c),l=r.next(c);if("number"==typeof l.retain){var y={};"number"==typeof f.retain?y.retain=c:y.insert=f.insert;var h=a.attributes.compose(f.attributes,l.attributes,"number"==typeof f.retain);if(h&&(y.attributes=h),u.push(y),!r.hasNext()&&i(u.ops[u.ops.length-1],y)){var b=new p(e.rest());return u.concat(b).chop()}}else"number"==typeof l.delete&&"number"==typeof f.retain&&u.push(l)}return u.chop()},p.prototype.concat=function(t){var e=new p(this.ops.slice());return t.ops.length>0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e},p.prototype.diff=function(t,e){if(this.ops===t.ops)return new p;var r=[this,t].map((function(e){return e.map((function(r){if(null!=r.insert)return"string"==typeof r.insert?r.insert:u;throw new Error("diff() called "+(e===t?"on":"with")+" non-document")})).join("")})),o=new p,s=n(r[0],r[1],e),c=a.iterator(this.ops),f=a.iterator(t.ops);return s.forEach((function(t){for(var e=t[1].length;e>0;){var r=0;switch(t[0]){case n.INSERT:r=Math.min(f.peekLength(),e),o.push(f.next(r));break;case n.DELETE:r=Math.min(e,c.peekLength()),c.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(c.peekLength(),f.peekLength(),e);var s=c.next(r),u=f.next(r);i(s.insert,u.insert)?o.retain(r,a.attributes.diff(s.attributes,u.attributes)):o.push(u).delete(r)}e-=r}})),o.chop()},p.prototype.eachLine=function(t,e){e=e||"\n";for(var r=a.iterator(this.ops),o=new p,n=0;r.hasNext();){if("insert"!==r.peekType())return;var i=r.peek(),s=a.length(i)-r.peekLength(),u="string"==typeof i.insert?i.insert.indexOf(e,s)-s:-1;if(u<0)o.push(r.next());else if(u>0)o.push(r.next(u));else{if(!1===t(o,r.next(1).attributes||{},n))return;n+=1,o=new p}}o.length()>0&&t(o,{},n)},p.prototype.transform=function(t,e){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);for(var r=a.iterator(this.ops),o=a.iterator(t.ops),n=new p;r.hasNext()||o.hasNext();)if("insert"!==r.peekType()||!e&&"insert"===o.peekType())if("insert"===o.peekType())n.push(o.next());else{var i=Math.min(r.peekLength(),o.peekLength()),s=r.next(i),u=o.next(i);if(s.delete)continue;u.delete?n.push(u):n.retain(i,a.attributes.transform(s.attributes,u.attributes,e))}else n.retain(a.length(r.next()));return n.chop()},p.prototype.transformPosition=function(t,e){e=!!e;for(var r=a.iterator(this.ops),o=0;r.hasNext()&&o<=t;){var n=r.peekLength(),i=r.peekType();r.next(),"delete"!==i?("insert"===i&&(o<t||!e)&&(t+=n),o+=n):t-=Math.min(n,t-o)}return t},t.exports=p},function(t,e,r){function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=r(4),i=r(18),s=r(19),a=r(25),u=r(27),p=r(29),c=Date.prototype.getTime;function f(t,e,r){var h=r||{};return!!(h.strict?s(t,e):t===e)||(!t||!e||"object"!==o(t)&&"object"!==o(e)?h.strict?s(t,e):t==e:function(t,e,r){var s,h;if(o(t)!==o(e))return!1;if(l(t)||l(e))return!1;if(t.prototype!==e.prototype)return!1;if(i(t)!==i(e))return!1;var b=a(t),m=a(e);if(b!==m)return!1;if(b||m)return t.source===e.source&&u(t)===u(e);if(p(t)&&p(e))return c.call(t)===c.call(e);var d=y(t),g=y(e);if(d!==g)return!1;if(d||g){if(t.length!==e.length)return!1;for(s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0}if(o(t)!==o(e))return!1;try{var v=n(t),S=n(e)}catch(t){return!1}if(v.length!==S.length)return!1;for(v.sort(),S.sort(),s=v.length-1;s>=0;s--)if(v[s]!=S[s])return!1;for(s=v.length-1;s>=0;s--)if(h=v[s],!f(t[h],e[h],r))return!1;return!0}(t,e,h))}function l(t){return null==t}function y(t){return!(!t||"object"!==o(t)||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&!(t.length>0&&"number"!=typeof t[0]))}t.exports=f},function(t,e,r){"use strict";var o=Array.prototype.slice,n=r(5),i=Object.keys,s=i?function(t){return i(t)}:r(17),a=Object.keys;s.shim=function(){Object.keys?function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2)||(Object.keys=function(t){return n(t)?a(o.call(t)):a(t)}):Object.keys=s;return Object.keys||s},t.exports=s},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=Object.prototype.toString;t.exports=function(t){var e=n.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"===o(t)&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===n.call(t.callee)),r}},function(t,e,r){"use strict";var o=r(1),n=r(21)("%Function%"),i=n.apply,s=n.call;t.exports=function(){return o.apply(s,arguments)},t.exports.apply=function(){return o.apply(i,arguments)}},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":r(window))&&(o=window)}t.exports=o},function(t,e,r){"use strict";var o=function(t){return t!=t};t.exports=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!o(t)||!o(e))}},function(t,e,r){"use strict";var o=r(8);t.exports=function(){return"function"==typeof Object.is?Object.is:o}},function(t,e,r){"use strict";var o=Object,n=TypeError;t.exports=function(){if(null!=this&&this!==o(this))throw new n("RegExp.prototype.flags getter called on non-object");var t="";return this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.sticky&&(t+="y"),t}},function(t,e,r){"use strict";var o=r(10),n=r(0).supportsDescriptors,i=Object.getOwnPropertyDescriptor,s=TypeError;t.exports=function(){if(!n)throw new s("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");if("gim"===/a/gim.flags){var t=i(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof/a/.dotAll)return t.get}return o}},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=Object.defineProperty,a=Object.getOwnPropertyDescriptor,u=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===i.call(t)},p=function(t){if(!t||"[object Object]"!==i.call(t))return!1;var e,r=n.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&n.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!o)return!1;for(e in t);return void 0===e||n.call(t,e)},c=function(t,e){s&&"__proto__"===e.name?s(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},f=function(t,e){if("__proto__"===e){if(!n.call(t,e))return;if(a)return a(t,e).value}return t[e]};t.exports=function t(){var e,r,n,i,s,a,l=arguments[0],y=1,h=arguments.length,b=!1;for("boolean"==typeof l&&(b=l,l=arguments[1]||{},y=2),(null==l||"object"!==o(l)&&"function"!=typeof l)&&(l={});y<h;++y)if(null!=(e=arguments[y]))for(r in e)n=f(l,r),l!==(i=f(e,r))&&(b&&i&&(p(i)||(s=u(i)))?(s?(s=!1,a=n&&u(n)?n:[]):a=n&&p(n)?n:{},c(l,{name:r,newValue:t(b,a,i)})):void 0!==i&&c(l,{name:r,newValue:i}));return l}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,r){"use strict";function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t){return function(t){if(Array.isArray(t))return u(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||a(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],o=!0,n=!1,i=void 0;try{for(var s,a=t[Symbol.iterator]();!(o=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);o=!0);}catch(t){n=!0,i=t}finally{try{o||null==a.return||a.return()}finally{if(n)throw i}}return r}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}var p="undefined"==typeof URL?r(31).URL:URL,c=function(t,e){return e.some((function(e){return e instanceof RegExp?e.test(t):e===t}))},f=function(t,e){if(e=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0},e),Reflect.has(e,"normalizeHttps"))throw new Error("options.normalizeHttps is renamed to options.forceHttp");if(Reflect.has(e,"normalizeHttp"))throw new Error("options.normalizeHttp is renamed to options.forceHttps");if(Reflect.has(e,"stripFragment"))throw new Error("options.stripFragment is renamed to options.stripHash");if(t=t.trim(),/^data:/i.test(t))return function(t,e){var r=e.stripHash,o=t.match(/^data:(.*?),(.*?)(?:#(.*))?$/);if(!o)throw new Error("Invalid URL: ".concat(t));var n=o[1].split(";"),a=o[2],u=r?"":o[3],p=!1;"base64"===n[n.length-1]&&(n.pop(),p=!0);var c=(n.shift()||"").toLowerCase(),f=i(n.map((function(t){var e=s(t.split("=").map((function(t){return t.trim()})),2),r=e[0],o=e[1],n=void 0===o?"":o;return"charset"===r&&"us-ascii"===(n=n.toLowerCase())?"":"".concat(r).concat(n?"=".concat(n):"")})).filter(Boolean));return p&&f.push("base64"),(0!==f.length||c&&"text/plain"!==c)&&f.unshift(c),"data:".concat(f.join(";"),",").concat(p?a.trim():a).concat(u?"#".concat(u):"")}(t,e);var r=t.startsWith("//");!r&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));var a=new p(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&"https:"===a.protocol&&(a.protocol="http:"),e.forceHttps&&"http:"===a.protocol&&(a.protocol="https:"),e.stripAuthentication&&(a.username="",a.password=""),e.stripHash&&(a.hash=""),a.pathname&&(a.pathname=a.pathname.replace(/((?!:).|^)\/{2,}/g,(function(t,e){return/^(?!\/)/g.test(e)?"".concat(e,"/"):"/"}))),a.pathname&&(a.pathname=decodeURI(a.pathname)),!0===e.removeDirectoryIndex&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){var u=a.pathname.split("/"),f=u[u.length-1];c(f,e.removeDirectoryIndex)&&(u=u.slice(0,u.length-1),a.pathname=u.slice(1).join("/")+"/")}if(a.hostname&&(a.hostname=a.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.([a-z\-\d]{2,63})\.([a-z.]{2,5})$/.test(a.hostname)&&(a.hostname=a.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(var l=0,y=i(a.searchParams.keys());l<y.length;l++){var h=y[l];c(h,e.removeQueryParameters)&&a.searchParams.delete(h)}return e.sortQueryParameters&&a.searchParams.sort(),e.removeTrailingSlash&&(a.pathname=a.pathname.replace(/\/$/,"")),t=a.toString(),!e.removeTrailingSlash&&"/"!==a.pathname||""!==a.hash||(t=t.replace(/\/$/,"")),r&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t};t.exports=f,t.exports.default=f},function(t,e,r){"use strict";r.r(e),r.d(e,"default",(function(){return h}));var o=r(2),n=r.n(o),i=r(14),s=r.n(i);function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],o=!0,n=!1,i=void 0;try{for(var s,a=t[Symbol.iterator]();!(o=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);o=!0);}catch(t){n=!0,i=t}finally{try{o||null==a.return||a.return()}finally{if(n)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){f(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function f(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var y={globalRegularExpression:/(https?:\/\/|www\.)[\S]+/g,urlRegularExpression:/(https?:\/\/[\S]+)|(www.[\S]+)/,normalizeRegularExpression:/(https?:\/\/[\S]+)|(www.[\S]+)/,normalizeUrlOptions:{stripWWW:!1}},h=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.quill=e,r=r||{},this.options=c(c({},y),r),this.registerTypeListener(),this.registerPasteListener()}var e,r,o;return e=t,(r=[{key:"registerPasteListener",value:function(){var t=this;this.quill.clipboard.addMatcher(Node.TEXT_NODE,(function(e,r){if("string"==typeof e.data){var o=e.data.match(t.options.globalRegularExpression);if(o&&o.length>0){var i=new n.a,s=e.data;o.forEach((function(e){var r=s.split(e),o=r.shift();i.insert(o),i.insert(e,{link:t.normalize(e)}),s=r.join(e)})),i.insert(s),r.ops=i.ops}return r}}))}},{key:"registerTypeListener",value:function(){var t=this;this.quill.on("text-change",(function(e){var r=e.ops;if(!(!r||r.length<1||r.length>2)){var o=r[r.length-1];o.insert&&"string"==typeof o.insert&&o.insert.match(/\s/)&&t.checkTextForUrl()}}))}},{key:"checkTextForUrl",value:function(){var t=this.quill.getSelection();if(t){var e=a(this.quill.getLeaf(t.index),1)[0];if(e.text&&"a"!==e.parent.domNode.localName){var r=e.text.match(this.options.urlRegularExpression);if(r){var o=this.quill.getIndex(e)+r.index;this.textToUrl(o,r[0])}}}}},{key:"textToUrl",value:function(t,e){var r=(new n.a).retain(t).delete(e.length).insert(e,{link:this.normalize(e)});this.quill.updateContents(r)}},{key:"normalize",value:function(t){if(this.options.normalizeRegularExpression.test(t))try{return s()(t,this.options.normalizeUrlOptions)}catch(t){console.error(t)}return t}}])&&l(e.prototype,r),o&&l(e,o),t}();window.Quill&&window.Quill.register("modules/magicUrl",h)},function(t,e){function r(t,e,s){if(t==e)return t?[[0,t]]:[];(s<0||t.length<s)&&(s=null);var u=n(t,e),p=t.substring(0,u);u=i(t=t.substring(u),e=e.substring(u));var c=t.substring(t.length-u),f=function(t,e){var s;if(!t)return[[1,e]];if(!e)return[[-1,t]];var a=t.length>e.length?t:e,u=t.length>e.length?e:t,p=a.indexOf(u);if(-1!=p)return s=[[1,a.substring(0,p)],[0,u],[1,a.substring(p+u.length)]],t.length>e.length&&(s[0][0]=s[2][0]=-1),s;if(1==u.length)return[[-1,t],[1,e]];var c=function(t,e){var r=t.length>e.length?t:e,o=t.length>e.length?e:t;if(r.length<4||2*o.length<r.length)return null;function s(t,e,r){for(var o,s,a,u,p=t.substring(r,r+Math.floor(t.length/4)),c=-1,f="";-1!=(c=e.indexOf(p,c+1));){var l=n(t.substring(r),e.substring(c)),y=i(t.substring(0,r),e.substring(0,c));f.length<y+l&&(f=e.substring(c-y,c)+e.substring(c,c+l),o=t.substring(0,r-y),s=t.substring(r+l),a=e.substring(0,c-y),u=e.substring(c+l))}return 2*f.length>=t.length?[o,s,a,u,f]:null}var a,u,p,c,f,l=s(r,o,Math.ceil(r.length/4)),y=s(r,o,Math.ceil(r.length/2));if(!l&&!y)return null;a=y?l&&l[4].length>y[4].length?l:y:l;t.length>e.length?(u=a[0],p=a[1],c=a[2],f=a[3]):(c=a[0],f=a[1],u=a[2],p=a[3]);var h=a[4];return[u,p,c,f,h]}(t,e);if(c){var f=c[0],l=c[1],y=c[2],h=c[3],b=c[4],m=r(f,y),d=r(l,h);return m.concat([[0,b]],d)}return function(t,e){for(var r=t.length,n=e.length,i=Math.ceil((r+n)/2),s=i,a=2*i,u=new Array(a),p=new Array(a),c=0;c<a;c++)u[c]=-1,p[c]=-1;u[s+1]=0,p[s+1]=0;for(var f=r-n,l=f%2!=0,y=0,h=0,b=0,m=0,d=0;d<i;d++){for(var g=-d+y;g<=d-h;g+=2){for(var v=s+g,S=(A=g==-d||g!=d&&u[v-1]<u[v+1]?u[v+1]:u[v-1]+1)-g;A<r&&S<n&&t.charAt(A)==e.charAt(S);)A++,S++;if(u[v]=A,A>r)h+=2;else if(S>n)y+=2;else if(l){if((w=s+f-g)>=0&&w<a&&-1!=p[w]){var j=r-p[w];if(A>=j)return o(t,e,A,S)}}}for(var O=-d+b;O<=d-m;O+=2){for(var w=s+O,x=(j=O==-d||O!=d&&p[w-1]<p[w+1]?p[w+1]:p[w-1]+1)-O;j<r&&x<n&&t.charAt(r-j-1)==e.charAt(n-x-1);)j++,x++;if(p[w]=j,j>r)m+=2;else if(x>n)b+=2;else if(!l){if((v=s+f-O)>=0&&v<a&&-1!=u[v]){var A=u[v];S=s+A-v;if(A>=(j=r-j))return o(t,e,A,S)}}}}return[[-1,t],[1,e]]}(t,e)}(t=t.substring(0,t.length-u),e=e.substring(0,e.length-u));return p&&f.unshift([0,p]),c&&f.push([0,c]),function t(e){e.push([0,""]);var r,o=0,s=0,a=0,u="",p="";for(;o<e.length;)switch(e[o][0]){case 1:a++,p+=e[o][1],o++;break;case-1:s++,u+=e[o][1],o++;break;case 0:s+a>1?(0!==s&&0!==a&&(0!==(r=n(p,u))&&(o-s-a>0&&0==e[o-s-a-1][0]?e[o-s-a-1][1]+=p.substring(0,r):(e.splice(0,0,[0,p.substring(0,r)]),o++),p=p.substring(r),u=u.substring(r)),0!==(r=i(p,u))&&(e[o][1]=p.substring(p.length-r)+e[o][1],p=p.substring(0,p.length-r),u=u.substring(0,u.length-r))),0===s?e.splice(o-a,s+a,[1,p]):0===a?e.splice(o-s,s+a,[-1,u]):e.splice(o-s-a,s+a,[-1,u],[1,p]),o=o-s-a+(s?1:0)+(a?1:0)+1):0!==o&&0==e[o-1][0]?(e[o-1][1]+=e[o][1],e.splice(o,1)):o++,a=0,s=0,u="",p=""}""===e[e.length-1][1]&&e.pop();var c=!1;o=1;for(;o<e.length-1;)0==e[o-1][0]&&0==e[o+1][0]&&(e[o][1].substring(e[o][1].length-e[o-1][1].length)==e[o-1][1]?(e[o][1]=e[o-1][1]+e[o][1].substring(0,e[o][1].length-e[o-1][1].length),e[o+1][1]=e[o-1][1]+e[o+1][1],e.splice(o-1,1),c=!0):e[o][1].substring(0,e[o+1][1].length)==e[o+1][1]&&(e[o-1][1]+=e[o+1][1],e[o][1]=e[o][1].substring(e[o+1][1].length)+e[o+1][1],e.splice(o+1,1),c=!0)),o++;c&&t(e)}(f),null!=s&&(f=function(t,e){var r=function(t,e){if(0===e)return[0,t];for(var r=0,o=0;o<t.length;o++){var n=t[o];if(-1===n[0]||0===n[0]){var i=r+n[1].length;if(e===i)return[o+1,t];if(e<i){t=t.slice();var s=e-r,a=[n[0],n[1].slice(0,s)],u=[n[0],n[1].slice(s)];return t.splice(o,1,a,u),[o+1,t]}r=i}}throw new Error("cursor_pos is out of bounds!")}(t,e),o=r[1],n=r[0],i=o[n],s=o[n+1];if(null==i)return t;if(0!==i[0])return t;if(null!=s&&i[1]+s[1]===s[1]+i[1])return o.splice(n,2,s,i),a(o,n,2);if(null!=s&&0===s[1].indexOf(i[1])){o.splice(n,2,[s[0],i[1]],[0,i[1]]);var u=s[1].slice(i[1].length);return u.length>0&&o.splice(n+2,0,[s[0],u]),a(o,n,3)}return t}(f,s)),f=function(t){for(var e=!1,r=function(t){return t.charCodeAt(0)>=56320&&t.charCodeAt(0)<=57343},o=2;o<t.length;o+=1)0===t[o-2][0]&&((n=t[o-2][1]).charCodeAt(n.length-1)>=55296&&n.charCodeAt(n.length-1)<=56319)&&-1===t[o-1][0]&&r(t[o-1][1])&&1===t[o][0]&&r(t[o][1])&&(e=!0,t[o-1][1]=t[o-2][1].slice(-1)+t[o-1][1],t[o][1]=t[o-2][1].slice(-1)+t[o][1],t[o-2][1]=t[o-2][1].slice(0,-1));var n;if(!e)return t;var i=[];for(o=0;o<t.length;o+=1)t[o][1].length>0&&i.push(t[o]);return i}(f)}function o(t,e,o,n){var i=t.substring(0,o),s=e.substring(0,n),a=t.substring(o),u=e.substring(n),p=r(i,s),c=r(a,u);return p.concat(c)}function n(t,e){if(!t||!e||t.charAt(0)!=e.charAt(0))return 0;for(var r=0,o=Math.min(t.length,e.length),n=o,i=0;r<n;)t.substring(i,n)==e.substring(i,n)?i=r=n:o=n,n=Math.floor((o-r)/2+r);return n}function i(t,e){if(!t||!e||t.charAt(t.length-1)!=e.charAt(e.length-1))return 0;for(var r=0,o=Math.min(t.length,e.length),n=o,i=0;r<n;)t.substring(t.length-n,t.length-i)==e.substring(e.length-n,e.length-i)?i=r=n:o=n,n=Math.floor((o-r)/2+r);return n}var s=r;function a(t,e,r){for(var o=e+r-1;o>=0&&o>=e-1;o--)if(o+1<t.length){var n=t[o],i=t[o+1];n[0]===i[1]&&t.splice(o,2,[n[0],n[1]+i[1]])}return t}s.INSERT=1,s.DELETE=-1,s.EQUAL=0,t.exports=s},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,s=Object.prototype.toString,a=r(5),u=Object.prototype.propertyIsEnumerable,p=!u.call({toString:null},"toString"),c=u.call((function(){}),"prototype"),f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},y={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!y["$"+t]&&i.call(window,t)&&null!==window[t]&&"object"===o(window[t]))try{l(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();n=function(t){var e=null!==t&&"object"===o(t),r="[object Function]"===s.call(t),n=a(t),u=e&&"[object String]"===s.call(t),y=[];if(!e&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var b=c&&r;if(u&&t.length>0&&!i.call(t,0))for(var m=0;m<t.length;++m)y.push(String(m));if(n&&t.length>0)for(var d=0;d<t.length;++d)y.push(String(d));else for(var g in t)b&&"prototype"===g||!i.call(t,g)||y.push(String(g));if(p)for(var v=function(t){if("undefined"==typeof window||!h)return l(t);try{return l(t)}catch(t){return!1}}(t),S=0;S<f.length;++S)v&&"constructor"===f[S]||!i.call(t,f[S])||y.push(f[S]);return y}}t.exports=n},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n="function"==typeof Symbol&&"symbol"===o(Symbol.toStringTag),i=Object.prototype.toString,s=function(t){return!(n&&t&&"object"===o(t)&&Symbol.toStringTag in t)&&"[object Arguments]"===i.call(t)},a=function(t){return!!s(t)||null!==t&&"object"===o(t)&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==i.call(t)&&"[object Function]"===i.call(t.callee)},u=function(){return s(arguments)}();s.isLegacyArguments=a,t.exports=u?s:a},function(t,e,r){"use strict";var o=r(0),n=r(6),i=r(8),s=r(9),a=r(24),u=n(s(),Object);o(u,{getPolyfill:s,implementation:i,shim:a}),t.exports=u},function(t,e,r){"use strict";var o="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,i=Object.prototype.toString;t.exports=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==i.call(e))throw new TypeError(o+e);for(var r,s=n.call(arguments,1),a=function(){if(this instanceof r){var o=e.apply(this,s.concat(n.call(arguments)));return Object(o)===o?o:this}return e.apply(t,s.concat(n.call(arguments)))},u=Math.max(0,e.length-s.length),p=[],c=0;c<u;c++)p.push("$"+c);if(r=Function("binder","return function ("+p.join(",")+"){ return binder.apply(this,arguments); }")(a),e.prototype){var f=function(){};f.prototype=e.prototype,r.prototype=new f,f.prototype=null}return r}},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=TypeError,i=Object.getOwnPropertyDescriptor;if(i)try{i({},"")}catch(t){i=null}var s=function(){throw new n},a=i?function(){try{return s}catch(t){try{return i(arguments,"callee").get}catch(t){return s}}}():s,u=r(22)(),p=Object.getPrototypeOf||function(t){return t.__proto__},c=void 0,f="undefined"==typeof Uint8Array?void 0:p(Uint8Array),l={"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer.prototype,"%ArrayIteratorPrototype%":u?p([][Symbol.iterator]()):void 0,"%ArrayPrototype%":Array.prototype,"%ArrayProto_entries%":Array.prototype.entries,"%ArrayProto_forEach%":Array.prototype.forEach,"%ArrayProto_keys%":Array.prototype.keys,"%ArrayProto_values%":Array.prototype.values,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":void 0,"%AsyncFunctionPrototype%":void 0,"%AsyncGenerator%":void 0,"%AsyncGeneratorFunction%":void 0,"%AsyncGeneratorPrototype%":void 0,"%AsyncIteratorPrototype%":c&&u&&Symbol.asyncIterator?c[Symbol.asyncIterator]():void 0,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%Boolean%":Boolean,"%BooleanPrototype%":Boolean.prototype,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%DataViewPrototype%":"undefined"==typeof DataView?void 0:DataView.prototype,"%Date%":Date,"%DatePrototype%":Date.prototype,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%ErrorPrototype%":Error.prototype,"%eval%":eval,"%EvalError%":EvalError,"%EvalErrorPrototype%":EvalError.prototype,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float32ArrayPrototype%":"undefined"==typeof Float32Array?void 0:Float32Array.prototype,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%Float64ArrayPrototype%":"undefined"==typeof Float64Array?void 0:Float64Array.prototype,"%Function%":Function,"%FunctionPrototype%":Function.prototype,"%Generator%":void 0,"%GeneratorFunction%":void 0,"%GeneratorPrototype%":void 0,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int8ArrayPrototype%":"undefined"==typeof Int8Array?void 0:Int8Array.prototype,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int16ArrayPrototype%":"undefined"==typeof Int16Array?void 0:Int8Array.prototype,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%Int32ArrayPrototype%":"undefined"==typeof Int32Array?void 0:Int32Array.prototype,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u?p(p([][Symbol.iterator]())):void 0,"%JSON%":"object"===("undefined"==typeof JSON?"undefined":o(JSON))?JSON:void 0,"%JSONParse%":"object"===("undefined"==typeof JSON?"undefined":o(JSON))?JSON.parse:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&u?p((new Map)[Symbol.iterator]()):void 0,"%MapPrototype%":"undefined"==typeof Map?void 0:Map.prototype,"%Math%":Math,"%Number%":Number,"%NumberPrototype%":Number.prototype,"%Object%":Object,"%ObjectPrototype%":Object.prototype,"%ObjProto_toString%":Object.prototype.toString,"%ObjProto_valueOf%":Object.prototype.valueOf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%PromisePrototype%":"undefined"==typeof Promise?void 0:Promise.prototype,"%PromiseProto_then%":"undefined"==typeof Promise?void 0:Promise.prototype.then,"%Promise_all%":"undefined"==typeof Promise?void 0:Promise.all,"%Promise_reject%":"undefined"==typeof Promise?void 0:Promise.reject,"%Promise_resolve%":"undefined"==typeof Promise?void 0:Promise.resolve,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%RangeErrorPrototype%":RangeError.prototype,"%ReferenceError%":ReferenceError,"%ReferenceErrorPrototype%":ReferenceError.prototype,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%RegExpPrototype%":RegExp.prototype,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&u?p((new Set)[Symbol.iterator]()):void 0,"%SetPrototype%":"undefined"==typeof Set?void 0:Set.prototype,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer.prototype,"%String%":String,"%StringIteratorPrototype%":u?p(""[Symbol.iterator]()):void 0,"%StringPrototype%":String.prototype,"%Symbol%":u?Symbol:void 0,"%SymbolPrototype%":u?Symbol.prototype:void 0,"%SyntaxError%":SyntaxError,"%SyntaxErrorPrototype%":SyntaxError.prototype,"%ThrowTypeError%":a,"%TypedArray%":f,"%TypedArrayPrototype%":f?f.prototype:void 0,"%TypeError%":n,"%TypeErrorPrototype%":n.prototype,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?void 0:Uint8Array.prototype,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray.prototype,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?void 0:Uint16Array.prototype,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?void 0:Uint32Array.prototype,"%URIError%":URIError,"%URIErrorPrototype%":URIError.prototype,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakMapPrototype%":"undefined"==typeof WeakMap?void 0:WeakMap.prototype,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet,"%WeakSetPrototype%":"undefined"==typeof WeakSet?void 0:WeakSet.prototype},y=r(1).call(Function.call,String.prototype.replace),h=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,b=/\\(\\)?/g,m=function(t){var e=[];return y(t,h,(function(t,r,o,n){e[e.length]=o?y(n,b,"$1"):r||t})),e},d=function(t,e){if(!(t in l))throw new SyntaxError("intrinsic "+t+" does not exist!");if(void 0===l[t]&&!e)throw new n("intrinsic "+t+" exists, but is not available. Please file an issue!");return l[t]};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new TypeError('"allowMissing" argument must be a boolean');for(var r=m(t),o=d("%"+(r.length>0?r[0]:"")+"%",e),s=1;s<r.length;s+=1)if(null!=o)if(i&&s+1>=r.length){var a=i(o,r[s]);if(!e&&!(r[s]in o))throw new n("base intrinsic for "+t+" exists, but the property is not available.");o=a?a.get||a.value:o[r[s]]}else o=o[r[s]];return o}},function(t,e,r){"use strict";(function(e){function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=e.Symbol,i=r(23);t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"===o(n("foo"))&&("symbol"===o(Symbol("bar"))&&i())))}}).call(this,r(7))},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"===o(Symbol.iterator))return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},function(t,e,r){"use strict";var o=r(9),n=r(0);t.exports=function(){var t=o();return n(Object,{is:t},{is:function(){return Object.is!==t}}),t}},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=r(26),i=RegExp.prototype.exec,s=Object.getOwnPropertyDescriptor,a=Object.prototype.toString,u="function"==typeof Symbol&&"symbol"===o(Symbol.toStringTag);t.exports=function(t){if(!t||"object"!==o(t))return!1;if(!u)return"[object RegExp]"===a.call(t);var e=s(t,"lastIndex");return!(!e||!n(e,"value"))&&function(t){try{var e=t.lastIndex;return t.lastIndex=0,i.call(t),!0}catch(t){return!1}finally{t.lastIndex=e}}(t)}},function(t,e,r){"use strict";var o=r(1);t.exports=o.call(Function.call,Object.prototype.hasOwnProperty)},function(t,e,r){"use strict";var o=r(0),n=r(6),i=r(10),s=r(11),a=r(28),u=n(i);o(u,{getPolyfill:s,implementation:i,shim:a}),t.exports=u},function(t,e,r){"use strict";var o=r(0).supportsDescriptors,n=r(11),i=Object.getOwnPropertyDescriptor,s=Object.defineProperty,a=TypeError,u=Object.getPrototypeOf,p=/a/;t.exports=function(){if(!o||!u)throw new a("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=n(),e=u(p),r=i(e,"flags");return r&&r.get===t||s(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=Date.prototype.getDay,i=Object.prototype.toString,s="function"==typeof Symbol&&"symbol"===o(Symbol.toStringTag);t.exports=function(t){return"object"===o(t)&&null!==t&&(s?function(t){try{return n.call(t),!0}catch(t){return!1}}(t):"[object Date]"===i.call(t))}},function(t,e,r){function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=r(3),i=r(12),s={attributes:{compose:function(t,e,r){"object"!==o(t)&&(t={}),"object"!==o(e)&&(e={});var n=i(!0,{},e);for(var s in r||(n=Object.keys(n).reduce((function(t,e){return null!=n[e]&&(t[e]=n[e]),t}),{})),t)void 0!==t[s]&&void 0===e[s]&&(n[s]=t[s]);return Object.keys(n).length>0?n:void 0},diff:function(t,e){"object"!==o(t)&&(t={}),"object"!==o(e)&&(e={});var r=Object.keys(t).concat(Object.keys(e)).reduce((function(r,o){return n(t[o],e[o])||(r[o]=void 0===e[o]?null:e[o]),r}),{});return Object.keys(r).length>0?r:void 0},transform:function(t,e,r){if("object"!==o(t))return e;if("object"===o(e)){if(!r)return e;var n=Object.keys(e).reduce((function(r,o){return void 0===t[o]&&(r[o]=e[o]),r}),{});return Object.keys(n).length>0?n:void 0}}},iterator:function(t){return new a(t)},length:function(t){return"number"==typeof t.delete?t.delete:"number"==typeof t.retain?t.retain:"string"==typeof t.insert?t.insert.length:1}};function a(t){this.ops=t,this.index=0,this.offset=0}a.prototype.hasNext=function(){return this.peekLength()<1/0},a.prototype.next=function(t){t||(t=1/0);var e=this.ops[this.index];if(e){var r=this.offset,o=s.length(e);if(t>=o-r?(t=o-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof e.delete)return{delete:t};var n={};return e.attributes&&(n.attributes=e.attributes),"number"==typeof e.retain?n.retain=t:"string"==typeof e.insert?n.insert=e.insert.substr(r,t):n.insert=e.insert,n}return{retain:1/0}},a.prototype.peek=function(){return this.ops[this.index]},a.prototype.peekLength=function(){return this.ops[this.index]?s.length(this.ops[this.index])-this.offset:1/0},a.prototype.peekType=function(){return this.ops[this.index]?"number"==typeof this.ops[this.index].delete?"delete":"number"==typeof this.ops[this.index].retain?"retain":"insert":"retain"},a.prototype.rest=function(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);var t=this.offset,e=this.index,r=this.next(),o=this.ops.slice(this.index);return this.offset=t,this.index=e,[r].concat(o)}return[]},t.exports=s},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=r(32),i=r(34);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=S,e.resolve=function(t,e){return S(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?S(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=S(t));return t instanceof s?t.format():s.prototype.format.call(t)},e.Url=s;var a=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(c),l=["%","/","?",";","#"].concat(f),y=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},d={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=r(35);function S(t,e,r){if(t&&i.isObject(t)&&t instanceof s)return t;var o=new s;return o.parse(t,e,r),o}s.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+o(t));var s=t.indexOf("?"),u=-1!==s&&s<t.indexOf("#")?"?":"#",c=t.split(u);c[0]=c[0].replace(/\\/g,"/");var S=t=c.join(u);if(S=S.trim(),!r&&1===t.split("#").length){var j=p.exec(S);if(j)return this.path=S,this.href=S,this.pathname=j[1],j[2]?(this.search=j[2],this.query=e?v.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var O=a.exec(S);if(O){var w=(O=O[0]).toLowerCase();this.protocol=w,S=S.substr(O.length)}if(r||O||S.match(/^\/\/[^@\/]+@[^@\/]+/)){var x="//"===S.substr(0,2);!x||O&&d[O]||(S=S.substr(2),this.slashes=!0)}if(!d[O]&&(x||O&&!g[O])){for(var A,P,E=-1,I=0;I<y.length;I++){-1!==(k=S.indexOf(y[I]))&&(-1===E||k<E)&&(E=k)}-1!==(P=-1===E?S.lastIndexOf("@"):S.lastIndexOf("@",E))&&(A=S.slice(0,P),S=S.slice(P+1),this.auth=decodeURIComponent(A)),E=-1;for(I=0;I<l.length;I++){var k;-1!==(k=S.indexOf(l[I]))&&(-1===E||k<E)&&(E=k)}-1===E&&(E=S.length),this.host=S.slice(0,E),S=S.slice(E),this.parseHost(),this.hostname=this.hostname||"";var U="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!U)for(var R=this.hostname.split(/\./),T=(I=0,R.length);I<T;I++){var C=R[I];if(C&&!C.match(h)){for(var F="",D=0,M=C.length;D<M;D++)C.charCodeAt(D)>127?F+="x":F+=C[D];if(!F.match(h)){var N=R.slice(0,I),$=R.slice(I+1),L=C.match(b);L&&(N.push(L[1]),$.unshift(L[2])),$.length&&(S="/"+$.join(".")+S),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),U||(this.hostname=n.toASCII(this.hostname));var _=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+_,this.href+=this.host,U&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==S[0]&&(S="/"+S))}if(!m[w])for(I=0,T=f.length;I<T;I++){var W=f[I];if(-1!==S.indexOf(W)){var H=encodeURIComponent(W);H===W&&(H=escape(W)),S=S.split(W).join(H)}}var z=S.indexOf("#");-1!==z&&(this.hash=S.substr(z),S=S.slice(0,z));var B=S.indexOf("?");if(-1!==B?(this.search=S.substr(B),this.query=S.substr(B+1),e&&(this.query=v.parse(this.query)),S=S.slice(0,B)):e&&(this.search="",this.query={}),S&&(this.pathname=S),g[w]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){_=this.pathname||"";var V=this.search||"";this.path=_+V}return this.href=this.format(),this},s.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",o=this.hash||"",n=!1,s="";this.host?n=t+this.host:this.hostname&&(n=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=v.stringify(this.query));var a=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||g[e])&&!1!==n?(n="//"+(n||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):n||(n=""),o&&"#"!==o.charAt(0)&&(o="#"+o),a&&"?"!==a.charAt(0)&&(a="?"+a),e+n+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(a=a.replace("#","%23"))+o},s.prototype.resolve=function(t){return this.resolveObject(S(t,!1,!0)).format()},s.prototype.resolveObject=function(t){if(i.isString(t)){var e=new s;e.parse(t,!1,!0),t=e}for(var r=new s,o=Object.keys(this),n=0;n<o.length;n++){var a=o[n];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),p=0;p<u.length;p++){var c=u[p];"protocol"!==c&&(r[c]=t[c])}return g[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!g[t.protocol]){for(var f=Object.keys(t),l=0;l<f.length;l++){var y=f[l];r[y]=t[y]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||d[t.protocol])r.pathname=t.pathname;else{for(var h=(t.pathname||"").split("/");h.length&&!(t.host=h.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),r.pathname=h.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var b=r.pathname||"",m=r.search||"";r.path=b+m}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),S=t.host||t.pathname&&"/"===t.pathname.charAt(0),j=S||v||r.host&&t.pathname,O=j,w=r.pathname&&r.pathname.split("/")||[],x=(h=t.pathname&&t.pathname.split("/")||[],r.protocol&&!g[r.protocol]);if(x&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===h[0]?h[0]=t.host:h.unshift(t.host)),t.host=null),j=j&&(""===h[0]||""===w[0])),S)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,w=h;else if(h.length)w||(w=[]),w.pop(),w=w.concat(h),r.search=t.search,r.query=t.query;else if(!i.isNullOrUndefined(t.search)){if(x)r.hostname=r.host=w.shift(),(k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=w.slice(-1)[0],P=(r.host||t.host||w.length>1)&&("."===A||".."===A)||""===A,E=0,I=w.length;I>=0;I--)"."===(A=w[I])?w.splice(I,1):".."===A?(w.splice(I,1),E++):E&&(w.splice(I,1),E--);if(!j&&!O)for(;E--;E)w.unshift("..");!j||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),P&&"/"!==w.join("/").substr(-1)&&w.push("");var k,U=""===w[0]||w[0]&&"/"===w[0].charAt(0);x&&(r.hostname=r.host=U?"":w.length?w.shift():"",(k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift()));return(j=j||r.host&&w.length)&&!U&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var t=this.host,e=u.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){(function(t,o){var n;function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
3
+ /*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){var a="object"==i(e)&&e&&!e.nodeType&&e,u="object"==i(t)&&t&&!t.nodeType&&t,p="object"==(void 0===o?"undefined":i(o))&&o;p.global!==p&&p.window!==p&&p.self!==p||(s=p);var c,f,l=2147483647,y=/^xn--/,h=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,m={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,g=String.fromCharCode;function v(t){throw new RangeError(m[t])}function S(t,e){for(var r=t.length,o=[];r--;)o[r]=e(t[r]);return o}function j(t,e){var r=t.split("@"),o="";return r.length>1&&(o=r[0]+"@",t=r[1]),o+S((t=t.replace(b,".")).split("."),e).join(".")}function O(t){for(var e,r,o=[],n=0,i=t.length;n<i;)(e=t.charCodeAt(n++))>=55296&&e<=56319&&n<i?56320==(64512&(r=t.charCodeAt(n++)))?o.push(((1023&e)<<10)+(1023&r)+65536):(o.push(e),n--):o.push(e);return o}function w(t){return S(t,(function(t){var e="";return t>65535&&(e+=g((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=g(t)})).join("")}function x(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function A(t,e,r){var o=0;for(t=r?d(t/700):t>>1,t+=d(t/e);t>455;o+=36)t=d(t/35);return d(o+36*t/(t+38))}function P(t){var e,r,o,n,i,s,a,u,p,c,f,y=[],h=t.length,b=0,m=128,g=72;for((r=t.lastIndexOf("-"))<0&&(r=0),o=0;o<r;++o)t.charCodeAt(o)>=128&&v("not-basic"),y.push(t.charCodeAt(o));for(n=r>0?r+1:0;n<h;){for(i=b,s=1,a=36;n>=h&&v("invalid-input"),((u=(f=t.charCodeAt(n++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:36)>=36||u>d((l-b)/s))&&v("overflow"),b+=u*s,!(u<(p=a<=g?1:a>=g+26?26:a-g));a+=36)s>d(l/(c=36-p))&&v("overflow"),s*=c;g=A(b-i,e=y.length+1,0==i),d(b/e)>l-m&&v("overflow"),m+=d(b/e),b%=e,y.splice(b++,0,m)}return w(y)}function E(t){var e,r,o,n,i,s,a,u,p,c,f,y,h,b,m,S=[];for(y=(t=O(t)).length,e=128,r=0,i=72,s=0;s<y;++s)(f=t[s])<128&&S.push(g(f));for(o=n=S.length,n&&S.push("-");o<y;){for(a=l,s=0;s<y;++s)(f=t[s])>=e&&f<a&&(a=f);for(a-e>d((l-r)/(h=o+1))&&v("overflow"),r+=(a-e)*h,e=a,s=0;s<y;++s)if((f=t[s])<e&&++r>l&&v("overflow"),f==e){for(u=r,p=36;!(u<(c=p<=i?1:p>=i+26?26:p-i));p+=36)m=u-c,b=36-c,S.push(g(x(c+m%b,0))),u=d(m/b);S.push(g(x(u,0))),i=A(r,h,o==n),r=0,++o}++r,++e}return S.join("")}if(c={version:"1.4.1",ucs2:{decode:O,encode:w},decode:P,encode:E,toASCII:function(t){return j(t,(function(t){return h.test(t)?"xn--"+E(t):t}))},toUnicode:function(t){return j(t,(function(t){return y.test(t)?P(t.slice(4).toLowerCase()):t}))}},"object"==i(r(13))&&r(13))void 0===(n=function(){return c}.call(e,r,e,t))||(t.exports=n);else if(a&&u)if(t.exports==a)u.exports=c;else for(f in c)c.hasOwnProperty(f)&&(a[f]=c[f]);else s.punycode=c}(this)}).call(this,r(33)(t),r(7))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"===o(t)&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){"use strict";e.decode=e.parse=r(36),e.encode=e.stringify=r(37)},function(t,e,r){"use strict";function o(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,i){e=e||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var p=t.length;u>0&&p>u&&(p=u);for(var c=0;c<p;++c){var f,l,y,h,b=t[c].replace(a,"%20"),m=b.indexOf(r);m>=0?(f=b.substr(0,m),l=b.substr(m+1)):(f=b,l=""),y=decodeURIComponent(f),h=decodeURIComponent(l),o(s,y)?n(s[y])?s[y].push(h):s[y]=[s[y],h]:s[y]=h}return s};var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=function(t){switch(o(t)){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,u){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"===o(t)?s(a(t),(function(o){var a=encodeURIComponent(n(o))+r;return i(t[o])?s(t[o],(function(t){return a+encodeURIComponent(n(t))})).join(e):a+encodeURIComponent(n(t[o]))})).join(e):u?encodeURIComponent(n(u))+r+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function s(t,e){if(t.map)return t.map(e);for(var r=[],o=0;o<t.length;o++)r.push(e(t[o],o));return r}var a=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}}])}));
@@ -0,0 +1,77 @@
1
+ assignPositions = (target) ->
2
+ $hasMany = $(target)
3
+ return unless $hasMany.length > 0
4
+
5
+ $fields = $hasMany.children('.has-many-fields:not(.marked-for-destruction)')
6
+ positions = $fields.find("input[name$='[position]']").map(-> this.value).get()
7
+
8
+ if positions.length > 0
9
+ index = Math.min.apply(Math, positions) || 0
10
+
11
+ $fields.each((i, obj) ->
12
+ $(obj).find("input[name$='[position]']").first().val(index)
13
+ index = index + 1
14
+ )
15
+
16
+ true
17
+
18
+ (this.EffectiveBootstrap || {}).effective_has_many = ($element, options) ->
19
+ if options.sortable
20
+ $element.sortable(
21
+ containerSelector: '.form-has-many',
22
+ itemSelector: '.has-many-fields',
23
+ handle: '.has-many-move'
24
+ placeholder: "<div class='has-many-placeholder' />",
25
+ onDrop: ($item, container, _super) =>
26
+ assignPositions(container.target)
27
+ _super($item, container)
28
+ )
29
+
30
+ $(document).on 'click', '[data-effective-form-has-many-add]', (event) ->
31
+ event.preventDefault()
32
+
33
+ $obj = $(event.currentTarget)
34
+ $hasMany = $obj.closest('.form-has-many')
35
+ return unless $hasMany.length > 0
36
+
37
+ uid = (new Date).valueOf()
38
+ template = $obj.data('effective-form-has-many-template').replace(/HASMANYINDEX/g, uid)
39
+
40
+ $fields = $(template).hide().fadeIn('fast')
41
+ EffectiveBootstrap.initialize($fields)
42
+ $obj.closest('.has-many-links').before($fields)
43
+
44
+ assignPositions($hasMany)
45
+ true
46
+
47
+ $(document).on 'click', '[data-effective-form-has-many-remove]', (event) ->
48
+ event.preventDefault()
49
+
50
+ $obj = $(event.currentTarget)
51
+ $hasMany = $obj.closest('.form-has-many')
52
+ return unless $hasMany.length > 0
53
+
54
+ $input = $obj.siblings("input[name$='[_destroy]']").first()
55
+ $fields = $obj.closest('.has-many-fields').first()
56
+
57
+ if $input.length > 0
58
+ $input.val('true')
59
+ $fields.addClass('marked-for-destruction').fadeOut('fast')
60
+ else
61
+ $fields.fadeOut('fast', -> this.remove())
62
+
63
+ assignPositions($hasMany)
64
+ true
65
+
66
+ $(document).on 'click', '[data-effective-form-has-many-reorder]', (event) ->
67
+ event.preventDefault()
68
+
69
+ $obj = $(event.currentTarget)
70
+ $hasMany = $obj.closest('.form-has-many')
71
+ return unless $hasMany.length > 0
72
+
73
+ $fields = $hasMany.children('.has-many-fields:not(.marked-for-destruction)')
74
+ return unless $fields.length > 1
75
+
76
+ $hasMany.toggleClass('reordering')
77
+ true
@@ -0,0 +1,2 @@
1
+ //= require ./jquery.sortable
2
+ //= require ./initialize
@@ -0,0 +1,696 @@
1
+ /* ===================================================
2
+ * jquery-sortable.js v0.9.13
3
+ * http://johnny.github.com/jquery-sortable/
4
+ * ===================================================
5
+ * Copyright (c) 2012 Jonas von Andrian
6
+ * All rights reserved.
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions are met:
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above copyright
13
+ * notice, this list of conditions and the following disclaimer in the
14
+ * documentation and/or other materials provided with the distribution.
15
+ * * The name of the author may not be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ * ========================================================== */
29
+
30
+
31
+ !function ( $, window, pluginName, undefined){
32
+ var containerDefaults = {
33
+ // If true, items can be dragged from this container
34
+ drag: true,
35
+ // If true, items can be dropped onto this container
36
+ drop: true,
37
+ // Exclude items from being draggable, if the
38
+ // selector matches the item
39
+ exclude: "",
40
+ // If true, search for nested containers within an item.If you nest containers,
41
+ // either the original selector with which you call the plugin must only match the top containers,
42
+ // or you need to specify a group (see the bootstrap nav example)
43
+ nested: true,
44
+ // If true, the items are assumed to be arranged vertically
45
+ vertical: true
46
+ }, // end container defaults
47
+ groupDefaults = {
48
+ // This is executed after the placeholder has been moved.
49
+ // $closestItemOrContainer contains the closest item, the placeholder
50
+ // has been put at or the closest empty Container, the placeholder has
51
+ // been appended to.
52
+ afterMove: function ($placeholder, container, $closestItemOrContainer) {
53
+ },
54
+ // The exact css path between the container and its items, e.g. "> tbody"
55
+ containerPath: "",
56
+ // The css selector of the containers
57
+ containerSelector: "ol, ul",
58
+ // Distance the mouse has to travel to start dragging
59
+ distance: 0,
60
+ // Time in milliseconds after mousedown until dragging should start.
61
+ // This option can be used to prevent unwanted drags when clicking on an element.
62
+ delay: 0,
63
+ // The css selector of the drag handle
64
+ handle: "",
65
+ // The exact css path between the item and its subcontainers.
66
+ // It should only match the immediate items of a container.
67
+ // No item of a subcontainer should be matched. E.g. for ol>div>li the itemPath is "> div"
68
+ itemPath: "",
69
+ // The css selector of the items
70
+ itemSelector: "li",
71
+ // The class given to "body" while an item is being dragged
72
+ bodyClass: "dragging",
73
+ // The class giving to an item while being dragged
74
+ draggedClass: "dragged",
75
+ // Check if the dragged item may be inside the container.
76
+ // Use with care, since the search for a valid container entails a depth first search
77
+ // and may be quite expensive.
78
+ isValidTarget: function ($item, container) {
79
+ return true
80
+ },
81
+ // Executed before onDrop if placeholder is detached.
82
+ // This happens if pullPlaceholder is set to false and the drop occurs outside a container.
83
+ onCancel: function ($item, container, _super, event) {
84
+ },
85
+ // Executed at the beginning of a mouse move event.
86
+ // The Placeholder has not been moved yet.
87
+ onDrag: function ($item, position, _super, event) {
88
+ $item.css(position)
89
+ },
90
+ // Called after the drag has been started,
91
+ // that is the mouse button is being held down and
92
+ // the mouse is moving.
93
+ // The container is the closest initialized container.
94
+ // Therefore it might not be the container, that actually contains the item.
95
+ onDragStart: function ($item, container, _super, event) {
96
+ $item.css({
97
+ height: $item.outerHeight(),
98
+ width: $item.outerWidth()
99
+ })
100
+ $item.addClass(container.group.options.draggedClass)
101
+ $("body").addClass(container.group.options.bodyClass)
102
+ },
103
+ // Called when the mouse button is being released
104
+ onDrop: function ($item, container, _super, event) {
105
+ $item.removeClass(container.group.options.draggedClass).removeAttr("style")
106
+ $("body").removeClass(container.group.options.bodyClass)
107
+ // START MONKEY PATCH (for submitting form when heading positions are changed on touchscreen)
108
+ $item.trigger('movimento:drop:complete', $item)
109
+ // END MONKEY PATCH
110
+ },
111
+ // Called on mousedown. If falsy value is returned, the dragging will not start.
112
+ // Ignore if element clicked is input, select or textarea
113
+ onMousedown: function ($item, _super, event) {
114
+ if (!event.target.nodeName.match(/^(input|select|textarea)$/i)) {
115
+ event.preventDefault()
116
+ return true
117
+ }
118
+ },
119
+ // The class of the placeholder (must match placeholder option markup)
120
+ placeholderClass: "placeholder",
121
+ // Template for the placeholder. Can be any valid jQuery input
122
+ // e.g. a string, a DOM element.
123
+ // The placeholder must have the class "placeholder"
124
+ placeholder: '<li class="placeholder"></li>',
125
+ // If true, the position of the placeholder is calculated on every mousemove.
126
+ // If false, it is only calculated when the mouse is above a container.
127
+ pullPlaceholder: true,
128
+ // Specifies serialization of the container group.
129
+ // The pair $parent/$children is either container/items or item/subcontainers.
130
+ serialize: function ($parent, $children, parentIsContainer) {
131
+ var result = $.extend({}, $parent.data())
132
+
133
+ if(parentIsContainer)
134
+ return [$children]
135
+ else if ($children[0]){
136
+ result.children = $children
137
+ }
138
+
139
+ delete result.subContainers
140
+ delete result.sortable
141
+
142
+ return result
143
+ },
144
+ // Set tolerance while dragging. Positive values decrease sensitivity,
145
+ // negative values increase it.
146
+ tolerance: 0
147
+ }, // end group defaults
148
+ containerGroups = {},
149
+ groupCounter = 0,
150
+ emptyBox = {
151
+ left: 0,
152
+ top: 0,
153
+ bottom: 0,
154
+ right:0
155
+ },
156
+ eventNames = {
157
+ start: "touchstart.sortable mousedown.sortable",
158
+ drop: "touchend.sortable touchcancel.sortable mouseup.sortable",
159
+ drag: "touchmove.sortable mousemove.sortable",
160
+ scroll: "scroll.sortable"
161
+ },
162
+ subContainerKey = "subContainers"
163
+
164
+ /*
165
+ * a is Array [left, right, top, bottom]
166
+ * b is array [left, top]
167
+ */
168
+ function d(a,b) {
169
+ var x = Math.max(0, a[0] - b[0], b[0] - a[1]),
170
+ y = Math.max(0, a[2] - b[1], b[1] - a[3])
171
+ return x+y;
172
+ }
173
+
174
+ function setDimensions(array, dimensions, tolerance, useOffset) {
175
+ var i = array.length,
176
+ offsetMethod = useOffset ? "offset" : "position"
177
+ tolerance = tolerance || 0
178
+
179
+ while(i--){
180
+ var el = array[i].el ? array[i].el : $(array[i]),
181
+ // use fitting method
182
+ pos = el[offsetMethod]()
183
+ pos.left += parseInt(el.css('margin-left'), 10)
184
+ pos.top += parseInt(el.css('margin-top'),10)
185
+ dimensions[i] = [
186
+ pos.left - tolerance,
187
+ pos.left + el.outerWidth() + tolerance,
188
+ pos.top - tolerance,
189
+ pos.top + el.outerHeight() + tolerance
190
+ ]
191
+ }
192
+ }
193
+
194
+ function getRelativePosition(pointer, element) {
195
+ var offset = element.offset()
196
+ return {
197
+ left: pointer.left - offset.left,
198
+ top: pointer.top - offset.top
199
+ }
200
+ }
201
+
202
+ function sortByDistanceDesc(dimensions, pointer, lastPointer) {
203
+ pointer = [pointer.left, pointer.top]
204
+ lastPointer = lastPointer && [lastPointer.left, lastPointer.top]
205
+
206
+ var dim,
207
+ i = dimensions.length,
208
+ distances = []
209
+
210
+ while(i--){
211
+ dim = dimensions[i]
212
+ distances[i] = [i,d(dim,pointer), lastPointer && d(dim, lastPointer)]
213
+ }
214
+ distances = distances.sort(function (a,b) {
215
+ return b[1] - a[1] || b[2] - a[2] || b[0] - a[0]
216
+ })
217
+
218
+ // last entry is the closest
219
+ return distances
220
+ }
221
+
222
+ function ContainerGroup(options) {
223
+ this.options = $.extend({}, groupDefaults, options)
224
+ this.containers = []
225
+
226
+ if(!this.options.rootGroup){
227
+ this.scrollProxy = $.proxy(this.scroll, this)
228
+ this.dragProxy = $.proxy(this.drag, this)
229
+ this.dropProxy = $.proxy(this.drop, this)
230
+ this.placeholder = $(this.options.placeholder)
231
+
232
+ if(!options.isValidTarget)
233
+ this.options.isValidTarget = undefined
234
+ }
235
+ }
236
+
237
+ ContainerGroup.get = function (options) {
238
+ if(!containerGroups[options.group]) {
239
+ if(options.group === undefined)
240
+ options.group = groupCounter ++
241
+
242
+ containerGroups[options.group] = new ContainerGroup(options)
243
+ }
244
+
245
+ return containerGroups[options.group]
246
+ }
247
+
248
+ ContainerGroup.prototype = {
249
+ dragInit: function (e, itemContainer) {
250
+ this.$document = $(itemContainer.el[0].ownerDocument)
251
+
252
+ // get item to drag
253
+ var closestItem = $(e.target).closest(this.options.itemSelector);
254
+ // using the length of this item, prevents the plugin from being started if there is no handle being clicked on.
255
+ // this may also be helpful in instantiating multidrag.
256
+ if (closestItem.length) {
257
+ this.item = closestItem;
258
+ this.itemContainer = itemContainer;
259
+ if (this.item.is(this.options.exclude) || !this.options.onMousedown(this.item, groupDefaults.onMousedown, e)) {
260
+ return;
261
+ }
262
+ this.setPointer(e);
263
+ this.toggleListeners('on');
264
+ this.setupDelayTimer();
265
+ this.dragInitDone = true;
266
+ }
267
+ },
268
+ drag: function (e) {
269
+ if(!this.dragging){
270
+ if(!this.distanceMet(e) || !this.delayMet)
271
+ return
272
+
273
+ this.options.onDragStart(this.item, this.itemContainer, groupDefaults.onDragStart, e)
274
+ this.item.before(this.placeholder)
275
+ this.dragging = true
276
+ }
277
+
278
+ this.setPointer(e)
279
+ // place item under the cursor
280
+ this.options.onDrag(this.item,
281
+ getRelativePosition(this.pointer, this.item.offsetParent()),
282
+ groupDefaults.onDrag,
283
+ e)
284
+
285
+ var p = this.getPointer(e),
286
+ box = this.sameResultBox,
287
+ t = this.options.tolerance
288
+
289
+ if(!box || box.top - t > p.top || box.bottom + t < p.top || box.left - t > p.left || box.right + t < p.left)
290
+ if(!this.searchValidTarget()){
291
+ this.placeholder.detach()
292
+ this.lastAppendedItem = undefined
293
+ }
294
+ },
295
+ drop: function (e) {
296
+ this.toggleListeners('off')
297
+
298
+ this.dragInitDone = false
299
+
300
+ if(this.dragging){
301
+ // processing Drop, check if placeholder is detached
302
+ if(this.placeholder.closest("html")[0]){
303
+ this.placeholder.before(this.item).detach()
304
+ } else {
305
+ this.options.onCancel(this.item, this.itemContainer, groupDefaults.onCancel, e)
306
+ }
307
+ this.options.onDrop(this.item, this.getContainer(this.item), groupDefaults.onDrop, e)
308
+
309
+ // cleanup
310
+ this.clearDimensions()
311
+ this.clearOffsetParent()
312
+ this.lastAppendedItem = this.sameResultBox = undefined
313
+ this.dragging = false
314
+ }
315
+ },
316
+ searchValidTarget: function (pointer, lastPointer) {
317
+ if(!pointer){
318
+ pointer = this.relativePointer || this.pointer
319
+ lastPointer = this.lastRelativePointer || this.lastPointer
320
+ }
321
+
322
+ var distances = sortByDistanceDesc(this.getContainerDimensions(),
323
+ pointer,
324
+ lastPointer),
325
+ i = distances.length
326
+
327
+ while(i--){
328
+ var index = distances[i][0],
329
+ distance = distances[i][1]
330
+
331
+ if(!distance || this.options.pullPlaceholder){
332
+ var container = this.containers[index]
333
+ if(!container.disabled){
334
+ if(!this.$getOffsetParent()){
335
+ var offsetParent = container.getItemOffsetParent()
336
+ pointer = getRelativePosition(pointer, offsetParent)
337
+ lastPointer = getRelativePosition(lastPointer, offsetParent)
338
+ }
339
+ if(container.searchValidTarget(pointer, lastPointer))
340
+ return true
341
+ }
342
+ }
343
+ }
344
+ if(this.sameResultBox)
345
+ this.sameResultBox = undefined
346
+ },
347
+ movePlaceholder: function (container, item, method, sameResultBox) {
348
+ var lastAppendedItem = this.lastAppendedItem
349
+ if(!sameResultBox && lastAppendedItem && lastAppendedItem[0] === item[0])
350
+ return;
351
+
352
+ item[method](this.placeholder)
353
+ this.lastAppendedItem = item
354
+ this.sameResultBox = sameResultBox
355
+ this.options.afterMove(this.placeholder, container, item)
356
+ },
357
+ getContainerDimensions: function () {
358
+ if(!this.containerDimensions)
359
+ setDimensions(this.containers, this.containerDimensions = [], this.options.tolerance, !this.$getOffsetParent())
360
+ return this.containerDimensions
361
+ },
362
+ getContainer: function (element) {
363
+ return element.closest(this.options.containerSelector).data(pluginName)
364
+ },
365
+ $getOffsetParent: function () {
366
+ if(this.offsetParent === undefined){
367
+ var i = this.containers.length - 1,
368
+ offsetParent = this.containers[i].getItemOffsetParent()
369
+
370
+ if(!this.options.rootGroup){
371
+ while(i--){
372
+ if(offsetParent[0] != this.containers[i].getItemOffsetParent()[0]){
373
+ // If every container has the same offset parent,
374
+ // use position() which is relative to this parent,
375
+ // otherwise use offset()
376
+ // compare #setDimensions
377
+ offsetParent = false
378
+ break;
379
+ }
380
+ }
381
+ }
382
+
383
+ this.offsetParent = offsetParent
384
+ }
385
+ return this.offsetParent
386
+ },
387
+ setPointer: function (e) {
388
+ var pointer = this.getPointer(e)
389
+
390
+ if(this.$getOffsetParent()){
391
+ var relativePointer = getRelativePosition(pointer, this.$getOffsetParent())
392
+ this.lastRelativePointer = this.relativePointer
393
+ this.relativePointer = relativePointer
394
+ }
395
+
396
+ this.lastPointer = this.pointer
397
+ this.pointer = pointer
398
+ },
399
+ distanceMet: function (e) {
400
+ var currentPointer = this.getPointer(e)
401
+ return (Math.max(
402
+ Math.abs(this.pointer.left - currentPointer.left),
403
+ Math.abs(this.pointer.top - currentPointer.top)
404
+ ) >= this.options.distance)
405
+ },
406
+ getPointer: function(e) {
407
+ var o = e.originalEvent || e.originalEvent.touches && e.originalEvent.touches[0]
408
+ return {
409
+ left: e.pageX || o.pageX,
410
+ top: e.pageY || o.pageY
411
+ }
412
+ },
413
+ setupDelayTimer: function () {
414
+ var that = this
415
+ this.delayMet = !this.options.delay
416
+
417
+ // init delay timer if needed
418
+ if (!this.delayMet) {
419
+ clearTimeout(this._mouseDelayTimer);
420
+ this._mouseDelayTimer = setTimeout(function() {
421
+ that.delayMet = true
422
+ }, this.options.delay)
423
+ }
424
+ },
425
+ scroll: function (e) {
426
+ this.clearDimensions()
427
+ this.clearOffsetParent() // TODO is this needed?
428
+ },
429
+ toggleListeners: function (method) {
430
+ var that = this,
431
+ events = ['drag','drop','scroll']
432
+
433
+ $.each(events,function (i,event) {
434
+ that.$document[method](eventNames[event], that[event + 'Proxy'])
435
+ })
436
+ },
437
+ clearOffsetParent: function () {
438
+ this.offsetParent = undefined
439
+ },
440
+ // Recursively clear container and item dimensions
441
+ clearDimensions: function () {
442
+ this.traverse(function(object){
443
+ object._clearDimensions()
444
+ })
445
+ },
446
+ traverse: function(callback) {
447
+ callback(this)
448
+ var i = this.containers.length
449
+ while(i--){
450
+ this.containers[i].traverse(callback)
451
+ }
452
+ },
453
+ _clearDimensions: function(){
454
+ this.containerDimensions = undefined
455
+ },
456
+ _destroy: function () {
457
+ containerGroups[this.options.group] = undefined
458
+ }
459
+ }
460
+
461
+ function Container(element, options) {
462
+ this.el = element
463
+ this.options = $.extend( {}, containerDefaults, options)
464
+
465
+ this.group = ContainerGroup.get(this.options)
466
+ this.rootGroup = this.options.rootGroup || this.group
467
+ this.handle = this.rootGroup.options.handle || this.rootGroup.options.itemSelector
468
+
469
+ var itemPath = this.rootGroup.options.itemPath
470
+ this.target = itemPath ? this.el.find(itemPath) : this.el
471
+
472
+ this.target.on(eventNames.start, this.handle, $.proxy(this.dragInit, this))
473
+
474
+ if(this.options.drop)
475
+ this.group.containers.push(this)
476
+ }
477
+
478
+ Container.prototype = {
479
+ dragInit: function (e) {
480
+ var rootGroup = this.rootGroup
481
+
482
+ if( !this.disabled &&
483
+ !rootGroup.dragInitDone &&
484
+ this.options.drag &&
485
+ this.isValidDrag(e)) {
486
+ rootGroup.dragInit(e, this)
487
+ }
488
+ },
489
+ isValidDrag: function(e) {
490
+ return e.which == 1 ||
491
+ e.type == "touchstart" && e.originalEvent.touches.length == 1
492
+ },
493
+ searchValidTarget: function (pointer, lastPointer) {
494
+ var distances = sortByDistanceDesc(this.getItemDimensions(),
495
+ pointer,
496
+ lastPointer),
497
+ i = distances.length,
498
+ rootGroup = this.rootGroup,
499
+ validTarget = !rootGroup.options.isValidTarget ||
500
+ rootGroup.options.isValidTarget(rootGroup.item, this)
501
+
502
+ if(!i && validTarget){
503
+ rootGroup.movePlaceholder(this, this.target, "append")
504
+ return true
505
+ } else
506
+ while(i--){
507
+ var index = distances[i][0],
508
+ distance = distances[i][1]
509
+ if(!distance && this.hasChildGroup(index)){
510
+ var found = this.getContainerGroup(index).searchValidTarget(pointer, lastPointer)
511
+ if(found)
512
+ return true
513
+ }
514
+ else if(validTarget){
515
+ this.movePlaceholder(index, pointer)
516
+ return true
517
+ }
518
+ }
519
+ },
520
+ movePlaceholder: function (index, pointer) {
521
+ var item = $(this.items[index]),
522
+ dim = this.itemDimensions[index],
523
+ method = "after",
524
+ width = item.outerWidth(),
525
+ height = item.outerHeight(),
526
+ offset = item.offset(),
527
+ sameResultBox = {
528
+ left: offset.left,
529
+ right: offset.left + width,
530
+ top: offset.top,
531
+ bottom: offset.top + height
532
+ }
533
+ if(this.options.vertical){
534
+ var yCenter = (dim[2] + dim[3]) / 2,
535
+ inUpperHalf = pointer.top <= yCenter
536
+ if(inUpperHalf){
537
+ method = "before"
538
+ sameResultBox.bottom -= height / 2
539
+ } else
540
+ sameResultBox.top += height / 2
541
+ } else {
542
+ var xCenter = (dim[0] + dim[1]) / 2,
543
+ inLeftHalf = pointer.left <= xCenter
544
+ if(inLeftHalf){
545
+ method = "before"
546
+ sameResultBox.right -= width / 2
547
+ } else
548
+ sameResultBox.left += width / 2
549
+ }
550
+ if(this.hasChildGroup(index))
551
+ sameResultBox = emptyBox
552
+ this.rootGroup.movePlaceholder(this, item, method, sameResultBox)
553
+ },
554
+ getItemDimensions: function () {
555
+ if(!this.itemDimensions){
556
+ this.items = this.$getChildren(this.el, "item").filter(
557
+ ":not(." + this.group.options.placeholderClass + ", ." + this.group.options.draggedClass + ")"
558
+ ).get()
559
+ setDimensions(this.items, this.itemDimensions = [], this.options.tolerance)
560
+ }
561
+ return this.itemDimensions
562
+ },
563
+ getItemOffsetParent: function () {
564
+ var offsetParent,
565
+ el = this.el
566
+ // Since el might be empty we have to check el itself and
567
+ // can not do something like el.children().first().offsetParent()
568
+ if(el.css("position") === "relative" || el.css("position") === "absolute" || el.css("position") === "fixed")
569
+ offsetParent = el
570
+ else
571
+ offsetParent = el.offsetParent()
572
+ return offsetParent
573
+ },
574
+ hasChildGroup: function (index) {
575
+ return this.options.nested && this.getContainerGroup(index)
576
+ },
577
+ getContainerGroup: function (index) {
578
+ var childGroup = $.data(this.items[index], subContainerKey)
579
+ if( childGroup === undefined){
580
+ var childContainers = this.$getChildren(this.items[index], "container")
581
+ childGroup = false
582
+
583
+ if(childContainers[0]){
584
+ var options = $.extend({}, this.options, {
585
+ rootGroup: this.rootGroup,
586
+ group: groupCounter ++
587
+ })
588
+ childGroup = childContainers[pluginName](options).data(pluginName).group
589
+ }
590
+ $.data(this.items[index], subContainerKey, childGroup)
591
+ }
592
+ return childGroup
593
+ },
594
+ $getChildren: function (parent, type) {
595
+ var options = this.rootGroup.options,
596
+ path = options[type + "Path"],
597
+ selector = options[type + "Selector"]
598
+
599
+ parent = $(parent)
600
+ if(path)
601
+ parent = parent.find(path)
602
+
603
+ return parent.children(selector)
604
+ },
605
+ _serialize: function (parent, isContainer) {
606
+ var that = this,
607
+ childType = isContainer ? "item" : "container",
608
+
609
+ children = this.$getChildren(parent, childType).not(this.options.exclude).map(function () {
610
+ return that._serialize($(this), !isContainer)
611
+ }).get()
612
+
613
+ return this.rootGroup.options.serialize(parent, children, isContainer)
614
+ },
615
+ traverse: function(callback) {
616
+ $.each(this.items || [], function(item){
617
+ var group = $.data(this, subContainerKey)
618
+ if(group)
619
+ group.traverse(callback)
620
+ });
621
+
622
+ callback(this)
623
+ },
624
+ _clearDimensions: function () {
625
+ this.itemDimensions = undefined
626
+ },
627
+ _destroy: function() {
628
+ var that = this;
629
+
630
+ this.target.off(eventNames.start, this.handle);
631
+ this.el.removeData(pluginName)
632
+
633
+ if(this.options.drop)
634
+ this.group.containers = $.grep(this.group.containers, function(val){
635
+ return val != that
636
+ })
637
+
638
+ $.each(this.items || [], function(){
639
+ $.removeData(this, subContainerKey)
640
+ })
641
+ }
642
+ }
643
+
644
+ var API = {
645
+ enable: function() {
646
+ this.traverse(function(object){
647
+ object.disabled = false
648
+ })
649
+ },
650
+ disable: function (){
651
+ this.traverse(function(object){
652
+ object.disabled = true
653
+ })
654
+ },
655
+ serialize: function () {
656
+ return this._serialize(this.el, true)
657
+ },
658
+ refresh: function() {
659
+ this.traverse(function(object){
660
+ object._clearDimensions()
661
+ })
662
+ },
663
+ destroy: function () {
664
+ this.traverse(function(object){
665
+ object._destroy();
666
+ })
667
+ }
668
+ }
669
+
670
+ $.extend(Container.prototype, API)
671
+
672
+ /**
673
+ * jQuery API
674
+ *
675
+ * Parameters are
676
+ * either options on init
677
+ * or a method name followed by arguments to pass to the method
678
+ */
679
+ $.fn[pluginName] = function(methodOrOptions) {
680
+ var args = Array.prototype.slice.call(arguments, 1)
681
+
682
+ return this.map(function(){
683
+ var $t = $(this),
684
+ object = $t.data(pluginName)
685
+
686
+ if(object && API[methodOrOptions])
687
+ return API[methodOrOptions].apply(object, args) || this
688
+ else if(!object && (methodOrOptions === undefined ||
689
+ typeof methodOrOptions === "object"))
690
+ $t.data(pluginName, new Container($t, methodOrOptions))
691
+
692
+ return this
693
+ });
694
+ };
695
+
696
+ }(jQuery, window, 'sortable');