'use strict';(function(){window.Reci||(window.Reci={});window.Reci.Class||(window.Reci.Class={});window.Reci.Class.Api||(window.Reci.Class.Api={});if(!window.Reci.Class.Api.Addr){var q=window.Reci.Utils.common,z=window.Reci.Utils.form,y=window.Reci.Utils.promise;window.Reci.Class.Api.Addr=function(w){function h(l,e,t){if(!m[l])return Promise.reject(new TypeError(l+" not defined"));var r=!1;for(let b in e)if(q.asString(e[b]).length){r=!0;break}if(!r)return Promise.resolve([]);e=q.obj2Qs(e);r=m[l].search.length? "&":"?";x._call("loader.start");return A.send(m[l].href+r+e,t,{use_cache:!0}).then(b=>{if(b.json&&b.json.ret)return b.json.ret;throw{type:"fail"};}).finally(function(){x._call("loader.stop")})}w=w?w:{};const A=new window.Reci.Class.Fetch,x=this,m={};if(w.urls)for(let l of["zip_addr","addr_b","addr_c","addr_cd","addr_d"]){const e=q.asString(w.urls[l]);e.length&&(m[l]=new URL(e,location.href))}x.send=h;x.bindDom=function(l){function e(c,a,d){const f=b["opt_"+c],u="c_"+c,n=f.is("select"),k=n?f:$("#"+ f.attr("list"));n?z.removeOptionList(k,""):k.empty();for(let v=0;v").text(a[v][c]).appendTo(k);n&&B.attr("value",a[v][u]);q.equals(d,a[v][u])&&f.val(n?d:a[v][c])}return a}function t(c,a,d){const f=b["conf_"+c],u="c_"+c;let n="";for(let k=0;k").text(k.a+k.b+k.c+k.d).data("code",k.code).appendTo(f.find("ul")).click(function(){u($(this).data("code"))})}f.show()},c).finally(function(){f&& f.hide().find("ul").empty()})}throw{type:"invalid"};}).then(function(d){d=String(d);g._call("clear","zip_addr");return r({c_a:d.substr(0,2),c_b:d.substr(2,3),c_c:d.substr(5,3),c_d:d.substr(8,3),c_cd:d.substr(5,6)})}).then(function(d){g._call("done","zip_addr",{zip:a,ret:d})})}).catch(function(c){console.error(c);g._call("error","zip_addr",c)})});b.btn_zip_close&&b.btn_zip_close.on("click",function(){p.cancel("by ui")});b.opt_a&&b.opt_b&&b.opt_a.on("change",function(){return p.interruptExec(function(){e("b", [],"");b.opt_c&&e("c",[],"");b.opt_d&&e("d",[],"");b.opt_cd&&e("cd",[],"");g._call("clear","addr_b");const c=b.opt_a.val();return h("addr_b",{c_a:c}).then(function(a){return e("b",a,"")}).then(function(a){g._call("done","addr_b",{c_a:c,ret:a})})}).catch(function(c){console.error(c);g._call("error","addr_b",c)})});b.opt_a&&b.opt_b&&b.opt_c&&b.opt_b.on("change",function(){return p.interruptExec(function(){e("c",[],"");b.opt_d&&e("d",[],"");g._call("clear","addr_c");const c=b.opt_a.val(),a=b.opt_b.val(); return h("addr_c",{c_a:c,c_b:a}).then(function(d){return e("c",d,"")}).then(function(d){g._call("done","addr_c",{c_a:c,c_b:a,ret:d})})}).catch(function(c){console.error(c);g._call("error","addr_c",c)})});b.opt_a&&b.opt_b&&b.opt_cd&&b.opt_b.on("change",function(){return p.interruptExec(function(){e("cd",[],"");g._call("clear","addr_cd");const c=b.opt_a.val(),a=b.opt_b.val();return h("addr_cd",{c_a:c,c_b:a}).then(function(d){return e("cd",d,"")}).then(function(d){g._call("done","addr_cd",{c_a:c,c_b:a, ret:d})})}).catch(function(c){console.error(c);g._call("error","addr_cd",c)})});b.opt_a&&b.opt_b&&b.opt_c&&b.opt_d&&b.opt_c.on("change",function(){return p.interruptExec(function(){e("d",[],"");g._call("clear","addr_d");const c=b.opt_a.val(),a=b.opt_b.val(),d=b.opt_c.val();return h("addr_d",{c_a:c,c_b:a,c_c:d}).then(function(f){return e("d",f,"")}).then(function(f){g._call("done","addr_d",{c_a:c,c_b:a,c_c:d,ret:f})})}).catch(function(c){console.error(c);g._call("error","addr_d",c)})});return g}}; window.Reci.Class.Api.Addr.prototype=new ReciBaseUtilsClass}})();